Attempts to clean the top scoring node from non-page content items, such as
 advertisements, widgets, etc
501394
def clean_top_scoring_elements!(options = {})
      keep_images = !!options[:images]

      top_scoring_elements.each do |element|
        element.search("*").each do |node|
          if cleanable?(node, keep_images)
            debugger if node.to_s =~ /maximum flavor/
            node.remove
          end
        end
      end
    end
909243
function cleanTree ( node, preserveWS ) {
    var children = node.childNodes,
        nonInlineParent, i, l, child, nodeName, nodeType, rewriter, childLength,
        startsWithWS, endsWithWS, data, sibling;

    nonInlineParent = node;
    while ( isInline( nonInlineParent ) ) {
      nonInlineParent = nonInlineParent.parentNode;
    }
    walker.root = nonInlineParent;

    for ( i = 0, l = children.length; i < l; i += 1 ) {
      child = children[i];
      nodeName = child.nodeName;
      nodeType = child.nodeType;
      rewriter = stylesRewriters[ nodeName ];
      if ( nodeType === ELEMENT_NODE ) {
        childLength = child.childNodes.length;
        if ( rewriter ) {
          child = rewriter( child, node );
        } else if ( blacklist.test( nodeName ) ) {
          node.removeChild( child );
          i -= 1;
          l -= 1;
          continue;
        } else if ( !allowedBlock.test( nodeName ) && !isInline( child ) ) {
          i -= 1;
          l += childLength - 1;
          node.replaceChild( empty( child ), child );
          continue;
        }
        if ( childLength ) {
          cleanTree( child, preserveWS || ( nodeName === 'PRE' ) );
        }
      } else {
        if ( nodeType === TEXT_NODE ) {
          data = child.data;
          startsWithWS = !notWS.test( data.charAt( 0 ) );
          endsWithWS = !notWS.test( data.charAt( data.length - 1 ) );
          if ( preserveWS || ( !startsWithWS && !endsWithWS ) ) {
            continue;
          }
          // Iterate through the nodes; if we hit some other content
          // before the start of a new block we don't trim
          if ( startsWithWS ) {
            walker.currentNode = child;
            while ( sibling = walker.previousPONode() ) {
              nodeName = sibling.nodeName;
              if ( nodeName === 'IMG' ||
                   ( nodeName === '#text' &&
                     notWS.test( sibling.data ) ) ) {
                break;
              }
              if ( !isInline( sibling ) ) {
                sibling = null;
                break;
              }
            }
            data = data.replace( /^[ \t\r\n]+/g, sibling ? ' ' : '' );
          }
          if ( endsWithWS ) {
            walker.currentNode = child;
            while ( sibling = walker.nextNode() ) {
              if ( nodeName === 'IMG' ||
                   ( nodeName === '#text' &&
                     notWS.test( sibling.data ) ) ) {
                break;
              }
              if ( !isInline( sibling ) ) {
                sibling = null;
                break;
              }
            }
            data = data.replace( /[ \t\r\n]+$/g, sibling ? ' ' : '' );
          }
          if ( data ) {
            child.data = data;
            continue;
          }
        }
        node.removeChild( child );
        i -= 1;
        l -= 1;
      }
    }
    return node;
  }
475417
def cleanup(self):
        
        for dict in (self.rule2func, self.rules, self.rule2name):
            for i in list(dict.keys()):
                dict[i] = None
        for i in dir(self):
            setattr(self, i, None)
1153729
function cleanOldContentNode(el) {
        var oldContentNode = el.lightDOM,
            lightFrag = document.createDocumentFragment();
        while (oldContentNode.childNodes.length > 0) {
            lightFrag.appendChild(oldContentNode.removeChild(oldContentNode.childNodes[0]));
        }
        return lightFrag;
    }
