github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/python/python-experimental/model_templates/methods_tostr_eq_simple.mustache (about) 1 def to_str(self): 2 """Returns the string representation of the model""" 3 return str(self.value) 4 5 def __eq__(self, other): 6 """Returns true if both objects are equal""" 7 if not isinstance(other, self.__class__): 8 return False 9 10 this_val = self._data_store['value'] 11 that_val = other._data_store['value'] 12 types = set() 13 types.add(this_val.__class__) 14 types.add(that_val.__class__) 15 vals_equal = this_val == that_val 16 if not six.PY3 and len(types) == 2 and unicode in types: # noqa: F821 17 vals_equal = ( 18 this_val.encode('utf-8') == that_val.encode('utf-8') 19 ) 20 if not vals_equal: 21 return False 22 return True