Function DocString
514684
def check_submission(self, submission_string, submission_id):
        
        if self.question_upload_type == STRING:
            return self.question_answer_string.lower().replace(' ', '') == submission_string.lower().replace(' ', '')
        else:
            raise Exception("Question not String Type.")
694181
def p_function_def(p):
    ''''''
    parts = _makeparts(p)
    body = parts[-1]
    name = parts[ast.findfirstkind(parts, 'word')]

    p[0] = ast.node(kind='function', name=name, body=body, parts=parts,
                    pos=_partsspan(parts))
825128
def docopt_cmd(func):
    
    def helper_fn(self, arg):
        '''helper function for docopt'''
        try:
            opt = docopt(helper_fn.__doc__, arg)
        except DocoptExit as exception:
            # The DocoptExit is thrown when the args do not match.
            # We print a message to the user and the usage block.
            print 'Invalid Command!'
            print exception
            return
        except SystemExit:
            # The SystemExit exception prints the usage for --help
            # We do not need to do the print here.
            return
        return func(self, opt)
    helper_fn.__name__ = func.__name__
    helper_fn.__doc__ = func.__doc__
    helper_fn.__dict__.update(func.__dict__)
    return helper_fn
1062989
def get_docs(self, arg=None):
        '''
        
        '''
        if arg:
            if '*' in arg:
                target_mod = arg
                _use_fnmatch = True
            else:
                target_mod = arg + '.' if not arg.endswith('.') else arg
                _use_fnmatch = False
            if _use_fnmatch:
                docs = [(fun, self.functions[fun].__doc__)
                        for fun in fnmatch.filter(self.functions, target_mod)]
            else:
                docs = [(fun, self.functions[fun].__doc__)
                        for fun in sorted(self.functions)
                        if fun == arg or fun.startswith(target_mod)]
        else:
            docs = [(fun, self.functions[fun].__doc__)
                    for fun in sorted(self.functions)]
        docs = dict(docs)
        return salt.utils.doc.strip_rst(docs)
663962
function(doc){
	var vs=doc.split("\r\n");
	if(vs.length==1){
		vs=doc.split("\n");
	}
	if(vs[vs.length-1]==''){
		vs.pop();
	}
	return vs;
}
559853
def _get_doc():
    ''''''
    def get_docstring(func):
        '''extract doctstring, if possible'''
        docstring = ':\n'
        if func.__doc__:
            docstring += _indent(func.__doc__, 2)
        return docstring

    ret = ['\nNeurite features (neurite, neuron, neuron population):']
    ret.extend(_INDENT + '- ' + feature + get_docstring(func)
               for feature, func in sorted(NEURITEFEATURES.items()))

    ret.append('\nNeuron features (neuron, neuron population):')
    ret.extend(_INDENT + '- ' + feature + get_docstring(func)
               for feature, func in sorted(NEURONFEATURES.items()))

    return '\n'.join(ret)
509341
function(string) {
    var translated = Documentation.TRANSLATIONS[string];
    if (typeof translated == 'undefined')
      return string;
    return (typeof translated == 'string') ? translated : translated[0];
  }
144643
def _from_docstring_rst(doc):
    

    def format_fn(line, status):
        """ format function """

        if re_from_data.match(line):
            line = re_from_data.sub(r"**\1** ", line)
            status["add_line"] = True
        line = re_from_defaults.sub(r"*\1*", line)
        if status["listing"]:
            # parameters
            if re_from_param.match(line):
                m = re_from_param.match(line)
                line = "  - ``{}`` {}".format(m.group(1), m.group(3))
            # status items
            elif re_from_status.match(line):
                m = re_from_status.match(line)
                line = "  - ``{}`` {}".format(m.group(1), m.group(3))
            # bullets
            elif re_from_item.match(line):
                line = re_from_item.sub(r"  -", line)
            # is continuation line
            else:
                line = " " * 4 + line.lstrip()
        # in .rst format code samples use double backticks vs single ones for
        # .md This converts them.
        line = re_lone_backtick.sub("``", line)
        return line

    return _reformat_docstring(doc, format_fn, code_newline="\n")
