(self, args, key, value)
return None
Append short arguments and value to dict.
Append short arguments and value to dict.
Append short arguments and value to dict .
def _append_short_args(self, args, key, value):
        """Append short arguments and value to dict."""
        # apply shorthands
        for short_arg, replacement in iteritems(SHORTHAND):
            key = key.replace(short_arg, replacement)
        for i, short_arg in enumerate(key[1:]):
            try:
                long_arg, long_arg_value = SHORT_ARGS[short_arg]
            except KeyError:
                logging.warning(u'Ignored unrecognised option `-%s`', short_arg)
            else:
                if i == len(key)-2:
                    # assign provided value to last argument specified
                    if long_arg_value and value:
                        logging.debug(
                            u'Value `%s` provided to option `-%s` interpreted as positional',
                            value, short_arg
                        )
                    self._append_arg(args, long_arg, long_arg_value or value or u'')
                else:
                    self._append_arg(args, long_arg, long_arg_value or u'')
        # if value provided not used, push back as positional
        if long_arg_value and value:
            return value
        return None
def _append_short_args ( self , args , key , value ) : # apply shorthands for short_arg , replacement in iteritems ( SHORTHAND ) : key = key . replace ( short_arg , replacement ) for i , short_arg in enumerate ( key [ 1 : ] ) : try : long_arg , long_arg_value = SHORT_ARGS [ short_arg ] except KeyError : logging . warning ( u'Ignored unrecognised option `-%s`' , short_arg ) else : if i == len ( key ) - 2 : # assign provided value to last argument specified if long_arg_value and value : logging . debug ( u'Value `%s` provided to option `-%s` interpreted as positional' , value , short_arg ) self . _append_arg ( args , long_arg , long_arg_value or value or u'' ) else : self . _append_arg ( args , long_arg , long_arg_value or u'' ) # if value provided not used, push back as positional if long_arg_value and value : return value return None