3
0
Fork 0

fix: fix 'consider-using-f-string' for pylint

This commit is contained in:
Lance Edgar 2025-08-30 19:29:52 -05:00
parent 1f4f613b62
commit 2969f3b7a5
3 changed files with 8 additions and 8 deletions

View file

@ -7,6 +7,7 @@ enable=anomalous-backslash-in-string,
assignment-from-none, assignment-from-none,
bare-except, bare-except,
broad-exception-caught, broad-exception-caught,
consider-using-f-string,
dangerous-default-value, dangerous-default-value,
disallowed-name, disallowed-name,
empty-docstring, empty-docstring,

View file

@ -99,10 +99,10 @@ class UUID(sa.types.TypeDecorator):
return str(value) return str(value)
if not isinstance(value, _uuid.UUID): if not isinstance(value, _uuid.UUID):
return "%.32x" % _uuid.UUID(value).int value = _uuid.UUID(value)
# hexstring # hexstring
return "%.32x" % value.int return f"{value.int:032x}"
def process_result_value(self, value, dialect): # pylint: disable=unused-argument,empty-docstring def process_result_value(self, value, dialect): # pylint: disable=unused-argument,empty-docstring
""" """ """ """

View file

@ -141,7 +141,7 @@ class InstallHandler(GenericHandler):
This is normally called by :meth:`run()`. This is normally called by :meth:`run()`.
""" """
self.rprint("\n\t[blue]Welcome to {}![/blue]".format(self.app.get_title())) self.rprint(f"\n\t[blue]Welcome to {self.app.get_title()}![/blue]")
self.rprint("\n\tThis tool will install and configure the app.") self.rprint("\n\tThis tool will install and configure the app.")
self.rprint("\n\t[italic]NB. You should already have created the database in PostgreSQL or MySQL.[/italic]") self.rprint("\n\t[italic]NB. You should already have created the database in PostgreSQL or MySQL.[/italic]")
@ -221,7 +221,7 @@ class InstallHandler(GenericHandler):
error = self.test_db_connection(dbinfo['dburl']) error = self.test_db_connection(dbinfo['dburl'])
if error: if error:
self.rprint("[bold red]cannot connect![/bold red] ..error was:") self.rprint("[bold red]cannot connect![/bold red] ..error was:")
self.rprint("\n{}".format(error)) self.rprint(f"\n{error}")
self.rprint("\n\t[bold yellow]aborting mission[/bold yellow]\n") self.rprint("\n\t[bold yellow]aborting mission[/bold yellow]\n")
sys.exit(1) sys.exit(1)
self.rprint("[bold green]good[/bold green]") self.rprint("[bold green]good[/bold green]")
@ -446,8 +446,7 @@ class InstallHandler(GenericHandler):
'upgrade', 'heads'] 'upgrade', 'heads']
subprocess.check_call(cmd) subprocess.check_call(cmd)
self.rprint("\n\tdb schema installed to: [bold green]{}[/bold green]".format( self.rprint(f"\n\tdb schema installed to: [bold green]{obfuscate_url_pw(db_url)}[/bold green]")
obfuscate_url_pw(db_url)))
return True return True
def show_goodbye(self): def show_goodbye(self):
@ -540,9 +539,9 @@ class InstallHandler(GenericHandler):
] ]
if default is not None: if default is not None:
if is_bool: if is_bool:
message.append(('', ' [{}]: '.format('Y' if default else 'N'))) message.append(('', f' [{"Y" if default else "N"}]: '))
else: else:
message.append(('', ' [{}]: '.format(default))) message.append(('', f' [{default}]: '))
else: else:
message.append(('', ': ')) message.append(('', ': '))