pylint fixes
This commit is contained in:
parent
a5ae77d568
commit
79c538d676
16 changed files with 26 additions and 88 deletions
|
|
@ -149,7 +149,7 @@ class AddrList(MMGenObject): # Address info for a single seed ID
|
|||
has_keys = False
|
||||
chksum_rec_f = lambda foo, e: (str(e.idx), e.addr.views[e.addr.view_pref])
|
||||
|
||||
def dmsg_sc(self, desc, data):
|
||||
def dmsg_sc(self, desc, data): # pylint: disable=method-hidden
|
||||
Msg(f'sc_debug_{desc}: {data}')
|
||||
|
||||
def noop(self, desc, data):
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ def write_data_to_file(
|
|||
msg('Redirecting output to file')
|
||||
|
||||
if binary and gc.platform == 'win32':
|
||||
import msvcrt
|
||||
import msvcrt # pylint: disable=import-error
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
|
||||
# MSWin workaround. See msg_r()
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class LEDControl:
|
|||
msg('\n')
|
||||
return
|
||||
|
||||
def set(self, state):
|
||||
def set(self, state): # pylint: disable=method-hidden
|
||||
lt = namedtuple('led_timings', ['on_secs', 'off_secs'])
|
||||
timings = {
|
||||
'off': lt(0, 0),
|
||||
|
|
@ -230,7 +230,7 @@ class LEDControl:
|
|||
|
||||
self.led_thread.start()
|
||||
|
||||
def stop(self):
|
||||
def stop(self): # pylint: disable=method-hidden
|
||||
|
||||
self.set('off')
|
||||
self.ev.set()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class Base(TxBase):
|
|||
|
||||
rel_fee_desc = 'gas price'
|
||||
rel_fee_disp = 'gas price in Gwei'
|
||||
txobj = None
|
||||
dfl_gas = 21000 # the startGas amt used in the transaction
|
||||
# for simple sends with no data, startGas = 21000
|
||||
contract_desc = 'contract'
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class TokenNew(TokenBase, New):
|
|||
if self.is_swap and (force or not hasattr(self, 'router_gas')):
|
||||
self.router_gas = (
|
||||
int(self.cfg.router_gas) if self.cfg.router_gas else
|
||||
self.txobj['router_gas'] if self.txobj else
|
||||
self.txobj['router_gas'] if hasattr(self, 'txobj') else
|
||||
self.dfl_router_gas)
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ match gc.platform:
|
|||
hold_protect_timeout = 2 if gc.platform == 'darwin' else 0.3
|
||||
case 'win32':
|
||||
try:
|
||||
import msvcrt
|
||||
import msvcrt # pylint: disable=import-error
|
||||
except:
|
||||
die(2, 'Unable to set terminal mode')
|
||||
if not sys.stdin.isatty():
|
||||
|
|
@ -304,3 +304,6 @@ def init_term(cfg, *, noecho=False):
|
|||
|
||||
def reset_term():
|
||||
get_term().reset()
|
||||
|
||||
# required by pylint:
|
||||
get_char = get_char_raw = kb_hold_protect = get_terminal_size = lambda *args, **kwargs: None
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class tool_cmd(tool_cmd_base):
|
|||
def unhexdump(self, infile: str):
|
||||
"decode hexdump from file (use '-' for stdin) (warning: outputs binary data)"
|
||||
if gc.platform == 'win32':
|
||||
import sys, msvcrt
|
||||
import sys, msvcrt # pylint: disable=import-error
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
from ..fileutil import get_data_from_file
|
||||
from ..util2 import decode_pretty_hexdump
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ def get_keccak(cfg=None, cached_ret=[]):
|
|||
from .contrib.keccak import keccak_256
|
||||
elif not (keccak_256 := get_hashlib_keccak()):
|
||||
load_cryptodome()
|
||||
from Crypto.Hash import keccak
|
||||
from Crypto.Hash import keccak # pylint: disable=import-error
|
||||
keccak_256 = lambda data: keccak.new(data=data, digest_bytes=32)
|
||||
cached_ret.append(keccak_256)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ from ... import xmrwallet
|
|||
|
||||
from .. import uarg_info
|
||||
|
||||
fmt_amt = hl_amt = lambda *args, **kwargs: None # pylint
|
||||
|
||||
class OpBase:
|
||||
|
||||
opts = ('wallet_dir',)
|
||||
|
|
|
|||
|
|
@ -84,86 +84,20 @@ errors-only = true
|
|||
jobs = 0
|
||||
ignore = [
|
||||
"data",
|
||||
"wordlist",
|
||||
"pyethereum",
|
||||
"rlp",
|
||||
"tx.py",
|
||||
]
|
||||
ignored-modules = [ # ignored for no-member, otherwise checked
|
||||
extension-pkg-allow-list = [
|
||||
"mmgen.proto.secp256k1.secp256k1",
|
||||
"mmgen.term",
|
||||
"msvcrt",
|
||||
"gmpy2",
|
||||
]
|
||||
|
||||
[tool.pylint."messages control"]
|
||||
disable = [
|
||||
"raw-checker-failed",
|
||||
"bad-inline-option",
|
||||
"locally-disabled",
|
||||
"file-ignored",
|
||||
"suppressed-message",
|
||||
"useless-suppression",
|
||||
"deprecated-pragma",
|
||||
"use-symbolic-message-instead",
|
||||
"use-implicit-booleaness-not-comparison-to-string",
|
||||
"use-implicit-booleaness-not-comparison-to-zero",
|
||||
"not-async-context-manager",
|
||||
# non-default:
|
||||
"no-method-argument",
|
||||
"no-self-argument",
|
||||
"function-redefined",
|
||||
"method-hidden",
|
||||
"possibly-used-before-assignment",
|
||||
"no-member",
|
||||
]
|
||||
|
||||
[tool.pylint.miscellaneous]
|
||||
notes = ["FIXME", "TODO", "DEBUG", "WIP"]
|
||||
|
||||
[tool.pylint.typecheck]
|
||||
mixin-class-rgx = """.*[Mm]ixin|\
|
||||
^(Hilite|InitErrors|DummyWIF|\
|
||||
cfg_file|cfg_file_sample|\
|
||||
MoneroMMGenFile|keygen_base|xmr_signable|\
|
||||
CmdTestShared|CmdTestSwapMethods|HTTPD|\
|
||||
RPC|TxProxyClient|Contract)$"""
|
||||
|
||||
ignored-classes = [ # ignored for no-member, otherwise checked
|
||||
"argparse.Namespace",
|
||||
"optparse.Values",
|
||||
"thread._local",
|
||||
"_thread._local",
|
||||
# mmgen:
|
||||
"baseconv",
|
||||
"deserialized_tx",
|
||||
"mmgen.autosign.Signable.base",
|
||||
"mmgen.autosign.Autosign", # tx_dir, etc. created dynamically
|
||||
"mmgen.rpc.local.RPCClient",
|
||||
"mmgen.proto.eth.tx.transaction.Transaction",
|
||||
"mmgen.proto.eth.tw.view.EthereumTwView",
|
||||
"mmgen.xmrwallet.file.MoneroMMGenTX.Base",
|
||||
"mmgen.xmrwallet.file.MoneroWalletOutputsFile.Base",
|
||||
"mmgen.xmrwallet.ops.sweep.OpSweep",
|
||||
"mmgen.xmrwallet.ops.wallet.OpWallet",
|
||||
"mmgen.xmrwallet.ops.label.OpLabel",
|
||||
"mmgen.xmrwallet.ops.new.OpNew",
|
||||
"mmgen.xmrwallet.ops.txview.OpTxview",
|
||||
"mmgen.xmrwallet.file.outputs.MoneroWalletOutputsFile.Base",
|
||||
"mmgen.xmrwallet.file.tx.MoneroMMGenTX.Base",
|
||||
"MMGenObjectDevTools",
|
||||
"MnemonicEntry",
|
||||
"MnEntryMode",
|
||||
"Sha2",
|
||||
"TwRPC",
|
||||
"TxInfo",
|
||||
# test suite:
|
||||
"CmdGroupMgr",
|
||||
"CmdTestEthBumpMethods",
|
||||
"CmdTestEthdevMethods",
|
||||
"CmdTestEthSwapMethods",
|
||||
"FFI_override",
|
||||
"GenTool",
|
||||
"Help",
|
||||
"Opts",
|
||||
"SwapMgrBase",
|
||||
"TestHashFunc",
|
||||
"VirtBlockDeviceBase",
|
||||
]
|
||||
notes = ["FIXME", "TODO", "DEBUG", "WIP", "NB"]
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from mmgen.color import red, blue, cyan, orange, purple, gray
|
|||
from mmgen.util import msg, suf, die, indent, fmt
|
||||
from mmgen.led import LEDControl
|
||||
from mmgen.autosign import Autosign
|
||||
from mmgen.autosign.signable import Signable
|
||||
from mmgen.autosign.signable import Signable # pylint: disable=no-name-in-module,import-error
|
||||
|
||||
from ..include.common import (
|
||||
omsg,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class ThornodeRPCServer(ThornodeServer):
|
|||
def get_account_info(m, length):
|
||||
return {
|
||||
'value': {
|
||||
'address': m[1],
|
||||
'address': m[1], # pylint: disable=unsubscriptable-object
|
||||
'pub_key': 'PubKeySecp256k1{0000}',
|
||||
'account_number': '1234',
|
||||
'sequence': '333444'}}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class CmdTestRunner:
|
|||
'PYTHONTRACEMALLOC': '10'})
|
||||
|
||||
if self.cfg.exact_output:
|
||||
from mmgen.term import get_terminal_size
|
||||
from mmgen.term import get_terminal_size # pylint: disable=no-name-in-module
|
||||
self.spawn_env['MMGEN_COLUMNS'] = str(get_terminal_size().width)
|
||||
else:
|
||||
self.spawn_env['MMGEN_COLUMNS'] = '120'
|
||||
|
|
|
|||
|
|
@ -486,12 +486,12 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
|
|||
if trunner is None:
|
||||
return
|
||||
|
||||
if self.proto.testnet:
|
||||
if self.proto.testnet: # pylint: disable=access-member-before-definition
|
||||
die(2, '--testnet and --regtest options incompatible with regtest test suite')
|
||||
|
||||
coin = self.coin
|
||||
|
||||
self.proto = init_proto(cfg, coin, network='regtest', need_amt=True)
|
||||
self.proto = init_proto(cfg, coin, network='regtest', need_amt=True) # redefinition
|
||||
|
||||
gldict = globals()
|
||||
for k, v in rt_data.items():
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ def parse_args():
|
|||
match cfg._args:
|
||||
case (gen1, rounds) if is_int(gen1) and is_int(rounds):
|
||||
test, dumpfile = ('speed', None)
|
||||
case (gen1, dumpfile) if is_int(gen1) and os.access(dumpfile, os.R_OK):
|
||||
case (gen1, dumpfile) if is_int(gen1) and os.access(dumpfile, os.R_OK): # pylint: disable=used-before-assignment
|
||||
test, rounds = ('dump', None)
|
||||
case (ab, rounds) if (ab := ab.split(':')) and is_int(rounds):
|
||||
test, dumpfile = ('ab', None)
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ class unit_tests:
|
|||
|
||||
def errors(self, name, ut, desc='reading transaction files (error handling)'):
|
||||
async def bad1():
|
||||
await CompletedTX(cfg, filename='foo')
|
||||
await CompletedTX(cfg, filename='foo') # pylint: disable=too-many-function-args
|
||||
def bad2():
|
||||
UnsignedTX(cfg, filename='foo')
|
||||
UnsignedTX(cfg, filename='foo') # pylint: disable=too-many-function-args
|
||||
bad_data = (
|
||||
('forbidden positional args', 'TypeError', 'positional arguments', bad1),
|
||||
('forbidden positional args', 'TypeError', 'positional arguments', bad2),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue