github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/error.py (about)

     1  # coding: utf-8
     2  
     3  """
     4      lakeFS API
     5  
     6      lakeFS HTTP API
     7  
     8      The version of the OpenAPI document: 1.0.0
     9      Contact: services@treeverse.io
    10      Generated by OpenAPI Generator (https://openapi-generator.tech)
    11  
    12      Do not edit the class manually.
    13  """  # noqa: E501
    14  
    15  
    16  from __future__ import annotations
    17  import pprint
    18  import re  # noqa: F401
    19  import json
    20  
    21  
    22  
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictStr
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictStr
    27  
    28  class Error(BaseModel):
    29      """
    30      Error
    31      """
    32      message: StrictStr = Field(..., description="short message explaining the error")
    33      __properties = ["message"]
    34  
    35      class Config:
    36          """Pydantic configuration"""
    37          allow_population_by_field_name = True
    38          validate_assignment = True
    39  
    40      def to_str(self) -> str:
    41          """Returns the string representation of the model using alias"""
    42          return pprint.pformat(self.dict(by_alias=True))
    43  
    44      def to_json(self) -> str:
    45          """Returns the JSON representation of the model using alias"""
    46          return json.dumps(self.to_dict())
    47  
    48      @classmethod
    49      def from_json(cls, json_str: str) -> Error:
    50          """Create an instance of Error from a JSON string"""
    51          return cls.from_dict(json.loads(json_str))
    52  
    53      def to_dict(self):
    54          """Returns the dictionary representation of the model using alias"""
    55          _dict = self.dict(by_alias=True,
    56                            exclude={
    57                            },
    58                            exclude_none=True)
    59          return _dict
    60  
    61      @classmethod
    62      def from_dict(cls, obj: dict) -> Error:
    63          """Create an instance of Error from a dict"""
    64          if obj is None:
    65              return None
    66  
    67          if not isinstance(obj, dict):
    68              return Error.parse_obj(obj)
    69  
    70          _obj = Error.parse_obj({
    71              "message": obj.get("message")
    72          })
    73          return _obj
    74  
    75