From 9891ba9e470834a11dbad87956bd874a8137e9bf Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 1 Mar 2022 18:41:36 -0800 Subject: [PATCH] allow passing a single Tool to be used as the default --- masque/builder/devices.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/masque/builder/devices.py b/masque/builder/devices.py index 1aebb56..4bf8692 100644 --- a/masque/builder/devices.py +++ b/masque/builder/devices.py @@ -181,7 +181,7 @@ class Device(Copyable, Mirrorable): pattern: Optional[Pattern] = None, ports: Optional[Dict[str, Port]] = None, *, - tools: Optional[Dict[Optional[str], Tool]] = None, + tools: Union[None, Tool, Dict[Optional[str], Tool]] = None, name: Optional[str] = None, ) -> None: """ @@ -209,6 +209,8 @@ class Device(Copyable, Mirrorable): if tools is None: self.tools = {} + elif isinstance(tools, Tool): + self.tools = {None: tools} else: self.tools = tools