From 2b49b22e23279d2ae7da2f0b7baf03f392204c2b Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Sat, 27 Jul 2024 16:04:50 +0200 Subject: [PATCH 1/2] Fix lint error & remove black Related to #620 Update the lint script and configuration files to fix the lint error. And remove black because ruff replace it. * **scripts/lint.sh** - Update the `ruff` command to use `ruff check` instead of `ruff`. - Remove the `black` command. * **.github/workflows/lint.yml** - Remove `black` from the `Install dependencies` step. * **.pre-commit-config.yaml** - Remove the `black` dependency. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/julien-duponchelle/python-mysql-replication/issues/620?shareId=XXXX-XXXX-XXXX-XXXX). --- .github/workflows/lint.yml | 2 +- .pre-commit-config.yaml | 5 ----- scripts/lint.sh | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 69ef8095..5e20e696 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ruff black + pip install ruff - name: Run lint script run: bash scripts/lint.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 95a94acd..4a2bf677 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,8 +12,3 @@ repos: hooks: - id: ruff args: [ --fix, --exit-non-zero-on-fix ] - -- repo: https://github.com/psf/black - rev: 23.7.0 - hooks: - - id: black diff --git a/scripts/lint.sh b/scripts/lint.sh index eee4960c..a1ce6aff 100644 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -3,5 +3,4 @@ set -e set -x -ruff pymysqlreplication -black pymysqlreplication --check +ruff check pymysqlreplication From 1574717fc73149aca6da8894a34de9ec85970c47 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Sun, 11 Aug 2024 17:38:17 +0200 Subject: [PATCH 2/2] Fix linting errors --- CHANGELOG | 4 ++++ pymysqlreplication/binlogstream.py | 2 +- pyproject.toml | 5 ++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7f8866b6..0c3f8005 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -256,3 +256,7 @@ 1.0.8 31/03/2024 * Fix parsing replications events (#614) + +1.0.9 11/08/2024 +* Fix typo in ident variable name (#619) +* Remove black and use only ruff as linter \ No newline at end of file diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 9e7befbc..0ba4ca5c 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -767,7 +767,7 @@ def __log_valid_parameters(self): parameter = parameter.replace("_BinLogStreamReader__", "") if parameter in ignored or not value: continue - if type(value) == frozenset: + if value is frozenset: string_list = [ str(item).split()[-1][:-2].split(".")[2] for item in value ] diff --git a/pyproject.toml b/pyproject.toml index 033760f5..638c65c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,8 @@ [tool.ruff] -ignore = [ - "E501", # Line too long, handled by black +lint.ignore = [ "F403", # from module import *' used, It should be removed afterwad "F405", # same to F403 ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"]