Helper - get arguments of a path drawing command
763570
function (str) {
    var output = [];
    var idx = 0;
    var c, num;

    var nextNumber = function () {
      var chars = [];

      while (/[^-\d\.]/.test(str.charAt(idx))) {
        // skip the non-digit characters
        idx++;
      }

      if ('-' === str.charAt(idx)) {
        chars.push('-');
        idx++;
      }

      while ((c = str.charAt(idx)) && /[\d\.Ee]/.test(c)) {
        chars.push(c);
        idx++;
      }

      return parseFloat(chars.join(''));
    };

    while (!isNaN(num = nextNumber())) output.push(num);

    return output;
  }
830393
def parse_command_line_arguments(argparse_parser, init_indent=5, subs_indent=5,
                                 line_width=76):
    """"""
    # Redirect stdout and stderr to prettify help or usage output from argparse.
    old_stdout = sys.stdout # save stdout
    old_stderr = sys.stderr # save stderr
    sys.stdout = RedirectHelp(sys.stdout, help_string_replacement_pairs,
            init_indent, subs_indent, line_width) # redirect stdout to add postprocessor
    sys.stderr = RedirectHelp(sys.stderr, help_string_replacement_pairs,
            init_indent, subs_indent, line_width) # redirect stderr to add postprocessor

    # Run the actual argument-parsing operation via argparse.
    args = argparse_parser.parse_args()

    # The argparse class has finished its argument-processing, so now no more
    # usage or help messages will be printed.  So restore stdout and stderr
    # to their usual settings, except with self-flushing added.
    sys.stdout = SelfFlushingOutstream(old_stdout)
    sys.stderr = SelfFlushingOutstream(old_stderr)

    return args
922519
def print_path(path: Path) -> str:
    """"""
    path_str = ""
    current_path: Optional[Path] = path
    while current_path:
        path_str = (
            f".{current_path.key}"
            if isinstance(current_path.key, str)
            else f"[{current_path.key}]"
        ) + path_str
        current_path = current_path.prev
    return f"value{path_str}" if path_str else ""
1083978
def _format_arguments(ctx):
    """"""
    params = [x for x in ctx.command.params if isinstance(x, click.Argument)]

    for param in params:
        for line in _format_argument(param):
            yield line
        yield ''
575620
private Argument[] getArguments()
	{
		Argument[] args = new Argument[auxArguments.size() + arguments.size()];

		for (int i = 0; i < auxArguments.size(); ++i)
		{
			args[i] = auxArguments.elementAt(i);
		}
		for (int j = 0; j < arguments.size(); ++j)
		{
			Command cmd = arguments.elementAt(j);

			if (cmd.getStatus() >= Command.COMMAND_EXECUTED)
			{
				args[auxArguments.size() + j] = cmd.getResult();
			}
			else
			{
				// System.out.println("arg: " + cmd.getResultValue());
				args = null;
				break;
			}
		}
		return args;
	}
1257958
def parse_args(args=None):
    """"""
    from argparse import ArgumentParser

    if args is None:
        args = sys.argv

    parser = ArgumentParser(description='''
Attempt to automatically find "adjacent" shapes in a SVG layer, and on a second
SVG layer, draw each detected connection between the center points of the
corresponding shapes.'''.strip())
    parser.add_argument('svg_input_file', type=path, default=None)
    parser.add_argument('svg_output_file', type=path, default="-",
                        help='Output file path ("-" for stdout)', nargs='?')
    parser.add_argument('-f', '--overwrite', action='store_true')

    args = parser.parse_args()

    if not args.overwrite and (args.svg_input_file == args.svg_output_file):
        parser.error('Input and output file are the same.  Use `-f` to force '
                     'overwrite.')

    return args
74433
def find_command(cmd, paths = [])
      exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
      paths += ENV['PATH'].split(File::PATH_SEPARATOR)
      paths.each do |path|
        exts.each do |ext|
          exe = File.join(path, "#{cmd}#{ext}")
          if (File.executable?(exe) && File.file?(exe))
            return Shellwords.escape exe
          end
        end
      end
      nil
    end
