Skip to content

Commit 62ca3b5

Browse files
format errors
1 parent f263c35 commit 62ca3b5

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

pythonbpf/codegen.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ def compile_to_ir(filename: str, output: str, loglevel=logging.WARNING):
6262
if not hasattr(module, "_debug_compile_unit"):
6363
debug_generator = DebugInfoGenerator(module)
6464
debug_generator.generate_file_metadata(filename, os.path.dirname(filename))
65-
debug_generator.generate_debug_cu(DW_LANG_C11,
66-
f"PythonBPF {VERSION}",
67-
True # TODO: This is probably not true
68-
# TODO: add a global field here that keeps track of all the globals. Works without it, but I think it might
69-
# be required for kprobes.
70-
, True)
65+
debug_generator.generate_debug_cu(
66+
DW_LANG_C11,
67+
f"PythonBPF {VERSION}",
68+
True, # TODO: This is probably not true
69+
# TODO: add a global field here that keeps track of all the globals. Works without it, but I think it might
70+
# be required for kprobes.
71+
True,
72+
)
7173

7274
processor(source, filename, module)
7375

@@ -129,7 +131,7 @@ def compile(loglevel=logging.WARNING) -> bool:
129131

130132
success = True
131133
success = (
132-
compile_to_ir(str(caller_file), str(ll_file), loglevel=loglevel) and success
134+
compile_to_ir(str(caller_file), str(ll_file), loglevel=loglevel) and success
133135
)
134136

135137
success = bool(
@@ -156,7 +158,7 @@ def BPF(loglevel=logging.WARNING) -> BpfProgram:
156158
caller_frame = inspect.stack()[1]
157159
src = inspect.getsource(caller_frame.frame)
158160
with tempfile.NamedTemporaryFile(
159-
mode="w+", delete=True, suffix=".py"
161+
mode="w+", delete=True, suffix=".py"
160162
) as f, tempfile.NamedTemporaryFile(
161163
mode="w+", delete=True, suffix=".ll"
162164
) as inter, tempfile.NamedTemporaryFile(

pythonbpf/debuginfo/debug_info_generator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def generate_file_metadata(self, filename, dirname):
2121
},
2222
)
2323

24-
def generate_debug_cu(self, language, producer: str, is_optimized: bool, is_distinct: bool):
24+
def generate_debug_cu(
25+
self, language, producer: str, is_optimized: bool, is_distinct: bool
26+
):
2527
self.module._debug_compile_unit = self.module.add_debug_info(
2628
"DICompileUnit",
2729
{ # type: ignore
@@ -100,7 +102,7 @@ def create_struct_member(self, name: str, base_type: Any, offset: int) -> Any:
100102
)
101103

102104
def create_struct_type(
103-
self, members: List[Any], size: int, is_distinct: bool
105+
self, members: List[Any], size: int, is_distinct: bool
104106
) -> Any:
105107
"""Create a struct type with the given members and size"""
106108
return self.module.add_debug_info(
@@ -115,7 +117,7 @@ def create_struct_type(
115117
)
116118

117119
def create_global_var_debug_info(
118-
self, name: str, var_type: Any, is_local: bool = False
120+
self, name: str, var_type: Any, is_local: bool = False
119121
) -> Any:
120122
"""Create debug info for a global variable"""
121123
global_var = self.module.add_debug_info(

0 commit comments

Comments
 (0)