File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 12
12
13
13
import geoip2 .models
14
14
import geoip2 .records
15
- from geoip2 .mixins import SimpleEquality
16
15
17
16
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
+
19
24
def to_dict (self ) -> dict :
20
25
"""Returns a dict of the object suitable for serialization."""
21
26
result = {}
22
27
for key , value in self .__dict__ .items ():
23
28
if hasattr (value , "to_dict" ) and callable (value .to_dict ):
24
29
if d := value .to_dict ():
25
30
result [key ] = d
26
- elif hasattr (value , "raw" ):
27
- # geoip2 uses "raw" for historical reasons
28
- if d := value .raw :
29
- result [key ] = d
30
31
elif isinstance (value , list ):
31
32
ls = []
32
33
for e in value :
@@ -221,7 +222,7 @@ def __init__(
221
222
if risk_reasons is not None :
222
223
kwargs ["risk_reasons" ] = risk_reasons
223
224
224
- super ().__init__ (kwargs , locales = list ( locales or []) )
225
+ super ().__init__ (locales , ** kwargs )
225
226
self .location = GeoIP2Location (** (location or {}))
226
227
self .risk = risk
227
228
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 = [
8
8
dependencies = [
9
9
" aiohttp>=3.6.2,<4.0.0" ,
10
10
" email_validator>=2.0.0,<3.0.0" ,
11
- " geoip2>=4.8.0,<5 .0.0" ,
11
+ " geoip2>=5.0.1,<6 .0.0" ,
12
12
" requests>=2.24.0,<3.0.0" ,
13
13
" voluptuous" ,
14
14
]
You can’t perform that action at this time.
0 commit comments