Remove unneccessary fstrings

This commit is contained in:
Ivan Habunek 2024-08-12 09:02:48 +02:00
parent a0e0f4fccd
commit 93cfe2af75
No known key found for this signature in database
GPG Key ID: 01DB3DD0D824504C
1 changed files with 13 additions and 13 deletions

View File

@ -317,28 +317,28 @@ def format_account_name(account: Account) -> str:
def print_diags(instance_dict: t.Optional[Data], include_files: bool):
from importlib.metadata import version
click.echo(f'{green(f"Diagnostic Information")}')
click.echo(f'{green("Diagnostic Information")}')
from datetime import datetime, timezone
now = datetime.now(timezone.utc)
click.echo(f'{green("Current Date/Time:")} {now.strftime("%Y-%m-%d %H:%M:%S %Z")}')
from toot import __version__, config, settings
click.echo(f'{green(f"Toot version:")} {__version__}')
click.echo(f'{green("Toot version:")} {__version__}')
import platform
click.echo(f'{green(f"Platform:")} {platform.platform()}')
click.echo(f'{green("Platform:")} {platform.platform()}')
# print distro - only call if available (python 3.10+)
fd_os_release = getattr(platform, "freedesktop_os_release", None) # novermin
if callable(fd_os_release): # novermin
try:
name = platform.freedesktop_os_release()['PRETTY_NAME']
click.echo(f'{green(f"Distro:")} {name}')
click.echo(f'{green("Distro:")} {name}')
except: # noqa
pass
click.echo(f'{green(f"Python version:")} {platform.python_version()}')
click.echo(f'{green("Python version:")} {platform.python_version()}')
click.echo(green("Dependency versions:"))
deps = sorted(['beautifulsoup4', 'click', 'requests', 'tomlkit', 'urwid', 'wcwidth',
@ -353,30 +353,30 @@ def print_diags(instance_dict: t.Optional[Data], include_files: bool):
click.echo(f"\t{dep}: {ver}")
click.echo(f'{green(f"Settings file path:")} {settings.get_settings_path()}')
click.echo(f'{green(f"Config file path:")} {config.get_config_file_path()}')
click.echo(f'{green("Settings file path:")} {settings.get_settings_path()}')
click.echo(f'{green("Config file path:")} {config.get_config_file_path()}')
if instance_dict:
try:
click.echo(f'{green(f"Server URI:")} {instance_dict["uri"]}')
click.echo(f'{green("Server URI:")} {instance_dict["uri"]}')
except: # noqa E722
pass
try:
click.echo(f'{green(f"Server version:")} {instance_dict["version"]}')
click.echo(f'{green("Server version:")} {instance_dict["version"]}')
except: # noqa E722
pass
if include_files:
click.echo(f'{green(f"Settings file contents:")}')
click.echo(f'{green("Settings file contents:")}')
try:
with open(settings.get_settings_path(), 'r') as f:
print(f.read())
except: # noqa
click.echo(f'{yellow(f"Could not open settings file")}')
click.echo(f'{yellow("Could not open settings file")}')
click.echo('')
click.echo(f'{green(f"Config file contents:")}')
click.echo(f'{green("Config file contents:")}')
try:
with open(config.get_config_file_path(), 'r') as f:
for line in f:
@ -387,7 +387,7 @@ def print_diags(instance_dict: t.Optional[Data], include_files: bool):
click.echo(line, nl=False)
except: # noqa
click.echo(f'{yellow(f"Could not open config file")}')
click.echo(f'{yellow("Could not open config file")}')
click.echo('')