We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This does not work:
def require(requirement: bool, error_message: str): if not requirement: raise Exception("ASR verify failed: " + error_message) def verify(asr: Transactions): t: Transaction for t in asr.transactions: require(len(t.items) >= 2, "len(items) >= 2") total = 0 for item in t.items: require(item.account_idx >= 0 and item.account_idx < len(asr.accounts), "0 <= account_idx < len(accounts)") require(item.commodity == "$", 'commodity == "$"') total += item.amount require(total == 0, "sum(items[:].amount) == 0")
Here are the workarounds that make it work today:
def verify(asr: Transactions): i: i32 for i in range(len(asr.transactions)): t: Transaction = asr.transactions[i] require(len(t.items) >= 2, "len(items) >= 2") total: i64 = i64(0) j: i32 for j in range(len(t.items)): item: TransactionItem = t.items[j] require(item.account_idx >= i64(0) and item.account_idx < i64(len(asr.accounts)), "0 <= account_idx < len(accounts)") require(item.commodity == "$", 'commodity == "$"') total += item.amount require(total == i64(0), "sum(items[:].amount) == 0")
There are several issues:
for t in asr.transactions
for item in t.items
t: Translation
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This does not work:
Here are the workarounds that make it work today:
There are several issues:
for t in asr.transactions
andfor item in t.items
t: Translation
without initializing it, since it is initialized in the loopThe text was updated successfully, but these errors were encountered: