Skip to content

Commit

Permalink
Revert some unneeded f-strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
angryfoxx committed Jan 30, 2024
1 parent 9024d6b commit 3a15d68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dbbackup/db/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_postgres_uri(self):
else:
host = "@" + host

port = f":{self.settings.get('PORT')}" if self.settings.get("PORT") else ""
port = ":{}".format(self.settings.get("PORT")) if self.settings.get("PORT") else ""
dbname = f"--dbname=postgresql://{user}{password}{host}{port}/{dbname}"
return dbname

Expand Down Expand Up @@ -72,7 +72,7 @@ def _restore_dump(self, dump):
if self.single_transaction:
cmd += " --single-transaction"

cmd += f" {self.settings['NAME']}"
cmd += " {}".format(self.settings["NAME"])
cmd = f"{self.restore_prefix} {cmd} {self.restore_suffix}"
stdout, stderr = self.run_command(cmd, stdin=dump, env=self.restore_env)
return stdout, stderr
Expand All @@ -88,14 +88,14 @@ class PgDumpGisConnector(PgDumpConnector):

def _enable_postgis(self):
cmd = f'{self.psql_cmd} -c "CREATE EXTENSION IF NOT EXISTS postgis;"'
cmd += f" --username={self.settings['ADMIN_USER']}"
cmd += " --username={}".format(self.settings["ADMIN_USER"])
cmd += " --no-password"

if self.settings.get("HOST"):
cmd += f" --host={self.settings['HOST']}"
cmd += " --host={}".format(self.settings["HOST"])

if self.settings.get("PORT"):
cmd += f" --port={self.settings['PORT']}"
cmd += " --port={}".format(self.settings["PORT"])

return self.run_command(cmd)

Expand Down
6 changes: 3 additions & 3 deletions dbbackup/management/commands/dbbackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class Command(BaseDbBackupCommand):
help = "Backup a database, encrypt and/or compress and write to 'storage.'"
help = "Backup a database, encrypt and/or compress."
content_type = "db"

option_list = BaseDbBackupCommand.option_list + (
Expand Down Expand Up @@ -110,7 +110,7 @@ def _save_new_backup(self, database):
"""
Save a new backup file.
"""
self.logger.info(f"Backing Up Database: {database['NAME']}")
self.logger.info("Backing Up Database: %s", database["NAME"])
# Get backup, schema and name
filename = self.connector.generate_filename(self.servername)

Expand All @@ -130,7 +130,7 @@ def _save_new_backup(self, database):

# Set file name
filename = self.filename or filename
self.logger.info(f"Backup tempfile created: {utils.handle_size(outputfile)}")
self.logger.info("Backup tempfile created: %s", utils.handle_size(outputfile))

# Store backup
outputfile.seek(0)
Expand Down
6 changes: 4 additions & 2 deletions dbbackup/management/commands/dbrestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def _restore_backup(self):
)

self.logger.info(
f"Restoring backup for database '{self.database_name}' and server '{self.servername}'"
"Restoring backup for database '%s' and server '%s'",
self.database_name,
self.servername,
)

if self.schemas:
Expand All @@ -121,7 +123,7 @@ def _restore_backup(self):
input_file.close()
input_file = uncompressed_file

self.logger.info(f"Restore tempfile created: {utils.handle_size(input_file)}")
self.logger.info("Restore tempfile created: %s", utils.handle_size(input_file))
if self.interactive:
self._ask_confirmation()

Expand Down

0 comments on commit 3a15d68

Please sign in to comment.