33from __future__import annotations
44
55import json
6- from typing import TYPE_CHECKING
6+ from typing import TYPE_CHECKING , Any
77
88import geoip2 .models
99import geoip2 .records
@@ -23,7 +23,7 @@ def __hash__(self) -> int:
2323# This is not particularly efficient, but I don't expect it to be used much.
2424return hash (json .dumps (self .to_dict (),sort_keys = True ))
2525
26- def to_dict (self )-> dict :# noqa: C901
26+ def to_dict (self )-> dict [ str , Any ] :# noqa: C901
2727"""Return a dict of the object suitable for serialization."""
2828result = {}
2929for key ,value in self .__dict__ .items ():
@@ -100,7 +100,7 @@ class GeoIP2Location(geoip2.records.Location):
100100 `RFC 3339 <https://tools.ietf.org/html/rfc3339>`_. For instance, the
101101 local time in Boston might be returned as 2015-04-27T19:17:24-04:00."""
102102
103- def __init__ (self ,* args ,** kwargs )-> None :# noqa: ANN002
103+ def __init__ (self ,* args : Any ,** kwargs : Any )-> None :
104104"""Initialize a GeoIP2Location instance."""
105105self .local_time = kwargs .get ("local_time" )
106106super ().__init__ (* args ,** kwargs )
@@ -131,11 +131,11 @@ def __init__(
131131self ,
132132locales :Sequence [str ]| None ,
133133* ,
134- country :dict | None = None ,
135- location :dict | None = None ,
134+ country :dict [ str , Any ] | None = None ,
135+ location :dict [ str , Any ] | None = None ,
136136risk :float | None = None ,
137- risk_reasons :list [dict ]| None = None ,
138- ** kwargs ,
137+ risk_reasons :list [dict [ str , Any ] ]| None = None ,
138+ ** kwargs : Any ,
139139 )-> None :
140140"""Initialize an IPAddress instance."""
141141# For raw attribute
@@ -161,7 +161,7 @@ class ScoreIPAddress(_Serializable):
161161"""This field contains the risk associated with the IP address. The value
162162 ranges from 0.01 to 99. A higher score indicates a higher risk."""
163163
164- def __init__ (self ,* ,risk :float | None = None ,** _ )-> None :
164+ def __init__ (self ,* ,risk :float | None = None ,** _ : Any )-> None :
165165"""Initialize a ScoreIPAddress instance."""
166166self .risk = risk
167167
@@ -197,7 +197,7 @@ def __init__(
197197matches_provided_name :bool | None = None ,
198198phone_number :str | None = None ,
199199matches_provided_phone_number :bool | None = None ,
200- ** _ ,
200+ ** _ : Any ,
201201 )-> None :
202202"""Initialize an Issuer instance."""
203203self .name = name
@@ -239,7 +239,7 @@ def __init__(
239239id :str | None = None ,
240240last_seen :str | None = None ,
241241local_time :str | None = None ,
242- ** _ ,
242+ ** _ : Any ,
243243 )-> None :
244244"""Initialize a Device instance."""
245245self .confidence = confidence
@@ -277,7 +277,7 @@ def __init__(
277277action :str | None = None ,
278278reason :str | None = None ,
279279rule_label :str | None = None ,
280- ** _ ,
280+ ** _ : Any ,
281281 )-> None :
282282"""Initialize a Disposition instance."""
283283self .action = action
@@ -293,7 +293,7 @@ class EmailDomain(_Serializable):
293293 was first seen by MaxMind. This is expressed using the ISO 8601 date
294294 format."""
295295
296- def __init__ (self ,* ,first_seen :str | None = None ,** _ )-> None :
296+ def __init__ (self ,* ,first_seen :str | None = None ,** _ : Any )-> None :
297297"""Initialize an EmailDomain instance."""
298298self .first_seen = first_seen
299299
@@ -325,7 +325,7 @@ class Email(_Serializable):
325325
326326def __init__ (
327327self ,
328- domain :dict | None = None ,
328+ domain :dict [ str , Any ] | None = None ,
329329first_seen :str | None = None ,
330330is_disposable :bool | None = None ,# noqa: FBT001
331331is_free :bool | None = None ,# noqa: FBT001
@@ -378,7 +378,7 @@ class CreditCard(_Serializable):
378378
379379def __init__ (
380380self ,
381- issuer :dict | None = None ,
381+ issuer :dict [ str , Any ] | None = None ,
382382country :str | None = None ,
383383brand :str | None = None ,
384384is_business :bool | None = None ,# noqa: FBT001
@@ -432,7 +432,7 @@ def __init__(
432432longitude :float | None = None ,
433433distance_to_ip_location :int | None = None ,
434434is_in_ip_country :bool | None = None ,
435- ** _ ,
435+ ** _ : Any ,
436436 )-> None :
437437"""Initialize a BillingAddress instance."""
438438self .is_postal_in_city = is_postal_in_city
@@ -487,7 +487,7 @@ def __init__(
487487is_in_ip_country :bool | None = None ,
488488is_high_risk :bool | None = None ,
489489distance_to_billing_address :int | None = None ,
490- ** _ ,
490+ ** _ : Any ,
491491 )-> None :
492492"""Initialize a ShippingAddress instance."""
493493self .is_postal_in_city = is_postal_in_city
@@ -538,7 +538,7 @@ def __init__(
538538matches_postal :bool | None = None ,
539539network_operator :str | None = None ,
540540number_type :str | None = None ,
541- ** _ ,
541+ ** _ : Any ,
542542 )-> None :
543543"""Initialize a Phone instance."""
544544self .country = country
@@ -573,7 +573,7 @@ def __init__(
573573code :str | None = None ,
574574warning :str | None = None ,
575575input_pointer :str | None = None ,
576- ** _ ,
576+ ** _ : Any ,
577577 )-> None :
578578"""Initialize a ServiceWarning instance."""
579579self .code = code
@@ -717,7 +717,7 @@ def __init__(
717717shipping_address :float | None = None ,
718718shipping_address_distance_to_ip_location :float | None = None ,
719719time_of_day :float | None = None ,
720- ** _ ,
720+ ** _ : Any ,
721721 )-> None :
722722"""Initialize a Subscores instance."""
723723self .avs_result = avs_result
@@ -831,7 +831,7 @@ def __init__(
831831* ,
832832code :str | None = None ,
833833reason :str | None = None ,
834- ** _ ,
834+ ** _ : Any ,
835835 )-> None :
836836"""Initialize a Reason instance."""
837837self .code = code
@@ -855,8 +855,8 @@ def __init__(
855855self ,
856856* ,
857857multiplier :float ,
858- reasons :list | None = None ,
859- ** _ ,
858+ reasons :list [ dict [ str , Any ]] | None = None ,
859+ ** _ : Any ,
860860 )-> None :
861861"""Initialize a RiskScoreReason instance."""
862862self .multiplier = multiplier
@@ -948,23 +948,23 @@ def __init__(
948948self ,
949949locales :Sequence [str ],
950950* ,
951- billing_address :dict | None = None ,
952- billing_phone :dict | None = None ,
953- credit_card :dict | None = None ,
954- disposition :dict | None = None ,
951+ billing_address :dict [ str , Any ] | None = None ,
952+ billing_phone :dict [ str , Any ] | None = None ,
953+ credit_card :dict [ str , Any ] | None = None ,
954+ disposition :dict [ str , Any ] | None = None ,
955955funds_remaining :float ,
956- device :dict | None = None ,
957- email :dict | None = None ,
956+ device :dict [ str , Any ] | None = None ,
957+ email :dict [ str , Any ] | None = None ,
958958id :str ,
959- ip_address :dict | None = None ,
959+ ip_address :dict [ str , Any ] | None = None ,
960960queries_remaining :int ,
961961risk_score :float ,
962- shipping_address :dict | None = None ,
963- shipping_phone :dict | None = None ,
964- subscores :dict | None = None ,
965- warnings :list [dict ]| None = None ,
966- risk_score_reasons :list [dict ]| None = None ,
967- ** _ ,
962+ shipping_address :dict [ str , Any ] | None = None ,
963+ shipping_phone :dict [ str , Any ] | None = None ,
964+ subscores :dict [ str , Any ] | None = None ,
965+ warnings :list [dict [ str , Any ] ]| None = None ,
966+ risk_score_reasons :list [dict [ str , Any ] ]| None = None ,
967+ ** _ : Any ,
968968 )-> None :
969969"""Initialize a Factors instance."""
970970self .billing_address = BillingAddress (** (billing_address or {}))
@@ -1056,21 +1056,21 @@ def __init__(
10561056self ,
10571057locales :Sequence [str ],
10581058* ,
1059- billing_address :dict | None = None ,
1060- billing_phone :dict | None = None ,
1061- credit_card :dict | None = None ,
1062- device :dict | None = None ,
1063- disposition :dict | None = None ,
1064- email :dict | None = None ,
1059+ billing_address :dict [ str , Any ] | None = None ,
1060+ billing_phone :dict [ str , Any ] | None = None ,
1061+ credit_card :dict [ str , Any ] | None = None ,
1062+ device :dict [ str , Any ] | None = None ,
1063+ disposition :dict [ str , Any ] | None = None ,
1064+ email :dict [ str , Any ] | None = None ,
10651065funds_remaining :float ,
10661066id :str ,
1067- ip_address :dict | None = None ,
1067+ ip_address :dict [ str , Any ] | None = None ,
10681068queries_remaining :int ,
10691069risk_score :float ,
1070- shipping_address :dict | None = None ,
1071- shipping_phone :dict | None = None ,
1072- warnings :list [dict ]| None = None ,
1073- ** _ ,
1070+ shipping_address :dict [ str , Any ] | None = None ,
1071+ shipping_phone :dict [ str , Any ] | None = None ,
1072+ warnings :list [dict [ str , Any ] ]| None = None ,
1073+ ** _ : Any ,
10741074 )-> None :
10751075"""Initialize an Insights instance."""
10761076self .billing_address = BillingAddress (** (billing_address or {}))
@@ -1128,14 +1128,14 @@ class Score(_Serializable):
11281128def __init__ (
11291129self ,
11301130* ,
1131- disposition :dict | None = None ,
1131+ disposition :dict [ str , Any ] | None = None ,
11321132funds_remaining :float ,
11331133id :str ,
1134- ip_address :dict | None = None ,
1134+ ip_address :dict [ str , Any ] | None = None ,
11351135queries_remaining :int ,
11361136risk_score :float ,
1137- warnings :list [dict ]| None = None ,
1138- ** _ ,
1137+ warnings :list [dict [ str , Any ] ]| None = None ,
1138+ ** _ : Any ,
11391139 )-> None :
11401140"""Initialize a Score instance."""
11411141self .disposition = Disposition (** (disposition or {}))