Skip to content

Commit

Permalink
ordered keyword is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
azvoleff committed Mar 4, 2025
1 parent 52c2f9c commit bd7e46a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 68 deletions.
3 changes: 0 additions & 3 deletions te_schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@


class SchemaBase:
class Meta:
ordered = True

"""Base class for te_schemas schemas"""

def validate(self):
Expand Down
3 changes: 0 additions & 3 deletions te_schemas/land_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,6 @@ class LCTransitionMeaningDeg(LCTransitionMeaning):
metadata={"validate": validate.OneOf(["degradation", "stable", "improvement"])}
)

class Meta:
ordered = True

def code(self):
meaning_key = {"degradation": -1, "stable": 0, "improvement": 1}

Expand Down
58 changes: 0 additions & 58 deletions te_schemas/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,27 @@ class Value:
name: str
value: float

class Meta:
ordered = True


@dataclass
class ValuesByYearDict:
name: str
unit: str
values: Dict[int, Dict[str, float]]

class Meta:
ordered = True


# Area summary schemas
@dataclass
class Area:
name: Optional[str]
area: float = field(metadata={"validate": validate.Range(min=0)})

class Meta:
ordered = True


@dataclass
class AreaList:
name: Optional[str]
unit: str = field(metadata={"validate": validate.OneOf(["m", "ha", "sq km"])})
areas: List[Area]

class Meta:
ordered = True


# Population summary schema
@dataclass
Expand All @@ -91,18 +79,12 @@ class Population:
}
)

class Meta:
ordered = True


@dataclass
class PopulationList:
name: Optional[str]
values: List[Population]

class Meta:
ordered = True


# Crosstab summary schemas
@dataclass
Expand All @@ -111,9 +93,6 @@ class CrossTabEntry:
final_label: str
value: float

class Meta:
ordered = True


# Crosstab summary schemas
@dataclass
Expand All @@ -123,9 +102,6 @@ class CrossTabEntryInitialFinal:
initial_value: float
final_value: float

class Meta:
ordered = True


@dataclass
class CrossTab:
Expand All @@ -135,9 +111,6 @@ class CrossTab:
final_year: int
values: Union[List[CrossTabEntry], List[CrossTabEntryInitialFinal]]

class Meta:
ordered = True


###
# Schemas to facilitate UNCCD reporting
Expand All @@ -150,26 +123,19 @@ class ReportMetadata:
affected_areas_only: bool = field(default=False)

class Meta:
ordered = True
datetimeformat = "%Y-%m-%dT%H:%M:%S+00:00"


@dataclass
class SDG15Report:
summary: AreaList

class Meta:
ordered = True


@dataclass
class ProductivityReport:
summaries: Dict[str, AreaList]
crosstabs_by_productivity_class: List[CrossTab]

class Meta:
ordered = True


@dataclass
class LandCoverReport:
Expand All @@ -179,19 +145,13 @@ class LandCoverReport:
crosstabs_by_land_cover_class: List[CrossTab]
land_cover_areas_by_year: ValuesByYearDict

class Meta:
ordered = True


@dataclass
class SoilOrganicCarbonReport:
summaries: Dict[str, AreaList]
crosstab_by_land_cover_class: CrossTab
soc_stock_by_year: ValuesByYearDict

class Meta:
ordered = True


@dataclass
class LandConditionReport:
Expand All @@ -201,9 +161,6 @@ class LandConditionReport:
soil_organic_carbon: Optional[SoilOrganicCarbonReport] = field(default=None)
error_recode: Optional[ErrorRecodePolygons] = field(default=None)

class Meta:
ordered = True


@dataclass
class LandConditionProgressReport:
Expand All @@ -214,17 +171,11 @@ class LandConditionProgressReport:
error_recode: Optional[ErrorRecodePolygons] = field(default=None)
sdg_error_recode: Optional[AreaList] = field(default=None)

class Meta:
ordered = True


@dataclass
class AffectedPopulationReport:
summary: Dict[str, PopulationList]

class Meta:
ordered = True


@dataclass
class DroughtExposedPopulation:
Expand All @@ -251,24 +202,15 @@ class DroughtReport:
tier_two: Dict[int, Dict[str, PopulationList]]
tier_three: Dict[int, Value]

class Meta:
ordered = True


@dataclass
class TrendsEarthLandConditionSummary:
metadata: ReportMetadata
land_condition: Dict[str, Union[LandConditionReport, LandConditionProgressReport]]
affected_population: Dict[str, AffectedPopulationReport]

class Meta:
ordered = True


@dataclass
class TrendsEarthDroughtSummary:
metadata: ReportMetadata
drought: DroughtReport

class Meta:
ordered = True
4 changes: 0 additions & 4 deletions te_schemas/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class TrendsEarthVersion:
revision: typing.Optional[str] = None

class Meta:
ordered = True
datetimeformat = "%Y-%m-%dT%H:%M:%S+00:00"


Expand All @@ -26,9 +25,6 @@ class AreaOfInterest:
geojson: dict
crs_wkt: str

class Meta:
ordered = True


################################################################################
# Schema for numeric data for plotting within a timeseries object
Expand Down

0 comments on commit bd7e46a

Please sign in to comment.