Get absolute path for filename.

    :param filename: file
    :return: path
978124
def get_path(filename):
    
    path = abspath(filename) if os.path.isdir(filename) else dirname(abspath(filename))
    return path
1058187
def get_file(self, attr_name):
        ''''''
        return os.path.abspath(os.path.join(self.folder, "{}.log"
                                            .format(attr_name)))
983064
def read_relative_file(filename):
    """"""
    with open(join(dirname(abspath(__file__)), filename)) as f:
        return f.read()
1002322
def from_filename(self, filename):
        '''
        
        '''
        i = len(self.base_directory)
        if filename[:i] != self.base_directory:
            raise ValueError('Filename needs to start with "%s";\nyou passed "%s".' % (self.base_directory, filename))

        if filename.endswith(self.extension):
            if len(self.extension) > 0:
                j = -len(self.extension)
            else:
                j = None
            return self.key_transformer.from_path(tuple(filename[i:j].strip('/').split('/')))
635712
def _ensure_filepath(filename):
        

        filepath = os.path.dirname(filename)
        if not os.path.exists(filepath):
            os.makedirs(filepath)
1016542
def partial_path(filename)
      return filename if filename.nil? || Pathname.new(filename).absolute?

      # try relative to template
      if template
        base_folder = File.dirname(template)
        filename = File.expand_path(File.join(base_folder, filename))
        return filename if File.exists?(filename)
      end

      # try relative to PWD
      filename = File.expand_path(File.join(FileUtils.pwd, filename))
      return filename if File.exists?(filename)

      # try built in template folder
      filename = File.expand_path(File.join('../templates', filename), __FILE__)
    end
980641
def absolute_path(string):
    ''''''
    if not os.path.isabs(string):
        msg = '{0!r} is not an absolute path'.format(string)
        raise argparse.ArgumentTypeError(msg)
    if not os.path.exists(os.path.dirname(string)):
        msg = 'path {0!r} does not exist'.format(string)
        raise argparse.ArgumentTypeError(msg)
    return string
490178
def get_absolute_path(some_path):
    
    if os.path.isabs(some_path):
        return some_path
    else:
        return evaluate_relative_path(os.getcwd(), some_path)
1167758
def _use_absolute_file_name(self, img):
        
        img['file_name'] = os.path.join(
            self._imgdir, img['file_name'])
        assert os.path.isfile(img['file_name']), img['file_name']
383229
def _get_abs_filepath(self, ifile):
        
        assert ifile is not None
        ifile = ifile[7:] if ifile.startswith('file://') else ifile
        if ifile[0] != '/':
            basedir = os.path.abspath(os.path.dirname(self.config_file))
            ifile = os.path.join(basedir, ifile)
        return 'file://' + ifile
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
580402
def _get_filename(self, path):
        
        match = re.search("[a-z]{2,3}_[A-Z]{2}", path)

        if match:
            start = match.start(0)
            filename = path[start:]
        else:
            filename = os.path.basename(path)

        return filename
637259
def realpath(self, filename):
        
        if self.filesystem.is_windows_fs:
            return self.abspath(filename)
        filename = make_string_path(filename)
        path, ok = self._joinrealpath(filename[:0], filename, {})
        return self.abspath(path)
986230
def normalizeFilename(filename):
    
    result = os.path.expanduser(filename)
    result = os.path.abspath(result)
    return result
874270
private String getFileName(String fileName) {

        if (fileName != null) {
            int index = fileName.indexOf(':');
            if (index < 0) {
                return fileName;
            } else {

                fileName = fileName.substring(index + 1);

                index = fileName.lastIndexOf('/');
                if (index < 0) {
                    return fileName;
                } else {
                    return fileName.substring(index + 1);
                }

            }
        }
        return null;
    }
438512
def obtain_to(filename):
    
    root, _ = nc.open(filename)
    lat, lon = nc.getvar(root, 'lat')[0,:], nc.getvar(root, 'lon')[0,:]
    nc.close(root)
    return obtain(lat, lon)
13203
def auto_cleaned_path(instance, filename: str) -> str:
    
    stem, suffix = parse_filename(filename)
    base_dir = get_base_dir_from_object(instance)
    target_filename = get_safe_path_name(stem)

    return os.path.join(base_dir, "{target_filename}{suffix}".format(target_filename=target_filename,
                                                                     suffix=suffix))