Removes comments from the element and its children.
546392
def removeComments(element):
    
    global _num_bytes_saved_in_comments
    num = 0

    if isinstance(element, xml.dom.minidom.Comment):
        _num_bytes_saved_in_comments += len(element.data)
        element.parentNode.removeChild(element)
        num += 1
    else:
        for subelement in element.childNodes[:]:
            num += removeComments(subelement)

    return num
982863
function commentStrip(string) {
  // Remove commented lines
  string = string.replace(RE_COMMENT_SINGLE_LINE, '');
  string = string.replace(RE_COMMENT_MULTI_LINES, '');
  return string;
}
694915
private function cleanupDOMDocument()
    {
        $expressions = array(
            '//comment()',
            '//processing-instruction()',
        );

        foreach ($expressions as $expression) {
            foreach ($this->xpath->query($expression) as $node) {
                $node->parentNode->removeChild($node);
            }
        }

        $this->dom->normalizeDocument();
    }
637503
private static void cleanStyles(Element e) {
        if (e == null) {
            return;
        }

        Element cur = e.children().first();

        // Remove any root styles, if we're able.
        if (!"readability-styled".equals(e.className())) {
            e.removeAttr("style");
        }

        // Go until there are no more child nodes
        while (cur != null) {
            // Remove style attributes
            if (!"readability-styled".equals(cur.className())) {
                cur.removeAttr("style");
            }
            cleanStyles(cur);
            cur = cur.nextElementSibling();
        }
    }
845106
def empty(self):
        """"""
        for k in list(self.children.keys()):
            self.remove_child(self.children[k])
811644
function removeDuplicateComments(ast) {
    // Some comments are duplicated as both the leadingComment for one node,
    // and the trailing comment for another. Every comment's range is unique,
    // so two comments with the same range are talking about the same comment.
    // So we'll just remove all trailing comments which are also a leading
    // comment somewhere.
    //eslint-disable-next-line no-undef
    const rangesInLeadingComments = new Set();
    estreeWalker.walk(ast, {
        enter: (node) => {
            for (let leadingComment of node.leadingComments || []) {
                rangesInLeadingComments.add(leadingComment.range.join(','));
            }
        }
    });
    estreeWalker.walk(ast, {
        enter: (node) => {
            if (!node.trailingComments) {
                return;
            }
            node.trailingComments = node.trailingComments.filter((comment) => {
                return !rangesInLeadingComments.has(comment.range.join(','));
            });
        }
    });
}
233444
function removeComments(node) {
  var _arr3 = COMMENT_KEYS;

  for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
    var key = _arr3[_i3];
    delete node[key];
  }
  return node;
}
811902
def _strip_comments(line, comments=None):
        """"""
        if comments is None:
            comments = []

        new_comments = False
        comment_start = line.find("#")
        if comment_start != -1:
            comments.append(line[comment_start + 1:].strip())
            new_comments = True
            line = line[:comment_start]

        return line, comments, new_comments
600404
private void removeCommentNodes(Document doc) {
        List<Node> toRemove = new ArrayList<>();
        NodeList children = doc.getChildNodes();
        for (int cn = 0; cn < children.getLength(); cn++) {
            Node child = children.item(cn);
            if (Node.COMMENT_NODE == child.getNodeType()) {
                toRemove.add(child);
            }
        }
        for (Node child : toRemove) {
            doc.removeChild(child);
        }
    }
1151265
private void _cleanChildren() {
        //bStatsTreeNeedsUpdate = true;
        if (children != null) {
            Iterator values = children.values().iterator();

            while (values.hasNext()) {
                ModuleItem remMI = (ModuleItem) values.next();
                remMI.getInstance().cleanup();

                //_cleanMBean(remMI);
                remMI._cleanChildren();
                remMI = null;
            }

            children.clear();
        }
    }
801458
public Comment removeComment(final long commentId) {
        Comment removedComment = null;

        if (comments != null) {
            for (int index = comments.size() - 1; index >= 0; --index) {
                Comment currentComment = comments.get(index);

                if (currentComment.getId() == commentId) {
                    removedComment = comments.remove(index);
                    break;
                }
            }
        }

        return removedComment;
    }
742160
def delete_children(attribute)
      self.send(attribute).each { |c| c.parent = nil }
      self.send(attribute).clear
    end
864144
function () {
        YAHOO.util.Event.purgeElement(this.container,true);
        this.container.parentNode.removeChild(this.container);
        this.container = null;
    }
258048
private String removeCommentsFromInput(BufferedReader in) throws IOException {
	  String l = in.readLine();
	  //remove lines that start with a comment
	  while(l.startsWith("#")){
	    l = in.readLine();
	  }
	  if(l.contains("#")){
	    l = l.substring(0, l.indexOf("#"));
	  }
	  return l.trim();
  }
624167
function(id, params, headers, callback) {
        var url;
        url = this.client.url() + ("comments/" + (id || ''));
        return this.client.del(url, params, headers, callback);
      }
967378
def remove_comments(code):
    """"""

    pattern = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*\n)"
    # first group captures quoted strings (double or single)
    # second group captures comments (//single-line or /* multi-line */)
    regex = re.compile(pattern, re.MULTILINE | re.DOTALL)

    def do_replace(match):
        # if the 2nd group (capturing comments) is not None,
        # it means we have captured a non-quoted (real) comment string.
        if match.group(2) is not None:
            return ""  # so we will return empty to remove the comment
        else:  # otherwise, we will return the 1st group
            return match.group(1)  # captured quoted-string

    return regex.sub(do_replace, code)
510448
def clean_comment_body(body):
    
    body = _parser.unescape(body)
    body = re.sub(r'<a [^>]+>(.+?)</a>', r'\1', body)
    body = body.replace('<br>', '\n')
    body = re.sub(r'<.+?>', '', body)
    return body