Python static analysis fails on some codon-specific code (i.e. u32, u64 used as types). An handy solution could be including for the type checkers a small section where necessary, like:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
u64 = int
u32 = int
This should allow standard type checkers and static analysis to work decently with codon.
As of now, the above code results in the compilation error:
error: cannot import name 'TYPE_CHECKING' from 'typing'
A simple fix, I believe, would be adding TYPE_CHECKING = False in typing
EDIT: I am not sure the codon compiler skips entirely a block that is 100% sure not to be executed. If that's not the case, it might not be as easy :')
Python static analysis fails on some codon-specific code (i.e. u32, u64 used as types). An handy solution could be including for the type checkers a small section where necessary, like:
This should allow standard type checkers and static analysis to work decently with codon.
As of now, the above code results in the compilation error:
A simple fix, I believe, would be adding
TYPE_CHECKING = Falsein typingEDIT: I am not sure the codon compiler skips entirely a block that is 100% sure not to be executed. If that's not the case, it might not be as easy :')