607734
def init_args():
    """"""
    parser = argparse.ArgumentParser(
        description='draw basic graphs on terminal')
    parser.add_argument(
        'filename',
        nargs='?',
        default="-",
        help='data file name (comma or space separated). Defaults to stdin.')
    parser.add_argument(
        '--title',
        help='Title of graph'
    )
    parser.add_argument(
        '--width',
        type=int,
        default=50,
        help='width of graph in characters default:50'
    )
    parser.add_argument(
        '--format',
        default='{:<5.2f}',
        help='format specifier to use.'
    )
    parser.add_argument(
        '--suffix',
        default='',
        help='string to add as a suffix to all data points.'
    )
    parser.add_argument(
        '--no-labels',
        action='store_true',
        help='Do not print the label column'
    )
    parser.add_argument(
        '--color',
        nargs='*',
        choices=AVAILABLE_COLORS,
        help='Graph bar color( s )'
    )
    parser.add_argument(
        '--vertical',
        action='store_true',
        help='Vertical graph'
    )
    parser.add_argument(
        '--stacked',
        action='store_true',
        help='Stacked bar graph'
    )
    parser.add_argument(
        '--different-scale',
        action='store_true',
        help='Categories have different scales.'
    )
    parser.add_argument(
        '--calendar',
        action='store_true',
        help='Calendar Heatmap chart'
    )
    parser.add_argument(
        '--start-dt',
        help='Start date for Calendar chart'
    )
    parser.add_argument(
        '--custom-tick',
        default='',
        help='Custom tick mark, emoji approved'
    )
    parser.add_argument(
        '--delim',
        default='',
        help='Custom delimiter, default , or space'
    )
    parser.add_argument(
        '--verbose',
        action='store_true',
        help='Verbose output, helpful for debugging'
    )
    parser.add_argument(
        '--version',
        action='store_true',
        help='Display version and exit'
    )
    if len(sys.argv) == 1:
        if sys.stdin.isatty():
            parser.print_usage()
            sys.exit(2)

    args = vars(parser.parse_args())

    if args['custom_tick'] != '':
        global TICK, SM_TICK
        TICK = args['custom_tick']
        SM_TICK = ''

    if args['delim'] != '':
        global DELIM
        DELIM = args['delim']

    return args
1190734
function _drawLine(canvas, ctx, params, path) {
	var l,
		lx, ly;
	l = 2;
	_addStartArrow(
		canvas, ctx,
		params, path,
		path.x2 + params.x,
		path.y2 + params.y,
		path.x1 + params.x,
		path.y1 + params.y
	);
	if (path.x1 !== undefined && path.y1 !== undefined) {
		ctx.moveTo(path.x1 + params.x, path.y1 + params.y);
	}
	while (true) {
		// Calculate next coordinates
		lx = path['x' + l];
		ly = path['y' + l];
		// If coordinates are given
		if (lx !== undefined && ly !== undefined) {
			// Draw next line
			ctx.lineTo(lx + params.x, ly + params.y);
			l += 1;
		} else {
			// Otherwise, stop drawing
			break;
		}
	}
	l -= 1;
	// Optionally add arrows to path
	_addEndArrow(
		canvas, ctx,
		params,
		path,
		path['x' + (l - 1)] + params.x,
		path['y' + (l - 1)] + params.y,
		path['x' + l] + params.x,
		path['y' + l] + params.y
	);
}
958464
def _get_command_args(self, command, args):
        ''''''
        command_args = {}
        command_argument_names =\
            command.__code__.co_varnames[:command.__code__.co_argcount]

        for varname in command_argument_names:
            if varname == 'args':
                command_args['args'] = args
            elif varname in self.provide_args:
                command_args[varname] = self.provide_args[varname]
            else:
                command_args[varname] = getattr(args, varname)
        return command_args
