mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
pyproject.toml: Update ancient flake8
v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
3d841d5b8a
commit
7c3aa9477f
@ -31,6 +31,6 @@ class VersioningCheck(Check):
|
||||
"""
|
||||
def visit(self, f: model.Field) -> None:
|
||||
if not hasattr(f, "added"):
|
||||
raise ValueError(f"Field {f.path} is missing the `added` annotation")
|
||||
raise ValueError(f"Field {f.path} is missing the 'added' annotation")
|
||||
if not hasattr(f, "deprecated"):
|
||||
raise ValueError(f"Field {f.path} is missing the `deprecated` annotation")
|
||||
raise ValueError(f"Field {f.path} is missing the 'deprecated' annotation")
|
||||
|
@ -244,10 +244,12 @@ def gen_array(a, meta):
|
||||
if a.deprecated:
|
||||
defi += " #[deprecated]\n"
|
||||
defi += rename_if_necessary(alias, name)
|
||||
# Note: flake8 gets confused on these strings in f strings, hence suppression:
|
||||
# contrib/msggen/msggen/gen/rpc/rust.py:250:42: E226 missing whitespace around arithmetic operator
|
||||
if not a.optional:
|
||||
defi += f" pub {name}: {'Vec<'*a.dims}{itemtype}{'>'*a.dims},\n"
|
||||
defi += f" pub {name}: {'Vec<'*a.dims}{itemtype}{'>'*a.dims},\n" # noqa: E226
|
||||
else:
|
||||
defi += f" #[serde(skip_serializing_if = \"crate::is_none_or_empty\")]\n pub {name}: Option<{'Vec<'*a.dims}{itemtype}{'>'*a.dims}>,\n"
|
||||
defi += f" #[serde(skip_serializing_if = \"crate::is_none_or_empty\")]\n pub {name}: Option<{'Vec<'*a.dims}{itemtype}{'>'*a.dims}>,\n" # noqa: E226
|
||||
|
||||
return (defi, decl)
|
||||
|
||||
|
@ -96,7 +96,7 @@ class Request(dict):
|
||||
|
||||
def set_result(self, result: Any) -> None:
|
||||
if self.state != RequestState.PENDING:
|
||||
assert(self.termination_tb is not None)
|
||||
assert self.termination_tb is not None
|
||||
raise ValueError(
|
||||
"Cannot set the result of a request that is not pending, "
|
||||
"current state is {state}. Request previously terminated at\n"
|
||||
@ -112,7 +112,7 @@ class Request(dict):
|
||||
|
||||
def set_exception(self, exc: Union[Exception, RpcException]) -> None:
|
||||
if self.state != RequestState.PENDING:
|
||||
assert(self.termination_tb is not None)
|
||||
assert self.termination_tb is not None
|
||||
raise ValueError(
|
||||
"Cannot set the exception of a request that is not pending, "
|
||||
"current state is {state}. Request previously terminated at\n"
|
||||
@ -569,7 +569,7 @@ class Plugin(object):
|
||||
request: Request) -> inspect.BoundArguments:
|
||||
"""Positional binding of parameters
|
||||
"""
|
||||
assert(isinstance(params, list))
|
||||
assert isinstance(params, list)
|
||||
sig = inspect.signature(func)
|
||||
|
||||
# Collect injections so we can sort them and insert them in the right
|
||||
@ -595,7 +595,7 @@ class Plugin(object):
|
||||
request: Request) -> inspect.BoundArguments:
|
||||
"""Keyword based binding of parameters
|
||||
"""
|
||||
assert(isinstance(params, dict))
|
||||
assert isinstance(params, dict)
|
||||
sig = inspect.signature(func)
|
||||
|
||||
# Inject additional parameters if they are in the signature.
|
||||
|
@ -3,41 +3,41 @@ from pyln.client.clnutils import cln_parse_rpcversion
|
||||
|
||||
def test_rpcversion():
|
||||
foo = cln_parse_rpcversion("0.11.2")
|
||||
assert(foo[0] == 0)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 2)
|
||||
assert foo[0] == 0
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 2
|
||||
|
||||
foo = cln_parse_rpcversion("0.11.2rc2-modded")
|
||||
assert(foo[0] == 0)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 2)
|
||||
assert foo[0] == 0
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 2
|
||||
|
||||
foo = cln_parse_rpcversion("22.11")
|
||||
assert(foo[0] == 22)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 0)
|
||||
assert foo[0] == 22
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 0
|
||||
|
||||
foo = cln_parse_rpcversion("22.11rc1")
|
||||
assert(foo[0] == 22)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 0)
|
||||
assert foo[0] == 22
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 0
|
||||
|
||||
foo = cln_parse_rpcversion("22.11rc1-modded")
|
||||
assert(foo[0] == 22)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 0)
|
||||
assert foo[0] == 22
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 0
|
||||
|
||||
foo = cln_parse_rpcversion("22.11-modded")
|
||||
assert(foo[0] == 22)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 0)
|
||||
assert foo[0] == 22
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 0
|
||||
|
||||
foo = cln_parse_rpcversion("22.11.0")
|
||||
assert(foo[0] == 22)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 0)
|
||||
assert foo[0] == 22
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 0
|
||||
|
||||
foo = cln_parse_rpcversion("22.11.1")
|
||||
assert(foo[0] == 22)
|
||||
assert(foo[1] == 11)
|
||||
assert(foo[2] == 1)
|
||||
assert foo[0] == 22
|
||||
assert foo[1] == 11
|
||||
assert foo[2] == 1
|
||||
|
@ -58,7 +58,7 @@ def test_gossmap_halfchannel(tmp_path):
|
||||
l2id = "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
|
||||
|
||||
# check structure parsed correctly
|
||||
assert(len(g.nodes) == 2)
|
||||
assert len(g.nodes) == 2
|
||||
n1 = g.get_node(l1id)
|
||||
n2 = g.get_node(l2id)
|
||||
assert n1
|
||||
|
@ -38,7 +38,7 @@ class BitcoinRpcProxy(object):
|
||||
|
||||
# If we have set a mock for this method reply with that instead of
|
||||
# forwarding the request.
|
||||
if method in self.mocks and type(self.mocks[method]) == dict:
|
||||
if method in self.mocks and isinstance(self.mocks[method], dict):
|
||||
ret = {}
|
||||
ret['id'] = r['id']
|
||||
ret['error'] = None
|
||||
|
@ -1055,7 +1055,7 @@ class LightningNode(object):
|
||||
return addr in addrs
|
||||
|
||||
# We should not have funds on that address yet, we just generated it.
|
||||
assert(not has_funds_on_addr(addr))
|
||||
assert not has_funds_on_addr(addr)
|
||||
|
||||
self.bitcoin.rpc.sendtoaddress(addr, (amount + 1000000) / 10**8)
|
||||
self.bitcoin.generate_block(1)
|
||||
@ -1196,7 +1196,7 @@ class LightningNode(object):
|
||||
route = self.rpc.getroute(dst.info["id"], amt, riskfactor=0, fuzzpercent=0)
|
||||
self.rpc.sendpay(route["route"], invoice["payment_hash"], payment_secret=invoice.get('payment_secret'))
|
||||
result = self.rpc.waitsendpay(invoice["payment_hash"])
|
||||
assert(result.get('status') == 'complete')
|
||||
assert result.get('status') == 'complete'
|
||||
self.wait_for_htlcs()
|
||||
return
|
||||
|
||||
@ -1227,7 +1227,7 @@ class LightningNode(object):
|
||||
self.rpc.sendpay([routestep], rhash, payment_secret=psecret, bolt11=inv['bolt11'])
|
||||
# wait for sendpay to comply
|
||||
result = self.rpc.waitsendpay(rhash)
|
||||
assert(result.get('status') == 'complete')
|
||||
assert result.get('status') == 'complete'
|
||||
|
||||
# Make sure they're all settled, in case we quickly mine blocks!
|
||||
dst.wait_for_htlcs()
|
||||
@ -1304,11 +1304,11 @@ class LightningNode(object):
|
||||
# force new feerates by restarting and thus skipping slow smoothed process
|
||||
# Note: testnode must be created with: opts={'may_reconnect': True}
|
||||
def force_feerates(self, rate):
|
||||
assert(self.may_reconnect)
|
||||
assert self.may_reconnect
|
||||
self.set_feerates([rate] * 4, False)
|
||||
self.restart()
|
||||
self.daemon.wait_for_log('peer_out WIRE_UPDATE_FEE')
|
||||
assert(self.rpc.feerates('perkw')['perkw']['opening'] == rate)
|
||||
assert self.rpc.feerates('perkw')['perkw']['opening'] == rate
|
||||
|
||||
def wait_for_onchaind_txs(self, *args):
|
||||
"""Wait for onchaind to ask lightningd to create one or more txs. Each arg is a pair of typename, resolvename. Returns tuples of the rawtx, txid and number of blocks delay for each pair.
|
||||
|
48
poetry.lock
generated
48
poetry.lock
generated
@ -710,19 +710,19 @@ testing = ["hatch", "pre-commit", "pytest", "tox"]
|
||||
|
||||
[[package]]
|
||||
name = "flake8"
|
||||
version = "4.0.1"
|
||||
version = "6.1.0"
|
||||
description = "the modular source code checker: pep8 pyflakes and co"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
python-versions = ">=3.8.1"
|
||||
files = [
|
||||
{file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"},
|
||||
{file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"},
|
||||
{file = "flake8-6.1.0-py2.py3-none-any.whl", hash = "sha256:ffdfce58ea94c6580c77888a86506937f9a1a227dfcd15f245d694ae20a6b6e5"},
|
||||
{file = "flake8-6.1.0.tar.gz", hash = "sha256:d5b3857f07c030bdb5bf41c7f53799571d75c4491748a3adcd47de929e34cd23"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
mccabe = ">=0.6.0,<0.7.0"
|
||||
pycodestyle = ">=2.8.0,<2.9.0"
|
||||
pyflakes = ">=2.4.0,<2.5.0"
|
||||
mccabe = ">=0.7.0,<0.8.0"
|
||||
pycodestyle = ">=2.11.0,<2.12.0"
|
||||
pyflakes = ">=3.1.0,<3.2.0"
|
||||
|
||||
[[package]]
|
||||
name = "flaky"
|
||||
@ -1365,13 +1365,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "mccabe"
|
||||
version = "0.6.1"
|
||||
version = "0.7.0"
|
||||
description = "McCabe checker, plugin for flake8"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
python-versions = ">=3.6"
|
||||
files = [
|
||||
{file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"},
|
||||
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
|
||||
{file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"},
|
||||
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1626,13 +1626,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "pycodestyle"
|
||||
version = "2.8.0"
|
||||
version = "2.11.1"
|
||||
description = "Python style guide checker"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"},
|
||||
{file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"},
|
||||
{file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"},
|
||||
{file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1648,13 +1648,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "pyflakes"
|
||||
version = "2.4.0"
|
||||
version = "3.1.0"
|
||||
description = "passive checker of Python programs"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"},
|
||||
{file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"},
|
||||
{file = "pyflakes-3.1.0-py2.py3-none-any.whl", hash = "sha256:4132f6d49cb4dae6819e5379898f2b8cce3c5f23994194c24b77d5da2e36f774"},
|
||||
{file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1670,7 +1670,7 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "pyln-client"
|
||||
version = "24.05rc2"
|
||||
version = "24.05"
|
||||
description = "Client library and plugin library for Core Lightning"
|
||||
optional = false
|
||||
python-versions = "^3.8"
|
||||
@ -1704,7 +1704,7 @@ url = "contrib/pyln-grpc-proto"
|
||||
|
||||
[[package]]
|
||||
name = "pyln-proto"
|
||||
version = "24.05rc2"
|
||||
version = "24.05"
|
||||
description = "This package implements some of the Lightning Network protocol in pure python. It is intended for protocol testing and some minor tooling only. It is not deemed secure enough to handle any amount of real funds (you have been warned!)."
|
||||
optional = false
|
||||
python-versions = "^3.8"
|
||||
@ -1724,7 +1724,7 @@ url = "contrib/pyln-proto"
|
||||
|
||||
[[package]]
|
||||
name = "pyln-testing"
|
||||
version = "24.05rc2"
|
||||
version = "24.05"
|
||||
description = "Test your Core Lightning integration, plugins or whatever you want"
|
||||
optional = false
|
||||
python-versions = "^3.8"
|
||||
@ -2373,5 +2373,5 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "047f3455bfbc5ef70bf08134d205cae4b10dece2df2b737c65655449cc2f8fcd"
|
||||
python-versions = ">=3.8.1,<4.0"
|
||||
content-hash = "81b82db3ba9c112833eb1482277d4c8f81c3f92aed6440b3024c07c02255f271"
|
||||
|
@ -7,7 +7,7 @@ authors = ["Christian Decker <cdecker@blockstream.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
# Build dependencies belong here
|
||||
python = "^3.8"
|
||||
python = ">=3.8.1,<4.0"
|
||||
pyln-client = { path = "contrib/pyln-client", develop = true }
|
||||
pyln-proto = { path = "contrib/pyln-proto", develop = true }
|
||||
pyln-grpc-proto = { path = "contrib/pyln-grpc-proto", develop = true }
|
||||
@ -27,7 +27,7 @@ crc32c = "^2.2.post0" # Belongs to lnprototest
|
||||
pytest-xdist = "^2.5.0"
|
||||
pytest-test-groups = "^1.0.3"
|
||||
pytest-timeout = "^2.1.0"
|
||||
flake8 = "^4.0.1"
|
||||
flake8 = "^6.0"
|
||||
mypy = "^0.931"
|
||||
pytest-custom-exit-code = "0.3.0"
|
||||
pyln-testing = { path = "./contrib/pyln-testing", develop = true, extras = [ "grpc" ] }
|
||||
|
Loading…
Reference in New Issue
Block a user