We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11adec4 commit 09729f2Copy full SHA for 09729f2
1 file changed
emmet-core/emmet/core/mpid.py
@@ -91,12 +91,18 @@ def __init__(self, val: MPID | int | str) -> None:
91
)
92
93
def __eq__(self, other: Any) -> bool:
94
+ if other is None:
95
+ return False
96
+
97
if isinstance(other, MPID):
98
return self.string == other.string
99
elif isinstance(other, AlphaID):
100
return other == self
101
elif isinstance(other, (int, str)):
- return self.string == MPID(other).string
102
+ try:
103
+ return self.string == MPID(other).string
104
+ except ValueError:
105
106
return NotImplemented
107
108
def __str__(self) -> str:
0 commit comments