summaryrefslogtreecommitdiff
path: root/src/click/types.py
diff options
context:
space:
mode:
authorMartijn Pieters <mj@zopatista.com>2022-11-09 17:03:49 +0000
committerDavid Lord <davidism@gmail.com>2023-01-19 16:33:27 -0800
commit085f414a046bd5f15dfa08bedd0aa50f25410520 (patch)
tree5340cf1aea7c3bf068f1fc9fc2db7a2650b86fe8 /src/click/types.py
parenta1093bbe0dae00eea8342247a0c2739b07a6acd8 (diff)
downloadclick-085f414a046bd5f15dfa08bedd0aa50f25410520.tar.gz
Type hinting: Low-hanging fruit improvements
Clean out a series of ignores, either by specifying types or by reworking code slightly the ignore is no longer needed.
Diffstat (limited to 'src/click/types.py')
-rw-r--r--src/click/types.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/click/types.py b/src/click/types.py
index 1b04e37..57866ec 100644
--- a/src/click/types.py
+++ b/src/click/types.py
@@ -702,17 +702,14 @@ class File(ParamType):
lazy = self.resolve_lazy_flag(value)
if lazy:
- f: t.IO[t.Any] = t.cast(
- t.IO[t.Any],
- LazyFile(
- value, self.mode, self.encoding, self.errors, atomic=self.atomic
- ),
+ lf = LazyFile(
+ value, self.mode, self.encoding, self.errors, atomic=self.atomic
)
if ctx is not None:
- ctx.call_on_close(f.close_intelligently) # type: ignore
+ ctx.call_on_close(lf.close_intelligently)
- return f
+ return t.cast(t.IO[t.Any], lf)
f, should_close = open_stream(
value, self.mode, self.encoding, self.errors, atomic=self.atomic