<commit_before>"""
Management command to execute several deployment steps with a single command.
More to save flux in the puppet manifest than any effort to reduce typing
required.

.. moduleauthor:: Infoxchange Development Team <<EMAIL>>

"""
import logging
from shutil import copytree

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

LOGGER = logging.getLogger(__name__)


class Command(NoArgsCommand):
    """
    Copy static files to nginx location
    """

    def handle_noargs(self, **options):
        try:
            static_dir = settings.NGINX_STATIC_DIR
        except AttributeError:
            static_dir = None

        if not static_dir:
            return<commit_msg>A version of copytree that handles me pre-creating /static<commit_after>"""
Management command to execute several deployment steps with a single command.
More to save flux in the puppet manifest than any effort to reduce typing
required.

.. moduleauthor:: Infoxchange Development Team <<EMAIL>>

"""
import logging
import os
from shutil import copy2, copystat

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

LOGGER = logging.getLogger(__name__)


def copytree(src, dst):
    """
    A version of copytree I don't hate
    """

    if not (os.path.exists(dst) and os.path.isdir(dst)):
        os.makedirs(dst)
        copystat(src, dst)

    for name in os.listdir(src):
        srcname = os.path.join(src, name)
        dstname = os.path.join(dst, name)

        if os.path.isdir(srcname):
            copytree(srcname, dstname)
        else:
            copy2(srcname, dstname)


class Command(NoArgsCommand):
    """
    Copy static files to nginx location
    """

    def handle_noargs(self, **options):
        try:
            static_dir = settings.NGINX_STATIC_DIR
        except AttributeError:
            static_dir = None

        if not static_dir:
            return
{'fraction_non_alphanumeric': 0.07965056526207605, 'fraction_numerical': 0.0010277492291880781, 'mean_word_length': 2.8784860557768925, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4030818', 'n_tokens_mistral': 551, 'n_tokens_neox': 538, 'n_words': 185}