From 4a89db7c11997e75b6fdb7cc04d303d8b5f1209d Mon Sep 17 00:00:00 2001 From: Sveinbjorn Thordarson Date: Sat, 12 Aug 2023 00:39:09 +0000 Subject: [PATCH] f-string modernization --- .gitignore | 1 + README.md | 2 +- add_placename_data.py | 2 +- iceaddr/db.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 58255e9..0434860 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ venv *.zip *.csv .vscode +*.pyc diff --git a/README.md b/README.md index ab47294..e918aea 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ in the database: ```python >>> from iceaddr import nearest_addr >>> addr = nearest_addr(64.148446, -21.944933)[0] ->>> print("{0} {1}".format(addr["heiti_nf"], addr["husnr"])) +>>> print(f"{addr['heiti_nf']} {addr['husnr']}") Öldugata 2 ``` diff --git a/add_placename_data.py b/add_placename_data.py index 5f6c626..018c628 100755 --- a/add_placename_data.py +++ b/add_placename_data.py @@ -154,7 +154,7 @@ def add_placenames_from_is50v(dbc) -> None: # Special handling of flakes - use center point elif type(c) is list: if not c: - # print("Faulty flake: {0}".format(n)) + # print(f"Faulty flake: {n}") # pprint(i) # raise continue diff --git a/iceaddr/db.py b/iceaddr/db.py index 7adf087..ee0cab7 100755 --- a/iceaddr/db.py +++ b/iceaddr/db.py @@ -27,7 +27,7 @@ def connection(self) -> sqlite3.Connection: if not self.db_conn: db_path = resource_filename(__name__, _DB_REL_PATH) # Open database file in read-only mode via URI - db_uri = "file:{0}?mode=ro".format(db_path) + db_uri = f"file:{db_path}?mode=ro" self.db_conn = sqlite3.connect(db_uri, uri=True, check_same_thread=False) # Return rows as key-value dicts self.db_conn.row_factory = lambda c, r: dict(