Adapts the AST sub-tree that is rooted at the given doc string node.
763965
def adapt_doc_string!(parsed_doc_string)
      # Saving off the original data
      parsed_doc_string['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_doc_string))

      parsed_doc_string['value'] = parsed_doc_string.delete(:content)
      parsed_doc_string['content_type'] = parsed_doc_string.delete(:contentType)
      parsed_doc_string['line'] = parsed_doc_string.delete(:location)[:line]
    end
1255714
private void adaptForRemove(final ITreeStructData pOldNode) throws TTException {
        assert pOldNode != null;

        // Adapt left sibling node if there is one.
        if (pOldNode.hasLeftSibling()) {
            final ITreeStructData leftSibling = (ITreeStructData)getPtx().getData(pOldNode.getLeftSiblingKey());
            leftSibling.setRightSiblingKey(pOldNode.getRightSiblingKey());
            getPtx().setData(leftSibling);
        }

        // Adapt right sibling node if there is one.
        if (pOldNode.hasRightSibling()) {
            final ITreeStructData rightSibling = (ITreeStructData)getPtx().getData(pOldNode.getRightSiblingKey());
            rightSibling.setLeftSiblingKey(pOldNode.getLeftSiblingKey());
            getPtx().setData(rightSibling);
        }

        // Adapt parent, if node has now left sibling it is a first child.
        final ITreeStructData parent = (ITreeStructData)getPtx().getData(pOldNode.getParentKey());
        if (!pOldNode.hasLeftSibling()) {
            parent.setFirstChildKey(pOldNode.getRightSiblingKey());
        }
        parent.decrementChildCount();
        getPtx().setData(parent);

        if (pOldNode.getKind() == IConstants.ELEMENT) {
            // removing attributes
            for (int i = 0; i < ((ElementNode)pOldNode).getAttributeCount(); i++) {
                moveTo(((ElementNode)pOldNode).getAttributeKey(i));
                getPtx().removeData(mDelegate.getCurrentNode());
            }
            // removing namespaces
            moveTo(pOldNode.getDataKey());
            for (int i = 0; i < ((ElementNode)pOldNode).getNamespaceCount(); i++) {
                moveTo(((ElementNode)pOldNode).getNamespaceKey(i));
                getPtx().removeData(mDelegate.getCurrentNode());
            }
        }

        // Remove old node.
        getPtx().removeData(pOldNode);
    }
544315
def _handle_file_ast(self, node, scope, ctxt, stream):
        
        self._root = ctxt = fields.Dom(stream)
        ctxt._pfp__scope = scope
        self._root._pfp__name = "__root"
        self._root._pfp__interp = self
        self._dlog("handling file AST with {} children".format(len(node.children())))

        for child in node.children():
            self._handle_node(child, scope, ctxt, stream)

        ctxt._pfp__process_fields_metadata()

        return ctxt
562264
private void mergeExtensionsIntoDocument(Node target, Node extensions) throws Exception {
        final XPathFactory factory = XPathFactory.newInstance();
        final NodeList nodes = (NodeList) factory.newXPath().evaluate("//extensions", extensions, XPathConstants.NODESET);
        for (int i = 0; i < nodes.getLength(); i++) {
            final Node extensionNode = nodes.item(i);
            String nameBasedXpath =  DomUtils.getNameBasedXPath(extensionNode, false);
            log.debug("Processing extension node: " + nameBasedXpath);

            final NodeList targetNodes = (NodeList) factory.newXPath().evaluate(nameBasedXpath, target, XPathConstants.NODESET);
            if (targetNodes.getLength() != 1) {
                throw new IllegalArgumentException("XPath "+nameBasedXpath+" not found in target");
            }
            Node targetNode = targetNodes.item(0);
            Node importedNode = targetNode.getOwnerDocument().importNode(extensionNode, true);
            targetNode.appendChild(importedNode);
        }
    }
446814
def inherit_docstrings(cls):
    
    @functools.wraps(cls)
    def _inherit_docstrings(cls):
        if not isinstance(cls, (type, colorise.compat.ClassType)):
            raise RuntimeError("Type is not a class")

        for name, value in colorise.compat.iteritems(vars(cls)):
            if isinstance(getattr(cls, name), types.MethodType):
                if not getattr(value, '__doc__', None):
                    for base in cls.__bases__:
                        basemethod = getattr(base, name, None)

                        if basemethod and getattr(base, '__doc__', None):
                            value.__doc__ = basemethod.__doc__

        return cls

    return _inherit_docstrings(cls)
11872
def fixup_parse_tree(cls_node):
    
    for node in cls_node.children:
        if node.type == syms.suite:
            # already in the preferred format, do nothing
            return

    # !%@#! oneliners have no suite node, we have to fake one up
    for i, node in enumerate(cls_node.children):
        if node.type == token.COLON:
            break
    else:
        raise ValueError("No class suite and no ':'!")

    # move everything into a suite node
    suite = Node(syms.suite, [])
    while cls_node.children[i+1:]:
        move_node = cls_node.children[i+1]
        suite.append_child(move_node.clone())
        move_node.remove()
    cls_node.append_child(suite)
    node = suite
993352
function setAsRootDocument(doc) {
  rootDoc = doc;
  var window = rootDoc.defaultView;
  window.setTimeout = function(code, delay, arguments) {};
  window.setInterval = function(code, delay, arguments) {};
  anychartify(rootDoc);

  return rootDoc
}
1180178
private TreeNode setPos(DocTree node, TreeNode newNode) {
    int pos = pos(node);
    return newNode.setPosition(new SourcePosition(pos, length(node), lineNumber(pos)));
  }
153052
def add_adjust(self, data, prehashed=False):
        
        subtrees = self._get_whole_subtrees()
        new_node = Node(data, prehashed=prehashed)
        self.leaves.append(new_node)
        for node in reversed(subtrees):
            new_parent = Node(node.val + new_node.val)
            node.p, new_node.p = new_parent, new_parent
            new_parent.l, new_parent.r = node, new_node
            node.sib, new_node.sib = new_node, node
            node.side, new_node.side = 'L', 'R'
            new_node = new_node.p
        self.root = new_node
401432
public void setDocumentation(String doc) {
		if (Strings.isEmpty(doc)) {
			getSarlAnnotationType().eAdapters().removeIf(new Predicate<Adapter>() {
				public boolean test(Adapter adapter) {
					return adapter.isAdapterForType(DocumentationAdapter.class);
				}
			});
		} else {
			DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getExistingAdapter(
					getSarlAnnotationType(), DocumentationAdapter.class);
			if (adapter == null) {
				adapter = new DocumentationAdapter();
				getSarlAnnotationType().eAdapters().add(adapter);
			}
			adapter.setDocumentation(doc);
		}
	}
505364
private static void fixupNamespace(Document doc) throws MarshalException {

		Node n;
		Element el;
		String prefix;

		n = doc.getFirstChild();

		if (n.getNodeType() != Node.ELEMENT_NODE) {
			throw new RuntimeException("No element");
		}

		el = (Element) n;

		prefix = el.getPrefix();

		if (prefix != null && prefix.length() > 0) {
			el.setPrefix(null);
		} else {
			prefix = "";
		}

		dropNamespaceDecls(el);

		removePrefixFromChildren(el, prefix);
	}
1346983
def docCopyNode(self, doc, extended):
        
        if doc is None: doc__o = None
        else: doc__o = doc._o
        ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, extended)
        if ret is None:raise treeError('xmlDocCopyNode() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
817376
def adapt_single_html(html):
    
    html_root = etree.fromstring(html)

    metadata = parse_metadata(html_root.xpath('//*[@data-type="metadata"]')[0])
    id_ = metadata['cnx-archive-uri'] or 'book'

    binder = Binder(id_, metadata=metadata)
    nav_tree = parse_navigation_html_to_tree(html_root, id_)

    body = html_root.xpath('//xhtml:body', namespaces=HTML_DOCUMENT_NAMESPACES)
    _adapt_single_html_tree(binder, body[0], nav_tree, top_metadata=metadata)

    return binder
436173
public static Node normalizeFormatting(final Node doc) throws CouldNotProcessException {
        try {
            return createDocumentFromString(normalizeFormattingAsString(doc));
        } catch (XMLParsingException ex) {
            throw new CouldNotProcessException("Couldn't normalize formatting. Returning old document.", ex);
        }
    }
892443
private static void doTransform(Tree t) {

    if (t.value().startsWith("QP")) {
      //look at the children
      List<Tree> children = t.getChildrenAsList();
      if (children.size() >= 3 && children.get(0).isPreTerminal()) {
        //go through the children and check if they match the structure we want
        String child1 = children.get(0).value();
        String child2 = children.get(1).value();
        String child3 = children.get(2).value();
        if((child3.startsWith("CD") || child3.startsWith("DT")) &&
           (child1.startsWith("RB") || child1.startsWith("JJ") || child1.startsWith("IN")) &&
           (child2.startsWith("IN") || child2.startsWith("JJ"))) {
          transformQP(t);
        }
      }
    /* --- to be written or deleted
    } else if (t.value().startsWith("NP")) {
      //look at the children
      List<Tree> children = t.getChildrenAsList();
      if (children.size() >= 3) {

      }
    ---- */
    } else if (t.isPhrasal()) {
      for (Tree child : t.getChildrenAsList()) {
        doTransform(child);
      }
    }
  }
150438
def _copy_ancestor_docstring(mro_list, func):  # pylint: disable=W0613
    """"""
    if func.__doc__ is not None:
        raise RuntimeError('Function already has docstring')
    # Search for docstring in superclass
    for cls in mro_list:
        super_fn = getattr(cls, func.__name__, None)
        if super_fn is None:
            continue
        func.__doc__ = super_fn.__doc__
        break
    else:
        raise RuntimeError("Can't inherit docstring for %s: method does not "
                           "exist in superclass" % func.__name__)
    return func
636803
public void buildMethodComments(XMLNode node, Content methodDocTree) {
        if (!configuration.nocomment) {
            ExecutableElement method = currentMethod;
            if (utils.getFullBody(currentMethod).isEmpty()) {
                DocFinder.Output docs = DocFinder.search(configuration,
                        new DocFinder.Input(utils, currentMethod));
                if (docs.inlineTags != null && !docs.inlineTags.isEmpty())
                        method = (ExecutableElement)docs.holder;
            }
            TypeMirror containingType = method.getEnclosingElement().asType();
            writer.addComments(containingType, method, methodDocTree);
        }
    }