|
20 | 20 | import re |
21 | 21 | import sys |
22 | 22 | from collections import OrderedDict as odict |
23 | | -from typing import Any, Callable, Iterable, List, Optional, Tuple |
| 23 | +from typing import Any, Callable, Iterable, Optional |
24 | 24 |
|
25 | 25 | import pyrogue as pr |
26 | 26 |
|
@@ -323,10 +323,10 @@ def __getattr__(self, name: str) -> Any: |
323 | 323 | raise AttributeError('{} has no attribute {}'.format(self, name)) |
324 | 324 |
|
325 | 325 |
|
326 | | - def __dir__(self) -> List[str]: |
| 326 | + def __dir__(self) -> list[str]: |
327 | 327 | return super().__dir__() + [k for k,v in self._nodes.items()] |
328 | 328 |
|
329 | | - def __reduce__(self) -> Tuple[Any, Tuple[dict]]: |
| 329 | + def __reduce__(self) -> tuple[Any, tuple[dict]]: |
330 | 330 | attr = {} |
331 | 331 |
|
332 | 332 | attr['name'] = self._name |
@@ -465,7 +465,7 @@ def addNodes(self, nodeClass: Callable[..., Any], number: int, stride: int, **kw |
465 | 465 | self.add(nodeClass(name='{:s}[{:d}]'.format(name, i), offset=offset+(i*stride), **kwargs)) |
466 | 466 |
|
467 | 467 | @property |
468 | | - def nodeList(self) -> List[Any]: |
| 468 | + def nodeList(self) -> list[Any]: |
469 | 469 | """Return a recursive list of nodes.""" |
470 | 470 | lst = [] |
471 | 471 | for key,value in self._nodes.items(): |
@@ -521,7 +521,7 @@ def variablesByGroup(self, incGroups: Optional[list[str]] = None, excGroups: Opt |
521 | 521 | return self.getNodes(typ=pr.BaseVariable,excTyp=pr.BaseCommand,incGroups=incGroups,excGroups=excGroups) |
522 | 522 |
|
523 | 523 | @property |
524 | | - def variableList(self) -> List[Any]: |
| 524 | + def variableList(self) -> list[Any]: |
525 | 525 | """Return a recursive list of variables and commands.""" |
526 | 526 | lst = [] |
527 | 527 | for key,value in self.nodes.items(): |
@@ -550,7 +550,7 @@ def devicesByGroup(self, incGroups: Optional[list[str]] = None, excGroups: Optio |
550 | 550 | return self.getNodes(pr.Device,incGroups=incGroups,excGroups=excGroups) |
551 | 551 |
|
552 | 552 | @property |
553 | | - def deviceList(self) -> List[Any]: |
| 553 | + def deviceList(self) -> list[Any]: |
554 | 554 | """Return a recursive list of devices.""" |
555 | 555 | lst = [] |
556 | 556 | for key,value in self.nodes.items(): |
@@ -597,7 +597,7 @@ def isCommand(self) -> bool: |
597 | 597 | """Return True if this node is a command.""" |
598 | 598 | return self.isinstance(pr.BaseCommand) |
599 | 599 |
|
600 | | - def find(self, *, recurse: bool = True, typ: Optional[Any] = None, **kwargs: Any) -> List[Any]: |
| 600 | + def find(self, *, recurse: bool = True, typ: Optional[Any] = None, **kwargs: Any) -> list[Any]: |
601 | 601 | """ |
602 | 602 | Find all child nodes that are a base class of 'typ' |
603 | 603 | and whose properties match all of the kwargs. |
@@ -718,7 +718,7 @@ def _finishInit(self): |
718 | 718 | def getYaml( |
719 | 719 | self, |
720 | 720 | readFirst: bool = False, |
721 | | - modes: List[str] = ['RW','RO','WO'], |
| 721 | + modes: list[str] = ['RW','RO','WO'], |
722 | 722 | incGroups: Optional[list[str]] = None, |
723 | 723 | excGroups: Optional[list[str]] = ['Hidden'], |
724 | 724 | recurse: bool = True, |
@@ -750,7 +750,7 @@ def getYaml( |
750 | 750 | def printYaml( |
751 | 751 | self, |
752 | 752 | readFirst: bool = False, |
753 | | - modes: List[str] = ['RW','RO','WO'], |
| 753 | + modes: list[str] = ['RW','RO','WO'], |
754 | 754 | incGroups: Optional[list[str]] = None, |
755 | 755 | excGroups: Optional[list[str]] = ['Hidden'], |
756 | 756 | recurse: bool = False, |
@@ -862,7 +862,7 @@ def _setTimeout(self,timeout): |
862 | 862 | """ |
863 | 863 | pass |
864 | 864 |
|
865 | | - def nodeMatch(self, name: str) -> Tuple[List[Any], Optional[List[str]]]: |
| 865 | + def nodeMatch(self, name: str) -> tuple[list[Any], Optional[list[str]]]: |
866 | 866 | """Match a node name, including array-style accessors. |
867 | 867 |
|
868 | 868 | Parameters |
@@ -902,7 +902,7 @@ def nodeMatch(self, name: str) -> Tuple[List[Any], Optional[List[str]]]: |
902 | 902 | return _iterateDict(self._anodes[aname],keys),None |
903 | 903 |
|
904 | 904 |
|
905 | | -def _iterateDict(d: dict, keys: List[str]) -> List[Any]: |
| 905 | +def _iterateDict(d: dict, keys: list[str]) -> list[Any]: |
906 | 906 | """Iterate into a nested dict using array-style keys.""" |
907 | 907 | retList = [] |
908 | 908 |
|
@@ -943,7 +943,7 @@ def _iterateDict(d: dict, keys: List[str]) -> List[Any]: |
943 | 943 | return retList |
944 | 944 |
|
945 | 945 |
|
946 | | -def genBaseList(cls: Any) -> List[str]: |
| 946 | +def genBaseList(cls: Any) -> list[str]: |
947 | 947 | """Return a list of base class names for a class.""" |
948 | 948 | ret = [str(cls)] |
949 | 949 |
|
|
0 commit comments