1144207
def remove_irrelevant_nodes(frame, options, total_time=None):
    '''
    
    '''
    if frame is None:
        return None
    
    if total_time is None:
        total_time = frame.time()

    filter_threshold = options.get('filter_threshold', 0.01)

    for child in frame.children:
        proportion_of_total = child.time() / total_time

        if proportion_of_total < filter_threshold:
            frame.self_time += child.time()
            child.remove_from_parent()
        
    for child in frame.children:
        remove_irrelevant_nodes(child, options=options, total_time=total_time)

    return frame
102247
function cleanup(e) {
    if (e.tile.proxyRefs) {
      for (var proxyKey in e.tile.proxyRefs) {
        var proxyTile = e.tile.proxyRefs[proxyKey];
        if ((--proxyTile.proxyCount <= 0) && cache.unload(proxyKey)) {
          proxyTile.element.parentNode.removeChild(proxyTile.element);
        }
      }
      delete e.tile.proxyRefs;
    }
  }
720227
def _clean_item(self, item):
        '''
        
        '''
        item_copy = dict(item)
        del item_copy['body']
        del item_copy['links']
        del item_copy['response_headers']
        del item_copy['request_headers']
        del item_copy['status_code']
        del item_copy['status_msg']
        item_copy['action'] = 'ack'
        item_copy['logger'] = self.logger.name
        item_copy

        return item_copy
212481
def clear_content(self):
        
        if self.sectPr is not None:
            content_elms = self[:-1]
        else:
            content_elms = self[:]
        for content_elm in content_elms:
            self.remove(content_elm)
297578
def ignore_whitespace_text_nodes(cls, wrapped_node):
        
        for child in wrapped_node.children:
            if child.is_text and child.value.strip() == '':
                child.delete()
            else:
                cls.ignore_whitespace_text_nodes(child)
1369922
function(articleContent) {
    this._cleanStyles(articleContent);

    // Check for data tables before we continue, to avoid removing items in
    // those tables, which will often be isolated even though they're
    // visually linked to other content-ful elements (text, images, etc.).
    this._markDataTables(articleContent);

    // Clean out junk from the article content
    this._cleanConditionally(articleContent, "form");
    this._cleanConditionally(articleContent, "fieldset");
    this._clean(articleContent, "object");
    this._clean(articleContent, "embed");
    this._clean(articleContent, "h1");
    this._clean(articleContent, "footer");
    this._clean(articleContent, "link");
    this._clean(articleContent, "aside");

    // Clean out elements have "share" in their id/class combinations from final top candidates,
    // which means we don't remove the top candidates even they have "share".
    this._forEachNode(articleContent.children, function(topCandidate) {
      this._cleanMatchedNodes(topCandidate, /share/);
    });

    // If there is only one h2 and its text content substantially equals article title,
    // they are probably using it as a header and not a subheader,
    // so remove it since we already extract the title separately.
    var h2 = articleContent.getElementsByTagName('h2');
    if (h2.length === 1) {
      var lengthSimilarRate = (h2[0].textContent.length - this._articleTitle.length) / this._articleTitle.length;
      if (Math.abs(lengthSimilarRate) < 0.5) {
        var titlesMatch = false;
        if (lengthSimilarRate > 0) {
          titlesMatch = h2[0].textContent.includes(this._articleTitle);
        } else {
          titlesMatch = this._articleTitle.includes(h2[0].textContent);
        }
        if (titlesMatch) {
          this._clean(articleContent, "h2");
        }
      }
    }

    this._clean(articleContent, "iframe");
    this._clean(articleContent, "input");
    this._clean(articleContent, "textarea");
    this._clean(articleContent, "select");
    this._clean(articleContent, "button");
    this._cleanHeaders(articleContent);

    // Do these last as the previous stuff may have removed junk
    // that will affect these
    this._cleanConditionally(articleContent, "table");
    this._cleanConditionally(articleContent, "ul");
    this._cleanConditionally(articleContent, "div");

    // Remove extra paragraphs
    this._removeNodes(articleContent.getElementsByTagName('p'), function (paragraph) {
      var imgCount = paragraph.getElementsByTagName('img').length;
      var embedCount = paragraph.getElementsByTagName('embed').length;
      var objectCount = paragraph.getElementsByTagName('object').length;
      // At this point, nasty iframes have been removed, only remain embedded video ones.
      var iframeCount = paragraph.getElementsByTagName('iframe').length;
      var totalCount = imgCount + embedCount + objectCount + iframeCount;

      return totalCount === 0 && !this._getInnerText(paragraph, false);
    });

    this._forEachNode(this._getAllNodesWithTag(articleContent, ["br"]), function(br) {
      var next = this._nextElement(br.nextSibling);
      if (next && next.tagName == "P")
        br.parentNode.removeChild(br);
    });
  }
