pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

add type hints to components

Open michaelbynum opened this issue 1 year ago • 1 comments

Changes proposed in this PR:

  • Add some type hints to components

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

michaelbynum avatar Mar 03 '24 12:03 michaelbynum

It looks like there might be a workaround to avoid the function call:

    @overload
    def __getitem__(self, index) -> _BlockData:
        ...

    __getitem__ = IndexedComponent.__getitem__  # type: ignore

jsiirola avatar Mar 06 '24 20:03 jsiirola

It looks like there might be a workaround to avoid the function call:

    @overload
    def __getitem__(self, index) -> _BlockData:
        ...

    __getitem__ = IndexedComponent.__getitem__  # type: ignore

Genius!!!

michaelbynum avatar Mar 07 '24 23:03 michaelbynum