AndreaCensi/contracts

cannot specify parameter type as file in docstring

gezakiss7 opened this issue · 1 comments

Is there a way to specify that a parameter's type is file in the docstring?
The expression ":type in_file: file" does not work, nor do other formats I could think of.
(Note that the decorator "@contract(in_file=file)" works, but I'd like to use the docstring.)

It's only a workaround, but note that

:type in_file: isinstance(file)

will work correctly (i.e. you won't get e.g. ParseSyntaxException: Unknown identifier 'file'. Did you mean 'finite'? and non-file arguments will be rejected).