You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to declare a CatchAll member variable and specify that it's not to be hashed?
When I call hash(mydataclass) I get a failure on the CatchAll member because it's a dict.
TypeError: unhashable type: 'dict'
Here is my class
@dataclass_json(undefined=Undefined.INCLUDE)
@dataclass(unsafe_hash=True)
class UnknownPacket:
"""Catchall Packet for things we don't know about.
All of the unknown attributes are stored in the unknown_fields
"""
unknown_fields: CatchAll
normally I can specify a non hashable like this.
@dataclass_json(undefined=Undefined.INCLUDE)
@dataclass(unsafe_hash=True)
class Foo:
tPARM: Optional[list[str]] = field(default=None, hash=False)
...
the tPARM member won't be used in the hash(foo).
How, if at all, can I declare the CatchAll as hash=false ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to declare a CatchAll member variable and specify that it's not to be hashed?
When I call hash(mydataclass) I get a failure on the CatchAll member because it's a dict.
Here is my class
normally I can specify a non hashable like this.
the tPARM member won't be used in the hash(foo).
How, if at all, can I declare the CatchAll as hash=false ?
Beta Was this translation helpful? Give feedback.
All reactions