-------------------------- Get logo filename of OS distribution
975181
function getLogoFile(distro) {
  distro = distro || '';
  distro = distro.toLowerCase();
  let result = _platform;
  if (_windows) {
    result = 'windows';
  }
  else if (distro.indexOf('mac os') !== -1) {
    result = 'apple';
  }
  else if (distro.indexOf('arch') !== -1) {
    result = 'arch';
  }
  else if (distro.indexOf('centos') !== -1) {
    result = 'centos';
  }
  else if (distro.indexOf('coreos') !== -1) {
    result = 'coreos';
  }
  else if (distro.indexOf('debian') !== -1) {
    result = 'debian';
  }
  else if (distro.indexOf('deepin') !== -1) {
    result = 'deepin';
  }
  else if (distro.indexOf('elementary') !== -1) {
    result = 'elementary';
  }
  else if (distro.indexOf('fedora') !== -1) {
    result = 'fedora';
  }
  else if (distro.indexOf('gentoo') !== -1) {
    result = 'gentoo';
  }
  else if (distro.indexOf('mageia') !== -1) {
    result = 'mageia';
  }
  else if (distro.indexOf('mandriva') !== -1) {
    result = 'mandriva';
  }
  else if (distro.indexOf('manjaro') !== -1) {
    result = 'manjaro';
  }
  else if (distro.indexOf('mint') !== -1) {
    result = 'mint';
  }
  else if (distro.indexOf('openbsd') !== -1) {
    result = 'openbsd';
  }
  else if (distro.indexOf('freebsd') !== -1) {
    result = 'freebsd';
  }
  else if (distro.indexOf('opensuse') !== -1) {
    result = 'opensuse';
  }
  else if (distro.indexOf('pclinuxos') !== -1) {
    result = 'pclinuxos';
  }
  else if (distro.indexOf('puppy') !== -1) {
    result = 'puppy';
  }
  else if (distro.indexOf('raspbian') !== -1) {
    result = 'raspbian';
  }
  else if (distro.indexOf('reactos') !== -1) {
    result = 'reactos';
  }
  else if (distro.indexOf('redhat') !== -1) {
    result = 'redhat';
  }
  else if (distro.indexOf('slackware') !== -1) {
    result = 'slackware';
  }
  else if (distro.indexOf('sugar') !== -1) {
    result = 'sugar';
  }
  else if (distro.indexOf('steam') !== -1) {
    result = 'steam';
  }
  else if (distro.indexOf('suse') !== -1) {
    result = 'suse';
  }
  else if (distro.indexOf('mate') !== -1) {
    result = 'ubuntu-mate';
  }
  else if (distro.indexOf('lubuntu') !== -1) {
    result = 'lubuntu';
  }
  else if (distro.indexOf('xubuntu') !== -1) {
    result = 'xubuntu';
  }
  else if (distro.indexOf('ubuntu') !== -1) {
    result = 'ubuntu';
  }
  else if (distro.indexOf('solaris') !== -1) {
    result = 'solaris';
  }
  else if (distro.indexOf('tails') !== -1) {
    result = 'tails';
  }
  else if (distro.indexOf('robolinux') !== -1) {
    result = 'robolinux';
  } else if (_linux && distro) {
    result = distro.toLowerCase();
  }
  return result;
}
1221953
def get_filename4code(module, content, ext=None):
    
    imagedir = module + "-images"
    fn = hashlib.sha1(content.encode(sys.getfilesystemencoding())).hexdigest()
    try:
        os.mkdir(imagedir)
        sys.stderr.write('Created directory ' + imagedir + '\n')
    except OSError:
        pass
    if ext:
        fn += "." + ext
    return os.path.join(imagedir, fn)
692180
def _get_fname_nio(store):
    """"""
    try:
        f = store.ds.file
    except AttributeError:
        return None
    try:
        return f.path
    except AttributeError:
        return None
1174817
def filename(self):
        """"""
        if os.path.splitext(self.destination)[1]:
            # If the filename has been given make use of it
            target_file = self.destination
        else:
            # Otherwise determine it from the url.
            parsed_url = urlparse(self.url)
            source_filename = (parsed_url.path.rpartition('/')[-1] or
                               parsed_url.hostname)
            target_file = os.path.join(self.destination, source_filename)

        return os.path.abspath(target_file)
407948
def name(self, pretty=False):
        
        name = self.os_release_attr('name') \
            or self.lsb_release_attr('distributor_id') \
            or self.distro_release_attr('name') \
            or self.uname_attr('name')
        if pretty:
            name = self.os_release_attr('pretty_name') \
                or self.lsb_release_attr('description')
            if not name:
                name = self.distro_release_attr('name') \
                       or self.uname_attr('name')
                version = self.version(pretty=True)
                if version:
                    name = name + ' ' + version
        return name or ''
