8080from . import deprecation
8181from . import typecontainer
8282from . import externallibrary
83- from . import project
8483from . import undo
8584from . import stringrecognizer
8685
8786
8887PathType = Union [str , os .PathLike ]
8988InstructionsType = Generator [Tuple [List ['_function.InstructionTextToken' ], int ], None , None ]
90- NotificationType = Mapping ['BinaryDataNotification' , 'BinaryDataNotificationCallbacks' ]
9189ProgressFuncType = Callable [[int , int ], bool ]
9290DataMatchCallbackType = Callable [[int , 'databuffer.DataBuffer' ], bool ]
9391LineMatchCallbackType = Callable [[int , 'lineardisassembly.LinearDisassemblyLine' ], bool ]
@@ -127,10 +125,10 @@ def llil(self) -> Optional[lowlevelil.LowLevelILInstruction]:
127125 return self .function .get_low_level_il_at (self .address , self .arch )
128126
129127 @property
130- def llils (self ) -> Iterator [lowlevelil .LowLevelILInstruction ]:
128+ def llils (self ) -> List [lowlevelil .LowLevelILInstruction ]:
131129 """Returns the low level il instructions at the current location if any exists"""
132130 if self .function is None or self .arch is None :
133- return
131+ return []
134132 return self .function .get_low_level_ils_at (self .address , self .arch )
135133
136134 @property
@@ -306,7 +304,7 @@ class BinaryDataNotification:
306304 >>>
307305 """
308306
309- def __init__ (self , notifications : NotificationType = None ):
307+ def __init__ (self , notifications : Optional [ NotificationType ] = None ):
310308 self .notifications = notifications
311309
312310 def notification_barrier (self , view : 'BinaryView' ) -> int :
@@ -826,7 +824,7 @@ def __init__(self, view: 'BinaryView', notify: 'BinaryDataNotification'):
826824 self ._notify = notify
827825 self ._cb = core .BNBinaryDataNotification ()
828826 self ._cb .context = 0
829- if (not hasattr (notify , 'notifications' )) or (hasattr ( notify , 'notifications' ) and notify .notifications is None ):
827+ if (not hasattr (notify , 'notifications' )) or (notify .notifications is None ):
830828 self ._cb .notificationBarrier = self ._cb .notificationBarrier
831829 self ._cb .dataWritten = self ._cb .dataWritten .__class__ (self ._data_written )
832830 self ._cb .dataInserted = self ._cb .dataInserted .__class__ (self ._data_inserted )
@@ -9369,7 +9367,7 @@ def find_next_constant(
93699367 return result .value
93709368
93719369 class QueueGenerator :
9372- def __init__ (self , t , results ):
9370+ def __init__ (self , t : threading . Thread , results : queue . Queue ):
93739371 self .thread = t
93749372 self .results = results
93759373 t .start ()
@@ -9388,7 +9386,7 @@ def __next__(self):
93889386 def find_all_data (
93899387 self , start : int , end : int , data : bytes , flags : FindFlag = FindFlag .FindCaseSensitive ,
93909388 progress_func : Optional [ProgressFuncType ] = None , match_callback : Optional [DataMatchCallbackType ] = None
9391- ) -> QueueGenerator :
9389+ ) -> Union [ QueueGenerator , bool ] :
93929390 """
93939391 ``find_all_data`` searches for the bytes ``data`` starting at the virtual address ``start``
93949392 until the virtual address ``end``. Once a match is found, the ``match_callback`` is called.
@@ -9464,7 +9462,7 @@ def find_all_text(
94649462 self , start : int , end : int , text : str , settings : Optional [_function .DisassemblySettings ] = None ,
94659463 flags = FindFlag .FindCaseSensitive , graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph , progress_func = None ,
94669464 match_callback = None
9467- ) -> QueueGenerator :
9465+ ) -> Union [ QueueGenerator , bool ] :
94689466 """
94699467 ``find_all_text`` searches for string ``text`` occurring in the linear view output starting
94709468 at the virtual address ``start`` until the virtual address ``end``. Once a match is found,
@@ -9559,7 +9557,7 @@ def find_all_constant(
95599557 self , start : int , end : int , constant : int , settings : Optional [_function .DisassemblySettings ] = None ,
95609558 graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph , progress_func : Optional [ProgressFuncType ] = None ,
95619559 match_callback : Optional [LineMatchCallbackType ] = None
9562- ) -> QueueGenerator :
9560+ ) -> Union [ QueueGenerator , bool ] :
95639561 """
95649562 ``find_all_constant`` searches for the integer constant ``constant`` starting at the
95659563 virtual address ``start`` until the virtual address ``end``. Once a match is found,
@@ -9632,8 +9630,8 @@ def find_all_constant(
96329630
96339631 return self .QueueGenerator (t , results )
96349632
9635- def search (self , pattern : str , start : int = None , end : int = None , raw : bool = False , ignore_case : bool = False , overlap : bool = False , align : int = 1 ,
9636- limit : int = None , progress_callback : Optional [ProgressFuncType ] = None , match_callback : Optional [DataMatchCallbackType ] = None ) -> QueueGenerator :
9633+ def search (self , pattern : str , start : Optional [ int ] = None , end : Optional [ int ] = None , raw : bool = False , ignore_case : bool = False , overlap : bool = False , align : int = 1 ,
9634+ limit : Optional [ int ] = None , progress_callback : Optional [ProgressFuncType ] = None , match_callback : Optional [DataMatchCallbackType ] = None ) -> QueueGenerator :
96379635 r"""
96389636 Searches for matches of the specified ``pattern`` within this BinaryView with an optionally provided address range specified by ``start`` and ``end``.
96399637 This is the API used by the advanced binary search UI option. The search pattern can be interpreted in various ways:
@@ -11355,7 +11353,10 @@ def value(self, data: Union[bytes, int, float]) -> None:
1135511353 if isinstance (self .type , (_types .IntegerType , _types .IntegerBuilder )):
1135611354 signed = bool (self .type .signed )
1135711355 to_write = data .to_bytes (len (self ), TypedDataAccessor .byte_order (self .endian ), signed = signed ) # type: ignore
11358- elif isinstance (data , float ) and isinstance (self .type , (_types .FloatType , _types .FloatBuilder )):
11356+ elif isinstance (data , float ):
11357+ if not isinstance (self .type , (_types .FloatType , _types .FloatBuilder )):
11358+ raise TypeError (f"Can't set the value of type { type (self .type )} to float value" )
11359+
1135911360 endian = "<" if self .endian == Endianness .LittleEndian else ">"
1136011361 if self .type .width == 2 :
1136111362 code = "e"
0 commit comments