We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a375aa5 commit 485f0b9Copy full SHA for 485f0b9
tap/utils.py
@@ -171,6 +171,15 @@ def is_option_arg(*name_or_flags) -> bool:
171
return any(name_or_flag.startswith('-') for name_or_flag in name_or_flags)
172
173
174
+def is_positional_arg(*name_or_flags) -> bool:
175
+ """Returns whether the argument is a positional arg (as opposed to an optional arg).
176
+
177
+ :param name_or_flags: Either a name or a list of option strings, e.g. foo or -f, --foo.
178
+ :return: True if the argument is a positional arg, False otherwise.
179
+ """
180
+ return not is_option_arg(*name_or_flags)
181
182
183
def tokenize_source(obj: object) -> Generator:
184
"""Returns a generator for the tokens of the object's source code."""
185
source = inspect.getsource(obj)
0 commit comments