Skip to content

Commit

Permalink
fix: Readd some details
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarrabah committed Jan 9, 2025
1 parent 908b066 commit 8b54eb7
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/frformat/geo/canton.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
canton_versioned_data.add_version(Millesime.M2023, CANTON_COG_2023)
canton_versioned_data.add_version(Millesime.M2024, CANTON_COG_2024)

Canton = new_format.new(name, description, canton_versioned_data)
Canton = new_format.new("Canton", name, description, canton_versioned_data)
4 changes: 3 additions & 1 deletion src/frformat/geo/code_commune_insee.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
Millesime.M2024, CODES_COMMUNES_INSEE_COG_2024
)

CodeCommuneInsee = new_format.new(name, description, code_commune_insee_versioned_data)
CodeCommuneInsee = new_format.new(
"CodeCommuneInsee", name, description, code_commune_insee_versioned_data
)
8 changes: 6 additions & 2 deletions src/frformat/geo/code_pays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
code_pays_IS02_versioned_data.add_version(Millesime.M2023, CODES_PAYS_ISO2_COG_2023)
code_pays_IS02_versioned_data.add_version(Millesime.M2024, CODES_PAYS_ISO2_COG_2024)

CodePaysISO2 = new_format.new(name, description, code_pays_IS02_versioned_data)
CodePaysISO2 = new_format.new(
"CodePaysISO2", name, description, code_pays_IS02_versioned_data
)


name = "Codes ISO3 Pays"
Expand All @@ -25,4 +27,6 @@
code_pays_IS03_versioned_data.add_version(Millesime.M2023, CODES_PAYS_ISO3_COG_2023)
code_pays_IS03_versioned_data.add_version(Millesime.M2024, CODES_PAYS_ISO3_COG_2024)

CodePaysISO3 = new_format.new(name, description, code_pays_IS03_versioned_data)
CodePaysISO3 = new_format.new(
"CodePaysISO3", name, description, code_pays_IS03_versioned_data
)
2 changes: 1 addition & 1 deletion src/frformat/geo/code_postal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
name = "Code postal"
description = "Vérifie que le code postal est bien un code postal français"

CodePostal = new_format.new(name, description, CODES_POSTAUX)
CodePostal = new_format.new("CodePostal", name, description, CODES_POSTAUX)
2 changes: 1 addition & 1 deletion src/frformat/geo/code_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
code_region_versioned_data.add_version(Millesime.M2023, CODES_REGIONS_COG_2023)
code_region_versioned_data.add_version(Millesime.M2024, CODES_REGIONS_COG_2024)

CodeRegion = new_format.new(name, description, code_region_versioned_data)
CodeRegion = new_format.new("CodeRegion", name, description, code_region_versioned_data)
2 changes: 1 addition & 1 deletion src/frformat/geo/commune.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
commune_versioned_data.add_version(Millesime.M2023, COMMUNES_COG_2023)
commune_versioned_data.add_version(Millesime.M2024, COMMUNES_COG_2024)

Commune = new_format.new(name, description, commune_versioned_data)
Commune = new_format.new("Commune", name, description, commune_versioned_data)
4 changes: 3 additions & 1 deletion src/frformat/geo/departement.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
departement_versioned_data.add_version(Millesime.M2023, DEPARTEMENTS_COG_2023)
departement_versioned_data.add_version(Millesime.M2024, DEPARTEMENTS_COG_2024)

Departement = new_format.new(name, description, departement_versioned_data)
Departement = new_format.new(
"Departement", name, description, departement_versioned_data
)
4 changes: 3 additions & 1 deletion src/frformat/geo/numero_departement.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@
Millesime.M2024, NUMEROS_DEPARTEMENTS_COG_2024
)

NumeroDepartement = new_format.new(name, description, numero_departement_versioned_data)
NumeroDepartement = new_format.new(
"NumeroDepartement", name, description, numero_departement_versioned_data
)
2 changes: 1 addition & 1 deletion src/frformat/geo/pays.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
pays_versioned_data = VersionedSet[Millesime]()
pays_versioned_data.add_version(Millesime.M2024, PAYS_COG_2024)

Pays = new_format.new(name, description, pays_versioned_data)
Pays = new_format.new("Pays", name, description, pays_versioned_data)
2 changes: 1 addition & 1 deletion src/frformat/geo/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
region_versioned_data.add_version(Millesime.M2023, REGIONS_COG_2023)
region_versioned_data.add_version(Millesime.M2024, REGIONS_COG_2024)

Region = new_format.new(name, description, region_versioned_data)
Region = new_format.new("Region", name, description, region_versioned_data)
10 changes: 9 additions & 1 deletion src/frformat/new_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def is_valid(self, value: str) -> bool:


def new(
name: str, description: str, valid_data: Union[VersionedSet, FrozenSet[str]]
class_name: str,
name: str,
description: str,
valid_data: Union[VersionedSet, FrozenSet[str]],
) -> Type:
def get_geo_data(cog: Union[Millesime, str]) -> Union[FrozenSet, None]:
if isinstance(valid_data, VersionedSet):
Expand Down Expand Up @@ -92,5 +95,10 @@ def __init__(self, options: Options = Options()):
metadata = Metadata(name, description)

if isinstance(valid_data, VersionedSet):
GeoFormat.__name__ = class_name
GeoFormat.__qualname__ = class_name
return GeoFormat

EnumFormat.__name__ = class_name
EnumFormat.__qualname__ = class_name
return EnumFormat
4 changes: 3 additions & 1 deletion src/tests/test_geo_data_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def test_geo_data_format():

versioned_data.add_version(Millesime.M2024, frozenset({"Arandas"}))

FormatTest = new("Versionned format", "Versionned format", versioned_data)
FormatTest = new(
"Versionned format", "Versionned format", "Versionned format", versioned_data
)

test_cases = [
{
Expand Down
4 changes: 3 additions & 1 deletion src/tests/test_validator_with_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ def test_validator():
{"Bonjour", "Réunion", "Plane!", "Fly ", "La liste"}
)

Validator = new_format.new("validator", "Test validator", valid_values_enum)
Validator = new_format.new(
"Validator", "validator", "Test validator", valid_values_enum
)

test_cases = [
{
Expand Down

0 comments on commit 8b54eb7

Please sign in to comment.