From a6f0c5fb4cc2de2906b4382ca80c5396dbce49f8 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 15 Dec 2017 20:25:20 -0500 Subject: [PATCH] pylint fixes fix exception formatting and a circular import --- .pylintrc | 14 +++++++++----- lbrynet/core/BlobManager.py | 2 +- lbrynet/daemon/Daemon.py | 2 +- lbrynet/file_manager/EncryptedFileDownloader.py | 2 +- lbrynet/reflector/__init__.py | 1 - lbrynet/winhelpers/knownpaths.py | 3 ++- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.pylintrc b/.pylintrc index 3d95c0cfe..2f61e3aee 100644 --- a/.pylintrc +++ b/.pylintrc @@ -34,6 +34,8 @@ unsafe-load-any-extension=no # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code extension-pkg-whitelist= + miniupnpc, + unqlite # Allow optimization of some AST trees. This will activate a peephole AST # optimizer, which will apply various small optimizations. For instance, it can @@ -74,10 +76,8 @@ disable= broad-except, cell-var-from-loop, consider-iterating-dictionary, - cyclic-import, dangerous-default-value, duplicate-code, - exec-used, fixme, global-statement, inherit-non-class, @@ -86,12 +86,10 @@ disable= locally-disabled, logging-not-lazy, missing-docstring, - multiple-imports, no-else-return, no-init, no-member, no-self-use, - not-context-manager, protected-access, redefined-builtin, redefined-outer-name, @@ -117,7 +115,13 @@ disable= unused-variable, wildcard-import, wrong-import-order, - wrong-import-position + wrong-import-position, + deprecated-lambda, + simplifiable-if-statement, + unidiomatic-typecheck, + global-at-module-level, + inconsistent-return-statements, + keyword-arg-before-vararg [REPORTS] diff --git a/lbrynet/core/BlobManager.py b/lbrynet/core/BlobManager.py index ab66951ef..5d0556f13 100644 --- a/lbrynet/core/BlobManager.py +++ b/lbrynet/core/BlobManager.py @@ -52,7 +52,7 @@ class DiskBlobManager(DHTHashSupplier): blob that is already on the hard disk """ if length is not None and not isinstance(length, int): - raise Exception("invalid length type: %s (%s)", length, str(type(length))) + raise Exception("invalid length type: %s (%s)" % (length, str(type(length)))) if blob_hash in self.blobs: return defer.succeed(self.blobs[blob_hash]) return self._make_new_blob(blob_hash, length) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index f768ff895..d87a62868 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -314,7 +314,7 @@ class Daemon(AuthJSONRPCServer): log.error("Couldn't bind to port %d. Visit lbry.io/faq/how-to-change-port for" " more details.", self.peer_port) log.error("%s", traceback.format_exc()) - raise ValueError("%s lbrynet may already be running on your computer.", str(e)) + raise ValueError("%s lbrynet may already be running on your computer." % str(e)) return defer.succeed(True) def _start_reflector(self): diff --git a/lbrynet/file_manager/EncryptedFileDownloader.py b/lbrynet/file_manager/EncryptedFileDownloader.py index 09c7c8ec4..71996a603 100644 --- a/lbrynet/file_manager/EncryptedFileDownloader.py +++ b/lbrynet/file_manager/EncryptedFileDownloader.py @@ -73,7 +73,7 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver): self.completed = True defer.returnValue(True) else: - raise Exception("Unknown status for stream %s: %s", self.stream_hash, status) + raise Exception("Unknown status for stream %s: %s" % (self.stream_hash, status)) @defer.inlineCallbacks def stop(self, err=None, change_status=True): diff --git a/lbrynet/reflector/__init__.py b/lbrynet/reflector/__init__.py index 01e4da72c..edcad4066 100644 --- a/lbrynet/reflector/__init__.py +++ b/lbrynet/reflector/__init__.py @@ -67,4 +67,3 @@ the client disconnects. from lbrynet.reflector.server.server import ReflectorServerFactory as ServerFactory from lbrynet.reflector.client.client import EncryptedFileReflectorClientFactory as ClientFactory from lbrynet.reflector.client.blob import BlobReflectorClientFactory as BlobClientFactory -from lbrynet.reflector import reupload diff --git a/lbrynet/winhelpers/knownpaths.py b/lbrynet/winhelpers/knownpaths.py index 3a1e8ddc9..c35004419 100644 --- a/lbrynet/winhelpers/knownpaths.py +++ b/lbrynet/winhelpers/knownpaths.py @@ -1,5 +1,6 @@ from __future__ import print_function -import ctypes, sys +import sys +import ctypes from ctypes import windll, wintypes from uuid import UUID