File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1212
1313import geoip2 .models
1414import geoip2 .records
15- from geoip2 .mixins import SimpleEquality
1615
1716
18- class _Serializable (SimpleEquality ):
17+ class _Serializable :
18+ def __eq__ (self , other : object ) -> bool :
19+ return isinstance (other , self .__class__ ) and self .to_dict () == other .to_dict ()
20+
21+ def __ne__ (self , other : object ) -> bool :
22+ return not self .__eq__ (other )
23+
1924 def to_dict (self ) -> dict :
2025 """Returns a dict of the object suitable for serialization."""
2126 result = {}
2227 for key , value in self .__dict__ .items ():
2328 if hasattr (value , "to_dict" ) and callable (value .to_dict ):
2429 if d := value .to_dict ():
2530 result [key ] = d
26- elif hasattr (value , "raw" ):
27- # geoip2 uses "raw" for historical reasons
28- if d := value .raw :
29- result [key ] = d
3031 elif isinstance (value , list ):
3132 ls = []
3233 for e in value :
@@ -221,7 +222,7 @@ def __init__(
221222 if risk_reasons is not None :
222223 kwargs ["risk_reasons" ] = risk_reasons
223224
224- super ().__init__ (kwargs , locales = list ( locales or []) )
225+ super ().__init__ (locales , ** kwargs )
225226 self .location = GeoIP2Location (** (location or {}))
226227 self .risk = risk
227228 self .risk_reasons = [IPRiskReason (** x ) for x in risk_reasons or []]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ authors = [
88dependencies = [
99 " aiohttp>=3.6.2,<4.0.0" ,
1010 " email_validator>=2.0.0,<3.0.0" ,
11- " geoip2>=4.8.0,<5 .0.0" ,
11+ " geoip2>=5.0.1,<6 .0.0" ,
1212 " requests>=2.24.0,<3.0.0" ,
1313 " voluptuous" ,
1414]
You can’t perform that action at this time.
0 commit comments