Skip to content

Commit

Permalink
use new pbw endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
the-infinity committed Feb 17, 2024
1 parent 2b51607 commit ecefa12
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.ruff]
select = [
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
Expand All @@ -12,15 +12,15 @@ select = [
"B", # flake8-bugbear
]

ignore = [
lint.ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"F401", # imported but unused
"S101", # use of assert detected
]

fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
lint.fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]

exclude = [
".bzr",
Expand All @@ -47,10 +47,10 @@ exclude = [

line-length = 140

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"
multiline-quotes = "single"
docstring-quotes = "double"
Expand Down
3 changes: 3 additions & 0 deletions test-pull-converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ def main():
source_uid: str = args.source_uid

converter: PullConverter = get_converter(source_uid)

result: ImportSourceResult = converter.get_static_parking_sites()
# print_result(result)

result: ImportSourceResult = converter.get_realtime_parking_sites()
print_result(result)


Expand Down
1 change: 1 addition & 0 deletions v3/bahn_v2/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Copyright 2024 binary butterfly GmbH
Use of this source code is governed by an MIT-style license that can be found in the LICENSE.txt.
"""

import json

import requests
Expand Down
12 changes: 4 additions & 8 deletions v3/pbw/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,11 @@ def get_realtime_parking_sites(self) -> ImportSourceResult:
realtime_parking_site_errors=[],
)

parking_site_dicts = self._get_remote_data('catalog-object')
for parking_site_dict in parking_site_dicts:
parking_site_input: PbwParkingSiteInput = self.parking_site_validator.validate(parking_site_dict)
realtime_dicts = self._get_remote_data('object-dynamic-all')

realtime_dicts = self._get_remote_data('object-dynamic-by-id', parking_site_input.id)

for realtime_dict in realtime_dicts:
realtime_input: PbwRealtimeInput = self.realtime_validator.validate(realtime_dict)
import_source_result.realtime_parking_site_inputs.append(self.mapper.map_realtime_parking_site(realtime_input))
for realtime_dict in realtime_dicts:
realtime_input: PbwRealtimeInput = self.realtime_validator.validate(realtime_dict)
import_source_result.realtime_parking_site_inputs.append(self.mapper.map_realtime_parking_site(realtime_input))

return import_source_result

Expand Down
4 changes: 2 additions & 2 deletions v3/pbw/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class PbwParkingSiteObjectInput:

@validataclass
class PbwRealtimeParkingSiteInput:
kurzparker_frei: int = IntegerValidator(min_value=0)
ladeplaetze_frei: int = IntegerValidator(min_value=0)
kurzparker_frei: Optional[int] = Noneable(IntegerValidator(min_value=0)), Default(None)
ladeplaetze_frei: Optional[int] = Noneable(IntegerValidator(min_value=0)), Default(None)


@validataclass
Expand Down

0 comments on commit ecefa12

Please sign in to comment.