<commit_before>import collections
import imp
from importlib import import_module
from optparse import OptionParser, NO_DEFAULT
import os
import sys

import django
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError, handle_default_options
from django.core.management.color import color_style
from django.utils import six

# For backwards compatibility: get_version() used to be in this module.
from django import get_version

# A cache of loaded commands, so that call_command
# doesn't have to reload every time it's called.
_commands = None


def find_commands(management_dir):
    """
    Given a path to a management directory, returns a list of all the command
    names that are available.

    Returns an empty list if no commands are defined.
    """
    command_dir = os.path.join(management_dir, 'commands')
    try:
        return [f[:-3] for f in os.listdir(command_dir)
                if not f.startswith('_') and f.endswith('.py')]
    except OSError:
        return []

<commit_msg>Oops.<commit_after>import collections
import imp
from importlib import import_module
from optparse import OptionParser, NO_DEFAULT
import os
import sys

import django
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError, handle_default_options
from django.core.management.color import color_style
from django.utils import six

# For backwards compatibility: get_version() used to be in this module.
from django import get_version

# A cache of loaded commands, so that call_command
# doesn't have to reload every time it's called.
_commands = None


def find_commands(management_dir):
    """
    Given a path to a management directory, returns a list of all the command
    names that are available.

    Returns an empty list if no commands are defined.
    """
    command_dir = os.path.join(management_dir, 'commands')
    try:
        return [f[:-3] for f in os.listdir(command_dir)
                if not f.startswith('_') and f.endswith('.py')]
    except OSError:
        return []


{'fraction_non_alphanumeric': 0.0656770130454341, 'fraction_numerical': 0.000899685110211426, 'mean_word_length': 3.975391498881432, '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': '1060726', 'n_tokens_mistral': 609, 'n_tokens_neox': 591, 'n_words': 244}