@@ -80,9 +80,9 @@ class Command(BaseCommand):
80
80
),
81
81
optparse .make_option ('--verify-city-import' , action = 'store_true' ,
82
82
default = False ,
83
- help = 'Verify city import and print out missing cities. For debug purposes only. '
83
+ help = 'Verify city import and print out missing cities.'
84
84
),
85
- )
85
+ )
86
86
87
87
@transaction .commit_on_success
88
88
def handle (self , * args , ** options ):
@@ -101,7 +101,7 @@ def handle(self, *args, **options):
101
101
' Done: ' ,
102
102
progressbar .Percentage (),
103
103
progressbar .Bar (),
104
- ]
104
+ ]
105
105
106
106
for url in SOURCES :
107
107
destination_file_name = url .split ('/' )[- 1 ]
@@ -160,11 +160,12 @@ def handle(self, *args, **options):
160
160
progress .finish ()
161
161
162
162
if url in TRANSLATION_SOURCES and options .get (
163
- 'hack_translations' , False ):
163
+ 'hack_translations' , False ):
164
164
with open (translation_hack_path , 'w+' ) as f :
165
165
pickle .dump (self .translation_data , f )
166
166
167
- if options .get ('verify_city_import' , False ) and url in CITY_SOURCES :
167
+ if (options .get ('verify_city_import' , False ) and
168
+ url in CITY_SOURCES ):
168
169
self .logger .info ('Verifying city import' )
169
170
self .verify_city_import (geonames )
170
171
@@ -290,10 +291,12 @@ def verify_city_import(self, geonames):
290
291
except City .DoesNotExist :
291
292
self .logger .info (items )
292
293
for duplicate_items in geonames .parse ():
293
- if items [0 ] != duplicate_items [0 ] and items [1 ] == duplicate_items [1 ] and items [8 ] == duplicate_items [8 ] and items [10 ] == duplicate_items [10 ]:
294
+ if (items [0 ] != duplicate_items [0 ] and
295
+ items [1 ] == duplicate_items [1 ] and
296
+ items [8 ] == duplicate_items [8 ] and
297
+ items [10 ] == duplicate_items [10 ]):
294
298
self .logger .info (duplicate_items )
295
299
296
-
297
300
def city_import (self , items ):
298
301
try :
299
302
city_items_pre_import .send (sender = self , items = items )
@@ -314,12 +317,12 @@ def city_import(self, items):
314
317
raise
315
318
316
319
try :
317
- region_id = self ._get_region_id (country_code2 , region_geoname_code )
320
+ region_id = self ._get_region_id (country_code2 , region_geoname_code )
318
321
except Region .DoesNotExist :
319
322
if self .noinsert :
320
323
return
321
324
else :
322
- region_id = None
325
+ region_id = None
323
326
324
327
try :
325
328
kwargs = dict (name = force_unicode (name ),
@@ -389,7 +392,7 @@ def translation_parse(self, items):
389
392
Country : {},
390
393
Region : {},
391
394
City : {},
392
- }
395
+ }
393
396
394
397
if len (items ) > 4 :
395
398
# avoid shortnames, colloquial, and historic
0 commit comments