

def __init__(self, bucket=None, access_key=None, secret_key=None, headers=None, calling_format=None, cache=None, base_url=None):
    if (bucket is None):
        bucket = settings.AWS_STORAGE_BUCKET_NAME
    if (calling_format is None):
        calling_format = getattr(settings, 'AWS_CALLING_FORMAT', CallingFormat.SUBDOMAIN)
    self.bucket = bucket
    if ((not access_key) and (not secret_key)):
        (access_key, secret_key) = self._get_access_keys()
    self.connection = AWSAuthConnection(access_key, secret_key, calling_format=calling_format)
    default_headers = getattr(settings, HEADERS, [])
    if isinstance(default_headers, dict):
        default_headers = [('.*', default_headers)]
    if headers:
        default_headers = (list(headers) + list(default_headers))
    self.headers = []
    for value in default_headers:
        self.headers.append((re.compile(value[0]), value[1]))
    if (cache is not None):
        self.cache = cache
    else:
        cache = getattr(settings, 'CUDDLYBUDDLY_STORAGE_S3_CACHE', None)
        if (cache is not None):
            self.cache = self._get_cache_class(cache)()
        else:
            self.cache = None
    if (base_url is None):
        if (not self.static):
            base_url = settings.MEDIA_URL
        else:
            base_url = settings.STATIC_URL
    self.base_url = base_url

dataset/ETHPy150Open kylemacfarlane/django-cb-storage-s3/src/cuddlybuddly/storage/s3/storage.py S3Storage.__init__/original