r5py 1.0.2__tar.gz → 1.0.3.dev0__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 r5py might be problematic. Click here for more details.
- {r5py-1.0.2/src/r5py.egg-info → r5py-1.0.3.dev0}/PKG-INFO +3 -2
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/__init__.py +1 -1
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/regional_task.py +4 -2
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/transit_layer.py +18 -39
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/transport_network.py +28 -2
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/exceptions.py +4 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0/src/r5py.egg-info}/PKG-INFO +3 -2
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py.egg-info/SOURCES.txt +1 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/__init__.py +12 -8
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/file_digest.py +3 -3
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/transport_network.py +21 -2
- r5py-1.0.3.dev0/tests/data/test_broken_gtfs.zip +0 -0
- r5py-1.0.3.dev0/tests/data/test_isochrones_bicycle.gpkg.zip +0 -0
- r5py-1.0.3.dev0/tests/data/test_isochrones_car.gpkg.zip +0 -0
- r5py-1.0.3.dev0/tests/data/test_isochrones_from_multiple_origins.gpkg.zip +0 -0
- r5py-1.0.3.dev0/tests/data/test_isochrones_transit.gpkg.zip +0 -0
- r5py-1.0.3.dev0/tests/data/test_isochrones_walk.gpkg.zip +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_detailed_itineraries.py +4 -4
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_isochrones.py +4 -0
- r5py-1.0.3.dev0/tests/test_transit_layer.py +5 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_transport_network.py +31 -2
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_travel_time_matrix.py +14 -2
- r5py-1.0.2/tests/data/test_isochrones_bicycle.gpkg.zip +0 -0
- r5py-1.0.2/tests/data/test_isochrones_car.gpkg.zip +0 -0
- r5py-1.0.2/tests/data/test_isochrones_from_multiple_origins.gpkg.zip +0 -0
- r5py-1.0.2/tests/data/test_isochrones_transit.gpkg.zip +0 -0
- r5py-1.0.2/tests/data/test_isochrones_walk.gpkg.zip +0 -0
- r5py-1.0.2/tests/test_transit_layer.py +0 -18
- {r5py-1.0.2 → r5py-1.0.3.dev0}/LICENSE +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/MANIFEST.in +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/README.md +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/pyproject.toml +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/setup.cfg +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/__main__.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/__init__.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/access_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/base_travel_time_matrix.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/detailed_itineraries.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/direct_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/egress_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/isochrones.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/scenario.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/street_layer.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/street_segment.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/transfer_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/transit_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/transport_mode.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/travel_time_matrix.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/trip.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/trip_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/r5/trip_planner.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/__init__.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/camel_to_snake_case.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/classpath.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/config.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/contains_gtfs_data.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/data_validation.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/environment.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/file_digest.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/good_enough_equidistant_crs.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/jvm.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/memory_footprint.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/parse_int_date.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/sample_data_set.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/snake_to_camel_case.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/spatially_clustered_geodataframe.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/validating_requests_session.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/warnings.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py/util/working_copy.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py.egg-info/dependency_links.txt +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py.egg-info/requires.txt +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/src/r5py.egg-info/top_level.txt +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/__init__.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/data_directory.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/destinations.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/garbage_collection.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/origins.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/r5_jar.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/routing_parameters.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/routing_results.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/sample_data.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/conftest_d/upstream_r5.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_detailed_itineraries_bicycle.gpkg.zip +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_detailed_itineraries_car.gpkg.zip +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_detailed_itineraries_transit.gpkg.zip +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_detailed_itineraries_walk.gpkg.zip +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_invalid_points_duplicate_ids.geojson +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_invalid_points_no_id_column.geojson +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_multiple_origins.geojson +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_snapped_population_grid_centroids.geojson +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_travel_times_bicycle.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_travel_times_car.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_travel_times_transit.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_travel_times_walk.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_valid_points_data.geojson +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_valid_single_point_data.geojson +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_walking_details_not_snapped.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_walking_details_snapped.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_walking_times_not_snapped.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/data/test_walking_times_snapped.csv +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/temporary_directory.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_camel_to_snake_case.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_classpath.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_config.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_contains_gtfs_data.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_data_validation.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_deterministic_behaviour.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_file_digest.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_good_enough_equidistant_crs.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_java_casting.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_memory_footprint.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_parse_int_date.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_regional_task.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_sample_data_set.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_snake_to_camel_case.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_street_layer.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_transport_mode.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_trip.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_trip_leg.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_trip_planner.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_validating_request_session.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_verbose_warnings.py +0 -0
- {r5py-1.0.2 → r5py-1.0.3.dev0}/tests/test_working_directory.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: r5py
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3.dev0
|
|
4
4
|
Summary: Python wrapper for the R5 routing analysis engine
|
|
5
5
|
Author: Christoph Fink, Willem Klumpenhouwer, Marcus Sairava, Rafael Pereira, Henrikki Tenkanen
|
|
6
6
|
License: GPL-3.0-or-later or MIT
|
|
@@ -58,6 +58,7 @@ Requires-Dist: pytest-lazy-fixtures; extra == "tests"
|
|
|
58
58
|
Requires-Dist: r5py.sampledata.helsinki>=0.1.1; extra == "tests"
|
|
59
59
|
Requires-Dist: r5py.sampledata.sao_paulo>=0.1.1; extra == "tests"
|
|
60
60
|
Requires-Dist: typing-extensions; extra == "tests"
|
|
61
|
+
Dynamic: license-file
|
|
61
62
|
|
|
62
63
|
<img class="r5py_logo" align="right" src="https://github.com/r5py/r5py/raw/main/docs/_static/images/r5py_blue.svg" alt="r5py logo" style="width:180px; max-width:30vW;">
|
|
63
64
|
|
|
@@ -194,8 +194,10 @@ class RegionalTask:
|
|
|
194
194
|
):
|
|
195
195
|
# fmt: on
|
|
196
196
|
warnings.warn(
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
(
|
|
198
|
+
"The currently loaded GTFS data sets do not define "
|
|
199
|
+
f"any services on {departure.date()}."
|
|
200
|
+
),
|
|
199
201
|
RuntimeWarning,
|
|
200
202
|
)
|
|
201
203
|
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
"""Wraps a com.conveyal.r5.transit.TransitLayer."""
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
import datetime
|
|
8
7
|
import functools
|
|
9
8
|
|
|
10
9
|
import jpype
|
|
11
10
|
import jpype.types
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
import java.time
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
__all__ = ["TransitLayer"]
|
|
@@ -32,44 +31,24 @@ class TransitLayer:
|
|
|
32
31
|
instance._transit_layer = transit_layer
|
|
33
32
|
return instance
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try:
|
|
39
|
-
start_date = min(
|
|
40
|
-
[
|
|
41
|
-
parse_int_date(service.calendar.start_date)
|
|
42
|
-
for service in self._transit_layer.services
|
|
43
|
-
]
|
|
44
|
-
)
|
|
45
|
-
except (AttributeError, ValueError) as exception:
|
|
46
|
-
raise ValueError("No GTFS data set loaded") from exception
|
|
47
|
-
return start_date
|
|
34
|
+
def covers(self, date):
|
|
35
|
+
"""
|
|
36
|
+
Check whether `date` is covered by GTFS data sets.
|
|
48
37
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
raise ValueError("No GTFS data set loaded") from exception
|
|
64
|
-
return end_date
|
|
65
|
-
|
|
66
|
-
def covers(self, point_in_time):
|
|
67
|
-
"""Check whether `point_in_time` is covered by GTFS data sets."""
|
|
68
|
-
try:
|
|
69
|
-
covers = self.start_date <= point_in_time <= self.end_date
|
|
70
|
-
except ValueError: # no GTFS data loaded
|
|
71
|
-
covers = False
|
|
72
|
-
return covers
|
|
38
|
+
Arguments:
|
|
39
|
+
----------
|
|
40
|
+
date : datetime.date
|
|
41
|
+
date for which to check whether a GTFS service exists.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
--------
|
|
45
|
+
bool
|
|
46
|
+
Whether or not any services exist on `date`.
|
|
47
|
+
"""
|
|
48
|
+
date = java.time.LocalDate.of(date.year, date.month, date.day)
|
|
49
|
+
return True in set(
|
|
50
|
+
[service.activeOn(date) for service in self._transit_layer.services]
|
|
51
|
+
)
|
|
73
52
|
|
|
74
53
|
def get_street_vertex_for_stop(self, stop):
|
|
75
54
|
"""
|
|
@@ -16,6 +16,7 @@ from .street_layer import StreetLayer
|
|
|
16
16
|
from .transit_layer import TransitLayer
|
|
17
17
|
from .transport_mode import TransportMode
|
|
18
18
|
from ..util import Config, contains_gtfs_data, FileDigest, start_jvm, WorkingCopy
|
|
19
|
+
from ..util.exceptions import GtfsFileError
|
|
19
20
|
|
|
20
21
|
import com.conveyal.gtfs
|
|
21
22
|
import com.conveyal.osmlib
|
|
@@ -35,7 +36,7 @@ start_jvm()
|
|
|
35
36
|
class TransportNetwork:
|
|
36
37
|
"""Wrap a com.conveyal.r5.transit.TransportNetwork."""
|
|
37
38
|
|
|
38
|
-
def __init__(self, osm_pbf, gtfs=[]):
|
|
39
|
+
def __init__(self, osm_pbf, gtfs=[], allow_errors=False):
|
|
39
40
|
"""
|
|
40
41
|
Load a transport network.
|
|
41
42
|
|
|
@@ -45,6 +46,9 @@ class TransportNetwork:
|
|
|
45
46
|
file path of an OpenStreetMap extract in PBF format
|
|
46
47
|
gtfs : str | pathlib.Path | list[str] | list[pathlib.Path]
|
|
47
48
|
path(s) to public transport schedule information in GTFS format
|
|
49
|
+
allow_errors : bool
|
|
50
|
+
try to proceed with loading the transport network even if input data
|
|
51
|
+
contain errors
|
|
48
52
|
"""
|
|
49
53
|
osm_pbf = WorkingCopy(osm_pbf)
|
|
50
54
|
if isinstance(gtfs, (str, pathlib.Path)):
|
|
@@ -79,9 +83,31 @@ class TransportNetwork:
|
|
|
79
83
|
transport_network.transitLayer = com.conveyal.r5.transit.TransitLayer()
|
|
80
84
|
transport_network.transitLayer.parentNetwork = transport_network
|
|
81
85
|
for gtfs_file in gtfs:
|
|
82
|
-
gtfs_feed = com.conveyal.gtfs.GTFSFeed.
|
|
86
|
+
gtfs_feed = com.conveyal.gtfs.GTFSFeed.writableTempFileFromGtfs(
|
|
83
87
|
f"{gtfs_file}"
|
|
84
88
|
)
|
|
89
|
+
if gtfs_feed.errors.size() > 0:
|
|
90
|
+
errors = [
|
|
91
|
+
f"{error.errorType}: {error.getMessageWithContext()}"
|
|
92
|
+
for error in gtfs_feed.errors
|
|
93
|
+
]
|
|
94
|
+
if allow_errors:
|
|
95
|
+
warnings.warn(
|
|
96
|
+
(
|
|
97
|
+
"R5 reported the following issues with "
|
|
98
|
+
f"GTFS file {gtfs_file.name}: \n"
|
|
99
|
+
+ ("\n- ".join(errors))
|
|
100
|
+
),
|
|
101
|
+
RuntimeWarning,
|
|
102
|
+
)
|
|
103
|
+
else:
|
|
104
|
+
raise GtfsFileError(
|
|
105
|
+
(
|
|
106
|
+
f"Could not load GTFS file {gtfs_file.name}. \n"
|
|
107
|
+
+ ("\n- ".join(errors))
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
|
|
85
111
|
transport_network.transitLayer.loadFromGtfs(gtfs_feed)
|
|
86
112
|
gtfs_feed.close()
|
|
87
113
|
|
|
@@ -12,6 +12,10 @@ class R5pyError(Exception):
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
# more specific exceptions
|
|
15
|
+
class GtfsFileError(R5pyError):
|
|
16
|
+
"""GTFS file contained errors."""
|
|
17
|
+
|
|
18
|
+
|
|
15
19
|
class ChecksumFailed(requests.RequestException, R5pyError):
|
|
16
20
|
"""Requested resource did not pass checksum test."""
|
|
17
21
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: r5py
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3.dev0
|
|
4
4
|
Summary: Python wrapper for the R5 routing analysis engine
|
|
5
5
|
Author: Christoph Fink, Willem Klumpenhouwer, Marcus Sairava, Rafael Pereira, Henrikki Tenkanen
|
|
6
6
|
License: GPL-3.0-or-later or MIT
|
|
@@ -58,6 +58,7 @@ Requires-Dist: pytest-lazy-fixtures; extra == "tests"
|
|
|
58
58
|
Requires-Dist: r5py.sampledata.helsinki>=0.1.1; extra == "tests"
|
|
59
59
|
Requires-Dist: r5py.sampledata.sao_paulo>=0.1.1; extra == "tests"
|
|
60
60
|
Requires-Dist: typing-extensions; extra == "tests"
|
|
61
|
+
Dynamic: license-file
|
|
61
62
|
|
|
62
63
|
<img class="r5py_logo" align="right" src="https://github.com/r5py/r5py/raw/main/docs/_static/images/r5py_blue.svg" alt="r5py logo" style="width:180px; max-width:30vW;">
|
|
63
64
|
|
|
@@ -90,6 +90,7 @@ tests/conftest_d/routing_results.py
|
|
|
90
90
|
tests/conftest_d/sample_data.py
|
|
91
91
|
tests/conftest_d/transport_network.py
|
|
92
92
|
tests/conftest_d/upstream_r5.py
|
|
93
|
+
tests/data/test_broken_gtfs.zip
|
|
93
94
|
tests/data/test_detailed_itineraries_bicycle.gpkg.zip
|
|
94
95
|
tests/data/test_detailed_itineraries_car.gpkg.zip
|
|
95
96
|
tests/data/test_detailed_itineraries_transit.gpkg.zip
|
|
@@ -73,10 +73,12 @@ from .sample_data import (
|
|
|
73
73
|
)
|
|
74
74
|
|
|
75
75
|
from .transport_network import (
|
|
76
|
+
broken_gtfs_file_path,
|
|
76
77
|
gtfs_file_path,
|
|
77
78
|
gtfs_timezone_helsinki,
|
|
79
|
+
helsinki_osm_pbf_file_path,
|
|
78
80
|
not_a_gtfs_file,
|
|
79
|
-
|
|
81
|
+
sao_paulo_osm_pbf_file_path,
|
|
80
82
|
transport_network,
|
|
81
83
|
transport_network_files_tuple,
|
|
82
84
|
transport_network_from_test_directory,
|
|
@@ -89,46 +91,48 @@ from .upstream_r5 import (
|
|
|
89
91
|
)
|
|
90
92
|
|
|
91
93
|
__all__ = [
|
|
94
|
+
"broken_gtfs_file_path",
|
|
92
95
|
"can_compute_detailed_route_geometries",
|
|
93
96
|
"departure_datetime",
|
|
94
97
|
"detailed_itineraries_bicycle",
|
|
95
98
|
"detailed_itineraries_car",
|
|
96
99
|
"detailed_itineraries_transit",
|
|
97
100
|
"detailed_itineraries_walk",
|
|
98
|
-
"file_digest_test_file_as_pathlib_path",
|
|
99
|
-
"file_digest_test_file_as_str",
|
|
100
|
-
"file_digest_sha256",
|
|
101
101
|
"file_digest_blake2b",
|
|
102
102
|
"file_digest_blake2s",
|
|
103
|
-
"
|
|
103
|
+
"file_digest_sha256",
|
|
104
|
+
"file_digest_test_file_as_pathlib_path",
|
|
105
|
+
"file_digest_test_file_as_str",
|
|
104
106
|
"gtfs_file_path",
|
|
105
107
|
"gtfs_timezone_helsinki",
|
|
106
|
-
"
|
|
108
|
+
"helsinki_osm_pbf_file_path",
|
|
107
109
|
"isochrones_bicycle",
|
|
108
110
|
"isochrones_car",
|
|
111
|
+
"isochrones_from_multiple_origins",
|
|
109
112
|
"isochrones_transit",
|
|
110
113
|
"isochrones_walk",
|
|
114
|
+
"java_garbage_collection",
|
|
111
115
|
"multiple_origins",
|
|
112
116
|
"not_a_gtfs_file",
|
|
113
117
|
"origin_point",
|
|
114
118
|
"origins_invalid_duplicate_ids",
|
|
115
119
|
"origins_invalid_no_id",
|
|
116
120
|
"origins_valid_ids",
|
|
117
|
-
"osm_pbf_file_path",
|
|
118
121
|
"population_grid",
|
|
119
122
|
"population_grid_points",
|
|
120
123
|
"population_grid_points_first_three",
|
|
121
124
|
"population_grid_points_four",
|
|
122
125
|
"population_grid_points_second_three",
|
|
123
|
-
"regional_task",
|
|
124
126
|
"r5_jar_cached",
|
|
125
127
|
"r5_jar_cached_invalid",
|
|
126
128
|
"r5_jar_sha256",
|
|
127
129
|
"r5_jar_sha256_github_error_message_when_posting",
|
|
128
130
|
"r5_jar_sha256_invalid",
|
|
129
131
|
"r5_jar_url",
|
|
132
|
+
"regional_task",
|
|
130
133
|
"sample_data_set_sha256",
|
|
131
134
|
"sample_data_set_url",
|
|
135
|
+
"sao_paulo_osm_pbf_file_path",
|
|
132
136
|
"snapped_population_grid_points",
|
|
133
137
|
"transport_network",
|
|
134
138
|
"transport_network_files_tuple",
|
|
@@ -9,12 +9,12 @@ import pytest
|
|
|
9
9
|
from .routing_results import ISOCHRONES_WALK
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
ISOCHRONES_WALK_BLAKE2B = "
|
|
12
|
+
ISOCHRONES_WALK_BLAKE2B = "163f6b2bc985e7eb347020320392a151ba1c156a09e82f87c0149273de2714516a098984e581bf99742c075232e18d69f5171370589cb5ec64d70f42f539f76c"
|
|
13
13
|
ISOCHRONES_WALK_BLAKE2S = (
|
|
14
|
-
"
|
|
14
|
+
"9f0af2c9946982b2e7d17a0b2205b596cbef01b1037874f5ad72348407ad381e"
|
|
15
15
|
)
|
|
16
16
|
ISOCHRONES_WALK_SHA256 = (
|
|
17
|
-
"
|
|
17
|
+
"b632d148ca5d9875482197461809f25fe790d71827e821983cefe2394841b417"
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
+
from .data_directory import DATA_DIRECTORY
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
BROKEN_GTFS_FILE = DATA_DIRECTORY / "test_broken_gtfs.zip"
|
|
13
|
+
|
|
9
14
|
|
|
10
15
|
@pytest.fixture
|
|
11
16
|
def not_a_gtfs_file():
|
|
@@ -15,6 +20,12 @@ def not_a_gtfs_file():
|
|
|
15
20
|
yield r5py.sampledata.helsinki.osm_pbf
|
|
16
21
|
|
|
17
22
|
|
|
23
|
+
@pytest.fixture
|
|
24
|
+
def broken_gtfs_file_path():
|
|
25
|
+
"""Return a file path of a broken GTFS file."""
|
|
26
|
+
yield BROKEN_GTFS_FILE
|
|
27
|
+
|
|
28
|
+
|
|
18
29
|
@pytest.fixture
|
|
19
30
|
def gtfs_file_path():
|
|
20
31
|
"""Return the file path of a GTFS sample data set."""
|
|
@@ -30,13 +41,21 @@ def gtfs_timezone_helsinki():
|
|
|
30
41
|
|
|
31
42
|
|
|
32
43
|
@pytest.fixture
|
|
33
|
-
def
|
|
34
|
-
"""Return the path of the OSM sample data set."""
|
|
44
|
+
def helsinki_osm_pbf_file_path():
|
|
45
|
+
"""Return the path of the OSM sample data set covering Helsinki."""
|
|
35
46
|
import r5py.sampledata.helsinki
|
|
36
47
|
|
|
37
48
|
yield r5py.sampledata.helsinki.osm_pbf
|
|
38
49
|
|
|
39
50
|
|
|
51
|
+
@pytest.fixture
|
|
52
|
+
def sao_paulo_osm_pbf_file_path():
|
|
53
|
+
"""Return the path of the OSM sample data set covering São Paulo."""
|
|
54
|
+
import r5py.sampledata.sao_paulo
|
|
55
|
+
|
|
56
|
+
yield r5py.sampledata.sao_paulo.osm_pbf
|
|
57
|
+
|
|
58
|
+
|
|
40
59
|
@pytest.fixture
|
|
41
60
|
def transport_network_files_tuple():
|
|
42
61
|
"""Return a tuple of transport network input test data file paths."""
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -284,8 +284,8 @@ class TestDetailedItineraries:
|
|
|
284
284
|
pytest.warns(
|
|
285
285
|
RuntimeWarning,
|
|
286
286
|
match=(
|
|
287
|
-
"
|
|
288
|
-
"
|
|
287
|
+
"The currently loaded GTFS data sets do not define "
|
|
288
|
+
"any services on .*"
|
|
289
289
|
),
|
|
290
290
|
),
|
|
291
291
|
self._expectations,
|
|
@@ -309,8 +309,8 @@ class TestDetailedItineraries:
|
|
|
309
309
|
pytest.warns(
|
|
310
310
|
RuntimeWarning,
|
|
311
311
|
match=(
|
|
312
|
-
"
|
|
313
|
-
"
|
|
312
|
+
"The currently loaded GTFS data sets do not define "
|
|
313
|
+
"any services on .*"
|
|
314
314
|
),
|
|
315
315
|
),
|
|
316
316
|
self._expectations,
|
|
@@ -80,6 +80,8 @@ class TestIsochrones:
|
|
|
80
80
|
lambda t: round(t.total_seconds() / 60)
|
|
81
81
|
)
|
|
82
82
|
|
|
83
|
+
isochrones["geometry"] = isochrones["geometry"].set_precision(0.0001)
|
|
84
|
+
|
|
83
85
|
geopandas.testing.assert_geodataframe_equal(
|
|
84
86
|
isochrones,
|
|
85
87
|
isochrones_from_multiple_origins,
|
|
@@ -131,6 +133,8 @@ class TestIsochrones:
|
|
|
131
133
|
lambda t: round(t.total_seconds() / 60)
|
|
132
134
|
)
|
|
133
135
|
|
|
136
|
+
isochrones["geometry"] = isochrones["geometry"].set_precision(0.0001)
|
|
137
|
+
|
|
134
138
|
geopandas.testing.assert_geodataframe_equal(
|
|
135
139
|
isochrones,
|
|
136
140
|
expected_isochrones,
|
|
@@ -149,15 +149,44 @@ class Test_TransportNetwork:
|
|
|
149
149
|
)
|
|
150
150
|
def test_argument_types(
|
|
151
151
|
self,
|
|
152
|
-
|
|
152
|
+
helsinki_osm_pbf_file_path,
|
|
153
153
|
gtfs_file_path,
|
|
154
154
|
osm_pbf_type,
|
|
155
155
|
gtfs_type,
|
|
156
156
|
gtfs_is_list,
|
|
157
157
|
):
|
|
158
|
-
osm_pbf = osm_pbf_type(
|
|
158
|
+
osm_pbf = osm_pbf_type(helsinki_osm_pbf_file_path)
|
|
159
159
|
gtfs = gtfs_type(gtfs_file_path)
|
|
160
160
|
if gtfs_is_list:
|
|
161
161
|
gtfs = [gtfs]
|
|
162
162
|
transport_network = r5py.TransportNetwork(osm_pbf, gtfs)
|
|
163
163
|
del transport_network
|
|
164
|
+
|
|
165
|
+
def test_broken_gtfs_file(
|
|
166
|
+
self,
|
|
167
|
+
helsinki_osm_pbf_file_path,
|
|
168
|
+
broken_gtfs_file_path,
|
|
169
|
+
):
|
|
170
|
+
with pytest.raises(
|
|
171
|
+
r5py.util.exceptions.GtfsFileError,
|
|
172
|
+
match="Could not load GTFS file.*",
|
|
173
|
+
):
|
|
174
|
+
_ = r5py.TransportNetwork(
|
|
175
|
+
helsinki_osm_pbf_file_path,
|
|
176
|
+
[broken_gtfs_file_path],
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def test_broken_gtfs_file_allow_errors(
|
|
180
|
+
self,
|
|
181
|
+
sao_paulo_osm_pbf_file_path,
|
|
182
|
+
broken_gtfs_file_path,
|
|
183
|
+
):
|
|
184
|
+
with pytest.warns(
|
|
185
|
+
RuntimeWarning,
|
|
186
|
+
match=".*issues with GTFS file.*",
|
|
187
|
+
):
|
|
188
|
+
_ = r5py.TransportNetwork(
|
|
189
|
+
sao_paulo_osm_pbf_file_path,
|
|
190
|
+
[broken_gtfs_file_path],
|
|
191
|
+
allow_errors=True,
|
|
192
|
+
)
|
|
@@ -291,7 +291,13 @@ class TestTravelTimeMatrix:
|
|
|
291
291
|
origin_point,
|
|
292
292
|
departure_datetime,
|
|
293
293
|
):
|
|
294
|
-
with pytest.warns(
|
|
294
|
+
with pytest.warns(
|
|
295
|
+
RuntimeWarning,
|
|
296
|
+
match=(
|
|
297
|
+
"The currently loaded GTFS data sets do not define "
|
|
298
|
+
"any services on .*"
|
|
299
|
+
),
|
|
300
|
+
):
|
|
295
301
|
_ = r5py.TravelTimeMatrix(
|
|
296
302
|
transport_network,
|
|
297
303
|
origins=origin_point,
|
|
@@ -307,7 +313,13 @@ class TestTravelTimeMatrix:
|
|
|
307
313
|
origin_point,
|
|
308
314
|
departure_datetime,
|
|
309
315
|
):
|
|
310
|
-
with pytest.warns(
|
|
316
|
+
with pytest.warns(
|
|
317
|
+
RuntimeWarning,
|
|
318
|
+
match=(
|
|
319
|
+
"The currently loaded GTFS data sets do not define "
|
|
320
|
+
"any services on .*"
|
|
321
|
+
),
|
|
322
|
+
):
|
|
311
323
|
_ = r5py.TravelTimeMatrix(
|
|
312
324
|
transport_network_from_test_files_without_gtfs,
|
|
313
325
|
origins=origin_point,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import pytest
|
|
5
|
-
|
|
6
|
-
from r5py.r5.transit_layer import TransitLayer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TestTransitLayer:
|
|
10
|
-
def test_uninitialised_transit_layer_start_date(self):
|
|
11
|
-
transit_layer = TransitLayer()
|
|
12
|
-
with pytest.raises((AttributeError, ValueError)):
|
|
13
|
-
assert transit_layer.start_date < transit_layer.end_date
|
|
14
|
-
|
|
15
|
-
def test_uninitialised_transit_layer_end_date(self):
|
|
16
|
-
transit_layer = TransitLayer()
|
|
17
|
-
with pytest.raises((AttributeError, ValueError)):
|
|
18
|
-
assert transit_layer.end_date > transit_layer.start_date
|
|
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
|
|
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
|