<commit_before>import postcss from 'postcss';
import parser from 'postcss-selector-parser';

const uniformStyle = parser(selector => {
  selector.walkCombinators(node => {
    node.value = node.value.trim().concat(' ');
    node.spaces = {};
  });
  selector.walkAttributes(node => {
    if (node.value) {
      node.value = node.value.trim().replace(/^'?([^"']+)'?$/, '"$1"');
    }
    node.attribute = node.attribute.trim();
  });
});

export default postcss.plugin('postcss-combine-duplicated-selectors', () => {
  return css => {
    const symbolTable = new Map();

    css.walkRules(rule => {
      const selector = uniformStyle.process(rule.selector).result;
      if (symbolTable.has(selector)) {
        // store original rule as destination<commit_msg>add comment for what regex does<commit_after>import postcss from 'postcss';
import parser from 'postcss-selector-parser';

const uniformStyle = parser(selector => {
  selector.walkCombinators(node => {
    node.value = node.value.trim().concat(' ');
    node.spaces = {};
  });
  selector.walkAttributes(node => {
    if (node.value) {
      // remove padding whitespace, and wrap in double quotes
      node.value = node.value.trim().replace(/^'?([^"']+)'?$/, '"$1"');
    }
    node.attribute = node.attribute.trim();
  });
});

export default postcss.plugin('postcss-combine-duplicated-selectors', () => {
  return css => {
    const symbolTable = new Map();

    css.walkRules(rule => {
      const selector = uniformStyle.process(rule.selector).result;
      if (symbolTable.has(selector)) {
        // store original rule as destination
{'fraction_non_alphanumeric': 0.17144638403990026, 'fraction_numerical': 0.0012468827930174563, 'mean_word_length': 3.4707520891364902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2039580', 'n_tokens_mistral': 487, 'n_tokens_neox': 478, 'n_words': 98}