This PR implements constraint types, both in the types ecosystem and as generated runtime assertions.
For the approach is quite naive in that:
predicate definition is restricted to a subset of Python that is manually parsed (with many redundant parts from PythonParser copied over to MidasParser, for example to resolve function calls)
subtyping only checks the base type, not the constraints
there is no constraint optimization when combining multiple predicates, nor when generating runtime assertions (e.g. to avoid creating identical functions)
the syntax and grammar for defining predicates is still a bit blurry, especially for parameters. Parameters are technically mixed (positional or keyword), but the underlying structures are the same as for functions, i.e. including positional- and keyword-only parameters, default values, etc.
This PR implements constraint types, both in the types ecosystem and as generated runtime assertions.
For the approach is quite naive in that:
- predicate definition is restricted to a subset of Python that is manually parsed (with many redundant parts from `PythonParser` copied over to `MidasParser`, for example to resolve function calls)
- subtyping only checks the base type, not the constraints
- there is no constraint optimization when combining multiple predicates, nor when generating runtime assertions (e.g. to avoid creating identical functions)
- the syntax and grammar for defining predicates is still a bit blurry, especially for parameters. Parameters are technically mixed (positional or keyword), but the underlying structures are the same as for functions, i.e. including positional- and keyword-only parameters, default values, etc.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This PR implements constraint types, both in the types ecosystem and as generated runtime assertions.
For the approach is quite naive in that:
PythonParsercopied over toMidasParser, for example to resolve function calls)776a3fb86cto3205e7b961