summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authornullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com>2026-02-14 01:42:06 +1100
committerGlenn Smith <glenn@vector35.com>2026-02-26 13:47:39 -0500
commit1477644130363181529308369212747957500371 (patch)
treee8b60c2cab88f67666a105cbb27b48efab74a601 /python/types.py
parent6898277643046680846138467766554534807928 (diff)
feat[python]: QualifiedName.separator
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/python/types.py b/python/types.py
index 83957bb4..b9e1141d 100644
--- a/python/types.py
+++ b/python/types.py
@@ -85,7 +85,7 @@ def convert_integer(value: ctypes.c_uint64, signed: bool, width: int) -> int:
return func[bool(signed)][width](value).value
class QualifiedName:
- def __init__(self, name: Optional[QualifiedNameType] = None):
+ def __init__(self, name: Optional[QualifiedNameType] = None, separator: str = "::"):
self._name: List[str] = []
if isinstance(name, str):
self._name = [name]
@@ -99,9 +99,10 @@ class QualifiedName:
self._name.append(i.decode("utf-8"))
else:
self._name.append(str(i))
+ self._separator = separator
def __str__(self):
- return "::".join(self.name)
+ return self.separator.join(self.name)
def __repr__(self):
return repr(str(self))
@@ -115,7 +116,7 @@ class QualifiedName:
elif isinstance(other, list):
return self.name == other
elif isinstance(other, self.__class__):
- return self.name == other.name
+ return self.name == other.name and self.separator == other.separator
return NotImplemented
def __ne__(self, other):
@@ -163,7 +164,7 @@ class QualifiedName:
name_list[i] = self.name[i].encode("utf-8")
result.name = name_list
result.nameCount = len(self.name)
- result.join = "::".encode("utf-8")
+ result.join = self.separator.encode("utf-8")
return result
@staticmethod
@@ -181,6 +182,14 @@ class QualifiedName:
def name(self, value: List[str]) -> None:
self._name = value
+ @property
+ def separator(self) -> str:
+ return self._separator
+
+ @separator.setter
+ def separator(self, value: str) -> None:
+ self._separator = value
+
@staticmethod
def escape(name: QualifiedNameType, escaping: TokenEscapingType) -> str:
return core.BNEscapeTypeName(str(QualifiedName(name)), escaping)