From adb1c362155b2fe6123c428ff102853f4d66def4 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Wed, 2 Mar 2022 06:19:33 +0300 Subject: [PATCH] black integration --- .github/workflows/black.yaml | 12 ++++++++++++ pyproject.toml | 4 ++++ setup.cfg | 3 ++- src/borg/constants.py | 6 +++++- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/black.yaml diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 000000000..29e2b6d0e --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,12 @@ +# https://black.readthedocs.io/en/stable/integrations/github_actions.html#usage + +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: psf/black@stable diff --git a/pyproject.toml b/pyproject.toml index 9261fbe8b..2a4838472 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,3 +4,7 @@ build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "src/borg/_version.py" + +[tool.black] +line-length = 120 +skip-magic-trailing-comma = true diff --git a/setup.cfg b/setup.cfg index 6e6e70c6c..0f7939da2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -106,7 +106,8 @@ markers = # W504 line break after binary operator # borg code style guidelines: -ignore = E226, W503 +# Ignoring E203 due to https://github.com/PyCQA/pycodestyle/issues/373 +ignore = E226, W503, E203 # Code style violation exceptions: # please note that the values are adjusted so that they do not cause failures diff --git a/src/borg/constants.py b/src/borg/constants.py index 19f9ba7f0..ff7840299 100644 --- a/src/borg/constants.py +++ b/src/borg/constants.py @@ -1,18 +1,22 @@ # this set must be kept complete, otherwise the RobustUnpacker might malfunction: +# fmt: off ITEM_KEYS = frozenset(['path', 'source', 'rdev', 'chunks', 'chunks_healthy', 'hardlink_master', 'hlid', 'mode', 'user', 'group', 'uid', 'gid', 'mtime', 'atime', 'ctime', 'birthtime', 'size', 'xattrs', 'bsdflags', 'acl_nfs4', 'acl_access', 'acl_default', 'acl_extended', 'part']) +# fmt: on # this is the set of keys that are always present in items: REQUIRED_ITEM_KEYS = frozenset(['path', 'mtime', ]) # this set must be kept complete, otherwise rebuild_manifest might malfunction: +# fmt: off ARCHIVE_KEYS = frozenset(['version', 'name', 'items', 'cmdline', 'hostname', 'username', 'time', 'time_end', 'comment', 'chunker_params', 'recreate_cmdline', 'recreate_source_id', 'recreate_args', 'recreate_partial_chunks', # used in 1.1.0b1 .. b2 - 'size', 'nfiles', 'size_parts', 'nfiles_parts', ]) + 'size', 'nfiles', 'size_parts', 'nfiles_parts']) +# fmt: on # this is the set of keys that are always present in archives: REQUIRED_ARCHIVE_KEYS = frozenset(['version', 'name', 'items', 'cmdline', 'time', ])