From 1a42c5030b7e18bff087da84c86b33136845bde4 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 16 Sep 2020 12:50:34 +0200 Subject: [PATCH 1/4] update versions of linters --- .pre-commit-config.yaml | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e4a13f..a761cdb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,32 +1,32 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-docstring-first - - id: check-yaml - - id: debug-statements - - id: check-ast -- repo: https://github.com/ambv/black - rev: 19.10b0 - hooks: - - id: black -- repo: https://github.com/asottile/blacken-docs - rev: v1.8.0 - hooks: - - id: blacken-docs - additional_dependencies: [black==19.10b0] -- repo: https://github.com/asottile/pyupgrade - rev: v1.25.2 - hooks: - - id: pyupgrade - args: ['--py36-plus'] -- repo: https://github.com/timothycrosley/isort - rev: 5.4.2 - hooks: - - id: isort -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 - hooks: - - id: flake8 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-docstring-first + - id: check-yaml + - id: debug-statements + - id: check-ast + - repo: https://github.com/ambv/black + rev: 20.8b1 + hooks: + - id: black + - repo: https://github.com/asottile/blacken-docs + rev: v1.8.0 + hooks: + - id: blacken-docs + additional_dependencies: [black==20.8b1] + - repo: https://github.com/asottile/pyupgrade + rev: v2.7.2 + hooks: + - id: pyupgrade + args: ['--py37-plus'] + - repo: https://github.com/timothycrosley/isort + rev: 5.5.2 + hooks: + - id: isort + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.3 + hooks: + - id: flake8 From 26445ac20e1676fcca788308e592afdca3d092e8 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 16 Sep 2020 13:04:37 +0200 Subject: [PATCH 2/4] run pre-commit filters --- demo.py | 6 +++--- miflora/miflora_poller.py | 4 +--- setup.py | 2 +- test/helper.py | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/demo.py b/demo.py index 2a5c322..242c549 100755 --- a/demo.py +++ b/demo.py @@ -35,8 +35,8 @@ def poll(args): backend = _get_backend(args) poller = MiFloraPoller(args.mac, backend) print("Getting data from Mi Flora") - print("FW: {}".format(poller.firmware_version())) - print("Name: {}".format(poller.name())) + print(f"FW: {poller.firmware_version()}") + print(f"Name: {poller.name()}") print("Temperature: {}".format(poller.parameter_value(MI_TEMPERATURE))) print("Moisture: {}".format(poller.parameter_value(MI_MOISTURE))) print("Light: {}".format(poller.parameter_value(MI_LIGHT))) @@ -106,7 +106,7 @@ def main(): "--backend", choices=["gatttool", "bluepy", "pygatt"], default="gatttool" ) parser.add_argument("-v", "--verbose", action="store_const", const=True) - subparsers = parser.add_subparsers(help="sub-command help",) + subparsers = parser.add_subparsers(help="sub-command help") parser_poll = subparsers.add_parser("poll", help="poll data from a sensor") parser_poll.add_argument("mac", type=valid_miflora_mac) diff --git a/miflora/miflora_poller.py b/miflora/miflora_poller.py index 86f9f5d..93a5937 100644 --- a/miflora/miflora_poller.py +++ b/miflora/miflora_poller.py @@ -49,9 +49,7 @@ def format_bytes(raw_data): class MiFloraPoller: - """" - A class to read data from Mi Flora plant sensors. - """ + """A class to read data from Mi Flora plant sensors.""" def __init__(self, mac, backend, cache_timeout=600, adapter="hci0"): """ diff --git a/setup.py b/setup.py index 0d51428..8d9c8f4 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def readme(): """Load the readme file.""" - with open("README.md", "r") as readme_file: + with open("README.md") as readme_file: return readme_file.read() diff --git a/test/helper.py b/test/helper.py index fc234a4..4d9c141 100644 --- a/test/helper.py +++ b/test/helper.py @@ -169,7 +169,7 @@ def _read_history(self): if self.history_data is None: raise ValueError("history not set") - (cmd, index,) = unpack(" Date: Wed, 16 Sep 2020 13:09:00 +0200 Subject: [PATCH 3/4] add .github/workflows/automerge.yml --- .github/workflows/automerge.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..a119e08 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,27 @@ +name: automerge +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - name: automerge + uses: "pascalgn/automerge-action@f81beb99aef41bb55ad072857d43073fba833a98" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 3f2475c917a3631cf0f5ef3497eeba3eca825e97 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 16 Sep 2020 13:14:21 +0200 Subject: [PATCH 4/4] add maintainer in setup --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 8d9c8f4..d25e98b 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,8 @@ def get_version_and_cmdclass(package_path): url="https://github.com/basnijholt/miflora", author="Daniel Matuschek", author_email="daniel@matuschek.net", + maintainer="Bas Nijholt", + maintainer_email="bas@nijho.lt", license="MIT", python_requires=">=3.6", classifiers=[