<commit_before># Python script for additional style validation
# Author: <NAME>
# Version: 2011-12-17
# * Requires lxml library (http://lxml.de/)
#
# Add CC by-sa license

import os, glob, re
from lxml import etree

path = 'C:\Documents and Settings\zelle\My Documents\CSL\styles\\'

for independentStyle in glob.glob( os.path.join(path, '*.csl') ):
    #print(os.path.basename(independentStyle))
    parser = etree.XMLParser(remove_blank_text=True)
    style = etree.parse(independentStyle, parser)
    styleElement = style.getroot()
    
    try:
        verbatimsStyle = styleElement.find(".//{http://purl.org/net/xbiblio/csl}rights").text
        style = etree.tostring(style, pretty_print=True, xml_declaration=True, encoding="utf-8")
        style = style.replace("'", '"', 4)
        f = open(independentStyle, 'w')
        f.write ( style )
        f.close()
    except:
        pass
<commit_msg>Escape non-breaking spaces during (re)indentation.<commit_after># -*- coding: utf-8 -*-
# Python script for additional style validation
# Author: <NAME>
# Version: 2011-12-17
# * Requires lxml library (http://lxml.de/)
#
# Add CC by-sa license

import os, glob, re
from lxml import etree

path = 'C:\Documents and Settings\zelle\My Documents\CSL\styles\\'

for independentStyle in glob.glob( os.path.join(path, '*.csl') ):
    #print(os.path.basename(independentStyle))
    parser = etree.XMLParser(remove_blank_text=True)
    style = etree.parse(independentStyle, parser)
    styleElement = style.getroot()
    
    try:
        verbatimsStyle = styleElement.find(".//{http://purl.org/net/xbiblio/csl}rights").text
        style = etree.tostring(style, pretty_print=True, xml_declaration=True, encoding="utf-8")
        style = style.replace("'", '"', 4)
        style = style.replace(" ", "&#160;")
        f = open(independentStyle, 'w')
        f.write ( style )
        f.close()
    except:
        pass

{'fraction_non_alphanumeric': 0.14785788923719959, 'fraction_numerical': 0.012539184952978056, 'mean_word_length': 3.246119733924612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '4840927', 'n_tokens_mistral': 652, 'n_tokens_neox': 625, 'n_words': 139}