r5py 0.1.1.dev0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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/__init__.py +2 -1
- r5py/__main__.py +1 -14
- r5py/r5/__init__.py +14 -0
- r5py/r5/base_travel_time_matrix_computer.py +4 -5
- r5py/r5/detailed_itineraries_computer.py +6 -10
- r5py/r5/direct_leg.py +1 -3
- r5py/r5/regional_task.py +44 -38
- r5py/r5/street_layer.py +1 -0
- r5py/r5/transfer_leg.py +2 -6
- r5py/r5/transit_layer.py +2 -0
- r5py/r5/transit_leg.py +1 -5
- r5py/r5/transport_mode.py +5 -3
- r5py/r5/transport_network.py +26 -11
- r5py/r5/travel_time_matrix_computer.py +4 -15
- r5py/r5/trip.py +8 -4
- r5py/r5/trip_leg.py +44 -5
- r5py/r5/trip_planner.py +81 -39
- r5py/sampledata/_keep/__init__.py +3 -0
- r5py/util/__init__.py +2 -0
- r5py/util/classpath.py +9 -5
- r5py/util/config.py +21 -2
- r5py/util/environment.py +34 -0
- r5py/util/good_enough_equidistant_crs.py +0 -1
- r5py/util/memory_footprint.py +3 -5
- r5py/util/sample_data_set.py +74 -0
- r5py/util/validating_requests_session.py +2 -2
- {r5py-0.1.1.dev0.dist-info → r5py-0.1.2.dist-info}/METADATA +30 -23
- r5py-0.1.2.dist-info/RECORD +43 -0
- {r5py-0.1.1.dev0.dist-info → r5py-0.1.2.dist-info}/WHEEL +1 -1
- r5py/util/data_set.py +0 -74
- r5py-0.1.1.dev0.dist-info/RECORD +0 -41
- {r5py-0.1.1.dev0.dist-info → r5py-0.1.2.dist-info}/LICENSE +0 -0
- {r5py-0.1.1.dev0.dist-info → r5py-0.1.2.dist-info}/top_level.txt +0 -0
r5py/util/data_set.py
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"""A remote data set that is downloaded on demand."""
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import hashlib
|
|
8
|
-
import pathlib
|
|
9
|
-
import warnings
|
|
10
|
-
|
|
11
|
-
from r5py.util.config import Config
|
|
12
|
-
from r5py.util.validating_requests_session import ValidatingRequestsSession
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
config = Config()
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class DataSet(pathlib.Path):
|
|
19
|
-
"""Data set that is downloaded and cached as needed."""
|
|
20
|
-
|
|
21
|
-
# decide which kind of pathlib.Path we are (Windows, Unix, ...)
|
|
22
|
-
# cf. https://stackoverflow.com/a/66613346/463864
|
|
23
|
-
_flavour = type(pathlib.Path())._flavour
|
|
24
|
-
|
|
25
|
-
def __new__(cls, remote_url, sha256_checksum):
|
|
26
|
-
# pathlib.Path does everything in __new__, rather than __init__
|
|
27
|
-
cached_path = pathlib.Path(config.CACHE_DIR) / pathlib.Path(remote_url).name
|
|
28
|
-
return super().__new__(cls, cached_path)
|
|
29
|
-
|
|
30
|
-
def __init__(self, remote_url, sha256_checksum, *args, **kwargs):
|
|
31
|
-
"""
|
|
32
|
-
Define a data set that is downloaded and cached on demand.
|
|
33
|
-
|
|
34
|
-
Arguments
|
|
35
|
-
---------
|
|
36
|
-
remote_url : str
|
|
37
|
-
source URL for this data set
|
|
38
|
-
sha256_checksum : str
|
|
39
|
-
checksum for this data set, using an SHA256 algorithm
|
|
40
|
-
"""
|
|
41
|
-
super().__init__()
|
|
42
|
-
self.remote_url = remote_url
|
|
43
|
-
self.checksum = sha256_checksum
|
|
44
|
-
self.cached_path = (
|
|
45
|
-
pathlib.Path(config.CACHE_DIR) / pathlib.Path(remote_url).name
|
|
46
|
-
)
|
|
47
|
-
self._downloaded = False
|
|
48
|
-
|
|
49
|
-
def _download_remote_file(self):
|
|
50
|
-
if not self._downloaded:
|
|
51
|
-
try:
|
|
52
|
-
assert (
|
|
53
|
-
hashlib.sha256(self.cached_path.read_bytes()).hexdigest()
|
|
54
|
-
== self.checksum
|
|
55
|
-
)
|
|
56
|
-
except (AssertionError, FileNotFoundError):
|
|
57
|
-
if config.arguments.verbose:
|
|
58
|
-
warnings.warn(
|
|
59
|
-
f"First access to {pathlib.Path(self.remote_url).name}, "
|
|
60
|
-
"downloading remote file to local cache",
|
|
61
|
-
RuntimeWarning,
|
|
62
|
-
)
|
|
63
|
-
with ValidatingRequestsSession() as session, session.get(
|
|
64
|
-
self.remote_url, self.checksum
|
|
65
|
-
) as response:
|
|
66
|
-
self.cached_path.write_bytes(response.content)
|
|
67
|
-
|
|
68
|
-
def __str__(self):
|
|
69
|
-
self._download_remote_file()
|
|
70
|
-
return super().__str__()
|
|
71
|
-
|
|
72
|
-
def __fspath__(self):
|
|
73
|
-
self._download_remote_file()
|
|
74
|
-
return super().__fspath__()
|
r5py-0.1.1.dev0.dist-info/RECORD
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
r5py/__init__.py,sha256=1j5vMwVO1AWhsEh2wGB7oEdkWhU8LYKt2VyjIM7U9Jk,418
|
|
2
|
-
r5py/__main__.py,sha256=5p_QWx8hsNbz34OwMKl9mY644bfqwXRFXkFSlTP06AM,239
|
|
3
|
-
r5py/r5/__init__.py,sha256=gq-1XbdrHE4v3XAvyV-Amod-Vcgp_c1Sbs13mgxOD08,643
|
|
4
|
-
r5py/r5/access_leg.py,sha256=W3GfPEpqmWD1c4xipd6UcVIaBC-yb6srGCZV30E2dPY,293
|
|
5
|
-
r5py/r5/base_travel_time_matrix_computer.py,sha256=ji6-rAXPz5athCKkXbSZpDagmuMGq_MeGnEX1NuiuLg,6318
|
|
6
|
-
r5py/r5/breakdown_stat.py,sha256=ZQkWA0hXlcRH3KVgtxPSNHP0FUDri8MWqdFk8EUdDMU,533
|
|
7
|
-
r5py/r5/detailed_itineraries_computer.py,sha256=kRV8OBpvdsgYHcNGQzBi6Y3WyAlPCTSQn0HrWoBqvus,8483
|
|
8
|
-
r5py/r5/direct_leg.py,sha256=opX575iuByoy8WORIsSvIgVqAwglBVCl15ZCo1pv_Mk,1064
|
|
9
|
-
r5py/r5/egress_leg.py,sha256=9rsCIcwlZUzoZE6q4imNY3VWpjJepO1IJvheVrlPi90,297
|
|
10
|
-
r5py/r5/regional_task.py,sha256=fSExSD_-OlgbxJ42IS-ApbObSrHtXmRElxBqDwS88Io,22870
|
|
11
|
-
r5py/r5/scenario.py,sha256=nUNAlN3cO7E_b4sMpNqdL0FD7WQaQ49iIvh-k8l4YRM,763
|
|
12
|
-
r5py/r5/street_layer.py,sha256=aA8cBXvV60wH7WlEnwqbPXPpPxwQQsPPbW59HDUJrc0,2196
|
|
13
|
-
r5py/r5/transfer_leg.py,sha256=m_9t1Kr8pq5rmtJz4XZSvRpog4_WpMtF2nKeybJ0v8U,325
|
|
14
|
-
r5py/r5/transit_layer.py,sha256=znQcJmtFpqVcsvZziPDHxAcRS0OXvyn3JdWE_lXZv0A,2928
|
|
15
|
-
r5py/r5/transit_leg.py,sha256=zd8QnMiOHCw3hS6WO5uwegxROdwDpqNDqvZwVJ2MlKo,241
|
|
16
|
-
r5py/r5/transport_mode.py,sha256=YJj2CzZ0cz4hAu48udYtX8MnFuSx4he703xcP3BV_7I,3586
|
|
17
|
-
r5py/r5/transport_network.py,sha256=rP_C29qYdbgnTww2uR7Sf10zLcXfuaMlmhfH1hVztpI,10204
|
|
18
|
-
r5py/r5/travel_time_matrix_computer.py,sha256=ns4DnWXfyPpslwQlHGM5Vsmpdzvr8NF-hWaRgc8HYGc,4880
|
|
19
|
-
r5py/r5/trip.py,sha256=SvXXQdvkCZzXcAbLyxKjCEwdbft_Jt7SPmPDzdw0K9w,2617
|
|
20
|
-
r5py/r5/trip_leg.py,sha256=gto-VRo_AdUxdRDRlIey6f8jSZ021NI91BODTowp-wQ,4131
|
|
21
|
-
r5py/r5/trip_planner.py,sha256=298IvJioFz4uj1L8qXJE5Ehrqcy51IP_2FoQfo3GEDc,21293
|
|
22
|
-
r5py/util/__init__.py,sha256=moUcR_oxpITt2vdNQxuej6haFywjA62UcUY4T5TMDns,673
|
|
23
|
-
r5py/util/camel_to_snake_case.py,sha256=zj5F3PNBvsuS6vqN4USeeo8NI-3hnscGhwun0G95AK0,673
|
|
24
|
-
r5py/util/classpath.py,sha256=os4UmHEs2GGk0jnHSD_1wJHEjmpYQU3VAb6T_iUdFEw,2724
|
|
25
|
-
r5py/util/config.py,sha256=R7Liz5LfZXlUxvuI8U-X71kzDvOWVVKsf6sasejwiEA,3968
|
|
26
|
-
r5py/util/contains_gtfs_data.py,sha256=ooX4hfVDKK0aqX1MI46jSFZ7dZ6riyXaORrgF6PUFrk,1211
|
|
27
|
-
r5py/util/data_set.py,sha256=cOLHp20vvnfZcaY2bjvRO7wW29enTMebjK_FqpidpsQ,2398
|
|
28
|
-
r5py/util/data_validation.py,sha256=H5Mcp2nS4vu5RKym20mPnGpl-8d0SDchzDRJBrrL6WE,1039
|
|
29
|
-
r5py/util/exceptions.py,sha256=r65XUg_AJ_bTw8ARNj7A2-GbFZlSTrOAjDynx1pSD2Y,1049
|
|
30
|
-
r5py/util/good_enough_equidistant_crs.py,sha256=VuzPGPTyL7T0Cl3SZba7atBTyyt9uUTLkq7JVMxjGsI,2355
|
|
31
|
-
r5py/util/jvm.py,sha256=NCwoYLDznXydcIRAZl2kzUQA6D6NCvzjVG74pm6ioR0,5027
|
|
32
|
-
r5py/util/memory_footprint.py,sha256=FlOLEAz7yI3YOv3wJe_tejJPh0y640QlDd0Z3Ce5i2s,4660
|
|
33
|
-
r5py/util/parse_int_date.py,sha256=JmnV8TwdUdUp3kSp2e73ZSxCbRyqv2FmQzNt0I_MsM0,667
|
|
34
|
-
r5py/util/snake_to_camel_case.py,sha256=uJ5hTCVDUEmIxTyy4LGFTbpGC_rtnjDZVQ2vmVRTQ4k,485
|
|
35
|
-
r5py/util/validating_requests_session.py,sha256=nkgOsZ_fbaP19R8l0ImZLFo5zUdw9-B289w0DEygtW0,1809
|
|
36
|
-
r5py/util/warnings.py,sha256=CvxKWKlNO_p3riB4SkNqbU5AGPsaY_3-OzqaBObE3B8,139
|
|
37
|
-
r5py-0.1.1.dev0.dist-info/LICENSE,sha256=VAnuGDX1TPylSN9G2xLa-urDpj_SQwn-qqs068dx4tk,51
|
|
38
|
-
r5py-0.1.1.dev0.dist-info/METADATA,sha256=f9uUrBSAQ_qHaywnEEZOFJ1ISf-q9SNVcwLwXvOXgcs,9579
|
|
39
|
-
r5py-0.1.1.dev0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
40
|
-
r5py-0.1.1.dev0.dist-info/top_level.txt,sha256=fOH1R85dkNDOI7jkg-lIsl5CQIO4fE5X868K9dTqs9U,5
|
|
41
|
-
r5py-0.1.1.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|