<commit_before>import os
import os.path

from django.core.management.base import NoArgsCommand
from django.conf import settings

class Command(NoArgsCommand):
    
    can_import_settings = True

    def handle_noargs(self, **options):
        cache_manifest_path = os.path.join(settings.STATIC_ROOT,
                                           'cache.manifest')
        static_prefix_length = len(settings.STATIC_ROOT.split(os.sep))
        with open(cache_manifest_path, 'w') as cache_manifest:
            print >>cache_manifest, "CACHE MANIFEST"
            print >>cache_manifest, "CACHE:"
            for root, dirs, files in os.walk(settings.STATIC_ROOT):
                url = '/'.join(root.split(os.sep)[static_prefix_length:])
                for file in files:
                    print >>cache_manifest, "%s%s/%s" % (settings.STATIC_URL, url, file)<commit_msg>Don't cache markers, admin files or uncompressed JS/CSS<commit_after>import os
import os.path

from django.core.management.base import NoArgsCommand
from django.conf import settings

class Command(NoArgsCommand):
    
    can_import_settings = True

    def handle_noargs(self, **options):
        cache_manifest_path = os.path.join(settings.STATIC_ROOT,
                                           'cache.manifest')
        static_prefix_length = len(settings.STATIC_ROOT.split(os.sep))
        with open(cache_manifest_path, 'w') as cache_manifest:
            print >>cache_manifest, "CACHE MANIFEST"
            print >>cache_manifest, "CACHE:"
            for root, dirs, files in os.walk(settings.STATIC_ROOT):
                if root == settings.STATIC_ROOT:
                    # Don't cache admin media or markers
                    dirs.remove('admin')
                    dirs.remove('markers')
                url = '/'.join(root.split(os.sep)[static_prefix_length:])
                for file in files:
                    # Don't cache uncompressed JS/CSS
                    _, ext = os.path.splitext(file)
                    if ext in ('.js','.css') and 'c' != url.split('/')[0]:
                        continue
                    print >>cache_manifest, "%s%s/%s" % (settings.STATIC_URL, url, file)
{'fraction_non_alphanumeric': 0.10511882998171847, 'fraction_numerical': 0.0004570383912248629, 'mean_word_length': 2.09180790960452, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1084975', 'n_tokens_mistral': 631, 'n_tokens_neox': 581, 'n_words': 139}