<commit_before>#!/usr/bin/env python

'''
circle_urls.py will rename all url files to not have extension .html

'''

import sys
import os
from glob import glob

site_dir = os.path.abspath(sys.argv[1])
print("Using site directory %s" %(site_dir))

files = glob("%s/*.html" %(site_dir))

# For each file, we need to replace all links to have correct .html extension
search_names = [os.path.basename(f).replace('.html','') for f in files]
for html_file in files:
    with open(html_file,'r') as filey:
        content = filey.read()
    for search_name in search_names:
        content = content.replace('%s"' %(search_name),'%s.html"' %(search_name))
    with open(html_file,'w') as filey:
        filey.write(content)<commit_msg>need to replace circle pr number<commit_after>#!/usr/bin/env python

'''
circle_urls.py will rename all url files to not have extension .html

'''

import sys
import os
from glob import glob

site_dir = os.path.abspath(sys.argv[1])
print("Using site directory %s" %(site_dir))

files = glob("%s/*.html" %(site_dir))

# Circle PR number is part of the URL
circle_pr_number = os.environ['CIRCLE_PR_NUMBER']

# For each file, we need to replace all links to have correct .html extension
search_names = [os.path.basename(f).replace('.html','') for f in files]
for html_file in files:
    with open(html_file,'r') as filey:
        content = filey.read()
    for search_name in search_names:
        content = content.replace('%s"' %(search_name),'%s.html"' %(search_name))
    # Circle PR number is part of the URL
    content = content.replace('/experiments/', '/%s/experiments' %circle_pr_number)
    with open(html_file,'w') as filey:
        filey.write(content)
{'fraction_non_alphanumeric': 0.1366863905325444, 'fraction_numerical': 0.001183431952662722, 'mean_word_length': 4.108761329305136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5408486', 'n_tokens_mistral': 567, 'n_tokens_neox': 560, 'n_words': 174}