mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Make type hints compatible with Python 3.8
This commit is contained in:
parent
8da1ac6cee
commit
c4fb92c658
@ -1,8 +1,9 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from contextlib import (AbstractAsyncContextManager, AbstractContextManager,
|
from contextlib import asynccontextmanager, contextmanager
|
||||||
asynccontextmanager, contextmanager)
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import AsyncIterator, Iterator, List, Optional
|
# TODO If we upgrade to python 3.9, these context manager hints are deprecated
|
||||||
|
from typing import (AsyncContextManager, AsyncIterator, ContextManager,
|
||||||
|
Iterator, List, Optional)
|
||||||
|
|
||||||
import rich
|
import rich
|
||||||
from rich.markup import escape
|
from rich.markup import escape
|
||||||
@ -59,7 +60,7 @@ class TerminalConductor:
|
|||||||
finally:
|
finally:
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def exclusive_output(self) -> AbstractAsyncContextManager[None]:
|
def exclusive_output(self) -> AsyncContextManager[None]:
|
||||||
return self._exclusive_output_cm()
|
return self._exclusive_output_cm()
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
@ -79,5 +80,5 @@ class TerminalConductor:
|
|||||||
self,
|
self,
|
||||||
description: Path,
|
description: Path,
|
||||||
steps: Optional[float],
|
steps: Optional[float],
|
||||||
) -> AbstractContextManager[ProgressBar]:
|
) -> ContextManager[ProgressBar]:
|
||||||
return self._progress_bar_cm(escape(str(description)), steps=steps)
|
return self._progress_bar_cm(escape(str(description)), steps=steps)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from contextlib import AbstractAsyncContextManager, asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from typing import AsyncIterator
|
# TODO If we upgrade to python 3.9, this context manager hint is deprecated
|
||||||
|
from typing import AsyncContextManager, AsyncIterator
|
||||||
|
|
||||||
|
|
||||||
class Limiter:
|
class Limiter:
|
||||||
@ -15,5 +16,5 @@ class Limiter:
|
|||||||
finally:
|
finally:
|
||||||
self._semaphore.release()
|
self._semaphore.release()
|
||||||
|
|
||||||
def limit(self) -> AbstractAsyncContextManager[None]:
|
def limit(self) -> AsyncContextManager[None]:
|
||||||
return self._context_manager()
|
return self._context_manager()
|
||||||
|
Loading…
Reference in New Issue
Block a user