summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-10-15 13:15:42 -0400
committerJosh Ferrell <josh@vector35.com>2025-10-15 13:16:01 -0400
commit25212cfd39f6dc45ce9030c194b6131645b76ba3 (patch)
tree3d17e7456a8812887dc488371a7f48e0fb0a4946 /python
parent501af661e5805cb0139ac7fca29b6a5dbd3beefd (diff)
Fix some python type hints
Diffstat (limited to 'python')
-rw-r--r--python/basedetection.py14
-rw-r--r--python/basicblock.py8
-rw-r--r--python/binaryview.py2
-rw-r--r--python/debuginfo.py2
4 files changed, 13 insertions, 13 deletions
diff --git a/python/basedetection.py b/python/basedetection.py
index e5b51cd1..ea6151cc 100644
--- a/python/basedetection.py
+++ b/python/basedetection.py
@@ -162,13 +162,13 @@ class BaseAddressDetection:
def detect_base_address(
self,
arch: Optional[Union['architecture.Architecture', str]] = None,
- analysis: Optional[Literal["basic", "controlFlow", "full"]] = "full",
- min_strlen: Optional[int] = 10,
- alignment: Optional[int] = 1024,
- low_boundary: Optional[int] = 0,
- high_boundary: Optional[int] = 0xFFFFFFFFFFFFFFFF,
- poi_analysis: Optional[BaseAddressDetectionPOISetting] = BaseAddressDetectionPOISetting.POIAnalysisAll,
- max_pointers: Optional[int] = 128,
+ analysis: Literal["basic", "controlFlow", "full"] = "full",
+ min_strlen: int = 10,
+ alignment: int = 1024,
+ low_boundary: int = 0,
+ high_boundary: int = 0xFFFFFFFFFFFFFFFF,
+ poi_analysis: BaseAddressDetectionPOISetting = BaseAddressDetectionPOISetting.POIAnalysisAll,
+ max_pointers: int = 128,
) -> bool:
"""
``detect_base_address`` runs initial analysis and attempts to identify candidate base addresses
diff --git a/python/basicblock.py b/python/basicblock.py
index 9f02f2a9..4f279432 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -20,7 +20,7 @@
import ctypes
from dataclasses import dataclass
-from typing import Generator, Optional, List, Tuple
+from typing import Generator, Optional, List, Tuple, Union
# Binary Ninja components
import binaryninja
@@ -106,7 +106,7 @@ class BasicBlock:
core.BNFreeBasicBlock(self.handle)
@classmethod
- def _from_core_block(cls, block: core.BNBasicBlockHandle) -> Optional['BasicBlock']:
+ def _from_core_block(cls, block: core.BNBasicBlockHandle) -> Optional[Union['BasicBlock', 'binaryninja.lowlevelil.LowLevelILBasicBlock', 'binaryninja.mediumlevelil.MediumLevelILBasicBlock', 'binaryninja.highlevelil.HighLevelILBasicBlock']]:
"""From a BNBasicBlockHandle, get a BasicBlock or one of the IL subclasses (takes ref)"""
func_handle = core.BNGetBasicBlockFunction(block)
if not func_handle:
@@ -674,8 +674,8 @@ class BasicBlock:
Dominance frontier for this basic block (read-only)
The dominance frontier of a basic block B is the set of blocks that are not strictly dominated by B,
- but are immediately control-dependent on B. In other words, it contains the blocks where B's dominance
- "stops" - the blocks that have at least one predecessor not dominated by B, while having another
+ but are immediately control-dependent on B. In other words, it contains the blocks where B's dominance
+ "stops" - the blocks that have at least one predecessor not dominated by B, while having another
predecessor that is dominated by B.
"""
count = ctypes.c_ulonglong()
diff --git a/python/binaryview.py b/python/binaryview.py
index 88779630..26d20edd 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -7322,7 +7322,7 @@ class BinaryView:
raise TypeError("Removal is only supported with a Component or string representing its Guid")
- def get_function_parent_components(self, function: 'function.Function') -> List['component.Component']:
+ def get_function_parent_components(self, function: '_function.Function') -> List['component.Component']:
_components = []
count = ctypes.c_ulonglong(0)
bn_components = core.BNGetFunctionParentComponents(self.handle, function.handle, count)
diff --git a/python/debuginfo.py b/python/debuginfo.py
index 376e2b5e..17dbec5e 100644
--- a/python/debuginfo.py
+++ b/python/debuginfo.py
@@ -222,7 +222,7 @@ class DebugInfoParser(object, metaclass=_DebugInfoParserMetaClass):
"""Returns whether this debug-info parser is valid for the provided binary view"""
return core.BNIsDebugInfoParserValidForView(self.handle, view.handle)
- def parse_debug_info(self, view: 'binaryview.BinaryView', debug_view: 'binaryview.BinaryView', debug_info: Optional["DebugInfo"] = None, progress: ProgressFuncType = None) -> Optional["DebugInfo"]:
+ def parse_debug_info(self, view: 'binaryview.BinaryView', debug_view: 'binaryview.BinaryView', debug_info: Optional["DebugInfo"] = None, progress: Optional[ProgressFuncType] = None) -> Optional["DebugInfo"]:
"""
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.