From 2426c5bbd7d6c3f2b6f348e7bef9e140ce8f1cbd Mon Sep 17 00:00:00 2001 From: esc Date: Tue, 16 Apr 2024 16:10:28 +0200 Subject: [PATCH 1/3] update pre-commit tools using pre-commit autoupdate As title --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index da51c7d..5685c38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,37 +5,37 @@ exclude: | repos: # Checks for debug statements and merge conflicts - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: debug-statements - id: check-merge-conflict # Pyupgrade: upgrades older python syntax to newer one - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.2 hooks: - id: pyupgrade args: ["--py38-plus"] # Black - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 24.4.0 hooks: - id: black language_version: python3 args: ["--line-length=79"] # Autoflake: removes unused imports and variables - - repo: https://github.com/humitos/mirrors-autoflake.git - rev: v1.1 + - repo: https://github.com/pycqa/autoflake + rev: v2.3.1 hooks: - id: autoflake args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] # Manual Linting: Flake 8 - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 # Static Type checking: MyPy - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.9.0 hooks: - id: mypy additional_dependencies: From 02d2c1cdbebc5d832406f55561ec7372838b008a Mon Sep 17 00:00:00 2001 From: esc Date: Tue, 16 Apr 2024 16:10:44 +0200 Subject: [PATCH 2/3] fixup errors detected by pre-commit As title --- numba_rvsdg/core/datastructures/scfg.py | 4 ++-- numba_rvsdg/core/transformations.py | 8 +++++--- numba_rvsdg/rendering/rendering.py | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/numba_rvsdg/core/datastructures/scfg.py b/numba_rvsdg/core/datastructures/scfg.py index 5b4d15e..2bf4a9b 100644 --- a/numba_rvsdg/core/datastructures/scfg.py +++ b/numba_rvsdg/core/datastructures/scfg.py @@ -259,7 +259,7 @@ def __iter__(self) -> Generator[Tuple[str, BasicBlock], None, None]: yield (name, block) # If this is a region, recursively yield everything from that # specific region. - if type(block) == RegionBlock: + if type(block) == RegionBlock: # noqa: E721 assert block.subregion is not None yield from block.subregion # finally add any jump_targets to the list of names to visit @@ -1372,7 +1372,7 @@ def region_view_iterator( continue # populate the to_vist - if type(block) == RegionBlock: + if type(block) == RegionBlock: # noqa: E721 # If this is a region, continue on to the exiting block, i.e. # the region is presented a single fall-through block to the # consumer of this iterator. diff --git a/numba_rvsdg/core/transformations.py b/numba_rvsdg/core/transformations.py index ab1cd13..3b84d06 100644 --- a/numba_rvsdg/core/transformations.py +++ b/numba_rvsdg/core/transformations.py @@ -145,9 +145,11 @@ def reverse_lookup(d: Mapping[int, str], value: str) -> int: ) variable_assignment[backedge_variable] = reverse_lookup( backedge_value_table, - synth_exit - if needs_synth_exit - else next(iter(exit_blocks)), + ( + synth_exit + if needs_synth_exit + else next(iter(exit_blocks)) + ), ) # Create the actual control variable block synth_assign_block = SyntheticAssignment( diff --git a/numba_rvsdg/rendering/rendering.py b/numba_rvsdg/rendering/rendering.py index a8c1ba0..c4fad36 100644 --- a/numba_rvsdg/rendering/rendering.py +++ b/numba_rvsdg/rendering/rendering.py @@ -66,15 +66,15 @@ def render_block( The BasicBlock to be rendered. """ - if type(block) == BasicBlock: + if type(block) == BasicBlock: # noqa: E721 self.render_basic_block(digraph, name, block) - if type(block) == PythonBytecodeBlock: + if type(block) == PythonBytecodeBlock: # noqa: E721 self.render_basic_block(digraph, name, block) - elif type(block) == SyntheticAssignment: + elif type(block) == SyntheticAssignment: # noqa: E721 self.render_control_variable_block(digraph, name, block) elif isinstance(block, SyntheticBranch): self.render_branching_block(digraph, name, block) - elif type(block) == RegionBlock: + elif type(block) == RegionBlock: # noqa: E721 self.render_region_block(digraph, name, block) elif isinstance(block, SyntheticBlock): self.render_basic_block(digraph, name, block) From d0102794bbfcda8b373ed68c56e9173ea8265389 Mon Sep 17 00:00:00 2001 From: esc Date: Tue, 16 Apr 2024 16:11:33 +0200 Subject: [PATCH 3/3] adding lint target to makefile As title --- makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makefile b/makefile index 0bc40b3..6433fdb 100644 --- a/makefile +++ b/makefile @@ -3,6 +3,8 @@ build: python -m pip install -vv -e . test: pytest --pyargs numba_rvsdg +lint: + pre-commit run --all-files docs: cd docs && make html conda-env: