From 796231ec57266e03dd0889c6e7b40dc21b80e170 Mon Sep 17 00:00:00 2001 From: James Myatt Date: Thu, 13 Feb 2025 13:35:42 +0000 Subject: [PATCH] Fix type hints for add_collection --- invoke/collection.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/invoke/collection.py b/invoke/collection.py index 23dcff928..cece24cd4 100644 --- a/invoke/collection.py +++ b/invoke/collection.py @@ -1,6 +1,6 @@ import copy from types import ModuleType -from typing import Any, Callable, Dict, List, Optional, Tuple +from typing import Any, Callable, Dict, List, Optional, Tuple, Union from .util import Lexicon, helpline @@ -284,14 +284,16 @@ def add_task( def add_collection( self, - coll: "Collection", + coll: Union["Collection", ModuleType], name: Optional[str] = None, default: Optional[bool] = None, ) -> None: """ Add `.Collection` ``coll`` as a sub-collection of this one. - :param coll: The `.Collection` to add. + :param coll: + The `.Collection` to add. A `ModuleType` will be converted to a + `.Collection` using `.Collection.from_module`. :param str name: The name to attach the collection as. Defaults to the collection's