Skip to content

Commit 63cd150

Browse files
committed
chore: fix more type and linting warnings
1 parent 3fe7997 commit 63cd150

File tree

10 files changed

+22
-12
lines changed

10 files changed

+22
-12
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ repos:
1919
require_serial: false
2020
additional_dependencies: []
2121
minimum_pre_commit_version: '0'
22-
files: '^(src|tests)/'
2322
- id: mypy
2423
name: mypy
2524
description: '`mypy` will check Python types for correctness'
@@ -29,4 +28,3 @@ repos:
2928
require_serial: true
3029
additional_dependencies: [ ]
3130
minimum_pre_commit_version: '2.9.2'
32-
files: '^(src|tests)/'

examples/helloworld/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: noqa
22
# fmt: off
3+
# mypy: disable-error-code="no-any-return, no-untyped-call"
34
# This file was automatically generated by algokit-client-generator.
45
# DO NOT MODIFY IT BY HAND.
56
import base64

examples/lifecycle/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: noqa
22
# fmt: off
3+
# mypy: disable-error-code="no-any-return, no-untyped-call"
34
# This file was automatically generated by algokit-client-generator.
45
# DO NOT MODIFY IT BY HAND.
56
import base64

examples/lifecycle/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
@pytest.fixture(scope="session")
20-
def lifecycle_client(algod_client: AlgodClient, indexer_client: IndexerClient) -> LifeCycleAppClient:
20+
def lifecycle_client(algod_client: AlgodClient) -> LifeCycleAppClient:
2121
account = get_localnet_default_account(algod_client)
2222
signer = AccountTransactionSigner(account.private_key)
2323

examples/state/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: noqa
22
# fmt: off
3+
# mypy: disable-error-code="no-any-return, no-untyped-call"
34
# This file was automatically generated by algokit-client-generator.
45
# DO NOT MODIFY IT BY HAND.
56
import base64

examples/state/test_client.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: disable-error-code="no-untyped-call"
12
import algokit_utils
23
import algosdk
34
import pytest
@@ -146,28 +147,32 @@ def test_get_global_state(state_app_client: StateAppClient) -> None:
146147
state_app_client.deploy(
147148
template_values={"VALUE": 1}, allow_delete=True, allow_update=True, on_update=OnUpdate.UpdateApp
148149
)
149-
state_app_client.set_global(int1=1, int2=2, bytes1="test", bytes2=b"test")
150+
int1_expected = 1
151+
int2_expected = 2
152+
state_app_client.set_global(int1=int1_expected, int2=int2_expected, bytes1="test", bytes2=b"test")
150153
response = state_app_client.get_global_state()
151154

152155
assert response.bytes1.as_bytes == b"test"
153156
assert response.bytes2.as_str == "test"
154-
assert response.int1 == 1
155-
assert response.int2 == 2
157+
assert response.int1 == int1_expected
158+
assert response.int2 == int2_expected
156159
assert response.value == 1
157160

158161

159162
def test_get_local_state(state_app_client: StateAppClient) -> None:
160163
state_app_client.deploy(
161164
template_values={"VALUE": 1}, allow_delete=True, allow_update=True, on_update=OnUpdate.UpdateApp
162165
)
166+
int1_expected = 1
167+
int2_expected = 2
163168
state_app_client.opt_in(args=OptInArgs())
164-
state_app_client.set_local(int1=1, int2=2, bytes1="test", bytes2=b"test")
169+
state_app_client.set_local(int1=int1_expected, int2=int2_expected, bytes1="test", bytes2=b"test")
165170
response = state_app_client.get_local_state(account=None)
166171

167172
assert response.local_bytes1.as_str == "test"
168173
assert response.local_bytes2.as_str == "test"
169-
assert response.local_int1 == 1
170-
assert response.local_int2 == 2
174+
assert response.local_int1 == int1_expected
175+
assert response.local_int2 == int2_expected
171176

172177

173178
def test_deploy_create_1arg(state_app_client: StateAppClient) -> None:

examples/voting/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: noqa
22
# fmt: off
3+
# mypy: disable-error-code="no-any-return, no-untyped-call"
34
# This file was automatically generated by algokit-client-generator.
45
# DO NOT MODIFY IT BY HAND.
56
import base64

examples/voting/test_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: disable-error-code="no-untyped-call"
12
import base64
23
import math
34
import random
@@ -106,7 +107,8 @@ def test_get_preconditions(
106107
signer=AccountTransactionSigner(voter[0].private_key),
107108
),
108109
)
109-
assert len(response.return_value) == 4
110+
expected_length = 4
111+
assert len(response.return_value) == expected_length
110112

111113

112114
@pytest.fixture()

examples/voting/voting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def calculate_total_options_count(self) -> pt.Expr:
210210

211211

212212
@app.create()
213-
def create(
213+
def create( # noqa: PLR0913
214214
vote_id: pt.abi.String,
215215
snapshot_public_key: pt.abi.DynamicBytes,
216216
metadata_ipfs_cid: pt.abi.String,
@@ -297,7 +297,7 @@ def close() -> pt.Expr:
297297
app.state.close_time.set(pt.Global.latest_timestamp()),
298298
(note := StringScratchVar()).store(
299299
pt.Concat(
300-
pt.Bytes('{"standard":"arc69","description":"This is a voting result NFT' " for voting round with ID "),
300+
pt.Bytes('{"standard":"arc69","description":"This is a voting result NFT for voting round with ID '),
301301
app.state.vote_id.get(),
302302
pt.Bytes('.","properties":{"metadata":"ipfs://'),
303303
app.state.metadata_ipfs_cid.get(),

src/algokit_client_generator/generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def generated_comment(context: GenerateContext) -> DocumentParts:
7171
def disable_linting(context: GenerateContext) -> DocumentParts:
7272
yield "# flake8: noqa" # this works for flake8 and ruff
7373
yield "# fmt: off" # disable formatting
74+
yield '# mypy: disable-error-code="no-any-return, no-untyped-call"' # disable common type warnings
7475

7576

7677
def imports(context: GenerateContext) -> DocumentParts:

0 commit comments

Comments
 (0)