Skip to content

Commit

Permalink
Update pre-commit to python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
rth committed Apr 12, 2024
1 parent 71257ec commit 380f1aa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,13 @@ For additional documentation see

# Installation

pgeocode requires Python 3.8+ as well as `numpy` and `pandas` packages.
pgeocode requires Python 3.10+ as well as `numpy` and `pandas` packages.
It can be installed with,

```
pip install pgeocode
```

or

```
conda install -c conda-forge pgeocode
```

# Quickstart

Expand Down Expand Up @@ -142,6 +137,8 @@ repository for examples of data files.

The pgeocode package is distributed under the 3-clause BSD license.

The pgeocode package is maintained by [Symerio](https://www.symerio.com).

# Supported countries

The list of countries available in the GeoNames database, with the
Expand Down Expand Up @@ -173,4 +170,4 @@ Uruguay (UY), Holy See (VA), United States Virgin Islands (VI), Wallis
and Futuna Islands (WF), Mayotte (YT), South Africa (ZA)

See [GeoNames database](http://download.geonames.org/export/zip/) for
more information. The pgeocode package is maintained by [Symerio](https://www.symerio.com).
more information.
8 changes: 4 additions & 4 deletions pgeocode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import urllib.request
import warnings
from io import BytesIO
from typing import Any, List, Optional, Tuple
from typing import Any
from zipfile import ZipFile

import numpy as np
Expand Down Expand Up @@ -182,7 +182,7 @@ def _open_extract_url(url: str, country: str) -> Any:


@contextlib.contextmanager
def _open_extract_cycle_url(urls: List[str], country: str) -> Any:
def _open_extract_cycle_url(urls: list[str], country: str) -> Any:
"""Same as _open_extract_url but cycle through URLs until one works
We start by opening the first URL in the list, and if fails
Expand Down Expand Up @@ -245,7 +245,7 @@ def __init__(self, country: str = "fr", unique: bool = True):
self.unique = unique

@staticmethod
def _get_data(country: str) -> Tuple[str, pd.DataFrame]:
def _get_data(country: str) -> tuple[str, pd.DataFrame]:
"""Load the data from disk; otherwise download and save it"""

data_path = os.path.join(STORAGE_DIR, country.upper() + ".txt")
Expand Down Expand Up @@ -349,7 +349,7 @@ def query_location(
self,
name: str,
top_k: int = 100,
fuzzy_threshold: Optional[int] = None,
fuzzy_threshold: int | None = None,
col: str = "place_name",
) -> pd.DataFrame:
"""Get location information from a place name
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = ["setuptools>=42", "wheel"]

[tool.ruff]
target-version = "py38"
target-version = "py310"

[tool.ruff.lint]
select = [
Expand All @@ -20,7 +20,7 @@ select = [
ignore = ["E402", "E501", "E731", "E741"]

[tool.mypy]
python_version = "3.8"
python_version = "3.10"
show_error_codes = true
warn_unreachable = true

Expand Down
2 changes: 1 addition & 1 deletion test_pgeocode.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_haversine_distance():
y = x * rng.rand(N, 2)

d_ref = np.zeros(N)
for idx, (x_coord, y_coord) in enumerate(zip(x, y)):
for idx, (x_coord, y_coord) in enumerate(zip(x, y, strict=False)):
d_ref[idx] = great_circle(x_coord, y_coord).km

d_pred = haversine_distance(x, y)
Expand Down

0 comments on commit 380f1aa

Please sign in to comment.