Skip to content

Commit 25212cf

Browse files
committed
Fix some python type hints
1 parent 501af66 commit 25212cf

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

python/basedetection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ def aborted(self) -> bool:
162162
def detect_base_address(
163163
self,
164164
arch: Optional[Union['architecture.Architecture', str]] = None,
165-
analysis: Optional[Literal["basic", "controlFlow", "full"]] = "full",
166-
min_strlen: Optional[int] = 10,
167-
alignment: Optional[int] = 1024,
168-
low_boundary: Optional[int] = 0,
169-
high_boundary: Optional[int] = 0xFFFFFFFFFFFFFFFF,
170-
poi_analysis: Optional[BaseAddressDetectionPOISetting] = BaseAddressDetectionPOISetting.POIAnalysisAll,
171-
max_pointers: Optional[int] = 128,
165+
analysis: Literal["basic", "controlFlow", "full"] = "full",
166+
min_strlen: int = 10,
167+
alignment: int = 1024,
168+
low_boundary: int = 0,
169+
high_boundary: int = 0xFFFFFFFFFFFFFFFF,
170+
poi_analysis: BaseAddressDetectionPOISetting = BaseAddressDetectionPOISetting.POIAnalysisAll,
171+
max_pointers: int = 128,
172172
) -> bool:
173173
"""
174174
``detect_base_address`` runs initial analysis and attempts to identify candidate base addresses

python/basicblock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import ctypes
2222
from dataclasses import dataclass
23-
from typing import Generator, Optional, List, Tuple
23+
from typing import Generator, Optional, List, Tuple, Union
2424

2525
# Binary Ninja components
2626
import binaryninja
@@ -106,7 +106,7 @@ def __del__(self):
106106
core.BNFreeBasicBlock(self.handle)
107107

108108
@classmethod
109-
def _from_core_block(cls, block: core.BNBasicBlockHandle) -> Optional['BasicBlock']:
109+
def _from_core_block(cls, block: core.BNBasicBlockHandle) -> Optional[Union['BasicBlock', 'binaryninja.lowlevelil.LowLevelILBasicBlock', 'binaryninja.mediumlevelil.MediumLevelILBasicBlock', 'binaryninja.highlevelil.HighLevelILBasicBlock']]:
110110
"""From a BNBasicBlockHandle, get a BasicBlock or one of the IL subclasses (takes ref)"""
111111
func_handle = core.BNGetBasicBlockFunction(block)
112112
if not func_handle:
@@ -674,8 +674,8 @@ def dominance_frontier(self) -> List['BasicBlock']:
674674
Dominance frontier for this basic block (read-only)
675675
676676
The dominance frontier of a basic block B is the set of blocks that are not strictly dominated by B,
677-
but are immediately control-dependent on B. In other words, it contains the blocks where B's dominance
678-
"stops" - the blocks that have at least one predecessor not dominated by B, while having another
677+
but are immediately control-dependent on B. In other words, it contains the blocks where B's dominance
678+
"stops" - the blocks that have at least one predecessor not dominated by B, while having another
679679
predecessor that is dominated by B.
680680
"""
681681
count = ctypes.c_ulonglong()

python/binaryview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7322,7 +7322,7 @@ def remove_component(self, _component: Union[component.Component, str]) -> bool:
73227322

73237323
raise TypeError("Removal is only supported with a Component or string representing its Guid")
73247324

7325-
def get_function_parent_components(self, function: 'function.Function') -> List['component.Component']:
7325+
def get_function_parent_components(self, function: '_function.Function') -> List['component.Component']:
73267326
_components = []
73277327
count = ctypes.c_ulonglong(0)
73287328
bn_components = core.BNGetFunctionParentComponents(self.handle, function.handle, count)

python/debuginfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def is_valid_for_view(self, view: 'binaryview.BinaryView') -> bool:
222222
"""Returns whether this debug-info parser is valid for the provided binary view"""
223223
return core.BNIsDebugInfoParserValidForView(self.handle, view.handle)
224224

225-
def parse_debug_info(self, view: 'binaryview.BinaryView', debug_view: 'binaryview.BinaryView', debug_info: Optional["DebugInfo"] = None, progress: ProgressFuncType = None) -> Optional["DebugInfo"]:
225+
def parse_debug_info(self, view: 'binaryview.BinaryView', debug_view: 'binaryview.BinaryView', debug_info: Optional["DebugInfo"] = None, progress: Optional[ProgressFuncType] = None) -> Optional["DebugInfo"]:
226226
"""
227227
Returns a ``DebugInfo`` object populated with debug info by this debug-info parser. Only provide a ``DebugInfo`` object if you wish to append to the existing debug info.
228228

0 commit comments

Comments
 (0)