<commit_before>from django_medusa.renderers import DiskStaticSiteRenderer


class WaferDiskStaticSiteRenderer(DiskStaticSiteRenderer):

    # People may create pages that mirror directories - if this happens,
    # we skip the page, rather than aborting and print a message, since
    # this may require manual fixup later
    def render_path(self, path=None, view=None):
        if not path:
            super(WaferDiskStaticSiteRenderer, self).render_path(path, view)
        else:
            try:
                super(WaferDiskStaticSiteRenderer, self).render_path(path,
                                                                     view)
            except IOError as err:
                print('Skiping %s - threw IOError %s' % (path, err))<commit_msg>Copy static assets into static site<commit_after>import shutil
import os

from django_medusa.renderers import DiskStaticSiteRenderer
from django.conf import settings


class WaferDiskStaticSiteRenderer(DiskStaticSiteRenderer):

    # People may create pages that mirror directories - if this happens,
    # we skip the page, rather than aborting and print a message, since
    # this may require manual fixup later
    def render_path(self, path=None, view=None):
        if not path:
            super(WaferDiskStaticSiteRenderer, self).render_path(path, view)
        else:
            try:
                super(WaferDiskStaticSiteRenderer, self).render_path(path,
                                                                     view)
            except IOError as err:
                print('Skiping %s - threw IOError %s' % (path, err))

    # Copy static assets into place.
    @classmethod
    def finalize_output(self):
        DiskStaticSiteRenderer.finalize_output()

        static_path = os.path.join(settings.MEDUSA_DEPLOY_DIR,
                                   settings.STATIC_URL.lstrip('/'))
        media_path = os.path.join(settings.MEDUSA_DEPLOY_DIR,
                                  settings.MEDIA_URL.lstrip('/'))

        shutil.rmtree(static_path, ignore_errors=True)
        shutil.rmtree(media_path, ignore_errors=True)

        shutil.copytree(settings.STATIC_ROOT, static_path)
        shutil.copytree(settings.MEDIA_ROOT, media_path)
{'fraction_non_alphanumeric': 0.07072515666965085, 'fraction_numerical': 0.0, 'mean_word_length': 2.2532751091703056, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3366179', 'n_tokens_mistral': 594, 'n_tokens_neox': 568, 'n_words': 155}