You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using contracts, we often would like to provide type hints to help the IDE, whilst having more complex contracts in the docstring to be checked. Can I add support for this to PyContracts? I'm happy if it falls behind a configuration flag or something similar.
An over simplified example could be:
@contractdefadd_gt_5(x: int, y: int):
""" Add two numbers that are both greater than 5 :type x: int, >5 :type y: int, >5 :rtype: int, >11 """returnx+yadd_gt_5(10, 10) # Fineadd_gt_5(2, 2) # Should fail
I'm aware we can specify contracts as strings in the type annotations but then the IDE cannot decipher types to make life easier for the user.
Again, I'm happy to make this change just want to check that you're happy with it being in master. 😄
The text was updated successfully, but these errors were encountered:
Hey,
When using contracts, we often would like to provide type hints to help the IDE, whilst having more complex contracts in the docstring to be checked. Can I add support for this to PyContracts? I'm happy if it falls behind a configuration flag or something similar.
An over simplified example could be:
I'm aware we can specify contracts as strings in the type annotations but then the IDE cannot decipher types to make life easier for the user.
Again, I'm happy to make this change just want to check that you're happy with it being in master. 😄
The text was updated successfully, but these errors were encountered: