pylint and mypy fixes

This commit is contained in:
Lex Berezhny 2018-10-15 00:04:25 -04:00
parent 2c5fd4aade
commit e10f1df321
5 changed files with 13 additions and 20 deletions

View file

@ -14,7 +14,7 @@ jobs:
- pip install -e .
script:
- pylint --rcfile=setup.cfg torba
- mypy torba
- mypy --ignore-missing-imports torba
after_success: skip
- &tests

View file

@ -12,7 +12,7 @@ setup(
description='Wallet library for bitcoin based currencies.',
keywords='wallet,crypto,currency,money,bitcoin,lbry',
classifiers=(
'Framework :: Twisted',
'Framework :: AsyncIO',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
@ -26,7 +26,8 @@ setup(
packages=find_packages(exclude=('tests',)),
python_requires='>=3.6',
install_requires=(
'twisted',
'aiorpcx',
'aiosqlite',
'coincurve',
'pbkdf2',
'cryptography'

View file

@ -1,5 +1,5 @@
import logging
from typing import Tuple, List
from typing import Tuple, List, Union
import sqlite3
import aiosqlite
@ -134,7 +134,8 @@ class SQLiteMixin:
return sql, values
@staticmethod
def _update_sql(table: str, data: dict, where: str, constraints: list) -> Tuple[str, list]:
def _update_sql(table: str, data: dict, where: str,
constraints: Union[list, tuple]) -> Tuple[str, list]:
columns, values = [], []
for column, value in data.items():
columns.append("{} = ?".format(column))
@ -151,16 +152,6 @@ class SQLiteMixin:
log.debug(values)
return t.execute(sql, values)
def run_operation(self, sql, values):
log.debug(sql)
log.debug(values)
return self.db.runOperation(sql, values)
def run_query(self, sql, values):
log.debug(sql)
log.debug(values)
return self.db.runQuery(sql, values)
class BaseDatabase(SQLiteMixin):
@ -441,7 +432,8 @@ class BaseDatabase(SQLiteMixin):
"SELECT {} FROM pubkey_address".format(cols), **constraints
))
async def get_addresses(self, cols=('address', 'account', 'chain', 'position', 'used_times'), **constraints):
async def get_addresses(self, cols=('address', 'account', 'chain', 'position', 'used_times'),
**constraints):
addresses = await self.select_addresses(', '.join(cols), **constraints)
return rows_to_dict(addresses, cols)