mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 06:33:50 +01:00
Define __copy__ and __deepcopy__ as identity functions on DomainSpecificString, so that copy.deepcopy() will work on them
This commit is contained in:
parent
9c0e570496
commit
e01bdf2432
1 changed files with 8 additions and 0 deletions
|
@ -38,6 +38,14 @@ class DomainSpecificString(
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
raise ValueError("Attempted to iterate a %s" % (type(self).__name__))
|
raise ValueError("Attempted to iterate a %s" % (type(self).__name__))
|
||||||
|
|
||||||
|
# Because this class is a namedtuple of strings and booleans, it is deeply
|
||||||
|
# immutable.
|
||||||
|
def __copy__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __deepcopy__(self, memo):
|
||||||
|
return self
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_string(cls, s, hs):
|
def from_string(cls, s, hs):
|
||||||
"""Parse the string given by 's' into a structure object."""
|
"""Parse the string given by 's' into a structure object."""
|
||||||
|
|
Loading…
Reference in a new issue