diff --git a/third_party/3/geoip2/__init__.pyi b/third_party/3/geoip2/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/third_party/3/geoip2/database.pyi b/third_party/3/geoip2/database.pyi new file mode 100644 index 000000000000..29071d53a928 --- /dev/null +++ b/third_party/3/geoip2/database.pyi @@ -0,0 +1,24 @@ +# Stubs for geoip2.database (Python 3) + +from types import TracebackType +from typing import Optional, Sequence, Type + +from maxminddb.reader import Metadata +from geoip2.models import AnonymousIP, ASN, City, ConnectionType, Country, Domain, Enterprise, ISP + +_Locales = Optional[Sequence[str]] + +class Reader: + def __init__(self, filename: str, locales: _Locales = ..., mode: int = ...) -> None: ... + def __enter__(self) -> Reader: ... + def __exit__(self, exc_type: Optional[Type[BaseException]] = ..., exc_val: Optional[BaseException] = ..., exc_tb: Optional[TracebackType] = ...) -> None: ... + def country(self, ip_address: str) -> Country: ... + def city(self, ip_address: str) -> City: ... + def anonymous_ip(self, ip_address: str) -> AnonymousIP: ... + def asn(self, ip_address: str) -> ASN: ... + def connection_type(self, ip_address: str) -> ConnectionType: ... + def domain(self, ip_address: str) -> Domain: ... + def enterprise(self, ip_address: str) -> Enterprise: ... + def isp(self, ip_address: str) -> ISP: ... + def metadata(self) -> Metadata: ... + def close(self) -> None: ... diff --git a/third_party/3/geoip2/errors.pyi b/third_party/3/geoip2/errors.pyi new file mode 100644 index 000000000000..29fcde014f08 --- /dev/null +++ b/third_party/3/geoip2/errors.pyi @@ -0,0 +1,20 @@ +# Stubs for geoip2.errors (Python 3) + +from typing import Optional + +class GeoIP2Error(RuntimeError): ... + +class AddressNotFoundError(GeoIP2Error): ... + +class AuthenticationError(GeoIP2Error): ... + +class HTTPError(GeoIP2Error): + http_status: int = ... + uri: str = ... + def __init__(self, message: str, http_status: Optional[int] = ..., uri: Optional[str] = ...) -> None: ... + +class InvalidRequestError(GeoIP2Error): ... + +class OutOfQueriesError(GeoIP2Error): ... + +class PermissionRequiredError(GeoIP2Error): ... diff --git a/third_party/3/geoip2/mixins.pyi b/third_party/3/geoip2/mixins.pyi new file mode 100644 index 000000000000..fb34a6adf4bb --- /dev/null +++ b/third_party/3/geoip2/mixins.pyi @@ -0,0 +1,8 @@ +# Stubs for geoip2.mixins (Python 3) + +from typing import Any + +class SimpleEquality: + __metaclass__: Any = ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... diff --git a/third_party/3/geoip2/models.pyi b/third_party/3/geoip2/models.pyi new file mode 100644 index 000000000000..a29030d375a8 --- /dev/null +++ b/third_party/3/geoip2/models.pyi @@ -0,0 +1,68 @@ +# Stubs for geoip2.models (Python 3) + +from typing import Any, Mapping, Optional, Sequence + +from geoip2 import records + +from geoip2.mixins import SimpleEquality + +_Locales = Optional[Sequence[str]] +_RawResonse = Mapping[str, Mapping[str, 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: Any = ... + def __init__(self, raw_response: _RawResonse, locales: _Locales = ...) -> None: ... + +class City(Country): + city: records.City = ... + location: records.Location = ... + postal: records.Postal = ... + subdivisions: records.Subdivisions = ... + def __init__(self, raw_response: _RawResonse, locales: _Locales = ...) -> None: ... + +class Insights(City): ... + +class Enterprise(City): ... + +class SimpleModel(SimpleEquality): + __metaclass__: Any = ... + +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: str = ... + raw: str = ... + def __init__(self, raw: str) -> None: ... + +class ASN(SimpleModel): + autonomous_system_number: int = ... + autonomous_system_organization: str = ... + ip_address: str = ... + raw: str = ... + def __init__(self, raw: str) -> None: ... + +class ConnectionType(SimpleModel): + connection_type: str = ... + ip_address: str = ... + raw: str = ... + def __init__(self, raw: str) -> None: ... + +class Domain(SimpleModel): + domain: str = ... + ip_address: str = ... + raw: str = ... + def __init__(self, raw: str) -> None: ... + +class ISP(ASN): + isp: str = ... + organization: str = ... + def __init__(self, raw: str) -> None: ... diff --git a/third_party/3/geoip2/records.pyi b/third_party/3/geoip2/records.pyi new file mode 100644 index 000000000000..893842a96904 --- /dev/null +++ b/third_party/3/geoip2/records.pyi @@ -0,0 +1,87 @@ +# Stubs for geoip2.records (Python 3) + +from typing import Any, Mapping, Optional, Sequence, Tuple + +from geoip2.mixins import SimpleEquality + +_Locales = Optional[Sequence[str]] +_Names = Mapping[str, str] + +class Record(SimpleEquality): + __metaclass__: Any = ... + def __init__(self, **kwargs: Any) -> None: ... + def __setattr__(self, name: str, value: Any) -> None: ... + +class PlaceRecord(Record): + __metaclass__: Any = ... + def __init__(self, locales: _Locales = ..., **kwargs: Any) -> None: ... + @property + def name(self) -> str: ... + +class City(PlaceRecord): + confidence: int = ... + geoname_id: int = ... + names: _Names = ... + +class Continent(PlaceRecord): + code: str = ... + geoname_id: int = ... + names: _Names = ... + +class Country(PlaceRecord): + confidence: int = ... + geoname_id: int = ... + is_in_european_union: bool = ... + iso_code: str = ... + names: _Names = ... + def __init__(self, locales: _Locales = ..., **kwargs: Any) -> None: ... + +class RepresentedCountry(Country): + type: str = ... + +class Location(Record): + average_income: int = ... + accuracy_radius: int = ... + latitude: float = ... + longitude: float = ... + metro_code: int = ... + population_density: int = ... + time_zone: str = ... + +class MaxMind(Record): + queries_remaining: int = ... + +class Postal(Record): + code: str = ... + confidence: int = ... + +class Subdivision(PlaceRecord): + confidence: int = ... + geoname_id: int = ... + iso_code: str = ... + 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: int = ... + connection_type: str = ... + domain: str = ... + ip_address: str = ... + 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: str = ... + organization: str = ... + user_type: str = ... + def __init__(self, **kwargs: Any) -> None: ...