Skip to content

Commit d943b78

Browse files
committed
Add __init__ to maps to improve imports
1 parent 744aa3f commit d943b78

5 files changed

Lines changed: 7 additions & 5 deletions

File tree

examples/execve2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pythonbpf.decorators import bpf, map, section, bpfglobal
22
from ctypes import c_void_p, c_int64, c_int32, c_uint64
33
from pythonbpf.helpers import ktime
4-
from pythonbpf.maps.maps import HashMap
4+
from pythonbpf.maps import HashMap
55

66

77
@bpf

examples/execve3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pythonbpf import bpf, map, section, bpfglobal, compile
22
from pythonbpf.helpers import ktime, deref
3-
from pythonbpf.maps.maps import HashMap
3+
from pythonbpf.maps import HashMap
44

55
from ctypes import c_void_p, c_int64, c_int32, c_uint64
66

pythonbpf/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from llvmlite import ir
33
from .license_pass import license_processing
44
from .functions_pass import func_proc
5-
from pythonbpf.maps.maps_pass import maps_proc
5+
from pythonbpf.maps import maps_proc
66
from .structs.structs_pass import structs_proc
77
from .globals_pass import globals_processing
88
import os

pythonbpf/maps/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .maps import HashMap, PerfEventArray
2+
from .maps_pass import maps_proc

pythonbpf/maps/maps_pass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ def process_bpf_map(func_node, module):
256256
if handler:
257257
return handler(map_name, rval, module)
258258
else:
259-
logger.warning(f"Unknown map type {
260-
rval.func.id}, defaulting to HashMap")
259+
logger.warning(f"Unknown map type "
260+
f"{rval.func.id}, defaulting to HashMap")
261261
process_hash_map(map_name, rval, module)
262262
else:
263263
raise ValueError("Function under @map must return a map")

0 commit comments

Comments
 (0)