pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.31k stars 365 forks source link

`add_collection()` is missing the `ModuleType` in the type-hints #950

Open exhuma opened 1 year ago

exhuma commented 1 year ago

Since upgrading to 2.1.2 I'm getting a typing error when adding a module as collection.

The error originates from this line: https://github.com/pyinvoke/invoke/blob/b2da4d929d0e895d44d7f5b4581749f4709022e6/invoke/collection.py#L287

It can be fixed by using

    def add_collection(
        self,
        coll: Union["Collection", ModuleType],     # <-- fix
        name: Optional[str] = None,
        default: Optional[bool] = None,
    ) -> None:
kuwv commented 11 months ago

956