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.
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/PKG-INFO +1 -1
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/pyproject.toml +1 -1
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/const.py +2 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/efa_base.py +27 -1
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/PKG-INFO +1 -1
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/setup.cfg +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/__init__.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/exceptions.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/models.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/parsers.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/__init__.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/avv.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/base.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/beg.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/bsvg.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/bvg.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/db.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/ding.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/fptf_base.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/gtfsde.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/hvv.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/kvv.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/mvv.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/national_rail.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/nta.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/nvbw.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/nwl.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/oebb.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/otp.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/otp_base.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/otp_custom.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/rejseplanen.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/rmv.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/rvv.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/sbb.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/trafiklab.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/transitous.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/trias_base.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vagfr.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vbn.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vgn.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vrn.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vrr.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vvo.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/providers/vvs.py +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/openpublictransport/py.typed +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/SOURCES.txt +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/dependency_links.txt +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/requires.txt +0 -0
- {python_openpublictransport-0.1.6 → python_openpublictransport-0.1.7}/src/python_openpublictransport.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-openpublictransport"
|
|
7
|
-
version = "0.1.
|
|
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" }
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|