Skip to content

Commit

Permalink
Fix: Automated code cleanup
Browse files Browse the repository at this point in the history
Use f-strings, black, ...
  • Loading branch information
hoh committed Apr 9, 2024
1 parent 4381075 commit 3bfe28d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/example_django/example_django/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

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

os.system("/usr/bin/python3 /opt/code/manage.py " "loaddata /opt/code/blog/fixtures/default_articles.json")
os.system("/usr/bin/python3 /opt/code/manage.py loaddata /opt/code/blog/fixtures/default_articles.json")
12 changes: 6 additions & 6 deletions packaging/version_from_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
sys.exit(1)

if not os.path.isfile(target_file_path):
print("No such file: '{}'".format(target_file_path))
print(f"No such file: '{target_file_path}'")
sys.exit(2)


Expand All @@ -41,17 +41,17 @@ def get_git_version():

version = get_git_version()

with open(target_file_path, "r") as target_file:
with open(target_file_path) as target_file:
target_content = target_file.read()

if format_ == "deb":
updated_content = re.sub(r"(Version:)\w*(.*)", "\\1 {}".format(version), target_content)
updated_content = re.sub(r"(Version:)\w*(.*)", f"\\1 {version}", target_content)
elif format_ == "setup.py":
updated_content = re.sub(r"(version)\w*=(.*)'", "\\1='{}'".format(version), target_content)
updated_content = re.sub(r"(version)\w*=(.*)'", f"\\1='{version}'", target_content)
elif format_ == "__version__":
updated_content = re.sub(r"(__version__)\w*(.*)", "\\1 = '{}'".format(version), target_content)
updated_content = re.sub(r"(__version__)\w*(.*)", f"\\1 = '{version}'", target_content)
else:
print("Format must be 'deb', 'setup.py' or '__version__', not '{}'".format(format_))
print(f"Format must be 'deb', 'setup.py' or '__version__', not '{format_}'")

if "--inplace" in args:
with open(target_file_path, "w") as target_file:
Expand Down
4 changes: 1 addition & 3 deletions vm_connector/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ def read_root():

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

0 comments on commit 3bfe28d

Please sign in to comment.