github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/repository_dump_status.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  from datetime import datetime
    22  from typing import Optional
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictBool, StrictStr
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictBool, StrictStr
    27  from lakefs_sdk.models.refs_dump import RefsDump
    28  
    29  class RepositoryDumpStatus(BaseModel):
    30      """
    31      RepositoryDumpStatus
    32      """
    33      id: StrictStr = Field(..., description="ID of the task")
    34      done: StrictBool = Field(...)
    35      update_time: datetime = Field(...)
    36      error: Optional[StrictStr] = None
    37      refs: Optional[RefsDump] = None
    38      __properties = ["id", "done", "update_time", "error", "refs"]
    39  
    40      class Config:
    41          """Pydantic configuration"""
    42          allow_population_by_field_name = True
    43          validate_assignment = True
    44  
    45      def to_str(self) -> str:
    46          """Returns the string representation of the model using alias"""
    47          return pprint.pformat(self.dict(by_alias=True))
    48  
    49      def to_json(self) -> str:
    50          """Returns the JSON representation of the model using alias"""
    51          return json.dumps(self.to_dict())
    52  
    53      @classmethod
    54      def from_json(cls, json_str: str) -> RepositoryDumpStatus:
    55          """Create an instance of RepositoryDumpStatus from a JSON string"""
    56          return cls.from_dict(json.loads(json_str))
    57  
    58      def to_dict(self):
    59          """Returns the dictionary representation of the model using alias"""
    60          _dict = self.dict(by_alias=True,
    61                            exclude={
    62                            },
    63                            exclude_none=True)
    64          # override the default output from pydantic by calling `to_dict()` of refs
    65          if self.refs:
    66              _dict['refs'] = self.refs.to_dict()
    67          return _dict
    68  
    69      @classmethod
    70      def from_dict(cls, obj: dict) -> RepositoryDumpStatus:
    71          """Create an instance of RepositoryDumpStatus from a dict"""
    72          if obj is None:
    73              return None
    74  
    75          if not isinstance(obj, dict):
    76              return RepositoryDumpStatus.parse_obj(obj)
    77  
    78          _obj = RepositoryDumpStatus.parse_obj({
    79              "id": obj.get("id"),
    80              "done": obj.get("done"),
    81              "update_time": obj.get("update_time"),
    82              "error": obj.get("error"),
    83              "refs": RefsDump.from_dict(obj.get("refs")) if obj.get("refs") is not None else None
    84          })
    85          return _obj
    86  
    87