From b095828ae2a439298c152698f9c4d749e9187714 Mon Sep 17 00:00:00 2001 From: varun-r-mallya Date: Wed, 1 Oct 2025 00:49:23 +0530 Subject: [PATCH] remove some ruff errors --- .pre-commit-config.yaml | 14 +++++++------- pythonbpf/functions_pass.py | 2 +- pythonbpf/maps/__init__.py | 2 ++ pythonbpf/structs/__init__.py | 2 ++ tests/failing_tests/binops.py | 1 + tests/failing_tests/license.py | 1 + 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2c9083..3972f3e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,13 +35,13 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace -#- repo: https://github.com/astral-sh/ruff-pre-commit -# rev: "v0.4.2" -# hooks: -# - id: ruff -# args: ["--fix", "--show-fixes"] -# - id: ruff-format -# exclude: ^(docs) +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.4.2" + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] + - id: ruff-format + exclude: ^(docs) ## Checking static types #- repo: https://github.com/pre-commit/mirrors-mypy diff --git a/pythonbpf/functions_pass.py b/pythonbpf/functions_pass.py index 1835665..1a86d7f 100644 --- a/pythonbpf/functions_pass.py +++ b/pythonbpf/functions_pass.py @@ -674,7 +674,7 @@ def assign_string_to_array(builder, target_array_ptr, source_string_ptr, array_l Copy a string (i8*) to a fixed-size array ([N x i8]*) """ # Create a loop to copy characters one by one - entry_block = builder.block + # entry_block = builder.block copy_block = builder.append_basic_block("copy_char") end_block = builder.append_basic_block("copy_end") diff --git a/pythonbpf/maps/__init__.py b/pythonbpf/maps/__init__.py index 7893e14..370bbf2 100644 --- a/pythonbpf/maps/__init__.py +++ b/pythonbpf/maps/__init__.py @@ -1,2 +1,4 @@ from .maps import HashMap, PerfEventArray from .maps_pass import maps_proc + +__all__ = ["HashMap", "PerfEventArray", "maps_proc"] diff --git a/pythonbpf/structs/__init__.py b/pythonbpf/structs/__init__.py index 3b697e2..9dac561 100644 --- a/pythonbpf/structs/__init__.py +++ b/pythonbpf/structs/__init__.py @@ -1 +1,3 @@ from .structs_pass import structs_proc + +__all__ = ["structs_proc"] diff --git a/tests/failing_tests/binops.py b/tests/failing_tests/binops.py index 34260a1..3a86765 100644 --- a/tests/failing_tests/binops.py +++ b/tests/failing_tests/binops.py @@ -6,6 +6,7 @@ from ctypes import c_void_p, c_int64 @section("sometag1") def sometag(ctx: c_void_p) -> c_int64: a = 1 + 2 + 1 + print(f"{a}") return c_int64(0) diff --git a/tests/failing_tests/license.py b/tests/failing_tests/license.py index 086fd68..9853ab7 100644 --- a/tests/failing_tests/license.py +++ b/tests/failing_tests/license.py @@ -7,6 +7,7 @@ from ctypes import c_void_p, c_int64 @section("sometag1") def sometag(ctx: c_void_p) -> c_int64: a = 1 + 2 + print(f"{a}") return c_int64(0)