Documentation from interface
339247
public SpannableStringBuilder replace(final int start, final int end,
            CharSequence tb, int tbstart, int tbend) {
        checkRange("replace", start, end);

        int filtercount = mFilters.length;
        for (int i = 0; i < filtercount; i++) {
            CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);

            if (repl != null) {
                tb = repl;
                tbstart = 0;
                tbend = repl.length();
            }
        }

        final int origLen = end - start;
        final int newLen = tbend - tbstart;

        if (origLen == 0 && newLen == 0 && !hasNonExclusiveExclusiveSpanAt(tb, tbstart)) {
            // This is a no-op iif there are no spans in tb that would be added (with a 0-length)
            // Early exit so that the text watchers do not get notified
            return this;
        }

        TextWatcher[] textWatchers = getSpans(start, start + origLen, TextWatcher.class);
        sendBeforeTextChanged(textWatchers, start, origLen, newLen);

        // Try to keep the cursor / selection at the same relative position during
        // a text replacement. If replaced or replacement text length is zero, this
        // is already taken care of.
        boolean adjustSelection = origLen != 0 && newLen != 0;
        int selectionStart = 0;
        int selectionEnd = 0;
        if (adjustSelection) {
            selectionStart = Selection.getSelectionStart(this);
            selectionEnd = Selection.getSelectionEnd(this);
        }

        change(start, end, tb, tbstart, tbend);

        if (adjustSelection) {
            if (selectionStart > start && selectionStart < end) {
                final int offset = (selectionStart - start) * newLen / origLen;
                selectionStart = start + offset;

                setSpan(false, Selection.SELECTION_START, selectionStart, selectionStart,
                        Spanned.SPAN_POINT_POINT);
            }
            if (selectionEnd > start && selectionEnd < end) {
                final int offset = (selectionEnd - start) * newLen / origLen;
                selectionEnd = start + offset;

                setSpan(false, Selection.SELECTION_END, selectionEnd, selectionEnd,
                        Spanned.SPAN_POINT_POINT);
            }
        }

        sendTextChanged(textWatchers, start, origLen, newLen);
        sendAfterTextChanged(textWatchers);

        // Span watchers need to be called after text watchers, which may update the layout
        sendToSpanWatchers(start, end, newLen - origLen);

        return this;
    }
1347677
def autodoc_process_docstring(app, what, name, obj, options, lines):
    
    # check that only symbols that can be directly imported from ``callee``
    # package are being documented
    _, symbol = name.rsplit('.', 1)
    if symbol not in callee.__all__:
        raise SphinxError(
            "autodoc'd '%s' is not a part of the public API!" % name)

    # for classes exempt from automatic merging of class & __init__ docs,
    # pretend their __init__ methods have no docstring at all,
    # so that nothing will be appended to the class's docstring
    if what == 'class' and name in autoclass_content_exceptions:
        # amusingly, when autodoc reads the constructor's docstring
        # for appending it to class docstring, it will report ``what``
        # as 'class' (again!); hence we must check what it actually read
        ctor_docstring_lines = prepare_docstring(obj.__init__.__doc__)
        if lines == ctor_docstring_lines:
            lines[:] = []
541886
protected String documentation() {
        if (documentation != null)
            return documentation;
        if (docPath != null) {
            // read from file
            try {
                InputStream s = docPath.openInputStream();
                documentation = readHTMLDocumentation(s, docPath);
            } catch (IOException exc) {
                documentation = "";
                env.error(null, "javadoc.File_Read_Error", docPath.getName());
            }
        } else {
            // no doc file to be had
            documentation = "";
        }
        return documentation;
    }
