mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
simplify if statements
This commit is contained in:
@@ -40,11 +40,10 @@ class DeadlockHandler:
|
|||||||
if exc_type == psycopg2.errors.DeadlockDetected: # pylint: disable=E1101
|
if exc_type == psycopg2.errors.DeadlockDetected: # pylint: disable=E1101
|
||||||
self.handler()
|
self.handler()
|
||||||
return True
|
return True
|
||||||
else:
|
elif exc_type == psycopg2.extensions.TransactionRollbackError \
|
||||||
if exc_type == psycopg2.extensions.TransactionRollbackError:
|
and exc_value.pgcode == '40P01':
|
||||||
if exc_value.pgcode == '40P01':
|
self.handler()
|
||||||
self.handler()
|
return True
|
||||||
return True
|
|
||||||
|
|
||||||
if self.ignore_sql_errors and isinstance(exc_value, psycopg2.Error):
|
if self.ignore_sql_errors and isinstance(exc_value, psycopg2.Error):
|
||||||
LOG.info("SQL error ignored: %s", exc_value)
|
LOG.info("SQL error ignored: %s", exc_value)
|
||||||
|
|||||||
@@ -130,9 +130,8 @@ def import_osm_data(osm_file, options, drop=False, ignore_errors=False):
|
|||||||
if drop:
|
if drop:
|
||||||
conn.drop_table('planet_osm_nodes')
|
conn.drop_table('planet_osm_nodes')
|
||||||
|
|
||||||
if drop:
|
if drop and options['flatnode_file']:
|
||||||
if options['flatnode_file']:
|
Path(options['flatnode_file']).unlink()
|
||||||
Path(options['flatnode_file']).unlink()
|
|
||||||
|
|
||||||
|
|
||||||
def create_tables(conn, config, reverse_only=False):
|
def create_tables(conn, config, reverse_only=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user