Skip to content

Commit ece56e0

Browse files
authored
Merge pull request magmax#72 from magmax/update
Update
2 parents 7d60cbf + c8c9d5c commit ece56e0

12 files changed

+163
-166
lines changed

.github/workflows/pre-commit.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: pre-commit
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-python@v2
18+
- uses: pre-commit/[email protected]

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
# This workflow will upload a Python Package using Twine when a release is
3+
# created
4+
# For more information see:
5+
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
6+
7+
name: Upload Python Package
8+
9+
on:
10+
release:
11+
types: [created]
12+
13+
jobs:
14+
deploy:
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: 3.x
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install setuptools wheel twine
28+
- name: Build and publish
29+
env:
30+
TWINE_USERNAME: __token__
31+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
32+
run: |
33+
python setup.py sdist bdist_wheel
34+
twine upload dist/*

.github/workflows/python-publish.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/python-test.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/run-tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
# This workflow will install Python dependencies, run tests and lint with a
3+
# variety of Python versions
4+
# For more information see:
5+
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
6+
7+
name: Python package
8+
9+
on:
10+
push:
11+
branches:
12+
- master
13+
pull_request:
14+
branches:
15+
- master
16+
17+
jobs:
18+
build:
19+
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
python-version:
24+
- "3.5"
25+
- "3.6"
26+
- "3.7"
27+
- "3.8"
28+
- "3.9"
29+
- "3.10"
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v2
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
python -m pip install -r requirements-test.txt
41+
- name: Test with pytest
42+
run: |
43+
pytest

.pre-commit-config.yaml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1+
---
12
repos:
2-
- repo: https://github.com/PyCQA/isort.git
3-
rev: 5.7.0
3+
- repo: https://github.com/adrienverge/yamllint
4+
rev: v1.26.3
45
hooks:
5-
- id: isort
6+
- name: check YAML format
7+
id: yamllint
68
- repo: https://github.com/psf/black
7-
rev: 20.8b1
9+
rev: 22.1.0
810
hooks:
9-
- id: black
10-
language_version: python3
11-
args:
12-
- -l
13-
- "119"
11+
- name: re-format with black
12+
id: black
13+
language_version: python3
14+
15+
- repo: https://github.com/pre-commit/pre-commit-hooks
16+
rev: v4.1.0
17+
hooks:
18+
- name: remove whitespaces
19+
id: trailing-whitespace
20+
1421
- repo: https://gitlab.com/pycqa/flake8
15-
rev: 6de8252c035844f1e679f509b5f37340b44d5c39
22+
rev: 21d3c70d676007470908d39b73f0521d39b3b997
1623
hooks:
17-
- id: flake8
24+
- name: check-format with flake8
25+
id: flake8
26+
args:
27+
- --show-source
28+
- --statistics
29+
- --count
30+
- --max-complexity=12

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.yamllint.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: default
2+
3+
rules:
4+
truthy:
5+
ignore: |
6+
.github/workflows/*
7+
indentation:
8+
spaces: 2

Makefile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
all: flakes test
1+
all: precommit test
22

33
test:
44
python setup.py test
55

6-
analysis:: flakes
7-
8-
flakes:
9-
@echo Searching for static errors...
10-
@flake8 --statistics --count readchar
11-
12-
coveralls::
13-
coveralls
6+
precommit::
7+
pre-commit run -a
148

159
publish:
1610
@python setup.py bdist_wheel upload

readchar/key.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@
88
ESC = "\x1b"
99

1010
# CTRL
11-
CTRL_A = '\x01'
12-
CTRL_B = '\x02'
13-
CTRL_C = '\x03'
14-
CTRL_D = '\x04'
15-
CTRL_E = '\x05'
16-
CTRL_F = '\x06'
17-
CTRL_G = '\x07'
18-
CTRL_H = '\x08'
19-
CTRL_I = '\t'
20-
CTRL_J = '\n'
21-
CTRL_K = '\x0b'
22-
CTRL_L = '\x0c'
23-
CTRL_M = '\r'
24-
CTRL_N = '\x0e'
25-
CTRL_O = '\x0f'
26-
CTRL_P = '\x10'
27-
CTRL_Q = '\x11'
28-
CTRL_R = '\x12'
29-
CTRL_S = '\x13'
30-
CTRL_T = '\x14'
31-
CTRL_U = '\x15'
32-
CTRL_V = '\x16'
33-
CTRL_W = '\x17'
34-
CTRL_X = '\x18'
35-
CTRL_Y = '\x19'
36-
CTRL_Z = '\x1a'
11+
CTRL_A = "\x01"
12+
CTRL_B = "\x02"
13+
CTRL_C = "\x03"
14+
CTRL_D = "\x04"
15+
CTRL_E = "\x05"
16+
CTRL_F = "\x06"
17+
CTRL_G = "\x07"
18+
CTRL_H = "\x08"
19+
CTRL_I = "\t"
20+
CTRL_J = "\n"
21+
CTRL_K = "\x0b"
22+
CTRL_L = "\x0c"
23+
CTRL_M = "\r"
24+
CTRL_N = "\x0e"
25+
CTRL_O = "\x0f"
26+
CTRL_P = "\x10"
27+
CTRL_Q = "\x11"
28+
CTRL_R = "\x12"
29+
CTRL_S = "\x13"
30+
CTRL_T = "\x14"
31+
CTRL_U = "\x15"
32+
CTRL_V = "\x16"
33+
CTRL_W = "\x17"
34+
CTRL_X = "\x18"
35+
CTRL_Y = "\x19"
36+
CTRL_Z = "\x1a"
3737

3838
# ALT
3939
ALT_A = "\x1b\x61"

readchar/readchar.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
20960: key.PAGE_DOWN,
5454
18400: key.HOME,
5555
20448: key.END,
56-
18432: key.UP, # 72 * 256
57-
20480: key.DOWN, # 80 * 256
58-
19200: key.LEFT, # 75 * 256
59-
19712: key.RIGHT, # 77 * 256
56+
18432: key.UP, # 72 * 256
57+
20480: key.DOWN, # 80 * 256
58+
19200: key.LEFT, # 75 * 256
59+
19712: key.RIGHT, # 77 * 256
6060
}
6161

6262
def readkey(getchar_fn=None):
@@ -79,7 +79,6 @@ def readkey(getchar_fn=None):
7979
else:
8080
return ch.decode()
8181

82-
8382
else:
8483

8584
def readkey(getchar_fn=None):

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
from setuptools import find_packages, setup
88
from setuptools.command.test import test as TestCommand
99

10-
version = "2.0.1"
1110
github_ref = os.getenv("GITHUB_REF")
1211
if github_ref and github_ref.startswith("refs/tags"):
1312
version = github_ref[10:]
13+
else:
14+
version = "0.0.0-local"
1415

1516

1617
def read_description():
@@ -81,7 +82,5 @@ def run_tests(self):
8182
"wheel",
8283
],
8384
install_requires=[],
84-
setup_requires=[
85-
"flake8",
86-
],
85+
setup_requires=[],
8786
)

0 commit comments

Comments
 (0)