922346
def get_args():
    
    expected = ['working_directory', 'operating_system', 'version']
    possible = ['json'].extend(expected)
    try:
        opts, args = getopt.getopt(sys.argv[1:], '', map(lambda x: ('%s=' % x),
                                   possible))
    except getopt.GetoptError as err:
        print(str(err))
        exit_cleanly(error_number=errno.EINVAL)
    arguments = dict()
    for o, a in opts:
        option = re.sub('^-*', '', o)
        if 'json' in option:
            arguments = _load_json(a)
            break
        if option in expected:
            arguments[option] = a
    error = 0
    for item in expected:
        if item not in arguments:
            print("Missing: %s from arguments" % item)
            error = errno.EINVAL
    if error:
        exit_cleanly(error_number=error)
    return arguments
826174
def parse_args(args=None):
    """"""
    import sys
    from argparse import ArgumentParser
    from path_helpers import path

    if args is None:
        args = sys.argv

    parser = ArgumentParser(description='Example app for drawing shapes from '
                            'dataframe, scaled to fit to GTK canvas while '
                            'preserving aspect ratio (a.k.a., aspect fit).')
    parser.add_argument('svg_filepath', type=path, default=None)
    parser.add_argument('-p', '--padding-fraction', type=float, default=0)

    args = parser.parse_args()
    return args
981935
def get_args(cls, dist, header=None):
    
    if header is None:
        header = cls.get_header()
    spec = str(dist.as_requirement())
    for type_ in 'console', 'gui':
        group = type_ + '_scripts'
        for name, ep in dist.get_entry_map(group).items():
            # ensure_safe_name
            if re.search(r'[\\/]', name):
                raise ValueError("Path separators not allowed in script names")
            script_text = TEMPLATE.format(
                ep.module_name,
                ep.attrs[0],
                '.'.join(ep.attrs),
                spec,
                group,
                name,
            )
            args = cls._get_script_args(type_, name, header, script_text)
            for res in args:
                yield res
555430
function getOpts (processArgv) {
  return optimist(processArgv)
    .usage(help())
    // Show version
    .boolean("version")
    .describe("version", "Show version and exit")
    // Help options (converted to help command)
    .boolean("h")
    .describe("h", "Show help")
    .alias("h", "help")
    // Update notification control
    .boolean("no-notifier")
    .describe("no-notifier", "Disable update notifier");
}
311745
function getArgs(){

    var params, args = [], wasFlag, posIndex;
    if(!hasWindow && hasProcess){
        params = process.argv.slice(2);

        if(!params.length) return [];

        if((posIndex = params.indexOf('--')) !== -1){
            return params.slice(posIndex + 1);
        }

        for(var i=0; i<params.length; i++){

            if(isFlag(params[i])){
                wasFlag = params[i];
                if(hasEqual(params[i])){
                    if(i+1 < params.length - 1 && !isFlag(params[i+1])){
                        i++;
                        args.push(toJSValue(params[i]));
                        wasFlag = false;
                    }
                }
            }else{

                if(!wasFlag){
                    args.push(toJSValue(params[i]));
                }
                wasFlag = false;
            }
        }

        return args;
    }else if(hasWindow){
        return window.location.pathname.split('/');
    }

    return [];
}
780740
def get_all_command_path(path = './mjsonwp_routes.js')
      raise "No file in #{path}" unless File.exist? path

      current_command = ''
      @spec_commands = File.read(path).lines.each_with_object({}) do |line, memo|
        if line =~ /#{WD_HUB_PREFIX_MATCH}.+'/
          current_command = gsub_set(line.slice(/#{WD_HUB_PREFIX_MATCH}.+'/))
          memo[current_command] = []
        elsif line =~ HTTP_METHOD_MATCH
          memo[current_command] << line.slice(HTTP_METHOD_MATCH).chop.downcase.to_sym
        end
        memo
      end
    end
1353321
def get_command(arguments):
    
    return [k for k, v in arguments.items()
            if not k.startswith('-') and v is True][0]