From f54a077d066b74a1cb11029ffab92c64671a20c2 Mon Sep 17 00:00:00 2001 From: pat <8444617+pnoll1@users.noreply.github.com> Date: Sat, 23 Apr 2022 14:35:02 -0700 Subject: [PATCH] treat oa_quality_check as function --- osmand_osm/osm/processing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osmand_osm/osm/processing.py b/osmand_osm/osm/processing.py index 028ef42..b31ee9b 100755 --- a/osmand_osm/osm/processing.py +++ b/osmand_osm/osm/processing.py @@ -110,6 +110,7 @@ def oa_quality_check(source): # handle files with hashes only try: id_end = json.loads(stats.stdout)['data']['minid']['nodes'] + return id_end except Exception as e: logging.info('Error finding id_end in {0}. File is likely hashes only'.format(source.table)) raise @@ -125,7 +126,7 @@ def oa_quality_check(source): logging.exception('ogr2osm failure ') raise return id_start - oa_quality_check(source) + id_end = oa_quality_check(source) elif 'integer' in r or 'numeric' in r: try: run('ogr2osm -f --id={0} -t addr_oa.py -o {1} "PG:dbname={4}" --sql "select * from \\"{2}\\" where {3} is not null and {3}!=0"'.format(id_start, source.path_osm, source.table, number_field, db_name), shell=True, capture_output=True, check=True, encoding='utf8') @@ -133,7 +134,7 @@ def oa_quality_check(source): logging.exception('ogr2osm failure ') raise return id_start - oa_quality_check(source) + id_end = oa_quality_check(source) # handle empty file else: logging.warning('{0} is empty'.format(source.table))