818116
function(doc) {
  // Skip if the function has a name.
  if (doc.name) {
    return doc.name;
  }

  try {
    var node = doc.codeNode;

    // Is this a simple declaration? "var element = function() {".
    if (node.declarations && node.declarations.length) {
      return node.declarations[0].id.name;
    }

    // Is this an expression? "elementFinder.find = function() {".
    if (node.expression) {
      var parts = [];

      /**
       * Recursively create the function name by examining the object property.
       * @param obj Parsed object.
       * @return {string} The name of the function.
       */
      function buildName(obj) {
        if (!obj) {
          return parts.join('.');
        }

        if (obj.property && obj.property.name) {
          parts.unshift(obj.property.name);
        }

        if (obj.object && obj.object.name) {
          parts.unshift(obj.object.name);
        }

        return buildName(obj.object);
      }

      return buildName(node.expression.left);
    }
  } catch (e) {
    console.log('Could not find document name', doc.file, doc.endingLine);
  }
}
1368893
def func2md(self, func, clsname=None, names=None, depth=3):
        
        section = "#" * depth
        if names is None:
            names = [func.__name__]

        funcname = ", ".join(names)
        escfuncname = ", ".join(["`%s`" % funcname if funcname.startswith("_") else funcname for funcname in names])
        header = "%s%s" % ("%s." % clsname if clsname else "", escfuncname)

        path = self.get_src_path(func)
        doc = self.doc2md(func)

        args, kwargs = [], []
        spec = getargspec(func)
        vargsname, kwargsname = spec.varargs, spec.keywords
        vargs = list(make_iter(spec.args)) if spec.args else []
        defaults = list(make_iter(spec.defaults)) if spec.defaults else []

        while vargs:
            if vargs and vargs[0] == "self":
                args.append(vargs.pop(0))
            elif len(vargs) > len(defaults):
                args.append(vargs.pop(0))
            else:
                default = defaults.pop(0)
                if isinstance(default, str):
                    default = "\"%s\"" % default
                else:
                    default = "%s" % str(default)

                kwargs.append((vargs.pop(0), default))

        if args:
            args = ", ".join("%s" % arg for arg in args)
        if kwargs:
            kwargs = ", ".join("%s=%s" % kwarg for kwarg in kwargs)
            if args:
                kwargs = ", " + kwargs
        if vargsname:
            vargsname = "*%s" % vargsname
            if args or kwargs:
                vargsname = ", " + vargsname
        if kwargsname:
            kwargsname = "**%s" % kwargsname
            if args or kwargs or vargsname:
                kwargsname = ", " + kwargsname

        _FUNCDEF = "{funcname}({args}{kwargs}{vargs}{vkwargs})"
        funcdef = _FUNCDEF.format(funcname=funcname,
                                  args=args or "",
                                  kwargs=kwargs or "",
                                  vargs=vargsname or "",
                                  vkwargs=kwargsname or "")

        # split the function definition if it is too long
        lmax = 90
        if len(funcdef) > lmax:
            # wrap in the args list
            split = funcdef.split("(", 1)
            # we gradually build the string again
            rest = split[1]
            args = rest.split(", ")

            funcname = "(".join(split[:1]) + "("
            lline = len(funcname)
            parts = []
            for arg in args:
                larg = len(arg)
                if larg > lmax - 5:
                    # not much to do if arg is so long
                    parts.append(arg)
                elif lline + larg > lmax:
                    # the next arg is too long, break the line
                    parts.append("\\\n    " + arg)
                    lline = 0
                else:
                    parts.append(arg)
                lline += len(parts[-1])
            funcdef = funcname + ", ".join(parts)

        # build the signature
        string = FUNC_TEMPLATE.format(section=section,
                                      header=header,
                                      funcdef=funcdef,
                                      path=path,
                                      doc=doc if doc else "*No documentation found.*")
        return string
311372
def _create_function(name, doc=""):
    """"""
    def _(col):
        sc = SparkContext._active_spark_context
        jc = getattr(sc._jvm.functions, name)(col._jc if isinstance(col, Column) else col)
        return Column(jc)
    _.__name__ = name
    _.__doc__ = doc
    return _
913773
def _doc_method(klass, func):
    """"""
    argspec = inspect.getfullargspec(func)
    # Remove first 'self' argument.
    if argspec.args and argspec.args[0] == 'self':
        del argspec.args[0]
    args = inspect.formatargspec(*argspec)
    header = "{klass}.{name}{args}".format(klass=klass.__name__,
                                             name=_name(func),
                                             args=args,
                                             )
    docstring = _doc(func)
    return _concat(header, docstring)
759135
function (t) {
			if(t.type === "function"){
				var fn = "("+helpers.makeParamsString(t.params)+")";
				
				if(t.constructs && t.constructs.types){
					fn = "constructor"+fn;
					fn += " => "+helpers.makeTypes(t.constructs.types)
				} else {
					fn = "function"+fn;
				}
				
				return fn;
			}
			var type = docMap[t.type];
			var title = type && type.title || undefined;
			var txt = helpers.linkTo(t.type, title);
			
			if(t.template && t.template.length){
				txt += "&lt;"+t.template.map(function(templateItem){
					return helpers.makeTypes(templateItem.types)
				}).join(",")+"&gt;";
			}
			if(type){
				if(type.type === "function" && (type.params || type.signatures)){
					var params = type.params || (type.signatures[0] && type.signatures[0].params ) || []
				} else if(type.type === "typedef" && type.types[0] && type.types[0].type == "function"){
					var params = type.types[0].params;
				}
				if(params){
					txt += "("+helpers.makeParamsString(params)+")";
				}
			}
			
			return txt;
		}
114853
def update_docstring(dispatcher, func=None):
    
    doc = dispatcher.__doc__ or ''
    if inspect.cleandoc(doc).startswith('%s(' % dispatcher.__name__):
        return
    sig = '(...)'
    if func and func.__code__.co_argcount:
        argspec = inspect.getfullargspec(func) # pylint: disable=deprecated-method
        if argspec.args and argspec.args[0] in {'self', 'cls'}:
            argspec.args.pop(0)
        if any(argspec):
            sig = inspect.formatargspec(*argspec) # pylint: disable=deprecated-method
            sig = re.sub(r' at 0x[0-9a-f]{8,16}(?=>)', '', sig)
    sep = '\n' if doc.startswith('\n') else '\n\n'
    dispatcher.__doc__ = dispatcher.__name__ + sig + sep + doc
706380
def parse_docstring(docstring):
    '''
    
    '''
    if docstring is None:
        return '', ''

    parts = _DOCSTRING_SPLIT.split(docstring)

    if len(parts) == 1:
        return docstring, ''
    elif len(parts) == 2:
        return parts[0], parts[1]
    else:
        raise TooManySplitsError()
737830
function makeDocString(obj) {
        var docStr = obj
        if (Array.isArray(docStr)) {
            docStr = docStr.join('\n');
        }
        return docStr;
    }
820106
def docstr(self, prefix='', include_label=True):
        """"""
        return '\n'.join([x.docstr(prefix, include_label) for x in self])