<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Perform text replacements in all files in the current directory and sub
# directories to help migrate from bootstrap 2 to bootstrap 3.
#
# This script should be executed in a directory with HTML files or templates.
# Use at your on risk, try it on a copy first!
import os
import re
from optparse import OptionParser

# List of regular expression replacements tuples to be executed in order.
# Does not include all changes from:
# http://getbootstrap.com/migration

# HTML class="btn" class='btn' class='something btn somethingelse'
# CSS .btn .btn.something
affix = r'(["\'\s\.\{]|\Z)'

# omitted classs: .checkbox.inline .radio.inline

all_regexes = {
    'general': [
        (re.compile(affix + r'span(\d+)' + affix), '\\1col-md-\\2\\3'),
        (re.compile(affix + r'offset(\d+)' + affix), '\\1col-md-offset-\\2\\3'),
        (re.compile(affix + r'hero-unit' + affix), '\\1jumbotron\\2'),

        (re.compile(affix + r'(container|row)-fluid' + affix), '\\1\\2\\3'),
        (re.compile(affix + r'nav-(collapse|toggle)' + affix), '\\1navbar-\\2\\3'),

        (re.compile(affix + r'(input|btn)-small' + affix), '\\1\\2-sm\\3'),
        (re.compile(affix + r'(input|btn)-large' + affix), '\\1\\2-lg\\3'),

        (re.compile(affix + r'btn-navbar' + affix), '\\1navbar-btn\\2'),
        (re.compile(affix + r'btn-mini' + affix), '\\1btn-xs\\2'),
        (re.compile(affix + r'unstyled' + affix), '\\1list-unstyled\\2'),

        (re.compile(affix + r'(visible|hidden)-phone' + affix), '\\1\\2-xs\\3'),
        (re.compile(affix + r'(visible|hidden)-tablet' + affix), '\\1\\2-sm\\3'),
        (re.compile(affix + r'(visible|hidden)-desktop' + affix), '\\1\\2-lg\\3'),

        (re.compile(affix + r'input-(prepend|append)' + affix), '\\1input-group\\3'),

        # Should these regexes be more restriced because class names are more
        # likely to occurr in other places?
        (re.compile(affix + r'inline' + affix), '\\1list-inline\\2'),
        (re.compile(affix + r'add-on' + affix), '\\1input-group-addon\\2'),
        (re.compile(affix + r'thumbnail' + affix), '\\1img-thumbnail\\2'),        
    ],
    # still missing:
    #  .navbar .nav -> .navbar-nav
    #  .btn -> .btn .btn-default
    #  .control-group.(warning|error|success) -> .form-group.has-*
    #  .(checkbox|radio).inline -> .*-inline
    #  .img-polaroid -> .img-thumbnail
    #  ul.unstyled -> .list-unstyled
    #  ul.inline -> .list-inline
    #  .label -> .label .label-default
    #  .table .error -> .table .danger
    #  .accordion-group -> .panel .panel-default    
    'more': [
        (re.compile(affix + r'btn' + affix), '\\1btn btn-default\\2'),
        (re.compile(affix + r'brand' + affix), '\\1navbar-brand\\2'),
        (re.compile(affix + r'(alert|text)-error' + affix), '\\1\\2-danger\\3'),
        (re.compile(affix + r'input-block-level' + affix), '\\1form-control\\2'),
        (re.compile(affix + r'control-group' + affix), '\\1form-group\\2'),
        (re.compile(affix + r'muted' + affix), '\\1text-muted\\2'),
        (re.compile(affix + r'label-important' + affix), '\\1label-danger\\2'),
        (re.compile(affix + r'bar(-\w+)?' + affix), '\\1progress-bar\\2\\3'),
        (re.compile(affix + r'accordion' + affix), '\\1panel-group\\2'),
        (re.compile(affix + r'accordion-heading' + affix), '\\1panel-heading\\2'),
        (re.compile(affix + r'accordion-body' + affix), '\\1panel-collapse\\2'),
        (re.compile(affix + r'accordion-inner' + affix), '\\1panel-body\\2'),
    ],
    # Font Awesome: https://github.com/FortAwesome/Font-Awesome/wiki/Upgrading-from-3.2.1-to-4	
    'html': [
        (re.compile(affix + r'btn' + affix), '\\1btn btn-default\\2'),
        (re.compile(affix + r'well-large' + affix), '\\1well-lg\\2'),
        (re.compile(affix + r'well-small' + affix), '\\1well-sm\\2'),        
        (re.compile(affix + r'icon-rotate-(\w+)' + affix), '\\1fa fa-rotate-\\2\\3'), # icons
        (re.compile(affix + r'icon-spin-(\w+)' + affix), '\\1fa fa-spin-\\2\\3'),
        (re.compile(affix + r'icon-li-(\w+)' + affix), '\\1fa fa-li-\\2\\3'),
        (re.compile(affix + r'icons-ul-(\w+)' + affix), '\\1fa fa-ul-\\2\\3'),
        (re.compile(affix + r'icon-large-(\w+)' + affix), '\\1fa fa-lg-\\2\\3'),
        (re.compile(affix + r'icon-hand-(\w+)' + affix), '\\1fa fa-hand-o-\\2\\3'),
        (re.compile(affix + r'icon-fixed-width-(\w+)' + affix), '\\1fa fa-fw-\\2\\3'),
        (re.compile(affix + r'icon-chevron-sign-(\w+)' + affix), '\\1fa fa-chevron-circle-\\2\\3'),
        (re.compile(affix + r'icon-circle-arrow-(\w+)' + affix), '\\1fa fa-arrow-circle-\\2\\3'),
        (re.compile(affix + r'icon-double-angle-(\w+)' + affix), '\\1fa fa-angle-double-\\2\\3'),
        (re.compile(affix + r'icon-fixed-width' + affix), '\\1fa fa-fw\\2'),
        (re.compile(affix + r'icon-large' + affix), '\\1fa-lg\\2'),
        (re.compile(affix + r'icon-ul' + affix), '\\1fa-ul\\2'),
        (re.compile(affix + r'icon-li' + affix), '\\1fa-li\\2'),
        (re.compile(affix + r'icon-spin' + affix), '\\1fa-spin\\2'),
        
        (re.compile(affix + r'icon-ban-circle' + affix), '\\1fa fa-ban\\2'),
        (re.compile(affix + r'icon-bar-chart' + affix), '\\1fa fa-bar-chart-o\\2'),        
        (re.compile(affix + r'icon-beaker' + affix), '\\1fa fa-flask\\2'),
        (re.compile(affix + r'icon-bell' + affix), '\\1fa fa-bell-o\\2'),        
        (re.compile(affix + r'icon-bell-alt' + affix), '\\1fa fa-bell\\2'),
        (re.compile(affix + r'icon-bitbucket-sign' + affix), '\\1fa fa-bitbucket-square\\2'),
        (re.compile(affix + r'icon-bookmark-empty' + affix), '\\1fa fa-bookmark-o\\2'),        
        (re.compile(affix + r'icon-building' + affix), '\\1fa fa-building-o\\2'),
        (re.compile(affix + r'icon-calendar-empty' + affix), '\\1fa fa-calendar-o\\2'),
        (re.compile(affix + r'icon-check-empty' + affix), '\\1fa fa-square-o\\2'),
        (re.compile(affix + r'icon-check-minus' + affix), '\\1fa fa-minus-square-o\\2'),
        (re.compile(affix + r'icon-check-sign' + affix), '\\1fa fa-check-square\\2'),<commit_msg>Update more rule for b2tob3 for the missing in html type<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Perform text replacements in all files in the current directory and sub
# directories to help migrate from bootstrap 2 to bootstrap 3.
#
# This script should be executed in a directory with HTML files or templates.
# Use at your on risk, try it on a copy first!
import os
import re
from optparse import OptionParser

# List of regular expression replacements tuples to be executed in order.
# Does not include all changes from:
# http://getbootstrap.com/migration

# HTML class="btn" class='btn' class='something btn somethingelse'
# CSS .btn .btn.something
affix = r'(["\'\s\.\{]|\Z)'

# omitted classs: .checkbox.inline .radio.inline

all_regexes = {
    'general': [
        (re.compile(affix + r'span(\d+)' + affix), '\\1col-md-\\2\\3'),
        (re.compile(affix + r'offset(\d+)' + affix), '\\1col-md-offset-\\2\\3'),
        (re.compile(affix + r'hero-unit' + affix), '\\1jumbotron\\2'),

        (re.compile(affix + r'(container|row)-fluid' + affix), '\\1\\2\\3'),
        (re.compile(affix + r'nav-(collapse|toggle)' + affix), '\\1navbar-\\2\\3'),

        (re.compile(affix + r'(input|btn)-small' + affix), '\\1\\2-sm\\3'),
        (re.compile(affix + r'(input|btn)-large' + affix), '\\1\\2-lg\\3'),

        (re.compile(affix + r'btn-navbar' + affix), '\\1navbar-btn\\2'),
        (re.compile(affix + r'btn-mini' + affix), '\\1btn-xs\\2'),
        (re.compile(affix + r'unstyled' + affix), '\\1list-unstyled\\2'),

        (re.compile(affix + r'(visible|hidden)-phone' + affix), '\\1\\2-xs\\3'),
        (re.compile(affix + r'(visible|hidden)-tablet' + affix), '\\1\\2-sm\\3'),
        (re.compile(affix + r'(visible|hidden)-desktop' + affix), '\\1\\2-lg\\3'),

        (re.compile(affix + r'input-(prepend|append)' + affix), '\\1input-group\\3'),

        # Should these regexes be more restriced because class names are more
        # likely to occurr in other places?
        (re.compile(affix + r'inline' + affix), '\\1list-inline\\2'),
        (re.compile(affix + r'add-on' + affix), '\\1input-group-addon\\2'),
        (re.compile(affix + r'thumbnail' + affix), '\\1img-thumbnail\\2'),        
    ],
    # still missing:
    #  .navbar .nav -> .navbar-nav
    #  .btn -> .btn .btn-default
    #  .control-group.(warning|error|success) -> .form-group.has-*
    #  .(checkbox|radio).inline -> .*-inline
    #  .img-polaroid -> .img-thumbnail
    #  ul.unstyled -> .list-unstyled
    #  ul.inline -> .list-inline
    #  .label -> .label .label-default
    #  .table .error -> .table .danger
    #  .accordion-group -> .panel .panel-default    
    'more': [
        (re.compile(affix + r'btn' + affix), '\\1btn btn-default\\2'),
        (re.compile(affix + r'brand' + affix), '\\1navbar-brand\\2'),
        (re.compile(affix + r'(alert|text)-error' + affix), '\\1\\2-danger\\3'),
        (re.compile(affix + r'input-block-level' + affix), '\\1form-control\\2'),
        (re.compile(affix + r'control-group' + affix), '\\1form-group\\2'),
        (re.compile(affix + r'muted' + affix), '\\1text-muted\\2'),
        (re.compile(affix + r'label-important' + affix), '\\1label-danger\\2'),
        (re.compile(affix + r'bar(-\w+)?' + affix), '\\1progress-bar\\2\\3'),
        (re.compile(affix + r'accordion' + affix), '\\1panel-group\\2'),
        (re.compile(affix + r'accordion-heading' + affix), '\\1panel-heading\\2'),
        (re.compile(affix + r'accordion-body' + affix), '\\1panel-collapse\\2'),
        (re.compile(affix + r'accordion-inner' + affix), '\\1panel-body\\2'),
    ],
    # Font Awesome: https://github.com/FortAwesome/Font-Awesome/wiki/Upgrading-from-3.2.1-to-4	
    'html': [
        (re.compile(affix + r'btn' + affix), '\\1btn btn-default\\2'),
        (re.compile(affix + r'well-large' + affix), '\\1well-lg\\2'),
        (re.compile(affix + r'well-small' + affix), '\\1well-sm\\2'),
        (re.compile(affix + r'(alert|text)-error' + affix), '\\1\\2-danger\\3'),
        (re.compile(affix + r'input-block-level' + affix), '\\1form-control\\2'),
        (re.compile(affix + r'control-group' + affix), '\\1form-group\\2'),
        (re.compile(affix + r'label-important' + affix), '\\1label-danger\\2'),                                
        (re.compile(affix + r'icon-rotate-(\w+)' + affix), '\\1fa fa-rotate-\\2\\3'), # icons
        (re.compile(affix + r'icon-spin-(\w+)' + affix), '\\1fa fa-spin-\\2\\3'),
        (re.compile(affix + r'icon-li-(\w+)' + affix), '\\1fa fa-li-\\2\\3'),
        (re.compile(affix + r'icons-ul-(\w+)' + affix), '\\1fa fa-ul-\\2\\3'),
        (re.compile(affix + r'icon-large-(\w+)' + affix), '\\1fa fa-lg-\\2\\3'),
        (re.compile(affix + r'icon-hand-(\w+)' + affix), '\\1fa fa-hand-o-\\2\\3'),
        (re.compile(affix + r'icon-fixed-width-(\w+)' + affix), '\\1fa fa-fw-\\2\\3'),
        (re.compile(affix + r'icon-chevron-sign-(\w+)' + affix), '\\1fa fa-chevron-circle-\\2\\3'),
        (re.compile(affix + r'icon-circle-arrow-(\w+)' + affix), '\\1fa fa-arrow-circle-\\2\\3'),
        (re.compile(affix + r'icon-double-angle-(\w+)' + affix), '\\1fa fa-angle-double-\\2\\3'),
        (re.compile(affix + r'icon-fixed-width' + affix), '\\1fa fa-fw\\2'),
        (re.compile(affix + r'icon-large' + affix), '\\1fa-lg\\2'),
        (re.compile(affix + r'icon-ul' + affix), '\\1fa-ul\\2'),
        (re.compile(affix + r'icon-li' + affix), '\\1fa-li\\2'),
        (re.compile(affix + r'icon-spin' + affix), '\\1fa-spin\\2'),
        
        (re.compile(affix + r'icon-ban-circle' + affix), '\\1fa fa-ban\\2'),
        (re.compile(affix + r'icon-bar-chart' + affix), '\\1fa fa-bar-chart-o\\2'),        
        (re.compile(affix + r'icon-beaker' + affix), '\\1fa fa-flask\\2'),
        (re.compile(affix + r'icon-bell' + affix), '\\1fa fa-bell-o\\2'),        
        (re.compile(affix + r'icon-bell-alt' + affix), '\\1fa fa-bell\\2'),
        (re.compile(affix + r'icon-bitbucket-sign' + affix), '\\1fa fa-bitbucket-square\\2'),
        (re.compile(affix + r'icon-bookmark-empty' + affix), '\\1fa fa-bookmark-o\\2'),        
        (re.compile(affix + r'icon-building' + affix), '\\1fa fa-building-o\\2'),
        (re.compile(affix + r'icon-calendar-empty' + affix), '\\1fa fa-calendar-o\\2'),
        (re.compile(affix + r'icon-check-empty' + affix), '\\1fa fa-square-o\\2'),
        (re.compile(affix + r'icon-check-minus' + affix), '\\1fa fa-minus-square-o\\2'),
        (re.compile(affix + r'icon-check-sign' + affix), '\\1fa fa-check-square\\2'),
{'fraction_non_alphanumeric': 0.23948984411903637, 'fraction_numerical': 0.023854511100614078, 'mean_word_length': 2.4056300268096513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, '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': '3659905', 'n_tokens_mistral': 4975, 'n_tokens_neox': 4882, 'n_words': 835}