From 000e66fb7ad60a821274baa6cee694e5da23280f Mon Sep 17 00:00:00 2001 From: jorenham Date: Thu, 23 Jul 2026 23:05:20 +0200 Subject: [PATCH] Modernize inline type annotations --- src/sh/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sh/__init__.py b/src/sh/__init__.py index 6240977c..1c82b69f 100644 --- a/src/sh/__init__.py +++ b/src/sh/__init__.py @@ -73,7 +73,7 @@ from queue import Empty, Queue from shlex import quote as shlex_quote from types import GeneratorType, GenericAlias, ModuleType -from typing import Any, Dict, Type, Union +from typing import Any __project_url__ = "https://github.com/amoffat/sh" @@ -241,7 +241,7 @@ def poll(self, timeout): # by zhangyafeikimi when he discovered that if the fds created internally by sh # numbered > 1024, select.select failed (a limitation of select.select). this # can happen if your script opens a lot of files -Poller: Union[Type[SelectPoller], Type[PollPoller]] = SelectPoller +Poller: type[SelectPoller | PollPoller] = SelectPoller if HAS_POLL and not FORCE_USE_SELECT: Poller = PollPoller @@ -367,7 +367,7 @@ class CommandNotFound(AttributeError): rc_exc_regex = re.compile(r"(ErrorReturnCode|SignalException)_((\d+)|SIG[a-zA-Z0-9]+)") -rc_exc_cache: Dict[str, Type[ErrorReturnCode]] = {} +rc_exc_cache: dict[str, type[ErrorReturnCode]] = {} SIGNAL_MAPPING = { v: k for k, v in signal.__dict__.items() if re.match(r"SIG[a-zA-Z]+", k) @@ -1168,7 +1168,7 @@ class Command: thread_local = threading.local() RunningCommandCls = RunningCommand - _call_args: Dict[str, Any] = { + _call_args: dict[str, Any] = { "fg": False, # run command in foreground # run a command in the background. commands run in the background # ignore SIGHUP and do not automatically exit when the parent process