chore: refactor code quality issues

This commit is contained in:
Aksh Gupta 2021-03-10 08:40:06 +00:00
parent dd8742535f
commit ea8d2cfdfe
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):
):
rendevouz_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