<commit_before>#!/usr/bin/python

import sys
import os
try:
    import json
except:
    from django.utils import simplejson as json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)))
import manage
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'

from django.test.client import Client
from settings import DHCP_CONFIG_OUTPUT_DIRECTORY
from dhcp.models import DHCPFile
always_push_svn = True
def main():
    client = Client()
    dhcp_scopes = []
    dhcp_scopes = json.loads(client.get('/api/dhcp/1/get_scopes/', follow=True).content)
    output_dir = DHCP_CONFIG_OUTPUT_DIRECTORY
    for dhcp_scope in dhcp_scopes:
        try:
            dir = dhcp_scope.split("-")[0]
            output_file = dhcp_scope.split("-")[1]
            final_destination_file = "%s/%s/%s_generated_hosts.conf" % (output_dir,dir, output_file)
            output_text = client.get('/api/dhcp/%s/view_hosts/' % dhcp_scope, follow=True).content
            output_text = output_text[1:-1]
            output_text =  output_text.replace("\\n","\n")
            output_text =  output_text.replace('\\"','"')
            try:
                f = open(final_destination_file,"w")
                f.write(output_text)
                f.close()<commit_msg>Update to scripts/output_dhcp_config_files_svn.py to help with changes accidently overwriting<commit_after>#!/usr/bin/python

import sys
import os
try:
    import json
except:
    from django.utils import simplejson as json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)))
import manage
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'

from django.test.client import Client
from settings import DHCP_CONFIG_OUTPUT_DIRECTORY
from dhcp.models import DHCPFile
always_push_svn = True
def main():
    client = Client()
    dhcp_scopes = []
    dhcp_scopes = json.loads(client.get('/api/dhcp/1/get_scopes/', follow=True).content)
    output_dir = DHCP_CONFIG_OUTPUT_DIRECTORY
    for dhcp_scope in dhcp_scopes:
        try:
            dir = dhcp_scope.split("-")[0]
            output_file = '-'.join(dhcp_scope.split("-")[1:])
            final_destination_file = "%s/%s/%s_generated_hosts.conf" % (output_dir,dir, output_file)
            output_text = client.get('/api/dhcp/%s/view_hosts/' % dhcp_scope, follow=True).content
            output_text = output_text[1:-1]
            output_text =  output_text.replace("\\n","\n")
            output_text =  output_text.replace('\\"','"')
            try:
                f = open(final_destination_file,"w")
                f.write(output_text)
                f.close()
{'fraction_non_alphanumeric': 0.13231642426392337, 'fraction_numerical': 0.0035473572188719402, 'mean_word_length': 3.116788321167883, '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': '6331161', 'n_tokens_mistral': 975, 'n_tokens_neox': 943, 'n_words': 159}