summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-06-23 20:20:50 -0400
committerPeter LaFosse <peter@vector35.com>2021-09-05 10:09:09 -0400
commitbc5c0977dc5b4087e8f39cc67089bb5709aac04e (patch)
tree2e955215d9a9000a84412f814d011248f6bdbe5d /python/types.py
parent421b398453d09e06e7b202229e34b66414683a45 (diff)
type hints for highlevelil.py, mediumlevelil.py and lowlevelil.py, workflow.py
Fix linter error in scriptingprovider.py Update workflow.py using updated paradigms and type hints
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py28
1 files changed, 4 insertions, 24 deletions
diff --git a/python/types.py b/python/types.py
index 0e5f7562..d3f6294d 100644
--- a/python/types.py
+++ b/python/types.py
@@ -258,7 +258,8 @@ class Symbol:
"""
def __init__(self, sym_type, addr, short_name, full_name=None, raw_name=None, handle=None, binding=None, namespace=None, ordinal=0):
if handle is not None:
- _handle = core.handle_of_type(handle, core.BNSymbol)
+ SymbolPointer = ctypes.POINTER(core.BNSymbol)
+ _handle = ctypes.cast(handle, SymbolPointer)
else:
if isinstance(sym_type, str):
sym_type = SymbolType[sym_type]
@@ -1093,7 +1094,7 @@ class StructureMember:
if len(self.name) == 0:
return f"<member: {self.type}, offset {self.offset:#x}>"
return f"<{self.type.get_string_before_name()} {self.name}{self.type.get_string_after_name()}" + \
- ", offset {self.offset:#x}>"
+ f", offset {self.offset:#x}>"
class Structure:
def __init__(self, handle=None):
@@ -1395,28 +1396,7 @@ class TypeParserResult:
return "<types: %s, variables: %s, functions: %s>" % (self.types, self.variables, self.functions)
- @types.setter
- def types(self, value):
- self._types = value
-
- @property
- def variables(self):
- return self._variables
-
- @variables.setter
- def variables(self, value):
- self._variables = value
-
- @property
- def functions(self):
- return self._functions
-
- @functions.setter
- def functions(self, value):
- self._functions = value
-
-
-def preprocess_source(source, filename=None, include_dirs=[]):
+def preprocess_source(source:str, filename:str=None, include_dirs:List[str]=[]) -> Tuple[Optional[str], str]:
"""
``preprocess_source`` run the C preprocessor on the given source or source filename.