From a2f8e7068e152eebc3f599a29b5cb7f93fe66522 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 14 Feb 2020 13:23:33 -0300 Subject: [PATCH] pylint --- lbry/file/file_manager.py | 2 +- lbry/stream/managed_stream.py | 1 - lbry/stream/stream_manager.py | 20 ++++++++++---------- lbry/torrent/torrent_manager.py | 3 --- setup.cfg | 1 + 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lbry/file/file_manager.py b/lbry/file/file_manager.py index c8ef53be7..fb841f401 100644 --- a/lbry/file/file_manager.py +++ b/lbry/file/file_manager.py @@ -238,7 +238,7 @@ class FileManager: # TODO: analytics for torrents pass elif self.analytics_manager and (error or (stream and (stream.downloader.time_to_descriptor or - stream.downloader.time_to_first_bytes))): + stream.downloader.time_to_first_bytes))): server = self.wallet_manager.ledger.network.client.server self.loop.create_task( self.analytics_manager.send_time_to_first_bytes( diff --git a/lbry/stream/managed_stream.py b/lbry/stream/managed_stream.py index 8147b5a7a..7d87577a8 100644 --- a/lbry/stream/managed_stream.py +++ b/lbry/stream/managed_stream.py @@ -3,7 +3,6 @@ import asyncio import time import typing import logging -import binascii from typing import Optional from aiohttp.web import Request, StreamResponse, HTTPRequestRangeNotSatisfiable from lbry.error import DownloadSDTimeoutError diff --git a/lbry/stream/stream_manager.py b/lbry/stream/stream_manager.py index 84ef5b2a1..a120316cc 100644 --- a/lbry/stream/stream_manager.py +++ b/lbry/stream/stream_manager.py @@ -230,17 +230,17 @@ class StreamManager(SourceManager): self.reflect_stream(stream) return stream - async def delete(self, stream: ManagedStream, delete_file: Optional[bool] = False): - if stream.sd_hash in self.running_reflector_uploads: - self.running_reflector_uploads[stream.sd_hash].cancel() - stream.stop_tasks() - if stream.sd_hash in self.streams: - del self.streams[stream.sd_hash] - blob_hashes = [stream.sd_hash] + [b.blob_hash for b in stream.descriptor.blobs[:-1]] + async def delete(self, source: ManagedDownloadSource, delete_file: Optional[bool] = False): + if source.sd_hash in self.running_reflector_uploads: + self.running_reflector_uploads[source.sd_hash].cancel() + source.stop_tasks() + if source.sd_hash in self.streams: + del self.streams[source.sd_hash] + blob_hashes = [source.sd_hash] + [b.blob_hash for b in source.descriptor.blobs[:-1]] await self.blob_manager.delete_blobs(blob_hashes, delete_from_db=False) - await self.storage.delete_stream(stream.descriptor) - if delete_file and stream.output_file_exists: - os.remove(stream.full_path) + await self.storage.delete_stream(source.descriptor) + if delete_file and source.output_file_exists: + os.remove(source.full_path) async def stream_partial_content(self, request: Request, sd_hash: str): return await self._sources[sd_hash].stream_file(request, self.node) diff --git a/lbry/torrent/torrent_manager.py b/lbry/torrent/torrent_manager.py index c8f0f0b36..4868c2060 100644 --- a/lbry/torrent/torrent_manager.py +++ b/lbry/torrent/torrent_manager.py @@ -82,9 +82,6 @@ class TorrentManager(SourceManager): super().__init__(loop, config, storage, analytics_manager) self.torrent_session: 'TorrentSession' = torrent_session - def add(self, source: ManagedDownloadSource): - super().add(source) - async def recover_streams(self, file_infos: typing.List[typing.Dict]): raise NotImplementedError diff --git a/setup.cfg b/setup.cfg index c5d268dbb..8bad7f04e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,6 +12,7 @@ ignore_missing_imports = True [pylint] jobs=8 ignore=words,server,rpc,schema,winpaths.py,migrator,undecorated.py +extension-pkg-whitelist=libtorrent max-parents=10 max-args=10 max-line-length=120