From 93634a4769a11cc17f353e576427bb69323f7830 Mon Sep 17 00:00:00 2001 From: varun-r-mallya Date: Sun, 12 Oct 2025 23:47:46 +0530 Subject: [PATCH] format chore --- pythonbpf/vmlinux_parser/class_handler.py | 22 +++++++++++++-------- pythonbpf/vmlinux_parser/dependency_node.py | 6 ++++-- tests/failing_tests/xdp_pass.py | 2 ++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pythonbpf/vmlinux_parser/class_handler.py b/pythonbpf/vmlinux_parser/class_handler.py index 111b8e0..3e77475 100644 --- a/pythonbpf/vmlinux_parser/class_handler.py +++ b/pythonbpf/vmlinux_parser/class_handler.py @@ -41,9 +41,7 @@ def process_vmlinux_post_ast( module_name = getattr(elem_type_class, "__module__", None) if current_symbol_name in processing_stack: - logger.info( - f"Circular dependency detected for {current_symbol_name}, skipping" - ) + logger.info(f"Circular dependency detected for {current_symbol_name}, skipping") return True # Check if already processed @@ -119,20 +117,28 @@ def process_vmlinux_post_ast( raise ImportError( f"Unsupported module of {containing_type}" ) - logger.info(f"{containing_type} containing type of parent {elem_name} with {elem_type} and ctype {ctype_complex_type} and length {type_length}") - new_dep_node.set_field_containing_type(elem_name, containing_type) + logger.info( + f"{containing_type} containing type of parent {elem_name} with {elem_type} and ctype {ctype_complex_type} and length {type_length}" + ) + new_dep_node.set_field_containing_type( + elem_name, containing_type + ) new_dep_node.set_field_type_size(elem_name, type_length) - new_dep_node.set_field_ctype_complex_type(elem_name, ctype_complex_type) + new_dep_node.set_field_ctype_complex_type( + elem_name, ctype_complex_type + ) new_dep_node.set_field_type(elem_name, elem_type) if containing_type.__module__ == "vmlinux": if process_vmlinux_post_ast( - containing_type, llvm_handler, handler, processing_stack + containing_type, llvm_handler, handler, processing_stack ): new_dep_node.set_field_ready(elem_name, True) elif containing_type.__module__ == ctypes.__name__: logger.info(f"Processing ctype internal{containing_type}") else: - raise TypeError("Module not supported in recursive resolution") + raise TypeError( + "Module not supported in recursive resolution" + ) continue if process_vmlinux_post_ast( elem_type, llvm_handler, handler, processing_stack diff --git a/pythonbpf/vmlinux_parser/dependency_node.py b/pythonbpf/vmlinux_parser/dependency_node.py index 1b4a3bd..eab99c1 100644 --- a/pythonbpf/vmlinux_parser/dependency_node.py +++ b/pythonbpf/vmlinux_parser/dependency_node.py @@ -46,7 +46,9 @@ class Field: if mark_ready: self.ready = True - def set_ctype_complex_type(self, ctype_complex_type: Any, mark_ready: bool = True) -> None: + def set_ctype_complex_type( + self, ctype_complex_type: Any, mark_ready: bool = True + ) -> None: """Set the ctype_complex_type of this field and optionally mark it as ready.""" self.ctype_complex_type = ctype_complex_type if mark_ready: @@ -127,7 +129,7 @@ class DependencyNode: containing_type=containing_type, type_size=type_size, ctype_complex_type=ctype_complex_type, - bitfield_size=bitfield_size + bitfield_size=bitfield_size, ) # Invalidate readiness cache self._ready_cache = None diff --git a/tests/failing_tests/xdp_pass.py b/tests/failing_tests/xdp_pass.py index 92b523f..c7717c0 100644 --- a/tests/failing_tests/xdp_pass.py +++ b/tests/failing_tests/xdp_pass.py @@ -2,8 +2,10 @@ from pythonbpf import bpf, map, section, bpfglobal, compile_to_ir from pythonbpf.maps import HashMap from pythonbpf.helper import XDP_PASS from vmlinux import struct_xdp_md + # from vmlinux import struct_ring_buffer_per_cpu # noqa: F401 from vmlinux import struct_xdp_buff # noqa: F401 + # from vmlinux import struct_xdp_md from ctypes import c_int64