github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/python/python-experimental/model_templates/methods_shared.mustache (about)

     1      def __setitem__(self, name, value):
     2          """this allows us to set values with instance[field_name] = val"""
     3          self.__setattr__(name, value)
     4  
     5      def __getitem__(self, name):
     6          """this allows us to get a value with val = instance[field_name]"""
     7          return self.__getattr__(name)
     8  
     9      def __repr__(self):
    10          """For `print` and `pprint`"""
    11          return self.to_str()
    12  
    13      def __ne__(self, other):
    14          """Returns true if both objects are not equal"""
    15          return not self == other