MCPcopy Create free account
hub / github.com/apache/madlib / Action

Class Action

src/madpack/argparse.py:741–829  ·  view source on GitHub ↗

Information about how to convert command line strings to Python objects. Action objects are used by an ArgumentParser to represent the information needed to parse a single argument from one or more strings from the command line. The keyword arguments to the Action constructor are also

Source from the content-addressed store, hash-verified

739# ==============
740
741class Action(_AttributeHolder):
742 """Information about how to convert command line strings to Python objects.
743
744 Action objects are used by an ArgumentParser to represent the information
745 needed to parse a single argument from one or more strings from the
746 command line. The keyword arguments to the Action constructor are also
747 all attributes of Action instances.
748
749 Keyword Arguments:
750
751 - option_strings -- A list of command-line option strings which
752 should be associated with this action.
753
754 - dest -- The name of the attribute to hold the created object(s)
755
756 - nargs -- The number of command-line arguments that should be
757 consumed. By default, one argument will be consumed and a single
758 value will be produced. Other values include:
759 - N (an integer) consumes N arguments (and produces a list)
760 - '?' consumes zero or one arguments
761 - '*' consumes zero or more arguments (and produces a list)
762 - '+' consumes one or more arguments (and produces a list)
763 Note that the difference between the default and nargs=1 is that
764 with the default, a single value will be produced, while with
765 nargs=1, a list containing a single value will be produced.
766
767 - const -- The value to be produced if the option is specified and the
768 option uses an action that takes no values.
769
770 - default -- The value to be produced if the option is not specified.
771
772 - type -- The type which the command-line arguments should be converted
773 to, should be one of 'string', 'int', 'float', 'complex' or a
774 callable object that accepts a single string argument. If None,
775 'string' is assumed.
776
777 - choices -- A container of values that should be allowed. If not None,
778 after a command-line argument has been converted to the appropriate
779 type, an exception will be raised if it is not a member of this
780 collection.
781
782 - required -- True if the action must always be specified at the
783 command line. This is only meaningful for optional command-line
784 arguments.
785
786 - help -- The help string describing the argument.
787
788 - metavar -- The name to be used for the option's argument with the
789 help string. If None, the 'dest' value will be used as the name.
790 """
791
792 def __init__(self,
793 option_strings,
794 dest,
795 nargs=None,
796 const=None,
797 default=None,
798 type=None,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected