Skip to content

Commit

Permalink
Rename base model
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulVanSchayck committed Oct 12, 2023
1 parent 8f6fb51 commit b3a9344
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pydantic import ConfigDict


class EDRBaseModel(PydanticBaseModel):
class EdrBaseModel(PydanticBaseModel):
model_config = ConfigDict(
str_strip_whitespace=True,
extra="forbid",
Expand Down
10 changes: 5 additions & 5 deletions src/edr_pydantic/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
from typing import List
from typing import Optional

from .base_model import EdrBaseModel
from .link import Link
from .my_base_model import EDRBaseModel


class Provider(EDRBaseModel):
class Provider(EdrBaseModel):
name: Optional[str] = None
url: Optional[str] = None


class Contact(EDRBaseModel):
class Contact(EdrBaseModel):
email: Optional[str] = None
phone: Optional[str] = None
fax: Optional[str] = None
Expand All @@ -25,7 +25,7 @@ class Contact(EDRBaseModel):
country: Optional[str] = None


class LandingPageModel(EDRBaseModel):
class LandingPageModel(EdrBaseModel):
links: List[Link]
title: Optional[str] = None
description: Optional[str] = None
Expand All @@ -34,5 +34,5 @@ class LandingPageModel(EDRBaseModel):
contact: Optional[Contact] = None


class ConformanceModel(EDRBaseModel):
class ConformanceModel(EdrBaseModel):
conformsTo: List[str] # noqa: N815
8 changes: 4 additions & 4 deletions src/edr_pydantic/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
from typing import List
from typing import Optional

from .base_model import EdrBaseModel
from .data_queries import DataQueries
from .extent import Extent
from .link import Link
from .my_base_model import EDRBaseModel
from .parameter import Parameter


class Collection(EDRBaseModel):
class Collection(EdrBaseModel):
id: str
title: Optional[str] = None
description: Optional[str] = None
Expand All @@ -25,7 +25,7 @@ class Collection(EDRBaseModel):
distanceunits: Optional[List[str]] = None


class Collections(EDRBaseModel):
class Collections(EdrBaseModel):
links: List[Link]
collections: List[Collection]

Expand All @@ -35,6 +35,6 @@ class Instance(Collection):
pass


class Instances(EDRBaseModel):
class Instances(EdrBaseModel):
links: List[Link]
instances: List[Instance]
6 changes: 3 additions & 3 deletions src/edr_pydantic/data_queries.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from typing import Optional

from .base_model import EdrBaseModel
from .link import EDRQueryLink
from .my_base_model import EDRBaseModel


class EDRQuery(EDRBaseModel):
class EDRQuery(EdrBaseModel):
link: EDRQueryLink


class DataQueries(EDRBaseModel):
class DataQueries(EdrBaseModel):
position: Optional[EDRQuery] = None
radius: Optional[EDRQuery] = None
area: Optional[EDRQuery] = None
Expand Down
10 changes: 5 additions & 5 deletions src/edr_pydantic/extent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

from pydantic import AwareDatetime

from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel


class Spatial(EDRBaseModel):
class Spatial(EdrBaseModel):
bbox: List[List[float]]
crs: str


class Temporal(EDRBaseModel):
class Temporal(EdrBaseModel):
interval: List[List[AwareDatetime]]
values: List[str]
trs: str


class Vertical(EDRBaseModel):
class Vertical(EdrBaseModel):
interval: List[List[str]]
values: List[str]
vrs: str


class Extent(EDRBaseModel):
class Extent(EdrBaseModel):
spatial: Spatial
temporal: Optional[Temporal] = None
vertical: Optional[Vertical] = None
4 changes: 2 additions & 2 deletions src/edr_pydantic/link.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from typing import Optional
from typing import Union

from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel
from .variables import CorridorVariables
from .variables import CubeVariables
from .variables import ItemVariables
from .variables import RadiusVariables
from .variables import Variables


class Link(EDRBaseModel):
class Link(EdrBaseModel):
href: str
hreflang: Optional[str] = None
rel: str
Expand Down
6 changes: 3 additions & 3 deletions src/edr_pydantic/observed_property.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from typing import List
from typing import Optional

from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel


class Category(EDRBaseModel):
class Category(EdrBaseModel):
id: str
label: str
description: Optional[str] = None


class ObservedProperty(EDRBaseModel):
class ObservedProperty(EdrBaseModel):
id: Optional[str] = None
label: str
description: Optional[str] = None
Expand Down
6 changes: 3 additions & 3 deletions src/edr_pydantic/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from pydantic import model_validator

from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel
from .observed_property import ObservedProperty
from .unit import Unit


class Parameter(EDRBaseModel, extra="allow"):
class Parameter(EdrBaseModel, extra="allow"):
type: Literal["Parameter"] = "Parameter"
id: Optional[str] = None
label: Optional[str] = None
Expand All @@ -28,7 +28,7 @@ def must_not_have_unit_if_observed_property_has_categories(self):
return self


class ParameterGroup(EDRBaseModel, extra="allow"):
class ParameterGroup(EdrBaseModel, extra="allow"):
type: Literal["ParameterGroup"] = "ParameterGroup"
id: Optional[str] = None
label: Optional[str] = None
Expand Down
9 changes: 5 additions & 4 deletions src/edr_pydantic/reference_system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel


class CRS(EDRBaseModel):
name: str # MAY EPSG code
wkt: str # SHALL Well Known Text
class CRS(EdrBaseModel):
name: str # # This MAY be an EPSG code
# TODO: Implement WKT (Well Known Text) validator
wkt: str
6 changes: 3 additions & 3 deletions src/edr_pydantic/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

from pydantic import model_validator

from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel


class Symbol(EDRBaseModel, extra="allow"):
class Symbol(EdrBaseModel, extra="allow"):
value: str
type: str


class Unit(EDRBaseModel):
class Unit(EdrBaseModel):
id: Optional[str] = None
label: Optional[str] = None
symbol: Optional[Union[str, Symbol]] = None
Expand Down
4 changes: 2 additions & 2 deletions src/edr_pydantic/variables.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import List
from typing import Optional

from .my_base_model import EDRBaseModel
from .base_model import EdrBaseModel


class Variables(EDRBaseModel, extra="allow"):
class Variables(EdrBaseModel, extra="allow"):
# TODO query_type required? Not according to C.3
query_type: str
output_formats: Optional[List[str]] = None
Expand Down

0 comments on commit b3a9344

Please sign in to comment.