From 6084112d485fd6061a238b9c1a4882d845280feb Mon Sep 17 00:00:00 2001 From: Matt Hauff Date: Fri, 25 Oct 2024 15:55:37 -0700 Subject: [PATCH] [CHIA-1553] Replace pylint with ruff (#18759) * Replace pylint with ruff * poetry * remove pylint * Address comments by @altendky * Undo formatting * actually undo formatting --- .github/CODEOWNERS | 1 - .github/workflows/dependency-review.yml | 2 +- .github/workflows/upload-pypi-source.yml | 2 - .pre-commit-config.yaml | 7 + CONTRIBUTING.md | 2 +- benchmarks/block_ref.py | 1 - benchmarks/streamable.py | 2 +- chia/_tests/build-init-files.py | 2 +- chia/_tests/cmds/cmd_test_utils.py | 2 +- chia/_tests/cmds/test_show.py | 2 +- chia/_tests/cmds/wallet/test_coins.py | 6 +- chia/_tests/cmds/wallet/test_dao.py | 8 +- chia/_tests/cmds/wallet/test_did.py | 18 +- chia/_tests/cmds/wallet/test_nft.py | 16 +- chia/_tests/cmds/wallet/test_notifications.py | 6 +- chia/_tests/cmds/wallet/test_vcs.py | 14 +- chia/_tests/cmds/wallet/test_wallet.py | 30 +- chia/_tests/process_junit.py | 1 - chia/_tests/util/misc.py | 2 +- chia/_tests/util/time_out_assert.py | 2 +- chia/_tests/wallet/rpc/test_wallet_rpc.py | 4 +- .../wallet/test_wallet_state_manager.py | 2 +- chia/cmds/chia.py | 2 +- chia/cmds/cmd_classes.py | 6 +- chia/cmds/signer.py | 2 +- chia/daemon/windows_signal.py | 4 +- chia/data_layer/data_store.py | 3 +- chia/full_node/full_node.py | 2 +- chia/rpc/data_layer_rpc_util.py | 4 +- chia/rpc/wallet_request_types.py | 2 - chia/rpc/wallet_rpc_api.py | 2 +- chia/server/chia_policy.py | 8 +- chia/util/db_wrapper.py | 3 +- chia/util/dump_keyring.py | 2 +- chia/util/task_timing.py | 4 +- chia/wallet/dao_wallet/dao_wallet.py | 1 - chia/wallet/nft_wallet/nft_puzzles.py | 6 +- chia/wallet/util/blind_signer_tl.py | 3 - chia/wallet/wallet.py | 2 +- chia/wallet/wallet_protocol.py | 4 +- poetry.lock | 100 +-- pylintrc | 583 ------------------ pyproject.toml | 64 +- tools/analyze-chain.py | 1 - tools/analyze_memory_profile.py | 2 +- tools/cpu_utilization.py | 1 - tools/generate_chain.py | 1 - tools/run_block.py | 2 +- tools/test_full_sync.py | 1 - 49 files changed, 184 insertions(+), 763 deletions(-) delete mode 100644 pylintrc diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 85c52a45e3c7..502ac003c694 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,4 @@ * @Chia-Network/required-reviewers /.github/**/* @Chia-Network/actions-reviewers /PRETTY_GOOD_PRACTICES.md @altendky @Chia-Network/required-reviewers -/pylintrc @altendky @Chia-Network/required-reviewers /tests/ether.py @altendky @Chia-Network/required-reviewers diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 53a3bbdd86e2..53b8c1209bef 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -21,5 +21,5 @@ jobs: - name: "Dependency Review" uses: actions/dependency-review-action@v4 with: - allow-dependencies-licenses: pkg:pypi/pylint, pkg:pypi/pyinstaller + allow-dependencies-licenses: pkg:pypi/pyinstaller deny-licenses: AGPL-1.0-only, AGPL-1.0-or-later, AGPL-1.0-or-later, AGPL-3.0-or-later, GPL-1.0-only, GPL-1.0-or-later, GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later diff --git a/.github/workflows/upload-pypi-source.yml b/.github/workflows/upload-pypi-source.yml index fa0f3c89de4f..7baee8f1b3d1 100644 --- a/.github/workflows/upload-pypi-source.yml +++ b/.github/workflows/upload-pypi-source.yml @@ -122,8 +122,6 @@ jobs: command: black --check --diff . - name: flake8 command: flake8 benchmarks build_scripts chia tools *.py - - name: pylint - command: pylint benchmarks build_scripts chia tools *.py - name: generated protocol tests command: | python3 -m chia._tests.util.build_network_protocol_files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 063bfe9dc4e0..ebee9872709c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -106,3 +106,10 @@ repos: entry: ./activated.py flake8 language: system types: [python] + - repo: local + hooks: + - id: ruff + name: Ruff + entry: ./activated.py ruff check --fix + language: system + types: [python] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d6e871094f3..40a501a3f153 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,7 @@ The [black library](https://black.readthedocs.io/en/stable/) is used as an autom The [flake8 library](https://readthedocs.org/projects/flake8/) helps ensure consistent style. The [Mypy library](https://mypy.readthedocs.io/en/stable/) is very useful for ensuring objects are of the correct type, so try to always add the type of the return value, and the type of local variables. The [isort library](https://isort.readthedocs.io) is used to sort, group and validate imports in all python files. -The [pylint library](https://pylint.pycqa.org/en/stable/) is used to further lint all python files. +The [Ruff library](https://docs.astral.sh) is used to further lint all of the python files If you want verbose logging for tests, edit the `tests/pytest.ini` file. diff --git a/benchmarks/block_ref.py b/benchmarks/block_ref.py index 640c668773c3..1b7b35520e69 100644 --- a/benchmarks/block_ref.py +++ b/benchmarks/block_ref.py @@ -98,5 +98,4 @@ def entry_point(db_path: Path) -> None: if __name__ == "__main__": - # pylint: disable = no-value-for-parameter entry_point() diff --git a/benchmarks/streamable.py b/benchmarks/streamable.py index 386da56a6917..366310c2d4d9 100644 --- a/benchmarks/streamable.py +++ b/benchmarks/streamable.py @@ -304,4 +304,4 @@ def get_bench_results() -> BenchmarkResults: if __name__ == "__main__": - run() # pylint: disable = no-value-for-parameter + run() diff --git a/chia/_tests/build-init-files.py b/chia/_tests/build-init-files.py index 67b5840eec04..38f3269d4009 100755 --- a/chia/_tests/build-init-files.py +++ b/chia/_tests/build-init-files.py @@ -89,4 +89,4 @@ def command(verbose, root_str): raise click.ClickException("At least one __init__.py created or not a regular file") -command() # pylint: disable=no-value-for-parameter +command() diff --git a/chia/_tests/cmds/cmd_test_utils.py b/chia/_tests/cmds/cmd_test_utils.py index 4a4acc7983eb..7ddf2571d7b2 100644 --- a/chia/_tests/cmds/cmd_test_utils.py +++ b/chia/_tests/cmds/cmd_test_utils.py @@ -440,7 +440,7 @@ def run_cli_command(capsys: object, chia_root: Path, command_list: list[str]) -> argv_temp = sys.argv try: sys.argv = ["chia", "--root-path", str(chia_root)] + command_list - chia_cli() # pylint: disable=no-value-for-parameter + chia_cli() except SystemExit as e: if e.code != 0: exited_cleanly = False diff --git a/chia/_tests/cmds/test_show.py b/chia/_tests/cmds/test_show.py index f2fe27545f20..3916ce8f6dbc 100644 --- a/chia/_tests/cmds/test_show.py +++ b/chia/_tests/cmds/test_show.py @@ -79,7 +79,7 @@ async def get_block(self, header_hash: bytes32) -> Optional[FullBlock]: return full_block -RPC_CLIENT_TO_USE = ShowFullNodeRpcClient() # pylint: disable=no-value-for-parameter +RPC_CLIENT_TO_USE = ShowFullNodeRpcClient() def test_chia_show(capsys: object, get_test_cli_clients: tuple[TestRpcClients, Path]) -> None: diff --git a/chia/_tests/cmds/wallet/test_coins.py b/chia/_tests/cmds/wallet/test_coins.py index ceca5f538753..4839fb900fcf 100644 --- a/chia/_tests/cmds/wallet/test_coins.py +++ b/chia/_tests/cmds/wallet/test_coins.py @@ -25,7 +25,7 @@ def test_coins_get_info(capsys: object, get_test_cli_clients: tuple[TestRpcClien # set RPC Client - inst_rpc_client = TestWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TestWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = ["wallet", "coins", "list", FINGERPRINT_ARG, "-i1", "-u"] # these are various things that should be in the output @@ -68,7 +68,7 @@ async def combine_coins( self.add_to_log("combine_coins", (args, tx_config, timelock_info)) return CombineCoinsResponse([STD_UTX], [STD_TX]) - inst_rpc_client = CoinsCombineRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = CoinsCombineRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client assert sum(coin.amount for coin in STD_TX.removals) < 500_000_000_000 command_args = [ @@ -173,7 +173,7 @@ async def get_coin_records_by_names( else: return [] - inst_rpc_client = CoinsSplitRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = CoinsSplitRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client target_coin_id = test_coin.name() command_args = [ diff --git a/chia/_tests/cmds/wallet/test_dao.py b/chia/_tests/cmds/wallet/test_dao.py index 6f6292459401..68a2e6a2e6d3 100644 --- a/chia/_tests/cmds/wallet/test_dao.py +++ b/chia/_tests/cmds/wallet/test_dao.py @@ -66,7 +66,7 @@ async def create_new_dao_wallet( } ) - inst_rpc_client = DAOCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DAOCreateRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ "dao", @@ -175,7 +175,7 @@ async def get_transaction(self, transaction_id: bytes32) -> TransactionRecord: valid_times=parse_timelock_info(tuple()), ) - inst_rpc_client = DAOCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DAOCreateRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client get_id_args = ["dao", "get_id", FINGERPRINT_ARG, "-i 2"] @@ -345,7 +345,7 @@ async def get_transaction(self, transaction_id: bytes32) -> TransactionRecord: ) # List all proposals - inst_rpc_client = DAOCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DAOCreateRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client list_args = ["dao", "list_proposals", FINGERPRINT_ARG, "-i 2"] # these are various things that should be in the output @@ -549,7 +549,7 @@ async def get_transaction(self, transaction_id: bytes32) -> TransactionRecord: valid_times=parse_timelock_info(tuple()), ) - inst_rpc_client = DAOCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DAOCreateRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client lockup_args = ["dao", "lockup_coins", FINGERPRINT_ARG, "-i 2", "-a", "1000", "-m 0.1", "--reuse"] lockup_asserts = ["Transaction submitted to nodes"] diff --git a/chia/_tests/cmds/wallet/test_did.py b/chia/_tests/cmds/wallet/test_did.py index a26d797ee53b..be16113e39ef 100644 --- a/chia/_tests/cmds/wallet/test_did.py +++ b/chia/_tests/cmds/wallet/test_did.py @@ -45,7 +45,7 @@ async def create_new_did_wallet( ) return {"wallet_id": 3, "my_did": "did:chia:testdid123456"} - inst_rpc_client = DidCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidCreateRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ "wallet", @@ -78,7 +78,7 @@ def test_did_sign_message(capsys: object, get_test_cli_clients: tuple[TestRpcCli test_rpc_clients, root_dir = get_test_cli_clients # set RPC Client - inst_rpc_client = TestWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TestWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client did_id = encode_puzzle_hash(get_bytes32(1), "did:chia:") message = b"hello did world!!" @@ -106,7 +106,7 @@ async def did_set_wallet_name(self, wallet_id: int, name: str) -> dict[str, Unio self.add_to_log("did_set_wallet_name", (wallet_id, name)) return {} - inst_rpc_client = DidSetNameRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidSetNameRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client w_id = 3 did_name = "testdid" @@ -129,7 +129,7 @@ async def get_did_id(self, wallet_id: int) -> dict[str, str]: self.add_to_log("get_did_id", (wallet_id,)) return {"my_did": encode_puzzle_hash(get_bytes32(1), "did:chia:"), "coin_id": get_bytes32(2).hex()} - inst_rpc_client = DidGetDidRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidGetDidRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client w_id = 3 expected_did = encode_puzzle_hash(get_bytes32(1), "did:chia:") @@ -165,7 +165,7 @@ async def get_did_info(self, coin_id: str, latest: bool) -> dict[str, object]: } return response - inst_rpc_client = DidGetDetailsRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidGetDetailsRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client did_coin_id_hex = get_bytes32(1).hex() command_args = ["wallet", "did", "get_details", FINGERPRINT_ARG, "--coin_id", did_coin_id_hex] @@ -207,7 +207,7 @@ async def update_did_metadata( self.add_to_log("update_did_metadata", (wallet_id, metadata, tx_config, push, timelock_info)) return DIDUpdateMetadataResponse([STD_UTX], [STD_TX], WalletSpendBundle([], G2Element()), uint32(wallet_id)) - inst_rpc_client = DidUpdateMetadataRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidUpdateMetadataRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client w_id = 3 json_mdata = '{"test": true}' @@ -252,7 +252,7 @@ async def find_lost_did( self.add_to_log("find_lost_did", (coin_id, recovery_list_hash, metadata, num_verification)) return {"success": True, "latest_coin_id": get_bytes32(2).hex()} - inst_rpc_client = DidFindLostRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidFindLostRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client c_id = get_bytes32(1) json_mdata = '{"test": true}' @@ -291,7 +291,7 @@ async def did_message_spend( self.add_to_log("did_message_spend", (wallet_id, tx_config, extra_conditions, push, timelock_info)) return DIDMessageSpendResponse([STD_UTX], [STD_TX], WalletSpendBundle([], G2Element())) - inst_rpc_client = DidMessageSpendRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidMessageSpendRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client w_id = 3 c_announcements = [get_bytes32(1), get_bytes32(2)] @@ -357,7 +357,7 @@ async def did_transfer_did( STD_TX.name, ) - inst_rpc_client = DidTransferRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = DidTransferRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client w_id = 3 t_address = encode_puzzle_hash(get_bytes32(1), "xch") diff --git a/chia/_tests/cmds/wallet/test_nft.py b/chia/_tests/cmds/wallet/test_nft.py index 5d9f74bebaaf..614e33074d2a 100644 --- a/chia/_tests/cmds/wallet/test_nft.py +++ b/chia/_tests/cmds/wallet/test_nft.py @@ -36,7 +36,7 @@ async def create_new_nft_wallet(self, did_id: str, name: Optional[str] = None) - self.add_to_log("create_new_nft_wallet", (did_id, name)) return {"wallet_id": 4} - inst_rpc_client = NFTCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NFTCreateRpcClient() did_id = encode_puzzle_hash(get_bytes32(2), "did:chia:") test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = ["wallet", "nft", "create", FINGERPRINT_ARG, "-ntest", "--did-id", did_id] @@ -54,7 +54,7 @@ def test_nft_sign_message(capsys: object, get_test_cli_clients: tuple[TestRpcCli # set RPC Client - inst_rpc_client = TestWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TestWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client did_id = encode_puzzle_hash(get_bytes32(1), "nft") message = b"hello nft world!!" @@ -132,7 +132,7 @@ async def mint_nft( bytes32.zeros.hex(), ) - inst_rpc_client = NFTCreateRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NFTCreateRpcClient() target_addr = encode_puzzle_hash(get_bytes32(2), "xch") test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ @@ -209,7 +209,7 @@ async def add_uri_to_nft( self.add_to_log("add_uri_to_nft", (wallet_id, nft_coin_id, key, uri, fee, tx_config, push, timelock_info)) return NFTAddURIResponse([STD_UTX], [STD_TX], uint32(wallet_id), WalletSpendBundle([], G2Element())) - inst_rpc_client = NFTAddUriRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NFTAddUriRpcClient() nft_coin_id = get_bytes32(2).hex() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ @@ -275,7 +275,7 @@ async def transfer_nft( WalletSpendBundle([], G2Element()), ) - inst_rpc_client = NFTTransferRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NFTTransferRpcClient() nft_coin_id = get_bytes32(2).hex() target_address = encode_puzzle_hash(get_bytes32(2), "xch") test_rpc_clients.wallet_rpc_client = inst_rpc_client @@ -352,7 +352,7 @@ async def list_nfts(self, wallet_id: int, num: int = 50, start_index: int = 0) - ) return {"nft_list": nft_list} - inst_rpc_client = NFTListRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NFTListRpcClient() launcher_ids = [bytes32([i] * 32).hex() for i in range(50, 60)] test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ @@ -401,7 +401,7 @@ async def set_nft_did( WalletSpendBundle([], G2Element()), ) - inst_rpc_client = NFTSetDidRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NFTSetDidRpcClient() nft_coin_id = get_bytes32(2).hex() did_id = encode_puzzle_hash(get_bytes32(3), "did:chia:") test_rpc_clients.wallet_rpc_client = inst_rpc_client @@ -447,7 +447,7 @@ def test_nft_get_info(capsys: object, get_test_cli_clients: tuple[TestRpcClients # set RPC Client - inst_rpc_client = TestWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TestWalletRpcClient() nft_coin_id = get_bytes32(2).hex() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ diff --git a/chia/_tests/cmds/wallet/test_notifications.py b/chia/_tests/cmds/wallet/test_notifications.py index 538015f0c1e6..ed9b9931f9e3 100644 --- a/chia/_tests/cmds/wallet/test_notifications.py +++ b/chia/_tests/cmds/wallet/test_notifications.py @@ -40,7 +40,7 @@ def __init__(self, name: str) -> None: return cast(TransactionRecord, FakeTransactionRecord(get_bytes32(2).hex())) - inst_rpc_client = NotificationsSendRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NotificationsSendRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client target_ph = get_bytes32(1) target_addr = encode_puzzle_hash(target_ph, "xch") @@ -82,7 +82,7 @@ async def get_notifications(self, request: GetNotifications) -> GetNotifications [Notification(get_bytes32(1), bytes("hello", "utf8"), uint64(1000000000), uint32(50))] ) - inst_rpc_client = NotificationsGetRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NotificationsGetRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client target_ph = get_bytes32(1) command_args = [ @@ -114,7 +114,7 @@ async def delete_notifications(self, ids: Optional[list[bytes32]] = None) -> boo self.add_to_log("delete_notifications", (ids,)) return True - inst_rpc_client = NotificationsDeleteRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = NotificationsDeleteRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = ["wallet", "notifications", "delete", FINGERPRINT_ARG, "--all"] # these are various things that should be in the output diff --git a/chia/_tests/cmds/wallet/test_vcs.py b/chia/_tests/cmds/wallet/test_vcs.py index f8d1aacdbfac..cef9ac5dcde4 100644 --- a/chia/_tests/cmds/wallet/test_vcs.py +++ b/chia/_tests/cmds/wallet/test_vcs.py @@ -55,7 +55,7 @@ async def vc_mint( ), ) - inst_rpc_client = VcsMintRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsMintRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client did_bytes = get_bytes32(1) did_id = encode_puzzle_hash(did_bytes, "did:chia:") @@ -108,7 +108,7 @@ def __getattr__(self, item: str) -> Any: records = [cast(VCRecord, FakeVC())] return records, proofs - inst_rpc_client = VcsGetRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsGetRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = ["wallet", "vcs", "get", FINGERPRINT_ARG, "-s10", "-c10"] # these are various things that should be in the output @@ -144,7 +144,7 @@ async def vc_spend( ) return VCSpendResponse([STD_UTX], [STD_TX]) - inst_rpc_client = VcsUpdateProofsRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsUpdateProofsRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client vc_bytes = get_bytes32(1) target_ph = get_bytes32(2) @@ -196,7 +196,7 @@ async def vc_add_proofs(self, proofs: dict[str, Any]) -> None: self.add_to_log("vc_add_proofs", (proofs,)) return None - inst_rpc_client = VcsAddProofRevealRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsAddProofRevealRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client new_proof = "test_proof" command_args = ["wallet", "vcs", "add_proof_reveal", FINGERPRINT_ARG, f"-p{new_proof}"] @@ -220,7 +220,7 @@ async def vc_get_proofs_for_root(self, root: bytes32) -> dict[str, Any]: self.add_to_log("vc_get_proofs_for_root", (root,)) return {"test_proof": "1", "test_proof2": "1"} - inst_rpc_client = VcsGetProofsForRootRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsGetProofsForRootRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client proof_hash = get_bytes32(1) command_args = ["wallet", "vcs", "get_proofs_for_root", FINGERPRINT_ARG, f"-r{proof_hash.hex()}"] @@ -261,7 +261,7 @@ async def vc_revoke( self.add_to_log("vc_revoke", (vc_parent_id, tx_config, fee, push, timelock_info)) return VCRevokeResponse([STD_UTX], [STD_TX]) - inst_rpc_client = VcsRevokeRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsRevokeRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client parent_id = get_bytes32(1) vc_id = get_bytes32(2) @@ -330,7 +330,7 @@ async def crcat_approve_pending( ) return [STD_TX] - inst_rpc_client = VcsApproveRCATSRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = VcsApproveRCATSRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client wallet_id = uint32(2) command_args = [ diff --git a/chia/_tests/cmds/wallet/test_wallet.py b/chia/_tests/cmds/wallet/test_wallet.py index 64407d2efe88..ebd1a51d6bd8 100644 --- a/chia/_tests/cmds/wallet/test_wallet.py +++ b/chia/_tests/cmds/wallet/test_wallet.py @@ -60,7 +60,7 @@ def test_get_transaction(capsys: object, get_test_cli_clients: tuple[TestRpcClients, Path]) -> None: test_rpc_clients, root_dir = get_test_cli_clients # set RPC Client - inst_rpc_client = TestWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TestWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client # get output with all options but verbose command_args = ["wallet", "get_transaction", WALLET_ID_ARG, "-tx", bytes32_hexstr] @@ -149,7 +149,7 @@ async def get_coin_records(self, request: GetCoinRecords) -> dict[str, Any]: "total_count": 1, } - inst_rpc_client = GetTransactionsWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = GetTransactionsWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client # get output with all options but verbose command_args = [ @@ -269,7 +269,7 @@ async def get_connections( } ] - inst_rpc_client = ShowRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = ShowRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = ["wallet", "show", FINGERPRINT_ARG] assert_list = [ @@ -376,7 +376,7 @@ async def cat_spend( ) return CATSpendResponse([STD_UTX], [STD_TX], STD_TX, STD_TX.name) - inst_rpc_client = SendWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = SendWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client # get output with all options but verbose addr = encode_puzzle_hash(get_bytes32(3), "xch") @@ -479,7 +479,7 @@ async def get_next_address(self, wallet_id: int, new_address: bool) -> str: return encode_puzzle_hash(get_bytes32(3), "xch") return encode_puzzle_hash(get_bytes32(4), "xch") - inst_rpc_client = GetAddressWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = GetAddressWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client # get output with all options but verbose addr1 = encode_puzzle_hash(get_bytes32(3), "xch") @@ -526,7 +526,7 @@ async def spend_clawback_coins( ], } - inst_rpc_client = ClawbackWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = ClawbackWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client tx_ids = [get_bytes32(3), get_bytes32(4), get_bytes32(5)] r_tx_ids_hex = [get_bytes32(6).hex(), get_bytes32(7).hex(), get_bytes32(8).hex()] @@ -560,7 +560,7 @@ async def delete_unconfirmed_transactions(self, wallet_id: int) -> None: self.add_to_log("delete_unconfirmed_transactions", (wallet_id,)) return None - inst_rpc_client = UnconfirmedTxRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = UnconfirmedTxRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ "wallet", @@ -586,7 +586,7 @@ async def get_current_derivation_index(self) -> str: self.add_to_log("get_current_derivation_index", ()) return str(520) - inst_rpc_client = GetDerivationIndexRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = GetDerivationIndexRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ "wallet", @@ -605,7 +605,7 @@ def test_sign_message(capsys: object, get_test_cli_clients: tuple[TestRpcClients test_rpc_clients, root_dir = get_test_cli_clients # set RPC Client - inst_rpc_client = TestWalletRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TestWalletRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client xch_addr = encode_puzzle_hash(get_bytes32(1), "xch") message = b"hello world" @@ -633,7 +633,7 @@ async def extend_derivation_index(self, index: int) -> str: self.add_to_log("extend_derivation_index", (index,)) return str(index) - inst_rpc_client = UpdateDerivationIndexRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = UpdateDerivationIndexRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client index = 600 command_args = ["wallet", "update_derivation_index", FINGERPRINT_ARG, "--index", str(index)] @@ -657,7 +657,7 @@ async def set_cat_name(self, wallet_id: int, name: str) -> None: self.add_to_log("set_cat_name", (wallet_id, name)) return None # we don't need to do anything here - inst_rpc_client = AddTokenRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = AddTokenRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = ["wallet", "add_token", FINGERPRINT_ARG, "-nexamplecat"] assert_list = [f"Successfully renamed test1 with wallet_id 2 on key {FINGERPRINT} to examplecat"] @@ -765,7 +765,7 @@ async def create_offer_for_ids( return CreateOfferForIDsResponse([STD_UTX], [STD_TX], created_offer, trade_offer) - inst_rpc_client = MakeOfferRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = MakeOfferRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client request_cat_id = get_bytes32(2) request_nft_id = get_bytes32(2) @@ -913,7 +913,7 @@ async def get_all_offers( records.append(trade_offer) return records - inst_rpc_client = GetOffersRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = GetOffersRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ "wallet", @@ -999,7 +999,7 @@ async def take_offer( ), ) - inst_rpc_client = TakeOfferRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = TakeOfferRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client # these are various things that should be in the output cat1 = bytes32.from_hexstr("fd6a341ed39c05c31157d5bfea395a0e142398ced24deea1e82f836d7ec2909c") @@ -1084,7 +1084,7 @@ async def cancel_offer( self.add_to_log("cancel_offer", (trade_id, tx_config, fee, secure, push, timelock_info)) return CancelOfferResponse([STD_UTX], [STD_TX]) - inst_rpc_client = CancelOfferRpcClient() # pylint: disable=no-value-for-parameter + inst_rpc_client = CancelOfferRpcClient() test_rpc_clients.wallet_rpc_client = inst_rpc_client command_args = [ "wallet", diff --git a/chia/_tests/process_junit.py b/chia/_tests/process_junit.py index 8442c88464eb..abf65408ca16 100644 --- a/chia/_tests/process_junit.py +++ b/chia/_tests/process_junit.py @@ -345,5 +345,4 @@ def output_time_out_assert( if __name__ == "__main__": - # pylint: disable = no-value-for-parameter main() diff --git a/chia/_tests/util/misc.py b/chia/_tests/util/misc.py index 751d9aacaa08..3ea473c59479 100644 --- a/chia/_tests/util/misc.py +++ b/chia/_tests/util/misc.py @@ -348,7 +348,7 @@ def __exit__( label=self.label, ) - ether.record_property( # pylint: disable=E1102 + ether.record_property( data.tag, json.dumps(data.marshal(), ensure_ascii=True, sort_keys=True), ) diff --git a/chia/_tests/util/time_out_assert.py b/chia/_tests/util/time_out_assert.py index a777c802675e..b1b99917077f 100644 --- a/chia/_tests/util/time_out_assert.py +++ b/chia/_tests/util/time_out_assert.py @@ -125,7 +125,7 @@ async def time_out_assert_custom_interval( timed_out=timed_out, ) - ether.record_property( # pylint: disable=E1102 + ether.record_property( data.tag, json.dumps(data.marshal(), ensure_ascii=True, sort_keys=True), ) diff --git a/chia/_tests/wallet/rpc/test_wallet_rpc.py b/chia/_tests/wallet/rpc/test_wallet_rpc.py index db4c17f9eec1..e2aad760b6e6 100644 --- a/chia/_tests/wallet/rpc/test_wallet_rpc.py +++ b/chia/_tests/wallet/rpc/test_wallet_rpc.py @@ -281,7 +281,7 @@ async def assert_push_tx_error(node_rpc: FullNodeRpcClient, tx: TransactionRecor try: await node_rpc.push_tx(spend_bundle) except ValueError as error: - error_string = error.args[0]["error"] # noqa: # pylint: disable=E1126 + error_string = error.args[0]["error"] if error_string.find("ASSERT_ANNOUNCE_CONSUMED_FAILED") == -1: raise ValueError from error @@ -413,7 +413,7 @@ async def test_push_transactions(wallet_rpc_environment: WalletRpcTestEnvironmen ).signed_tx resp_client = await client.push_transactions( - PushTransactions(transactions=[tx], fee=uint64(10)), # pylint: disable=unexpected-keyword-arg + PushTransactions(transactions=[tx], fee=uint64(10)), DEFAULT_TX_CONFIG, ) resp = await client.fetch( diff --git a/chia/_tests/wallet/test_wallet_state_manager.py b/chia/_tests/wallet/test_wallet_state_manager.py index 481173c0bd51..06332c1f0834 100644 --- a/chia/_tests/wallet/test_wallet_state_manager.py +++ b/chia/_tests/wallet/test_wallet_state_manager.py @@ -226,7 +226,7 @@ async def test_confirming_txs_not_ours(wallet_environments: WalletTestFramework) ) await env_2.rpc_client.push_transactions( - PushTransactions( # pylint: disable=unexpected-keyword-arg + PushTransactions( transactions=action_scope.side_effects.transactions, sign=False, ), diff --git a/chia/cmds/chia.py b/chia/cmds/chia.py index cf67f4f843a1..3c7291a72de1 100644 --- a/chia/cmds/chia.py +++ b/chia/cmds/chia.py @@ -136,7 +136,7 @@ def run_daemon_cmd(ctx: click.Context, wait_for_unlock: bool) -> None: def main() -> None: import chia.cmds.signer # noqa - cli() # pylint: disable=no-value-for-parameter + cli() if __name__ == "__main__": diff --git a/chia/cmds/cmd_classes.py b/chia/cmds/cmd_classes.py index 1aedf7ee963d..0771c10247c7 100644 --- a/chia/cmds/cmd_classes.py +++ b/chia/cmds/cmd_classes.py @@ -41,7 +41,7 @@ def option(*param_decls: str, **kwargs: Any) -> Any: else: default_default = MISSING - return field( # pylint: disable=invalid-field-call + return field( metadata=dict( option_args=dict( param_decls=tuple(param_decls), @@ -268,7 +268,7 @@ class WalletClientInfo: @command_helper class NeedsWalletRPC: - context: Context = field(default_factory=dict) # pylint: disable=invalid-field-call + context: Context = field(default_factory=dict) client_info: Optional[WalletClientInfo] = None wallet_rpc_port: Optional[int] = option( "-wp", @@ -294,7 +294,7 @@ async def wallet_rpc(self, **kwargs: Any) -> AsyncIterator[WalletClientInfo]: yield self.client_info else: if "root_path" not in kwargs: - kwargs["root_path"] = self.context["root_path"] # pylint: disable=unsubscriptable-object + kwargs["root_path"] = self.context["root_path"] async with get_wallet_client(self.wallet_rpc_port, self.fingerprint, **kwargs) as ( wallet_client, fp, diff --git a/chia/cmds/signer.py b/chia/cmds/signer.py index 85d90337bdc2..56b49e7982d8 100644 --- a/chia/cmds/signer.py +++ b/chia/cmds/signer.py @@ -151,7 +151,7 @@ class SPIn(_SPTranslation): def read_sp_input(self, typ: type[_T_ClvmStreamable]) -> list[_T_ClvmStreamable]: final_list: list[_T_ClvmStreamable] = [] - for filename in self.signer_protocol_input: # pylint: disable=not-an-iterable + for filename in self.signer_protocol_input: with open(Path(filename), "rb") as file: final_list.append( byte_deserialize_clvm_streamable( diff --git a/chia/daemon/windows_signal.py b/chia/daemon/windows_signal.py index 67f8789e6a57..74424a0723b7 100644 --- a/chia/daemon/windows_signal.py +++ b/chia/daemon/windows_signal.py @@ -21,8 +21,8 @@ import threading sigmap = { - signal.SIGINT: signal.CTRL_C_EVENT, # pylint: disable=E1101 - signal.SIGBREAK: signal.CTRL_BREAK_EVENT, # pylint: disable=E1101 + signal.SIGINT: signal.CTRL_C_EVENT, + signal.SIGBREAK: signal.CTRL_BREAK_EVENT, } def kill(pid: int, signum: signal.Signals) -> None: diff --git a/chia/data_layer/data_store.py b/chia/data_layer/data_store.py index ead6f196cfd2..2e7688097893 100644 --- a/chia/data_layer/data_store.py +++ b/chia/data_layer/data_store.py @@ -496,8 +496,7 @@ async def change_root_status(self, root: Root, status: Status = Status.PENDING) async def check(self) -> None: for check in self._checks: - # pylint seems to think these are bound methods not unbound methods. - await check(self) # pylint: disable=too-many-function-args + await check(self) async def _check_roots_are_incrementing(self) -> None: async with self.db_wrapper.reader() as reader: diff --git a/chia/full_node/full_node.py b/chia/full_node/full_node.py index f5531e8d7b90..10d58f82f89b 100644 --- a/chia/full_node/full_node.py +++ b/chia/full_node/full_node.py @@ -2651,7 +2651,7 @@ async def add_transaction( await self.broadcast_added_tx(mempool_item, current_peer=peer) if self.simulator_transaction_callback is not None: # callback - await self.simulator_transaction_callback(spend_name) # pylint: disable=E1102 + await self.simulator_transaction_callback(spend_name) else: self.mempool_manager.remove_seen(spend_name) diff --git a/chia/rpc/data_layer_rpc_util.py b/chia/rpc/data_layer_rpc_util.py index 315152222f40..33b8ca4846cb 100644 --- a/chia/rpc/data_layer_rpc_util.py +++ b/chia/rpc/data_layer_rpc_util.py @@ -26,9 +26,7 @@ async def __call__(self, request: dict[str, Any]) -> dict[str, Any]: class UnboundMarshalledRoute(Protocol): # Ignoring pylint complaint about the name of the first argument since this is a # special case. - async def __call__( # pylint: disable=E0213 - protocol_self, self: Any, request: MarshallableProtocol - ) -> MarshallableProtocol: + async def __call__(protocol_self, self: Any, request: MarshallableProtocol) -> MarshallableProtocol: pass diff --git a/chia/rpc/wallet_request_types.py b/chia/rpc/wallet_request_types.py index 387475823741..1b091bd4effe 100644 --- a/chia/rpc/wallet_request_types.py +++ b/chia/rpc/wallet_request_types.py @@ -1,5 +1,3 @@ -# pylint: disable=invalid-field-call - from __future__ import annotations import sys diff --git a/chia/rpc/wallet_rpc_api.py b/chia/rpc/wallet_rpc_api.py index 56f32200f0c1..5458195e5aed 100644 --- a/chia/rpc/wallet_rpc_api.py +++ b/chia/rpc/wallet_rpc_api.py @@ -3186,7 +3186,7 @@ async def dao_create_proposal( return { "success": True, # Semantics guarantee proposal_id here - "proposal_id": proposal_id, # pylint: disable=possibly-used-before-assignment + "proposal_id": proposal_id, "tx_id": None, # tx_endpoint wrapper will take care of this "tx": None, # tx_endpoint wrapper will take care of this "transactions": None, # tx_endpoint wrapper will take care of this diff --git a/chia/server/chia_policy.py b/chia/server/chia_policy.py index 25a1a8dfaa14..6073f69c173e 100644 --- a/chia/server/chia_policy.py +++ b/chia/server/chia_policy.py @@ -261,7 +261,7 @@ async def _chia_accept_loop(self, listener: socket.socket) -> tuple[socket.socke try: return await self._chia_accept(listener) except OSError as exc: - if exc.winerror not in ( # pylint: disable=E1101 + if exc.winerror not in ( _winapi.ERROR_NETNAME_DELETED, _winapi.ERROR_OPERATION_ABORTED, ): @@ -269,7 +269,7 @@ async def _chia_accept_loop(self, listener: socket.socket) -> tuple[socket.socke def _chia_accept(self, listener: socket.socket) -> asyncio.Future[tuple[socket.socket, tuple[object, ...]]]: self._register_with_iocp(listener) - conn = self._get_accept_socket(listener.family) # pylint: disable=assignment-from-no-return + conn = self._get_accept_socket(listener.family) ov = _overlapped.Overlapped(_winapi.NULL) ov.AcceptEx(listener.fileno(), conn.fileno()) @@ -292,13 +292,13 @@ async def accept_coro(self: ChiaProactor, future: asyncio.Future[object], conn: raise except OSError as exc: # https://github.com/python/cpython/issues/93821#issuecomment-1157945855 - if exc.winerror not in ( # pylint: disable=E1101 + if exc.winerror not in ( _winapi.ERROR_NETNAME_DELETED, _winapi.ERROR_OPERATION_ABORTED, ): raise - future = self._register(ov, listener, finish_accept) # pylint: disable=assignment-from-no-return + future = self._register(ov, listener, finish_accept) coro = accept_coro(self, future, conn) asyncio.ensure_future(coro, loop=self._loop) return future diff --git a/chia/util/db_wrapper.py b/chia/util/db_wrapper.py index 4453fc4d747e..99176aa3a794 100644 --- a/chia/util/db_wrapper.py +++ b/chia/util/db_wrapper.py @@ -114,8 +114,7 @@ def get_host_parameter_limit() -> int: if sys.version_info >= (3, 11): connection = sqlite3.connect(":memory:") - # sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER exists in 3.11, pylint - limit_number = sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER # pylint: disable=E1101 + limit_number = sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER host_parameter_limit = connection.getlimit(limit_number) else: # guessing based on defaults, seems you can't query diff --git a/chia/util/dump_keyring.py b/chia/util/dump_keyring.py index e4c9b2a3004d..11b8831d3c7f 100755 --- a/chia/util/dump_keyring.py +++ b/chia/util/dump_keyring.py @@ -86,7 +86,7 @@ def dump(keyring_file: str, full_payload: bool, passphrase_file: Optional[TextIO def main() -> None: colorama.init() - dump() # pylint: disable=no-value-for-parameter + dump() if __name__ == "__main__": diff --git a/chia/util/task_timing.py b/chia/util/task_timing.py index 3ebce35a6779..e951afb10a4b 100644 --- a/chia/util/task_timing.py +++ b/chia/util/task_timing.py @@ -128,7 +128,7 @@ def __init__(self, name: str, file: str) -> None: def get_stack(frame: FrameType) -> str: ret = "" code = frame.f_code - while code.co_flags & inspect.CO_COROUTINE: # pylint: disable=no-member + while code.co_flags & inspect.CO_COROUTINE: ret = f"/{code.co_name}{ret}" if frame.f_back is None: break @@ -162,7 +162,7 @@ def trace_fun(frame: FrameType, event: str, arg: Any) -> None: return # we only care about instrumenting co-routines - if (frame.f_code.co_flags & inspect.CO_COROUTINE) == 0: # pylint: disable=no-member + if (frame.f_code.co_flags & inspect.CO_COROUTINE) == 0: # with open("instrumentation.log", "a") as f: # f.write(f"[1] {event} {get_fun(frame)}\n") return diff --git a/chia/wallet/dao_wallet/dao_wallet.py b/chia/wallet/dao_wallet/dao_wallet.py index 2b04cf4dea61..03b76aaca93e 100644 --- a/chia/wallet/dao_wallet/dao_wallet.py +++ b/chia/wallet/dao_wallet/dao_wallet.py @@ -1473,7 +1473,6 @@ async def create_proposal_close_spend( spend_bundle = WalletSpendBundle([proposal_cs, treasury_cs], AugSchemeMPL.aggregate([])) else: # TODO: maybe we can refactor this to provide clarity around timer_cs having been defined - # pylint: disable-next=E0606 spend_bundle = WalletSpendBundle([proposal_cs, timer_cs, treasury_cs], AugSchemeMPL.aggregate([])) if fee > 0: await self.standard_wallet.create_tandem_xch_tx(fee, action_scope) diff --git a/chia/wallet/nft_wallet/nft_puzzles.py b/chia/wallet/nft_wallet/nft_puzzles.py index 90dc670e7570..94e88a0d38b0 100644 --- a/chia/wallet/nft_wallet/nft_puzzles.py +++ b/chia/wallet/nft_wallet/nft_puzzles.py @@ -98,13 +98,13 @@ async def get_nft_info_from_puzzle(nft_coin_info: NFTCoinInfo, config: dict[str, assert uncurried_nft is not None data_uris: list[str] = [] - for uri in uncurried_nft.data_uris.as_python(): # pylint: disable=E1133 + for uri in uncurried_nft.data_uris.as_python(): data_uris.append(str(uri, "utf-8")) meta_uris: list[str] = [] - for uri in uncurried_nft.meta_uris.as_python(): # pylint: disable=E1133 + for uri in uncurried_nft.meta_uris.as_python(): meta_uris.append(str(uri, "utf-8")) license_uris: list[str] = [] - for uri in uncurried_nft.license_uris.as_python(): # pylint: disable=E1133 + for uri in uncurried_nft.license_uris.as_python(): license_uris.append(str(uri, "utf-8")) off_chain_metadata: Optional[str] = None nft_info = NFTInfo( diff --git a/chia/wallet/util/blind_signer_tl.py b/chia/wallet/util/blind_signer_tl.py index 2d017b5bddef..be2f24470e0c 100644 --- a/chia/wallet/util/blind_signer_tl.py +++ b/chia/wallet/util/blind_signer_tl.py @@ -17,9 +17,6 @@ ) from chia.wallet.util.clvm_streamable import TranslationLayer, TranslationLayerMapping, clvm_streamable -# Pylint doesn't understand that these classes are in fact dataclasses -# pylint: disable=invalid-field-call - @clvm_streamable @dataclass(frozen=True) diff --git a/chia/wallet/wallet.py b/chia/wallet/wallet.py index 58ebbeb67885..426c5e75ffd0 100644 --- a/chia/wallet/wallet.py +++ b/chia/wallet/wallet.py @@ -501,7 +501,7 @@ async def get_coins_to_offer( # WSChiaConnection is only imported for type checking async def coin_added( self, coin: Coin, height: uint32, peer: WSChiaConnection, coin_data: Optional[Streamable] - ) -> None: # pylint: disable=used-before-assignment + ) -> None: pass def get_name(self) -> str: diff --git a/chia/wallet/wallet_protocol.py b/chia/wallet/wallet_protocol.py index 93c569f731a9..e80427d3573a 100644 --- a/chia/wallet/wallet_protocol.py +++ b/chia/wallet/wallet_protocol.py @@ -58,9 +58,7 @@ def get_name(self) -> str: ... async def match_hinted_coin(self, coin: Coin, hint: bytes32) -> bool: ... wallet_info: WalletInfo - # WalletStateManager is only imported for type hinting thus leaving pylint - # unable to process this - wallet_state_manager: WalletStateManager # pylint: disable=used-before-assignment + wallet_state_manager: WalletStateManager class GSTOptionalArgs(TypedDict): diff --git a/poetry.lock b/poetry.lock index fc77a1709392..c68f41213dd2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -255,20 +255,6 @@ cffi = ">=1.0.1" dev = ["cogapp", "pre-commit", "pytest", "wheel"] tests = ["pytest"] -[[package]] -name = "astroid" -version = "3.2.4" -description = "An abstract syntax tree for Python with inference support." -optional = true -python-versions = ">=3.8.0" -files = [ - {file = "astroid-3.2.4-py3-none-any.whl", hash = "sha256:413658a61eeca6202a59231abb473f932038fbcbf1666587f66d482083413a25"}, - {file = "astroid-3.2.4.tar.gz", hash = "sha256:0e14202810b30da1b735827f78f5157be2bbd4a7a59b7707ca0bfc2fb4c0063a"}, -] - -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} - [[package]] name = "async-timeout" version = "4.0.3" @@ -1233,20 +1219,6 @@ Pygments = ">=2.9.0,<3.0.0" [package.extras] toml = ["tomli (>=1.2.1)"] -[[package]] -name = "dill" -version = "0.3.7" -description = "serialize all of Python" -optional = true -python-versions = ">=3.7" -files = [ - {file = "dill-0.3.7-py3-none-any.whl", hash = "sha256:76b122c08ef4ce2eedcd4d1abd8e641114bfc6c2867f49f3c41facf65bf19f5e"}, - {file = "dill-0.3.7.tar.gz", hash = "sha256:cc1c8b182eb3013e24bd475ff2e9295af86c1a38eb1aff128dac8962a9ce3c03"}, -] - -[package.extras] -graph = ["objgraph (>=1.7.2)"] - [[package]] name = "distlib" version = "0.3.7" @@ -2491,36 +2463,6 @@ importlib-metadata = {version = ">=4.6", markers = "python_version < \"3.10\""} packaging = ">=22.0" setuptools = ">=42.0.0" -[[package]] -name = "pylint" -version = "3.2.6" -description = "python code static checker" -optional = true -python-versions = ">=3.8.0" -files = [ - {file = "pylint-3.2.6-py3-none-any.whl", hash = "sha256:03c8e3baa1d9fb995b12c1dbe00aa6c4bcef210c2a2634374aedeb22fb4a8f8f"}, - {file = "pylint-3.2.6.tar.gz", hash = "sha256:a5d01678349454806cff6d886fb072294f56a58c4761278c97fb557d708e1eb3"}, -] - -[package.dependencies] -astroid = ">=3.2.4,<=3.3.0-dev0" -colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} -dill = [ - {version = ">=0.2", markers = "python_version < \"3.11\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, - {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, -] -isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" -mccabe = ">=0.6,<0.8" -platformdirs = ">=2.2.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -tomlkit = ">=0.10.1" -typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""} - -[package.extras] -spelling = ["pyenchant (>=3.2,<4.0)"] -testutils = ["gitpython (>3)"] - [[package]] name = "pyproject-hooks" version = "1.0.0" @@ -2773,6 +2715,33 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "ruff" +version = "0.7.1" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.7.1-py3-none-linux_armv6l.whl", hash = "sha256:cb1bc5ed9403daa7da05475d615739cc0212e861b7306f314379d958592aaa89"}, + {file = "ruff-0.7.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:27c1c52a8d199a257ff1e5582d078eab7145129aa02721815ca8fa4f9612dc35"}, + {file = "ruff-0.7.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:588a34e1ef2ea55b4ddfec26bbe76bc866e92523d8c6cdec5e8aceefeff02d99"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94fc32f9cdf72dc75c451e5f072758b118ab8100727168a3df58502b43a599ca"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:985818742b833bffa543a84d1cc11b5e6871de1b4e0ac3060a59a2bae3969250"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:32f1e8a192e261366c702c5fb2ece9f68d26625f198a25c408861c16dc2dea9c"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:699085bf05819588551b11751eff33e9ca58b1b86a6843e1b082a7de40da1565"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:344cc2b0814047dc8c3a8ff2cd1f3d808bb23c6658db830d25147339d9bf9ea7"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4316bbf69d5a859cc937890c7ac7a6551252b6a01b1d2c97e8fc96e45a7c8b4a"}, + {file = "ruff-0.7.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79d3af9dca4c56043e738a4d6dd1e9444b6d6c10598ac52d146e331eb155a8ad"}, + {file = "ruff-0.7.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c5c121b46abde94a505175524e51891f829414e093cd8326d6e741ecfc0a9112"}, + {file = "ruff-0.7.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8422104078324ea250886954e48f1373a8fe7de59283d747c3a7eca050b4e378"}, + {file = "ruff-0.7.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:56aad830af8a9db644e80098fe4984a948e2b6fc2e73891538f43bbe478461b8"}, + {file = "ruff-0.7.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:658304f02f68d3a83c998ad8bf91f9b4f53e93e5412b8f2388359d55869727fd"}, + {file = "ruff-0.7.1-py3-none-win32.whl", hash = "sha256:b517a2011333eb7ce2d402652ecaa0ac1a30c114fbbd55c6b8ee466a7f600ee9"}, + {file = "ruff-0.7.1-py3-none-win_amd64.whl", hash = "sha256:f38c41fcde1728736b4eb2b18850f6d1e3eedd9678c914dede554a70d5241307"}, + {file = "ruff-0.7.1-py3-none-win_arm64.whl", hash = "sha256:19aa200ec824c0f36d0c9114c8ec0087082021732979a359d6f3c390a6ff2a37"}, + {file = "ruff-0.7.1.tar.gz", hash = "sha256:9d8a41d4aa2dad1575adb98a82870cf5db5f76b2938cf2206c22c940034a36f4"}, +] + [[package]] name = "s3transfer" version = "0.10.1" @@ -2991,17 +2960,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "tomlkit" -version = "0.12.1" -description = "Style preserving TOML library" -optional = true -python-versions = ">=3.7" -files = [ - {file = "tomlkit-0.12.1-py3-none-any.whl", hash = "sha256:712cbd236609acc6a3e2e97253dfc52d4c2082982a88f61b640ecf0817eab899"}, - {file = "tomlkit-0.12.1.tar.gz", hash = "sha256:38e1ff8edb991273ec9f6181244a6a391ac30e9f5098e7535640ea6be97a7c86"}, -] - [[package]] name = "types-aiofiles" version = "23.2.0.20240311" @@ -3422,11 +3380,11 @@ url = "https://pypi.chia.net/simple" reference = "chia" [extras] -dev = ["aiohttp_cors", "black", "build", "coverage", "diff-cover", "flake8", "isort", "lxml", "mypy", "pre-commit", "pre-commit", "py3createtorrent", "pyinstaller", "pylint", "pytest", "pytest-cov", "pytest-mock", "pytest-monitor", "pytest-xdist", "pyupgrade", "types-aiofiles", "types-cryptography", "types-pyyaml", "types-setuptools"] +dev = ["aiohttp_cors", "black", "build", "coverage", "diff-cover", "flake8", "isort", "lxml", "mypy", "pre-commit", "pre-commit", "py3createtorrent", "pyinstaller", "pytest", "pytest-cov", "pytest-mock", "pytest-monitor", "pytest-xdist", "pyupgrade", "types-aiofiles", "types-cryptography", "types-pyyaml", "types-setuptools"] legacy-keyring = ["keyrings.cryptfile"] upnp = ["miniupnpc"] [metadata] lock-version = "2.0" python-versions = ">=3.9, <3.13" -content-hash = "fe87fd693372aa1c4e1596ce31c01cee1e50c5f7f24b9099c80410fde037568d" +content-hash = "18912f0d4b20b794111a68c8c95cc875ede2cc0504c1640d81e4c2d893b3276d" diff --git a/pylintrc b/pylintrc deleted file mode 100644 index 7913c3742373..000000000000 --- a/pylintrc +++ /dev/null @@ -1,583 +0,0 @@ -[MASTER] -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-allow-list=lxml,zstd - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. -jobs=4 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Specify a configuration file. -#rcfile= - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -disable=locally-disabled, - suppressed-message, - import-error, - abstract-method, - arguments-differ, - arguments-renamed, - attribute-defined-outside-init, - bare-except, - broad-exception-caught, - broad-exception-raised, - cell-var-from-loop, - chained-comparison, - consider-iterating-dictionary, - consider-using-enumerate, - consider-using-in, - consider-using-with, - cyclic-import, - dangerous-default-value, - duplicate-code, - duplicate-key, - expression-not-assigned, - fixme, - global-statement, - global-variable-not-assigned, - implicit-str-concat, - import-outside-toplevel, - inconsistent-return-statements, - invalid-name, - keyword-arg-before-vararg, - line-too-long, - logging-fstring-interpolation, - logging-not-lazy, - lost-exception, - missing-class-docstring, - missing-function-docstring, - missing-module-docstring, - no-else-break, - no-else-continue, - no-else-raise, - no-else-return, - pointless-statement, - pointless-string-statement, - protected-access, - raise-missing-from, - raising-format-tuple, - redefined-argument-from-local, - redefined-builtin, - redefined-outer-name, - reimported, - return-in-finally, - simplifiable-condition, - simplifiable-if-expression, - simplifiable-if-statement, - singleton-comparison, - subprocess-run-check, - superfluous-parens, - too-few-public-methods, - too-many-ancestors, - too-many-arguments, - too-many-boolean-expressions, - too-many-branches, - too-many-instance-attributes, - too-many-lines, - too-many-locals, - too-many-nested-blocks, - too-many-public-methods, - too-many-return-statements, - too-many-statements, - try-except-raise, - typevar-name-incorrect-variance, - unbalanced-tuple-unpacking, - undefined-loop-variable, - ungrouped-imports, - unidiomatic-typecheck, - unknown-option-value, - unnecessary-comprehension, - unnecessary-dict-index-lookup, - unnecessary-dunder-call, - unnecessary-ellipsis, - unnecessary-lambda, - unnecessary-lambda-assignment, - unnecessary-negation, - unnecessary-pass, - unspecified-encoding, - unused-argument, - unused-import, - unused-variable, - unused-wildcard-import, - use-a-generator, - use-dict-literal, - use-implicit-booleaness-not-comparison, - use-implicit-booleaness-not-len, - useless-else-on-loop, - useless-import-alias, - useless-return, - use-list-literal, - wildcard-import, - wrong-import-order, - wrong-import-position, - multiple-statements, - contextmanager-generator-missing-cleanup, - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=c-extension-no-member - - -[REPORTS] - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio).You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=no - -# Activate the evaluation score. -score=no - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=optparse.Values,sys.exit - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins=cls - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules=chiabip158, - chiapos, - chiavdf, - chia_rs, - cryptography, - aiohttp, - keyring, - bitstring, - clvm_tools, - clvm_tools_rs, - setproctitle, - clvm, - colorlog, - concurrent_log_handler, - aiosqlite, - sortedcontainers, - aiter, - miniupnpc, - pytest, - setuptools_scm - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX, - TODO - - -[BASIC] - -# Naming style matching correct argument names -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style -#argument-rgx= - -# Naming style matching correct attribute names -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Naming style matching correct class attribute names -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style -#class-attribute-rgx= - -# Naming style matching correct class names -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming-style -#class-rgx= - -# Naming style matching correct constant names -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming style matching correct function names -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma -good-names=i, - j, - k, - ex, - Run, - _ - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# Naming style matching correct inline iteration names -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style -#inlinevar-rgx= - -# Naming style matching correct method names -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style -#method-rgx= - -# Naming style matching correct module names -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Naming style matching correct variable names -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style -#variable-rgx= - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes -max-spelling-suggestions=4 - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=120 - -# Maximum number of lines in a module -max-module-lines=1000 - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of statements in function / method body -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# The following functions mutate other functions' signatures and need a E1120 exception -signature-mutators=chia.rpc.util.tx_endpoint - -[IMPORTS] - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub, - TERMIOS, - Bastion, - rexec - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=builtins.Exception diff --git a/pyproject.toml b/pyproject.toml index 92db76773d38..732a42af5eab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,7 +91,6 @@ mypy = { version = "1.11.1", optional = true } pre-commit = [ { version = "3.5.0", python = "<3.9", optional = true }, { version = "3.7.1", python = ">=3.9", optional = true } ] py3createtorrent = { version = "1.2.1", optional = true } pyinstaller = { version = "6.9.0", optional = true } -pylint = { version = "3.2.6", optional = true } pytest = { version = "8.3.3", optional = true } pytest-cov = { version = "5.0.0", optional = true } pytest-mock = { version = "3.14.0", optional = true } @@ -108,10 +107,11 @@ pyupgrade = { version = "3.16.0", optional = true } # numpy = [ # {version="1.24.4", python = "<3.9", optional = true}, # {version="1.26.4", python = ">=3.9", optional = true}] +ruff = "0.7.1" [tool.poetry.extras] -dev = ["aiohttp_cors", "black", "build", "coverage", "diff-cover", "flake8", "isort", "mypy", "pre-commit", "py3createtorrent", "pyinstaller", "pylint", "pytest", "pytest-cov", "pytest-mock", "pytest-monitor", "pytest-xdist", "types-aiofiles", "types-cryptography", "types-pyyaml", "types-setuptools", "pyupgrade", "lxml"] +dev = ["aiohttp_cors", "black", "build", "coverage", "diff-cover", "flake8", "isort", "mypy", "pre-commit", "py3createtorrent", "pyinstaller", "pytest", "pytest-cov", "pytest-mock", "pytest-monitor", "pytest-xdist", "types-aiofiles", "types-cryptography", "types-pyyaml", "types-setuptools", "pyupgrade", "lxml"] upnp = ["miniupnpc"] legacy_keyring = ["keyrings.cryptfile"] @@ -158,3 +158,63 @@ include = ''' )$ ''' exclude = '' + +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +preview = true +select = ["PL"] +explicit-preview-rules = false +ignore = [ + # Pylint convention + "PLC0105", # type-name-incorrect-variance + "PLC0415", # import-outside-top-level + "PLC2801", # unnecessary-dunder-call + "PLC0206", # dict-index-missing-items + "PLC1901", # compare-to-empty-string + "PLC2701", # import-private-name + "PLC0414", # useless-import-alias + + # Pylint refactor + "PLR0915", # too-many-statements + "PLR0914", # too-many-locals + "PLR0913", # too-many-arguments + "PLR0912", # too-many-branches + "PLR1702", # too-many-nested-blocks + "PLR0904", # too-many-public-methods + "PLR6301", # no-self-use + "PLR0917", # too-many-positional-arguments + "PLR6201", # literal-membership + "PLR0911", # too-many-return-statements + "PLR2004", # magic-value-comparison + "PLR1714", # repeated-equality-comparison + "PLR6104", # non-augmented-assignment + "PLR1704", # redefined-argument-from-local + "PLR0916", # too-many-boolean-expressions + "PLR5501", # collapsible-else-if + "PLR1711", # useless-return + "PLR1730", # if-stmt-min-max + "PLR1736", # unnecessary-list-index-lookup + "PLR1733", # unnecessary-dict-index-lookup + + # Pylint warning + "PLW2901", # redefined-loop-name + "PLW1641", # eq-without-hash + "PLW1514", # unspecified-encoding + "PLW0602", # global-variable-not-assigned + "PLW0603", # global-statement + "PLW0108", # unnecessary-lambda + "PLW1510", # subprocess-run-without-check + "PLW0120", # useless-else-on-loop +] + +[tool.ruff.lint.pylint] +max-args = 5 +max-locals = 15 +max-returns = 6 +max-branches = 12 +max-statements = 50 +max-nested-blocks = 5 +max-public-methods = 20 +max-bool-expr = 5 diff --git a/tools/analyze-chain.py b/tools/analyze-chain.py index 3278e6898401..293f4d5a3100 100755 --- a/tools/analyze-chain.py +++ b/tools/analyze-chain.py @@ -163,5 +163,4 @@ def default_call( if __name__ == "__main__": - # pylint: disable = no-value-for-parameter main() diff --git a/tools/analyze_memory_profile.py b/tools/analyze_memory_profile.py index 976151ce95ee..ffe08b4532e7 100644 --- a/tools/analyze_memory_profile.py +++ b/tools/analyze_memory_profile.py @@ -211,4 +211,4 @@ def analyze_slot(ctx: click.Context, slot: int) -> None: if __name__ == "__main__": - memory_profiler() # pylint: disable = no-value-for-parameter + memory_profiler() diff --git a/tools/cpu_utilization.py b/tools/cpu_utilization.py index 9acc028b0d53..40cb24d87f9b 100644 --- a/tools/cpu_utilization.py +++ b/tools/cpu_utilization.py @@ -115,5 +115,4 @@ def main(pid: int, output: str, threads: bool) -> None: if __name__ == "__main__": - # pylint: disable = no-value-for-parameter main() diff --git a/tools/generate_chain.py b/tools/generate_chain.py index 87c135539f7e..4d3b0d59823b 100644 --- a/tools/generate_chain.py +++ b/tools/generate_chain.py @@ -222,5 +222,4 @@ def main(length: int, fill_rate: int, profile: bool, block_refs: bool, output: O if __name__ == "__main__": - # pylint: disable = no-value-for-parameter main() diff --git a/tools/run_block.py b/tools/run_block.py index b8f5c7e8a0f1..2d5a9feac4cc 100644 --- a/tools/run_block.py +++ b/tools/run_block.py @@ -76,4 +76,4 @@ def get_config_and_constants(): if __name__ == "__main__": - cmd_run_json_block_file() # pylint: disable=no-value-for-parameter + cmd_run_json_block_file() diff --git a/tools/test_full_sync.py b/tools/test_full_sync.py index 2af2ca12880a..ef928ea667ca 100755 --- a/tools/test_full_sync.py +++ b/tools/test_full_sync.py @@ -204,5 +204,4 @@ async def run_sync_checkpoint( main.add_command(analyze) if __name__ == "__main__": - # pylint: disable = no-value-for-parameter main()