Merge pull request #1317 from akshgpt7/chore-refactor-issues

Refactor code quality issues
This commit is contained in:
Micah Lee 2021-04-11 11:37:42 -07:00 committed by GitHub
commit a08a12d855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 38 additions and 97 deletions

View file

@ -28,11 +28,9 @@ import tempfile
import subprocess
import time
import shlex
import getpass
import psutil
from distutils.version import LooseVersion as Version
from .settings import Settings
class TorErrorAutomatic(Exception):
@ -518,13 +516,12 @@ class Onion(object):
self.settings.get("control_port_address"),
self.settings.get("control_port_port"),
)
else:
print(
"Can't connect to the Tor controller using socket file {}.".format(
self.settings.get("socket_file_path")
)
print(
"Can't connect to the Tor controller using socket file {}.".format(
self.settings.get("socket_file_path")
)
raise TorErrorSocketFile(self.settings.get("socket_file_path"))
)
raise TorErrorSocketFile(self.settings.get("socket_file_path"))
# Try authenticating
try:
@ -755,7 +752,7 @@ class Onion(object):
):
rendezvous_circuit_ids.append(c.id)
symbols = [c for c in "\\|/-"]
symbols = list("\\|/-")
symbols_i = 0
while True:
@ -837,9 +834,6 @@ class Onion(object):
# Import the key
key = RSA.importKey(base64.b64decode(key))
# Is this a v2 Onion key? (1024 bits) If so, we should keep using it.
if key.n.bit_length() == 1024:
return True
else:
return False
return key.n.bit_length() == 1024
except:
return False