Skip to content

Commit 3bfe28d

Browse files
committed
Fix: Automated code cleanup
Use f-strings, black, ...
1 parent 4381075 commit 3bfe28d

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

examples/example_django/example_django/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
os.system("/usr/bin/python3 /opt/code/manage.py migrate")
1919

20-
os.system("/usr/bin/python3 /opt/code/manage.py " "loaddata /opt/code/blog/fixtures/default_articles.json")
20+
os.system("/usr/bin/python3 /opt/code/manage.py loaddata /opt/code/blog/fixtures/default_articles.json")

packaging/version_from_git.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
sys.exit(1)
3131

3232
if not os.path.isfile(target_file_path):
33-
print("No such file: '{}'".format(target_file_path))
33+
print(f"No such file: '{target_file_path}'")
3434
sys.exit(2)
3535

3636

@@ -41,17 +41,17 @@ def get_git_version():
4141

4242
version = get_git_version()
4343

44-
with open(target_file_path, "r") as target_file:
44+
with open(target_file_path) as target_file:
4545
target_content = target_file.read()
4646

4747
if format_ == "deb":
48-
updated_content = re.sub(r"(Version:)\w*(.*)", "\\1 {}".format(version), target_content)
48+
updated_content = re.sub(r"(Version:)\w*(.*)", f"\\1 {version}", target_content)
4949
elif format_ == "setup.py":
50-
updated_content = re.sub(r"(version)\w*=(.*)'", "\\1='{}'".format(version), target_content)
50+
updated_content = re.sub(r"(version)\w*=(.*)'", f"\\1='{version}'", target_content)
5151
elif format_ == "__version__":
52-
updated_content = re.sub(r"(__version__)\w*(.*)", "\\1 = '{}'".format(version), target_content)
52+
updated_content = re.sub(r"(__version__)\w*(.*)", f"\\1 = '{version}'", target_content)
5353
else:
54-
print("Format must be 'deb', 'setup.py' or '__version__', not '{}'".format(format_))
54+
print(f"Format must be 'deb', 'setup.py' or '__version__', not '{format_}'")
5555

5656
if "--inplace" in args:
5757
with open(target_file_path, "w") as target_file:

vm_connector/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def read_root():
2626

2727
async def get_latest_message_amend(ref: str, sender: str) -> Optional[dict]:
2828
async with aiohttp.ClientSession() as session:
29-
url = (
30-
f"{settings.API_SERVER}/api/v0/messages.json?msgType=STORE&sort_order=-1" f"&refs={ref}&addresses={sender}"
31-
)
29+
url = f"{settings.API_SERVER}/api/v0/messages.json?msgType=STORE&sort_order=-1&refs={ref}&addresses={sender}"
3230
resp = await session.get(url)
3331
resp.raise_for_status()
3432
resp_data = await resp.json()

0 commit comments

Comments
 (0)