Merge pull request #1964 from lbryio/update-aiohttp

update aiohttp and pylint
This commit is contained in:
Jack Robison 2019-02-28 12:38:17 -05:00 committed by GitHub
commit 4fd2d994f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 18 deletions

View file

@ -9,7 +9,7 @@ jobs:
- stage: code quality - stage: code quality
name: "pylint lbrynet" name: "pylint lbrynet"
install: 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 git+https://github.com/lbryio/torba.git#egg=torba
- pip install -e . - pip install -e .
script: pylint lbrynet script: pylint lbrynet

View file

@ -67,8 +67,7 @@ class RequestDatagram(KademliaDatagramBase):
def make_ping(cls, from_node_id: bytes, rpc_id: typing.Optional[bytes] = None) -> 'RequestDatagram': 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: if rpc_id and len(rpc_id) != constants.rpc_id_length:
raise ValueError("invalid rpc id length") raise ValueError("invalid rpc id length")
elif not rpc_id: rpc_id = rpc_id or constants.generate_id()[:constants.rpc_id_length]
rpc_id = constants.generate_id()[:constants.rpc_id_length]
if len(from_node_id) != constants.hash_bits // 8: if len(from_node_id) != constants.hash_bits // 8:
raise ValueError("invalid node id") raise ValueError("invalid node id")
return cls(REQUEST_TYPE, rpc_id, from_node_id, b'ping') return cls(REQUEST_TYPE, rpc_id, from_node_id, b'ping')

View file

@ -843,12 +843,12 @@ class Daemon(metaclass=JSONRPCServerType):
amount = self.get_dewies_or_error("amount", amount) amount = self.get_dewies_or_error("amount", amount)
if not amount: if not amount:
raise NullFundsError raise NullFundsError
elif amount < 0: if amount < 0:
raise NegativeFundsError() raise NegativeFundsError()
if address and claim_id: if address and claim_id:
raise Exception("Given both an address and a 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") raise Exception("Not given an address or a claim id")
if address: if address:
@ -1238,7 +1238,7 @@ class Daemon(metaclass=JSONRPCServerType):
amount = self.get_dewies_or_error("amount", amount) amount = self.get_dewies_or_error("amount", amount)
if not amount: if not amount:
raise NullFundsError raise NullFundsError
elif amount < 0: if amount < 0:
raise NegativeFundsError() raise NegativeFundsError()
for address in addresses: for address in addresses:

View file

@ -445,11 +445,11 @@ def _handle_claim_result(results):
if results['error'] in ['name is not claimed', 'claim not found']: if results['error'] in ['name is not claimed', 'claim not found']:
if 'claim_id' in results: if 'claim_id' in results:
raise UnknownClaimID(results['claim_id']) raise UnknownClaimID(results['claim_id'])
elif 'name' in results: if 'name' in results:
raise UnknownNameError(results['name']) raise UnknownNameError(results['name'])
elif 'uri' in results: if 'uri' in results:
raise UnknownURI(results['uri']) raise UnknownURI(results['uri'])
elif 'outpoint' in results: if 'outpoint' in results:
raise UnknownOutpoint(results['outpoint']) raise UnknownOutpoint(results['outpoint'])
raise Exception(results['error']) raise Exception(results['error'])

View file

@ -434,12 +434,11 @@ class StreamManager:
msg = f"fee of {fee_amount} exceeds max configured to allow of {max_fee_amount}" msg = f"fee of {fee_amount} exceeds max configured to allow of {max_fee_amount}"
log.warning(msg) log.warning(msg)
raise KeyFeeAboveMaxAllowed(msg) raise KeyFeeAboveMaxAllowed(msg)
else: balance = await self.wallet.default_account.get_balance()
balance = await self.wallet.default_account.get_balance() if lbc_to_dewies(str(fee_amount)) > balance:
if lbc_to_dewies(str(fee_amount)) > balance: msg = f"fee of {fee_amount} exceeds max available balance"
msg = f"fee of {fee_amount} exceeds max available balance" log.warning(msg)
log.warning(msg) raise InsufficientFundsError(msg)
raise InsufficientFundsError(msg)
fee_address = claim.source_fee.address.decode() fee_address = claim.source_fee.address.decode()
outpoint = f"{resolved['txid']}:{resolved['nout']}" outpoint = f"{resolved['txid']}:{resolved['nout']}"
existing = self.get_filtered_streams(outpoint=outpoint) existing = self.get_filtered_streams(outpoint=outpoint)
@ -449,8 +448,7 @@ class StreamManager:
if existing and existing[0].claim_id != resolved['claim_id']: if existing and existing[0].claim_id != resolved['claim_id']:
raise Exception(f"stream for {existing[0].claim_id} collides with existing " raise Exception(f"stream for {existing[0].claim_id} collides with existing "
f"download {resolved['claim_id']}") 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(): if existing and existing[0].sd_hash != claim.source_hash.decode():
log.info("claim contains an update to a stream we have, downloading it") log.info("claim contains an update to a stream we have, downloading it")
stream = await self.download_stream_from_claim( stream = await self.download_stream_from_claim(

View file

@ -23,7 +23,7 @@ setup(
'console_scripts': 'lbrynet=lbrynet.extras.cli:main' 'console_scripts': 'lbrynet=lbrynet.extras.cli:main'
}, },
install_requires=[ install_requires=[
'aiohttp==3.4.4', 'aiohttp==3.5.4',
'aioupnp', 'aioupnp',
'appdirs==1.4.3', 'appdirs==1.4.3',
'colorama==0.3.7', 'colorama==0.3.7',