test: Fix lint issues.

This commit is contained in:
tecnovert 2023-08-01 15:57:01 +02:00
parent 547e50acb6
commit a13a5d4bf6
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 11 additions and 11 deletions

View file

@ -6069,7 +6069,7 @@ class BasicSwap(BaseApp):
with self.mxDB:
if 'debug' in data:
new_value = data['debug']
ensure(type(new_value) == bool, 'New debug value not boolean')
ensure(isinstance(new_value, bool), 'New debug value not boolean')
if settings_copy.get('debug', False) != new_value:
self.debug = new_value
settings_copy['debug'] = new_value
@ -6077,7 +6077,7 @@ class BasicSwap(BaseApp):
if 'debug_ui' in data:
new_value = data['debug_ui']
ensure(type(new_value) == bool, 'New debug_ui value not boolean')
ensure(isinstance(new_value, bool), 'New debug_ui value not boolean')
if settings_copy.get('debug_ui', False) != new_value:
self.debug_ui = new_value
settings_copy['debug_ui'] = new_value
@ -6085,7 +6085,7 @@ class BasicSwap(BaseApp):
if 'expire_db_records' in data:
new_value = data['expire_db_records']
ensure(type(new_value) == bool, 'New expire_db_records value not boolean')
ensure(isinstance(new_value, bool), 'New expire_db_records value not boolean')
if settings_copy.get('expire_db_records', False) != new_value:
self._expire_db_records = new_value
settings_copy['expire_db_records'] = new_value
@ -6093,14 +6093,14 @@ class BasicSwap(BaseApp):
if 'show_chart' in data:
new_value = data['show_chart']
ensure(type(new_value) == bool, 'New show_chart value not boolean')
ensure(isinstance(new_value, bool), 'New show_chart value not boolean')
if settings_copy.get('show_chart', True) != new_value:
settings_copy['show_chart'] = new_value
settings_changed = True
if 'chart_api_key' in data:
new_value = data['chart_api_key']
ensure(type(new_value) == str, 'New chart_api_key value not a string')
ensure(isinstance(new_value, bool), 'New chart_api_key value not a string')
ensure(len(new_value) <= 128, 'New chart_api_key value too long')
if all(c in string.hexdigits for c in new_value):
if settings_copy.get('chart_api_key', '') != new_value:

View file

@ -51,7 +51,7 @@ def getCoinType(coin_type_ind):
def validateAmountString(amount, ci):
if type(amount) != str:
if not isinstance(amount, str):
return
ar = amount.split('.')
if len(ar) > 1 and len(ar[1]) > ci.exp():

View file

@ -107,9 +107,9 @@ def float_to_str(f: float) -> str:
def make_int(v, scale: int = 8, r: int = 0) -> int: # r = 0, no rounding, fail, r > 0 round up, r < 0 floor
if type(v) == float:
if isinstance(v, float):
v = float_to_str(v)
elif type(v) == int:
elif isinstance(v, int):
return v * 10 ** scale
sign = 1
@ -145,7 +145,7 @@ def make_int(v, scale: int = 8, r: int = 0) -> int: # r = 0, no rounding, fail,
def validate_amount(amount, scale: int = 8) -> bool:
str_amount = float_to_str(amount) if type(amount) == float else str(amount)
str_amount = float_to_str(amount) if isinstance(amount, float) else str(amount)
has_decimal = False
for c in str_amount:
if c == '.' and not has_decimal:

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2022 tecnovert
# Copyright (c) 2020-2023 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE.txt or http://www.opensource.org/licenses/mit-license.php.
@ -135,7 +135,7 @@ def wait_for_bid(delay_event, swap_client, bid_id, state=None, sent: bool = Fals
assert (len(bids) < 2)
for bid in bids:
if bid[2] == bid_id:
if type(state) == list:
if isinstance(state, list):
if bid[5] in state:
return
else: