Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
the-infinity committed Nov 27, 2024
1 parent 011ed3a commit 07bcbd4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _get_static_parking_site_inputs_and_exceptions(
) -> tuple[list[StaticParkingSiteInput], list[ImportParkingSiteException]]:
static_parking_site_inputs: list[StaticParkingSiteInput] = []

feature_inputs, import_parking_site_exceptions = self._get_features_and_exceptions(source_uid)
feature_inputs, import_parking_site_exceptions = self._get_geojson_features_and_exceptions(source_uid)

for feature_input in feature_inputs:
static_parking_site_inputs.append(
Expand All @@ -68,7 +68,7 @@ def _get_static_parking_site_inputs_and_exceptions(

return static_parking_site_inputs, import_parking_site_exceptions

def _get_features_and_exceptions(
def _get_geojson_features_and_exceptions(
self,
source_uid: str,
) -> tuple[list[GeojsonFeatureInput], list[ImportParkingSiteException]]:
Expand Down
6 changes: 3 additions & 3 deletions src/parkapi_sources/converters/herrenberg_bike/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class HerrenbergBikePropertiesInput(ValidataclassMixin):
operator_name: OptionalUnset[str] = NoneToUnsetValue(StringValidator(min_length=0, max_length=256)), DefaultUnset
capacity: int = IntegerValidator(min_value=0)
capacity_charging: OptionalUnset[int] = NoneToUnsetValue(IntegerValidator(min_value=0)), DefaultUnset
# capacity_cargobike is unsupported yet
# capacity_cargobike is unsupported yet: https://github.com/ParkenDD/parkapi-sources-v3/issues/174
# capacity_cargobike: OptionalUnset[int] = NoneToUnsetValue(IntegerValidator(min_value=0)), DefaultUnset
max_height: OptionalUnset[int] = NoneToUnsetValue(IntegerValidator(min_value=0)), DefaultUnset
max_width: OptionalUnset[int] = NoneToUnsetValue(IntegerValidator(min_value=0)), DefaultUnset
Expand Down Expand Up @@ -146,9 +146,9 @@ class HerrenbergBikePropertiesInput(ValidataclassMixin):
max_stay: OptionalUnset[int] = NoneToUnsetValue(IntegerValidator(min_value=0)), DefaultUnset
fee_description: OptionalUnset[str] = NoneToUnsetValue(StringValidator(max_length=512)), DefaultUnset

def to_dict(self, *args, **kwargs) -> dict:
def to_dict(self, **kwargs) -> dict:
ignore_keys = ['type', 'original_uid', 'supervision_type', 'date_surveyed']
result = {key: value for key, value in super().to_dict(*args, **kwargs).items() if key not in ignore_keys}
result = {key: value for key, value in super().to_dict(**kwargs).items() if key not in ignore_keys}

result['uid'] = self.original_uid
result['purpose'] = PurposeType.BIKE
Expand Down
2 changes: 1 addition & 1 deletion src/parkapi_sources/converters/kienzler/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_static_parking_sites(self) -> tuple[list[StaticParkingSiteInput], list[I
)

if self.use_geojson:
geojson_features, geojson_parking_site_errors = self._get_features_and_exceptions(
geojson_features, geojson_parking_site_errors = self._get_geojson_features_and_exceptions(
source_uid=self.source_info.uid,
)

Expand Down
4 changes: 1 addition & 3 deletions src/parkapi_sources/converters/kienzler/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ class KienzlerGeojsonFeaturePropertiesInput(ValidataclassMixin):
max_depth: int = IntegerValidator(min_value=0)
park_and_ride_type: list[ParkAndRideType] = ListValidator(EnumValidator(ParkAndRideType))
external_identifiers: Optional[list[ExternalIdentifierInput]] = ListValidator(
DataclassValidator(
ExternalIdentifierInput,
),
DataclassValidator(ExternalIdentifierInput),
)

def to_dict(self, **kwargs) -> dict[str, Any]:
Expand Down

0 comments on commit 07bcbd4

Please sign in to comment.