Skip to content

Commit d37f7ab

Browse files
committed
Don't inherit from object anymore
1 parent e0389d2 commit d37f7ab

28 files changed

Lines changed: 148 additions & 148 deletions

python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_install_directory():
9090
return core.BNGetInstallDirectory()
9191

9292

93-
class _DestructionCallbackHandler(object):
93+
class _DestructionCallbackHandler:
9494
def __init__(self):
9595
self._cb = core.BNObjectDestructionCallbacks()
9696
self._cb.context = 0

python/architecture.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464

6565
@dataclass(frozen=False)
66-
class RegisterInfo(object):
66+
class RegisterInfo:
6767
full_width_reg:RegisterName
6868
offset:int
6969
size:int = 0
@@ -81,7 +81,7 @@ def __repr__(self):
8181

8282

8383
@dataclass(frozen=False)
84-
class RegisterStackInfo(object):
84+
class RegisterStackInfo:
8585
storage_regs:List[RegisterName]
8686
top_relative_regs:List[RegisterName]
8787
stack_top_reg:RegisterName
@@ -92,7 +92,7 @@ def __repr__(self):
9292

9393

9494
@dataclass(frozen=True)
95-
class IntrinsicInput(object):
95+
class IntrinsicInput:
9696
type:'types.Type'
9797
name:str = ""
9898

@@ -103,7 +103,7 @@ def __repr__(self):
103103

104104

105105
@dataclass(frozen=True)
106-
class IntrinsicInfo(object):
106+
class IntrinsicInfo:
107107
inputs:List[IntrinsicInput]
108108
outputs:List['types.Type']
109109
index:Optional[int] = None
@@ -113,7 +113,7 @@ def __repr__(self):
113113

114114

115115
@dataclass(frozen=True)
116-
class InstructionBranch(object):
116+
class InstructionBranch:
117117
type:BranchType
118118
target:int
119119
arch:'Architecture'
@@ -125,7 +125,7 @@ def __repr__(self):
125125

126126

127127
@dataclass(frozen=False)
128-
class InstructionInfo(object):
128+
class InstructionInfo:
129129
length:int = 0
130130
arch_transition_by_target_addr:bool = False
131131
branch_delay:bool = False

python/basicblock.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ def __repr__(self):
4848
return f"<{self.type.name}: {self.target.start:#x}>"
4949

5050

51-
52-
class BasicBlock(object):
53-
def __init__(self, handle:core.BNBasicBlock, view:Optional['binaryninja.binaryview.BinaryView']=None):
51+
class BasicBlock:
52+
def __init__(self, handle:core.BNBasicBlockHandle, view:Optional['binaryninja.binaryview.BinaryView']=None):
5453
self._view = view
5554
self.handle = core.handle_of_type(handle, core.BNBasicBlock)
5655
self._arch = None

python/binaryview.py

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
InstructionsType = Generator[Tuple[List['_function.InstructionTextToken'], int], None, None]
7070
NotificationType = Mapping['BinaryDataNotification', 'BinaryDataNotificationCallbacks']
7171

72-
class ReferenceSource(object):
72+
class ReferenceSource:
7373
def __init__(self, func:Optional['_function.Function'], arch:Optional['architecture.Architecture'],
7474
addr:int):
7575
self._function = func
@@ -128,7 +128,7 @@ def address(self):
128128
return self._address
129129

130130

131-
class BinaryDataNotification(object):
131+
class BinaryDataNotification:
132132
def __init__(self):
133133
pass
134134

