summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/architecture.py10
-rw-r--r--python/basicblock.py6
-rw-r--r--python/binaryview.py6
-rw-r--r--python/bncompleter.py2
-rw-r--r--python/callingconvention.py2
-rw-r--r--python/downloadprovider.py2
-rw-r--r--python/filemetadata.py2
-rw-r--r--python/mediumlevelil.py10
8 files changed, 20 insertions, 20 deletions
diff --git a/python/architecture.py b/python/architecture.py
index db0c2a77..de28dc77 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -99,8 +99,8 @@ class IntrinsicInput:
def __repr__(self):
if len(self.name) == 0:
- return "<input: %s>" % str(self.type)
- return "<input: %s %s>" % (str(self.type), self.name)
+ return f"<input: {self.type}>"
+ return f"<input: {self.type} {self.name}>"
@dataclass(frozen=True)
@@ -162,7 +162,7 @@ class _ArchitectureMetaClass(type):
binaryninja._init_plugins()
arch = core.BNGetArchitectureByName(name)
if arch is None:
- raise KeyError("'%s' is not a valid architecture" % str(name))
+ raise KeyError(f"'{name}' is not a valid architecture")
return CoreArchitecture._from_cache(arch)
@@ -476,7 +476,7 @@ class Architecture(metaclass=_ArchitectureMetaClass):
self._pending_type_lists = {}
def __repr__(self):
- return "<arch: %s>" % self.name
+ return f"<arch: {self.name}>"
def __eq__(self, other):
if not isinstance(other, self.__class__):
@@ -2390,7 +2390,7 @@ class CoreArchitecture(Architecture):
if not core.BNAssemble(self.handle, code, addr, result.handle, errors):
error_str = errors.value
core.free_string(errors)
- raise ValueError("Could not assemble: %s" % error_str)
+ raise ValueError(f"Could not assemble: {error_str}")
return bytes(result)
def is_never_branch_patch_available(self, data:bytes, addr:int=0) -> bool:
diff --git a/python/basicblock.py b/python/basicblock.py
index 872e44b8..3854ffd5 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -64,9 +64,9 @@ class BasicBlock:
def __repr__(self):
arch = self.arch
if arch:
- return "<block: %s@%#x-%#x>" % (arch.name, self.start, self.end)
+ return f"<block: {arch.name}@{self.start:#x}-{self.end:#x}>"
else:
- return "<block: %#x-%#x>" % (self.start, self.end)
+ return f"<block: {self.start:#x}-{self.end:#x}>"
def __len__(self):
return int(core.BNGetBasicBlockLength(self.handle))
@@ -88,7 +88,7 @@ class BasicBlock:
try:
object.__setattr__(self, name, value)
except AttributeError:
- raise AttributeError("attribute '%s' is read only" % name)
+ raise AttributeError(f"attribute '{name}' is read only")
def __iter__(self) -> Generator[Tuple[List['_function.InstructionTextToken'], int], None, None]:
if self.arch is None:
diff --git a/python/binaryview.py b/python/binaryview.py
index 28634f83..28db7271 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -383,7 +383,7 @@ class AnalysisProgress:
return "Extended Analysis"
def __repr__(self):
- return "<progress: %s>" % str(self)
+ return f"<progress: {self}>"
class BinaryDataNotificationCallbacks:
@@ -636,7 +636,7 @@ class _BinaryViewTypeMetaclass(type):
binaryninja._init_plugins()
view_type = core.BNGetBinaryViewTypeByName(str(value))
if view_type is None:
- raise KeyError("'%s' is not a valid view type" % str(value))
+ raise KeyError(f"'{value}' is not a valid view type")
return BinaryViewType(view_type)
@@ -7844,4 +7844,4 @@ class DataVariableAndName(CoreDataVariable):
self.name = var_name
def __repr__(self) -> str:
- return "<var 0x%x: %s %s>" % (self.address, str(self.type), self.name) \ No newline at end of file
+ return f"<var {self.address:#x}: {self.type} {self.name}>" \ No newline at end of file
diff --git a/python/bncompleter.py b/python/bncompleter.py
index 330cf0d0..0063bf5f 100644
--- a/python/bncompleter.py
+++ b/python/bncompleter.py
@@ -197,7 +197,7 @@ class Completer:
while True:
for word in words:
if (word[:n] == attr and not (noprefix and word[:n+1] == noprefix)):
- match = "%s.%s" % (expr, word)
+ match = f"{expr}.{word}"
try:
val = inspect.getattr_static(thisobject, word)
except Exception:
diff --git a/python/callingconvention.py b/python/callingconvention.py
index ff3e8ff6..1b068536 100644
--- a/python/callingconvention.py
+++ b/python/callingconvention.py
@@ -170,7 +170,7 @@ class CallingConvention:
core.BNFreeCallingConvention(self.handle)
def __repr__(self):
- return "<calling convention: %s %s>" % (self.arch.name, self.name)
+ return f"<calling convention: {self.arch.name} {self.name}>"
def __str__(self):
return self.name
diff --git a/python/downloadprovider.py b/python/downloadprovider.py
index cf63a6f1..c44b91e1 100644
--- a/python/downloadprovider.py
+++ b/python/downloadprovider.py
@@ -261,7 +261,7 @@ class _DownloadProviderMetaclass(type):
binaryninja._init_plugins()
provider = core.BNGetDownloadProviderByName(str(value))
if provider is None:
- raise KeyError("'%s' is not a valid download provider" % str(value))
+ raise KeyError(f"'{value}' is not a valid download provider")
return DownloadProvider(provider)
diff --git a/python/filemetadata.py b/python/filemetadata.py
index f4cc75f3..a8c738c2 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -141,7 +141,7 @@ class FileMetadata:
self.handle = _handle
def __repr__(self):
- return "<FileMetadata: %s>" % self.filename
+ return f"<FileMetadata: {self.filename}>"
def __del__(self):
if self.navigation is not None:
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index ae6c8b01..d890a860 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -271,7 +271,7 @@ class MediumLevelILInstruction:
return result
def __repr__(self):
- return "<il: %s>" % str(self)
+ return f"<il: {self}>"
def __eq__(self, other:'MediumLevelILInstruction') -> bool:
if not isinstance(other, MediumLevelILInstruction):
@@ -2597,9 +2597,9 @@ class MediumLevelILFunction:
def __repr__(self):
arch = self.source_function.arch
if arch:
- return "<mlil func: %s@%#x>" % (arch.name, self.source_function.start)
+ return f"<mlil func: {arch.name}@{self.source_function.start:#x}>"
else:
- return "<mlil func: %#x>" % self.source_function.start
+ return f"<mlil func: {self.source_function.start:#x}>"
def __len__(self):
return int(core.BNGetMediumLevelILInstructionCount(self.handle))
@@ -3056,9 +3056,9 @@ class MediumLevelILBasicBlock(basicblock.BasicBlock):
def __repr__(self):
arch = self.arch
if arch:
- return "<mlil block: %s@%d-%d>" % (arch.name, self.start, self.end)
+ return f"<mlil block: {arch.name}@{self.start}-{self.end}>"
else:
- return "<mlil block: %d-%d>" % (self.start, self.end)
+ return f"<mlil block: {self.start}-{self.end}>"
def __iter__(self):
for idx in range(self.start, self.end):