<commit_before>from django.core.files.storage import get_storage_class

from storages.backends.s3boto import S3BotoStorage


STATIC_LOCATION = 'static'


class StaticS3Storage(S3BotoStorage):

    def __init__(self, *args, **kwargs):
        super(StaticS3Storage, self).__init__(location=STATIC_LOCATION,
                                              *args, **kwargs)

    def url(self, name):
        url = super(StaticS3Storage, self).url(name)
        if name.endswith('/') and not url.endswith('/'):
            url += '/'
        return url


class MediaS3Storage(S3BotoStorage):

    def download_url(self, name):
        name = self._normalize_name(self._clean_name(name))
        return self.connection.generate_url(
            self.querystring_expire, method='GET',
            bucket=self.bucket.name, key=self._encode_name(name),
            query_auth=self.querystring_auth, force_http=True,
            response_headers={'response-content-disposition': 'attachment'})


class CachedS3BotoStorage(S3BotoStorage):
    """S3 storage backend that saves the files locally, too."""
    def __init__(self, location=STATIC_LOCATION, *args, **kwargs):
        super(CachedS3BotoStorage, self).__init__(location=location,
                                                  *args, **kwargs)
        self.local_storage = get_storage_class(
            "compressor.storage.CompressorFileStorage")()

    def save(self, name, content):
        name = super(CachedS3BotoStorage, self).save(name, content)
        self.local_storage._save(name, content)
        return name<commit_msg>Cosmetic update on the class.<commit_after>from django.core.files.storage import get_storage_class

from storages.backends.s3boto import S3BotoStorage


STATIC_LOCATION = 'static'


class StaticS3Storage(S3BotoStorage):

    def __init__(self, *args, **kwargs):
        super(StaticS3Storage, self).__init__(
            location=STATIC_LOCATION, *args, **kwargs)

    def url(self, name):
        url = super(StaticS3Storage, self).url(name)
        if name.endswith('/') and not url.endswith('/'):
            url += '/'
        return url


class MediaS3Storage(S3BotoStorage):

    def download_url(self, name):
        name = self._normalize_name(self._clean_name(name))
        return self.connection.generate_url(
            self.querystring_expire, method='GET',
            bucket=self.bucket.name, key=self._encode_name(name),
            query_auth=self.querystring_auth, force_http=True,
            response_headers={'response-content-disposition': 'attachment'})


class CachedS3BotoStorage(S3BotoStorage):
    """S3 storage backend that saves the files locally, too."""
    def __init__(self, location=STATIC_LOCATION, *args, **kwargs):
        super(CachedS3BotoStorage, self).__init__(
            location=location, *args, **kwargs)
        self.local_storage = get_storage_class(
            "compressor.storage.CompressorFileStorage")()

    def save(self, name, content):
        name = super(CachedS3BotoStorage, self).save(name, content)
        self.local_storage._save(name, content)
        return name
{'fraction_non_alphanumeric': 0.1108611825192802, 'fraction_numerical': 0.008354755784061696, 'mean_word_length': 3.0533854166666665, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4710769', 'n_tokens_mistral': 933, 'n_tokens_neox': 900, 'n_words': 177}