From 6d51d6ed61484161f3952571968343179461325f Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 3 Jul 2024 15:19:16 -0400 Subject: [PATCH 1/6] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 46843b0..f3c1c2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,3 +129,10 @@ select = [ "W", # pycodestyle warnings - https://beta.ruff.rs/docs/rules/#warning-w "I001", # isort ] + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git*,*.css' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From 26337e0cb4d8d4f03f162c7152e7caffb2eb3fb4 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 3 Jul 2024 15:19:16 -0400 Subject: [PATCH 2/6] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bc9f00..2ecafe9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,3 +21,11 @@ repos: language: system entry: ruff types: [python] + + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in pyproject.toml + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli From 07eab433cb7893384609d53d5ccaf9cf385b1bca Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 3 Jul 2024 15:21:46 -0400 Subject: [PATCH 3/6] Ignore "implementors" from codespell -- used in legit URL and overall is questionable --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f3c1c2c..06ededa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,4 +135,4 @@ select = [ skip = '.git*,*.css' check-hidden = true # ignore-regex = '' -# ignore-words-list = '' +ignore-words-list = 'implementors' From de49992ebdc35436c7f5a966cf9ee6be8a42fda2 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 3 Jul 2024 15:21:48 -0400 Subject: [PATCH 4/6] [DATALAD RUNCMD] run codespell throughout fixing typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- CONTRIBUTING.rst | 2 +- Dockerfile | 2 +- docs/explanations/folders.rst | 2 +- docs/explanations/notes.rst | 2 +- pyproject.toml | 2 +- src/gphotos_sync/Checks.py | 4 ++-- src/gphotos_sync/GoogleAlbumsSync.py | 2 +- src/gphotos_sync/__main__.py | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 90de195..8c99991 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -39,7 +39,7 @@ on your workstation as follows:: In both cases tox -p runs in parallel the following checks: - - Buiild Spinx Documentation + - Build Spinx Documentation - run pytest on all tests in ./tests - run mypy linting on all files in ./src ./tests - run pre-commit checks: diff --git a/Dockerfile b/Dockerfile index 192d44a..a128841 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN pip install ${PIP_OPTIONS} FROM python:3.11-slim as runtime -# Add apt-get system dependecies for runtime here if needed +# Add apt-get system dependencies for runtime here if needed # copy the virtual environment from the build stage and put it in PATH COPY --from=build /venv/ /venv/ diff --git a/docs/explanations/folders.rst b/docs/explanations/folders.rst index 49e943f..c67209b 100644 --- a/docs/explanations/folders.rst +++ b/docs/explanations/folders.rst @@ -22,7 +22,7 @@ albums: folder. The folder names will be 'albums/YYYY/MM Original Album Name'. Note that these are the default layouts and you can change what is downloaded -and how it is layed out with command line options. See the help for details:: +and how it is laid out with command line options. See the help for details:: gphotos-sync --help diff --git a/docs/explanations/notes.rst b/docs/explanations/notes.rst index 31d9787..d9258b1 100644 --- a/docs/explanations/notes.rst +++ b/docs/explanations/notes.rst @@ -13,5 +13,5 @@ Google Photos Library in the cloud. There are two primary reasons for this: - Even if the API allowed it, this would be a very hard problem, because it is often hard to identify if a local photo or video matches one in the - cloud. Besides this, I would not want the resposibility of potentially + cloud. Besides this, I would not want the responsibility of potentially trashing someone's photo collection. diff --git a/pyproject.toml b/pyproject.toml index 06ededa..a8b92f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ filterwarnings = [ "error", "ignore:.*socket.*:ResourceWarning", # this deprecation is rather serious for gphotos-sync as it relies on sqlite - # doing date conversion quite heavily - will ignore the deprection for now + # doing date conversion quite heavily - will ignore the deprecation for now # DeprecationWarning: The default datetime adapter is deprecated as of Python 3.12; "ignore:.*sqlite3.*:DeprecationWarning:", # like the above diff --git a/src/gphotos_sync/Checks.py b/src/gphotos_sync/Checks.py index 6cdf98e..862d5c0 100644 --- a/src/gphotos_sync/Checks.py +++ b/src/gphotos_sync/Checks.py @@ -130,7 +130,7 @@ def _get_max_path_length(self) -> int: except BaseException: # for failures choose a safe size for Windows filesystems log.info( - f"cant determine max filepath length, defaulting to " f"{max_length}" + f"can't determine max filepath length, defaulting to " f"{max_length}" ) log.info("Max Path Length: %d" % max_length) return max_length @@ -145,7 +145,7 @@ def _get_max_filename_length(self) -> int: # for failures choose a safe size for Windows filesystems max_filename = 248 log.info( - f"cant determine max filename length, " f"defaulting to {max_filename}" + f"can't determine max filename length, " f"defaulting to {max_filename}" ) log.info("Max filename length: %d" % max_filename) return max_filename diff --git a/src/gphotos_sync/GoogleAlbumsSync.py b/src/gphotos_sync/GoogleAlbumsSync.py index 3baa5ca..fcd1576 100644 --- a/src/gphotos_sync/GoogleAlbumsSync.py +++ b/src/gphotos_sync/GoogleAlbumsSync.py @@ -376,7 +376,7 @@ def create_album_content_links(self): follow_symlinks=False, ) except PermissionError: - log.debug(f"cant set date on {link_file}") + log.debug(f"can't set date on {link_file}") except FileExistsError as err: log.info("duplicate link to %s: %s", full_file_name, err) diff --git a/src/gphotos_sync/__main__.py b/src/gphotos_sync/__main__.py index 812e0e2..866a7b9 100644 --- a/src/gphotos_sync/__main__.py +++ b/src/gphotos_sync/__main__.py @@ -76,7 +76,7 @@ def __init__(self): "--conf", action="store", help="use the .ini configuration file to initialise arguments. " - "Command line provided arguments will superceed the ones in the config file", + "Command line provided arguments will supersede the ones in the config file", ) parser.add_argument( "root_folder", @@ -286,7 +286,7 @@ def __init__(self): ) parser.add_argument( "--max-filename", - help="Set the maxiumum filename length for target filesystem." + help="Set the maximum filename length for target filesystem." "This overrides the automatic detection.", default=0, ) From 551c44ce9f4156df4be11381e2f237dfd8cff25d Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sat, 13 Jul 2024 22:13:18 +0100 Subject: [PATCH 5/6] fix ruff invocation --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ecafe9..67e7afa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,13 +19,13 @@ repos: name: Run ruff stages: [commit] language: system - entry: ruff + entry: ruff check types: [python] - repo: https://github.com/codespell-project/codespell # Configuration for codespell is in pyproject.toml rev: v2.2.6 hooks: - - id: codespell - additional_dependencies: - - tomli + - id: codespell + additional_dependencies: + - tomli From fc5f61c4b989036480bf54ae314151cee8390b1f Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sat, 13 Jul 2024 22:17:23 +0100 Subject: [PATCH 6/6] fix lint error --- tests/test_units/test_errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_units/test_errors.py b/tests/test_units/test_errors.py index 5b92ec7..7128ec6 100644 --- a/tests/test_units/test_errors.py +++ b/tests/test_units/test_errors.py @@ -66,7 +66,7 @@ def test_authorize(self, local_server, authorized_session): bad_file.unlink() with pytest.raises(SystemExit) as test_wrapped_e: a = auth.Authorize(scope, bad_file, bad_file) - assert test_wrapped_e.type == SystemExit + assert test_wrapped_e.type is SystemExit a = auth.Authorize(scope, bad_file, secrets_file) res = a.load_token()