No longer inheriting from object and added proper use of super().
This commit is contained in:
parent
607677f98f
commit
4ece422f48
75 changed files with 186 additions and 191 deletions
|
@ -24,7 +24,7 @@ BLOB_BYTES_UPLOADED = 'Blob Bytes Uploaded'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Manager(object):
|
class Manager:
|
||||||
def __init__(self, analytics_api, context=None, installation_id=None, session_id=None):
|
def __init__(self, analytics_api, context=None, installation_id=None, session_id=None):
|
||||||
self.analytics_api = analytics_api
|
self.analytics_api = analytics_api
|
||||||
self._tracked_data = collections.defaultdict(list)
|
self._tracked_data = collections.defaultdict(list)
|
||||||
|
@ -219,7 +219,7 @@ class Manager(object):
|
||||||
callback(maybe_deferred, *args, **kwargs)
|
callback(maybe_deferred, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Api(object):
|
class Api:
|
||||||
def __init__(self, cookies, url, write_key, enabled):
|
def __init__(self, cookies, url, write_key, enabled):
|
||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
|
@ -13,7 +13,7 @@ log = logging.getLogger(__name__)
|
||||||
MAX_BLOB_SIZE = 2 * 2 ** 20
|
MAX_BLOB_SIZE = 2 * 2 ** 20
|
||||||
|
|
||||||
|
|
||||||
class BlobFile(object):
|
class BlobFile:
|
||||||
"""
|
"""
|
||||||
A chunk of data available on the network which is specified by a hashsum
|
A chunk of data available on the network which is specified by a hashsum
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BlobFileCreator(object):
|
class BlobFileCreator:
|
||||||
"""
|
"""
|
||||||
This class is used to create blobs on the local filesystem
|
This class is used to create blobs on the local filesystem
|
||||||
when we do not know the blob hash beforehand (i.e, when creating
|
when we do not know the blob hash beforehand (i.e, when creating
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class HashBlobReader(object):
|
class HashBlobReader:
|
||||||
"""
|
"""
|
||||||
This is a file like reader class that supports
|
This is a file like reader class that supports
|
||||||
read(size) and close()
|
read(size) and close()
|
||||||
|
|
|
@ -7,7 +7,7 @@ from lbrynet.core.cryptoutils import get_lbry_hash_obj
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class HashBlobWriter(object):
|
class HashBlobWriter:
|
||||||
def __init__(self, length_getter, finished_cb):
|
def __init__(self, length_getter, finished_cb):
|
||||||
self.write_handle = BytesIO()
|
self.write_handle = BytesIO()
|
||||||
self.length_getter = length_getter
|
self.length_getter = length_getter
|
||||||
|
|
|
@ -164,11 +164,11 @@ class Env(envparse.Env):
|
||||||
self._convert_key(key): self._convert_value(value)
|
self._convert_key(key): self._convert_value(value)
|
||||||
for key, value in schema.items()
|
for key, value in schema.items()
|
||||||
}
|
}
|
||||||
envparse.Env.__init__(self, **my_schema)
|
super().__init__(**my_schema)
|
||||||
|
|
||||||
def __call__(self, key, *args, **kwargs):
|
def __call__(self, key, *args, **kwargs):
|
||||||
my_key = self._convert_key(key)
|
my_key = self._convert_key(key)
|
||||||
return super(Env, self).__call__(my_key, *args, **kwargs)
|
return super().__call__(my_key, *args, **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _convert_key(key):
|
def _convert_key(key):
|
||||||
|
@ -289,7 +289,7 @@ ADJUSTABLE_SETTINGS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config:
|
||||||
def __init__(self, fixed_defaults, adjustable_defaults, persisted_settings=None,
|
def __init__(self, fixed_defaults, adjustable_defaults, persisted_settings=None,
|
||||||
environment=None, cli_settings=None):
|
environment=None, cli_settings=None):
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from decimal import Decimal
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BlobAvailabilityTracker(object):
|
class BlobAvailabilityTracker:
|
||||||
"""
|
"""
|
||||||
Class to track peer counts for known blobs, and to discover new popular blobs
|
Class to track peer counts for known blobs, and to discover new popular blobs
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BlobInfo(object):
|
class BlobInfo:
|
||||||
"""
|
"""
|
||||||
This structure is used to represent the metadata of a blob.
|
This structure is used to represent the metadata of a blob.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from lbrynet.blob.creator import BlobFileCreator
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DiskBlobManager(object):
|
class DiskBlobManager:
|
||||||
def __init__(self, blob_dir, storage, node_datastore=None):
|
def __init__(self, blob_dir, storage, node_datastore=None):
|
||||||
"""
|
"""
|
||||||
This class stores blobs on the hard disk
|
This class stores blobs on the hard disk
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class DownloadOptionChoice(object):
|
class DownloadOptionChoice:
|
||||||
"""A possible choice that can be picked for some option.
|
"""A possible choice that can be picked for some option.
|
||||||
|
|
||||||
An option can have one or more choices that can be picked from.
|
An option can have one or more choices that can be picked from.
|
||||||
|
@ -10,7 +10,7 @@ class DownloadOptionChoice(object):
|
||||||
self.bool_options_description = bool_options_description
|
self.bool_options_description = bool_options_description
|
||||||
|
|
||||||
|
|
||||||
class DownloadOption(object):
|
class DownloadOption:
|
||||||
"""An option for a user to select a value from several different choices."""
|
"""An option for a user to select a value from several different choices."""
|
||||||
def __init__(self, option_types, long_description, short_description, default_value,
|
def __init__(self, option_types, long_description, short_description, default_value,
|
||||||
default_value_description):
|
default_value_description):
|
||||||
|
|
|
@ -12,19 +12,19 @@ class DownloadCanceledError(Exception):
|
||||||
|
|
||||||
class DownloadSDTimeout(Exception):
|
class DownloadSDTimeout(Exception):
|
||||||
def __init__(self, download):
|
def __init__(self, download):
|
||||||
Exception.__init__(self, 'Failed to download sd blob {} within timeout'.format(download))
|
super().__init__('Failed to download sd blob {} within timeout'.format(download))
|
||||||
self.download = download
|
self.download = download
|
||||||
|
|
||||||
|
|
||||||
class DownloadTimeoutError(Exception):
|
class DownloadTimeoutError(Exception):
|
||||||
def __init__(self, download):
|
def __init__(self, download):
|
||||||
Exception.__init__(self, 'Failed to download {} within timeout'.format(download))
|
super().__init__('Failed to download {} within timeout'.format(download))
|
||||||
self.download = download
|
self.download = download
|
||||||
|
|
||||||
|
|
||||||
class DownloadDataTimeout(Exception):
|
class DownloadDataTimeout(Exception):
|
||||||
def __init__(self, download):
|
def __init__(self, download):
|
||||||
Exception.__init__(self, 'Failed to download data blobs for sd hash '
|
super().__init__('Failed to download data blobs for sd hash '
|
||||||
'{} within timeout'.format(download))
|
'{} within timeout'.format(download))
|
||||||
self.download = download
|
self.download = download
|
||||||
|
|
||||||
|
@ -55,39 +55,39 @@ class KeyFeeAboveMaxAllowed(Exception):
|
||||||
|
|
||||||
class InvalidExchangeRateResponse(Exception):
|
class InvalidExchangeRateResponse(Exception):
|
||||||
def __init__(self, source, reason):
|
def __init__(self, source, reason):
|
||||||
Exception.__init__(self, 'Failed to get exchange rate from {}:{}'.format(source, reason))
|
super().__init__('Failed to get exchange rate from {}:{}'.format(source, reason))
|
||||||
self.source = source
|
self.source = source
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
|
|
||||||
|
|
||||||
class UnknownNameError(Exception):
|
class UnknownNameError(Exception):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
Exception.__init__(self, 'Name {} is unknown'.format(name))
|
super().__init__('Name {} is unknown'.format(name))
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
|
||||||
class UnknownClaimID(Exception):
|
class UnknownClaimID(Exception):
|
||||||
def __init__(self, claim_id):
|
def __init__(self, claim_id):
|
||||||
Exception.__init__(self, 'Claim {} is unknown'.format(claim_id))
|
super().__init__('Claim {} is unknown'.format(claim_id))
|
||||||
self.claim_id = claim_id
|
self.claim_id = claim_id
|
||||||
|
|
||||||
|
|
||||||
class UnknownURI(Exception):
|
class UnknownURI(Exception):
|
||||||
def __init__(self, uri):
|
def __init__(self, uri):
|
||||||
Exception.__init__(self, 'URI {} cannot be resolved'.format(uri))
|
super().__init__('URI {} cannot be resolved'.format(uri))
|
||||||
self.name = uri
|
self.name = uri
|
||||||
|
|
||||||
class UnknownOutpoint(Exception):
|
class UnknownOutpoint(Exception):
|
||||||
def __init__(self, outpoint):
|
def __init__(self, outpoint):
|
||||||
Exception.__init__(self, 'Outpoint {} cannot be resolved'.format(outpoint))
|
super().__init__('Outpoint {} cannot be resolved'.format(outpoint))
|
||||||
self.outpoint = outpoint
|
self.outpoint = outpoint
|
||||||
|
|
||||||
class InvalidName(Exception):
|
class InvalidName(Exception):
|
||||||
def __init__(self, name, invalid_characters):
|
def __init__(self, name, invalid_characters):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.invalid_characters = invalid_characters
|
self.invalid_characters = invalid_characters
|
||||||
Exception.__init__(
|
super().__init__(
|
||||||
self, 'URI contains invalid characters: {}'.format(','.join(invalid_characters)))
|
'URI contains invalid characters: {}'.format(','.join(invalid_characters)))
|
||||||
|
|
||||||
|
|
||||||
class UnknownStreamTypeError(Exception):
|
class UnknownStreamTypeError(Exception):
|
||||||
|
@ -105,7 +105,7 @@ class InvalidStreamDescriptorError(Exception):
|
||||||
class InvalidStreamInfoError(Exception):
|
class InvalidStreamInfoError(Exception):
|
||||||
def __init__(self, name, stream_info):
|
def __init__(self, name, stream_info):
|
||||||
msg = '{} has claim with invalid stream info: {}'.format(name, stream_info)
|
msg = '{} has claim with invalid stream info: {}'.format(name, stream_info)
|
||||||
Exception.__init__(self, msg)
|
super().__init__(msg)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.stream_info = stream_info
|
self.stream_info = stream_info
|
||||||
|
|
||||||
|
@ -159,14 +159,14 @@ class NegotiationError(Exception):
|
||||||
class InvalidCurrencyError(Exception):
|
class InvalidCurrencyError(Exception):
|
||||||
def __init__(self, currency):
|
def __init__(self, currency):
|
||||||
self.currency = currency
|
self.currency = currency
|
||||||
Exception.__init__(
|
super().__init__(
|
||||||
self, 'Invalid currency: {} is not a supported currency.'.format(currency))
|
'Invalid currency: {} is not a supported currency.'.format(currency))
|
||||||
|
|
||||||
|
|
||||||
class NoSuchDirectoryError(Exception):
|
class NoSuchDirectoryError(Exception):
|
||||||
def __init__(self, directory):
|
def __init__(self, directory):
|
||||||
self.directory = directory
|
self.directory = directory
|
||||||
Exception.__init__(self, 'No such directory {}'.format(directory))
|
super().__init__('No such directory {}'.format(directory))
|
||||||
|
|
||||||
|
|
||||||
class ComponentStartConditionNotMet(Exception):
|
class ComponentStartConditionNotMet(Exception):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
class Offer(object):
|
class Offer:
|
||||||
"""A rate offer to download blobs from a host."""
|
"""A rate offer to download blobs from a host."""
|
||||||
|
|
||||||
RATE_ACCEPTED = "RATE_ACCEPTED"
|
RATE_ACCEPTED = "RATE_ACCEPTED"
|
||||||
|
|
|
@ -3,14 +3,14 @@ from lbrynet import conf
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
class BasePaymentRateManager(object):
|
class BasePaymentRateManager:
|
||||||
def __init__(self, rate=None, info_rate=None):
|
def __init__(self, rate=None, info_rate=None):
|
||||||
self.min_blob_data_payment_rate = rate if rate is not None else conf.settings['data_rate']
|
self.min_blob_data_payment_rate = rate if rate is not None else conf.settings['data_rate']
|
||||||
self.min_blob_info_payment_rate = (
|
self.min_blob_info_payment_rate = (
|
||||||
info_rate if info_rate is not None else conf.settings['min_info_rate'])
|
info_rate if info_rate is not None else conf.settings['min_info_rate'])
|
||||||
|
|
||||||
|
|
||||||
class PaymentRateManager(object):
|
class PaymentRateManager:
|
||||||
def __init__(self, base, rate=None):
|
def __init__(self, base, rate=None):
|
||||||
"""
|
"""
|
||||||
@param base: a BasePaymentRateManager
|
@param base: a BasePaymentRateManager
|
||||||
|
@ -36,7 +36,7 @@ class PaymentRateManager(object):
|
||||||
self.points_paid += amount
|
self.points_paid += amount
|
||||||
|
|
||||||
|
|
||||||
class NegotiatedPaymentRateManager(object):
|
class NegotiatedPaymentRateManager:
|
||||||
def __init__(self, base, availability_tracker, generous=None):
|
def __init__(self, base, availability_tracker, generous=None):
|
||||||
"""
|
"""
|
||||||
@param base: a BasePaymentRateManager
|
@param base: a BasePaymentRateManager
|
||||||
|
@ -84,7 +84,7 @@ class NegotiatedPaymentRateManager(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class OnlyFreePaymentsManager(object):
|
class OnlyFreePaymentsManager:
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
A payment rate manager that will only ever accept and offer a rate of 0.0,
|
A payment rate manager that will only ever accept and offer a rate of 0.0,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from collections import defaultdict
|
||||||
from lbrynet.core import utils
|
from lbrynet.core import utils
|
||||||
|
|
||||||
# Do not create this object except through PeerManager
|
# Do not create this object except through PeerManager
|
||||||
class Peer(object):
|
class Peer:
|
||||||
def __init__(self, host, port):
|
def __init__(self, host, port):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from lbrynet.core.Peer import Peer
|
from lbrynet.core.Peer import Peer
|
||||||
|
|
||||||
|
|
||||||
class PeerManager(object):
|
class PeerManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.peers = []
|
self.peers = []
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ def get_default_price_model(blob_tracker, base_price, **kwargs):
|
||||||
return MeanAvailabilityWeightedPrice(blob_tracker, base_price, **kwargs)
|
return MeanAvailabilityWeightedPrice(blob_tracker, base_price, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class ZeroPrice(object):
|
class ZeroPrice:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.base_price = 0.0
|
self.base_price = 0.0
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class ZeroPrice(object):
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
|
|
||||||
class MeanAvailabilityWeightedPrice(object):
|
class MeanAvailabilityWeightedPrice:
|
||||||
"""Calculate mean-blob-availability and stream-position weighted price for a blob
|
"""Calculate mean-blob-availability and stream-position weighted price for a blob
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
|
|
@ -6,7 +6,7 @@ from twisted.internet import task
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DummyRateLimiter(object):
|
class DummyRateLimiter:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.dl_bytes_this_second = 0
|
self.dl_bytes_this_second = 0
|
||||||
self.ul_bytes_this_second = 0
|
self.ul_bytes_this_second = 0
|
||||||
|
@ -44,7 +44,7 @@ class DummyRateLimiter(object):
|
||||||
self.total_ul_bytes += num_bytes
|
self.total_ul_bytes += num_bytes
|
||||||
|
|
||||||
|
|
||||||
class RateLimiter(object):
|
class RateLimiter:
|
||||||
"""This class ensures that upload and download rates don't exceed specified maximums"""
|
"""This class ensures that upload and download rates don't exceed specified maximums"""
|
||||||
|
|
||||||
#implements(IRateLimiter)
|
#implements(IRateLimiter)
|
||||||
|
|
|
@ -19,7 +19,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SinglePeerFinder(DummyPeerFinder):
|
class SinglePeerFinder(DummyPeerFinder):
|
||||||
def __init__(self, peer):
|
def __init__(self, peer):
|
||||||
DummyPeerFinder.__init__(self)
|
super().__init__()
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
|
|
||||||
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=False):
|
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=False):
|
||||||
|
@ -28,7 +28,7 @@ class SinglePeerFinder(DummyPeerFinder):
|
||||||
|
|
||||||
class BlobCallback(BlobFile):
|
class BlobCallback(BlobFile):
|
||||||
def __init__(self, blob_dir, blob_hash, timeout):
|
def __init__(self, blob_dir, blob_hash, timeout):
|
||||||
BlobFile.__init__(self, blob_dir, blob_hash)
|
super().__init__(blob_dir, blob_hash)
|
||||||
self.callback = defer.Deferred()
|
self.callback = defer.Deferred()
|
||||||
reactor.callLater(timeout, self._cancel)
|
reactor.callLater(timeout, self._cancel)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class BlobCallback(BlobFile):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class SingleBlobDownloadManager(object):
|
class SingleBlobDownloadManager:
|
||||||
def __init__(self, blob):
|
def __init__(self, blob):
|
||||||
self.blob = blob
|
self.blob = blob
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class SingleBlobDownloadManager(object):
|
||||||
return self.blob.blob_hash
|
return self.blob.blob_hash
|
||||||
|
|
||||||
|
|
||||||
class SinglePeerDownloader(object):
|
class SinglePeerDownloader:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._payment_rate_manager = OnlyFreePaymentsManager()
|
self._payment_rate_manager = OnlyFreePaymentsManager()
|
||||||
self._rate_limiter = DummyRateLimiter()
|
self._rate_limiter = DummyRateLimiter()
|
||||||
|
|
|
@ -10,7 +10,7 @@ def get_default_strategy(blob_tracker, **kwargs):
|
||||||
return BasicAvailabilityWeightedStrategy(blob_tracker, **kwargs)
|
return BasicAvailabilityWeightedStrategy(blob_tracker, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Strategy(object):
|
class Strategy:
|
||||||
"""
|
"""
|
||||||
Base for negotiation strategies
|
Base for negotiation strategies
|
||||||
"""
|
"""
|
||||||
|
@ -109,7 +109,7 @@ class BasicAvailabilityWeightedStrategy(Strategy):
|
||||||
base_price=0.0001, alpha=1.0):
|
base_price=0.0001, alpha=1.0):
|
||||||
price_model = MeanAvailabilityWeightedPrice(
|
price_model = MeanAvailabilityWeightedPrice(
|
||||||
blob_tracker, base_price=base_price, alpha=alpha)
|
blob_tracker, base_price=base_price, alpha=alpha)
|
||||||
Strategy.__init__(self, price_model, max_rate, min_rate, is_generous)
|
super().__init__(price_model, max_rate, min_rate, is_generous)
|
||||||
self._acceleration = Decimal(acceleration) # rate of how quickly to ramp offer
|
self._acceleration = Decimal(acceleration) # rate of how quickly to ramp offer
|
||||||
self._deceleration = Decimal(deceleration)
|
self._deceleration = Decimal(deceleration)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class OnlyFreeStrategy(Strategy):
|
||||||
implementer(INegotiationStrategy)
|
implementer(INegotiationStrategy)
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
price_model = ZeroPrice()
|
price_model = ZeroPrice()
|
||||||
Strategy.__init__(self, price_model, 0.0, 0.0, True)
|
super().__init__(price_model, 0.0, 0.0, True)
|
||||||
|
|
||||||
def _get_mean_rate(self, rates):
|
def _get_mean_rate(self, rates):
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
|
@ -12,7 +12,7 @@ from lbrynet.core.HTTPBlobDownloader import HTTPBlobDownloader
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class StreamDescriptorReader(object):
|
class StreamDescriptorReader:
|
||||||
"""Classes which derive from this class read a stream descriptor file return
|
"""Classes which derive from this class read a stream descriptor file return
|
||||||
a dictionary containing the fields in the file"""
|
a dictionary containing the fields in the file"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -33,7 +33,7 @@ class StreamDescriptorReader(object):
|
||||||
class PlainStreamDescriptorReader(StreamDescriptorReader):
|
class PlainStreamDescriptorReader(StreamDescriptorReader):
|
||||||
"""Read a stream descriptor file which is not a blob but a regular file"""
|
"""Read a stream descriptor file which is not a blob but a regular file"""
|
||||||
def __init__(self, stream_descriptor_filename):
|
def __init__(self, stream_descriptor_filename):
|
||||||
StreamDescriptorReader.__init__(self)
|
super().__init__()
|
||||||
self.stream_descriptor_filename = stream_descriptor_filename
|
self.stream_descriptor_filename = stream_descriptor_filename
|
||||||
|
|
||||||
def _get_raw_data(self):
|
def _get_raw_data(self):
|
||||||
|
@ -49,7 +49,7 @@ class PlainStreamDescriptorReader(StreamDescriptorReader):
|
||||||
class BlobStreamDescriptorReader(StreamDescriptorReader):
|
class BlobStreamDescriptorReader(StreamDescriptorReader):
|
||||||
"""Read a stream descriptor file which is a blob"""
|
"""Read a stream descriptor file which is a blob"""
|
||||||
def __init__(self, blob):
|
def __init__(self, blob):
|
||||||
StreamDescriptorReader.__init__(self)
|
super().__init__()
|
||||||
self.blob = blob
|
self.blob = blob
|
||||||
|
|
||||||
def _get_raw_data(self):
|
def _get_raw_data(self):
|
||||||
|
@ -76,7 +76,7 @@ def bytes2unicode(value):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
class StreamDescriptorWriter(object):
|
class StreamDescriptorWriter:
|
||||||
"""Classes which derive from this class write fields from a dictionary
|
"""Classes which derive from this class write fields from a dictionary
|
||||||
of fields to a stream descriptor"""
|
of fields to a stream descriptor"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -94,7 +94,7 @@ class StreamDescriptorWriter(object):
|
||||||
|
|
||||||
class PlainStreamDescriptorWriter(StreamDescriptorWriter):
|
class PlainStreamDescriptorWriter(StreamDescriptorWriter):
|
||||||
def __init__(self, sd_file_name):
|
def __init__(self, sd_file_name):
|
||||||
StreamDescriptorWriter.__init__(self)
|
super().__init__()
|
||||||
self.sd_file_name = sd_file_name
|
self.sd_file_name = sd_file_name
|
||||||
|
|
||||||
def _write_stream_descriptor(self, raw_data):
|
def _write_stream_descriptor(self, raw_data):
|
||||||
|
@ -110,7 +110,7 @@ class PlainStreamDescriptorWriter(StreamDescriptorWriter):
|
||||||
|
|
||||||
class BlobStreamDescriptorWriter(StreamDescriptorWriter):
|
class BlobStreamDescriptorWriter(StreamDescriptorWriter):
|
||||||
def __init__(self, blob_manager):
|
def __init__(self, blob_manager):
|
||||||
StreamDescriptorWriter.__init__(self)
|
super().__init__()
|
||||||
self.blob_manager = blob_manager
|
self.blob_manager = blob_manager
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -124,7 +124,7 @@ class BlobStreamDescriptorWriter(StreamDescriptorWriter):
|
||||||
defer.returnValue(sd_hash)
|
defer.returnValue(sd_hash)
|
||||||
|
|
||||||
|
|
||||||
class StreamMetadata(object):
|
class StreamMetadata:
|
||||||
FROM_BLOB = 1
|
FROM_BLOB = 1
|
||||||
FROM_PLAIN = 2
|
FROM_PLAIN = 2
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class StreamMetadata(object):
|
||||||
self.source_file = None
|
self.source_file = None
|
||||||
|
|
||||||
|
|
||||||
class StreamDescriptorIdentifier(object):
|
class StreamDescriptorIdentifier:
|
||||||
"""Tries to determine the type of stream described by the stream descriptor using the
|
"""Tries to determine the type of stream described by the stream descriptor using the
|
||||||
'stream_type' field. Keeps a list of StreamDescriptorValidators and StreamDownloaderFactorys
|
'stream_type' field. Keeps a list of StreamDescriptorValidators and StreamDownloaderFactorys
|
||||||
and returns the appropriate ones based on the type of the stream descriptor given
|
and returns the appropriate ones based on the type of the stream descriptor given
|
||||||
|
@ -407,7 +407,7 @@ def validate_descriptor(stream_info):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class EncryptedFileStreamDescriptorValidator(object):
|
class EncryptedFileStreamDescriptorValidator:
|
||||||
def __init__(self, raw_info):
|
def __init__(self, raw_info):
|
||||||
self.raw_info = raw_info
|
self.raw_info = raw_info
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ from lbrynet.core.Error import DownloadCanceledError, RequestCanceledError
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ReservedPoints(object):
|
class ReservedPoints:
|
||||||
def __init__(self, identifier, amount):
|
def __init__(self, identifier, amount):
|
||||||
self.identifier = identifier
|
self.identifier = identifier
|
||||||
self.amount = amount
|
self.amount = amount
|
||||||
|
@ -62,7 +62,7 @@ class ClaimOutpoint(dict):
|
||||||
return not self.__eq__(compare)
|
return not self.__eq__(compare)
|
||||||
|
|
||||||
|
|
||||||
class Wallet(object):
|
class Wallet:
|
||||||
"""This class implements the Wallet interface for the LBRYcrd payment system"""
|
"""This class implements the Wallet interface for the LBRYcrd payment system"""
|
||||||
implements(IWallet)
|
implements(IWallet)
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ class Wallet(object):
|
||||||
|
|
||||||
class LBRYumWallet(Wallet):
|
class LBRYumWallet(Wallet):
|
||||||
def __init__(self, storage, config=None):
|
def __init__(self, storage, config=None):
|
||||||
Wallet.__init__(self, storage)
|
super().__init__(storage)
|
||||||
self._config = config
|
self._config = config
|
||||||
self.config = make_config(self._config)
|
self.config = make_config(self._config)
|
||||||
self.network = None
|
self.network = None
|
||||||
|
@ -1228,7 +1228,7 @@ class LBRYumWallet(Wallet):
|
||||||
return not self.wallet.use_encryption
|
return not self.wallet.use_encryption
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressRequester(object):
|
class LBRYcrdAddressRequester:
|
||||||
implements([IRequestCreator])
|
implements([IRequestCreator])
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
|
@ -1266,7 +1266,7 @@ class LBRYcrdAddressRequester(object):
|
||||||
return err
|
return err
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressQueryHandlerFactory(object):
|
class LBRYcrdAddressQueryHandlerFactory:
|
||||||
implements(IQueryHandlerFactory)
|
implements(IQueryHandlerFactory)
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
|
@ -1285,7 +1285,7 @@ class LBRYcrdAddressQueryHandlerFactory(object):
|
||||||
return "LBRYcrd Address - an address for receiving payments via LBRYcrd"
|
return "LBRYcrd Address - an address for receiving payments via LBRYcrd"
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressQueryHandler(object):
|
class LBRYcrdAddressQueryHandler:
|
||||||
implements(IQueryHandler)
|
implements(IQueryHandler)
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
|
|
|
@ -8,7 +8,7 @@ DELAY_INCREMENT = 0.0001
|
||||||
QUEUE_SIZE_THRESHOLD = 100
|
QUEUE_SIZE_THRESHOLD = 100
|
||||||
|
|
||||||
|
|
||||||
class CallLaterManager(object):
|
class CallLaterManager:
|
||||||
def __init__(self, callLater):
|
def __init__(self, callLater):
|
||||||
"""
|
"""
|
||||||
:param callLater: (IReactorTime.callLater)
|
:param callLater: (IReactorTime.callLater)
|
||||||
|
|
|
@ -37,7 +37,7 @@ def cache(fn):
|
||||||
return helper
|
return helper
|
||||||
|
|
||||||
|
|
||||||
class BlobRequester(object):
|
class BlobRequester:
|
||||||
#implements(IRequestCreator)
|
#implements(IRequestCreator)
|
||||||
|
|
||||||
def __init__(self, blob_manager, peer_finder, payment_rate_manager, wallet, download_manager):
|
def __init__(self, blob_manager, peer_finder, payment_rate_manager, wallet, download_manager):
|
||||||
|
@ -193,7 +193,7 @@ class BlobRequester(object):
|
||||||
self._peers[peer] += amount
|
self._peers[peer] += amount
|
||||||
|
|
||||||
|
|
||||||
class RequestHelper(object):
|
class RequestHelper:
|
||||||
def __init__(self, requestor, peer, protocol, payment_rate_manager):
|
def __init__(self, requestor, peer, protocol, payment_rate_manager):
|
||||||
self.requestor = requestor
|
self.requestor = requestor
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
|
@ -427,7 +427,7 @@ class PriceRequest(RequestHelper):
|
||||||
class DownloadRequest(RequestHelper):
|
class DownloadRequest(RequestHelper):
|
||||||
"""Choose a blob and download it from a peer and also pay the peer for the data."""
|
"""Choose a blob and download it from a peer and also pay the peer for the data."""
|
||||||
def __init__(self, requester, peer, protocol, payment_rate_manager, wallet, head_blob_hash):
|
def __init__(self, requester, peer, protocol, payment_rate_manager, wallet, head_blob_hash):
|
||||||
RequestHelper.__init__(self, requester, peer, protocol, payment_rate_manager)
|
super().__init__(requester, peer, protocol, payment_rate_manager)
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
self.head_blob_hash = head_blob_hash
|
self.head_blob_hash = head_blob_hash
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ class DownloadRequest(RequestHelper):
|
||||||
return reason
|
return reason
|
||||||
|
|
||||||
|
|
||||||
class BlobDownloadDetails(object):
|
class BlobDownloadDetails:
|
||||||
"""Contains the information needed to make a ClientBlobRequest from an open blob"""
|
"""Contains the information needed to make a ClientBlobRequest from an open blob"""
|
||||||
def __init__(self, blob, deferred, write_func, cancel_func, peer):
|
def __init__(self, blob, deferred, write_func, cancel_func, peer):
|
||||||
self.blob = blob
|
self.blob = blob
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from lbrynet.blob.blob_file import MAX_BLOB_SIZE
|
from lbrynet.blob.blob_file import MAX_BLOB_SIZE
|
||||||
|
|
||||||
|
|
||||||
class ClientRequest(object):
|
class ClientRequest:
|
||||||
def __init__(self, request_dict, response_identifier=None):
|
def __init__(self, request_dict, response_identifier=None):
|
||||||
self.request_dict = request_dict
|
self.request_dict = request_dict
|
||||||
self.response_identifier = response_identifier
|
self.response_identifier = response_identifier
|
||||||
|
@ -9,7 +9,7 @@ class ClientRequest(object):
|
||||||
|
|
||||||
class ClientPaidRequest(ClientRequest):
|
class ClientPaidRequest(ClientRequest):
|
||||||
def __init__(self, request_dict, response_identifier, max_pay_units):
|
def __init__(self, request_dict, response_identifier, max_pay_units):
|
||||||
ClientRequest.__init__(self, request_dict, response_identifier)
|
super().__init__(request_dict, response_identifier)
|
||||||
self.max_pay_units = max_pay_units
|
self.max_pay_units = max_pay_units
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class ClientBlobRequest(ClientPaidRequest):
|
||||||
max_pay_units = MAX_BLOB_SIZE
|
max_pay_units = MAX_BLOB_SIZE
|
||||||
else:
|
else:
|
||||||
max_pay_units = blob.length
|
max_pay_units = blob.length
|
||||||
ClientPaidRequest.__init__(self, request_dict, response_identifier, max_pay_units)
|
super().__init__(request_dict, response_identifier, max_pay_units)
|
||||||
self.write = write_func
|
self.write = write_func
|
||||||
self.finished_deferred = finished_deferred
|
self.finished_deferred = finished_deferred
|
||||||
self.cancel = cancel_func
|
self.cancel = cancel_func
|
||||||
|
|
|
@ -9,14 +9,14 @@ from lbrynet.core import utils
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PeerConnectionHandler(object):
|
class PeerConnectionHandler:
|
||||||
def __init__(self, request_creators, factory):
|
def __init__(self, request_creators, factory):
|
||||||
self.request_creators = request_creators
|
self.request_creators = request_creators
|
||||||
self.factory = factory
|
self.factory = factory
|
||||||
self.connection = None
|
self.connection = None
|
||||||
|
|
||||||
|
|
||||||
class ConnectionManager(object):
|
class ConnectionManager:
|
||||||
#implements(interfaces.IConnectionManager)
|
#implements(interfaces.IConnectionManager)
|
||||||
MANAGE_CALL_INTERVAL_SEC = 5
|
MANAGE_CALL_INTERVAL_SEC = 5
|
||||||
TCP_CONNECT_TIMEOUT = 15
|
TCP_CONNECT_TIMEOUT = 15
|
||||||
|
|
|
@ -5,7 +5,7 @@ from twisted.internet import defer
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DownloadManager(object):
|
class DownloadManager:
|
||||||
#implements(interfaces.IDownloadManager)
|
#implements(interfaces.IDownloadManager)
|
||||||
|
|
||||||
def __init__(self, blob_manager):
|
def __init__(self, blob_manager):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from twisted.internet.task import LoopingCall
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SingleBlobMetadataHandler(object):
|
class SingleBlobMetadataHandler:
|
||||||
#implements(interfaces.IMetadataHandler)
|
#implements(interfaces.IMetadataHandler)
|
||||||
|
|
||||||
def __init__(self, blob_hash, download_manager):
|
def __init__(self, blob_hash, download_manager):
|
||||||
|
@ -29,7 +29,7 @@ class SingleBlobMetadataHandler(object):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class SingleProgressManager(object):
|
class SingleProgressManager:
|
||||||
def __init__(self, download_manager, finished_callback, timeout_callback, timeout):
|
def __init__(self, download_manager, finished_callback, timeout_callback, timeout):
|
||||||
self.finished_callback = finished_callback
|
self.finished_callback = finished_callback
|
||||||
self.timeout_callback = timeout_callback
|
self.timeout_callback = timeout_callback
|
||||||
|
@ -72,7 +72,7 @@ class SingleProgressManager(object):
|
||||||
return [b for b in blobs.values() if not b.get_is_verified()]
|
return [b for b in blobs.values() if not b.get_is_verified()]
|
||||||
|
|
||||||
|
|
||||||
class DummyBlobHandler(object):
|
class DummyBlobHandler:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class DummyBlobHandler(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class StandaloneBlobDownloader(object):
|
class StandaloneBlobDownloader:
|
||||||
def __init__(self, blob_hash, blob_manager, peer_finder,
|
def __init__(self, blob_hash, blob_manager, peer_finder,
|
||||||
rate_limiter, payment_rate_manager, wallet,
|
rate_limiter, payment_rate_manager, wallet,
|
||||||
timeout=None):
|
timeout=None):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from twisted.internet import defer
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class StreamProgressManager(object):
|
class StreamProgressManager:
|
||||||
#implements(IProgressManager)
|
#implements(IProgressManager)
|
||||||
|
|
||||||
def __init__(self, finished_callback, blob_manager,
|
def __init__(self, finished_callback, blob_manager,
|
||||||
|
@ -80,7 +80,7 @@ class StreamProgressManager(object):
|
||||||
class FullStreamProgressManager(StreamProgressManager):
|
class FullStreamProgressManager(StreamProgressManager):
|
||||||
def __init__(self, finished_callback, blob_manager,
|
def __init__(self, finished_callback, blob_manager,
|
||||||
download_manager, delete_blob_after_finished=False):
|
download_manager, delete_blob_after_finished=False):
|
||||||
StreamProgressManager.__init__(self, finished_callback, blob_manager, download_manager,
|
super().__init__(finished_callback, blob_manager, download_manager,
|
||||||
delete_blob_after_finished)
|
delete_blob_after_finished)
|
||||||
self.outputting_d = None
|
self.outputting_d = None
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from lbrynet.core import utils
|
||||||
|
|
||||||
class HTTPSHandler(logging.Handler):
|
class HTTPSHandler(logging.Handler):
|
||||||
def __init__(self, url, fqdn=False, localname=None, facility=None, cookies=None):
|
def __init__(self, url, fqdn=False, localname=None, facility=None, cookies=None):
|
||||||
logging.Handler.__init__(self)
|
super().__init__()
|
||||||
self.url = url
|
self.url = url
|
||||||
self.fqdn = fqdn
|
self.fqdn = fqdn
|
||||||
self.localname = localname
|
self.localname = localname
|
||||||
|
@ -243,7 +243,7 @@ def configure_twisted():
|
||||||
observer.start()
|
observer.start()
|
||||||
|
|
||||||
|
|
||||||
class LoggerNameFilter(object):
|
class LoggerNameFilter:
|
||||||
"""Filter a log record based on its name.
|
"""Filter a log record based on its name.
|
||||||
|
|
||||||
Allows all info level and higher records to pass thru.
|
Allows all info level and higher records to pass thru.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class LoopingCallManager(object):
|
class LoopingCallManager:
|
||||||
def __init__(self, calls=None):
|
def __init__(self, calls=None):
|
||||||
self.calls = calls or {}
|
self.calls = calls or {}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BlobAvailabilityHandlerFactory(object):
|
class BlobAvailabilityHandlerFactory:
|
||||||
implements(IQueryHandlerFactory)
|
implements(IQueryHandlerFactory)
|
||||||
|
|
||||||
def __init__(self, blob_manager):
|
def __init__(self, blob_manager):
|
||||||
|
@ -26,7 +26,7 @@ class BlobAvailabilityHandlerFactory(object):
|
||||||
return "Blob Availability - blobs that are available to be uploaded"
|
return "Blob Availability - blobs that are available to be uploaded"
|
||||||
|
|
||||||
|
|
||||||
class BlobAvailabilityHandler(object):
|
class BlobAvailabilityHandler:
|
||||||
implements(IQueryHandler)
|
implements(IQueryHandler)
|
||||||
|
|
||||||
def __init__(self, blob_manager):
|
def __init__(self, blob_manager):
|
||||||
|
|
|
@ -10,7 +10,7 @@ from lbrynet.core.Offer import Offer
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BlobRequestHandlerFactory(object):
|
class BlobRequestHandlerFactory:
|
||||||
#implements(IQueryHandlerFactory)
|
#implements(IQueryHandlerFactory)
|
||||||
|
|
||||||
def __init__(self, blob_manager, wallet, payment_rate_manager, analytics_manager):
|
def __init__(self, blob_manager, wallet, payment_rate_manager, analytics_manager):
|
||||||
|
@ -33,7 +33,7 @@ class BlobRequestHandlerFactory(object):
|
||||||
return "Blob Uploader - uploads blobs"
|
return "Blob Uploader - uploads blobs"
|
||||||
|
|
||||||
|
|
||||||
class BlobRequestHandler(object):
|
class BlobRequestHandler:
|
||||||
#implements(IQueryHandler, IBlobSender)
|
#implements(IQueryHandler, IBlobSender)
|
||||||
PAYMENT_RATE_QUERY = 'blob_data_payment_rate'
|
PAYMENT_RATE_QUERY = 'blob_data_payment_rate'
|
||||||
BLOB_QUERY = 'requested_blob'
|
BLOB_QUERY = 'requested_blob'
|
||||||
|
|
|
@ -6,7 +6,7 @@ from twisted.internet import defer
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ServerRequestHandler(object):
|
class ServerRequestHandler:
|
||||||
"""This class handles requests from clients. It can upload blobs and
|
"""This class handles requests from clients. It can upload blobs and
|
||||||
return request for information about more blobs that are
|
return request for information about more blobs that are
|
||||||
associated with streams.
|
associated with streams.
|
||||||
|
|
|
@ -155,7 +155,7 @@ def json_dumps_pretty(obj, **kwargs):
|
||||||
return json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': '), **kwargs)
|
return json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': '), **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class DeferredLockContextManager(object):
|
class DeferredLockContextManager:
|
||||||
def __init__(self, lock):
|
def __init__(self, lock):
|
||||||
self._lock = lock
|
self._lock = lock
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ def DeferredDict(d, consumeErrors=False):
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
|
|
||||||
class DeferredProfiler(object):
|
class DeferredProfiler:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.profile_results = {}
|
self.profile_results = {}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ backend = default_backend()
|
||||||
|
|
||||||
class CryptBlobInfo(BlobInfo):
|
class CryptBlobInfo(BlobInfo):
|
||||||
def __init__(self, blob_hash, blob_num, length, iv):
|
def __init__(self, blob_hash, blob_num, length, iv):
|
||||||
BlobInfo.__init__(self, blob_hash, blob_num, length)
|
super().__init__(blob_hash, blob_num, length)
|
||||||
self.iv = iv
|
self.iv = iv
|
||||||
|
|
||||||
def get_dict(self):
|
def get_dict(self):
|
||||||
|
@ -30,7 +30,7 @@ class CryptBlobInfo(BlobInfo):
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
class StreamBlobDecryptor(object):
|
class StreamBlobDecryptor:
|
||||||
def __init__(self, blob, key, iv, length):
|
def __init__(self, blob, key, iv, length):
|
||||||
"""
|
"""
|
||||||
This class decrypts blob
|
This class decrypts blob
|
||||||
|
@ -99,7 +99,7 @@ class StreamBlobDecryptor(object):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
class CryptStreamBlobMaker(object):
|
class CryptStreamBlobMaker:
|
||||||
def __init__(self, key, iv, blob_num, blob):
|
def __init__(self, key, iv, blob_num, blob):
|
||||||
"""
|
"""
|
||||||
This class encrypts data and writes it to a new blob
|
This class encrypts data and writes it to a new blob
|
||||||
|
|
|
@ -12,7 +12,7 @@ from lbrynet.cryptstream.CryptBlob import CryptStreamBlobMaker
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CryptStreamCreator(object):
|
class CryptStreamCreator:
|
||||||
"""
|
"""
|
||||||
Create a new stream with blobs encrypted by a symmetric cipher.
|
Create a new stream with blobs encrypted by a symmetric cipher.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from twisted.internet import defer
|
||||||
from lbrynet.cryptstream.CryptBlob import StreamBlobDecryptor
|
from lbrynet.cryptstream.CryptBlob import StreamBlobDecryptor
|
||||||
|
|
||||||
|
|
||||||
class CryptBlobHandler(object):
|
class CryptBlobHandler:
|
||||||
#implements(IBlobHandler)
|
#implements(IBlobHandler)
|
||||||
|
|
||||||
def __init__(self, key, write_func):
|
def __init__(self, key, write_func):
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CurrentlyStartingError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CryptStreamDownloader(object):
|
class CryptStreamDownloader:
|
||||||
|
|
||||||
#implements(IStreamDownloader)
|
#implements(IStreamDownloader)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ComponentType(type):
|
||||||
return klass
|
return klass
|
||||||
|
|
||||||
|
|
||||||
class Component(object, metaclass=ComponentType):
|
class Component(metaclass=ComponentType):
|
||||||
"""
|
"""
|
||||||
lbrynet-daemon component helper
|
lbrynet-daemon component helper
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ def get_wallet_config():
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
class ConfigSettings(object):
|
class ConfigSettings:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_conf_setting(setting_name):
|
def get_conf_setting(setting_name):
|
||||||
return conf.settings[setting_name]
|
return conf.settings[setting_name]
|
||||||
|
@ -101,7 +101,7 @@ class DatabaseComponent(Component):
|
||||||
component_name = DATABASE_COMPONENT
|
component_name = DATABASE_COMPONENT
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.storage = None
|
self.storage = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -306,7 +306,7 @@ class WalletComponent(Component):
|
||||||
depends_on = [DATABASE_COMPONENT, HEADERS_COMPONENT]
|
depends_on = [DATABASE_COMPONENT, HEADERS_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -329,6 +329,7 @@ class WalletComponent(Component):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def start(self):
|
def start(self):
|
||||||
|
log.info("Starting torba wallet")
|
||||||
storage = self.component_manager.get_component(DATABASE_COMPONENT)
|
storage = self.component_manager.get_component(DATABASE_COMPONENT)
|
||||||
lbryschema.BLOCKCHAIN_NAME = conf.settings['blockchain_name']
|
lbryschema.BLOCKCHAIN_NAME = conf.settings['blockchain_name']
|
||||||
self.wallet = LbryWalletManager.from_old_config(conf.settings)
|
self.wallet = LbryWalletManager.from_old_config(conf.settings)
|
||||||
|
@ -346,7 +347,7 @@ class BlobComponent(Component):
|
||||||
depends_on = [DATABASE_COMPONENT, DHT_COMPONENT]
|
depends_on = [DATABASE_COMPONENT, DHT_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.blob_manager = None
|
self.blob_manager = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -377,7 +378,7 @@ class DHTComponent(Component):
|
||||||
depends_on = [UPNP_COMPONENT]
|
depends_on = [UPNP_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.dht_node = None
|
self.dht_node = None
|
||||||
self.upnp_component = None
|
self.upnp_component = None
|
||||||
self.external_udp_port = None
|
self.external_udp_port = None
|
||||||
|
@ -427,7 +428,7 @@ class HashAnnouncerComponent(Component):
|
||||||
depends_on = [DHT_COMPONENT, DATABASE_COMPONENT]
|
depends_on = [DHT_COMPONENT, DATABASE_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.hash_announcer = None
|
self.hash_announcer = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -455,7 +456,7 @@ class RateLimiterComponent(Component):
|
||||||
component_name = RATE_LIMITER_COMPONENT
|
component_name = RATE_LIMITER_COMPONENT
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.rate_limiter = RateLimiter()
|
self.rate_limiter = RateLimiter()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -476,7 +477,7 @@ class StreamIdentifierComponent(Component):
|
||||||
depends_on = [DHT_COMPONENT, RATE_LIMITER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT, WALLET_COMPONENT]
|
depends_on = [DHT_COMPONENT, RATE_LIMITER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT, WALLET_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.sd_identifier = StreamDescriptorIdentifier()
|
self.sd_identifier = StreamDescriptorIdentifier()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -510,7 +511,7 @@ class PaymentRateComponent(Component):
|
||||||
component_name = PAYMENT_RATE_COMPONENT
|
component_name = PAYMENT_RATE_COMPONENT
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.payment_rate_manager = OnlyFreePaymentsManager()
|
self.payment_rate_manager = OnlyFreePaymentsManager()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -530,7 +531,7 @@ class FileManagerComponent(Component):
|
||||||
STREAM_IDENTIFIER_COMPONENT, PAYMENT_RATE_COMPONENT]
|
STREAM_IDENTIFIER_COMPONENT, PAYMENT_RATE_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.file_manager = None
|
self.file_manager = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -570,7 +571,7 @@ class PeerProtocolServerComponent(Component):
|
||||||
PAYMENT_RATE_COMPONENT]
|
PAYMENT_RATE_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.lbry_server_port = None
|
self.lbry_server_port = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -622,7 +623,7 @@ class ReflectorComponent(Component):
|
||||||
depends_on = [DHT_COMPONENT, BLOB_COMPONENT, FILE_MANAGER_COMPONENT]
|
depends_on = [DHT_COMPONENT, BLOB_COMPONENT, FILE_MANAGER_COMPONENT]
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self.reflector_server_port = GCS('reflector_port')
|
self.reflector_server_port = GCS('reflector_port')
|
||||||
self.reflector_server = None
|
self.reflector_server = None
|
||||||
|
|
||||||
|
@ -656,7 +657,7 @@ class UPnPComponent(Component):
|
||||||
component_name = UPNP_COMPONENT
|
component_name = UPNP_COMPONENT
|
||||||
|
|
||||||
def __init__(self, component_manager):
|
def __init__(self, component_manager):
|
||||||
Component.__init__(self, component_manager)
|
super().__init__(component_manager)
|
||||||
self._int_peer_port = GCS('peer_port')
|
self._int_peer_port = GCS('peer_port')
|
||||||
self._int_dht_node_port = GCS('dht_node_port')
|
self._int_dht_node_port = GCS('dht_node_port')
|
||||||
self.use_upnp = GCS('use_upnp')
|
self.use_upnp = GCS('use_upnp')
|
||||||
|
|
|
@ -77,8 +77,7 @@ DIRECTION_ASCENDING = 'asc'
|
||||||
DIRECTION_DESCENDING = 'desc'
|
DIRECTION_DESCENDING = 'desc'
|
||||||
DIRECTIONS = DIRECTION_ASCENDING, DIRECTION_DESCENDING
|
DIRECTIONS = DIRECTION_ASCENDING, DIRECTION_DESCENDING
|
||||||
|
|
||||||
|
class IterableContainer:
|
||||||
class IterableContainer(object):
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for attr in dir(self):
|
for attr in dir(self):
|
||||||
if not attr.startswith("_"):
|
if not attr.startswith("_"):
|
||||||
|
@ -91,7 +90,7 @@ class IterableContainer(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Checker(object):
|
class Checker:
|
||||||
"""The looping calls the daemon runs"""
|
"""The looping calls the daemon runs"""
|
||||||
INTERNET_CONNECTION = 'internet_connection_checker', 300
|
INTERNET_CONNECTION = 'internet_connection_checker', 300
|
||||||
# CONNECTION_STATUS = 'connection_status_checker'
|
# CONNECTION_STATUS = 'connection_status_checker'
|
||||||
|
@ -123,7 +122,7 @@ class NoValidSearch(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CheckInternetConnection(object):
|
class CheckInternetConnection:
|
||||||
def __init__(self, daemon):
|
def __init__(self, daemon):
|
||||||
self.daemon = daemon
|
self.daemon = daemon
|
||||||
|
|
||||||
|
@ -131,7 +130,7 @@ class CheckInternetConnection(object):
|
||||||
self.daemon.connected_to_internet = utils.check_connection()
|
self.daemon.connected_to_internet = utils.check_connection()
|
||||||
|
|
||||||
|
|
||||||
class AlwaysSend(object):
|
class AlwaysSend:
|
||||||
def __init__(self, value_generator, *args, **kwargs):
|
def __init__(self, value_generator, *args, **kwargs):
|
||||||
self.value_generator = value_generator
|
self.value_generator = value_generator
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
|
@ -29,7 +29,7 @@ STREAM_STAGES = [
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetStream(object):
|
class GetStream:
|
||||||
def __init__(self, sd_identifier, wallet, exchange_rate_manager, blob_manager, peer_finder, rate_limiter,
|
def __init__(self, sd_identifier, wallet, exchange_rate_manager, blob_manager, peer_finder, rate_limiter,
|
||||||
payment_rate_manager, storage, max_key_fee, disable_max_key_fee, data_rate=None, timeout=None):
|
payment_rate_manager, storage, max_key_fee, disable_max_key_fee, data_rate=None, timeout=None):
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ BITTREX_FEE = 0.0025
|
||||||
COINBASE_FEE = 0.0 # add fee
|
COINBASE_FEE = 0.0 # add fee
|
||||||
|
|
||||||
|
|
||||||
class ExchangeRate(object):
|
class ExchangeRate:
|
||||||
def __init__(self, market, spot, ts):
|
def __init__(self, market, spot, ts):
|
||||||
if not int(time.time()) - ts < 600:
|
if not int(time.time()) - ts < 600:
|
||||||
raise ValueError('The timestamp is too dated.')
|
raise ValueError('The timestamp is too dated.')
|
||||||
|
@ -34,7 +34,7 @@ class ExchangeRate(object):
|
||||||
return {'spot': self.spot, 'ts': self.ts}
|
return {'spot': self.spot, 'ts': self.ts}
|
||||||
|
|
||||||
|
|
||||||
class MarketFeed(object):
|
class MarketFeed:
|
||||||
REQUESTS_TIMEOUT = 20
|
REQUESTS_TIMEOUT = 20
|
||||||
EXCHANGE_RATE_UPDATE_RATE_SEC = 300
|
EXCHANGE_RATE_UPDATE_RATE_SEC = 300
|
||||||
|
|
||||||
|
@ -96,8 +96,7 @@ class MarketFeed(object):
|
||||||
|
|
||||||
class BittrexFeed(MarketFeed):
|
class BittrexFeed(MarketFeed):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
MarketFeed.__init__(
|
super().__init__(
|
||||||
self,
|
|
||||||
"BTCLBC",
|
"BTCLBC",
|
||||||
"Bittrex",
|
"Bittrex",
|
||||||
"https://bittrex.com/api/v1.1/public/getmarkethistory",
|
"https://bittrex.com/api/v1.1/public/getmarkethistory",
|
||||||
|
@ -122,8 +121,7 @@ class BittrexFeed(MarketFeed):
|
||||||
|
|
||||||
class LBRYioFeed(MarketFeed):
|
class LBRYioFeed(MarketFeed):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
MarketFeed.__init__(
|
super().__init__(
|
||||||
self,
|
|
||||||
"BTCLBC",
|
"BTCLBC",
|
||||||
"lbry.io",
|
"lbry.io",
|
||||||
"https://api.lbry.io/lbc/exchange_rate",
|
"https://api.lbry.io/lbc/exchange_rate",
|
||||||
|
@ -140,8 +138,7 @@ class LBRYioFeed(MarketFeed):
|
||||||
|
|
||||||
class LBRYioBTCFeed(MarketFeed):
|
class LBRYioBTCFeed(MarketFeed):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
MarketFeed.__init__(
|
super().__init__(
|
||||||
self,
|
|
||||||
"USDBTC",
|
"USDBTC",
|
||||||
"lbry.io",
|
"lbry.io",
|
||||||
"https://api.lbry.io/lbc/exchange_rate",
|
"https://api.lbry.io/lbc/exchange_rate",
|
||||||
|
@ -161,8 +158,7 @@ class LBRYioBTCFeed(MarketFeed):
|
||||||
|
|
||||||
class CryptonatorBTCFeed(MarketFeed):
|
class CryptonatorBTCFeed(MarketFeed):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
MarketFeed.__init__(
|
super().__init__(
|
||||||
self,
|
|
||||||
"USDBTC",
|
"USDBTC",
|
||||||
"cryptonator.com",
|
"cryptonator.com",
|
||||||
"https://api.cryptonator.com/api/ticker/usd-btc",
|
"https://api.cryptonator.com/api/ticker/usd-btc",
|
||||||
|
@ -183,8 +179,7 @@ class CryptonatorBTCFeed(MarketFeed):
|
||||||
|
|
||||||
class CryptonatorFeed(MarketFeed):
|
class CryptonatorFeed(MarketFeed):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
MarketFeed.__init__(
|
super().__init__(
|
||||||
self,
|
|
||||||
"BTCLBC",
|
"BTCLBC",
|
||||||
"cryptonator.com",
|
"cryptonator.com",
|
||||||
"https://api.cryptonator.com/api/ticker/btc-lbc",
|
"https://api.cryptonator.com/api/ticker/btc-lbc",
|
||||||
|
@ -203,7 +198,7 @@ class CryptonatorFeed(MarketFeed):
|
||||||
return defer.succeed(float(json_response['ticker']['price']))
|
return defer.succeed(float(json_response['ticker']['price']))
|
||||||
|
|
||||||
|
|
||||||
class ExchangeRateManager(object):
|
class ExchangeRateManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.market_feeds = [
|
self.market_feeds = [
|
||||||
LBRYioBTCFeed(),
|
LBRYioBTCFeed(),
|
||||||
|
|
|
@ -12,7 +12,7 @@ from lbrynet.wallet.account import get_certificate_lookup
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Publisher(object):
|
class Publisher:
|
||||||
def __init__(self, blob_manager, payment_rate_manager, storage, lbry_file_manager, wallet, certificate):
|
def __init__(self, blob_manager, payment_rate_manager, storage, lbry_file_manager, wallet, certificate):
|
||||||
self.blob_manager = blob_manager
|
self.blob_manager = blob_manager
|
||||||
self.payment_rate_manager = payment_rate_manager
|
self.payment_rate_manager = payment_rate_manager
|
||||||
|
|
|
@ -9,7 +9,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@implementer(portal.IRealm)
|
@implementer(portal.IRealm)
|
||||||
class HttpPasswordRealm(object):
|
class HttpPasswordRealm:
|
||||||
def __init__(self, resource):
|
def __init__(self, resource):
|
||||||
self.resource = resource
|
self.resource = resource
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class HttpPasswordRealm(object):
|
||||||
|
|
||||||
|
|
||||||
@implementer(checkers.ICredentialsChecker)
|
@implementer(checkers.ICredentialsChecker)
|
||||||
class PasswordChecker(object):
|
class PasswordChecker:
|
||||||
credentialInterfaces = (credentials.IUsernamePassword,)
|
credentialInterfaces = (credentials.IUsernamePassword,)
|
||||||
|
|
||||||
def __init__(self, passwords):
|
def __init__(self, passwords):
|
||||||
|
|
|
@ -23,11 +23,11 @@ def copy_cookies(cookies):
|
||||||
|
|
||||||
class JSONRPCException(Exception):
|
class JSONRPCException(Exception):
|
||||||
def __init__(self, rpc_error):
|
def __init__(self, rpc_error):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.error = rpc_error
|
self.error = rpc_error
|
||||||
|
|
||||||
|
|
||||||
class AuthAPIClient(object):
|
class AuthAPIClient:
|
||||||
def __init__(self, key, timeout, connection, count, cookies, url, login_url):
|
def __init__(self, key, timeout, connection, count, cookies, url, login_url):
|
||||||
self.__api_key = key
|
self.__api_key = key
|
||||||
self.__service_url = login_url
|
self.__service_url = login_url
|
||||||
|
@ -130,7 +130,7 @@ class AuthAPIClient(object):
|
||||||
return cls(api_key, timeout, conn, id_count, cookies, url, service_url)
|
return cls(api_key, timeout, conn, id_count, cookies, url, service_url)
|
||||||
|
|
||||||
|
|
||||||
class LBRYAPIClient(object):
|
class LBRYAPIClient:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_client():
|
def get_client():
|
||||||
if not conf.settings:
|
if not conf.settings:
|
||||||
|
|
|
@ -27,7 +27,7 @@ log = logging.getLogger(__name__)
|
||||||
EMPTY_PARAMS = [{}]
|
EMPTY_PARAMS = [{}]
|
||||||
|
|
||||||
|
|
||||||
class JSONRPCError(object):
|
class JSONRPCError:
|
||||||
# http://www.jsonrpc.org/specification#error_object
|
# http://www.jsonrpc.org/specification#error_object
|
||||||
CODE_PARSE_ERROR = -32700 # Invalid JSON. Error while parsing the JSON text.
|
CODE_PARSE_ERROR = -32700 # Invalid JSON. Error while parsing the JSON text.
|
||||||
CODE_INVALID_REQUEST = -32600 # The JSON sent is not a valid Request object.
|
CODE_INVALID_REQUEST = -32600 # The JSON sent is not a valid Request object.
|
||||||
|
@ -129,7 +129,7 @@ class JSONRPCServerType(type):
|
||||||
return klass
|
return klass
|
||||||
|
|
||||||
|
|
||||||
class AuthorizedBase(object, metaclass=JSONRPCServerType):
|
class AuthorizedBase(metaclass=JSONRPCServerType):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def deprecated(new_command=None):
|
def deprecated(new_command=None):
|
||||||
|
|
|
@ -24,7 +24,7 @@ def generate_key(x=None):
|
||||||
return sha(x)
|
return sha(x)
|
||||||
|
|
||||||
|
|
||||||
class APIKey(object):
|
class APIKey:
|
||||||
def __init__(self, secret, name, expiration=None):
|
def __init__(self, secret, name, expiration=None):
|
||||||
self.secret = secret
|
self.secret = secret
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
|
@ -85,11 +85,11 @@ def rerun_if_locked(f):
|
||||||
|
|
||||||
class SqliteConnection(adbapi.ConnectionPool):
|
class SqliteConnection(adbapi.ConnectionPool):
|
||||||
def __init__(self, db_path):
|
def __init__(self, db_path):
|
||||||
adbapi.ConnectionPool.__init__(self, 'sqlite3', db_path, check_same_thread=False)
|
super().__init__('sqlite3', db_path, check_same_thread=False)
|
||||||
|
|
||||||
@rerun_if_locked
|
@rerun_if_locked
|
||||||
def runInteraction(self, interaction, *args, **kw):
|
def runInteraction(self, interaction, *args, **kw):
|
||||||
return adbapi.ConnectionPool.runInteraction(self, interaction, *args, **kw)
|
return super().runInteraction(interaction, *args, **kw)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_reactor(cls, reactor):
|
def set_reactor(cls, reactor):
|
||||||
|
|
|
@ -13,7 +13,7 @@ def is_valid_ipv4(address):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class _Contact(object):
|
class _Contact:
|
||||||
""" Encapsulation for remote contact
|
""" Encapsulation for remote contact
|
||||||
|
|
||||||
This class contains information on a single remote contact, and also
|
This class contains information on a single remote contact, and also
|
||||||
|
@ -167,7 +167,7 @@ class _Contact(object):
|
||||||
return _sendRPC
|
return _sendRPC
|
||||||
|
|
||||||
|
|
||||||
class ContactManager(object):
|
class ContactManager:
|
||||||
def __init__(self, get_time=None):
|
def __init__(self, get_time=None):
|
||||||
if not get_time:
|
if not get_time:
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
|
@ -6,7 +6,7 @@ if sys.version_info > (3,):
|
||||||
long = int
|
long = int
|
||||||
|
|
||||||
|
|
||||||
class Distance(object):
|
class Distance:
|
||||||
"""Calculate the XOR result between two string variables.
|
"""Calculate the XOR result between two string variables.
|
||||||
|
|
||||||
Frequently we re-use one of the points so as an optimization
|
Frequently we re-use one of the points so as an optimization
|
||||||
|
|
|
@ -7,7 +7,7 @@ if sys.version_info > (3,):
|
||||||
else:
|
else:
|
||||||
raw = lambda x: x
|
raw = lambda x: x
|
||||||
|
|
||||||
class Encoding(object):
|
class Encoding:
|
||||||
""" Interface for RPC message encoders/decoders
|
""" Interface for RPC message encoders/decoders
|
||||||
|
|
||||||
All encoding implementations used with this library should inherit and
|
All encoding implementations used with this library should inherit and
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TimeoutError(Exception):
|
||||||
msg = 'Timeout connecting to {}'.format(binascii.hexlify(remote_contact_id))
|
msg = 'Timeout connecting to {}'.format(binascii.hexlify(remote_contact_id))
|
||||||
else:
|
else:
|
||||||
msg = 'Timeout connecting to uninitialized node'
|
msg = 'Timeout connecting to uninitialized node'
|
||||||
Exception.__init__(self, msg)
|
super().__init__(msg)
|
||||||
self.remote_contact_id = remote_contact_id
|
self.remote_contact_id = remote_contact_id
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from lbrynet import conf
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DHTHashAnnouncer(object):
|
class DHTHashAnnouncer:
|
||||||
def __init__(self, dht_node, storage, concurrent_announcers=None):
|
def __init__(self, dht_node, storage, concurrent_announcers=None):
|
||||||
self.dht_node = dht_node
|
self.dht_node = dht_node
|
||||||
self.storage = storage
|
self.storage = storage
|
||||||
|
|
|
@ -22,7 +22,7 @@ def expand_peer(compact_peer_info):
|
||||||
return (peer_node_id, host, port)
|
return (peer_node_id, host, port)
|
||||||
|
|
||||||
|
|
||||||
class _IterativeFind(object):
|
class _IterativeFind:
|
||||||
# TODO: use polymorphism to search for a value or node
|
# TODO: use polymorphism to search for a value or node
|
||||||
# instead of using a find_value flag
|
# instead of using a find_value flag
|
||||||
def __init__(self, node, shortlist, key, rpc, exclude=None):
|
def __init__(self, node, shortlist, key, rpc, exclude=None):
|
||||||
|
|
|
@ -11,7 +11,7 @@ if sys.version_info > (3,):
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class KBucket(object):
|
class KBucket:
|
||||||
""" Description - later
|
""" Description - later
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
from . import msgtypes
|
from . import msgtypes
|
||||||
|
|
||||||
|
|
||||||
class MessageTranslator(object):
|
class MessageTranslator:
|
||||||
""" Interface for RPC message translators/formatters
|
""" Interface for RPC message translators/formatters
|
||||||
|
|
||||||
Classes inheriting from this should provide a translation services between
|
Classes inheriting from this should provide a translation services between
|
||||||
|
|
|
@ -11,7 +11,7 @@ from lbrynet.core.utils import generate_id
|
||||||
from . import constants
|
from . import constants
|
||||||
|
|
||||||
|
|
||||||
class Message(object):
|
class Message:
|
||||||
""" Base class for messages - all "unknown" messages use this class """
|
""" Base class for messages - all "unknown" messages use this class """
|
||||||
|
|
||||||
def __init__(self, rpcID, nodeID):
|
def __init__(self, rpcID, nodeID):
|
||||||
|
@ -29,7 +29,7 @@ class RequestMessage(Message):
|
||||||
def __init__(self, nodeID, method, methodArgs, rpcID=None):
|
def __init__(self, nodeID, method, methodArgs, rpcID=None):
|
||||||
if rpcID is None:
|
if rpcID is None:
|
||||||
rpcID = generate_id()[:constants.rpc_id_length]
|
rpcID = generate_id()[:constants.rpc_id_length]
|
||||||
Message.__init__(self, rpcID, nodeID)
|
super().__init__(rpcID, nodeID)
|
||||||
self.request = method
|
self.request = method
|
||||||
self.args = methodArgs
|
self.args = methodArgs
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class ResponseMessage(Message):
|
||||||
""" Message containing the result from a successful RPC request """
|
""" Message containing the result from a successful RPC request """
|
||||||
|
|
||||||
def __init__(self, rpcID, nodeID, response):
|
def __init__(self, rpcID, nodeID, response):
|
||||||
Message.__init__(self, rpcID, nodeID)
|
super().__init__(rpcID, nodeID)
|
||||||
self.response = response
|
self.response = response
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class ErrorMessage(ResponseMessage):
|
||||||
""" Message containing the error from an unsuccessful RPC request """
|
""" Message containing the error from an unsuccessful RPC request """
|
||||||
|
|
||||||
def __init__(self, rpcID, nodeID, exceptionType, errorMessage):
|
def __init__(self, rpcID, nodeID, exceptionType, errorMessage):
|
||||||
ResponseMessage.__init__(self, rpcID, nodeID, errorMessage)
|
super().__init__(rpcID, nodeID, errorMessage)
|
||||||
if isinstance(exceptionType, type):
|
if isinstance(exceptionType, type):
|
||||||
exceptionType = ('%s.%s' % (exceptionType.__module__, exceptionType.__name__)).encode()
|
exceptionType = ('%s.%s' % (exceptionType.__module__, exceptionType.__name__)).encode()
|
||||||
self.exceptionType = exceptionType
|
self.exceptionType = exceptionType
|
||||||
|
|
|
@ -47,7 +47,7 @@ def rpcmethod(func):
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
||||||
class MockKademliaHelper(object):
|
class MockKademliaHelper:
|
||||||
def __init__(self, clock=None, callLater=None, resolve=None, listenUDP=None):
|
def __init__(self, clock=None, callLater=None, resolve=None, listenUDP=None):
|
||||||
if not listenUDP or not resolve or not callLater or not clock:
|
if not listenUDP or not resolve or not callLater or not clock:
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
@ -127,7 +127,7 @@ class Node(MockKademliaHelper):
|
||||||
@param peerPort: the port at which this node announces it has a blob for
|
@param peerPort: the port at which this node announces it has a blob for
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MockKademliaHelper.__init__(self, clock, callLater, resolve, listenUDP)
|
super().__init__(clock, callLater, resolve, listenUDP)
|
||||||
self.node_id = node_id or self._generateID()
|
self.node_id = node_id or self._generateID()
|
||||||
self.port = udpPort
|
self.port = udpPort
|
||||||
self._listen_interface = interface
|
self._listen_interface = interface
|
||||||
|
|
|
@ -8,7 +8,7 @@ from lbrynet import conf
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DummyPeerFinder(object):
|
class DummyPeerFinder:
|
||||||
"""This class finds peers which have announced to the DHT that they have certain blobs"""
|
"""This class finds peers which have announced to the DHT that they have certain blobs"""
|
||||||
|
|
||||||
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=True):
|
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=True):
|
||||||
|
|
|
@ -15,7 +15,7 @@ from . import msgformat
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PingQueue(object):
|
class PingQueue:
|
||||||
"""
|
"""
|
||||||
Schedules a 15 minute delayed ping after a new node sends us a query. This is so the new node gets added to the
|
Schedules a 15 minute delayed ping after a new node sends us a query. This is so the new node gets added to the
|
||||||
routing table after having been given enough time for a pinhole to expire.
|
routing table after having been given enough time for a pinhole to expire.
|
||||||
|
|
|
@ -16,7 +16,7 @@ import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TreeRoutingTable(object):
|
class TreeRoutingTable:
|
||||||
""" This class implements a routing table used by a Node class.
|
""" This class implements a routing table used by a Node class.
|
||||||
|
|
||||||
The Kademlia routing table is a binary tree whFose leaves are k-buckets,
|
The Kademlia routing table is a binary tree whFose leaves are k-buckets,
|
||||||
|
|
|
@ -24,7 +24,7 @@ class EncryptedFileStreamCreator(CryptStreamCreator):
|
||||||
|
|
||||||
def __init__(self, blob_manager, lbry_file_manager, stream_name=None,
|
def __init__(self, blob_manager, lbry_file_manager, stream_name=None,
|
||||||
key=None, iv_generator=None):
|
key=None, iv_generator=None):
|
||||||
CryptStreamCreator.__init__(self, blob_manager, stream_name, key, iv_generator)
|
super().__init__(blob_manager, stream_name, key, iv_generator)
|
||||||
self.lbry_file_manager = lbry_file_manager
|
self.lbry_file_manager = lbry_file_manager
|
||||||
self.stream_hash = None
|
self.stream_hash = None
|
||||||
self.blob_infos = []
|
self.blob_infos = []
|
||||||
|
|
|
@ -37,8 +37,8 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
||||||
def __init__(self, rowid, stream_hash, peer_finder, rate_limiter, blob_manager, storage, lbry_file_manager,
|
def __init__(self, rowid, stream_hash, peer_finder, rate_limiter, blob_manager, storage, lbry_file_manager,
|
||||||
payment_rate_manager, wallet, download_directory, file_name, stream_name, sd_hash, key,
|
payment_rate_manager, wallet, download_directory, file_name, stream_name, sd_hash, key,
|
||||||
suggested_file_name, download_mirrors=None):
|
suggested_file_name, download_mirrors=None):
|
||||||
EncryptedFileSaver.__init__(
|
super().__init__(
|
||||||
self, stream_hash, peer_finder, rate_limiter, blob_manager, storage, payment_rate_manager, wallet,
|
stream_hash, peer_finder, rate_limiter, blob_manager, storage, payment_rate_manager, wallet,
|
||||||
download_directory, key, stream_name, file_name
|
download_directory, key, stream_name, file_name
|
||||||
)
|
)
|
||||||
self.sd_hash = sd_hash
|
self.sd_hash = sd_hash
|
||||||
|
@ -160,7 +160,7 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
||||||
self.blob_manager, download_manager)
|
self.blob_manager, download_manager)
|
||||||
|
|
||||||
|
|
||||||
class ManagedEncryptedFileDownloaderFactory(object):
|
class ManagedEncryptedFileDownloaderFactory:
|
||||||
#implements(IStreamDownloaderFactory)
|
#implements(IStreamDownloaderFactory)
|
||||||
|
|
||||||
def __init__(self, lbry_file_manager, blob_manager):
|
def __init__(self, lbry_file_manager, blob_manager):
|
||||||
|
|
|
@ -19,7 +19,7 @@ from lbrynet import conf
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EncryptedFileManager(object):
|
class EncryptedFileManager:
|
||||||
"""
|
"""
|
||||||
Keeps track of currently opened LBRY Files, their options, and
|
Keeps track of currently opened LBRY Files, their options, and
|
||||||
their LBRY File specific metadata.
|
their LBRY File specific metadata.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class EncryptedFileStatusReport(object):
|
class EncryptedFileStatusReport:
|
||||||
def __init__(self, name, num_completed, num_known, running_status):
|
def __init__(self, name, num_completed, num_known, running_status):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.num_completed = num_completed
|
self.num_completed = num_completed
|
||||||
|
|
|
@ -18,7 +18,7 @@ class EncryptedFileDownloader(CryptStreamDownloader):
|
||||||
|
|
||||||
def __init__(self, stream_hash, peer_finder, rate_limiter, blob_manager,
|
def __init__(self, stream_hash, peer_finder, rate_limiter, blob_manager,
|
||||||
storage, payment_rate_manager, wallet, key, stream_name, file_name):
|
storage, payment_rate_manager, wallet, key, stream_name, file_name):
|
||||||
CryptStreamDownloader.__init__(self, peer_finder, rate_limiter, blob_manager,
|
super().__init__(peer_finder, rate_limiter, blob_manager,
|
||||||
payment_rate_manager, wallet, key, stream_name)
|
payment_rate_manager, wallet, key, stream_name)
|
||||||
self.stream_hash = stream_hash
|
self.stream_hash = stream_hash
|
||||||
self.storage = storage
|
self.storage = storage
|
||||||
|
@ -87,7 +87,7 @@ class EncryptedFileDownloader(CryptStreamDownloader):
|
||||||
self.storage, download_manager)
|
self.storage, download_manager)
|
||||||
|
|
||||||
|
|
||||||
class EncryptedFileDownloaderFactory(object):
|
class EncryptedFileDownloaderFactory:
|
||||||
#implements(IStreamDownloaderFactory)
|
#implements(IStreamDownloaderFactory)
|
||||||
|
|
||||||
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet):
|
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet):
|
||||||
|
@ -125,7 +125,7 @@ class EncryptedFileDownloaderFactory(object):
|
||||||
class EncryptedFileSaver(EncryptedFileDownloader):
|
class EncryptedFileSaver(EncryptedFileDownloader):
|
||||||
def __init__(self, stream_hash, peer_finder, rate_limiter, blob_manager, storage, payment_rate_manager, wallet,
|
def __init__(self, stream_hash, peer_finder, rate_limiter, blob_manager, storage, payment_rate_manager, wallet,
|
||||||
download_directory, key, stream_name, file_name):
|
download_directory, key, stream_name, file_name):
|
||||||
EncryptedFileDownloader.__init__(self, stream_hash, peer_finder, rate_limiter,
|
super().__init__(stream_hash, peer_finder, rate_limiter,
|
||||||
blob_manager, storage, payment_rate_manager,
|
blob_manager, storage, payment_rate_manager,
|
||||||
wallet, key, stream_name, file_name)
|
wallet, key, stream_name, file_name)
|
||||||
self.download_directory = binascii.unhexlify(download_directory)
|
self.download_directory = binascii.unhexlify(download_directory)
|
||||||
|
@ -180,7 +180,7 @@ class EncryptedFileSaver(EncryptedFileDownloader):
|
||||||
|
|
||||||
class EncryptedFileSaverFactory(EncryptedFileDownloaderFactory):
|
class EncryptedFileSaverFactory(EncryptedFileDownloaderFactory):
|
||||||
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet, download_directory):
|
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet, download_directory):
|
||||||
EncryptedFileDownloaderFactory.__init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet)
|
super().__init__(peer_finder, rate_limiter, blob_manager, storage, wallet)
|
||||||
self.download_directory = binascii.hexlify(download_directory.encode())
|
self.download_directory = binascii.hexlify(download_directory.encode())
|
||||||
|
|
||||||
def _make_downloader(self, stream_hash, payment_rate_manager, stream_info):
|
def _make_downloader(self, stream_hash, payment_rate_manager, stream_info):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from twisted.internet import defer
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EncryptedFileMetadataHandler(object):
|
class EncryptedFileMetadataHandler:
|
||||||
|
|
||||||
def __init__(self, stream_hash, storage, download_manager):
|
def __init__(self, stream_hash, storage, download_manager):
|
||||||
self.stream_hash = stream_hash
|
self.stream_hash = stream_hash
|
||||||
|
|
|
@ -8,7 +8,7 @@ def add_lbry_file_to_sd_identifier(sd_identifier):
|
||||||
EncryptedFileOptions())
|
EncryptedFileOptions())
|
||||||
|
|
||||||
|
|
||||||
class EncryptedFileOptions(object):
|
class EncryptedFileOptions:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ def get_certificate_lookup(tx_or_hash, nout):
|
||||||
class Account(BaseAccount):
|
class Account(BaseAccount):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Account, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.certificates = {}
|
self.certificates = {}
|
||||||
|
|
||||||
def add_certificate_private_key(self, tx_or_hash, nout, private_key):
|
def add_certificate_private_key(self, tx_or_hash, nout, private_key):
|
||||||
|
@ -73,20 +73,20 @@ class Account(BaseAccount):
|
||||||
def get_balance(self, confirmations=6, include_claims=False, **constraints):
|
def get_balance(self, confirmations=6, include_claims=False, **constraints):
|
||||||
if not include_claims:
|
if not include_claims:
|
||||||
constraints.update({'is_claim': 0, 'is_update': 0, 'is_support': 0})
|
constraints.update({'is_claim': 0, 'is_update': 0, 'is_support': 0})
|
||||||
return super(Account, self).get_balance(confirmations, **constraints)
|
return super().get_balance(confirmations, **constraints)
|
||||||
|
|
||||||
def get_unspent_outputs(self, include_claims=False, **constraints):
|
def get_unspent_outputs(self, include_claims=False, **constraints):
|
||||||
if not include_claims:
|
if not include_claims:
|
||||||
constraints.update({'is_claim': 0, 'is_update': 0, 'is_support': 0})
|
constraints.update({'is_claim': 0, 'is_update': 0, 'is_support': 0})
|
||||||
return super(Account, self).get_unspent_outputs(**constraints)
|
return super().get_unspent_outputs(**constraints)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, ledger, d): # type: (torba.baseledger.BaseLedger, Dict) -> BaseAccount
|
def from_dict(cls, ledger, d): # type: (torba.baseledger.BaseLedger, Dict) -> BaseAccount
|
||||||
account = super(Account, cls).from_dict(ledger, d)
|
account = super().from_dict(ledger, d)
|
||||||
account.certificates = d['certificates']
|
account.certificates = d['certificates']
|
||||||
return account
|
return account
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
d = super(Account, self).to_dict()
|
d = super().to_dict()
|
||||||
d['certificates'] = self.certificates
|
d['certificates'] = self.certificates
|
||||||
return d
|
return d
|
||||||
|
|
|
@ -32,7 +32,7 @@ class WalletDatabase(BaseDatabase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def txo_to_row(self, tx, address, txo):
|
def txo_to_row(self, tx, address, txo):
|
||||||
row = super(WalletDatabase, self).txo_to_row(tx, address, txo)
|
row = super().txo_to_row(tx, address, txo)
|
||||||
row.update({
|
row.update({
|
||||||
'is_claim': txo.script.is_claim_name,
|
'is_claim': txo.script.is_claim_name,
|
||||||
'is_update': txo.script.is_update_claim,
|
'is_update': txo.script.is_update_claim,
|
||||||
|
|
|
@ -125,13 +125,13 @@ class MainNetLedger(BaseLedger):
|
||||||
default_fee_per_name_char = 200000
|
default_fee_per_name_char = 200000
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(MainNetLedger, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fee_per_name_char = self.config.get('fee_per_name_char', self.default_fee_per_name_char)
|
self.fee_per_name_char = self.config.get('fee_per_name_char', self.default_fee_per_name_char)
|
||||||
|
|
||||||
def get_transaction_base_fee(self, tx):
|
def get_transaction_base_fee(self, tx):
|
||||||
""" Fee for the transaction header and all outputs; without inputs. """
|
""" Fee for the transaction header and all outputs; without inputs. """
|
||||||
return max(
|
return max(
|
||||||
super(MainNetLedger, self).get_transaction_base_fee(tx),
|
super().get_transaction_base_fee(tx),
|
||||||
self.get_transaction_claim_name_fee(tx)
|
self.get_transaction_claim_name_fee(tx)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ class MainNetLedger(BaseLedger):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def start(self):
|
def start(self):
|
||||||
yield super(MainNetLedger, self).start()
|
yield super().start()
|
||||||
yield defer.DeferredList([
|
yield defer.DeferredList([
|
||||||
a.maybe_migrate_certificates() for a in self.accounts
|
a.maybe_migrate_certificates() for a in self.accounts
|
||||||
])
|
])
|
||||||
|
|
|
@ -20,7 +20,7 @@ if six.PY3:
|
||||||
buffer = memoryview
|
buffer = memoryview
|
||||||
|
|
||||||
|
|
||||||
class BackwardsCompatibleNetwork(object):
|
class BackwardsCompatibleNetwork:
|
||||||
def __init__(self, manager):
|
def __init__(self, manager):
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
|
||||||
|
@ -232,19 +232,19 @@ class LbryWalletManager(BaseWalletManager):
|
||||||
wallet.save()
|
wallet.save()
|
||||||
|
|
||||||
|
|
||||||
class ReservedPoints(object):
|
class ReservedPoints:
|
||||||
def __init__(self, identifier, amount):
|
def __init__(self, identifier, amount):
|
||||||
self.identifier = identifier
|
self.identifier = identifier
|
||||||
self.amount = amount
|
self.amount = amount
|
||||||
|
|
||||||
|
|
||||||
class ClientRequest(object):
|
class ClientRequest:
|
||||||
def __init__(self, request_dict, response_identifier=None):
|
def __init__(self, request_dict, response_identifier=None):
|
||||||
self.request_dict = request_dict
|
self.request_dict = request_dict
|
||||||
self.response_identifier = response_identifier
|
self.response_identifier = response_identifier
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressRequester(object):
|
class LBRYcrdAddressRequester:
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
@ -277,7 +277,7 @@ class LBRYcrdAddressRequester(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressQueryHandlerFactory(object):
|
class LBRYcrdAddressQueryHandlerFactory:
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
@ -293,7 +293,7 @@ class LBRYcrdAddressQueryHandlerFactory(object):
|
||||||
return "LBRYcrd Address - an address for receiving payments via LBRYcrd"
|
return "LBRYcrd Address - an address for receiving payments via LBRYcrd"
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressQueryHandler(object):
|
class LBRYcrdAddressQueryHandler:
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
|
|
@ -16,7 +16,7 @@ from .claim_proofs import verify_proof, InvalidProofError
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Resolver(object):
|
class Resolver:
|
||||||
|
|
||||||
def __init__(self, claim_trie_root, height, transaction_class, hash160_to_address, network):
|
def __init__(self, claim_trie_root, height, transaction_class, hash160_to_address, network):
|
||||||
self.claim_trie_root = claim_trie_root
|
self.claim_trie_root = claim_trie_root
|
||||||
|
|
|
@ -14,14 +14,14 @@ class GUID(ctypes.Structure):
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, uuid_):
|
def __init__(self, uuid_):
|
||||||
ctypes.Structure.__init__(self)
|
super().__init__()
|
||||||
self.Data1, self.Data2, self.Data3, self.Data4[0], self.Data4[1], rest = uuid_.fields
|
self.Data1, self.Data2, self.Data3, self.Data4[0], self.Data4[1], rest = uuid_.fields
|
||||||
for i in range(2, 8):
|
for i in range(2, 8):
|
||||||
self.Data4[i] = rest>>(8 - i - 1)*8 & 0xff
|
self.Data4[i] = rest>>(8 - i - 1)*8 & 0xff
|
||||||
|
|
||||||
|
|
||||||
# http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457.aspx
|
# http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457.aspx
|
||||||
class FOLDERID(object):
|
class FOLDERID:
|
||||||
# pylint: disable=bad-whitespace
|
# pylint: disable=bad-whitespace
|
||||||
AccountPictures = UUID('{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}')
|
AccountPictures = UUID('{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}')
|
||||||
AdminTools = UUID('{724EF170-A42D-4FEF-9F26-B60E846FBA4F}')
|
AdminTools = UUID('{724EF170-A42D-4FEF-9F26-B60E846FBA4F}')
|
||||||
|
@ -120,7 +120,7 @@ class FOLDERID(object):
|
||||||
|
|
||||||
|
|
||||||
# http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188.aspx
|
# http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188.aspx
|
||||||
class UserHandle(object):
|
class UserHandle:
|
||||||
current = wintypes.HANDLE(0)
|
current = wintypes.HANDLE(0)
|
||||||
common = wintypes.HANDLE(-1)
|
common = wintypes.HANDLE(-1)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue