Merge pull request #114 from lbryio/no-unused-imports

Remove all unused imports; add check to pylint
This commit is contained in:
Jack Robison 2016-08-09 02:30:49 -04:00 committed by GitHub
commit 49a05b42f9
17 changed files with 25 additions and 48 deletions

View file

@ -1,9 +1,6 @@
import requests
import json import json
import time
from copy import deepcopy from copy import deepcopy
from googlefinance import getQuotes
from lbrynet.conf import CURRENCIES from lbrynet.conf import CURRENCIES
from lbrynet.core import utils from lbrynet.core import utils
import logging import logging

View file

@ -6,7 +6,6 @@ import subprocess
import socket import socket
import time import time
import os import os
import requests
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from twisted.internet import threads, reactor, defer, task from twisted.internet import threads, reactor, defer, task
@ -15,10 +14,9 @@ from twisted.enterprise import adbapi
from collections import defaultdict, deque from collections import defaultdict, deque
from zope.interface import implements from zope.interface import implements
from decimal import Decimal from decimal import Decimal
from googlefinance import getQuotes
from lbryum import SimpleConfig, Network from lbryum import SimpleConfig, Network
from lbryum.lbrycrd import COIN, TYPE_ADDRESS from lbryum.lbrycrd import COIN
from lbryum.wallet import WalletStorage, Wallet from lbryum.wallet import WalletStorage, Wallet
from lbryum.commands import known_commands, Commands from lbryum.commands import known_commands, Commands
from lbryum.transaction import Transaction from lbryum.transaction import Transaction
@ -27,8 +25,6 @@ from lbrynet.interfaces import IRequestCreator, IQueryHandlerFactory, IQueryHand
from lbrynet.core.client.ClientRequest import ClientRequest from lbrynet.core.client.ClientRequest import ClientRequest
from lbrynet.core.Error import UnknownNameError, InvalidStreamInfoError, RequestCanceledError from lbrynet.core.Error import UnknownNameError, InvalidStreamInfoError, RequestCanceledError
from lbrynet.core.Error import InsufficientFundsError from lbrynet.core.Error import InsufficientFundsError
from lbrynet.core.sqlite_helpers import rerun_if_locked
from lbrynet.conf import SOURCE_TYPES
from lbrynet.core.LBRYMetadata import Metadata from lbrynet.core.LBRYMetadata import Metadata
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -1,5 +1,5 @@
import binascii import binascii
from twisted.internet import defer, task, reactor from twisted.internet import defer, reactor
import collections import collections
@ -78,4 +78,4 @@ class DHTHashSupplier(object):
self.hash_reannounce_time = 60 * 60 # 1 hour self.hash_reannounce_time = 60 * 60 # 1 hour
def hashes_to_announce(self): def hashes_to_announce(self):
pass pass

View file

@ -8,10 +8,7 @@
# may be created by processing this file with epydoc: http://epydoc.sf.net # may be created by processing this file with epydoc: http://epydoc.sf.net
import UserDict import UserDict
#import sqlite3
import cPickle as pickle
import time import time
import os
import constants import constants

View file

@ -7,7 +7,7 @@
# The docstrings in this module contain epytext markup; API documentation # The docstrings in this module contain epytext markup; API documentation
# may be created by processing this file with epydoc: http://epydoc.sf.net # may be created by processing this file with epydoc: http://epydoc.sf.net
import hashlib, random, struct, time, math, binascii import hashlib, random, struct, time, binascii
import argparse import argparse
from twisted.internet import defer, error from twisted.internet import defer, error
import constants import constants
@ -1017,4 +1017,4 @@ def main():
twisted.internet.reactor.run() twisted.internet.reactor.run()
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -20,7 +20,7 @@
import os, sys, time, signal, hashlib, random import sys, hashlib, random
import twisted.internet.reactor import twisted.internet.reactor
from lbrynet.dht.node import Node from lbrynet.dht.node import Node
#from entangled.kademlia.datastore import SQLiteDataStore #from entangled.kademlia.datastore import SQLiteDataStore
@ -106,7 +106,7 @@ def stop():
if __name__ == '__main__': if __name__ == '__main__':
import sys, os import sys
if len(sys.argv) < 2: if len(sys.argv) < 2:
print 'Usage:\n%s UDP_PORT [KNOWN_NODE_IP KNOWN_NODE_PORT]' % sys.argv[0] print 'Usage:\n%s UDP_PORT [KNOWN_NODE_IP KNOWN_NODE_PORT]' % sys.argv[0]
print 'or:\n%s UDP_PORT [FILE_WITH_KNOWN_NODES]' % sys.argv[0] print 'or:\n%s UDP_PORT [FILE_WITH_KNOWN_NODES]' % sys.argv[0]

