Package schrodinger :: Package application :: Package glide :: Package packages :: Module utils :: Class DictAction
[hide private]
[frames] | no frames]

Class DictAction

               object --+        
                        |        
argparse._AttributeHolder --+    
                            |    
              argparse.Action --+
                                |
                               DictAction

Argparse action class that uses values of the form key=val (see parseKeyval for more details) to fill a dictionary. (Similar to the "append" action, but for dicts.)

Instance Methods [hide private]
 
__init__(self, option_strings, dest, default=None, *a, **k)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__call__(self, parser, namespace, value, option_string=None)
 
parseKeyval(self, string)
Return a (key, val) tuple given a string.

Inherited from argparse.Action (private): _get_kwargs

Inherited from argparse._AttributeHolder: __repr__

Inherited from argparse._AttributeHolder (private): _get_args

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, option_strings, dest, default=None, *a, **k)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__call__(self, parser, namespace, value, option_string=None)
(Call operator)

 
Overrides: argparse.Action.__call__

parseKeyval(self, string)

 

Return a (key, val) tuple given a string. The string must start with the key, which is made of word characters (alphanumeric or underscore). Any non-word character optionally followed by whitespace acts as a separator, and everything else is the value. If the value is delimited by brackets or braces, it is parsed as JSON. If there is no delimiter, the value is interpreted as "yes".