From bc5c0977dc5b4087e8f39cc67089bb5709aac04e Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 23 Jun 2021 20:20:50 -0400 Subject: 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 --- python/types.py | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'python/types.py') 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"" 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 "" % (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. -- cgit v1.3.1