Skip to content

Commit

Permalink
chore: address linting errors after dev tooling update
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-makerx committed Oct 17, 2024
1 parent 97ccac8 commit fb0b057
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
18 changes: 9 additions & 9 deletions src/algokit_utils/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down Expand Up @@ -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:
Expand All @@ -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]


Expand Down
2 changes: 1 addition & 1 deletion src/algokit_utils/application_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions src/algokit_utils/beta/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/algokit_utils/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

1 comment on commit fb0b057

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_utils
   _debugging.py140795%20, 41, 76, 80, 89, 129, 157
   _ensure_funded.py69199%99
   _transfer.py67396%13, 76–77
   account.py851385%14–17, 61–65, 96, 109, 136, 139, 183
   application_client.py5287785%59–60, 167, 172, 201, 313, 318–319, 321, 323, 788, 803, 821–824, 914, 954, 966, 979, 1021, 1081–1087, 1091–1096, 1098, 1134, 1141, 1254, 1284, 1298, 1336–1338, 1340, 1350–1407, 1418–1423, 1443–1446
   application_specification.py971189%92, 94, 193–202, 206
   asset.py79594%9, 27–30
   common.py13192%13
   config.py511865%38–39, 50, 55, 60, 64–69, 100–109
   deploy.py4632694%30–33, 168, 172–173, 190, 205, 246, 362–363, 418, 429–437, 454–457, 467, 475, 668–669, 693
   dispenser_api.py821285%112–113, 117–120, 155–157, 176–178
   logic_error.py39295%8, 31
   models.py131695%45, 50–52, 61–62
   network_clients.py63395%93–94, 125
src/algokit_utils/beta
   account_manager.py551475%39–40, 64, 123–130, 183–187, 198–200
   algorand_client.py1011585%111–112, 121–122, 143–145, 154–155, 224, 259, 274, 290, 303, 319
   client_manager.py371073%40, 61–63, 68–70, 75–78
   composer.py3207178%335–336, 339–340, 343–344, 347–348, 355–356, 359–360, 389, 391, 393, 396, 399, 404, 407, 411, 414, 456–489, 494–505, 510–516, 521–529, 549–562, 566, 590, 593–610, 618, 643, 659–660, 662–663, 665–666, 668–669, 671–672, 678–682
TOTAL243429588% 

Tests Skipped Failures Errors Time
204 0 💤 0 ❌ 0 🔥 2m 20s ⏱️

Please sign in to comment.