Skip to content
Myr

ctx.obj is marked Any instead of Optional[Any]

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This makes typing more convenient since it's a completely generic object and won't be None if users are using it.

authored by David Lord · committed by David Lord · parent 447b6bb · Browse files · 2 files+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−1 removed

  • other:+3 added−1 removed

2 files+3 added−1 removed

modified:src/click/core.py+1 added-1 removed
306 unmodified lines
307 if obj is None and parent is not None:308 obj = parent.obj309310 #: the user object stored.311 self.obj: t.Optional[t.Any] = obj311 self.obj: t.Any = obj312 self._meta: t.Dict[str, t.Any] = getattr(parent, "meta", {})313314 #: A dictionary (-like object) with defaults for parameters.315 if (
2617 unmodified lines
modified:CHANGES.rst+2 added
5 unmodified lines
6Unreleased78- Mark top-level names as exported so type checking understand imports9 in user projects. :issue:`1879`10- Annotate ``Context.obj`` as ``Any`` so type checking allows all11 operations on the arbitrary object. :issue:`121314Version 8.0.015-------------
854 unmodified lines