Skip to content

Commit 56c7d43

Browse files
committed
hotfix for docs
1 parent 959788c commit 56c7d43

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

docs/source/conf.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
# sys.path.insert(0, os.path.abspath('../../urbanpy/utils'))
2323
import sphinx_rtd_theme
2424

25-
2625
# -- Project information -----------------------------------------------------
2726

2827
project = "urbanpy"
29-
copyright = "2020, IADB"
28+
copyright = "2023, IADB"
3029
author = "Andres Regal, Claudio Ortega & Antonio Vasquez Brust"
3130

3231
# The full version, including alpha/beta/rc tags
@@ -38,7 +37,11 @@
3837
# Add any Sphinx extension module names here, as strings. They can be
3938
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4039
# ones.
41-
extensions = ["sphinx.ext.autodoc", "sphinx_rtd_theme", "numpydoc"]
40+
extensions = [
41+
"sphinx.ext.autodoc",
42+
"sphinx_rtd_theme",
43+
"numpydoc",
44+
]
4245

4346
# Add any paths that contain templates here, relative to this directory.
4447
templates_path = ["_templates"]

docs/source/index.rst

-6
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ UrbanPy's original authors are Claudio Ortega
138138
(`socials <https://www.linkedin.com/in/claudioortega27/>`__) and Andrés
139139
Regal (`socials <https://www.linkedin.com/in/andrés-regal/>`__).
140140

141-
.. toctree::
142-
:maxdepth: 6
143-
:caption: Contents:
144-
145-
modules
146-
147141
\*Current support is tested on Linux Ubuntu 18.04 & Mac OS Catalina,
148142
coming soon we will test and support Windows 10.
149143

urbanpy/download/download.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1+
from typing import Optional, Tuple, Union
12
from warnings import warn
2-
import requests
3+
34
import geopandas as gpd
4-
import pandas as pd
55
import numpy as np
66
import osmnx as ox
7-
from shapely.geometry import Polygon, MultiPolygon
7+
import pandas as pd
8+
import requests
9+
from geopandas import GeoDataFrame, GeoSeries
810
from hdx.api.configuration import Configuration
911
from hdx.data.dataset import Dataset
10-
from typing import Optional, Union, Tuple
1112
from pandas import DataFrame
12-
from geopandas import GeoDataFrame, GeoSeries
13+
from shapely.geometry import MultiPolygon, Polygon
14+
1315
from urbanpy.utils import (
14-
to_overpass_query,
15-
overpass_to_gdf,
16-
get_hdx_label,
1716
HDX_POPULATION_TYPES,
17+
get_hdx_label,
18+
overpass_to_gdf,
19+
to_overpass_query,
1820
)
1921

2022
__all__ = [
@@ -176,7 +178,8 @@ def overpass(
176178
'key1': 'v1',
177179
'key2': None
178180
}
179-
mask:
181+
mask: GeoDataFrame, GeoSeries, Polygon or MultiPolygon
182+
Total bounds of mask to be used for the query.
180183
181184
Returns
182185
-------
@@ -185,6 +188,7 @@ def overpass(
185188
df: DataFrame
186189
Relations metadata such as ID and tags. Returns None if 'type_of_data' other than 'relation'.
187190
"""
191+
188192
minx, miny, maxx, maxy = mask.total_bounds
189193
bbox_string = f"{minx},{miny},{maxx},{maxy}"
190194

@@ -353,7 +357,6 @@ def get_hdx_dataset(resources_df: DataFrame, ids: Union[int, list]) -> DataFrame
353357
----------
354358
resources_df: pd.DataFrame
355359
Resources dataframe from returned by search_hdx_dataset
356-
357360
ids: int or list
358361
IDs in the resources dataframe
359362
@@ -373,7 +376,9 @@ def get_hdx_dataset(resources_df: DataFrame, ids: Union[int, list]) -> DataFrame
373376
-18.335694 | -70.387361 | 11.318147 | 12.099885
374377
-18.335417 | -70.394028 | 11.318147 | 12.099885
375378
-18.335139 | -70.394306 | 11.318147 | 12.099885
379+
376380
"""
381+
377382
urls = resources_df.loc[ids, "url"]
378383

379384
if isinstance(ids, list) and len(ids) > 1:

urbanpy/utils/utils.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
from math import ceil
2+
from typing import Optional, Tuple, Union
3+
14
import geopandas as gpd
2-
import pandas as pd
35
import numpy as np
6+
import pandas as pd
7+
from geopandas import GeoDataFrame, GeoSeries
48
from h3 import h3
5-
from math import ceil
6-
from shapely.geometry import Polygon, MultiPolygon
9+
from pandas import DataFrame
10+
from shapely.geometry import MultiPolygon, Polygon
711
from shapely.validation import make_valid
812
from sklearn.neighbors import BallTree
9-
from typing import Optional, Union, Tuple
10-
from pandas import DataFrame
11-
from geopandas import GeoDataFrame, GeoSeries
1213

1314
__all__ = [
1415
"swap_xy",
@@ -176,22 +177,20 @@ def create_duration_labels(durations):
176177
177178
Parameters
178179
----------
179-
180180
durations: Pandas Series
181181
Series containing trip durations in minutes.
182182
183183
Returns
184184
-------
185-
186185
custom_bins: list
187186
List of numbers with the inputs for the bins parameter of pd.cut function
188-
189187
custom_labels: list
190188
List of numbers with the inputs for the labels parameter of pd.cut function
191-
192189
"""
193190
default_bins = [0, 15, 30, 45, 60, 90, 120]
194-
default_labels = [f"{default_bins[i]}-{default_bins[i+1]}" for i in range(len(default_bins) - 1)]
191+
default_labels = [
192+
f"{default_bins[i]}-{default_bins[i+1]}" for i in range(len(default_bins) - 1)
193+
]
195194
default_labels.append(f">{default_bins[-1]}")
196195

197196
bins_ = default_bins.copy()
@@ -346,7 +345,6 @@ def overpass_to_gdf(
346345
ov_keys: list. Optional
347346
Unique OSM keys used in Overpass query (e.g. "amenity", "shop", etc) to fill "poi_type" df column.
348347
349-
350348
Returns
351349
-------
352350
gdf: GeoDataFrame

0 commit comments

Comments
 (0)