apyefa 1.0.1__tar.gz → 1.1.1__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.
Potentially problematic release.
This version of apyefa might be problematic. Click here for more details.
- {apyefa-1.0.1 → apyefa-1.1.1}/.github/workflows/python-package.yml +2 -2
- {apyefa-1.0.1 → apyefa-1.1.1}/PKG-INFO +5 -4
- {apyefa-1.0.1 → apyefa-1.1.1}/README.md +2 -2
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/client.py +6 -6
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/data_classes.py +13 -5
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa.egg-info/PKG-INFO +5 -4
- {apyefa-1.0.1 → apyefa-1.1.1}/pyproject.toml +1 -1
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/test_client.py +4 -4
- {apyefa-1.0.1 → apyefa-1.1.1}/.github/labeler.yml +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/.github/release-drafter.yml +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/.github/workflows/labeler.yml +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/.github/workflows/release_drafter.yml +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/.gitignore +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/.vscode/settings.json +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/LICENSE +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/__init__.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/__init__.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_add_info.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_coord.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_departures.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_geoobject.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_line_list.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_line_stop.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_serving_lines.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_stop_finder.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_stop_list.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_system_info.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/command_trip.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/parsers/__init__.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/parsers/parser.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/parsers/rapid_json_parser.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/commands/parsers/xml_parser.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/exceptions.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa/helpers.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa.egg-info/SOURCES.txt +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa.egg-info/dependency_links.txt +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa.egg-info/requires.txt +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/apyefa.egg-info/top_level.txt +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/examples.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/setup.cfg +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/conftest.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/integration/test_endpoints.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/__init__.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/parsers/__init__.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/parsers/test_json_parser.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/parsers/test_xml_parser.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_departures.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_line_list.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_line_stop.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_serving_lines.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_stop_finder.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_stop_list.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/commands/test_cmd_system_info.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/data_classes/__init__.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/data_classes/test_departure.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/data_classes/test_location.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/data_classes/test_system_info.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/data_classes/test_transportation.py +0 -0
- {apyefa-1.0.1 → apyefa-1.1.1}/tests/unit/test_helpers.py +0 -0
|
@@ -37,9 +37,9 @@ jobs:
|
|
|
37
37
|
- name: Install the code linting and formatting tool Ruff
|
|
38
38
|
run: pipx install ruff
|
|
39
39
|
- name: Lint code with Ruff
|
|
40
|
-
run: ruff check --output-format=github --target-version=
|
|
40
|
+
run: ruff check --output-format=github --target-version=py311
|
|
41
41
|
- name: Check code formatting with Ruff
|
|
42
|
-
run: ruff format --diff --target-version=
|
|
42
|
+
run: ruff format --diff --target-version=py311
|
|
43
43
|
continue-on-error: true
|
|
44
44
|
- name: Test with pytest
|
|
45
45
|
run: |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: apyefa
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Python API for EFA(Elektronische Fahrplanauskunft) async requests
|
|
5
5
|
Author-email: Alex Jung <jungdevelop@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -42,6 +42,7 @@ Requires-Dist: pytest; extra == "tests"
|
|
|
42
42
|
Requires-Dist: pytest-asyncio>=0.24.0; extra == "tests"
|
|
43
43
|
Requires-Dist: pytest-benchmark[histogram]>=3.2.1; extra == "tests"
|
|
44
44
|
Requires-Dist: requests>=2.32.3; extra == "tests"
|
|
45
|
+
Dynamic: license-file
|
|
45
46
|
|
|
46
47
|
# apyefa
|
|
47
48
|
[](https://github.com/alex-jung/apyefa/actions/workflows/python-package.yml)
|
|
@@ -79,8 +80,8 @@ pip install .
|
|
|
79
80
|
|Function Name |Description|
|
|
80
81
|
|----------------------------------------------------|-----------|
|
|
81
82
|
|[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|
|
|
82
|
-
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters
|
|
83
|
-
|[
|
|
83
|
+
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters|
|
|
84
|
+
|[locations_by_coord()](https://github.com/alex-jung/apyefa/wiki/locations_by_coord)|Search for locations by coordinates|
|
|
84
85
|
|[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|
|
|
85
86
|
|[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|
|
|
86
87
|
|[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|
|
|
@@ -34,8 +34,8 @@ pip install .
|
|
|
34
34
|
|Function Name |Description|
|
|
35
35
|
|----------------------------------------------------|-----------|
|
|
36
36
|
|[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|
|
|
37
|
-
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters
|
|
38
|
-
|[
|
|
37
|
+
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters|
|
|
38
|
+
|[locations_by_coord()](https://github.com/alex-jung/apyefa/wiki/locations_by_coord)|Search for locations by coordinates|
|
|
39
39
|
|[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|
|
|
40
40
|
|[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|
|
|
41
41
|
|[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|
|
|
@@ -130,17 +130,17 @@ class EfaClient:
|
|
|
130
130
|
|
|
131
131
|
return command.parse(response)[:limit]
|
|
132
132
|
|
|
133
|
-
async def
|
|
133
|
+
async def locations_by_coord(
|
|
134
134
|
self,
|
|
135
135
|
coord_x: float,
|
|
136
136
|
coord_y: float,
|
|
137
137
|
*,
|
|
138
138
|
format: CoordFormat = CoordFormat.WGS84,
|
|
139
|
-
limit: int = 10,
|
|
140
139
|
search_nearbly_stops: bool = False,
|
|
141
|
-
|
|
140
|
+
limit: int = 10,
|
|
141
|
+
) -> list[Location]:
|
|
142
142
|
"""
|
|
143
|
-
Asynchronously fetches
|
|
143
|
+
Asynchronously fetches locations based on given coordinates.
|
|
144
144
|
|
|
145
145
|
Args:
|
|
146
146
|
coord_x (float): The X coordinate (longitude).
|
|
@@ -150,9 +150,9 @@ class EfaClient:
|
|
|
150
150
|
search_nearbly_stops (bool, optional): Whether to search for nearby stops. Defaults to False.
|
|
151
151
|
|
|
152
152
|
Returns:
|
|
153
|
-
Location:
|
|
153
|
+
list[Location]: List of locations found based on the provided coordinates.
|
|
154
154
|
"""
|
|
155
|
-
_LOGGER.info("Request
|
|
155
|
+
_LOGGER.info("Request locations search by coordinates")
|
|
156
156
|
_LOGGER.debug(f"coord_x: {coord_x}")
|
|
157
157
|
_LOGGER.debug(f"coord_y: {coord_y}")
|
|
158
158
|
_LOGGER.debug(f"format: {format}")
|
|
@@ -122,7 +122,8 @@ _SCHEMA_PRODUCT = vol.Schema(
|
|
|
122
122
|
vol.Optional("id"): int,
|
|
123
123
|
vol.Optional("name"): str,
|
|
124
124
|
vol.Optional("iconId"): int,
|
|
125
|
-
}
|
|
125
|
+
},
|
|
126
|
+
extra=vol.ALLOW_EXTRA,
|
|
126
127
|
)
|
|
127
128
|
|
|
128
129
|
_SCHEMA_PARENT = vol.Schema(
|
|
@@ -136,7 +137,8 @@ _SCHEMA_PARENT = vol.Schema(
|
|
|
136
137
|
vol.Optional("disassembledName"): str,
|
|
137
138
|
vol.Optional("parent"): vol.Self,
|
|
138
139
|
vol.Optional("properties"): _SCHEMA_PROPERTIES,
|
|
139
|
-
}
|
|
140
|
+
},
|
|
141
|
+
extra=vol.ALLOW_EXTRA,
|
|
140
142
|
)
|
|
141
143
|
|
|
142
144
|
_SCHEMA_OPERATOR = vol.Schema(
|
|
@@ -144,7 +146,8 @@ _SCHEMA_OPERATOR = vol.Schema(
|
|
|
144
146
|
vol.Required("id"): str,
|
|
145
147
|
vol.Required("name"): str,
|
|
146
148
|
vol.Optional("code"): str,
|
|
147
|
-
}
|
|
149
|
+
},
|
|
150
|
+
extra=vol.ALLOW_EXTRA,
|
|
148
151
|
)
|
|
149
152
|
|
|
150
153
|
_SCHEMA_LOCATION: Final = vol.Schema(
|
|
@@ -201,7 +204,8 @@ _SCHEMA_SYSTEM_INFO: Final = vol.Schema(
|
|
|
201
204
|
vol.Required("to"): vol.Date("%Y-%m-%d"),
|
|
202
205
|
}
|
|
203
206
|
),
|
|
204
|
-
}
|
|
207
|
+
},
|
|
208
|
+
extra=vol.ALLOW_EXTRA,
|
|
205
209
|
)
|
|
206
210
|
|
|
207
211
|
_SCHEMA_DEPARTURE: Final = vol.Schema(
|
|
@@ -240,7 +244,8 @@ _SCHEMA_LEG: Final = vol.Schema(
|
|
|
240
244
|
vol.Optional("isRealtimeControlled"): vol.Boolean,
|
|
241
245
|
vol.Optional("realtimeStatus"): list,
|
|
242
246
|
vol.Optional("footPathInfo"): list,
|
|
243
|
-
}
|
|
247
|
+
},
|
|
248
|
+
extra=vol.ALLOW_EXTRA,
|
|
244
249
|
)
|
|
245
250
|
|
|
246
251
|
|
|
@@ -345,6 +350,7 @@ class Location(_Base):
|
|
|
345
350
|
@dataclass(frozen=True)
|
|
346
351
|
class Departure(_Base):
|
|
347
352
|
location: Location = field(repr=False)
|
|
353
|
+
line_id: str
|
|
348
354
|
line_name: str
|
|
349
355
|
route: str
|
|
350
356
|
origin: Location
|
|
@@ -375,6 +381,7 @@ class Departure(_Base):
|
|
|
375
381
|
hints = data.get("hints")
|
|
376
382
|
|
|
377
383
|
line = Line.from_dict(data.get("transportation"))
|
|
384
|
+
line_id = line.id
|
|
378
385
|
line_name = line.name
|
|
379
386
|
transport = line.product
|
|
380
387
|
origin = line.origin
|
|
@@ -384,6 +391,7 @@ class Departure(_Base):
|
|
|
384
391
|
return Departure(
|
|
385
392
|
data,
|
|
386
393
|
location,
|
|
394
|
+
line_id,
|
|
387
395
|
line_name,
|
|
388
396
|
route,
|
|
389
397
|
origin,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: apyefa
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Python API for EFA(Elektronische Fahrplanauskunft) async requests
|
|
5
5
|
Author-email: Alex Jung <jungdevelop@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -42,6 +42,7 @@ Requires-Dist: pytest; extra == "tests"
|
|
|
42
42
|
Requires-Dist: pytest-asyncio>=0.24.0; extra == "tests"
|
|
43
43
|
Requires-Dist: pytest-benchmark[histogram]>=3.2.1; extra == "tests"
|
|
44
44
|
Requires-Dist: requests>=2.32.3; extra == "tests"
|
|
45
|
+
Dynamic: license-file
|
|
45
46
|
|
|
46
47
|
# apyefa
|
|
47
48
|
[](https://github.com/alex-jung/apyefa/actions/workflows/python-package.yml)
|
|
@@ -79,8 +80,8 @@ pip install .
|
|
|
79
80
|
|Function Name |Description|
|
|
80
81
|
|----------------------------------------------------|-----------|
|
|
81
82
|
|[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|
|
|
82
|
-
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters
|
|
83
|
-
|[
|
|
83
|
+
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters|
|
|
84
|
+
|[locations_by_coord()](https://github.com/alex-jung/apyefa/wiki/locations_by_coord)|Search for locations by coordinates|
|
|
84
85
|
|[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|
|
|
85
86
|
|[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|
|
|
86
87
|
|[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|
|
|
@@ -138,7 +138,7 @@ class TestFunctionLocationsByCoord:
|
|
|
138
138
|
return_value=True,
|
|
139
139
|
):
|
|
140
140
|
|
|
141
|
-
await test_async_client.
|
|
141
|
+
await test_async_client.locations_by_coord(x, y)
|
|
142
142
|
|
|
143
143
|
mock_add_param.assert_any_call("outputFormat", "rapidJSON")
|
|
144
144
|
mock_add_param.assert_any_call("locationServerActive", 1)
|
|
@@ -154,7 +154,7 @@ class TestFunctionLocationsByCoord:
|
|
|
154
154
|
) as mock_parse:
|
|
155
155
|
mock_parse.return_value = [x for x in range(limit * 2)]
|
|
156
156
|
|
|
157
|
-
result = await test_async_client.
|
|
157
|
+
result = await test_async_client.locations_by_coord(0, 0, limit=limit)
|
|
158
158
|
|
|
159
159
|
assert len(result) == limit
|
|
160
160
|
|
|
@@ -172,7 +172,7 @@ class TestFunctionLocationsByCoord:
|
|
|
172
172
|
return_value=True,
|
|
173
173
|
):
|
|
174
174
|
|
|
175
|
-
await test_async_client.
|
|
175
|
+
await test_async_client.locations_by_coord(0, 0, format=format)
|
|
176
176
|
|
|
177
177
|
mock_add_param.assert_any_call("name_sf", f"0:0:{format}")
|
|
178
178
|
|
|
@@ -189,7 +189,7 @@ class TestFunctionLocationsByCoord:
|
|
|
189
189
|
return_value=True,
|
|
190
190
|
):
|
|
191
191
|
|
|
192
|
-
await test_async_client.
|
|
192
|
+
await test_async_client.locations_by_coord(
|
|
193
193
|
0, 0, search_nearbly_stops=search_nearbly_stops
|
|
194
194
|
)
|
|
195
195
|
|
|
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
|
|
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
|