From 3ddabd08ed6c30868e6caa5762d91c97ea829e87 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 18:17:53 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pycqa/isort: 5.10.1 → 7.0.0](https://github.com/pycqa/isort/compare/5.10.1...7.0.0) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 22.10.0 → 25.9.0](https://github.com/psf/black-pre-commit-mirror/compare/22.10.0...25.9.0) - [github.com/pre-commit/mirrors-mypy: v0.991 → v1.18.2](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.18.2) - [github.com/pycqa/flake8: 6.0.0 → 7.3.0](https://github.com/pycqa/flake8/compare/6.0.0...7.3.0) - [github.com/jazzband/pip-tools: 6.10.0 → v7.5.1](https://github.com/jazzband/pip-tools/compare/6.10.0...v7.5.1) --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2bbe40f..3461892 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,24 +5,24 @@ ci: skip: [pip-compile] repos: - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 7.0.0 hooks: - id: isort name: isort - - repo: https://github.com/psf/black - rev: 22.10.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.9.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.18.2 hooks: - id: mypy - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/jazzband/pip-tools - rev: 6.10.0 + rev: v7.5.1 hooks: - id: pip-compile files: ^(pyproject\.toml|requirements\.txt)$ From 57bc467ed0a16feca8d39ce43704ece4138eed0f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 18:18:03 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- code_data/__init__.py | 1 + code_data/_blocks.py | 3 +-- code_data/_flags_data.py | 1 + code_data/_line_mapping.py | 14 ++++++++------ code_data/_test_verify_code.py | 8 +++++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/code_data/__init__.py b/code_data/__init__.py index c6f46e1..ad10bc4 100644 --- a/code_data/__init__.py +++ b/code_data/__init__.py @@ -1,6 +1,7 @@ """ Transform Python code objects into data, and vice versa. """ + from __future__ import annotations from collections import OrderedDict diff --git a/code_data/_blocks.py b/code_data/_blocks.py index f320722..8fcb91e 100644 --- a/code_data/_blocks.py +++ b/code_data/_blocks.py @@ -9,9 +9,8 @@ import dis import sys from dataclasses import dataclass, field, replace -from typing import Callable, Generic, Hashable, Iterable, Optional, Tuple, TypeVar - from opcode import HAVE_ARGUMENT +from typing import Callable, Generic, Hashable, Iterable, Optional, Tuple, TypeVar from . import ( AdditionalArgs, diff --git a/code_data/_flags_data.py b/code_data/_flags_data.py index d8cee99..7f145e3 100644 --- a/code_data/_flags_data.py +++ b/code_data/_flags_data.py @@ -2,6 +2,7 @@ We represent code flags as a set of literal strings, representing each compiler flag. """ + from __future__ import annotations import dis diff --git a/code_data/_line_mapping.py b/code_data/_line_mapping.py index 1319606..9d86432 100644 --- a/code_data/_line_mapping.py +++ b/code_data/_line_mapping.py @@ -184,9 +184,9 @@ def collapse_items(items: ExpandedItems, is_linetable: bool) -> CollapsedItems: """ collapsed_items = [ CollapsedLineTableItem( - line_offset=None - if is_linetable and i.line_offset == -128 - else i.line_offset, + line_offset=( + None if is_linetable and i.line_offset == -128 else i.line_offset + ), bytecode_offset=i.bytecode_offset, ) for i in items @@ -245,9 +245,11 @@ def expand_bytecode(): while bytecode_offset > MAX_BYTECODE: expanded_items.append( LineTableItem( - line_offset=(-128 if line_offset is None else line_offset) - if is_linetable - else 0, + line_offset=( + (-128 if line_offset is None else line_offset) + if is_linetable + else 0 + ), bytecode_offset=MAX_BYTECODE, ) ) diff --git a/code_data/_test_verify_code.py b/code_data/_test_verify_code.py index 455f47f..fbdcc7f 100644 --- a/code_data/_test_verify_code.py +++ b/code_data/_test_verify_code.py @@ -116,9 +116,11 @@ def code_to_primitives(code: CodeType) -> dict[str, object]: for a in code.co_consts ) if name == "co_consts" - else [(i.opname, i.argval) for i in _get_instructions_bytes(code.co_code)] - if name == "co_code" - else getattr(code, name) + else ( + [(i.opname, i.argval) for i in _get_instructions_bytes(code.co_code)] + if name == "co_code" + else getattr(code, name) + ) ) for name in code_attributes }