Skip to content

Commit c742318

Browse files
committed
pre-commit: add mdformat and run it
1 parent 23c6dcc commit c742318

File tree

5 files changed

+109
-90
lines changed

5 files changed

+109
-90
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
---
2-
name: Bug report
3-
about: Create a report to help us improve
4-
title: ''
5-
labels: bug
1+
______________________________________________________________________
2+
3+
name: Bug report about: Create a report to help us improve title: '' labels: bug
64
assignees: ''
75

8-
---
6+
______________________________________________________________________
97

108
## Describe the bug
119

@@ -16,8 +14,8 @@ A clear and concise description of what the bug is.
1614
Steps to reproduce the behaviour:
1715

1816
1. Use this code '...'
19-
2. Do the following '....'
20-
3. See error
17+
1. Do the following '....'
18+
1. See error
2119

2220
## Expected behaviour
2321

@@ -29,9 +27,9 @@ If applicable, add screenshots to help explain your problem.
2927

3028
## Environment (please complete the following information)
3129

32-
- OS: [e.g. Linux / Windows / macOS / etc.]
33-
- python version: [get by running: `python --version`]
34-
- readchar version: [get by running: `pip show readchar`]
30+
- OS: \[e.g. Linux / Windows / macOS / etc.\]
31+
- python version: \[get by running: `python --version`\]
32+
- readchar version: \[get by running: `pip show readchar`\]
3533

3634
## Additional context
3735

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
---
2-
name: Feature request
3-
about: Suggest an idea for this project
4-
title: ''
5-
labels: enhancement
6-
assignees: ''
1+
______________________________________________________________________
72

8-
---
3+
name: Feature request about: Suggest an idea for this project title: '' labels:
4+
enhancement assignees: ''
5+
6+
______________________________________________________________________
97

108
## Is your feature request related to a problem? Please describe.
119

12-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when
11+
\[...\]
1312

1413
## Describe the solution you'd like
1514

1615
A clear and concise description of what you want to happen.
1716

1817
## Describe alternatives you've considered
1918

20-
A clear and concise description of any alternative solutions or features you've considered.
19+
A clear and concise description of any alternative solutions or features you've
20+
considered.
2121

2222
## Additional context
2323

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ repos:
3737
id: setup-cfg-fmt
3838
args: [--include-version-classifiers]
3939

40+
- repo: https://github.com/executablebooks/mdformat
41+
rev: 0.7.15
42+
hooks:
43+
- id: mdformat
44+
args: [--wrap=88]
45+
additional_dependencies:
46+
- mdformat-gfm
47+
4048
- repo: https://github.com/adrienverge/yamllint
4149
rev: v1.27.1
4250
hooks:

CONTRIBUTING.md

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
44

5-
The following is a set of guidelines for contributing to this GitHub project. These are mostly guidelines, not rules. Use your best judgment, and feel
6-
free to propose changes to this document in a pull request.
5+
The following is a set of guidelines for contributing to this GitHub project. These are
6+
mostly guidelines, not rules. Use your best judgment, and feel free to propose changes
7+
to this document in a pull request.
78

89
## Opening an issue
910

10-
If you want to open an issue about a problem or bug you encountered, simply go to the GitHub page and click _New issue_ in the _issues_ section. You
11-
will be presented with templates to use, choose a relevant one. (If no template fits, you can open a blank issue. But make sure you input all the
12-
appropriate information!)
11+
If you want to open an issue about a problem or bug you encountered, simply go to the
12+
GitHub page and click _New issue_ in the _issues_ section. You will be presented with
13+
templates to use, choose a relevant one. (If no template fits, you can open a blank
14+
issue. But make sure you input all the appropriate information!)
1315

1416
Fill out the template. You should at least provide the following information:
1517

@@ -26,64 +28,70 @@ Follow these steps if you want to contribute code to the project:
2628

2729
1. Fork this Git repository and create your branch from `master`.
2830

29-
2. Check out the code to your local machine by following the steps in [Getting the code](#getting-the-code) and make your changes.
31+
1. Check out the code to your local machine by following the steps in
32+
[Getting the code](#getting-the-code) and make your changes.
3033

31-
3. **Make sure the tests pass!!**
34+
1. **Make sure the tests pass!!**
3235

33-
4. If you added to the source code, add tests for your new code.
36+
1. If you added to the source code, add tests for your new code.
3437

35-
5. Update the documentation, if necessary.
38+
1. Update the documentation, if necessary.
3639

37-
6. Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), if you have multiple changes, make sure your
38-
commits are atomic (single irreducible change that makes sense on its own)
40+
1. Write a
41+
[good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
42+
if you have multiple changes, make sure your commits are atomic (single irreducible
43+
change that makes sense on its own)
3944

40-
7. Done, you can open a pull request.
45+
1. Done, you can open a pull request.
4146

4247
## Getting the code
4348

44-
If you want to experiment with the code yourself, you can get started by following these steps.
49+
If you want to experiment with the code yourself, you can get started by following these
50+
steps.
4551

4652
1. Clone the repository.
4753

48-
```bash
49-
git clone https://github.com/magmax/python-readchar.git
50-
```
54+
```bash
55+
git clone https://github.com/magmax/python-readchar.git
56+
```
5157

52-
2. Create a virtual environment:
58+
1. Create a virtual environment:
5359

54-
```bash
55-
python -m venv .venv
56-
```
60+
```bash
61+
python -m venv .venv
62+
```
5763

58-
3. Enter the virtual environment
64+
1. Enter the virtual environment
5965

60-
on Linux systems:
66+
on Linux systems:
6167

62-
```bash
63-
source .venv/bin/activate
64-
```
68+
```bash
69+
source .venv/bin/activate
70+
```
6571

66-
or for Windows systems:
72+
or for Windows systems:
6773

68-
```bash
69-
.venv\Scripts\activate
70-
```
74+
```bash
75+
.venv\Scripts\activate
76+
```
7177

72-
4. Install dependencies
78+
1. Install dependencies
7379

74-
```bash
75-
pip install -r requirements.txt
76-
```
80+
```bash
81+
pip install -r requirements.txt
82+
```
7783

78-
5. Install the local version of readchar (in edit mode, so it automatically reflects changes)
84+
1. Install the local version of readchar (in edit mode, so it automatically reflects
85+
changes)
7986

80-
```bash
81-
pip install -e .
82-
```
87+
```bash
88+
pip install -e .
89+
```
8390

8491
### Run the tests!
8592

86-
Always make sure all tests pass before suggesting any changes! This will avoid invalid PR's.
93+
Always make sure all tests pass before suggesting any changes! This will avoid invalid
94+
PR's.
8795

8896
The simplest way is to just run `make`. The provided makefile calls all tests for you.
8997

@@ -95,18 +103,18 @@ If you don't have `make`, you could run all tests manually like this:
95103

96104
- run `pytest` (source-code testing)
97105

98-
```bash
99-
pytest
100-
```
106+
```bash
107+
pytest
108+
```
101109

102110
- run `pre-commit` (linting and styling)
103111

104-
```bash
105-
pre-commit run -a
106-
```
112+
```bash
113+
pre-commit run -a
114+
```
107115

108116
- run `setup.py` (to test build process)
109117

110-
```bash
111-
python setup.py sdist bdist_wheel
112-
```
118+
```bash
119+
python setup.py sdist bdist_wheel
120+
```

README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Library to easily read single chars and keystrokes.
1212

1313
Born as a [python-inquirer](https://github.com/magmax/python-inquirer) requirement.
1414

15-
1615
## Installation
1716

1817
simply install it via `pip`:
@@ -23,7 +22,6 @@ pip install readchar
2322

2423
Or download the source code from [PyPi](https://pypi.python.org/pypi/readchar).
2524

26-
2725
## Usage
2826

2927
Simply read a character or keystroke:
@@ -49,21 +47,22 @@ while True:
4947
break
5048
```
5149

52-
5350
## Documentation
5451

5552
There are just two methods:
5653

5754
### `readchar.readchar() -> str`
5855

59-
Reads one character from `stdin`, returning it as a string with length 1. Waits until a character is available.
56+
Reads one character from `stdin`, returning it as a string with length 1. Waits until a
57+
character is available.
6058

61-
As only ASCII characters are actually a single character, you usually want to use the next function, that also handles longer keys.
59+
As only ASCII characters are actually a single character, you usually want to use the
60+
next function, that also handles longer keys.
6261

6362
### `readchar.readkey() -> str`
6463

65-
Reads the next keystroke from `stdin`, returning it as a string. Waits
66-
until a keystroke is available.
64+
Reads the next keystroke from `stdin`, returning it as a string. Waits until a keystroke
65+
is available.
6766

6867
A keystroke can be:
6968

@@ -72,24 +71,28 @@ A keystroke can be:
7271
- special characters like <kbd>ENTER</kbd>, <kbd>BACKSPACE</kbd>, <kbd>TAB</kbd>,...
7372
- combinations with <kbd>CTRL</kbd>: <kbd>CTRL</kbd>+<kbd>A</kbd>,...
7473
- keys that are made up of multiple characters:
75-
- characters for cursors/arrows: <kbd>🡩</kbd>, <kbd>🡪</kbd>, <kbd>🡫</kbd>, <kbd>🡨</kbd>
74+
- characters for cursors/arrows: <kbd>🡩</kbd>, <kbd>🡪</kbd>, <kbd>🡫</kbd>,
75+
<kbd>🡨</kbd>
7676
- navigation keys: <kbd>INSERT</kbd>, <kbd>HOME</kbd>,...
7777
- function keys: <kbd>F1</kbd> to <kbd>F12</kbd>
7878
- combinations with <kbd>ALT</kbd>: <kbd>ALT</kbd>+<kbd>A</kbd>,...
79-
- combinations with <kbd>CTRL</kbd> and <kbd>ALT</kbd>: <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>SUPR</kbd>,...
79+
- combinations with <kbd>CTRL</kbd> and <kbd>ALT</kbd>:
80+
<kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>SUPR</kbd>,...
8081

81-
> **Note**
82-
> <kbd>CTRL</kbd>+<kbd>C</kbd> will not be returned by `readkey()`, but instead raise a `KeyboardInterupt`. If you what to handle it yourself, use `readchar()`.
82+
> **Note** <kbd>CTRL</kbd>+<kbd>C</kbd> will not be returned by `readkey()`, but instead
83+
> raise a `KeyboardInterupt`. If you what to handle it yourself, use `readchar()`.
8384
8485
### `readchar.key` module
8586

86-
This submodule contains a list of available keys to compare against. The constants are defined depending on your operating system, so it should be
87-
fully portable. If a key is listed here for your platform, `readkey()` can read it, and you can compare against it.
87+
This submodule contains a list of available keys to compare against. The constants are
88+
defined depending on your operating system, so it should be fully portable. If a key is
89+
listed here for your platform, `readkey()` can read it, and you can compare against it.
8890

8991
### `readchar.config` class
9092

91-
This static class contains configurations for `readchar`. It holds constants that are used in other parts of the code as class attributes. You can
92-
override/change these to modify its behaviour. Here is a description of the existing attributes:
93+
This static class contains configurations for `readchar`. It holds constants that are
94+
used in other parts of the code as class attributes. You can override/change these to
95+
modify its behaviour. Here is a description of the existing attributes:
9396

9497
<dl>
9598
<dt><code>INTERRUPT_KEYS</code></dt>
@@ -101,7 +104,6 @@ List of keys that will result in `readkey()` raising a `KeyboardInterrupt`. <br>
101104
</dd>
102105
</dl>
103106

104-
105107
## OS Support
106108

107109
This library actively supports these operating systems:
@@ -114,18 +116,21 @@ Some operating systems are enabled, but not actively tested or supported:
114116
- macOS
115117
- FreeBSD
116118

117-
Theoretically every Unix based system should work, but they will not be actively tested. It is also required that somebody provides initial test
118-
results before the OS is enabled and added to the list. Feel free to open a PR for that.
119+
Theoretically every Unix based system should work, but they will not be actively tested.
120+
It is also required that somebody provides initial test results before the OS is enabled
121+
and added to the list. Feel free to open a PR for that.
119122

120123
Thank you!
121124

122-
123125
## How to contribute
124126

125-
You have an issue problem or found a bug? You have a great new idea or just want to fix a typo? Great :+1:. We are happy to accept your issue or pull
126-
request, but first, please read our [contribution guidelines](https://github.com/magmax/python-readchar/blob/master/CONTRIBUTING.md). They will also
127-
tell you how to write code for this repo and how to properly prepare an issue or a pull request.
127+
You have an issue problem or found a bug? You have a great new idea or just want to fix
128+
a typo? Great :+1:. We are happy to accept your issue or pull request, but first, please
129+
read our
130+
[contribution guidelines](https://github.com/magmax/python-readchar/blob/master/CONTRIBUTING.md).
131+
They will also tell you how to write code for this repo and how to properly prepare an
132+
issue or a pull request.
128133

129-
-----
134+
______________________________________________________________________
130135

131136
*Copyright (c) 2014-2022 Miguel Ángel García*

0 commit comments

Comments
 (0)