From 9f52406d45c4a9830190f87b13ea95ef6baf411c Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Sun, 7 Apr 2019 13:44:33 -0400 Subject: [PATCH] Fix flake8-quotes Q000 Remove bad quotes --- libs/custom/synchronousdeluge/__init__.py | 6 ++-- libs/custom/synchronousdeluge/client.py | 36 ++++++++++----------- libs/custom/synchronousdeluge/exceptions.py | 2 +- libs/custom/synchronousdeluge/transfer.py | 4 +-- libs/custom/utorrent/client.py | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libs/custom/synchronousdeluge/__init__.py b/libs/custom/synchronousdeluge/__init__.py index b0283e83..ad90cfe8 100644 --- a/libs/custom/synchronousdeluge/__init__.py +++ b/libs/custom/synchronousdeluge/__init__.py @@ -19,6 +19,6 @@ Example usage: from .exceptions import DelugeRPCError -__title__ = "synchronous-deluge" -__version__ = "0.1" -__author__ = "Christian Dale" +__title__ = 'synchronous-deluge' +__version__ = '0.1' +__author__ = 'Christian Dale' diff --git a/libs/custom/synchronousdeluge/client.py b/libs/custom/synchronousdeluge/client.py index 817aeba1..9194ebe8 100644 --- a/libs/custom/synchronousdeluge/client.py +++ b/libs/custom/synchronousdeluge/client.py @@ -9,7 +9,7 @@ from .exceptions import DelugeRPCError from .protocol import DelugeRPCRequest, DelugeRPCResponse from .transfer import DelugeTransfer -__all__ = ["DelugeClient"] +__all__ = ['DelugeClient'] RPC_RESPONSE = 1 RPC_ERROR = 2 @@ -24,35 +24,35 @@ class DelugeClient(object): self._request_counter = 0 def _get_local_auth(self): - username = password = "" + username = password = '' if platform.system() in ('Windows', 'Microsoft'): - app_data_path = os.environ.get("APPDATA") + app_data_path = os.environ.get('APPDATA') if not app_data_path: from six.moves import winreg hkey = winreg.OpenKey( winreg.HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", + 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders', ) - app_data_reg = winreg.QueryValueEx(hkey, "AppData") + app_data_reg = winreg.QueryValueEx(hkey, 'AppData') app_data_path = app_data_reg[0] winreg.CloseKey(hkey) - auth_file = os.path.join(app_data_path, "deluge", "auth") + auth_file = os.path.join(app_data_path, 'deluge', 'auth') else: from xdg.BaseDirectory import save_config_path try: - auth_file = os.path.join(save_config_path("deluge"), "auth") + auth_file = os.path.join(save_config_path('deluge'), 'auth') except OSError: return username, password if os.path.exists(auth_file): for line in open(auth_file): - if line.startswith("#"): + if line.startswith('#'): # This is a comment line continue line = line.strip() try: - lsplit = line.split(":") + lsplit = line.split(':') except Exception: continue @@ -63,13 +63,13 @@ class DelugeClient(object): else: continue - if username == "localclient": + if username == 'localclient': return username, password - return "", "" + return '', '' def _create_module_method(self, module, method): - fullname = "{0}.{1}".format(module, method) + fullname = '{0}.{1}'.format(module, method) def func(obj, *args, **kwargs): return self.remote_call(fullname, *args, **kwargs) @@ -80,18 +80,18 @@ class DelugeClient(object): def _introspect(self): def splitter(value): - return value.split(".") + return value.split('.') self.modules = [] - methods = self.remote_call("daemon.get_method_list").get() + methods = self.remote_call('daemon.get_method_list').get() methodmap = defaultdict(dict) for module, method in imap(splitter, methods): methodmap[module][method] = self._create_module_method(module, method) for module, methods in methodmap.items(): - clsname = "DelugeModule{0}".format(module.capitalize()) + clsname = 'DelugeModule{0}'.format(module.capitalize()) cls = type(clsname, (), methods) setattr(self, module, cls()) self.modules.append(module) @@ -133,7 +133,7 @@ class DelugeClient(object): self._request_counter += 1 return response - def connect(self, host="127.0.0.1", port=58846, username="", password=""): + def connect(self, host='127.0.0.1', port=58846, username='', password=''): """Connect to a daemon process. :param host: str, the hostname of the daemon @@ -145,11 +145,11 @@ class DelugeClient(object): self.transfer.connect((host, port)) # Attempt to fetch local auth info if needed - if not username and host in ("127.0.0.1", "localhost"): + if not username and host in ('127.0.0.1', 'localhost'): username, password = self._get_local_auth() # Authenticate - self.remote_call("daemon.login", username, password).get() + self.remote_call('daemon.login', username, password).get() # Introspect available methods self._introspect() diff --git a/libs/custom/synchronousdeluge/exceptions.py b/libs/custom/synchronousdeluge/exceptions.py index 6da4bdde..dcb23009 100644 --- a/libs/custom/synchronousdeluge/exceptions.py +++ b/libs/custom/synchronousdeluge/exceptions.py @@ -8,4 +8,4 @@ class DelugeRPCError(Exception): self.traceback = traceback def __str__(self): - return "{0}: {1}: {2}".format(self.__class__.__name__, self.name, self.msg) + return '{0}: {1}: {2}'.format(self.__class__.__name__, self.name, self.msg) diff --git a/libs/custom/synchronousdeluge/transfer.py b/libs/custom/synchronousdeluge/transfer.py index 42863b83..cbf49100 100644 --- a/libs/custom/synchronousdeluge/transfer.py +++ b/libs/custom/synchronousdeluge/transfer.py @@ -6,7 +6,7 @@ import zlib import rencode -__all__ = ["DelugeTransfer"] +__all__ = ['DelugeTransfer'] class DelugeTransfer(object): @@ -33,7 +33,7 @@ class DelugeTransfer(object): payload = zlib.compress(rencode.dumps(data)) self.conn.sendall(payload) - buf = b"" + buf = b'' while True: data = self.conn.recv(1024) diff --git a/libs/custom/utorrent/client.py b/libs/custom/utorrent/client.py index 5d3e1fec..ee9ef983 100644 --- a/libs/custom/utorrent/client.py +++ b/libs/custom/utorrent/client.py @@ -94,8 +94,8 @@ class UTorrentClient(object): def setprops(self, cur_hash, **kvpairs): params = [('action', 'setprops'), ('hash', cur_hash)] for k, v in iteritems(kvpairs): - params.append(("s", k)) - params.append(("v", v)) + params.append(('s', k)) + params.append(('v', v)) return self._action(params)