Mercurial > hg
diff tests/seq.py @ 50093:ce60c8d4ac87
typing: add type hints to argument checking functions in cmdutil
These might be surprising, since they can take strings instead of bytes. The
way `AnyStr` works is that it must be all bytes or all str for any given
invocation.
The wildcard here will be the `opts` that get passed in- if the type is unknown
and defaults to `Any`, there's no enforcement that the dict key type matches the
additional args. But a lot of uses should be using `**opts` from the command
method, which has a str key. The uses of these methods in this module are now
typed because their internals force a specific type, and it can't just be
inferred from the caller.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 14 Feb 2023 12:40:59 -0500 |
parents | 56f98406831b |
children | 2924676d4728 |