-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Stubs for geoip2 third party library #3299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
72913ac
Merge pull request #1 from python/master
jolaf 7cdc4bf
Making vars argument Optional, as it defaults to None in the code and…
29037b9
Merge pull request #2 from python/master
jolaf 3eed451
email.charset.SHORTEST, QP, BASE64 are not in the stub for Python 2
d065fdf
email.mime.application.MIMEApplication expects data to be bytes, whil…
73e625f
Adding #undocumented as requested by @srittau to fix #2830
9b26ce8
Merge branch 'master' of https://github.com/python/typeshed into pyth…
2b67cae
Merge pull request #4 from python/master
jolaf 1ee2bef
Merge pull request #5 from python/master
jolaf 603bf4b
NullTranslations._parse() stub added;
cb8c3e6
Merge pull request #6 from python/master
jolaf 5dc4d4f
Update stdlib/3/gettext.pyi
jolaf 1304aef
Update stdlib/3/gettext.pyi
jolaf a0fbaef
Suggestions from @srittau implemented
1206178
Merge branch 'master' of https://github.com/python/typeshed
1352f9c
Stubs for maxminddb added, approved by the developer, see https://git…
edf4dde
Fixed stubs for maxminddb
e3e3f4e
Fixes stubs for maxminddb
bf03a3f
Fixed stubs for maxminddb
5dfb034
Update third_party/3/maxminddb/extension.pyi
jolaf dfdb48f
Fixed according to suggestions from @srittau
982394c
Merge branch 'master' of github.com:jolaf/typeshed
7caba43
Merge pull request #8 from python/master
jolaf f87389f
Added ConfigParser.BOOLEAN_STATES # Undocumented
203bbc0
Whitespace fixed for flake8
fcd2edc
Added stub for urllib.request.proxy_bypass()
49449e0
Added stub for urllib.request.proxy_bypass()
25b7dd1
Merge branch 'proxy_bypass'
0dda34c
Added stub for asyncore.socket_map, undocumented but useful
8d0732c
Added stub for http.server.BaseHTTPRequestHandler.parse_request(), un…
dd375cc
Merge branch 'socket_map'
3d5666b
Merge branch 'parse_request'
047b17d
Also added stubs for BaseHTTPRequestHandler.weekdayname and monthname
d0df323
_maptype seems to be incorrect as the keys seem to be file descriptor…
236a6b4
Merge branch 'socket_map'
3aaf62b
Merge branch 'parse_request'
27fdd70
Merge pull request #9 from python/master
jolaf 8b82e59
Merge pull request #10 from python/master
jolaf f00701f
Added stubs for geoip2
e4752a6
Fixed according to flake8
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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): ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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]] | ||
|
jolaf marked this conversation as resolved.
|
||
|
|
||
| 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 = ... | ||
|
jolaf marked this conversation as resolved.
|
||
| raw: str = ... | ||
|
jolaf marked this conversation as resolved.
|
||
| def __init__(self, raw: str) -> None: ... | ||
|
|
||
| class ASN(SimpleModel): | ||
| autonomous_system_number: int = ... | ||
|
jolaf marked this conversation as resolved.
|
||
| 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: ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 = ... | ||
|
jolaf marked this conversation as resolved.
|
||
| 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: ... | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.