csv: Make _Writer.write positional-only (#6475)

At runtime it only uses positional parameters.

I think this works fortuitously in mypy and pyright because mypy ignores parameter names in protocols and pyright has a bug that allows passing positional-only to pos-or-keyword params (microsoft/pyright#2652) and the parameter to `io.TextIO.write` happens to be `__s`.
This commit is contained in:
Jelle Zijlstra
2021-12-02 13:27:21 -08:00
committed by GitHub
parent 906d5f1faf
commit 178b6bb8f4

View File

@@ -34,7 +34,7 @@ class _writer:
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
class _Writer(Protocol):
def write(self, s: str) -> Any: ...
def write(self, __s: str) -> object: ...
def writer(csvfile: _Writer, dialect: _DialectLike = ..., **fmtparams: Any) -> _writer: ...
def reader(csvfile: Iterable[str], dialect: _DialectLike = ..., **fmtparams: Any) -> _reader: ...