osm2pgsql_style=self.config.get_import_style_file(),
threads=self.threads or default_threads,
dsn=self.config.get_libpq_dsn(),
- flatnode_file=str(self.config.get_path('FLATNODE_FILE')),
+ flatnode_file=str(self.config.get_path('FLATNODE_FILE') or ''),
tablespaces=dict(slim_data=self.config.TABLESPACE_OSM_DATA,
slim_index=self.config.TABLESPACE_OSM_INDEX,
main_data=self.config.TABLESPACE_PLACE_DATA,
with connect(args.config.get_libpq_dsn()) as conn:
freeze.drop_update_tables(conn)
- freeze.drop_flatnode_file(str(args.config.get_path('FLATNODE_FILE')))
+ freeze.drop_flatnode_file(args.config.get_path('FLATNODE_FILE'))
return 0
conn.commit()
-def drop_flatnode_file(fname):
+def drop_flatnode_file(fpath):
""" Remove the flatnode file if it exists.
"""
- if fname:
- fpath = Path(fname)
- if fpath.exists():
- fpath.unlink()
+ if fpath and fpath.exists():
+ fpath.unlink()
return 'false'
if var_type == Path:
- value = str(config.get_path(conf_name))
+ value = str(config.get_path(conf_name) or '')
else:
value = getattr(config, conf_name)
assert not temp_db_cursor.table_exists(table)
def test_drop_flatnode_file_no_file():
- freeze.drop_flatnode_file('')
+ freeze.drop_flatnode_file(None)
def test_drop_flatnode_file_file_already_gone(tmp_path):
- freeze.drop_flatnode_file(str(tmp_path / 'something.store'))
+ freeze.drop_flatnode_file(tmp_path / 'something.store')
def test_drop_flatnode_file_delte(tmp_path):
flatfile = tmp_path / 'flatnode.store'
flatfile.write_text('Some content')
- freeze.drop_flatnode_file(str(flatfile))
+ freeze.drop_flatnode_file(flatfile)
assert not flatfile.exists()