Skip to content

Commit 68f1f6b

Browse files
committed
Unzip only if necessary
1 parent 5d6e349 commit 68f1f6b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cities_light/geonames.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ def __init__(self, url, force=False):
2828
destination_file_name = destination_file_name.replace(
2929
'zip', 'txt')
3030

31-
if self.downloaded and destination_file_name.split('.')[-1] == 'zip':
31+
destination = os.path.join(DATA_DIR, destination_file_name)
32+
exists = os.path.exists(destination)
33+
34+
if url.split('.')[-1] == 'zip' and not exists:
3235
self.extract(self.file_path, destination_file_name)
3336

3437
self.file_path = os.path.join(

0 commit comments

Comments
 (0)