View file

@ -11,7 +11,6 @@ from lbrynet import conf
from lbrynet.lbryfile.StreamDescriptor import get_sd_info from lbrynet.lbryfile.StreamDescriptor import get_sd_info
from lbrynet.core.cryptoutils import get_lbry_hash_obj from lbrynet.core.cryptoutils import get_lbry_hash_obj
from twisted.protocols.basic import FileSender from twisted.protocols.basic import FileSender
from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloader
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -155,4 +154,4 @@ def create_lbry_file(session, lbry_file_manager, file_name, file_handle, key=Non
d = lbry_file_creator.setup() d = lbry_file_creator.setup()
d.addCallback(lambda _: start_stream()) d.addCallback(lambda _: start_stream())
return d return d

View file

@ -1,18 +1,12 @@
import json
import logging import logging
from time import sleep
from bitcoinrpc.authproxy import AuthServiceProxy
from twisted.internet.task import LoopingCall
from zope.interface import implements from zope.interface import implements
#from lbrynet.core.StreamDescriptor import PlainStreamDescriptorWriter, BlobStreamDescriptorWriter
from lbrynet.core.PaymentRateManager import PaymentRateManager from lbrynet.core.PaymentRateManager import PaymentRateManager
from lbrynet.lbryfilemanager.LBRYFileCreator import create_lbry_file from lbrynet.lbryfilemanager.LBRYFileCreator import create_lbry_file
from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloader from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloader
# from lbrynet.lbryfile.StreamDescriptor import get_sd_info
from lbrynet.lbryfile.StreamDescriptor import publish_sd_blob, create_plain_sd from lbrynet.lbryfile.StreamDescriptor import publish_sd_blob, create_plain_sd
from lbrynet.lbrynet_console.interfaces import ICommandHandler, ICommandHandlerFactory from lbrynet.lbrynet_console.interfaces import ICommandHandler, ICommandHandlerFactory
from lbrynet.core.StreamDescriptor import download_sd_blob#, BlobStreamDescriptorReader from lbrynet.core.StreamDescriptor import download_sd_blob
from lbrynet.core.Error import UnknownNameError, InvalidBlobHashError, InsufficientFundsError from lbrynet.core.Error import UnknownNameError, InvalidBlobHashError, InsufficientFundsError
from lbrynet.core.Error import InvalidStreamInfoError from lbrynet.core.Error import InvalidStreamInfoError
from lbrynet.core.utils import is_valid_blobhash from lbrynet.core.utils import is_valid_blobhash

View file

@ -1,6 +1,4 @@
import binascii import binascii
import distutils.version
import locale
import logging.handlers import logging.handlers
import mimetypes import mimetypes
import os import os
@ -14,7 +12,6 @@ import sys
import base58 import base58
import requests import requests
import simplejson as json import simplejson as json
import pkg_resources
from urllib2 import urlopen from urllib2 import urlopen
from appdirs import user_data_dir from appdirs import user_data_dir
@ -25,7 +22,7 @@ from twisted.internet import defer, threads, error, reactor
from twisted.internet.task import LoopingCall from twisted.internet.task import LoopingCall
from txjsonrpc import jsonrpclib from txjsonrpc import jsonrpclib
from txjsonrpc.web import jsonrpc from txjsonrpc.web import jsonrpc
from txjsonrpc.web.jsonrpc import Handler, Proxy from txjsonrpc.web.jsonrpc import Handler
from lbrynet import __version__ as lbrynet_version from lbrynet import __version__ as lbrynet_version
from lbryum.version import LBRYUM_VERSION as lbryum_version from lbryum.version import LBRYUM_VERSION as lbryum_version
@ -46,10 +43,12 @@ from lbrynet.core import utils
from lbrynet.core.LBRYMetadata import verify_name_characters from lbrynet.core.LBRYMetadata import verify_name_characters
from lbrynet.core.utils import generate_id from lbrynet.core.utils import generate_id
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
from lbrynet.conf import MIN_BLOB_DATA_PAYMENT_RATE, DEFAULT_MAX_SEARCH_RESULTS, KNOWN_DHT_NODES, DEFAULT_MAX_KEY_FEE, \ from lbrynet.conf import MIN_BLOB_DATA_PAYMENT_RATE, DEFAULT_MAX_SEARCH_RESULTS, \
DEFAULT_WALLET, DEFAULT_SEARCH_TIMEOUT, DEFAULT_CACHE_TIME, DEFAULT_UI_BRANCH, LOG_POST_URL, LOG_FILE_NAME, SOURCE_TYPES KNOWN_DHT_NODES, DEFAULT_MAX_KEY_FEE, DEFAULT_WALLET, \
DEFAULT_SEARCH_TIMEOUT, DEFAULT_CACHE_TIME, DEFAULT_UI_BRANCH, \
LOG_POST_URL, LOG_FILE_NAME
from lbrynet.conf import DEFAULT_SD_DOWNLOAD_TIMEOUT from lbrynet.conf import DEFAULT_SD_DOWNLOAD_TIMEOUT
from lbrynet.conf import DEFAULT_TIMEOUT, WALLET_TYPES from lbrynet.conf import DEFAULT_TIMEOUT
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob, BlobStreamDescriptorReader from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob, BlobStreamDescriptorReader
from lbrynet.core.Session import LBRYSession from lbrynet.core.Session import LBRYSession
from lbrynet.core.PTCWallet import PTCWallet from lbrynet.core.PTCWallet import PTCWallet

View file

@ -1,7 +1,7 @@
import sys import sys
import json import json
from lbrynet.conf import API_CONNECTION_STRING, LOG_FILE_NAME from lbrynet.conf import API_CONNECTION_STRING
from jsonrpc.proxy import JSONRPCProxy from jsonrpc.proxy import JSONRPCProxy
help_msg = "Useage: lbrynet-cli method json-args\n" \ help_msg = "Useage: lbrynet-cli method json-args\n" \

View file

@ -5,7 +5,6 @@ import os
import webbrowser import webbrowser
import sys import sys
import socket import socket
import platform
from appdirs import user_data_dir from appdirs import user_data_dir
from twisted.web import server from twisted.web import server
@ -14,8 +13,8 @@ from jsonrpc.proxy import JSONRPCProxy
from lbrynet.core import log_support from lbrynet.core import log_support
from lbrynet.lbrynet_daemon.LBRYDaemonServer import LBRYDaemonServer, LBRYDaemonRequest from lbrynet.lbrynet_daemon.LBRYDaemonServer import LBRYDaemonServer, LBRYDaemonRequest
from lbrynet.conf import API_CONNECTION_STRING, API_INTERFACE, API_ADDRESS, API_PORT, \ from lbrynet.conf import API_CONNECTION_STRING, API_INTERFACE, API_PORT, \
DEFAULT_WALLET, UI_ADDRESS, DEFAULT_UI_BRANCH, LOG_FILE_NAME UI_ADDRESS, DEFAULT_UI_BRANCH, LOG_FILE_NAME
# TODO: stop it! # TODO: stop it!
if sys.platform != "darwin": if sys.platform != "darwin":

View file

@ -9,15 +9,14 @@ import tempfile
import time import time
import cgi import cgi
from datetime import datetime
from appdirs import user_data_dir from appdirs import user_data_dir
from twisted.web import server, static, resource from twisted.web import server, static, resource
from twisted.internet import defer, interfaces, error, reactor, task, threads from twisted.internet import defer, interfaces, error, reactor, threads
from zope.interface import implements from zope.interface import implements
from lbrynet.lbrynet_daemon.LBRYDaemon import LBRYDaemon from lbrynet.lbrynet_daemon.LBRYDaemon import LBRYDaemon
from lbrynet.conf import API_CONNECTION_STRING, API_ADDRESS, DEFAULT_WALLET, UI_ADDRESS, DEFAULT_UI_BRANCH, LOG_FILE_NAME from lbrynet.conf import API_ADDRESS, UI_ADDRESS, DEFAULT_UI_BRANCH, LOG_FILE_NAME
# TODO: omg, this code is essentially duplicated in LBRYDaemon # TODO: omg, this code is essentially duplicated in LBRYDaemon

View file

@ -5,14 +5,13 @@ import sys
from copy import deepcopy from copy import deepcopy
from appdirs import user_data_dir from appdirs import user_data_dir
from datetime import datetime
from twisted.internet import defer from twisted.internet import defer
from twisted.internet.task import LoopingCall from twisted.internet.task import LoopingCall
from lbrynet.core.Error import InvalidStreamInfoError, InsufficientFundsError, KeyFeeAboveMaxAllowed from lbrynet.core.Error import InsufficientFundsError, KeyFeeAboveMaxAllowed
from lbrynet.core.PaymentRateManager import PaymentRateManager from lbrynet.core.PaymentRateManager import PaymentRateManager
from lbrynet.core.StreamDescriptor import download_sd_blob from lbrynet.core.StreamDescriptor import download_sd_blob
from lbrynet.core.LBRYMetadata import Metadata, LBRYFeeValidator from lbrynet.core.LBRYMetadata import LBRYFeeValidator
from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloaderFactory from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloaderFactory
from lbrynet.conf import DEFAULT_TIMEOUT, LOG_FILE_NAME from lbrynet.conf import DEFAULT_TIMEOUT, LOG_FILE_NAME

View file

@ -4,7 +4,6 @@ import os
import sys import sys
from appdirs import user_data_dir from appdirs import user_data_dir
from datetime import datetime
from lbrynet.core.Error import InsufficientFundsError from lbrynet.core.Error import InsufficientFundsError
from lbrynet.lbryfilemanager.LBRYFileCreator import create_lbry_file from lbrynet.lbryfilemanager.LBRYFileCreator import create_lbry_file

View file

@ -1,7 +1,6 @@
import logging import logging
import random import random
from txjsonrpc.web.jsonrpc import Proxy from txjsonrpc.web.jsonrpc import Proxy
from twisted.internet import defer
from lbrynet.conf import SEARCH_SERVERS from lbrynet.conf import SEARCH_SERVERS
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -6,7 +6,6 @@ CLI for sending rpc commands to a DHT node
from twisted.internet import reactor from twisted.internet import reactor
from txjsonrpc.web.jsonrpc import Proxy from txjsonrpc.web.jsonrpc import Proxy
import argparse import argparse
import sys
def print_value(value): def print_value(value):
@ -39,4 +38,4 @@ def main():
d = proxy.callRemote(args.rpc_command) d = proxy.callRemote(args.rpc_command)
d.addCallbacks(print_value, print_error) d.addCallbacks(print_value, print_error)
d.addBoth(lambda _: shut_down()) d.addBoth(lambda _: shut_down())
reactor.run() reactor.run()

View file

@ -44,4 +44,5 @@ trial tests
# Ignoring distutils because: https://github.com/PyCQA/pylint/issues/73 # Ignoring distutils because: https://github.com/PyCQA/pylint/issues/73
# TODO: as code quality improves, make pylint be more strict # TODO: as code quality improves, make pylint be more strict
pylint -E --disable=inherit-non-class --disable=no-member --ignored-modules=distutils lbrynet pylint -E --disable=inherit-non-class --disable=no-member --ignored-modules=distutils \
--enable=unused-import lbrynet