Get the parser that has been set up by the given `function`
508203
def _get_corresponding_parsers(self, func):
        """"""
        if func in self._used_functions:
            yield self
        if self._subparsers_action is not None:
            for parser in self._subparsers_action.choices.values():
                for sp in parser._get_corresponding_parsers(func):
                    yield sp
81649
def _getFuncArgs(func):
  
  """
  code = func.func_code
  Defaults = func.func_defaults

  nargs = code.co_argcount
  ArgNames = code.co_varnames[:nargs]

  Args = OrderedDict()
  argCount = len(ArgNames)
  defCount = len(Defaults) if Defaults else 0
  diff = argCount - defCount

  for i in range(0, diff):
    Args[ArgNames[i]] = {}

  for i in range(diff, argCount):
    Args[ArgNames[i]] = {'default': Defaults[i - diff]}

  return Args
1095393
function getFormatFunction(name) {
  // lookup format
  const fmt = formats[name] || name || formats.default;
  // return compiled format
  return typeof fmt !== 'function' ? compile(fmt) : fmt;
}
1031276
def get_function(self, fun=None):
        """"""
        sfun = str(fun)
        self.say('get_function:' + sfun, verbosity=100)

        if not fun:
            return NoRuleFunction()  # dummy to execute via no_fun

        if sfun in self._rule_functions:
            return self._rule_functions[sfun]
        else:
            self.add_function(name=sfun,
                              fun=self.rule_function_not_found(fun))
            self.cry('fun(%s) not found, returning dummy' %
                     (sfun), verbosity=10)
            if sfun in self._rule_functions:
                return self._rule_functions[sfun]
            else:
                self.rule_function_not_found(fun)
905652
def get_function_call_repr(fn, args, kwargs):
    """"""

    result = get_full_name(fn) + "("
    first = True
    for v in args:
        if first:
            first = False
        else:
            result += ","
        result += repr(v)
    for k, v in kwargs.items():
        if first:
            first = False
        else:
            result += ","
        result += str(k) + "=" + repr(v)
    result += ")"
    return result
994103
def parse(self, func, *args, **kwargs):
        
        result = []
        for element in self.xpath('child::node()'):
            if isinstance(element, Parser):
                children = element.parse(func, *args, **kwargs)
                element_result = func(element, children, *args, **kwargs)
                if element_result:
                    result.append(element_result)
            else:
                result.append(element)
        return u"".join(result)
692010
def __get_calls_from_parser(proxy_parser, real_parser):
    
    __parsers[proxy_parser] = real_parser
    for method, safe, args, kwargs, proxy_subparser in proxy_parser.calls:
        args = (__proxy_to_real_parser(v) for v in args)
        kwargs = {k: __proxy_to_real_parser(v) for k, v in kwargs.items()}
        real_subparser = getattr(real_parser, method)(*args, **kwargs)
        if real_subparser is not None:
            __get_calls_from_parser(proxy_subparser, real_subparser)
1241850
def get_parser(parser=None):
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    if parser is None:
        parser = ArgumentParser(description=__doc__,
                                formatter_class=ArgumentDefaultsHelpFormatter)
    subparsers = parser.add_subparsers()
    pkg_init_parser = subparsers.add_parser('init')
    pkg_init_parser.add_argument("root",
                                 nargs='?',
                                 help="project root - should be empty")
    pkg_init_parser.set_defaults(func=run_init)
    return parser
797725
function parse(str, options, callback) {
	if (typeof options === 'function') {
		callback = options
		options = {}
	}
	process.nextTick(() => {
		const output = parseSync(str, options)
		callback(output)
	})
}
263132
def get_function_definition_from_first_line(self):
        """"""
        document = self.code_editor.document()
        cursor = QTextCursor(
            document.findBlockByLineNumber(self.line_number_cursor - 1))

        func_text = ''
        func_indent = ''

        is_first_line = True
        line_number = cursor.blockNumber() + 1

        number_of_lines = self.code_editor.blockCount()
        remain_lines = number_of_lines - line_number + 1
        number_of_lines_of_function = 0

        for __ in range(min(remain_lines, 20)):
            cur_text = to_text_string(cursor.block().text()).rstrip()

            if is_first_line:
                if not is_start_of_function(cur_text):
                    return None

                func_indent = get_indent(cur_text)
                is_first_line = False
            else:
                cur_indent = get_indent(cur_text)
                if cur_indent <= func_indent:
                    return None
                if is_start_of_function(cur_text):
                    return None
                if cur_text.strip == '':
                    return None

            if cur_text[-1] == '\\':
                cur_text = cur_text[:-1]

            func_text += cur_text
            number_of_lines_of_function += 1

            if cur_text.endswith(':'):
                return func_text, number_of_lines_of_function

            cursor.movePosition(QTextCursor.NextBlock)

        return None
688830
def parsecmap(self, fn):
        ''''''
        return self.bind(lambda res: Parser(lambda _, index: Value.success(index, fn(res))))
335194
function ( parser, params ) {
		var property, funcName, values;
		for ( property in params ) {
			funcName = 'set' + property.substring( 0, 1 ).toLocaleUpperCase() + property.substring( 1 );
			values = params[ property ];

			if ( typeof parser[ funcName ] === 'function' ) {

				parser[ funcName ]( values );

			} else if ( parser.hasOwnProperty( property ) ) {

				parser[ property ] = values;

			}
		}
	}
791585
def find_function_by_name(self, name):
        
        cfg_rv = None
        for cfg in self._cfgs:
            if cfg.name == name:
                cfg_rv = cfg
                break
        return cfg_rv
179828
def _nargs(f) -> Optional[int]:
    '''
        
    '''
    if isinstance(f, Function):
        return f.nargs
    spec = inspect.getfullargspec(f)
    if spec.varargs is not None:
        return None
    return len(spec.args)
1029855
def get_function_call_str(fn, args, kwargs):
    """"""

    def str_converter(v):
        try:
            return str(v)
        except Exception:
            try:
                return repr(v)
            except Exception:
                return "<n/a str raised>"

    result = get_full_name(fn) + "("
    first = True
    for v in args:
        if first:
            first = False
        else:
            result += ","
        result += str_converter(v)
    for k, v in kwargs.items():
        if first:
            first = False
        else:
            result += ","
        result += str(k) + "=" + str_converter(v)
    result += ")"
    return result
1102848
function parseArguments(opts, callback) {
  if ('function' === typeof opts) {
    callback = opts
    opts = {}
  }

  opts = opts || {}
  opts.callback = callback

  return opts
}
745050
def parser_for(self, name):
        

        def decorator(func):
            self.add_parser(name, func)
            return func

        return decorator