1159777
def clean_up
        @doc.css(".ess-separator").remove
        @doc.css("@title").remove
        @doc.css("@onclick").remove
        @doc.css("@tabindex").remove
        @doc.css(".ess-label-hits").remove
        @doc.css(".ess-clear").remove
      end
453301
function cleanUpData(){
      var v = $contentDomNode.html().replace(/<br\s*\/?>/mg,"\n");
      v = v.replace(/<div>/gi,"\n").replace(/<\/div>/gi,'');
      v = v.replace(/(<([^>]+)>)/ig,'');
      return $.trim(v.replace(/&nbsp;/ig,''));
    }
573477
def cleanup(self):
        
        now = time.time()
        expired = now - NODE_TIMEOUT
        if self.conn.zremrangebyscore(self.key, 0, expired):
            self._notify()
339145
def clean():
    """"""
    d = ['build', 'dist', 'scikits.audiolab.egg-info', HTML_DESTDIR,
            PDF_DESTDIR]
    for i in d:
        paver.path.path(i).rmtree()

    (paver.path.path('docs') / options.sphinx.builddir).rmtree()
526638
def clean_document(node):
    """"""
    if node is None or len(node) == 0:
        return None

    logger.debug("\n\n-------------- CLEANING DOCUMENT -----------------")
    to_drop = []

    for n in node.iter():
        # clean out any in-line style properties
        if "style" in n.attrib:
            n.set("style", "")

        # remove embended objects unless it's wanted video
        if n.tag in ("object", "embed") and not ok_embedded_video(n):
            logger.debug("Dropping node %s %r", n.tag, n.attrib)
            to_drop.append(n)

        # clean headings with bad css or high link density
        if n.tag in ("h1", "h2", "h3", "h4") and get_class_weight(n) < 0:
            logger.debug("Dropping <%s>, it's insignificant", n.tag)
            to_drop.append(n)

        if n.tag in ("h3", "h4") and get_link_density(n) > 0.33:
            logger.debug("Dropping <%s>, it's insignificant", n.tag)
            to_drop.append(n)

        # drop block element without content and children
        if n.tag in ("div", "p"):
            text_content = shrink_text(n.text_content())
            if len(text_content) < 5 and not n.getchildren():
                logger.debug(
                    "Dropping %s %r without content.", n.tag, n.attrib)
                to_drop.append(n)

        # finally try out the conditional cleaning of the target node
        if clean_conditionally(n):
            to_drop.append(n)

    drop_nodes_with_parents(to_drop)

    return node
164223
function cleanTitle( el ) {
		var txt = cleanPath( el.innerHTML );
		var idx = txt.indexOf( 'stdlib' );
		if ( idx === -1 || idx === 1 ) { // e.g., '@stdlib/types/iter'
			txt = 'stdlib | ' + txt;
		} else if ( txt.indexOf( ' | stdlib' ) === txt.length-9 ) { // e.g., 'foo/bar | stdlib'
			txt = 'stdlib | ' + txt.slice( 0, -9 );
		}
		el.innerHTML = txt;
	}
1047844
def suppress_deg_one_node(self, to_par_edge, nd_id, to_child_edge):
        """"""
        # circumvent the node with nd_id
        to_child_edge_id = to_child_edge['@id']
        par = to_par_edge['@source']
        self._edge_by_source[par][to_child_edge_id] = to_child_edge
        to_child_edge['@source'] = par
        # make it a tip...
        del self._edge_by_source[nd_id]
        # delete it
        self._del_tip(nd_id)