1111
1212
1313class Record (SimpleEquality ):
14-
1514 """All records are subclasses of the abstract class ``Record``"""
1615 __metaclass__ = ABCMeta
1716
18- _valid_attributes = None
17+ _valid_attributes = set ()
1918
2019 def __init__ (self , ** kwargs ):
2120 valid_args = dict ((k , kwargs .get (k )) for k in self ._valid_attributes )
@@ -33,7 +32,6 @@ def __repr__(self):
3332
3433
3534class PlaceRecord (Record ):
36-
3735 """All records with :py:attr:`names` subclass :py:class:`PlaceRecord`"""
3836 __metaclass__ = ABCMeta
3937
@@ -49,12 +47,12 @@ def __init__(self, locales=None, **kwargs):
4947 def name (self ):
5048 """Dict with locale codes as keys and localized name as value"""
5149 # pylint:disable=E1101
52- return next ((self .names .get (x ) for x in self ._locales if x in
53- self .names ), None )
50+ return next (
51+ (self .names .get (x ) for x in self ._locales
52+ if x in self .names ), None )
5453
5554
5655class City (PlaceRecord ):
57-
5856 """Contains data for the city record associated with an IP address
5957
6058 This class contains the city-level data associated with an IP address.
@@ -96,7 +94,6 @@ class City(PlaceRecord):
9694
9795
9896class Continent (PlaceRecord ):
99-
10097 """Contains data for the continent record associated with an IP address
10198
10299 This class contains the continent-level data associated with an IP
@@ -137,7 +134,6 @@ class Continent(PlaceRecord):
137134
138135
139136class Country (PlaceRecord ):
140-
141137 """Contains data for the country record associated with an IP address
142138
143139 This class contains the country-level data associated with an IP address.
@@ -186,7 +182,6 @@ class Country(PlaceRecord):
186182
187183
188184class RepresentedCountry (Country ):
189-
190185 """Contains data for the represented country associated with an IP address
191186
192187 This class contains the country-level data associated with an IP address
@@ -241,12 +236,11 @@ class RepresentedCountry(Country):
241236 :type: unicode
242237
243238 """
244- _valid_attributes = set (['confidence' , 'geoname_id' , 'iso_code' ,
245- 'names' , ' type' ])
239+ _valid_attributes = set (['confidence' , 'geoname_id' , 'iso_code' , 'names' ,
240+ 'type' ])
246241
247242
248243class Location (Record ):
249-
250244 """Contains data for the location record associated with an IP address
251245
252246 This class contains the location data associated with an IP address.
@@ -314,7 +308,6 @@ class Location(Record):
314308
315309
316310class MaxMind (Record ):
317-
318311 """Contains data related to your MaxMind account
319312
320313 Attributes:
@@ -331,7 +324,6 @@ class MaxMind(Record):
331324
332325
333326class Postal (Record ):
334-
335327 """Contains data for the postal record associated with an IP address
336328
337329 This class contains the postal data associated with an IP address.
@@ -361,7 +353,6 @@ class Postal(Record):
361353
362354
363355class Subdivision (PlaceRecord ):
364-
365356 """Contains data for the subdivisions associated with an IP address
366357
367358 This class contains the subdivision data associated with an IP address.
@@ -411,7 +402,6 @@ class Subdivision(PlaceRecord):
411402
412403
413404class Subdivisions (tuple ):
414-
415405 """A tuple-like collection of subdivisions associated with an IP address
416406
417407 This class contains the subdivisions of the country associated with the
@@ -422,6 +412,7 @@ class Subdivisions(tuple):
422412
423413 This attribute is returned by ``city`` and ``insights``.
424414 """
415+
425416 def __new__ (cls , locales , * subdivisions ):
426417 subdivisions = [Subdivision (locales , ** x ) for x in subdivisions ]
427418 obj = super (cls , Subdivisions ).__new__ (cls , subdivisions )
@@ -447,7 +438,6 @@ def most_specific(self):
447438
448439
449440class Traits (Record ):
450-
451441 """ Contains data for the traits record associated with an IP address
452442
453443 This class contains the traits data associated with an IP address.
@@ -558,15 +548,10 @@ class Traits(Record):
558548 :type: unicode
559549
560550"""
561- _valid_attributes = set (['autonomous_system_number' ,
562- 'autonomous_system_organization' ,
563- 'domain' ,
564- 'is_anonymous_proxy' ,
565- 'is_satellite_provider' ,
566- 'isp' ,
567- 'ip_address' ,
568- 'organization' ,
569- 'user_type' ])
551+ _valid_attributes = set (
552+ ['autonomous_system_number' , 'autonomous_system_organization' ,
553+ 'domain' , 'is_anonymous_proxy' , 'is_satellite_provider' , 'isp' ,
554+ 'ip_address' , 'organization' , 'user_type' ])
570555
571556 def __init__ (self , ** kwargs ):
572557 for k in ['is_anonymous_proxy' , 'is_satellite_provider' ]:
0 commit comments