python-openpublictransport 0.1.6__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/PKG-INFO +1 -1
  2. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/pyproject.toml +1 -1
  3. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/const.py +2 -0
  4. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/efa_base.py +27 -1
  5. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/PKG-INFO +1 -1
  6. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/setup.cfg +0 -0
  7. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/__init__.py +0 -0
  8. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/exceptions.py +0 -0
  9. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/models.py +0 -0
  10. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/parsers.py +0 -0
  11. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/__init__.py +0 -0
  12. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/avv.py +0 -0
  13. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/base.py +0 -0
  14. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/beg.py +0 -0
  15. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/bsvg.py +0 -0
  16. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/bvg.py +0 -0
  17. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/db.py +0 -0
  18. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/ding.py +0 -0
  19. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/fptf_base.py +0 -0
  20. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/gtfsde.py +0 -0
  21. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/hvv.py +0 -0
  22. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/kvv.py +0 -0
  23. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/mvv.py +0 -0
  24. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/national_rail.py +0 -0
  25. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/nta.py +0 -0
  26. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/nvbw.py +0 -0
  27. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/nwl.py +0 -0
  28. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/oebb.py +0 -0
  29. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/otp.py +0 -0
  30. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/otp_base.py +0 -0
  31. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/otp_custom.py +0 -0
  32. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/rejseplanen.py +0 -0
  33. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/rmv.py +0 -0
  34. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/rvv.py +0 -0
  35. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/sbb.py +0 -0
  36. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/trafiklab.py +0 -0
  37. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/transitous.py +0 -0
  38. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/trias_base.py +0 -0
  39. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vagfr.py +0 -0
  40. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vbn.py +0 -0
  41. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vgn.py +0 -0
  42. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vrn.py +0 -0
  43. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vrr.py +0 -0
  44. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vvo.py +0 -0
  45. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vvs.py +0 -0
  46. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/py.typed +0 -0
  47. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/SOURCES.txt +0 -0
  48. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/dependency_links.txt +0 -0
  49. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/requires.txt +0 -0
  50. {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-openpublictransport
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Python library for public transport APIs (EFA, OTP2, TRIAS, FPTF, HAFAS, GTFS-RT)
5
5
  License: MIT
6
6
  Requires-Python: >=3.11
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-openpublictransport"
7
- version = "0.1.6"
7
+ version = "0.1.7"
8
8
  description = "Python library for public transport APIs (EFA, OTP2, TRIAS, FPTF, HAFAS, GTFS-RT)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -44,6 +44,8 @@ KVV_TRANSPORTATION_TYPES = {
44
44
  1: "train",
45
45
  4: "tram",
46
46
  5: "bus",
47
+ 6: "bus", # Regionalbus (e.g. KVV line 106)
48
+ 7: "bus", # Schnellbus
47
49
  }
48
50
 
49
51
  HVV_TRANSPORTATION_TYPES = {
@@ -17,6 +17,28 @@ from .base import BaseProvider
17
17
  _LOGGER = logging.getLogger(__name__)
18
18
 
19
19
 
20
+ def _transport_type_from_name(name: str) -> str:
21
+ """Best-effort transport type from an EFA product name.
22
+
23
+ Used as a fallback when the numeric product class is not in a provider's
24
+ mapping (e.g. KVV Regionalbus class 6), so unmapped classes are not dropped
25
+ as "unknown". Checks subway/tram before the generic "bahn" → train.
26
+ """
27
+ n = (name or "").lower()
28
+ if "u-bahn" in n or "u_bahn" in n or "ubahn" in n or "subway" in n or "metro" in n:
29
+ return "subway"
30
+ if "straßenbahn" in n or "strassenbahn" in n or "stadtbahn" in n or "tram" in n:
31
+ return "tram"
32
+ if "fähre" in n or "faehre" in n or "schiff" in n or "ferry" in n:
33
+ return "ferry"
34
+ if "bus" in n or "ast" in n or "ruf" in n or "ersatz" in n:
35
+ # Stadt-/Regional-/Schnell-/Nachtbus, AST, Rufbus, (Schienen-)Ersatzverkehr
36
+ return "bus"
37
+ if "bahn" in n or "zug" in n or "train" in n: # S-Bahn, Regionalbahn, Zug, …
38
+ return "train"
39
+ return "unknown"
40
+
41
+
20
42
  class EFABaseProvider(BaseProvider):
21
43
  """Base class for all EFA-based providers (VRR, KVV, HVV, MVV, etc.)."""
22
44
 
@@ -122,10 +144,14 @@ class EFABaseProvider(BaseProvider):
122
144
  product = transportation.get("product", {})
123
145
  product_class = product.get("class", 0)
124
146
  transport_type = type_mapping.get(product_class, "unknown")
147
+ if transport_type == "unknown":
148
+ # Fall back to the product name so unmapped classes aren't dropped.
149
+ transport_type = _transport_type_from_name(product.get("name", ""))
125
150
  if transport_type == "unknown":
126
151
  _LOGGER.debug(
127
- "Unknown transport class %s for line %s",
152
+ "Unknown transport class %s / name %r for line %s",
128
153
  product_class,
154
+ product.get("name"),
129
155
  transportation.get("number", "unknown"),
130
156
  )
131
157
  return transport_type
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-openpublictransport
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Python library for public transport APIs (EFA, OTP2, TRIAS, FPTF, HAFAS, GTFS-RT)
5
5
  License: MIT
6
6
  Requires-Python: >=3.11