Skip to content

Commit f72fe10

Browse files
committed
Minor cleanup
1 parent 0c009a5 commit f72fe10

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

docker/geofabrik.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ def set_date_from_metadata(pbf_file: str):
107107
os.environ['PBF_TIMESTAMP'] = meta_timestamp
108108

109109

110-
def pbf_download_needed(pbf_file_with_date: str, md5_file_with_date: str,
111-
pgosm_date: str) -> bool:
110+
def pbf_download_needed(pbf_file_with_date: str,
111+
md5_file_with_date: str,
112+
pgosm_date: str
113+
) -> bool:
112114
"""Decides if the PBF/MD5 files need to be downloaded.
113115
114116
Parameters
@@ -123,6 +125,8 @@ def pbf_download_needed(pbf_file_with_date: str, md5_file_with_date: str,
123125
"""
124126
logger = logging.getLogger('pgosm-flex')
125127
# If the PBF file exists, check for the MD5 file too.
128+
logger.debug(f'Checking for PBF File: {pbf_file_with_date}')
129+
126130
if os.path.exists(pbf_file_with_date):
127131
logger.info(f'PBF File exists {pbf_file_with_date}')
128132

docker/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def okay_to_run(self, prior_import: dict) -> bool:
310310
"""
311311
self.logger.debug(f'Checking if it is okay to run...')
312312
if self.force:
313-
self.logger.warn(f'Using --force, kiss existing data goodbye')
313+
self.logger.warning(f'Using --force, kiss existing data goodbye')
314314
return True
315315

316316
# If no prior imports, do not require force

docker/tests/test_geofabrik.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
REGION_US = 'north-america/us'
77
SUBREGION_DC = 'district-of-columbia'
88
LAYERSET = 'default'
9-
PGOSM_DATE = '2021-12-02'
9+
PGOSM_DATE = '2021-01-13'
10+
11+
PBF_FILE_WITH_DATE = f'/app/tests/data/district-of-columbia-{PGOSM_DATE}.osm.pbf'
12+
MD5_FILE_WITH_DATE = f'/app/tests/data/district-of-columbia-{PGOSM_DATE}.osm.pbf.md5'
1013

1114

1215
class GeofabrikTests(unittest.TestCase):
@@ -34,7 +37,7 @@ def test_get_region_filename_returns_subregion_when_exists(self):
3437
def test_get_region_filename_returns_region_when_subregion_None(self):
3538
# Override Subregion to None
3639
helpers.unset_env_vars()
37-
helpers.set_env_vars(region='north-america/us',
40+
helpers.set_env_vars(region=REGION_US,
3841
subregion=None,
3942
srid=3857,
4043
language=None,
@@ -64,7 +67,6 @@ def test_get_pbf_url_returns_proper_with_region_and_subregion(self):
6467

6568
def test_pbf_download_needed_returns_boolean(self):
6669
pgosm_date = geofabrik.helpers.get_today()
67-
region_filename = geofabrik.get_region_filename()
6870
expected = bool
6971
result = geofabrik.pbf_download_needed(pbf_file_with_date='does-not-matter',
7072
md5_file_with_date='not-a-file',
@@ -73,11 +75,9 @@ def test_pbf_download_needed_returns_boolean(self):
7375

7476
def test_pbf_download_needed_returns_true_when_file_not_exists(self):
7577
pgosm_date = geofabrik.helpers.get_today()
76-
region_filename = geofabrik.get_region_filename()
7778
expected = True
7879
result = geofabrik.pbf_download_needed(pbf_file_with_date='does-not-matter',
7980
md5_file_with_date='not-a-file',
8081
pgosm_date=pgosm_date)
8182
self.assertEqual(expected, result)
8283

83-

0 commit comments

Comments
 (0)