Fix syntax errors

This commit is contained in:
Micah Lee 2019-10-20 17:59:12 -07:00
parent 098625621c
commit 8dd60eed78
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
4 changed files with 14 additions and 19 deletions

View File

@ -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

View File

@ -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):

View File

@ -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(

View File

@ -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,
)