MCPcopy Index your code
hub / github.com/McCloudS/subgen / __eq__

Method __eq__

language_code.py:187–201  ·  view source on GitHub ↗

Compare the LanguageCode instance to another object. Explicitly handle comparison to None.

(self, other)

Source from the content-addressed store, hash-verified

185 return True if self.iso_639_1 is not None else False
186
187 def __eq__(self, other):
188 """
189 Compare the LanguageCode instance to another object.
190 Explicitly handle comparison to None.
191 """
192 if other is None:
193 # If compared to None, return False unless self is None
194 return self.iso_639_1 is None
195 if isinstance(other, str): # Allow comparison with a string
196 return self.value == LanguageCode.from_string(other)
197 if isinstance(other, LanguageCode):
198 # Normal comparison for LanguageCode instances
199 return self.iso_639_1 == other.iso_639_1
200 # Otherwise, defer to the default equality
201 return NotImplemented

Callers

nothing calls this directly

Calls 1

from_stringMethod · 0.80

Tested by

no test coverage detected