972583
def make_interface():
    """"""
    modnames = ['odl'] + list(import_submodules(odl).keys())

    for modname in modnames:
        if not modname.startswith('odl'):
            modname = 'odl.' + modname

        shortmodname = modname.split('.')[-1]
        print('{: <25} : generated {}.rst'.format(shortmodname, modname))

        line = '=' * len(shortmodname)

        module = importlib.import_module(modname)

        docstring = module.__doc__
        submodules = [m[0] for m in inspect.getmembers(
            module, inspect.ismodule) if m[1].__name__.startswith('odl')]
        functions = [m[0] for m in inspect.getmembers(
            module, inspect.isfunction) if m[1].__module__ == modname]
        classes = [m[0] for m in inspect.getmembers(
            module, inspect.isclass) if m[1].__module__ == modname]

        docstring = '' if docstring is None else docstring

        submodules = [modname + '.' + mod for mod in submodules]
        functions = ['~' + modname + '.' + fun
                     for fun in functions if not fun.startswith('_')]
        classes = ['~' + modname + '.' + cls
                   for cls in classes if not cls.startswith('_')]

        if len(submodules) > 0:
            this_mod_string = module_string.format('\n   '.join(submodules))
        else:
            this_mod_string = ''

        if len(functions) > 0:
            this_fun_string = fun_string.format('\n   '.join(functions))
        else:
            this_fun_string = ''

        if len(classes) > 0:
            this_class_string = class_string.format('\n   '.join(classes))
        else:
            this_class_string = ''

        with open(modname + '.rst', 'w') as text_file:
            text_file.write(string.format(shortname=shortmodname,
                                          name=modname,
                                          line=line,
                                          docstring=docstring,
                                          module_string=this_mod_string,
                                          fun_string=this_fun_string,
                                          class_string=this_class_string))
1109044
def describe(self):
        
        #Interfaces are tricky because we can have an arbitrary number of embedded procedures
        #that each have different calling interfaces and return types. We are trying to 
        #summarize that information in a single interface. Interfaces can't mix executable
        #types; they are either all subroutines or all functions. 
        self.find_docstring()
        if not self.subroutine:
            #We have a return type to worry about, compile it from all the targets
            ret_type = []
            for target in self.targets:
                if target.returns not in ret_type:
                    ret_type.append(target.returns)

            ret_text = ', '.join(ret_type)
        else:
            ret_text = ""

        #The list of types it accepts is constructed the same way for functions and subroutines.
        act_type = []
        for target in self.targets:
            param = target.ordered_parameters[0]
            if param.strtype not in act_type:
                act_type.append(param.strtype)

        act_text = ', '.join(act_type)

        if self.subroutine:
            return "SUMMARY: {} | ACCEPTS: {}".format(self.summary, act_text)
        else:
            return "SUMMARY: {} | RETURNS: {} | ACCEPTS: {}".format(self.summary, ret_text, act_text)
962370
def doc(self):
        """"""
        return self._pv.doc or inspect.getdoc(
            getattr(type(self._target), self._pv.property, None)) or ''
514942
def showImports(peInstance):
    
    
    iidEntries = peInstance.ntHeaders.optionalHeader.dataDirectory[consts.IMPORT_DIRECTORY].info
    if iidEntries:
        for iidEntry in iidEntries:
            fields = iidEntry.getFields()
            print "module: %s" % iidEntry.metaData.moduleName.value
            for field in fields:
                print "%s -> %x" % (field,  fields[field].value)
            
            for iatEntry in iidEntry.iat:
                fields = iatEntry.getFields()
                for field in fields:
                    print "%s - %r" % (field,  fields[field].value)
                    
            print "\n"
    else:
        print "The file does not have imported functions."
1056778
private RpcElement readRpc(String documentation) {
    RpcElement.Builder builder = RpcElement.builder()
        .name(readName())
        .documentation(documentation);

    if (readChar() != '(') throw unexpected("expected '('");
    DataType requestType = readDataType();
    if (!(requestType instanceof NamedType)) {
      throw unexpected("expected message but was " + requestType);
    }
    builder.requestType((NamedType) requestType);
    if (readChar() != ')') throw unexpected("expected ')'");

    if (!readWord().equals("returns")) throw unexpected("expected 'returns'");

    if (readChar() != '(') throw unexpected("expected '('");
    DataType responseType = readDataType();
    if (!(responseType instanceof NamedType)) {
      throw unexpected("expected message but was " + responseType);
    }
    builder.responseType((NamedType) responseType);
    if (readChar() != ')') throw unexpected("expected ')'");

    if (peekChar() == '{') {
      pos++;
      while (true) {
        String rpcDocumentation = readDocumentation();
        if (peekChar() == '}') {
          pos++;
          break;
        }
        Object declared = readDeclaration(rpcDocumentation, Context.RPC);
        if (declared instanceof OptionElement) {
          builder.addOption((OptionElement) declared);
        }
      }
    } else if (readChar() != ';') throw unexpected("expected ';'");

    return builder.build();
  }
1372639
def interface(iface):
    '''
    
    '''
    iface_info, error = _get_iface_info(iface)

    if error is False:
        return iface_info.get(iface, {}).get('inet', '')
    else:
        return error
