mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-15 00:07:09 +08:00
Fixes to ContextManager (#1249)
* add typing.ContextManager for 3.6+ only This fixes the easier part of #655. Would it make sense to add a generic typing.ContextManager that exists in any Python version? * update comment * fix argument types for ContextManager.__exit__ * add AsyncContextManager * add @asynccontextmanager * typing.ContextManager now always exists * back out async-related changes Will submit those in a separate PR later * fix import order * AbstractContextManager only exists in 3.6+ * AbstractContextManager -> ContextManager
This commit is contained in:
committed by
Matthias Kramm
parent
385b9c8b66
commit
7dd2f80194
10
third_party/2and3/atomicwrites/__init__.pyi
vendored
10
third_party/2and3/atomicwrites/__init__.pyi
vendored
@@ -1,16 +1,16 @@
|
||||
import contextlib
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
from typing import Any, AnyStr, Callable, IO, Iterator, Text
|
||||
from typing import Any, AnyStr, Callable, ContextManager, IO, Iterator, Text
|
||||
|
||||
def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ...
|
||||
def move_atomic(src: AnyStr, dst: AnyStr) -> None: ...
|
||||
class AtomicWriter(object):
|
||||
def __init__(self, path: AnyStr, mode: Text='w', overwrite: bool=False) -> None: ...
|
||||
def open(self) -> contextlib.ContextManager[IO]: ...
|
||||
def _open(self, get_fileobject: Callable) -> contextlib.ContextManager[IO]: ...
|
||||
def open(self) -> ContextManager[IO]: ...
|
||||
def _open(self, get_fileobject: Callable) -> ContextManager[IO]: ...
|
||||
def get_fileobject(self, dir: AnyStr=None, **kwargs) -> IO: ...
|
||||
def sync(self, f: IO) -> None: ...
|
||||
def commit(self, f: IO) -> None: ...
|
||||
def rollback(self, f: IO) -> None: ...
|
||||
def atomic_write(path: AnyStr, writer_cls: type=AtomicWriter, **cls_kwargs) -> contextlib.ContextManager[IO]: ...
|
||||
def atomic_write(path: AnyStr, writer_cls: type=AtomicWriter, **cls_kwargs) -> ContextManager[IO]: ...
|
||||
|
||||
Reference in New Issue
Block a user