diff --git a/.travis.yml b/.travis.yml index 5643f7d03..4705fd7ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ jobs: - stage: code quality name: "pylint lbrynet" install: - - pip install astroid==2.0.4 pylint + - pip install astroid pylint - pip install git+https://github.com/lbryio/torba.git#egg=torba - pip install -e . script: pylint lbrynet diff --git a/lbrynet/dht/serialization/datagram.py b/lbrynet/dht/serialization/datagram.py index 81aa1b132..2d2104ee3 100644 --- a/lbrynet/dht/serialization/datagram.py +++ b/lbrynet/dht/serialization/datagram.py @@ -67,8 +67,7 @@ class RequestDatagram(KademliaDatagramBase): def make_ping(cls, from_node_id: bytes, rpc_id: typing.Optional[bytes] = None) -> 'RequestDatagram': if rpc_id and len(rpc_id) != constants.rpc_id_length: raise ValueError("invalid rpc id length") - elif not rpc_id: - rpc_id = constants.generate_id()[:constants.rpc_id_length] + rpc_id = rpc_id or constants.generate_id()[:constants.rpc_id_length] if len(from_node_id) != constants.hash_bits // 8: raise ValueError("invalid node id") return cls(REQUEST_TYPE, rpc_id, from_node_id, b'ping') diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index f4e590e2b..c581169da 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -843,12 +843,12 @@ class Daemon(metaclass=JSONRPCServerType): amount = self.get_dewies_or_error("amount", amount) if not amount: raise NullFundsError - elif amount < 0: + if amount < 0: raise NegativeFundsError() if address and claim_id: raise Exception("Given both an address and a claim id") - elif not address and not claim_id: + if not address and not claim_id: raise Exception("Not given an address or a claim id") if address: @@ -1238,7 +1238,7 @@ class Daemon(metaclass=JSONRPCServerType): amount = self.get_dewies_or_error("amount", amount) if not amount: raise NullFundsError - elif amount < 0: + if amount < 0: raise NegativeFundsError() for address in addresses: diff --git a/lbrynet/extras/wallet/resolve.py b/lbrynet/extras/wallet/resolve.py index 1baadb265..69920a0cc 100644 --- a/lbrynet/extras/wallet/resolve.py +++ b/lbrynet/extras/wallet/resolve.py @@ -445,11 +445,11 @@ def _handle_claim_result(results): if results['error'] in ['name is not claimed', 'claim not found']: if 'claim_id' in results: raise UnknownClaimID(results['claim_id']) - elif 'name' in results: + if 'name' in results: raise UnknownNameError(results['name']) - elif 'uri' in results: + if 'uri' in results: raise UnknownURI(results['uri']) - elif 'outpoint' in results: + if 'outpoint' in results: raise UnknownOutpoint(results['outpoint']) raise Exception(results['error']) diff --git a/lbrynet/stream/stream_manager.py b/lbrynet/stream/stream_manager.py index 386f0902e..6b8b76ef9 100644 --- a/lbrynet/stream/stream_manager.py +++ b/lbrynet/stream/stream_manager.py @@ -434,12 +434,11 @@ class StreamManager: msg = f"fee of {fee_amount} exceeds max configured to allow of {max_fee_amount}" log.warning(msg) raise KeyFeeAboveMaxAllowed(msg) - else: - balance = await self.wallet.default_account.get_balance() - if lbc_to_dewies(str(fee_amount)) > balance: - msg = f"fee of {fee_amount} exceeds max available balance" - log.warning(msg) - raise InsufficientFundsError(msg) + balance = await self.wallet.default_account.get_balance() + if lbc_to_dewies(str(fee_amount)) > balance: + msg = f"fee of {fee_amount} exceeds max available balance" + log.warning(msg) + raise InsufficientFundsError(msg) fee_address = claim.source_fee.address.decode() outpoint = f"{resolved['txid']}:{resolved['nout']}" existing = self.get_filtered_streams(outpoint=outpoint) @@ -449,8 +448,7 @@ class StreamManager: if existing and existing[0].claim_id != resolved['claim_id']: raise Exception(f"stream for {existing[0].claim_id} collides with existing " f"download {resolved['claim_id']}") - elif not existing: - existing.extend(self.get_filtered_streams(claim_id=resolved['claim_id'])) + existing.extend(self.get_filtered_streams(claim_id=resolved['claim_id'])) if existing and existing[0].sd_hash != claim.source_hash.decode(): log.info("claim contains an update to a stream we have, downloading it") stream = await self.download_stream_from_claim( diff --git a/setup.py b/setup.py index f018358f7..5b193236e 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( 'console_scripts': 'lbrynet=lbrynet.extras.cli:main' }, install_requires=[ - 'aiohttp==3.4.4', + 'aiohttp==3.5.4', 'aioupnp', 'appdirs==1.4.3', 'colorama==0.3.7',