859097
def generate_type_docs(types):
    
    output = StringIO()

    indent = "  "  # 2

    # loop through the basic types and add them to the RAML formatted output
    for type_name in types:

        if types[type_name].get("type") != None:

            output.write(indent + type_name + ":\n")

            indent += "  "  # 4

            type_safe = types[type_name]["type"].replace(" ", "_")

            # if we are dealing with a list, set type to array and specify type of items
            if types[type_name].get("items") != None:
                items_safe = types[type_name]["items"].replace(" ", "_")
                # if items_safe == "base":
                #     items_safe = "object"
                output.write(indent + "type: " + type_safe + "\n")
                output.write(indent + "items: " + items_safe + "\n")

            # otherwise, use the type per normal
            else:
                output.write(indent + "type: " + type_safe + "\n")

            # add the description
            if types[type_name].get("description") != None:
                output.write(indent + "description: " + types[type_name]["description"] + "\n")

            indent = indent[:-2]    # 2

    type_docs = output.getvalue()
    output.close()
    return type_docs
357897
def doc(self):
        
        doc = "Steam Web API - List of all interfaces\n\n"
        for interface in self.interfaces:
            doc += interface.__doc__
        return doc
1026055
private void addMethodInfo(MethodDoc method, Content dl) {
        ClassDoc[] intfacs = method.containingClass().interfaces();
        MethodDoc overriddenMethod = method.overriddenMethod();
        // Check whether there is any implementation or overridden info to be
        // printed. If no overridden or implementation info needs to be
        // printed, do not print this section.
        if ((intfacs.length > 0 &&
                new ImplementedMethods(method, this.configuration).build().length > 0) ||
                overriddenMethod != null) {
            MethodWriterImpl.addImplementsInfo(this, method, dl);
            if (overriddenMethod != null) {
                MethodWriterImpl.addOverridden(this,
                        method.overriddenType(), overriddenMethod, dl);
            }
        }
    }
884645
private void writeInterface(final GeneratorContext context, final TreeLogger logger,
      final BeanHelper bean) {
    final PrintWriter pw = context.tryCreate(logger, bean.getPackage(), bean.getValidatorName());
    if (pw != null) {
      final TreeLogger interfaceLogger = logger.branch(TreeLogger.TRACE,
          "Creating the interface for " + bean.getFullyQualifiedValidatorName());

      final ClassSourceFileComposerFactory factory =
          new ClassSourceFileComposerFactory(bean.getPackage(), bean.getValidatorName());
      factory.addImplementedInterface(
          GwtSpecificValidator.class.getCanonicalName() + " <" + bean.getTypeCanonicalName() + ">");
      factory.addImport(GWT.class.getCanonicalName());
      factory.makeInterface();
      final SourceWriter sw = factory.createSourceWriter(context, pw);

      // static MyValidator INSTANCE = GWT.create(MyValidator.class);
      sw.print("static ");
      sw.print(bean.getValidatorName());
      sw.print(" INSTANCE = GWT.create(");
      sw.print(bean.getValidatorName());
      sw.println(".class);");

      sw.commit(interfaceLogger);
      pw.close();
    }
  }
732919
def read_documentation(self, fid):
        """"""

        lin = self.read_line(fid)
        while lin[0] != ':':
            self.documentation.append(lin)
            lin = self.read_line(fid)
        return lin
38414
def get_interface(iface):
    '''
    
    '''
    _interfaces = get_interfaces_details()
    for _interface in _interfaces['interfaces']:
        if _interface['connectionid'] == iface:
            return _dict_to_string(_interface)
    return None
1026631
def _show_documentation(self):
        
        documents = []
        for key, document in self.app.documents.get().items():
            if key != "main":
                documents.append((key, document))
        documents = sorted(documents, key=lambda x: x[0])
        main = self.app.documents.get("main")
        if main is not None:
            documents.insert(0, (main.name, main))

        user_answer = ""
        index = 0
        while user_answer != "X":
            if index < 0:
                index = 0
            if index > len(documents) - 1:
                index = len(documents) - 1
            document = documents[index][1]

            os.system('cls' if os.name == 'nt' else 'clear')
            echo(Environment().from_string(document.content).render(app=self.app, plugin=document.plugin))

            source = "This document is registered by '%s' under the name '%s'" % (document.plugin.name, document.name)
            echo("-" * len(source))
            echo(source)
            echo("-" * len(source))
            commands = "Actions: "
            if index < len(documents) - 1:
                commands += "[N]ext, "
            if index > 0:
                commands += "[P]revious, "
            commands += "E[x]it"
            echo(commands)

            if index < len(documents) - 1:
                default = "N"
            elif index > 0:
                default = "P"
            else:
                default = "X"
            user_answer = prompt("Select your action", default=default).upper()

            if user_answer == "N":
                index += 1
            elif user_answer == "P":
                index -= 1
