Skip to content

Commit fc78920

Browse files
committed
chore: fixing some small types and urls
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent 45af817 commit fc78920

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

README_types.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,41 @@ if __name__ == "__main__":
162162
account = AccountId(0, 0, 200)
163163
query_hbar_balance(account)
164164

165+
def_query_hbar_balance function takes account as an argument, which is of custom type AccountId, then the function returns type None. It returns None because there is no return statement in the function, and it instead prints.
166+
167+
### Example 2
168+
from dataclasses import dataclass
169+
from hiero_sdk import AccountId
170+
from hiero_sdk import CryptoGetAccountBalanceQuery
171+
172+
def build_balance_query(account: AccountId) -> CryptoGetAccountBalanceQuery:
173+
"""
174+
Construct and return a CryptoGetAccountBalanceQuery for the given account.
175+
176+
Args:
177+
account (AccountId): The Hedera account identifier.
178+
179+
Returns:
180+
CryptoGetAccountBalanceQuery: A query object you can execute to fetch the balance.
181+
"""
182+
return CryptoGetAccountBalanceQuery(account)
183+
184+
if __name__ == "__main__":
185+
account = AccountId(0, 0, 200)
186+
query = build_balance_query(acct)
187+
print(query)
188+
165189
## Installing and Using MyPy
166190

167-
Use MyPy to help check for correct typing in your code and its imports. You can adopt type hints graduallyMyPy will not:
191+
Use MyPy to help check for correct typing in your code and its imports. You can adopt type hints gradually without impacting runtime. MyPy will not:
168192

169193
- Prevent or change the running of your code
170-
- By default, check untyped code
171194

172195
This makes MyPy safe to introduce at your own pace.
173196

174197
### Install MyPy
175198

176-
```bash
199+
bash:
177200
pip install mypy
178201

179202
Command to check type hinting with MyPy for program.py:
@@ -182,10 +205,9 @@ E.g.
182205
mypy src/hiero_sdk_python/tokens/token_info.py
183206

184207
Read about MyPy:
185-
https://mypy.readthedocs.io/en/stable/
208+
Mypy [general](https://mypy.readthedocs.io/en/stable/).
186209

187-
Mypy cheatsheet:
188-
https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#cheat-sheet-py3
210+
Mypy cheatsheet [cheatsheet](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#cheat-sheet-py3).
189211

190212
## Configuring MyPy
191213

@@ -201,5 +223,5 @@ implicit_optional = True
201223
# Suppress errors when calling functions without type annotations
202224
allow_untyped_calls = True
203225

204-
For a full list of flags and options, see the MyPy command-line reference:
205-
https://mypy.readthedocs.io/en/stable/command_line.html#command-line
226+
For a full list of flags and options, see the MyPy command-line reference:
227+
[MyPy command-line reference](https://mypy.readthedocs.io/en/stable/command_line.html#command-line)

0 commit comments

Comments
 (0)