Creates url of file location on AWS.

        :param filename: name of file
        :type filename: str
        :return: url of file location
        :rtype: str
969699
def get_url(self, filename):
        
        tile_url = self.tile_url
        force_http = filename in [AwsConstants.TILE_INFO, AwsConstants.PRODUCT_INFO, AwsConstants.METADATA]
        if tile_url is None or force_http:
            tile_url = self.get_tile_url(force_http=force_http)
        return '{}/{}'.format(tile_url, self.add_file_extension(filename))
903604
def _urlretrieve(url, filename):
    
    ctx = create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = CERT_NONE

    with urlopen(url, context=ctx) as u, filename.open('wb') as f:
            f.write(u.read())
194784
def get_url(self, fname):
        
        self._assert_file_in_registry(fname)
        return self.urls.get(fname, "".join([self.base_url, fname]))
1096349
def url(self) -> str:
        

        return 'file://{path}?id={id}'.format(
            path=os.path.join(self.results_path, 'project.html'),
            id=self.uuid
        )
785661
def file_path(self) -> str:
        
        user_dir = self.__get_user_path()
        file_path = path.abspath(path.join(user_dir, self.FILENAME))
        return file_path
686772
def generate_filename(self, instance, filename):
        
        from unidecode import unidecode

        return super().generate_filename(instance, unidecode(force_text(filename)))
1298040
def getUrlFromFilename(self, filename):
        """"""
        components = util.splitpath(util.getRelativePath(self.basepath, filename))
        url = '/'.join([url_quote(component, '') for component in components])
        return self.baseurl + url
1367129
def __generate_filepath(self):
        
        file_path = os.path.join(self.file_dir, str(uuid.uuid4()))
        if os.path.exists(file_path):
            warnings.warn("something has almost certainly gone wrong")
            return self.__generate_filepath()
        return file_path
1126166
def get_file(filename):
    ''''''
    destination = __DOWNLOAD_PARAMS['path']
    filepath = os.path.join(destination, filename)

    if not __is_current(filepath):

        if not os.path.exists(destination):
            os.makedirs(destination)

        url = 'ftp://ftp.ebi.ac.uk/pub/databases/chebi/' + \
            'Flat_file_tab_delimited/'
        urlretrieve(urlparse.urljoin(url, filename), filepath)
        urlcleanup()

    if filepath.endswith('.zip'):
        zfile = zipfile.ZipFile(filepath, 'r')
        filepath = os.path.join(destination, zfile.namelist()[0])
        zfile.extractall(destination)
    elif filepath.endswith('.gz'):
        unzipped_filepath = filepath[:-len('.gz')]

        if os.path.exists(unzipped_filepath) \
                and __is_current(unzipped_filepath):
            filepath = unzipped_filepath
        else:
            input_file = gzip.open(filepath, 'rb')
            filepath = os.path.join(destination, input_file.name[:-len('.gz')])
            output_file = open(filepath, 'wb')

            for line in input_file:
                output_file.write(line)

            input_file.close()
            output_file.close()

    return filepath
969825
protected function _getUri($filename): string {
        $this->_verifyPath();
        // Note: AWS SDK does not want the URI to start with a slash, as opposed to the old Zend
        // Framework implementation.
        $path = trim($this->_config['path'], '/');
        return $path . '/' . $filename;
    }
287917
def addFilename( self, filename ):
        
        filename = os.path.normpath(nativestring(filename))
        
        if filename in self._filenames:
            self._filenames.remove(filename)
        
        self._filenames.insert(0, filename)
        self._filenames = self._filenames[:self.maximumLength()]
        
        self.refresh()
385339
def get_filepath(self, filename):
        
        return os.path.join(self.parent_folder, self.product_id, self.add_file_extension(filename)).replace(':', '.')
1205451
def _get_url(self, url):
        
        url = str(url)
        if url != 'default' and not '://' in url:
            url = ':///'.join(('file', url))
        return url
421205
def make_file_exist(self, filename=None):
        
        if filename is None:
            path_to_file = FilePath(self)
            path_to_file.make_file_exist()
            return path_to_file
        else:
            self.make_directory_exist()
            path_to_file = self.touch_file(filename)
            return FilePath(path_to_file)
1275468
def question_image_filepath(instance, filename):
    
    return '/'.join(['images', str(instance.question_level), str(instance.question_level_id), binascii.b2a_hex(os.urandom(15)), filename])
965664
def url_to_path(url):
    # type: (str) -> str
    
    assert url.startswith('file:'), (
        "You can only turn file: urls into filenames (not %r)" % url)

    _, netloc, path, _, _ = urllib_parse.urlsplit(url)

    # if we have a UNC path, prepend UNC share notation
    if netloc:
        netloc = '\\\\' + netloc

    path = urllib_request.url2pathname(netloc + path)
    return path
1234823
def build_local_filename(download_url=None, filename=None, decompress=False):
    
    assert download_url or filename, "Either filename or URL must be specified"

    # if no filename provided, use the original filename on the server
    if not filename:
        digest = hashlib.md5(download_url.encode('utf-8')).hexdigest()
        parts = split(download_url)
        filename = digest + "." + "_".join(parts)

    filename = normalize_filename(filename)

    if decompress:
        (base, ext) = splitext(filename)
        if ext in (".gz", ".zip"):
            filename = base

    return filename