github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/range_metadata.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, StrictInt, StrictStr
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictInt, StrictStr
    27  
    28  class RangeMetadata(BaseModel):
    29      """
    30      RangeMetadata
    31      """
    32      id: StrictStr = Field(..., description="ID of the range.")
    33      min_key: StrictStr = Field(..., description="First key in the range.")
    34      max_key: StrictStr = Field(..., description="Last key in the range.")
    35      count: StrictInt = Field(..., description="Number of records in the range.")
    36      estimated_size: StrictInt = Field(..., description="Estimated size of the range in bytes")
    37      __properties = ["id", "min_key", "max_key", "count", "estimated_size"]
    38  
    39      class Config:
    40          """Pydantic configuration"""
    41          allow_population_by_field_name = True
    42          validate_assignment = True
    43  
    44      def to_str(self) -> str:
    45          """Returns the string representation of the model using alias"""
    46          return pprint.pformat(self.dict(by_alias=True))
    47  
    48      def to_json(self) -> str:
    49          """Returns the JSON representation of the model using alias"""
    50          return json.dumps(self.to_dict())
    51  
    52      @classmethod
    53      def from_json(cls, json_str: str) -> RangeMetadata:
    54          """Create an instance of RangeMetadata from a JSON string"""
    55          return cls.from_dict(json.loads(json_str))
    56  
    57      def to_dict(self):
    58          """Returns the dictionary representation of the model using alias"""
    59          _dict = self.dict(by_alias=True,
    60                            exclude={
    61                            },
    62                            exclude_none=True)
    63          return _dict
    64  
    65      @classmethod
    66      def from_dict(cls, obj: dict) -> RangeMetadata:
    67          """Create an instance of RangeMetadata from a dict"""
    68          if obj is None:
    69              return None
    70  
    71          if not isinstance(obj, dict):
    72              return RangeMetadata.parse_obj(obj)
    73  
    74          _obj = RangeMetadata.parse_obj({
    75              "id": obj.get("id"),
    76              "min_key": obj.get("min_key"),
    77              "max_key": obj.get("max_key"),
    78              "count": obj.get("count"),
    79              "estimated_size": obj.get("estimated_size")
    80          })
    81          return _obj
    82  
    83