diff --git a/src/click/utils.py b/src/click/utils.py index e2e3fe5f1..a987437ac 100644 --- a/src/click/utils.py +++ b/src/click/utils.py @@ -117,6 +117,14 @@ class LazyFile: files for writing. """ + name: str + mode: str + encoding: str | None + errors: str | None + atomic: bool + _f: t.IO[t.Any] | None + should_close: bool + def __init__( self, filename: str | os.PathLike[str], @@ -124,14 +132,12 @@ def __init__( encoding: str | None = None, errors: str | None = "strict", atomic: bool = False, - ): - self.name: str = os.fspath(filename) + ) -> None: + self.name = os.fspath(filename) self.mode = mode self.encoding = encoding self.errors = errors self.atomic = atomic - self._f: t.IO[t.Any] | None - self.should_close: bool if self.name == "-": self._f, self.should_close = open_stream(filename, mode, encoding, errors) @@ -508,6 +514,8 @@ class PacifyFlushWrapper: pipe, all calls and attributes are proxied. """ + wrapped: t.IO[t.Any] + def __init__(self, wrapped: t.IO[t.Any]) -> None: self.wrapped = wrapped