Closed pratyush618 closed 3 weeks ago
Isn't Callable
effectively the same as Callable[..., Any]
? Or am I misunderstood?
Confirmed. See PEP 484:
As well, a bare Callable in an annotation is equivalent to Callable[..., Any]
So this change shouldn't be necessary. Closing for now
have you though of writing environs using pydantic?
PR: Update
ParserMethod
Type Alias for More FlexibilitySummary:
This PR updates the
ParserMethod
type alias toCallable[..., object]
, which allows it to handle functions with any number of arguments and any return type. This change makes the type more flexible and compatible with a wider range of functions in the codebase.What Changed:
ParserMethod = typing.Callable
(incomplete).ParserMethod = Callable[..., object]
...
).object
).Why This Change:
The old type alias was too general and not fully defined. By switching to
Callable[..., object]
, we ensure better flexibility for callables, supporting a wider variety of function signatures with different argument types and return types.Impact:
ParserMethod
for more generic functions without any issues.