Skip to content

Commit

Permalink
Refactor AbstractContextManager import and usage
Browse files Browse the repository at this point in the history
  • Loading branch information
shunichironomura committed Feb 4, 2024
1 parent ccaf010 commit 5172311
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions capsula/encapsulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import threading
from collections import OrderedDict
from collections.abc import Hashable
from contextlib import AbstractContextManager
from itertools import chain
from typing import TYPE_CHECKING, Any, Dict, Generic, Tuple, TypeVar, Union

from capsula.utils import ExceptionInfo

from ._backport import AbstractContextManager
from ._capsule import Capsule
from ._context import ContextBase
from ._watcher import WatcherBase
Expand Down Expand Up @@ -40,7 +40,7 @@ def encapsulate(self) -> Any:
_V = TypeVar("_V", bound=WatcherBase)


class WatcherGroup(AbstractContextManager[Dict[_K, Any]], Generic[_K, _V]):
class WatcherGroup(Generic[_K, _V], AbstractContextManager[Dict[_K, Any]]):
def __init__(self, watchers: OrderedDict[_K, _V]) -> None:
self.watchers = watchers
self.context_manager_stack: queue.LifoQueue[AbstractContextManager[None]] = queue.LifoQueue()
Expand Down

0 comments on commit 5172311

Please sign in to comment.