88
99# pylint:disable=too-many-lines,too-many-instance-attributes,too-many-locals
1010from collections .abc import Sequence
11- from typing import Dict , List , Optional
11+ from typing import Optional
1212
1313import geoip2 .models
1414import geoip2 .records
1717
1818class _Serializable (SimpleEquality ):
1919 def to_dict (self ):
20- """Returns a dict of the object suitable for serialization"""
20+ """Returns a dict of the object suitable for serialization. """
2121 result = {}
2222 for key , value in self .__dict__ .items ():
2323 if hasattr (value , "to_dict" ) and callable (value .to_dict ):
@@ -83,7 +83,9 @@ class IPRiskReason(_Serializable):
8383 code : Optional [str ]
8484 reason : Optional [str ]
8585
86- def __init__ (self , code : Optional [str ] = None , reason : Optional [str ] = None ):
86+ def __init__ (
87+ self , code : Optional [str ] = None , reason : Optional [str ] = None
88+ ) -> None :
8789 self .code = code
8890 self .reason = reason
8991
@@ -197,16 +199,16 @@ class IPAddress(geoip2.models.Insights):
197199
198200 location : GeoIP2Location
199201 risk : Optional [float ]
200- risk_reasons : List [IPRiskReason ]
202+ risk_reasons : list [IPRiskReason ]
201203
202204 def __init__ (
203205 self ,
204206 locales : Optional [Sequence [str ]],
205207 * ,
206- country : Optional [Dict ] = None ,
207- location : Optional [Dict ] = None ,
208+ country : Optional [dict ] = None ,
209+ location : Optional [dict ] = None ,
208210 risk : Optional [float ] = None ,
209- risk_reasons : Optional [List [ Dict ]] = None ,
211+ risk_reasons : Optional [list [ dict ]] = None ,
210212 ** kwargs ,
211213 ) -> None :
212214 # For raw attribute
@@ -238,7 +240,7 @@ class ScoreIPAddress(_Serializable):
238240
239241 risk : Optional [float ]
240242
241- def __init__ (self , * , risk : Optional [float ] = None , ** _ ):
243+ def __init__ (self , * , risk : Optional [float ] = None , ** _ ) -> None :
242244 self .risk = risk
243245
244246
@@ -293,7 +295,7 @@ def __init__(
293295 phone_number : Optional [str ] = None ,
294296 matches_provided_phone_number : Optional [bool ] = None ,
295297 ** _ ,
296- ):
298+ ) -> None :
297299 self .name = name
298300 self .matches_provided_name = matches_provided_name
299301 self .phone_number = phone_number
@@ -353,7 +355,7 @@ def __init__(
353355 last_seen : Optional [str ] = None ,
354356 local_time : Optional [str ] = None ,
355357 ** _ ,
356- ):
358+ ) -> None :
357359 self .confidence = confidence
358360 self .id = id
359361 self .last_seen = last_seen
@@ -403,7 +405,7 @@ def __init__(
403405 reason : Optional [str ] = None ,
404406 rule_label : Optional [str ] = None ,
405407 ** _ ,
406- ):
408+ ) -> None :
407409 self .action = action
408410 self .reason = reason
409411 self .rule_label = rule_label
@@ -424,7 +426,7 @@ class EmailDomain(_Serializable):
424426
425427 first_seen : Optional [str ]
426428
427- def __init__ (self , * , first_seen : Optional [str ] = None , ** _ ):
429+ def __init__ (self , * , first_seen : Optional [str ] = None , ** _ ) -> None :
428430 self .first_seen = first_seen
429431
430432
@@ -478,12 +480,12 @@ class Email(_Serializable):
478480
479481 def __init__ (
480482 self ,
481- domain : Optional [Dict ] = None ,
483+ domain : Optional [dict ] = None ,
482484 first_seen : Optional [str ] = None ,
483485 is_disposable : Optional [bool ] = None ,
484486 is_free : Optional [bool ] = None ,
485487 is_high_risk : Optional [bool ] = None ,
486- ):
488+ ) -> None :
487489 self .domain = EmailDomain (** (domain or {}))
488490 self .first_seen = first_seen
489491 self .is_disposable = is_disposable
@@ -565,7 +567,7 @@ class CreditCard(_Serializable):
565567
566568 def __init__ (
567569 self ,
568- issuer : Optional [Dict ] = None ,
570+ issuer : Optional [dict ] = None ,
569571 country : Optional [str ] = None ,
570572 brand : Optional [str ] = None ,
571573 is_business : Optional [bool ] = None ,
@@ -574,7 +576,7 @@ def __init__(
574576 is_virtual : Optional [bool ] = None ,
575577 # pylint:disable=redefined-builtin
576578 type : Optional [str ] = None ,
577- ):
579+ ) -> None :
578580 self .issuer = Issuer (** (issuer or {}))
579581 self .country = country
580582 self .brand = brand
@@ -643,7 +645,7 @@ def __init__(
643645 distance_to_ip_location : Optional [int ] = None ,
644646 is_in_ip_country : Optional [bool ] = None ,
645647 ** _ ,
646- ):
648+ ) -> None :
647649 self .is_postal_in_city = is_postal_in_city
648650 self .latitude = latitude
649651 self .longitude = longitude
@@ -730,7 +732,7 @@ def __init__(
730732 is_high_risk : Optional [bool ] = None ,
731733 distance_to_billing_address : Optional [int ] = None ,
732734 ** _ ,
733- ):
735+ ) -> None :
734736 self .is_postal_in_city = is_postal_in_city
735737 self .latitude = latitude
736738 self .longitude = longitude
@@ -790,7 +792,7 @@ def __init__(
790792 network_operator : Optional [str ] = None ,
791793 number_type : Optional [str ] = None ,
792794 ** _ ,
793- ):
795+ ) -> None :
794796 self .country = country
795797 self .is_voip = is_voip
796798 self .network_operator = network_operator
@@ -838,7 +840,7 @@ def __init__(
838840 warning : Optional [str ] = None ,
839841 input_pointer : Optional [str ] = None ,
840842 ** _ ,
841- ):
843+ ) -> None :
842844 self .code = code
843845 self .warning = warning
844846 self .input_pointer = input_pointer
@@ -1061,7 +1063,7 @@ def __init__(
10611063 shipping_address_distance_to_ip_location : Optional [float ] = None ,
10621064 time_of_day : Optional [float ] = None ,
10631065 ** _ ,
1064- ):
1066+ ) -> None :
10651067 self .avs_result = avs_result
10661068 self .billing_address = billing_address
10671069 self .billing_address_distance_to_ip_location = (
@@ -1180,7 +1182,7 @@ def __init__(
11801182 code : Optional [str ] = None ,
11811183 reason : Optional [str ] = None ,
11821184 ** _ ,
1183- ):
1185+ ) -> None :
11841186 self .code = code
11851187 self .reason = reason
11861188
@@ -1207,15 +1209,15 @@ class RiskScoreReason(_Serializable):
12071209 """
12081210
12091211 multiplier : float
1210- reasons : List [Reason ]
1212+ reasons : list [Reason ]
12111213
12121214 def __init__ (
12131215 self ,
12141216 * ,
12151217 multiplier : float ,
1216- reasons : Optional [List ] = None ,
1218+ reasons : Optional [list ] = None ,
12171219 ** _ ,
1218- ):
1220+ ) -> None :
12191221 self .multiplier = multiplier
12201222 self .reasons = [Reason (** x ) for x in reasons or []]
12211223
@@ -1362,32 +1364,32 @@ class Factors(_Serializable):
13621364 shipping_address : ShippingAddress
13631365 shipping_phone : Phone
13641366 subscores : Subscores
1365- warnings : List [ServiceWarning ]
1366- risk_score_reasons : List [RiskScoreReason ]
1367+ warnings : list [ServiceWarning ]
1368+ risk_score_reasons : list [RiskScoreReason ]
13671369
13681370 def __init__ (
13691371 self ,
13701372 locales : Sequence [str ],
13711373 * ,
1372- billing_address : Optional [Dict ] = None ,
1373- billing_phone : Optional [Dict ] = None ,
1374- credit_card : Optional [Dict ] = None ,
1375- disposition : Optional [Dict ] = None ,
1374+ billing_address : Optional [dict ] = None ,
1375+ billing_phone : Optional [dict ] = None ,
1376+ credit_card : Optional [dict ] = None ,
1377+ disposition : Optional [dict ] = None ,
13761378 funds_remaining : float ,
1377- device : Optional [Dict ] = None ,
1378- email : Optional [Dict ] = None ,
1379+ device : Optional [dict ] = None ,
1380+ email : Optional [dict ] = None ,
13791381 # pylint:disable=redefined-builtin
13801382 id : str ,
1381- ip_address : Optional [Dict ] = None ,
1383+ ip_address : Optional [dict ] = None ,
13821384 queries_remaining : int ,
13831385 risk_score : float ,
1384- shipping_address : Optional [Dict ] = None ,
1385- shipping_phone : Optional [Dict ] = None ,
1386- subscores : Optional [Dict ] = None ,
1387- warnings : Optional [List [ Dict ]] = None ,
1388- risk_score_reasons : Optional [List [ Dict ]] = None ,
1386+ shipping_address : Optional [dict ] = None ,
1387+ shipping_phone : Optional [dict ] = None ,
1388+ subscores : Optional [dict ] = None ,
1389+ warnings : Optional [list [ dict ]] = None ,
1390+ risk_score_reasons : Optional [list [ dict ]] = None ,
13891391 ** _ ,
1390- ):
1392+ ) -> None :
13911393 self .billing_address = BillingAddress (** (billing_address or {}))
13921394 self .billing_phone = Phone (** (billing_phone or {}))
13931395 self .credit_card = CreditCard (** (credit_card or {}))
@@ -1529,29 +1531,29 @@ class Insights(_Serializable):
15291531 risk_score : float
15301532 shipping_address : ShippingAddress
15311533 shipping_phone : Phone
1532- warnings : List [ServiceWarning ]
1534+ warnings : list [ServiceWarning ]
15331535
15341536 def __init__ (
15351537 self ,
15361538 locales : Sequence [str ],
15371539 * ,
1538- billing_address : Optional [Dict ] = None ,
1539- billing_phone : Optional [Dict ] = None ,
1540- credit_card : Optional [Dict ] = None ,
1541- device : Optional [Dict ] = None ,
1542- disposition : Optional [Dict ] = None ,
1543- email : Optional [Dict ] = None ,
1540+ billing_address : Optional [dict ] = None ,
1541+ billing_phone : Optional [dict ] = None ,
1542+ credit_card : Optional [dict ] = None ,
1543+ device : Optional [dict ] = None ,
1544+ disposition : Optional [dict ] = None ,
1545+ email : Optional [dict ] = None ,
15441546 funds_remaining : float ,
15451547 # pylint:disable=redefined-builtin
15461548 id : str ,
1547- ip_address : Optional [Dict ] = None ,
1549+ ip_address : Optional [dict ] = None ,
15481550 queries_remaining : int ,
15491551 risk_score : float ,
1550- shipping_address : Optional [Dict ] = None ,
1551- shipping_phone : Optional [Dict ] = None ,
1552- warnings : Optional [List [ Dict ]] = None ,
1552+ shipping_address : Optional [dict ] = None ,
1553+ shipping_phone : Optional [dict ] = None ,
1554+ warnings : Optional [list [ dict ]] = None ,
15531555 ** _ ,
1554- ):
1556+ ) -> None :
15551557 self .billing_address = BillingAddress (** (billing_address or {}))
15561558 self .billing_phone = Phone (** (billing_phone or {}))
15571559 self .credit_card = CreditCard (** (credit_card or {}))
@@ -1632,21 +1634,21 @@ class Score(_Serializable):
16321634 ip_address : ScoreIPAddress
16331635 queries_remaining : int
16341636 risk_score : float
1635- warnings : List [ServiceWarning ]
1637+ warnings : list [ServiceWarning ]
16361638
16371639 def __init__ (
16381640 self ,
16391641 * ,
1640- disposition : Optional [Dict ] = None ,
1642+ disposition : Optional [dict ] = None ,
16411643 funds_remaining : float ,
16421644 # pylint:disable=redefined-builtin
16431645 id : str ,
1644- ip_address : Optional [Dict ] = None ,
1646+ ip_address : Optional [dict ] = None ,
16451647 queries_remaining : int ,
16461648 risk_score : float ,
1647- warnings : Optional [List [ Dict ]] = None ,
1649+ warnings : Optional [list [ dict ]] = None ,
16481650 ** _ ,
1649- ):
1651+ ) -> None :
16501652 self .disposition = Disposition (** (disposition or {}))
16511653 self .funds_remaining = funds_remaining
16521654 self .id = id
0 commit comments