From 8dd60eed78b641c64ea3db7aae4964d8382050ef Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 20 Oct 2019 17:59:12 -0700 Subject: [PATCH] Fix syntax errors --- onionshare/onion.py | 15 ++++++--------- onionshare/web/web.py | 12 ++++-------- onionshare_gui/onionshare_gui.py | 4 +++- onionshare_gui/tor_connection_dialog.py | 2 +- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/onionshare/onion.py b/onionshare/onion.py index 4e1491eb..95a31244 100644 --- a/onionshare/onion.py +++ b/onionshare/onion.py @@ -361,10 +361,7 @@ class Onion(object): summary = res_parts[4].split("=")[1] # "\033[K" clears the rest of the line - print( - f"Connecting to the Tor network: {progress}% - {summary}\033[K", - end="\r", - ) + print(f"Connecting to the Tor network: {progress}% - {summary}\033[K") if callable(tor_status_update_func): if not tor_status_update_func(progress, summary): @@ -529,9 +526,7 @@ class Onion(object): # Get the tor version self.tor_version = self.c.get_version().version_str - self.common.log( - "Onion", "connect", f"Connected to tor {self.tor_version}" - ) + self.common.log("Onion", "connect", f"Connected to tor {self.tor_version}") # Do the versions of stem and tor that I'm using support ephemeral onion services? list_ephemeral_hidden_services = getattr( @@ -585,7 +580,7 @@ class Onion(object): raise TorTooOld(strings._("error_stealth_not_supported")) if not save_scheduled_key: - print(f"Setting up onion service on port {port}." + print(f"Setting up onion service on port {port}.") if self.stealth: if self.settings.get("hidservauth_string"): @@ -700,7 +695,9 @@ class Onion(object): else: self.scheduled_auth_cookie = None else: - self.auth_string = f"HidServAuth {onion_host} {self.scheduled_auth_cookie}" + self.auth_string = ( + f"HidServAuth {onion_host} {self.scheduled_auth_cookie}" + ) if not save_scheduled_key: # We've used the scheduled share's HidServAuth. Reset it to None for future shares self.scheduled_auth_cookie = None diff --git a/onionshare/web/web.py b/onionshare/web/web.py index d630060d..16dfffd0 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -216,7 +216,7 @@ class Web: @self.app.route("/favicon.ico") def favicon(): return send_file( - f"{self.common.get_resource_path("static")}/img/favicon.ico" + f"{self.common.get_resource_path('static')}/img/favicon.ico" ) def error401(self): @@ -226,7 +226,7 @@ class Web: auth["username"] == "onionshare" and auth["password"] not in self.invalid_passwords ): - print(f"Invalid password guess: {auth["password"]}" + print(f"Invalid password guess: {auth['password']}") self.add_request(Web.REQUEST_INVALID_PASSWORD, data=auth["password"]) self.invalid_passwords.append(auth["password"]) @@ -307,9 +307,7 @@ class Web: def generate_password(self, persistent_password=None): self.common.log( - "Web", - "generate_password", - f"persistent_password={persistent_password}", + "Web", "generate_password", f"persistent_password={persistent_password}" ) if persistent_password != None and persistent_password != "": self.password = persistent_password @@ -321,9 +319,7 @@ class Web: else: self.password = self.common.build_password() self.common.log( - "Web", - "generate_password", - f'built random password: "{self.password}"', + "Web", "generate_password", f'built random password: "{self.password}"' ) def verbose_mode(self): diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 299130a9..bb206ec6 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -659,7 +659,9 @@ class OnionShareGui(QtWidgets.QMainWindow): event["path"] != "/favicon.ico" and event["path"] != f"/{mode.web.shutdown_password}/shutdown" ): - self.status_bar.showMessage(f"{strings._("other_page_loaded")}: {event["path"]}") + self.status_bar.showMessage( + f"{strings._('other_page_loaded')}: {event['path']}" + ) if event["type"] == Web.REQUEST_INVALID_PASSWORD: self.status_bar.showMessage( diff --git a/onionshare_gui/tor_connection_dialog.py b/onionshare_gui/tor_connection_dialog.py index 9de3c269..95e61eb3 100644 --- a/onionshare_gui/tor_connection_dialog.py +++ b/onionshare_gui/tor_connection_dialog.py @@ -112,7 +112,7 @@ class TorConnectionDialog(QtWidgets.QProgressDialog): # Display the exception in an alert box Alert( self.common, - f"{msg}\n\n{strings._("gui_tor_connection_error_settings")}", + f"{msg}\n\n{strings._('gui_tor_connection_error_settings')}", QtWidgets.QMessageBox.Warning, )