<commit_before>import tablib
from django.core.management.base import BaseCommand

from painter.models import Card


class Command(BaseCommand):
    help = ('Clears the database of cards, then fills it with the contents of one or' +
            ' more specified CSV files.')

    def add_arguments(self, parser):
        parser.add_argument(
            'filenames',
            nargs='+',
            type=str,
            help='One or more CSV file names. The extension is optional.',
        )

    def handle(self, *args, **options):
        dataset = tablib.Dataset()
        for filename in options['filenames']:
            print(filename)<commit_msg>Ensure the filenames have the .csv extension.<commit_after>import tablib
from django.core.management.base import BaseCommand

from painter.models import Card


class Command(BaseCommand):
    help = ('Clears the database of cards, then fills it with the contents of one or' +
            ' more specified CSV files.')

    def add_arguments(self, parser):
        parser.add_argument(
            'filenames',
            nargs='+',
            type=str,
            help='One or more CSV file names. The extension is optional.',
        )

    def ensure_csv_extension(self, filename):
        """Add '.csv' onto the end of filename if it isn't already there."""
        if filename.endswith('.csv'):
            return filename
        return filename + '.csv'

    def handle(self, *args, **options):
        dataset = tablib.Dataset()
        for filename in options['filenames']:
            filename = self.ensure_csv_extension(filename)
            print(filename)
{'fraction_non_alphanumeric': 0.09582309582309582, 'fraction_numerical': 0.0, 'mean_word_length': 2.39375, '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': '6260837', 'n_tokens_mistral': 434, 'n_tokens_neox': 422, 'n_words': 147}