@@ -205,7 +205,7 @@ def type_ref_changed(self, view:'BinaryView', name:'_types.QualifiedName', type:
205205
pass
206206

207207

208-
class StringReference(object):
208+
class StringReference:
209209
_decodings = {
210210
StringType.AsciiString: "ascii",
211211
StringType.Utf8String: "utf-8",
@@ -260,7 +260,7 @@ def view(self) -> 'BinaryView':
260260
return self._view
261261

262262

263-
class AnalysisCompletionEvent(object):
263+
class AnalysisCompletionEvent:
264264
"""
265265
The ``AnalysisCompletionEvent`` object provides an asynchronous mechanism for receiving
266266
callbacks when analysis is complete. The callback runs once. A completion event must be added
@@ -324,7 +324,7 @@ def view(self, value:'BinaryView'):
324324
self._view = value
325325

326326

327-
class BinaryViewEvent(object):
327+
class BinaryViewEvent:
328328
"""
329329
The ``BinaryViewEvent`` object provides a mechanism for receiving callbacks when a BinaryView
330330
is Finalized or the initial analysis is finished. The BinaryView finalized callbacks run before the
@@ -365,7 +365,8 @@ def _notify(view:core.BNBinaryView, callback:BinaryViewEventCallback) -> None:
365365
except:
366366
log.log_error(traceback.format_exc())
367367

368-
class ActiveAnalysisInfo(object):
368+
369+
class ActiveAnalysisInfo:
369370
def __init__(self, func:'_function.Function', analysis_time:int, update_count:int, submit_count:int):
370371
self._func = func
371372
self._analysis_time = analysis_time
@@ -392,7 +393,7 @@ def submit_count(self) -> int:
392393
return self._submit_count
393394

394395

395-
class AnalysisInfo(object):
396+
class AnalysisInfo:
396397
def __init__(self, state:AnalysisState, analysis_time:int, active_info:List[ActiveAnalysisInfo]):
397398
self._state = AnalysisState(state)
398399
self._analysis_time = analysis_time
@@ -414,7 +415,7 @@ def active_info(self) -> List[ActiveAnalysisInfo]:
414415
return self._active_info
415416

416417

417-
class AnalysisProgress(object):
418+
class AnalysisProgress:
418419
def __init__(self, state:AnalysisState, count:int, total:int):
419420
self._state = state
420421
self._count = count
@@ -449,7 +450,7 @@ def total(self) -> int:
449450
return self._total
450451

451452

452-
class BinaryDataNotificationCallbacks(object):
453+
class BinaryDataNotificationCallbacks:
453454
def __init__(self, view:'BinaryView', notify:'BinaryDataNotification'):
454455
self._view = view
455456
self._notify = notify
@@ -1006,8 +1007,8 @@ def add_binaryview_initial_analysis_completion_event(callback):
10061007
BinaryViewEvent.register(BinaryViewEventType.BinaryViewInitialAnalysisCompletionEvent, callback)
10071008

10081009

1009-
class Segment(object):
1010-
def __init__(self, handle:core.BNSegment):
1010+
class Segment:
1011+
def __init__(self, handle:core.BNSegmentHandle):
10111012
self.handle = handle
10121013

10131014
def __del__(self):
@@ -1103,9 +1104,9 @@ def relocation_ranges_at(self, addr:int) -> Generator[Tuple[int, int], None, Non
11031104
core.BNFreeRelocationRanges(ranges, count)
11041105

11051106

1106-
class Section(object):
1107-
def __init__(self, handle:core.BNSection):
1108-
self.handle = core.handle_of_type(handle, core.BNSection)
1107+
class Section:
1108+
def __init__(self, handle:core.BNSectionHandle):
1109+
self.handle = handle
11091110

11101111
def __del__(self):
11111112
core.BNFreeSection(self.handle)
@@ -1174,9 +1175,9 @@ def end(self) -> int:
11741175
return self.start + len(self)
11751176

11761177

1177-
class TagType(object):
1178-
def __init__(self, handle:core.BNTagType):
1179-
self.handle = core.handle_of_type(handle, core.BNTagType)
1178+
class TagType:
1179+
def __init__(self, handle:core.BNTagTypeHandle):
1180+
self.handle = handle
11801181

11811182
def __del__(self):
11821183
core.BNFreeTagType(self.handle)
@@ -1239,9 +1240,9 @@ def type(self, value:TagTypeType) -> None:
12391240
core.BNTagTypeSetType(self.handle, value)
12401241

12411242

1242-
class Tag(object):
1243-
def __init__(self, handle:core.BNTag):
1244-
self.handle = core.handle_of_type(handle, core.BNTag)
1243+
class Tag:
1244+
def __init__(self, handle:core.BNTagHandle):
1245+
self.handle = handle
12451246

12461247
def __del__(self):
12471248
core.BNFreeTag(self.handle)
@@ -1285,7 +1286,7 @@ class _BinaryViewAssociatedDataStore(associateddatastore._AssociatedDataStore):
12851286
_defaults = {}
12861287

12871288

1288-
class BinaryView(object):
1289+
class BinaryView:
12891290
"""
12901291
``class BinaryView`` implements a view on binary data, and presents a queryable interface of a binary file. One key
12911292
job of BinaryView is file format parsing which allows Binary Ninja to read, write, insert, remove portions
@@ -5429,7 +5430,7 @@ def get_linear_disassembly(self, settings=None):
54295430
...
54305431
cf fa ed fe 07 00 00 01 ........
54315432
"""
5432-
class LinearDisassemblyIterator(object):
5433+
class LinearDisassemblyIterator:
54335434
def __init__(self, view, settings):
54345435
self._view = view
54355436
self._settings = settings
@@ -6685,7 +6686,7 @@ def eval(self, expression, here=0):
66856686
return self.parse_expression(expression, here)
66866687

66876688

6688-
class BinaryReader(object):
6689+
class BinaryReader:
66896690
"""
66906691
``class BinaryReader`` is a convenience class for reading binary data.
66916692
@@ -7006,7 +7007,7 @@ def seek_relative(self, offset):
70067007
core.BNSeekBinaryReaderRelative(self._handle, offset)
70077008

70087009

7009-
class BinaryWriter(object):
7010+
class BinaryWriter:
70107011
"""
70117012
``class BinaryWriter`` is a convenience class for writing binary data.
70127013
@@ -7254,7 +7255,7 @@ def seek_relative(self, offset):
72547255
core.BNSeekBinaryWriterRelative(self._handle, offset)
72557256

72567257

7257-
class StructuredDataValue(object):
7258+
class StructuredDataValue:
72587259
def __init__(self, type, address, value, endian):
72597260
self._type = type
72607261
self._address = address
@@ -7319,7 +7320,7 @@ def str(self):
73197320
return str(self)
73207321

73217322

7322-
class StructuredDataView(object):
7323+
class StructuredDataView:
73237324
"""
73247325
``class StructuredDataView`` is a convenience class for reading structured binary data.
73257326
@@ -7441,7 +7442,7 @@ class CoreDataVariable:
74417442
auto_discovered:bool
74427443

74437444

7444-
class DataVariable(object):
7445+
class DataVariable:
74457446
def __init__(self, var:CoreDataVariable, view:'BinaryView'):
74467447
self._var = var
74477448
self._view = view

python/callingconvention.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from . import architecture
3131

3232

33-
class CallingConvention(object):
33+
class CallingConvention:
3434
name = None
3535
caller_saved_regs = []
3636
callee_saved_regs = []

python/databuffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Binary Ninja components
2424
from . import _binaryninjacore as core
2525

26-
class DataBuffer(object):
26+
class DataBuffer:
2727
def __init__(self, contents:bytes=b"", handle=None):
2828
if handle is not None:
2929
self.handle = core.handle_of_type(handle, core.BNDataBuffer)

python/datarender.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from . import highlight
3434

3535

36-
class TypeContext(object):
36+
class TypeContext:
3737
def __init__(self, _type, _offset):
3838
self._type = _type
3939
self._offset = _offset
@@ -48,7 +48,7 @@ def offset(self):
4848
"""The offset into the given type object"""
4949
return self._offset
5050

51-
class DataRenderer(object):
51+
class DataRenderer:
5252
"""
5353
DataRenderer objects tell the Linear View how to render specific types.
5454

python/fileaccessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from . import _binaryninjacore as core
2626
from . import log
2727

28-
class FileAccessor(object):
28+
class FileAccessor:
2929
def __init__(self):
3030
self._cb = core.BNFileAccessor()
3131
self._cb.context = 0

python/filemetadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
ProgressFuncType = Callable[[int, int], bool]
3434
ViewName = str
3535

36-
class NavigationHandler(object):
36+
class NavigationHandler:
3737
def _register(self, handle) -> None:
3838
self._cb = core.BNNavigationHandler()
3939
self._cb.context = 0
@@ -74,7 +74,7 @@ def navigate(self, view:ViewName, offset:int) -> bool:
7474
return NotImplemented
7575

7676

77-
class SaveSettings(object):
77+
class SaveSettings:
7878
"""
7979
``class SaveSettings`` is used to specify actions and options that apply to saving a database (.bndb).
8080
"""
@@ -112,7 +112,7 @@ class _FileMetadataAssociatedDataStore(associateddatastore._AssociatedDataStore)
112112
_defaults = {}
113113

114114

115-
class FileMetadata(object):
115+
class FileMetadata:
116116
"""
117117
``class FileMetadata`` represents the file being analyzed by Binary Ninja. It is responsible for opening,
118118
closing, creating the database (.bndb) files, and is used to keep track of undoable actions.

python/flowgraph.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from . import interaction
3939

4040

41-
class FlowGraphEdge(object):
41+
class FlowGraphEdge:
4242
def __init__(self, branch_type, source, target, points, back_edge, style):
4343
self.type = BranchType(branch_type)
4444
self.source = source
@@ -58,7 +58,7 @@ def __hash__(self):
5858
return hash((self.type, self.source, self.target, self.points, self.back_edge, self.style))
5959

6060

61-
class EdgeStyle(object):
61+
class EdgeStyle:
6262
def __init__(self, style=None, width=None, theme_color=None):
6363
self.style = style if style is not None else EdgePenStyle.SolidLine
6464
self.width = width if width is not None else 0
@@ -82,7 +82,7 @@ def __eq__(self, other):
8282
def __hash__(self):
8383
return hash((self.style, self.width, self.color))
8484

85-
class FlowGraphNode(object):
85+
class FlowGraphNode:
8686
def __init__(self, graph = None, handle = None):
8787
if handle is None:
8888
if graph is None:
@@ -335,7 +335,7 @@ def is_valid_for_graph(self, graph):
335335
return core.BNIsNodeValidForFlowGraph(graph.handle, self.handle)
336336

337337

338-
class FlowGraphLayoutRequest(object):
338+
class FlowGraphLayoutRequest:
339339
def __init__(self, graph, callback = None):
340340
self.on_complete = callback
341341
self._cb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)(self._complete)
@@ -367,7 +367,7 @@ def abort(self):
367367
self.on_complete = None
368368

369369

370-
class FlowGraph(object):
370+
class FlowGraph:
371371
"""
372372
``class FlowGraph`` implements a directed flow graph to be shown in the UI. This class allows plugins to
373373
create custom flow graphs and render them in the UI using the flow graph report API.

0 commit comments

Comments
 (0)