diff --git a/.github/workflows/check-python.yaml b/.github/workflows/check-python.yaml index ec6ee94e..ea7a5d9f 100644 --- a/.github/workflows/check-python.yaml +++ b/.github/workflows/check-python.yaml @@ -40,7 +40,7 @@ jobs: - name: Check linting with Ruff run: | # stop the build if there are Python syntax errors or undefined names - poetry run ruff . + poetry run ruff check . - name: Check types with mypy run: poetry run mypy diff --git a/pyproject.toml b/pyproject.toml index 0ee1f55c..9a2bd11c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,7 +121,7 @@ target-version = "py310" allow-star-arg-any = true suppress-none-returning = true -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "src/algokit_utils/beta/*" = ["ERA001", "E501", "PLR0911"] "path/to/file.py" = ["E402"] diff --git a/src/algokit_utils/account.py b/src/algokit_utils/account.py index aebb06ef..a0eb7d53 100644 --- a/src/algokit_utils/account.py +++ b/src/algokit_utils/account.py @@ -39,14 +39,14 @@ def get_account_from_mnemonic(mnemonic: str) -> Account: def create_kmd_wallet_account(kmd_client: "KMDClient", name: str) -> Account: """Creates a wallet with specified name""" - wallet_id = kmd_client.create_wallet(name, "")["id"] # type: ignore[no-untyped-call] - wallet_handle = kmd_client.init_wallet_handle(wallet_id, "") # type: ignore[no-untyped-call] - kmd_client.generate_key(wallet_handle) # type: ignore[no-untyped-call] + wallet_id = kmd_client.create_wallet(name, "")["id"] + wallet_handle = kmd_client.init_wallet_handle(wallet_id, "") + kmd_client.generate_key(wallet_handle) - key_ids: list[str] = kmd_client.list_keys(wallet_handle) # type: ignore[no-untyped-call] + key_ids: list[str] = kmd_client.list_keys(wallet_handle) account_key = key_ids[0] - private_account_key = kmd_client.export_key(wallet_handle, "", account_key) # type: ignore[no-untyped-call] + private_account_key = kmd_client.export_key(wallet_handle, "", account_key) return get_account_from_mnemonic(from_private_key(private_account_key)) # type: ignore[no-untyped-call] @@ -116,15 +116,15 @@ def get_kmd_wallet_account( predicate: "Callable[[dict[str, Any]], bool] | None" = None, ) -> Account | None: """Returns wallet matching specified name and predicate or None if not found""" - wallets: list[dict] = kmd_client.list_wallets() # type: ignore[no-untyped-call] + wallets: list[dict] = kmd_client.list_wallets() wallet = next((w for w in wallets if w["name"] == name), None) if wallet is None: return None wallet_id = wallet["id"] - wallet_handle = kmd_client.init_wallet_handle(wallet_id, "") # type: ignore[no-untyped-call] - key_ids: list[str] = kmd_client.list_keys(wallet_handle) # type: ignore[no-untyped-call] + wallet_handle = kmd_client.init_wallet_handle(wallet_id, "") + key_ids: list[str] = kmd_client.list_keys(wallet_handle) matched_account_key = None if predicate: for key in key_ids: @@ -138,7 +138,7 @@ def get_kmd_wallet_account( if not matched_account_key: return None - private_account_key = kmd_client.export_key(wallet_handle, "", matched_account_key) # type: ignore[no-untyped-call] + private_account_key = kmd_client.export_key(wallet_handle, "", matched_account_key) return get_account_from_mnemonic(from_private_key(private_account_key)) # type: ignore[no-untyped-call] diff --git a/src/algokit_utils/application_client.py b/src/algokit_utils/application_client.py index 6c10d01e..008ac32f 100644 --- a/src/algokit_utils/application_client.py +++ b/src/algokit_utils/application_client.py @@ -233,7 +233,7 @@ def prepare( ) -> "ApplicationClient": """Creates a copy of this ApplicationClient, using the new signer, sender and app_id values if provided. Will also substitute provided template_values into the associated app_spec in the copy""" - new_client: "ApplicationClient" = copy.copy(self) + new_client: ApplicationClient = copy.copy(self) new_client._prepare( # noqa: SLF001 new_client, signer=signer, sender=sender, app_id=app_id, template_values=template_values ) diff --git a/src/algokit_utils/beta/composer.py b/src/algokit_utils/beta/composer.py index 3defc3f7..a8aaa4b8 100644 --- a/src/algokit_utils/beta/composer.py +++ b/src/algokit_utils/beta/composer.py @@ -567,7 +567,7 @@ def _is_abi_value(self, x: bool | float | str | bytes | list | TxnParams) -> boo return isinstance(x, bool | int | float | str | bytes) - def _build_method_call( + def _build_method_call( # noqa: C901, PLR0912 self, params: MethodCallParams, suggested_params: algosdk.transaction.SuggestedParams ) -> list[TransactionWithSigner]: method_args = [] @@ -633,7 +633,7 @@ def _build_method_call( return self._build_atc(method_atc) - def _build_txn( + def _build_txn( # noqa: C901, PLR0912 self, txn: TransactionWithSigner | TxnParams | AtomicTransactionComposer, suggested_params: algosdk.transaction.SuggestedParams, diff --git a/src/algokit_utils/deploy.py b/src/algokit_utils/deploy.py index b24d584f..bb01c4f2 100644 --- a/src/algokit_utils/deploy.py +++ b/src/algokit_utils/deploy.py @@ -867,7 +867,7 @@ def _convert_deploy_args( signer: TransactionSigner | None, sender: str | None, ) -> tuple[ABIMethod | bool | None, ABIArgsDict, CreateCallParameters]: - args = _args.__dict__ if isinstance(_args, DeployCallArgs) else (_args or {}) + args = _args.__dict__ if isinstance(_args, DeployCallArgs) else dict(_args or {}) # return most derived type, unused parameters are ignored parameters = CreateCallParameters(