CourtLocation

The CourtLocation dataclass stores structured geographic information about a court's location. All fields are optional — any subset can be provided.

Initialization

Creates a new instance of CourtLocation.

Keyword Arguments

  • Name
    club
    Type
    str | None
    Description

    Name of the padel club.

  • Name
    city
    Type
    str | None
    Description

    City where the court is located.

  • Name
    address
    Type
    str | None
    Description

    Street address.

  • Name
    country
    Type
    str | None
    Description

    Country name or ISO 3166-1 code.

  • Name
    latitude
    Type
    float | None
    Description

    Geographic latitude in decimal degrees.

  • Name
    longitude
    Type
    float | None
    Description

    Geographic longitude in decimal degrees.

Instantiation

class
CourtLocation
from padelkit import CourtLocation

loc = CourtLocation(
    club="Club de Pádel Sol",
    city="Madrid",
    country="Spain",
    latitude=40.4168,
    longitude=-3.7038,
)

Output structure

CourtLocation(
  club='Club de Pádel Sol',
  city='Madrid',
  address=None,
  country='Spain',
  latitude=40.4168,
  longitude=-3.7038
)

methodsto_dict / from_dict

Dictionary Serialization

  • Name
    location.to_dict()
    Type
    dict[str, Any]
    Description

    Serializes the geographic location fields (club, city, address, country, latitude, longitude) into a JSON-compatible dictionary.

  • Name
    CourtLocation.from_dict(data)
    Type
    CourtLocation
    Description

    Classmethod that reconstructs a CourtLocation instance from a dictionary.

Serialize Location

method
to_dict / from_dict
from padelkit import CourtLocation

loc = CourtLocation(club="Club de Pádel Sol", city="Madrid", country="Spain")
restored = CourtLocation.from_dict(loc.to_dict())
assert restored == loc

Was this page helpful?