From 2d8fe52d08fa09386e59d2f3c524254795656b93 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 31 Aug 2021 14:15:55 -0700 Subject: [PATCH] Remove geoip2 stubs in favor of upstream (#5964) The geoip2 package has shipped a PEP 561 py.typed file since Jul 28, 2020. Co-authored-by: Akuli --- stubs/geoip2/@tests/stubtest_allowlist.txt | 14 ---- stubs/geoip2/METADATA.toml | 4 -- stubs/geoip2/geoip2/__init__.pyi | 0 stubs/geoip2/geoip2/database.pyi | 24 ------- stubs/geoip2/geoip2/errors.pyi | 14 ---- stubs/geoip2/geoip2/mixins.pyi | 3 - stubs/geoip2/geoip2/models.pyi | 62 ---------------- stubs/geoip2/geoip2/records.pyi | 83 ---------------------- 8 files changed, 204 deletions(-) delete mode 100644 stubs/geoip2/@tests/stubtest_allowlist.txt delete mode 100644 stubs/geoip2/METADATA.toml delete mode 100644 stubs/geoip2/geoip2/__init__.pyi delete mode 100644 stubs/geoip2/geoip2/database.pyi delete mode 100644 stubs/geoip2/geoip2/errors.pyi delete mode 100644 stubs/geoip2/geoip2/mixins.pyi delete mode 100644 stubs/geoip2/geoip2/models.pyi delete mode 100644 stubs/geoip2/geoip2/records.pyi diff --git a/stubs/geoip2/@tests/stubtest_allowlist.txt b/stubs/geoip2/@tests/stubtest_allowlist.txt deleted file mode 100644 index 5de08533c..000000000 --- a/stubs/geoip2/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,14 +0,0 @@ -geoip2.database.Reader.__exit__ -geoip2.database.Reader.__init__ -geoip2.models.SimpleModel.__init__ -geoip2.records.City.__init__ -geoip2.records.Continent.__init__ -geoip2.records.Country.__init__ -geoip2.records.Location.__init__ -geoip2.records.MaxMind.__init__ -geoip2.records.PlaceRecord.__init__ -geoip2.records.Postal.__init__ -geoip2.records.Record.__init__ -geoip2.records.RepresentedCountry.__init__ -geoip2.records.Subdivision.__init__ -geoip2.records.Traits.__init__ diff --git a/stubs/geoip2/METADATA.toml b/stubs/geoip2/METADATA.toml deleted file mode 100644 index 631b5ced7..000000000 --- a/stubs/geoip2/METADATA.toml +++ /dev/null @@ -1,4 +0,0 @@ -version = "3.0" -obsolete_since = "4.0.2" -python2 = true -requires = ["types-maxminddb"] diff --git a/stubs/geoip2/geoip2/__init__.pyi b/stubs/geoip2/geoip2/__init__.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/stubs/geoip2/geoip2/database.pyi b/stubs/geoip2/geoip2/database.pyi deleted file mode 100644 index cda650995..000000000 --- a/stubs/geoip2/geoip2/database.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from types import TracebackType -from typing import Optional, Sequence, Text, Type - -from geoip2.models import ASN, ISP, AnonymousIP, City, ConnectionType, Country, Domain, Enterprise -from maxminddb.reader import Metadata - -_Locales = Optional[Sequence[Text]] - -class Reader: - def __init__(self, filename: Text, locales: _Locales = ..., mode: int = ...) -> None: ... - def __enter__(self) -> Reader: ... - def __exit__( - self, exc_type: Type[BaseException] | None = ..., exc_val: BaseException | None = ..., exc_tb: TracebackType | None = ... - ) -> None: ... - def country(self, ip_address: Text) -> Country: ... - def city(self, ip_address: Text) -> City: ... - def anonymous_ip(self, ip_address: Text) -> AnonymousIP: ... - def asn(self, ip_address: Text) -> ASN: ... - def connection_type(self, ip_address: Text) -> ConnectionType: ... - def domain(self, ip_address: Text) -> Domain: ... - def enterprise(self, ip_address: Text) -> Enterprise: ... - def isp(self, ip_address: Text) -> ISP: ... - def metadata(self) -> Metadata: ... - def close(self) -> None: ... diff --git a/stubs/geoip2/geoip2/errors.pyi b/stubs/geoip2/geoip2/errors.pyi deleted file mode 100644 index aa6a929c3..000000000 --- a/stubs/geoip2/geoip2/errors.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from typing import Text - -class GeoIP2Error(RuntimeError): ... -class AddressNotFoundError(GeoIP2Error): ... -class AuthenticationError(GeoIP2Error): ... - -class HTTPError(GeoIP2Error): - http_status: int | None - uri: Text | None - def __init__(self, message: Text, http_status: int | None = ..., uri: Text | None = ...) -> None: ... - -class InvalidRequestError(GeoIP2Error): ... -class OutOfQueriesError(GeoIP2Error): ... -class PermissionRequiredError(GeoIP2Error): ... diff --git a/stubs/geoip2/geoip2/mixins.pyi b/stubs/geoip2/geoip2/mixins.pyi deleted file mode 100644 index 8c683c26b..000000000 --- a/stubs/geoip2/geoip2/mixins.pyi +++ /dev/null @@ -1,3 +0,0 @@ -class SimpleEquality: - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... diff --git a/stubs/geoip2/geoip2/models.pyi b/stubs/geoip2/geoip2/models.pyi deleted file mode 100644 index 1e07d613b..000000000 --- a/stubs/geoip2/geoip2/models.pyi +++ /dev/null @@ -1,62 +0,0 @@ -from typing import Any, Mapping, Optional, Sequence, Text - -from geoip2 import records -from geoip2.mixins import SimpleEquality - -_Locales = Optional[Sequence[Text]] -_RawResponse = Mapping[Text, Mapping[Text, Any]] - -class Country(SimpleEquality): - continent: records.Continent - country: records.Country - registered_country: records.Country - represented_country: records.RepresentedCountry - maxmind: records.MaxMind - traits: records.Traits - raw: _RawResponse - def __init__(self, raw_response: _RawResponse, locales: _Locales = ...) -> None: ... - -class City(Country): - city: records.City - location: records.Location - postal: records.Postal - subdivisions: records.Subdivisions - def __init__(self, raw_response: _RawResponse, locales: _Locales = ...) -> None: ... - -class Insights(City): ... -class Enterprise(City): ... -class SimpleModel(SimpleEquality): ... - -class AnonymousIP(SimpleModel): - is_anonymous: bool - is_anonymous_vpn: bool - is_hosting_provider: bool - is_public_proxy: bool - is_tor_exit_node: bool - ip_address: Text | None - raw: _RawResponse - def __init__(self, raw: _RawResponse) -> None: ... - -class ASN(SimpleModel): - autonomous_system_number: int | None - autonomous_system_organization: Text | None - ip_address: Text | None - raw: _RawResponse - def __init__(self, raw: _RawResponse) -> None: ... - -class ConnectionType(SimpleModel): - connection_type: Text | None - ip_address: Text | None - raw: _RawResponse - def __init__(self, raw: _RawResponse) -> None: ... - -class Domain(SimpleModel): - domain: Text | None - ip_address: Text | None - raw: Text | None - def __init__(self, raw: _RawResponse) -> None: ... - -class ISP(ASN): - isp: Text | None - organization: Text | None - def __init__(self, raw: _RawResponse) -> None: ... diff --git a/stubs/geoip2/geoip2/records.pyi b/stubs/geoip2/geoip2/records.pyi deleted file mode 100644 index 0d90b18ca..000000000 --- a/stubs/geoip2/geoip2/records.pyi +++ /dev/null @@ -1,83 +0,0 @@ -from typing import Any, Mapping, Optional, Sequence, Text, Tuple - -from geoip2.mixins import SimpleEquality - -_Locales = Optional[Sequence[Text]] -_Names = Mapping[Text, Text] - -class Record(SimpleEquality): - def __init__(self, **kwargs: Any) -> None: ... - def __setattr__(self, name: Text, value: Any) -> None: ... - -class PlaceRecord(Record): - def __init__(self, locales: _Locales = ..., **kwargs: Any) -> None: ... - @property - def name(self) -> Text: ... - -class City(PlaceRecord): - confidence: int - geoname_id: int - names: _Names - -class Continent(PlaceRecord): - code: Text - geoname_id: int - names: _Names - -class Country(PlaceRecord): - confidence: int - geoname_id: int - is_in_european_union: bool - iso_code: Text - names: _Names - def __init__(self, locales: _Locales = ..., **kwargs: Any) -> None: ... - -class RepresentedCountry(Country): - type: Text - -class Location(Record): - average_income: int - accuracy_radius: int - latitude: float - longitude: float - metro_code: int - population_density: int - time_zone: Text - -class MaxMind(Record): - queries_remaining: int - -class Postal(Record): - code: Text - confidence: int - -class Subdivision(PlaceRecord): - confidence: int - geoname_id: int - iso_code: Text - names: _Names - -class Subdivisions(Tuple[Subdivision]): - def __new__(cls, locales: _Locales, *subdivisions: Subdivision) -> Subdivisions: ... - def __init__(self, locales: _Locales, *subdivisions: Subdivision) -> None: ... - @property - def most_specific(self) -> Subdivision: ... - -class Traits(Record): - autonomous_system_number: int - autonomous_system_organization: Text - connection_type: Text - domain: Text - ip_address: Text - is_anonymous: bool - is_anonymous_proxy: bool - is_anonymous_vpn: bool - is_hosting_provider: bool - is_legitimate_proxy: bool - is_public_proxy: bool - is_satellite_provider: bool - is_tor_exit_node: bool - isp: Text - organization: Text - user_type: Text - def __init__(self, **kwargs: Any) -> None: ...