|
23 | 23 | from __future__ import annotations |
24 | 24 |
|
25 | 25 | from collections import OrderedDict |
26 | | -from contextlib import contextmanager |
| 26 | +from contextlib import AbstractContextManager, contextmanager |
27 | 27 | import difflib |
28 | 28 | from funcy import keep |
29 | 29 | import inspect |
30 | 30 | from itertools import count |
31 | 31 | from typing import ( |
32 | | - Any, Callable, ContextManager, Dict, Iterator, List as _List, Optional, |
33 | | - Sequence, Set, TYPE_CHECKING, Tuple, Type, Union |
| 32 | + Any, Callable, Dict, Iterator, List as _List, Optional, Sequence, Set, |
| 33 | + TYPE_CHECKING, Tuple, Type, Union |
34 | 34 | ) |
35 | 35 |
|
36 | 36 | import funcy |
@@ -270,7 +270,7 @@ def __init__(self, |
270 | 270 | If we loaded a Lkt unit, mapping of all grammar rules it contains. |
271 | 271 | """ |
272 | 272 |
|
273 | | - def context(self) -> ContextManager[None]: |
| 273 | + def context(self) -> AbstractContextManager[None]: |
274 | 274 | return diagnostic_context(self.location) |
275 | 275 |
|
276 | 276 | def _add_rule(self, name: str, parser: Parser, doc: str = "") -> None: |
@@ -762,7 +762,7 @@ def set_location(self, location: Location) -> None: |
762 | 762 | c.set_location(self.location) |
763 | 763 |
|
764 | 764 | @property |
765 | | - def diagnostic_context(self) -> ContextManager[None]: |
| 765 | + def diagnostic_context(self) -> AbstractContextManager[None]: |
766 | 766 | """ |
767 | 767 | Helper that will return a diagnostic context manager with parameters |
768 | 768 | set for the grammar definition. |
|
0 commit comments