diff --git a/srai/joiners/_base.py b/srai/joiners/_base.py index 00e35f32..098abac0 100644 --- a/srai/joiners/_base.py +++ b/srai/joiners/_base.py @@ -10,7 +10,9 @@ class Joiner(abc.ABC): @abc.abstractmethod def transform( - self, regions: gpd.GeoDataFrame, features: gpd.GeoDataFrame + self, + regions: gpd.GeoDataFrame, + features: gpd.GeoDataFrame, ) -> gpd.GeoDataFrame: # pragma: no cover """ Join features to regions. diff --git a/srai/joiners/intersection_joiner.py b/srai/joiners/intersection_joiner.py index be6ac438..c88d40f4 100644 --- a/srai/joiners/intersection_joiner.py +++ b/srai/joiners/intersection_joiner.py @@ -8,9 +8,10 @@ import pandas as pd from srai.constants import FEATURES_INDEX, GEOMETRY_COLUMN, REGIONS_INDEX +from srai.joiners import Joiner -class IntersectionJoiner: +class IntersectionJoiner(Joiner): """ Intersection Joiner. diff --git a/srai/loaders/_base.py b/srai/loaders/_base.py index c38abb7d..b708da89 100644 --- a/srai/loaders/_base.py +++ b/srai/loaders/_base.py @@ -1,8 +1,7 @@ """Base class for loaders.""" import abc -from pathlib import Path -from typing import Union +from typing import Any import geopandas as gpd @@ -11,13 +10,13 @@ class Loader(abc.ABC): """Abstract class for loaders.""" @abc.abstractmethod - def load(self, area: Union[gpd.GeoDataFrame, Path]) -> gpd.GeoDataFrame: # pragma: no cover + def load(self, *args: Any, **kwargs: Any) -> gpd.GeoDataFrame: # pragma: no cover """ Load data for a given area. Args: - area (gdf.GeoDataFrame | Path): GeoDataFrame with the area of interest or a path - to a file with a geometry. + *args: Positional arguments dependating on a specific loader. + **kwargs: Keyword arguments dependating on a specific loader. Returns: GeoDataFrame with the downloaded data. diff --git a/srai/loaders/geoparquet_loader.py b/srai/loaders/geoparquet_loader.py index 0661a696..a7a6e343 100644 --- a/srai/loaders/geoparquet_loader.py +++ b/srai/loaders/geoparquet_loader.py @@ -10,9 +10,10 @@ import geopandas as gpd from srai.constants import GEOMETRY_COLUMN, WGS84_CRS +from srai.loaders import Loader -class GeoparquetLoader: +class GeoparquetLoader(Loader): """ GeoparquetLoader. diff --git a/srai/loaders/gtfs_loader.py b/srai/loaders/gtfs_loader.py index 69509719..2999d106 100644 --- a/srai/loaders/gtfs_loader.py +++ b/srai/loaders/gtfs_loader.py @@ -18,6 +18,7 @@ from shapely.geometry import Point from srai.constants import GEOMETRY_COLUMN, WGS84_CRS +from srai.loaders import Loader from srai.utils._optional import import_optional_dependencies if TYPE_CHECKING: # pragma: no cover @@ -27,7 +28,7 @@ GTFS2VEC_TRIPS_PREFIX = "trips_at_" -class GTFSLoader: +class GTFSLoader(Loader): """ GTFSLoader. diff --git a/srai/loaders/osm_loaders/_base.py b/srai/loaders/osm_loaders/_base.py index bd90192a..13c53178 100644 --- a/srai/loaders/osm_loaders/_base.py +++ b/srai/loaders/osm_loaders/_base.py @@ -8,6 +8,7 @@ import pandas as pd from tqdm import tqdm +from srai.loaders import Loader from srai.loaders.osm_loaders.filters._typing import ( grouped_osm_tags_type, merge_grouped_osm_tags_type, @@ -16,7 +17,7 @@ from srai.utils.typing import is_expected_type -class OSMLoader(abc.ABC): +class OSMLoader(Loader, abc.ABC): """Abstract class for loaders.""" @abc.abstractmethod diff --git a/srai/loaders/osm_loaders/osm_online_loader.py b/srai/loaders/osm_loaders/osm_online_loader.py index f7a8f2f5..efe6eeb1 100644 --- a/srai/loaders/osm_loaders/osm_online_loader.py +++ b/srai/loaders/osm_loaders/osm_online_loader.py @@ -13,7 +13,10 @@ from srai.constants import FEATURES_INDEX, GEOMETRY_COLUMN, WGS84_CRS from srai.loaders.osm_loaders._base import OSMLoader -from srai.loaders.osm_loaders.filters._typing import grouped_osm_tags_type, osm_tags_type +from srai.loaders.osm_loaders.filters._typing import ( + grouped_osm_tags_type, + osm_tags_type, +) from srai.utils._optional import import_optional_dependencies diff --git a/srai/loaders/osm_loaders/osm_pbf_loader.py b/srai/loaders/osm_loaders/osm_pbf_loader.py index c09f3448..b22f9e40 100644 --- a/srai/loaders/osm_loaders/osm_pbf_loader.py +++ b/srai/loaders/osm_loaders/osm_pbf_loader.py @@ -11,7 +11,10 @@ from srai.constants import FEATURES_INDEX, GEOMETRY_COLUMN, WGS84_CRS from srai.loaders.osm_loaders._base import OSMLoader -from srai.loaders.osm_loaders.filters._typing import grouped_osm_tags_type, osm_tags_type +from srai.loaders.osm_loaders.filters._typing import ( + grouped_osm_tags_type, + osm_tags_type, +) from srai.utils._optional import import_optional_dependencies diff --git a/srai/loaders/osm_way_loader/osm_way_loader.py b/srai/loaders/osm_way_loader/osm_way_loader.py index 8a29a548..8adbbfbe 100644 --- a/srai/loaders/osm_way_loader/osm_way_loader.py +++ b/srai/loaders/osm_way_loader/osm_way_loader.py @@ -16,6 +16,7 @@ from srai.constants import FEATURES_INDEX, GEOMETRY_COLUMN, WGS84_CRS from srai.exceptions import LoadedDataIsEmptyException +from srai.loaders import Loader from srai.utils._optional import import_optional_dependencies from . import constants @@ -41,7 +42,7 @@ class NetworkType(str, Enum): WALK = "walk" -class OSMWayLoader: +class OSMWayLoader(Loader): """ OSMWayLoader downloads road infrastructure from OSM.