Skip to content

Commit c85bedf

Browse files
committed
Correct type hints for constructor
1 parent b9b2403 commit c85bedf

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
History
44
-------
55

6+
4.2.1
7+
++++++++++++++++++
8+
9+
* The type hints for the database file in the ``Reader`` constructor have
10+
been expanded to match those specified by ``maxmindb.open_database``. In
11+
particular, ``os.PathLike`` and ``IO`` have been added.
12+
13+
614
4.2.0 (2021-05-12)
715
++++++++++++++++++
816

geoip2/database.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
66
"""
77
import inspect
8-
from typing import Any, cast, List, Optional, Type, Union
8+
import os
9+
from typing import Any, AnyStr, cast, IO, List, Optional, Type, Union
910

1011
import maxminddb
1112

@@ -59,7 +60,10 @@ class Reader:
5960
"""
6061

6162
def __init__(
62-
self, fileish: str, locales: Optional[List[str]] = None, mode: int = MODE_AUTO
63+
self,
64+
fileish: Union[AnyStr, int, os.PathLike, IO],
65+
locales: Optional[List[str]] = None,
66+
mode: int = MODE_AUTO,
6367
) -> None:
6468
"""Create GeoIP2 Reader.
6569

0 commit comments

Comments
 (0)