From 08a06d56dd697e39788ca31e67284dc8fb974c67 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 22 Feb 2026 13:23:28 +0100 Subject: fix doc text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- arg.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'arg.py') diff --git a/arg.py b/arg.py index bb83df1..b3a1aec 100644 --- a/arg.py +++ b/arg.py @@ -45,16 +45,16 @@ class Parser(object): def __init__(self, argv = None, symbols = '-', keep_dashdash = False, store_nonflags = False, usage = None): ''' - @param argv A list with the arguments to parse, if `None`, `sys.argv[1:]` is used - @param symbols A string or list contain the characters that will cause an argument - to be parsed as being a flag, multicharacter strings will be ignored - @param keep_dashdash If `True`, `--` will be returned in `self.argv` - @param keep_nonflags During parsing, non-flag arguments are ignored, and after the last - flag has been parsed, `self.argv` will have the ignored arguments at - the beginning - @param usage Function (without arguments) that is to be called if parsing fails - due to usage error, if `None`, `UsageError` will be raised instead - on usage error + @param argv A list with the arguments to parse, if `None`, `sys.argv[1:]` is used + @param symbols A string or list containing the characters that will cause an argument + to be parsed as being a flag, multicharacter strings will be ignored + @param keep_dashdash If `True`, `--` will be returned in `self.argv` + @param store_nonflags During parsing, non-flag arguments are ignored, and after the last + flag has been parsed, `self.argv` will have the ignored arguments at + the beginning + @param usage Function (without arguments) that is to be called if parsing fails + due to usage error, if `None`, `UsageError` will be raised instead + on usage error ''' if argv is None: argv = _sys.argv[1:] @@ -75,7 +75,7 @@ class Parser(object): ''' Return a generator that returns the flags in the command line - Properties and functions in `self` can be used to after each + Properties and functions in `self` can be used after each time a flag is returned Each returned value is a single character @@ -175,14 +175,14 @@ class Parser(object): Get the argument specified for the flag, can only be `None` (no argument) if `self.testlong` has returned `True` with `MAY_HAVE_ATTACHED_ARGUMENT` as the second - argument for the currnet flag + argument for the current flag Reading this property will cause the parser to assume - that the flag should have an argument, if these is - no argument UsageError will be raised (or the specified + that the flag should have an argument; if there is + no argument, UsageError will be raised (or the specified usage function will be called) unless `self.testlong` has returned `True` with `MAY_HAVE_ATTACHED_ARGUMENT` - as the second argument for the currnet flag + as the second argument for the current flag ''' if self._arg is None and not self._accept_none_arg: self._usage() @@ -243,7 +243,7 @@ class Parser(object): Check whether the current flag is specific long flag It is important to use this function, because it will - set the parser's state appropriately whe it finds a match + set the parser's state appropriately when it finds a match If the flag is the specified long flag, but its argument status does not match `argument`, UsageError will be raised -- cgit v1.2.3-70-g09d2