1121108
def _writetypesdoc(doc, thing, forceload=0):
    
    try:
        object, name = pydoc.resolve(thing, forceload)
        name = os.path.join(doc, name + '.html')
    except (ImportError, pydoc.ErrorDuringImport), value:
        log.debug(str(value))
        return
        
    # inner classes
    cdict = {}
    fdict = {}
    elements_dict = {}
    types_dict = {}
    for kname,klass in inspect.getmembers(thing, inspect.isclass):
        if thing is not inspect.getmodule(klass):
            continue
        
        cdict[kname] = inspect.getmembers(klass, inspect.isclass)
        for iname,iklass in cdict[kname]:
            key = (kname,iname)
            fdict[key] = _writedoc(doc, iklass)
            if issubclass(iklass, ElementDeclaration):
                
                try:
                    typecode = iklass()
                except (AttributeError,RuntimeError), ex:
                    elements_dict[iname] = _writebrokedoc(doc, ex, iname)
                    continue

                elements_dict[iname] = None
                if typecode.pyclass is not None:                        
                    elements_dict[iname] = _writedoc(doc, typecode.pyclass)

                continue

            if issubclass(iklass, TypeDefinition):
                try:
                    typecode = iklass(None)
                except (AttributeError,RuntimeError), ex:
                    types_dict[iname] = _writebrokedoc(doc, ex, iname)
                    continue

                types_dict[iname] = None
                if typecode.pyclass is not None:
                    types_dict[iname] = _writedoc(doc, typecode.pyclass)

                continue
                        
                
    def strongarm(self, object, name=None, mod=None, funcs={}, classes={}, *ignored):
        """Produce HTML documentation for a class object."""
        realname = object.__name__
        name = name or realname
        bases = object.__bases__
        object, name = pydoc.resolve(object, forceload)
        contents = []
        push = contents.append
        if name == realname:
            title = '<a name="%s">class <strong>%s</strong></a>' % (
                name, realname)
        else:   
            title = '<strong>%s</strong> = <a name="%s">class %s</a>' % (
                name, name, realname)
                
        mdict = {}
        if bases:
            parents = []
            for base in bases:
                parents.append(self.classlink(base, object.__module__))
            title = title + '(%s)' % pydoc.join(parents, ', ')
            
        doc = self.markup(pydoc.getdoc(object), self.preformat, funcs, classes, mdict)
        doc = doc and '<tt>%s<br>&nbsp;</tt>' % doc
        for iname,iclass in cdict[name]:
            fname = fdict[(name,iname)]

            if elements_dict.has_key(iname):
                push('class <a href="%s">%s</a>: element declaration typecode<br/>'\
                    %(fname,iname))
                pyclass = elements_dict[iname]
                if pyclass is not None:
                    push('<ul>instance attributes:')
                    push('<li><a href="%s">pyclass</a>: instances serializable to XML<br/></li>'\
                        %elements_dict[iname])
                    push('</ul>')
            elif types_dict.has_key(iname):
                push('class <a href="%s">%s</a>: type definition typecode<br/>' %(fname,iname))
                pyclass = types_dict[iname]
                if pyclass is not None:
                    push('<ul>instance attributes:')
                    push('<li><a href="%s">pyclass</a>: instances serializable to XML<br/></li>'\
                          %types_dict[iname])
                    push('</ul>')
            else:
                push('class <a href="%s">%s</a>: TODO not sure what this is<br/>' %(fname,iname))
                
        contents = ''.join(contents)
        return self.section(title, '#000000', '#ffc8d8', contents, 3, doc) 
    
    doclass = pydoc.HTMLDoc.docclass
    pydoc.HTMLDoc.docclass = strongarm
            
    try:
        page = pydoc.html.page(pydoc.describe(object), pydoc.html.document(object, name))
        file = open(name, 'w')
        file.write(page)
        file.close()
    except (ImportError, pydoc.ErrorDuringImport), value:
        log.debug(str(value))
        
    pydoc.HTMLDoc.docclass = doclass