ci: enable more flake8 stuff
```
$ export ELECTRUM_LINTERS=E9,E101,E129,E273,E274,E703,E71,E722,F5,F6,F7,F8,W191,W29,B
$ export ELECTRUM_LINTERS_IGNORE=B007,B009,B010,B019,B036,F541,F841
$ flake8 . --count --select="$ELECTRUM_LINTERS" --ignore="$ELECTRUM_LINTERS_IGNORE" --show-source --statistics --exclude "*_pb2.py,electrum/_vendor/"
./electrum/commands.py:98:1: F811 redefinition of unused 'format_satoshis' from line 48
def format_satoshis(x):
^
./electrum/commands.py:437:9: F811 redefinition of unused 'Mnemonic' from line 62
from .mnemonic import Mnemonic
^
./electrum/gui/qt/wizard/wallet.py:37:5: F811 redefinition of unused 'Daemon' from line 14
from electrum.daemon import Daemon
^
./electrum/lntransport.py:14:1: F811 redefinition of unused 'Optional' from line 12
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
^
./electrum/lntransport.py:14:1: F811 redefinition of unused 'TYPE_CHECKING' from line 12
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
^
./electrum/plugin.py:966:13: F811 redefinition of unused 'hid' from line 593
import hid
^
./electrum/plugin.py:1040:13: F811 redefinition of unused 'hid' from line 593
import hid
^
./electrum/util.py:44:1: F811 redefinition of unused 'json' from line 26
import json
^
./electrum/util.py:46:1: F811 redefinition of unused 'NamedTuple' from line 29
from typing import NamedTuple, Optional
^
./electrum/util.py:46:1: F811 redefinition of unused 'Optional' from line 29
from typing import NamedTuple, Optional
^
./electrum/util.py:1456:56: F811 redefinition of unused 'traceback' from line 34
async def __aexit__(self, exc_type, exc_value, traceback):
^
./electrum/wallet_db.py:536:9: F811 redefinition of unused 'LOCAL' from line 46
LOCAL = 1
^
./electrum/wallet_db.py:537:9: F811 redefinition of unused 'REMOTE' from line 46
REMOTE = -1
^
./tests/test_bitcoin.py:28:1: F811 redefinition of unused 'bitcoin' from line 9
from electrum import crypto, constants, bitcoin
^
./tests/test_txbatcher.py:11:1: F811 redefinition of unused 'Transaction' from line 7
from electrum.transaction import Transaction, PartialTxInput, PartialTxOutput, TxOutpoint
^
./tests/test_wallet_vertical.py:20:1: F811 redefinition of unused 'Transaction' from line 10
from electrum.transaction import Transaction, PartialTxOutput, tx_from_any, Sighash
^
16 F811 redefinition of unused 'format_satoshis' from line 48
16
```
This commit is contained in:
@@ -45,7 +45,7 @@ from . import util
|
||||
from .lnmsg import OnionWireSerializer
|
||||
from .logging import Logger
|
||||
from .onion_message import create_blinded_path, send_onion_message_to
|
||||
from .util import (bfh, format_satoshis, json_decode, json_normalize, is_hash256_str, is_hex_str, to_bytes,
|
||||
from .util import (bfh, json_decode, json_normalize, is_hash256_str, is_hex_str, to_bytes,
|
||||
parse_max_spend, to_decimal, UserFacingException, InvalidPassword)
|
||||
|
||||
from . import bitcoin
|
||||
@@ -434,7 +434,6 @@ class Commands(Logger):
|
||||
arg:str:seed_type:The type of seed to create, e.g. 'standard' or 'segwit'
|
||||
arg:str:language:Default language for wordlist
|
||||
"""
|
||||
from .mnemonic import Mnemonic
|
||||
s = Mnemonic(language).make_seed(seed_type=seed_type, num_bits=nbits)
|
||||
return s
|
||||
|
||||
@@ -1156,7 +1155,7 @@ class Commands(Logger):
|
||||
if labels or balance:
|
||||
item = (item,)
|
||||
if balance:
|
||||
item += (format_satoshis(sum(wallet.get_addr_balance(addr))),)
|
||||
item += (util.format_satoshis(sum(wallet.get_addr_balance(addr))),)
|
||||
if labels:
|
||||
item += (repr(wallet.get_label_for_address(addr)),)
|
||||
out.append(item)
|
||||
|
||||
@@ -34,7 +34,6 @@ from electrum.gui.qt.util import (PasswordLineEdit, char_width_in_lineedit, WWLa
|
||||
if TYPE_CHECKING:
|
||||
from electrum.simple_config import SimpleConfig
|
||||
from electrum.plugin import Plugins
|
||||
from electrum.daemon import Daemon
|
||||
from electrum.gui.qt import QElectrumApplication
|
||||
|
||||
WIF_HELP_TEXT = (_('WIF keys are typed in Electrum, based on script type.') + '\n\n' +
|
||||
|
||||
@@ -9,7 +9,6 @@ import re
|
||||
import hashlib
|
||||
import asyncio
|
||||
from asyncio import StreamReader, StreamWriter
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from functools import cached_property
|
||||
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
|
||||
|
||||
|
||||
@@ -963,7 +963,7 @@ class DeviceMgr(ThreadJob):
|
||||
@runs_in_hwd_thread
|
||||
def _scan_devices_with_hid(self) -> List['Device']:
|
||||
try:
|
||||
import hid
|
||||
import hid # noqa: F811
|
||||
except ImportError:
|
||||
return []
|
||||
|
||||
@@ -1037,7 +1037,7 @@ class DeviceMgr(ThreadJob):
|
||||
ret["libusb.path"] = None
|
||||
# add hidapi
|
||||
try:
|
||||
import hid
|
||||
import hid # noqa: F811
|
||||
ret["hidapi.version"] = hid.__version__ # available starting with 0.12.0.post2
|
||||
except Exception as e:
|
||||
from importlib.metadata import version
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
import binascii
|
||||
import concurrent.futures
|
||||
import logging
|
||||
import os, sys, re, json
|
||||
import os, sys, re
|
||||
from collections import defaultdict, OrderedDict
|
||||
from concurrent.futures.process import ProcessPoolExecutor
|
||||
from typing import (NamedTuple, Union, TYPE_CHECKING, Tuple, Optional, Callable, Any,
|
||||
@@ -31,7 +31,6 @@ from typing import (NamedTuple, Union, TYPE_CHECKING, Tuple, Optional, Callable,
|
||||
from datetime import datetime, timezone
|
||||
import decimal
|
||||
from decimal import Decimal
|
||||
import traceback
|
||||
import urllib
|
||||
import threading
|
||||
import hmac
|
||||
@@ -43,7 +42,6 @@ import urllib.request, urllib.parse, urllib.error
|
||||
import builtins
|
||||
import json
|
||||
import time
|
||||
from typing import NamedTuple, Optional
|
||||
import ssl
|
||||
import ipaddress
|
||||
from ipaddress import IPv4Address, IPv6Address
|
||||
@@ -1453,9 +1451,9 @@ if hasattr(asyncio, 'timeout'): # python 3.11+
|
||||
async_timeout = asyncio.timeout
|
||||
else:
|
||||
class TimeoutAfterAsynciolike(aiorpcx.curio.TimeoutAfter):
|
||||
async def __aexit__(self, exc_type, exc_value, traceback):
|
||||
async def __aexit__(self, exc_type, exc_value, tb):
|
||||
try:
|
||||
await super().__aexit__(exc_type, exc_value, traceback)
|
||||
await super().__aexit__(exc_type, exc_value, tb)
|
||||
except (aiorpcx.TaskTimeout, aiorpcx.UncaughtTimeoutError):
|
||||
raise asyncio.TimeoutError from None
|
||||
except aiorpcx.TimeoutCancellationError:
|
||||
|
||||
@@ -43,7 +43,7 @@ from .keystore import bip44_derivation
|
||||
from .transaction import Transaction, TxOutpoint, tx_from_any, PartialTransaction, PartialTxOutput, BadHeaderMagic
|
||||
from .logging import Logger
|
||||
|
||||
from .lnutil import LOCAL, REMOTE, HTLCOwner, ChannelType
|
||||
from .lnutil import HTLCOwner, ChannelType
|
||||
from . import json_db
|
||||
from .json_db import StoredDict, JsonDB, locked, modifier, StoredObject, stored_in, stored_as
|
||||
from .plugin import run_hook, plugin_loaders
|
||||
|
||||
Reference in New Issue
Block a user