summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2022-01-26 10:44:52 -0500
committerPeter LaFosse <peter@vector35.com>2022-01-26 10:54:03 -0500
commite25d8896b6306cb6f984964c77b6a670a39cd11d (patch)
treecd963d42a49354fc09d51ef7559a0e425836a86c /python/types.py
parent344b7f695aeb333bd86a56029799ceef122b947d (diff)
Convert SizeWithConfidence to OffsetWithConfidence and remove
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py50
1 files changed, 1 insertions, 49 deletions
diff --git a/python/types.py b/python/types.py
index 65a9f311..5a7357ee 100644
--- a/python/types.py
+++ b/python/types.py
@@ -38,7 +38,6 @@ from . import typelibrary
QualifiedNameType = Union[Iterable[Union[str, bytes]], str, 'QualifiedName']
BoolWithConfidenceType = Union[bool, 'BoolWithConfidence']
-SizeWithConfidenceType = Union[int, 'SizeWithConfidence']
OffsetWithConfidenceType = Union[int, 'OffsetWithConfidence']
ParamsType = Union[List['Type'], List['FunctionParameter'], List[Tuple['Type', str]]]
MembersType = Union[List['StructureMember'], List['Type'], List[Tuple['Type', str]]]
@@ -448,53 +447,6 @@ class BoolWithConfidence:
return BoolWithConfidence(value)._to_core_struct()
-@dataclass(frozen=True)
-class SizeWithConfidence:
- value:int
- confidence:int=core.max_confidence
-
- def __int__(self):
- return self.value
-
- def __eq__(self, other):
- if not isinstance(other, self.__class__):
- return self.value == int(other)
- else:
- return (self.value, self.confidence) == (other.value, other.confidence)
-
- def __ne__(self, other):
- return not (self == other)
-
- def __gt__(self, other):
- return self.value > int(other)
-
- def __le__(self, other):
- return self.value <= int(other)
-
- def __ge__(self, other):
- return self.value >= int(other)
-
- def __lt__(self, other):
- return self.value < int(other)
-
- def _to_core_struct(self) -> core.BNSizeWithConfidence:
- result = core.BNSizeWithConfidence()
- result.value = self.value
- result.confidence = self.confidence
- return result
-
- @classmethod
- def from_core_struct(cls, core_struct:core.BNSizeWithConfidence) -> 'SizeWithConfidence':
- return cls(core_struct.value, core_struct.confidence)
-
- @staticmethod
- def get_core_struct(value:SizeWithConfidenceType) -> core.BNSizeWithConfidence:
- if isinstance(value, SizeWithConfidence):
- return value._to_core_struct()
- else:
- return SizeWithConfidence(value)._to_core_struct()
-
-
@dataclass
class MutableTypeBuilder:
type:'TypeBuilder'
@@ -655,7 +607,7 @@ class TypeBuilder:
@staticmethod
def function(ret:Optional['Type']=None, params:Optional[ParamsType]=None, calling_convention:'callingconvention.CallingConvention'=None,
variable_arguments:BoolWithConfidenceType=BoolWithConfidence(False),
- stack_adjust:SizeWithConfidenceType=0) -> 'FunctionBuilder':
+ stack_adjust:OffsetWithConfidenceType=0) -> 'FunctionBuilder':
"""
``function`` class method for creating an function Type.
:param Type ret: return Type of the function