739858
def parse_os_release(release_path='/etc/os-release'):
    
    release_info = {}
    if os.path.isfile(release_path):
        for line in open(release_path, 'r').readlines():
            line = line.strip()
            if line.startswith('#'):
                continue
            parts = line.split('=')
            if len(parts) != 2:
                continue
            release_info[parts[0].strip()] = parts[1].strip("\"'\n\t ")
    # In theory, we want ID/NAME, VERSION_ID and VERSION_CODENAME (with a
    # possible fallback to VERSION on the latter), based on information at:
    # https://www.freedesktop.org/software/systemd/man/os-release.html
    # However, after reviewing several distros /etc/os-release, getting
    # the codename is a bit of a mess.  It's usually in parentheses in
    # VERSION, with some exceptions.
    distro = release_info.get('ID', '')
    release = release_info.get('VERSION_ID', '')
    codename = release_info.get('UBUNTU_CODENAME', release_info.get('VERSION', ''))
    match = re.match(r'^[^(]+ \(([^)]+)\)', codename)
    if match:
        codename = match.group(1).lower()
    if not codename and release_info.get('NAME', '') == 'openSUSE Tumbleweed':
        codename = 'tumbleweed'
    return (distro, release, codename)
368248
def view_getApplicationLogo
      return VIEW_APPLOGO if defined? VIEW_APPLOGO
      dir = "#{Rails.root}/app/assets/images/lato/"
      if File.exist?("#{dir}/logo.svg")
        return "lato/logo.svg"
      end
      if File.exist?("#{dir}/logo.png")
        return "lato/logo.png"
      end
      if File.exist?("#{dir}/logo.jpg")
        return "lato/logo.jpg"
      end
      if File.exist?("#{dir}/logo.gif")
        return "lato/logo.gif"
      end
      return false
    end
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;
    }
1042200
def extract_version_from_filename(filename):
    """"""
    filename = os.path.splitext(os.path.basename(filename))[0]
    if filename.endswith('.tar'):
        filename = os.path.splitext(filename)[0]
    return filename.partition('-')[2]
611352
def filename(self):
        """"""
        if self.value and 'value' in self._json_data and self._json_data['value']:
            return self._json_data['value'].split('/')[-1]
        return None
1342189
def _get_archive_name(self, archname=None):
        '''
        
        '''
        archname = re.sub('[^a-z0-9]', '', (archname or '').lower()) or 'support'
        for grain in ['fqdn', 'host', 'localhost', 'nodename']:
            host = __grains__.get(grain)
            if host:
                break
        if not host:
            host = 'localhost'

        return os.path.join(tempfile.gettempdir(),
                            '{hostname}-{archname}-{date}-{time}.bz2'.format(archname=archname,
                                                                             hostname=host,
                                                                             date=time.strftime('%Y%m%d'),
                                                                             time=time.strftime('%H%M%S')))
998512
private String getFileName(String name) {
        //check if the environment is linux or windows
        if (name.contains(Constants.FORWARD_SLASH)) {
            name = name.substring(name.lastIndexOf(Constants.FORWARD_SLASH) + 1, name.length());
        } else if (name.contains(Constants.BACK_SLASH)) {
            name = name.substring(name.lastIndexOf(Constants.BACK_SLASH) + 1, name.length());
        }
        return name;
    }
66612
def fsroot(self):
        """"""
        if self.osname == 'windows':
            return '{}:\\'.format(
                self._handler.inspect_get_drive_mappings(self._root)[0][0])
        else:
            return self._handler.inspect_get_mountpoints(self._root)[0][0]
667412
@Pure
	public static String getExecutableFilename(String name) {
		if (OperatingSystem.WIN.isCurrentOS()) {
			return name + ".exe"; //$NON-NLS-1$
		}
		return name;
	}
817672
def get_distribution_path(catalog_id, dataset_id, distribution_id,
                          distribution_file_name, catalogs_dir=CATALOGS_DIR,
                          use_short_path=False):
    """"""
    if use_short_path:
        distribution_dir = get_distribution_dir(
            catalog_id, dataset_id, distribution_id, catalogs_dir,
            use_short_path=True)
        distribution_file_path = os.path.join(
            distribution_dir, distribution_file_name)
    else:
        distribution_dir = get_distribution_dir(
            catalog_id, dataset_id, distribution_id, catalogs_dir,
            use_short_path=False)
        distribution_file_path = os.path.join(
            distribution_dir, "download", distribution_file_name)

    return os.path.abspath(distribution_file_path)
20124
def extract_file_name(content_dispo):
    """"""
    # print type(content_dispo)
    # print repr(content_dispo)
    # convertion of escape string (str type) from server
    # to unicode object
    content_dispo = content_dispo.decode('unicode-escape').strip('"')
    file_name = ""
    for key_val in content_dispo.split(';'):
        param = key_val.strip().split('=')
        if param[0] == "filename":
            file_name = param[1].strip('"')
            break
    return file_name
697596
def name(self):
        ''''''
        if self.mako_template.filename:
            return os.path.basename(self.mako_template.filename)
        return 'string'