mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-03-30 17:11:29 +00:00
Add docstrings to core modules and helper functions
Co-authored-by: varun-r-mallya <100590632+varun-r-mallya@users.noreply.github.com>
This commit is contained in:
@ -19,10 +19,31 @@ mapping = {
|
||||
|
||||
|
||||
def ctypes_to_ir(ctype: str):
|
||||
"""
|
||||
Convert a ctypes type name to its corresponding LLVM IR type.
|
||||
|
||||
Args:
|
||||
ctype: String name of the ctypes type (e.g., 'c_int64', 'c_void_p')
|
||||
|
||||
Returns:
|
||||
The corresponding LLVM IR type
|
||||
|
||||
Raises:
|
||||
NotImplementedError: If the ctype is not supported
|
||||
"""
|
||||
if ctype in mapping:
|
||||
return mapping[ctype]
|
||||
raise NotImplementedError(f"No mapping for {ctype}")
|
||||
|
||||
|
||||
def is_ctypes(ctype: str) -> bool:
|
||||
"""
|
||||
Check if a given type name is a supported ctypes type.
|
||||
|
||||
Args:
|
||||
ctype: String name of the type to check
|
||||
|
||||
Returns:
|
||||
True if the type is a supported ctypes type, False otherwise
|
||||
"""
|
||||
return ctype in mapping
|
||||
|
||||
Reference in New Issue
Block a user