forked from LBRYCommunity/lbry-sdk
pylint and mypy fixes
This commit is contained in:
parent
2c5fd4aade
commit
e10f1df321
5 changed files with 13 additions and 20 deletions
|
@ -14,7 +14,7 @@ jobs:
|
||||||
- pip install -e .
|
- pip install -e .
|
||||||
script:
|
script:
|
||||||
- pylint --rcfile=setup.cfg torba
|
- pylint --rcfile=setup.cfg torba
|
||||||
- mypy torba
|
- mypy --ignore-missing-imports torba
|
||||||
after_success: skip
|
after_success: skip
|
||||||
|
|
||||||
- &tests
|
- &tests
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -12,7 +12,7 @@ setup(
|
||||||
description='Wallet library for bitcoin based currencies.',
|
description='Wallet library for bitcoin based currencies.',
|
||||||
keywords='wallet,crypto,currency,money,bitcoin,lbry',
|
keywords='wallet,crypto,currency,money,bitcoin,lbry',
|
||||||
classifiers=(
|
classifiers=(
|
||||||
'Framework :: Twisted',
|
'Framework :: AsyncIO',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'Intended Audience :: System Administrators',
|
'Intended Audience :: System Administrators',
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
|
@ -26,7 +26,8 @@ setup(
|
||||||
packages=find_packages(exclude=('tests',)),
|
packages=find_packages(exclude=('tests',)),
|
||||||
python_requires='>=3.6',
|
python_requires='>=3.6',
|
||||||
install_requires=(
|
install_requires=(
|
||||||
'twisted',
|
'aiorpcx',
|
||||||
|
'aiosqlite',
|
||||||
'coincurve',
|
'coincurve',
|
||||||
'pbkdf2',
|
'pbkdf2',
|
||||||
'cryptography'
|
'cryptography'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List, Union
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
|
@ -134,7 +134,8 @@ class SQLiteMixin:
|
||||||
return sql, values
|
return sql, values
|
||||||
|
|
||||||
@staticmethod
|
@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 = [], []
|
columns, values = [], []
|
||||||
for column, value in data.items():
|
for column, value in data.items():
|
||||||
columns.append("{} = ?".format(column))
|
columns.append("{} = ?".format(column))
|
||||||
|
@ -151,16 +152,6 @@ class SQLiteMixin:
|
||||||
log.debug(values)
|
log.debug(values)
|
||||||
return t.execute(sql, 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):
|
class BaseDatabase(SQLiteMixin):
|
||||||
|
|
||||||
|
@ -441,7 +432,8 @@ class BaseDatabase(SQLiteMixin):
|
||||||
"SELECT {} FROM pubkey_address".format(cols), **constraints
|
"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)
|
addresses = await self.select_addresses(', '.join(cols), **constraints)
|
||||||
return rows_to_dict(addresses, cols)
|
return rows_to_dict(addresses, cols)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue