summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-08-27 12:51:26 -0400
committerPeter LaFosse <peter@vector35.com>2021-09-06 11:46:38 -0400
commite7400c394eca465d2a54a70c16bb175e4521de91 (patch)
treea8bcfbafdbcc0bbb401b98a557fa564827a65c55
parent5c14a62561b94f453dd41ea92634ac4151a4e3a6 (diff)
Use more f-strings
-rw-r--r--python/architecture.py4
-rw-r--r--python/function.py4
-rw-r--r--suite/testcommon.py6
3 files changed, 7 insertions, 7 deletions
diff --git a/python/architecture.py b/python/architecture.py
index 46f21f88..1ca6d9c6 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -77,7 +77,7 @@ class RegisterInfo:
extend = ", sign extend"
else:
extend = ""
- return "<reg: size %d, offset %d in %s%s>" % (self.size, self.offset, self.full_width_reg, extend)
+ return f"<reg: size {self.size}, offset {self.offset} in {self.full_width_reg}{extend}>"
@dataclass(frozen=False)
@@ -88,7 +88,7 @@ class RegisterStackInfo:
index:Optional[RegisterStackIndex] = None
def __repr__(self):
- return "<reg stack: %d regs, stack top in %s>" % (len(self.storage_regs), self.stack_top_reg)
+ return f"<reg stack: {len(self.storage_regs)} regs, stack top in {self.stack_top_reg}>"
@dataclass(frozen=True)
diff --git a/python/function.py b/python/function.py
index 515c1008..ed157ba7 100644
--- a/python/function.py
+++ b/python/function.py
@@ -272,9 +272,9 @@ class Function:
def __repr__(self):
arch = self.arch
if arch:
- return "<func: %s@%#x>" % (arch.name, self.start)
+ return f"<func: {arch.name}@{self.start:#x}>"
else:
- return "<func: %#x>" % self.start
+ return f"<func: {self.start:#x}>"
def __eq__(self, other:'Function') -> bool:
if not isinstance(other, self.__class__):
diff --git a/suite/testcommon.py b/suite/testcommon.py
index 45345949..e56b94d9 100644
--- a/suite/testcommon.py
+++ b/suite/testcommon.py
@@ -151,10 +151,10 @@ class BinaryViewTestBuilder(Builder):
bblist = []
for func in self.bv.functions:
for bb in func.basic_blocks:
- bblist.append("basic block {} start: ".format(str(bb)) + hex(bb.start) + ' end: ' + hex(bb.end) + ' undetermined outgoing edges: ' + str(bb.has_undetermined_outgoing_edges) + ' incoming edges: ' + str(bb.incoming_edges) + ' outgoing edges: ' + str(bb.outgoing_edges))
+ bblist.append(f"basic block {bb} start: {bb.start:#x} end: {bb.end:#x} undetermined outgoing edges: {bb.has_undetermined_outgoing_edges} incoming edges: {bb.incoming_edges} outgoing edges: {bb.outgoing_edges}")
for anno in func.get_block_annotations(bb.start):
- bblist.append("basic block {} function annotation: ".format(str(bb)) + str(anno))
- bblist.append("basic block {} test get self: ".format(str(bb)) + str(func.get_basic_block_at(bb.start)))
+ bblist.append(f"basic block {bb} function annotation: {anno}")
+ bblist.append(f"basic block {bb} test get self: {func.get_basic_block_at(bb.start)}")
return fixOutput(bblist)
def test_function_low_il_basic_blocks(self):