-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add GTFS downloader #202
base: main
Are you sure you want to change the base?
feat: add GTFS downloader #202
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #202 +/- ##
==========================================
+ Coverage 88.15% 90.99% +2.84%
==========================================
Files 66 49 -17
Lines 2929 1444 -1485
==========================================
- Hits 2582 1314 -1268
+ Misses 347 130 -217
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't make another namespace / module, since PbfFileDownloader
and other classes related to pbf files are next to OsmPbfLoader
. I'd even go further and merge the logic of GTFSDownloader
with GTFSLoader
to simplify the usage for the user. Maybe create a directory gtfs
within loaders and place both files there.
By this I mean modyfing existing function:
@overload
def load(
self,
area: Union[BaseGeometry, Iterable[BaseGeometry], gpd.GeoSeries, gpd.GeoDataFrame],
fail_on_validation_errors: bool = True,
skip_validation: bool = False,
) -> gpd.GeoDataFrame:
...
@overload
def load(
self,
gtfs_file: Union[str, "os.PathLike[str]"] = None, # notice the change of input type, we should accept both types
fail_on_validation_errors: bool = True,
skip_validation: bool = False,
) -> gpd.GeoDataFrame:
...
def load(
self,
area: Optional[Union[BaseGeometry, Iterable[BaseGeometry], gpd.GeoSeries, gpd.GeoDataFrame]] = None,
gtfs_file: Optional[Union[str, "os.PathLike[str]"]] = None, # notice the change of input type, we should accept both types
fail_on_validation_errors: bool = True,
skip_validation: bool = False,
) -> gpd.GeoDataFrame:
# check if area and gtfs_file are both None or both not None to raise an error
# if area is not none then download a gtfs file and proceed (or throw an error if not found)
# if file path - just proceed
@@ -7,33 +7,34 @@ | |||
|
|||
|
|||
def download_file( | |||
url: str, fname: str, chunk_size: int = 1024, force_download: bool = True | |||
url: str, filename: Path, chunk_size: int = 1024, force_download: bool = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't force users to use only string or only Path, we can accept an input like this: Union[str, "os.PathLike[str]"]
and then wrap it with Path(...)
at the start of the function.
closes #175