diff options
| author | Peter LaFosse <peter@vector35.com> | 2021-06-23 20:20:50 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2021-09-05 10:09:09 -0400 |
| commit | bc5c0977dc5b4087e8f39cc67089bb5709aac04e (patch) | |
| tree | 2e955215d9a9000a84412f814d011248f6bdbe5d /python/flowgraph.py | |
| parent | 421b398453d09e06e7b202229e34b66414683a45 (diff) | |
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
Diffstat (limited to 'python/flowgraph.py')
| -rw-r--r-- | python/flowgraph.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/python/flowgraph.py b/python/flowgraph.py index 0fd2ae09..0a0faae9 100644 --- a/python/flowgraph.py +++ b/python/flowgraph.py @@ -84,13 +84,13 @@ class EdgeStyle: class FlowGraphNode: def __init__(self, graph = None, handle = None): - if handle is None: + _handle = handle + if _handle is None: if graph is None: - self.handle = None raise ValueError("flow graph node must be associated with a graph") - handle = core.BNCreateFlowGraphNode(graph.handle) - self.handle = handle - assert self.handle is not None, "core.BNCreateFlowGraphNode returned None" + _handle = core.BNCreateFlowGraphNode(graph.handle) + assert _handle is not None + self.handle = _handle self._graph = graph if self._graph is None: self._graph = FlowGraph(handle = core.BNGetFlowGraphNodeOwner(self.handle)) @@ -112,9 +112,6 @@ class FlowGraphNode: def __eq__(self, other): if not isinstance(other, self.__class__): return NotImplemented - - assert self.handle is not None - assert other.handle is not None return ctypes.addressof(self.handle.contents) == ctypes.addressof(other.handle.contents) def __ne__(self, other): @@ -123,7 +120,6 @@ class FlowGraphNode: return not (self == other) def __hash__(self): - assert self.handle is not None return hash(ctypes.addressof(self.handle.contents)) def __iter__(self): @@ -411,6 +407,7 @@ class FlowGraph: self._ext_cb.externalRefTaken = self._ext_cb.externalRefTaken.__class__(self._external_ref_taken) self._ext_cb.externalRefReleased = self._ext_cb.externalRefReleased.__class__(self._external_ref_released) handle = core.BNCreateCustomFlowGraph(self._ext_cb) + assert handle is not None self.handle = handle def __del__(self): @@ -425,8 +422,6 @@ class FlowGraph: def __eq__(self, other): if not isinstance(other, self.__class__): return NotImplemented - assert self.handle is not None - assert other.handle is not None return ctypes.addressof(self.handle.contents) == ctypes.addressof(other.handle.contents) def __ne__(self, other): |
