diff options
| author | Josh Ferrell <josh@vector35.com> | 2022-12-22 14:54:19 -0500 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2022-12-22 15:20:27 -0500 |
| commit | b5124b220868851108193f44b9111d4039ff7b12 (patch) | |
| tree | f66774a0da998e09cefd4efb2fab2ae4089ff395 /python | |
| parent | d0b71355485126d15389f9f2de201cc154e19c69 (diff) | |
Fix many incorrect type hints and type errors
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 39 | ||||
| -rw-r--r-- | python/filemetadata.py | 8 | ||||
| -rw-r--r-- | python/function.py | 39 | ||||
| -rw-r--r-- | python/highlevelil.py | 11 | ||||
| -rw-r--r-- | python/lowlevelil.py | 123 | ||||
| -rw-r--r-- | python/mediumlevelil.py | 7 | ||||
| -rw-r--r-- | python/platform.py | 6 |
7 files changed, 117 insertions, 116 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index f2830f5c..1af47236 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -1033,7 +1033,7 @@ class BinaryViewType(metaclass=_BinaryViewTypeMetaclass): @classmethod def load_raw_view_with_options( - cls, raw_view: 'BinaryView', update_analysis: Optional[bool] = True, progress_func: Optional[ProgressFuncType] = None, + cls, raw_view: Optional['BinaryView'], update_analysis: Optional[bool] = True, progress_func: Optional[ProgressFuncType] = None, options: Mapping[str, Any] = {} ) -> Optional['BinaryView']: """ @@ -1650,7 +1650,7 @@ class SymbolMapping(collections.abc.Mapping): # type: ignore else: self._symbol_cache[sym.raw_bytes] = [sym] - def __iter__(self) -> Iterator[List['_types.CoreSymbol']]: + def __iter__(self) -> Iterator[str]: if self._symbol_cache is None: self._build_symbol_cache() assert self._symbol_cache is not None @@ -1952,8 +1952,8 @@ class BinaryView: _registered_instances = [] def __init__( - self, file_metadata: 'filemetadata.FileMetadata' = None, parent_view: 'BinaryView' = None, - handle: core.BNBinaryViewHandle = None + self, file_metadata: Optional['filemetadata.FileMetadata'] = None, parent_view: Optional['BinaryView'] = None, + handle: Optional[core.BNBinaryViewHandle] = None ): if handle is not None: _handle = handle @@ -2242,7 +2242,7 @@ class BinaryView: return BinaryView(file_metadata=file_metadata, handle=view) @staticmethod - def new(data: Union[bytes, bytearray, 'databuffer.DataBuffer'] = None, file_metadata: Optional['filemetadata.FileMetadata'] = None) -> Optional['BinaryView']: + def new(data: Optional[Union[bytes, bytearray, 'databuffer.DataBuffer']] = None, file_metadata: Optional['filemetadata.FileMetadata'] = None) -> Optional['BinaryView']: binaryninja._init_plugins() if file_metadata is None: file_metadata = filemetadata.FileMetadata() @@ -3487,13 +3487,12 @@ class BinaryView: raise ValueError(f"Couldn't read {size} bytes from address: {address:#x}") return TypedDataAccessor.int_from_bytes(data, size, sign, _endian) - def read_pointer(self, address: int, size=None) -> int: - _size = size + def read_pointer(self, address: int, size: Optional[int] = None) -> int: if size is None: if self.arch is None: raise ValueError("Can't read pointer for BinaryView without an architecture") - _size = self.arch.address_size - return self.read_int(address, _size, False, self.endianness) + size = self.arch.address_size + return self.read_int(address, size, False, self.endianness) def write(self, addr: int, data: bytes, except_on_relocation: bool = True) -> int: """ @@ -3584,7 +3583,7 @@ class BinaryView: result.append(float(data[i])) return result - def get_modification(self, addr: int, length: int = None) -> List[ModificationStatus]: + def get_modification(self, addr: int, length: Optional[int] = None) -> List[ModificationStatus]: """ ``get_modification`` returns the modified bytes of up to ``length`` bytes from virtual address ``addr``, or if ``length`` is None returns the ModificationStatus. @@ -4164,7 +4163,7 @@ class BinaryView: return None return basicblock.BasicBlock(block, self) - def get_code_refs(self, addr: int, length: int = None) -> Generator['ReferenceSource', None, None]: + def get_code_refs(self, addr: int, length: Optional[int] = None) -> Generator['ReferenceSource', None, None]: """ ``get_code_refs`` returns a generator of :py:Class:`ReferenceSource <binaryninja.binaryview.ReferenceSource>` objects (xrefs or cross-references) that point to the provided virtual address. This function returns both autoanalysis ("auto") and user-specified ("user") xrefs. @@ -4240,7 +4239,7 @@ class BinaryView: core.BNFreeAddressList(refs) return result - def get_data_refs(self, addr: int, length: int = None) -> Generator[int, None, None]: + def get_data_refs(self, addr: int, length: Optional[int] = None) -> Generator[int, None, None]: """ ``get_data_refs`` returns a list of virtual addresses of _data_ (not code) which references ``addr``, optionally specifying a length. When ``length`` is set ``get_data_refs`` returns the data which references in the range ``addr``-``addr``+``length``. @@ -4275,7 +4274,7 @@ class BinaryView: finally: core.BNFreeDataReferences(refs) - def get_data_refs_from(self, addr: int, length: int = None) -> Generator[int, None, None]: + def get_data_refs_from(self, addr: int, length: Optional[int] = None) -> Generator[int, None, None]: """ ``get_data_refs_from`` returns a list of virtual addresses referenced by the address ``addr``. Optionally specifying a length. When ``length`` is set ``get_data_refs_from`` returns the data referenced in the range ``addr``-``addr``+``length``. @@ -4817,8 +4816,8 @@ class BinaryView: finally: core.BNFreeCodeReferences(refs, count.value) - def get_callees(self, addr: int, func: '_function.Function' = None, - arch: 'architecture.Architecture' = None) -> List[int]: + def get_callees(self, addr: int, func: Optional['_function.Function'] = None, + arch: Optional['architecture.Architecture'] = None) -> List[int]: """ ``get_callees`` returns a list of virtual addresses called by the call site in the function ``func``, of the architecture ``arch``, and at the address ``addr``. If no function is specified, call sites from @@ -5187,7 +5186,7 @@ class BinaryView: cur_item.append(tag) result[tag.name] = cur_item else: - result[tag.name] = [result[tag.name], tag] + result[tag.name] = [cur_item, tag] else: result[tag.name] = tag return result @@ -6108,7 +6107,7 @@ class BinaryView: raise TypeError("Removal is only supported with a Component or string representing its Guid") - def get_constant_data(self, addr: int) -> 'DataBuffer': + def get_constant_data(self, addr: int) -> databuffer.DataBuffer: return databuffer.DataBuffer(handle=core.BNGetConstantData(self.handle, addr)) def get_strings(self, start: Optional[int] = None, length: Optional[int] = None) -> List['StringReference']: @@ -6171,7 +6170,7 @@ class BinaryView: length = str_ref.length - (addr - str_ref.start) if partial else str_ref.length return StringReference(self, StringType(str_ref.type), start, length) - def get_ascii_string_at(self, addr: int, min_length: int = 4, max_length: int = None, + def get_ascii_string_at(self, addr: int, min_length: int = 4, max_length: Optional[int] = None, require_cstring: bool = True) -> Optional['StringReference']: """ ``get_ascii_string_at`` returns an ascii string found at ``addr``. @@ -6450,7 +6449,7 @@ class BinaryView: return core.BNGetPreviousDataVariableStartBeforeAddress(self.handle, addr) def get_linear_disassembly_position_at( - self, addr: int, settings: '_function.DisassemblySettings' = None + self, addr: int, settings: Optional['_function.DisassemblySettings'] = None ) -> 'lineardisassembly.LinearViewCursor': """ ``get_linear_disassembly_position_at`` instantiates a :py:class:`LinearViewCursor <binaryninja.lineardisassembly.LinearViewCursor>` object for use in @@ -6527,7 +6526,7 @@ class BinaryView: return result def get_linear_disassembly( - self, settings: '_function.DisassemblySettings' = None + self, settings: Optional['_function.DisassemblySettings'] = None ) -> Iterator['lineardisassembly.LinearDisassemblyLine']: """ ``get_linear_disassembly`` gets an iterator for all lines in the linear disassembly of the view for the given diff --git a/python/filemetadata.py b/python/filemetadata.py index ca5645ab..0335e9bc 100644 --- a/python/filemetadata.py +++ b/python/filemetadata.py @@ -416,8 +416,8 @@ class FileMetadata: return core.BNNavigate(self.handle, str(view), offset) def create_database( - self, filename: str, progress_func: Optional[ProgressFuncType] = None, settings: SaveSettings = None - ): + self, filename: str, progress_func: Optional[ProgressFuncType] = None, settings: Optional[SaveSettings] = None + ) -> bool: """ ``create_database`` writes the current database (.bndb) out to the specified file. @@ -446,7 +446,7 @@ class FileMetadata: ctypes.c_ulonglong)(lambda ctxt, cur, total: _progress_func(cur, total)), _settings ) - def open_existing_database(self, filename: str, progress_func: Callable[[int, int], bool] = None): + def open_existing_database(self, filename: str, progress_func: Optional[Callable[[int, int], bool]] = None): if progress_func is None: view = core.BNOpenExistingDatabase(self.handle, str(filename)) else: @@ -465,7 +465,7 @@ class FileMetadata: return None return binaryview.BinaryView(file_metadata=self, handle=view) - def save_auto_snapshot(self, progress_func: Optional[ProgressFuncType] = None, settings: SaveSettings = None): + def save_auto_snapshot(self, progress_func: Optional[ProgressFuncType] = None, settings: Optional[SaveSettings] = None) -> bool: _settings = None if settings is not None: _settings = settings.handle diff --git a/python/function.py b/python/function.py index b60776e2..692761e5 100644 --- a/python/function.py +++ b/python/function.py @@ -92,7 +92,7 @@ class _FunctionAssociatedDataStore(associateddatastore._AssociatedDataStore): class DisassemblySettings: - def __init__(self, handle: core.BNDisassemblySettingsHandle = None): + def __init__(self, handle: Optional[core.BNDisassemblySettingsHandle] = None): if handle is None: self.handle = core.BNCreateDisassemblySettings() else: @@ -338,9 +338,8 @@ class Function: >>> current_function = bv.functions[0] >>> here = current_function.start """ - def __init__(self, view: Optional['binaryview.BinaryView'] = None, handle:core.BNFunctionHandle=None): + def __init__(self, view: Optional['binaryview.BinaryView'] = None, handle: Optional[core.BNFunctionHandle] = None): self._advanced_analysis_requests = 0 - self.handle = None assert handle is not None, "creation of standalone 'Function' objects is not implemented" FunctionHandle = ctypes.POINTER(core.BNFunction) self.handle = ctypes.cast(handle, FunctionHandle) @@ -1848,7 +1847,7 @@ class Function: core.BNFreeTagList(tags, count.value) def get_auto_address_tags_of_type( - self, addr: int, tag_type: 'binaryview.TagType', arch: 'architecture.Architecture' = None + self, addr: int, tag_type: 'binaryview.TagType', arch: Optional['architecture.Architecture'] = None ): """ ``get_auto_address_tags_of_type`` gets a list of all auto-defined Tags in the function at a given address with a given type. @@ -1876,7 +1875,7 @@ class Function: core.BNFreeTagList(tags, count.value) def get_user_address_tags_of_type( - self, addr: int, tag_type: 'binaryview.TagType', arch: 'architecture.Architecture' = None + self, addr: int, tag_type: 'binaryview.TagType', arch: Optional['architecture.Architecture'] = None ): """ ``get_user_address_tags_of_type`` gets a list of all user Tags in the function at a given address with a given type. @@ -1904,7 +1903,7 @@ class Function: core.BNFreeTagList(tags, count.value) def get_address_tags_in_range( - self, address_range: 'variable.AddressRange', arch: 'architecture.Architecture' = None + self, address_range: 'variable.AddressRange', arch: Optional['architecture.Architecture'] = None ) -> List[Tuple['architecture.Architecture', int, 'binaryview.Tag']]: """ ``get_address_tags_in_range`` gets a list of all Tags in the function at a given address. @@ -1933,7 +1932,7 @@ class Function: core.BNFreeTagReferences(refs, count.value) def get_auto_address_tags_in_range( - self, address_range: 'variable.AddressRange', arch: 'architecture.Architecture' = None + self, address_range: 'variable.AddressRange', arch: Optional['architecture.Architecture'] = None ) -> List[Tuple['architecture.Architecture', int, 'binaryview.Tag']]: """ ``get_auto_address_tags_in_range`` gets a list of all auto-defined Tags in the function at a given address. @@ -1962,7 +1961,7 @@ class Function: core.BNFreeTagReferences(refs, count.value) def get_user_address_tags_in_range( - self, address_range: 'variable.AddressRange', arch: 'architecture.Architecture' = None + self, address_range: 'variable.AddressRange', arch: Optional['architecture.Architecture'] = None ) -> List[Tuple['architecture.Architecture', int, 'binaryview.Tag']]: """ ``get_user_address_tags_in_range`` gets a list of all user Tags in the function at a given address. @@ -2312,7 +2311,7 @@ class Function: core.BNRemoveUserFunctionTagsOfType(self.handle, tag_type.handle) def get_constants_referenced_by(self, addr: int, - arch: 'architecture.Architecture' = None) -> List[variable.ConstantReference]: + arch: Optional['architecture.Architecture'] = None) -> List[variable.ConstantReference]: if arch is None: arch = self.arch count = ctypes.c_ulonglong() @@ -2327,7 +2326,7 @@ class Function: return result def get_constants_referenced_by_address_if_available(self, addr: int, - arch: 'architecture.Architecture' = None) -> List[variable.ConstantReference]: + arch: Optional['architecture.Architecture'] = None) -> List[variable.ConstantReference]: if arch is None: arch = self.arch count = ctypes.c_ulonglong() @@ -2408,7 +2407,7 @@ class Function: def create_graph( self, graph_type: FunctionGraphType = FunctionGraphType.NormalFunctionGraph, - settings: 'DisassemblySettings' = None + settings: Optional['DisassemblySettings'] = None ) -> flowgraph.CoreFlowGraph: if settings is not None: settings_obj = settings.handle @@ -2822,7 +2821,7 @@ class Function: core.BNFreeVariableNameAndType(found_var) return result - def get_type_tokens(self, settings: 'DisassemblySettings' = None) -> List['DisassemblyTextLine']: + def get_type_tokens(self, settings: Optional['DisassemblySettings'] = None) -> List['DisassemblyTextLine']: _settings = None if settings is not None: _settings = settings.handle @@ -3173,8 +3172,8 @@ class Function: ``callers`` returns a list of functions that call this function Does not point to the actual address where the call occurs, just the start of the function that contains the call. - :return: List of start addresses for Functions that call this function - :rtype: list(int) + :return: List of Functions that call this function + :rtype: list(Function) """ functions = [] for ref in self.view.get_code_refs(self.start): @@ -3183,13 +3182,13 @@ class Function: return functions @property - def caller_sites(self) -> Generator['ReferenceSource', None, None]: + def caller_sites(self) -> Generator['binaryview.ReferenceSource', None, None]: """ ``caller_sites`` returns a list of ReferenceSource objects corresponding to the addresses in functions which reference this function - :return: List of start ReferenceSource objects of the call sites to this function - :rtype: list(int) + :return: List of ReferenceSource objects of the call sites to this function + :rtype: list(ReferenceSource) """ return self.view.get_code_refs(self.start) @@ -3430,7 +3429,7 @@ class Function: class AdvancedFunctionAnalysisDataRequestor: - def __init__(self, func: 'Function' = None): + def __init__(self, func: Optional['Function'] = None): self._function = func if self._function is not None: self._function.request_advanced_analysis_data() @@ -3493,8 +3492,8 @@ class DisassemblyTextLine: class DisassemblyTextRenderer: def __init__( - self, func: AnyFunctionType = None, settings: 'DisassemblySettings' = None, - handle: core.BNDisassemblySettings = None + self, func: Optional[AnyFunctionType] = None, settings: Optional['DisassemblySettings'] = None, + handle: Optional[core.BNDisassemblySettings] = None ): if handle is None: if func is None: diff --git a/python/highlevelil.py b/python/highlevelil.py index 1f8c3f84..b4bd9f42 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -39,6 +39,7 @@ from . import highlight from . import flowgraph from . import variable from . import databuffer +from . import types as _types from .interaction import show_graph_report from .commonil import ( BaseILInstruction, Tailcall, Syscall, Localcall, Comparison, Signed, UnaryOperation, BinaryOperation, SSA, Phi, @@ -1405,7 +1406,7 @@ class HighLevelILConst(HighLevelILInstruction, Constant): @dataclass(frozen=True, repr=False, eq=False) class HighLevelILConstData(HighLevelILInstruction, Constant): @property - def constant(self) -> 'DataBuffer': + def constant(self) -> 'databuffer.DataBuffer': return self.function.source_function.view.get_constant_data(self._get_int(0)) @property @@ -2102,8 +2103,8 @@ class HighLevelILFunction: a function. """ def __init__( - self, arch: Optional['architecture.Architecture'] = None, handle: core.BNHighLevelILFunction = None, - source_func: 'function.Function' = None + self, arch: Optional['architecture.Architecture'] = None, handle: Optional[core.BNHighLevelILFunction] = None, + source_func: Optional['function.Function'] = None ): self._arch = arch self._source_function = source_func @@ -2430,7 +2431,7 @@ class HighLevelILFunction: variable_list[i] = variables[i].to_BNVariable() core.BNGenerateHighLevelILSSAForm(self.handle, variable_list, len(variable_list)) - def create_graph(self, settings: 'function.DisassemblySettings' = None) -> 'flowgraph.CoreFlowGraph': + def create_graph(self, settings: Optional['function.DisassemblySettings'] = None) -> 'flowgraph.CoreFlowGraph': if settings is not None: settings_obj = settings.handle else: @@ -2444,7 +2445,7 @@ class HighLevelILFunction: return FunctionGraphType(core.BNGetBasicBlockFunctionGraphType(list(self.basic_blocks)[0].handle)) @property - def vars(self) -> List["variable.Variable"]: + def vars(self) -> Union[List["variable.Variable"], List["mediumlevelil.SSAVariable"]]: """This gets just the HLIL variables - you may be interested in the union of `HighLevelIlFunction.source_function.param_vars` and `HighLevelIlFunction.aliased_vars` as well for all the variables used in the function""" if self.source_function is None: return [] diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 7e2bee52..39461500 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -718,7 +718,7 @@ class LowLevelILInstruction(BaseILInstruction): return variable.RegisterValue.from_BNRegisterValue(value, self.function.arch) def get_possible_reg_values( - self, reg: 'architecture.RegisterType', options: List[DataFlowQueryOption] = None + self, reg: 'architecture.RegisterType', options: Optional[List[DataFlowQueryOption]] = None ) -> 'variable.PossibleValueSet': if self.function.arch is None: raise Exception("Can not call get_possible_reg_values on function with Architecture set to None") @@ -2655,9 +2655,10 @@ class LowLevelILFunction: """ def __init__( self, arch: Optional['architecture.Architecture'] = None, handle: Optional[core.BNLowLevelILFunction] = None, - source_func: 'function.Function' = None + source_func: Optional['function.Function'] = None ): - self._arch = arch + if arch is not None: + self._arch = arch self._source_function = source_func if handle is not None: LLILHandle = ctypes.POINTER(core.BNLowLevelILFunction) @@ -2668,12 +2669,12 @@ class LowLevelILFunction: self._source_function = function.Function(handle=source_handle) else: self._source_function = None - if self._arch is None: + if arch is None: if self._source_function is None: raise Exception("Can not instantiate LowLevelILFunction without an architecture") self._arch = self._source_function.arch else: - if self._arch is None: + if arch is None: if self._source_function is None: raise Exception("Can not instantiate LowLevelILFunction without an architecture") self._arch = self._source_function.arch @@ -2853,7 +2854,7 @@ class LowLevelILFunction: return self._arch @arch.setter - def arch(self, value='architecture.Architecture') -> None: + def arch(self, value: 'architecture.Architecture') -> None: self._arch = value @property @@ -2875,12 +2876,12 @@ class LowLevelILFunction: return FunctionGraphType(core.BNGetBasicBlockFunctionGraphType(list(self.basic_blocks)[0].handle)) @property - def registers(self) -> List[ILRegister]: + def registers(self) -> List[SSARegister]: """ Deprecated, use `regs` instead. List of registers used in this IL """ return self.regs @property - def regs(self) -> List[ILRegister]: + def regs(self) -> List[SSARegister]: """ List of registers used in this IL """ if self.il_form == FunctionGraphType.LowLevelILSSAFormFunctionGraph: # If this is a LLIL SSA function, then its registers is SSA registers @@ -2905,12 +2906,12 @@ class LowLevelILFunction: return False @property - def register_stacks(self) -> List[ILRegisterStack]: + def register_stacks(self) -> List[SSARegisterStack]: """ Deprecated, use `reg_stacks` instead. List of register stacks used in this IL """ return self.reg_stacks @property - def reg_stacks(self) -> List[ILRegisterStack]: + def reg_stacks(self) -> List[SSARegisterStack]: """ List of register stacks used in this IL """ if self.il_form == FunctionGraphType.LowLevelILSSAFormFunctionGraph: # If this is a LLIL SSA function, then its registers is SSA registers @@ -2928,7 +2929,7 @@ class LowLevelILFunction: core.BNFreeLLILVariablesList(registerStacks) @property - def flags(self) -> List[ILFlag]: + def flags(self) -> List[SSAFlag]: """ List of flags used in this IL """ if self.il_form == FunctionGraphType.LowLevelILSSAFormFunctionGraph: # If this is a LLIL SSA function, then its registers is SSA registers @@ -2995,7 +2996,7 @@ class LowLevelILFunction: return self.ssa_regs @property - def ssa_register_stacks(self) -> List[SSARegister]: + def ssa_register_stacks(self) -> List[SSARegisterStack]: return self.ssa_reg_stacks @property @@ -3124,7 +3125,7 @@ class LowLevelILFunction: def expr( self, operation, a: ExpressionIndex = 0, b: ExpressionIndex = 0, c: ExpressionIndex = 0, d: ExpressionIndex = 0, size: int = 0, - flags: Union['architecture.FlagWriteTypeName', 'architecture.FlagType', 'architecture.FlagIndex'] = None + flags: Optional[Union['architecture.FlagWriteTypeName', 'architecture.FlagType', 'architecture.FlagIndex']] = None ) -> ExpressionIndex: _flags = architecture.FlagIndex(0) if isinstance(operation, str): @@ -3205,7 +3206,7 @@ class LowLevelILFunction: def set_reg_split( self, size: int, hi: 'architecture.RegisterType', lo: 'architecture.RegisterType', value: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``set_reg_split`` uses ``hi`` and ``lo`` as a single extended register setting ``hi:lo`` to the expression @@ -3227,7 +3228,7 @@ class LowLevelILFunction: def set_reg_stack_top_relative( self, size: int, reg_stack: 'architecture.RegisterStackType', entry: ExpressionIndex, value: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``set_reg_stack_top_relative`` sets the top-relative entry ``entry`` of size ``size`` in register @@ -3248,7 +3249,7 @@ class LowLevelILFunction: def reg_stack_push( self, size: int, reg_stack: 'architecture.RegisterStackType', value: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``reg_stack_push`` pushes the expression ``value`` of size ``size`` onto the top of the register @@ -3467,7 +3468,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_FLAG_BIT, self.arch.get_flag_by_name(reg), bit, size=size) def add( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``add`` adds expression ``a`` to expression ``b`` potentially setting flags ``flags`` and returning @@ -3484,7 +3485,7 @@ class LowLevelILFunction: def add_carry( self, size: int, a: ExpressionIndex, b: ExpressionIndex, carry: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``add_carry`` adds with carry expression ``a`` to expression ``b`` potentially setting flags ``flags`` and @@ -3501,7 +3502,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_ADC, a, b, carry, size=size, flags=flags) def sub( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``sub`` subtracts expression ``b`` from expression ``a`` potentially setting flags ``flags`` and returning @@ -3518,7 +3519,7 @@ class LowLevelILFunction: def sub_borrow( self, size: int, a: ExpressionIndex, b: ExpressionIndex, carry: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``sub_borrow`` subtracts with borrow expression ``b`` from expression ``a`` potentially setting flags ``flags`` @@ -3535,7 +3536,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_SBB, a, b, carry, size=size, flags=flags) def and_expr( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``and_expr`` bitwise and's expression ``a`` and expression ``b`` potentially setting flags ``flags`` @@ -3551,7 +3552,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_AND, a, b, size=size, flags=flags) def or_expr( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``or_expr`` bitwise or's expression ``a`` and expression ``b`` potentially setting flags ``flags`` @@ -3567,7 +3568,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_OR, a, b, size=size, flags=flags) def xor_expr( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``xor_expr`` xor's expression ``a`` with expression ``b`` potentially setting flags ``flags`` @@ -3583,7 +3584,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_XOR, a, b, size=size, flags=flags) def shift_left( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``shift_left`` shifts left expression ``a`` by expression ``b`` from expression ``a`` potentially setting flags ``flags`` @@ -3599,7 +3600,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_LSL, a, b, size=size, flags=flags) def logical_shift_right( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``logical_shift_right`` shifts logically right expression ``a`` by expression ``b`` potentially setting flags @@ -3615,7 +3616,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_LSR, a, b, size=size, flags=flags) def arith_shift_right( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``arith_shift_right`` shifts arithmetic right expression ``a`` by expression ``b`` potentially setting flags @@ -3631,7 +3632,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_ASR, a, b, size=size, flags=flags) def rotate_left( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``rotate_left`` bitwise rotates left expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -3648,7 +3649,7 @@ class LowLevelILFunction: def rotate_left_carry( self, size: int, a: ExpressionIndex, b: ExpressionIndex, carry: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``rotate_left_carry`` bitwise rotates left with carry expression ``a`` by expression ``b`` potentially setting @@ -3665,7 +3666,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_RLC, a, b, carry, size=size, flags=flags) def rotate_right( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``rotate_right`` bitwise rotates right expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -3682,7 +3683,7 @@ class LowLevelILFunction: def rotate_right_carry( self, size: int, a: ExpressionIndex, b: ExpressionIndex, carry: ExpressionIndex, - flags: 'architecture.FlagType' = None + flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``rotate_right_carry`` bitwise rotates right with carry expression ``a`` by expression ``b`` potentially setting @@ -3699,7 +3700,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_RRC, a, b, carry, size=size, flags=flags) def mult( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mult`` multiplies expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an @@ -3715,7 +3716,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_MUL, a, b, size=size, flags=flags) def mult_double_prec_signed( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mult_double_prec_signed`` multiplies signed with double precision expression ``a`` by expression ``b`` @@ -3731,7 +3732,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_MULS_DP, a, b, size=size, flags=flags) def mult_double_prec_unsigned( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mult_double_prec_unsigned`` multiplies unsigned with double precision expression ``a`` by expression ``b`` @@ -3747,7 +3748,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_MULU_DP, a, b, size=size, flags=flags) def div_signed( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``div_signed`` signed divide expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -3763,7 +3764,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_DIVS, a, b, size=size, flags=flags) def div_double_prec_signed( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``div_double_prec_signed`` signed double precision divide using expression ``a`` as a @@ -3780,7 +3781,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_DIVS_DP, a, b, size=size, flags=flags) def div_unsigned( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``div_unsigned`` unsigned divide expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -3796,7 +3797,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_DIVU, a, b, size=size, flags=flags) def div_double_prec_unsigned( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``div_double_prec_unsigned`` unsigned double precision divide using expression ``a`` as @@ -3813,7 +3814,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_DIVU_DP, a, b, size=size, flags=flags) def mod_signed( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mod_signed`` signed modulus expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -3829,7 +3830,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_MODS, a, b, size=size, flags=flags) def mod_double_prec_signed( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mod_double_prec_signed`` signed double precision modulus using expression ``a`` as a single @@ -3846,7 +3847,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_MODS_DP, a, b, size=size, flags=flags) def mod_unsigned( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mod_unsigned`` unsigned modulus expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -3862,7 +3863,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_MODU, a, b, size=size, flags=flags) def mod_double_prec_unsigned( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``mod_double_prec_unsigned`` unsigned double precision modulus using expression ``a`` as @@ -3878,7 +3879,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_MODU_DP, a, b, size=size, flags=flags) - def neg_expr(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def neg_expr(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``neg_expr`` two's complement sign negation of expression ``value`` of size ``size`` potentially setting flags @@ -3890,7 +3891,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_NEG, value, size=size, flags=flags) - def not_expr(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def not_expr(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``not_expr`` bitwise inverse of expression ``value`` of size ``size`` potentially setting flags @@ -3902,7 +3903,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_NOT, value, size=size, flags=flags) - def sign_extend(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def sign_extend(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``sign_extend`` two's complement sign-extends the expression in ``value`` to ``size`` bytes @@ -3914,7 +3915,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_SX, value, size=size, flags=flags) - def zero_extend(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def zero_extend(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``zero_extend`` zero-extends the expression in ``value`` to ``size`` bytes @@ -3925,7 +3926,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_ZX, value, size=size, flags=flags) - def low_part(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def low_part(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``low_part`` truncates ``value`` to ``size`` bytes @@ -4173,7 +4174,7 @@ class LowLevelILFunction: def intrinsic( self, outputs: List[Union[ILRegisterType, ILFlag, 'architecture.RegisterInfo']], intrinsic: 'architecture.IntrinsicType', - params: List[ExpressionIndex], flags: 'architecture.FlagType' = None + params: List[ExpressionIndex], flags: Optional['architecture.FlagType'] = None ): """ ``intrinsic`` return an intrinsic expression. @@ -4258,7 +4259,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_UNIMPL_MEM, addr, size=size) def float_add( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``float_add`` adds floating point expression ``a`` to expression ``b`` potentially setting flags ``flags`` @@ -4274,7 +4275,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_FADD, a, b, size=size, flags=flags) def float_sub( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``float_sub`` subtracts floating point expression ``b`` from expression ``a`` potentially setting flags ``flags`` @@ -4290,7 +4291,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_FSUB, a, b, size=size, flags=flags) def float_mult( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``float_mult`` multiplies floating point expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -4306,7 +4307,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_FMUL, a, b, size=size, flags=flags) def float_div( - self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, a: ExpressionIndex, b: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``float_div`` divides floating point expression ``a`` by expression ``b`` potentially setting flags ``flags`` @@ -4321,7 +4322,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FDIV, a, b, size=size, flags=flags) - def float_sqrt(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def float_sqrt(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``float_sqrt`` returns square root of floating point expression ``value`` of size ``size`` potentially setting flags @@ -4333,7 +4334,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FSQRT, value, size=size, flags=flags) - def float_neg(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def float_neg(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``float_neg`` returns sign negation of floating point expression ``value`` of size ``size`` potentially setting flags @@ -4345,7 +4346,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FNEG, value, size=size, flags=flags) - def float_abs(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def float_abs(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``float_abs`` returns absolute value of floating point expression ``value`` of size ``size`` potentially setting flags @@ -4357,7 +4358,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FABS, value, size=size, flags=flags) - def float_to_int(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def float_to_int(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``float_to_int`` returns integer value of floating point expression ``value`` of size ``size`` potentially setting flags @@ -4369,7 +4370,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FLOAT_TO_INT, value, size=size, flags=flags) - def int_to_float(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def int_to_float(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``int_to_float`` returns floating point value of integer expression ``value`` of size ``size`` potentially setting flags @@ -4382,7 +4383,7 @@ class LowLevelILFunction: return self.expr(LowLevelILOperation.LLIL_INT_TO_FLOAT, value, size=size, flags=flags) def float_convert( - self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None + self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None ) -> ExpressionIndex: """ ``int_to_float`` converts floating point value of expression ``value`` to size ``size`` potentially setting flags @@ -4395,7 +4396,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FLOAT_CONV, value, size=size, flags=flags) - def round_to_int(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def round_to_int(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``round_to_int`` rounds a floating point value to the nearest integer @@ -4407,7 +4408,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_ROUND_TO_INT, value, size=size, flags=flags) - def floor(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def floor(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``floor`` rounds a floating point value to an integer towards negative infinity @@ -4419,7 +4420,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_FLOOR, value, size=size, flags=flags) - def ceil(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def ceil(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``ceil`` rounds a floating point value to an integer towards positive infinity @@ -4431,7 +4432,7 @@ class LowLevelILFunction: """ return self.expr(LowLevelILOperation.LLIL_CEIL, value, size=size, flags=flags) - def float_trunc(self, size: int, value: ExpressionIndex, flags: 'architecture.FlagType' = None) -> ExpressionIndex: + def float_trunc(self, size: int, value: ExpressionIndex, flags: Optional['architecture.FlagType'] = None) -> ExpressionIndex: """ ``float_trunc`` rounds a floating point value to an integer towards zero diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 6d6077c7..937fc07e 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -37,6 +37,7 @@ from . import variable from . import architecture from . import binaryview from . import databuffer +from . import types as _types from .interaction import show_graph_report from .commonil import ( BaseILInstruction, Constant, BinaryOperation, UnaryOperation, Comparison, SSA, Phi, FloatingPoint, ControlFlow, @@ -719,7 +720,7 @@ class MediumLevelILInstruction(BaseILInstruction): return result def get_possible_stack_contents_after( - self, offset: int, size: int, options: List[DataFlowQueryOption] = None + self, offset: int, size: int, options: Optional[List[DataFlowQueryOption]] = None ) -> 'variable.PossibleValueSet': option_array, option_size = MediumLevelILInstruction._make_options_array(options) value = core.BNGetMediumLevelILPossibleStackContentsAfterInstruction( @@ -1034,7 +1035,7 @@ class MediumLevelILConst(MediumLevelILConstBase): @dataclass(frozen=True, repr=False, eq=False) class MediumLevelILConstData(MediumLevelILConstBase): @property - def constant(self) -> 'DataBuffer': + def constant(self) -> 'databuffer.DataBuffer': return self.function.source_function.view.get_constant_data(self._get_int(0)) @property @@ -3146,7 +3147,7 @@ class MediumLevelILFunction: core.BNFreeILInstructionList(exprs) return result - def create_graph(self, settings: 'function.DisassemblySettings' = None) -> flowgraph.CoreFlowGraph: + def create_graph(self, settings: Optional['function.DisassemblySettings'] = None) -> flowgraph.CoreFlowGraph: if settings is not None: settings_obj = settings.handle else: diff --git a/python/platform.py b/python/platform.py index 4351fe94..355f7c10 100644 --- a/python/platform.py +++ b/python/platform.py @@ -61,7 +61,7 @@ class Platform(metaclass=_PlatformMetaClass): type_file_path = None # path to platform types file type_include_dirs = [] # list of directories available to #include from type_file_path - def __init__(self, arch: 'architecture.Architecture' = None, handle=None): + def __init__(self, arch: Optional['architecture.Architecture'] = None, handle=None): if handle is None: if arch is None: raise ValueError("platform must have an associated architecture") @@ -84,7 +84,7 @@ class Platform(metaclass=_PlatformMetaClass): _arch = architecture.CoreArchitecture._from_cache(core.BNGetPlatformArchitecture(_handle)) assert _handle is not None assert _arch is not None - self.handle:ctypes.POINTER(BNPlatform) = _handle + self.handle: ctypes.POINTER(core.BNPlatform) = _handle self._arch = _arch self._name = None @@ -119,7 +119,7 @@ class Platform(metaclass=_PlatformMetaClass): @classmethod @property - def os_list(self) -> List[str]: + def os_list(cls) -> List[str]: binaryninja._init_plugins() count = ctypes.c_ulonglong() platforms = core.BNGetPlatformOSList(count) |
