44=======
55
66"""
7+
78# pylint:disable=R0903
89from abc import ABCMeta
910
1011from geoip2 .mixins import SimpleEquality
1112
1213
1314class Record (SimpleEquality ):
14- """All records are subclasses of the abstract class ``Record``"""
15+ """All records are subclasses of the abstract class ``Record``."""
16+
1517 __metaclass__ = ABCMeta
1618
1719 _valid_attributes = set ()
@@ -32,7 +34,8 @@ def __repr__(self):
3234
3335
3436class PlaceRecord (Record ):
35- """All records with :py:attr:`names` subclass :py:class:`PlaceRecord`"""
37+ """All records with :py:attr:`names` subclass :py:class:`PlaceRecord`."""
38+
3639 __metaclass__ = ABCMeta
3740
3841 def __init__ (self , locales = None , ** kwargs ):
@@ -45,15 +48,15 @@ def __init__(self, locales=None, **kwargs):
4548
4649 @property
4750 def name (self ):
48- """Dict with locale codes as keys and localized name as value"""
51+ """Dict with locale codes as keys and localized name as value. """
4952 # pylint:disable=E1101
5053 return next (
5154 (self .names .get (x ) for x in self ._locales
5255 if x in self .names ), None )
5356
5457
5558class City (PlaceRecord ):
56- """Contains data for the city record associated with an IP address
59+ """Contains data for the city record associated with an IP address.
5760
5861 This class contains the city-level data associated with an IP address.
5962
@@ -90,11 +93,12 @@ class City(PlaceRecord):
9093 :type: dict
9194
9295 """
96+
9397 _valid_attributes = set (['confidence' , 'geoname_id' , 'names' ])
9498
9599
96100class Continent (PlaceRecord ):
97- """Contains data for the continent record associated with an IP address
101+ """Contains data for the continent record associated with an IP address.
98102
99103 This class contains the continent-level data associated with an IP
100104 address.
@@ -130,11 +134,12 @@ class Continent(PlaceRecord):
130134 :type: dict
131135
132136 """
137+
133138 _valid_attributes = set (['code' , 'geoname_id' , 'names' ])
134139
135140
136141class Country (PlaceRecord ):
137- """Contains data for the country record associated with an IP address
142+ """Contains data for the country record associated with an IP address.
138143
139144 This class contains the country-level data associated with an IP address.
140145
@@ -178,11 +183,12 @@ class Country(PlaceRecord):
178183 :type: dict
179184
180185 """
186+
181187 _valid_attributes = set (['confidence' , 'geoname_id' , 'iso_code' , 'names' ])
182188
183189
184190class RepresentedCountry (Country ):
185- """Contains data for the represented country associated with an IP address
191+ """Contains data for the represented country associated with an IP address.
186192
187193 This class contains the country-level data associated with an IP address
188194 for the IP's represented country. The represented country is the country
@@ -236,12 +242,13 @@ class RepresentedCountry(Country):
236242 :type: unicode
237243
238244 """
245+
239246 _valid_attributes = set (['confidence' , 'geoname_id' , 'iso_code' , 'names' ,
240247 'type' ])
241248
242249
243250class Location (Record ):
244- """Contains data for the location record associated with an IP address
251+ """Contains data for the location record associated with an IP address.
245252
246253 This class contains the location data associated with an IP address.
247254
@@ -304,13 +311,14 @@ class Location(Record):
304311 :type: unicode
305312
306313 """
314+
307315 _valid_attributes = set (['average_income' , 'accuracy_radius' , 'latitude' ,
308316 'longitude' , 'metro_code' , 'population_density' ,
309317 'postal_code' , 'postal_confidence' , 'time_zone' ])
310318
311319
312320class MaxMind (Record ):
313- """Contains data related to your MaxMind account
321+ """Contains data related to your MaxMind account.
314322
315323 Attributes:
316324
@@ -322,11 +330,12 @@ class MaxMind(Record):
322330 :type: int
323331
324332 """
333+
325334 _valid_attributes = set (['queries_remaining' ])
326335
327336
328337class Postal (Record ):
329- """Contains data for the postal record associated with an IP address
338+ """Contains data for the postal record associated with an IP address.
330339
331340 This class contains the postal data associated with an IP address.
332341
@@ -352,11 +361,12 @@ class Postal(Record):
352361 :type: int
353362
354363 """
364+
355365 _valid_attributes = set (['code' , 'confidence' ])
356366
357367
358368class Subdivision (PlaceRecord ):
359- """Contains data for the subdivisions associated with an IP address
369+ """Contains data for the subdivisions associated with an IP address.
360370
361371 This class contains the subdivision data associated with an IP address.
362372
@@ -402,11 +412,12 @@ class Subdivision(PlaceRecord):
402412 :type: dict
403413
404414 """
415+
405416 _valid_attributes = set (['confidence' , 'geoname_id' , 'iso_code' , 'names' ])
406417
407418
408419class Subdivisions (tuple ):
409- """A tuple-like collection of subdivisions associated with an IP address
420+ """A tuple-like collection of subdivisions associated with an IP address.
410421
411422 This class contains the subdivisions of the country associated with the
412423 IP address from largest to smallest.
@@ -430,10 +441,10 @@ def __init__(self, locales, *subdivisions): # pylint:disable=W0613
430441 def most_specific (self ):
431442 """The most specific (smallest) subdivision available.
432443
433- If there are no :py:class:`Subdivision` objects for the response,
434- this returns an empty :py:class:`Subdivision`.
444+ If there are no :py:class:`Subdivision` objects for the response,
445+ this returns an empty :py:class:`Subdivision`.
435446
436- :type: :py:class:`Subdivision`
447+ :type: :py:class:`Subdivision`
437448 """
438449 try :
439450 return self [- 1 ]
@@ -442,7 +453,7 @@ def most_specific(self):
442453
443454
444455class Traits (Record ):
445- """ Contains data for the traits record associated with an IP address
456+ """Contains data for the traits record associated with an IP address.
446457
447458 This class contains the traits data associated with an IP address.
448459
@@ -534,7 +545,8 @@ class Traits(Record):
534545 .. deprecated:: 2.2.0
535546 Due to the increased coverage by mobile carriers, very few
536547 satellite providers now serve multiple countries. As a result, the
537- output does not provide sufficiently relevant data for us to maintain it.
548+ output does not provide sufficiently relevant data for us to maintain
549+ it.
538550
539551 .. attribute:: isp
540552
@@ -578,7 +590,8 @@ class Traits(Record):
578590
579591 :type: unicode
580592
581- """
593+ """
594+
582595 _valid_attributes = set (
583596 ['autonomous_system_number' , 'autonomous_system_organization' ,
584597 'connection_type' , 'domain' , 'is_anonymous_proxy' ,
0 commit comments