Return site names for a modification.
193724
def get_mod_site_name(mod_condition):
    """"""
    if mod_condition.residue is None:
        mod_str = abbrevs[mod_condition.mod_type]
    else:
        mod_str = mod_condition.residue
    mod_pos = mod_condition.position if \
        mod_condition.position is not None else ''
    name = ('%s%s' % (mod_str, mod_pos))
    return name
696063
def site_param(dic):
    
    new = {}
    for name, val in dic.items():
        if name == 'vs30Type':
            # avoid "Unrecognized parameter vs30Type"
            new['vs30measured'] = val == 'measured'
        elif name not in site.site_param_dt:
            raise ValueError('Unrecognized parameter %s' % name)
        else:
            new[name] = val
    return new
512933
def extra_context(self):
        
        from django.conf import settings

        return {
            "site_name": (lambda r: settings.LEONARDO_SITE_NAME
                          if getattr(settings, 'LEONARDO_SITE_NAME', '') != ''
                          else settings.SITE_NAME),
            "debug": lambda r: settings.TEMPLATE_DEBUG
        }
383446
def list_overlay_names(self):
        """"""
        overlay_names = []
        if not os.path.isdir(self._overlays_abspath):
            return overlay_names
        for fname in os.listdir(self._overlays_abspath):
            name, ext = os.path.splitext(fname)
            overlay_names.append(name)
        return overlay_names
217797
function(sites) {

  // Map into a choices array
  var choices = [];
  _.map(sites, function(val, key) {
    if (!_.isEmpty(val)) {
      choices.push({
        name: val.site.name,
        value: val.site.name,
        id: val.site.name,
        uuid: val.site.id || key,
        php: val.site.php_version,
        upstream: val.site.upstream,
        framework: val.site.framework,
        drush: val.site.drush_version || 7
      });
    }
  });

  // Sort nicely by name and return
  return _.sortBy(choices, 'name');

}
1099902
function getSiteFromPrefix(prefix) {
  var split = prefix.split('/'), // Split the url/uri by `/`
    host = split.shift(),        // The first value should be the host ('http://' is not included)
    optPath = split.shift(),  // The next value is the first part of the site's path OR the whole part
    path = optPath ? `/${optPath}` : '',
    length = split.length + 1,   // We always need at least one pass through the for loop
    site;                        // Initialize the return value to `undefined`

  for (let i = 0; i < length; i++) {
    site = getSite(host, path); // Try to get the site based on the host and path

    if (site) { // If a site was found, break out of the loop
      break;
    } else {
      path += `/${split.shift()}`; // Grab the next value and append it to the `path` value
    }
  }

  return site; // Return the site
}
211978
def _get_files_modified():
    """"""
    cmd = "git diff-index --cached --name-only --diff-filter=ACMRTUXB HEAD"
    _, files_modified, _ = run(cmd)

    extensions = [re.escape(ext) for ext in list(SUPPORTED_FILES) + [".rst"]]
    test = "(?:{0})$".format("|".join(extensions))
    return list(filter(lambda f: re.search(test, f), files_modified))
815914
def get_prefixes(self, ns_uri):
        """"""
        ni = self.__lookup_uri(ns_uri)
        return ni.prefixes.copy()
55750
def get_site_dirs():
    

    sitedirs = []

    # start with PYTHONPATH
    sitedirs.extend(_pythonpath())

    prefixes = [sys.prefix]
    if sys.exec_prefix != sys.prefix:
        prefixes.append(sys.exec_prefix)
    for prefix in prefixes:
        if prefix:
            if sys.platform in ('os2emx', 'riscos'):
                sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
            elif os.sep == '/':
                sitedirs.extend([
                    os.path.join(
                        prefix,
                        "lib",
                        "python" + sys.version[:3],
                        "site-packages",
                    ),
                    os.path.join(prefix, "lib", "site-python"),
                ])
            else:
                sitedirs.extend([
                    prefix,
                    os.path.join(prefix, "lib", "site-packages"),
                ])
            if sys.platform == 'darwin':
                # for framework builds *only* we add the standard Apple
                # locations. Currently only per-user, but /Library and
                # /Network/Library could be added too
                if 'Python.framework' in prefix:
                    home = os.environ.get('HOME')
                    if home:
                        home_sp = os.path.join(
                            home,
                            'Library',
                            'Python',
                            sys.version[:3],
                            'site-packages',
                        )
                        sitedirs.append(home_sp)
    lib_paths = get_path('purelib'), get_path('platlib')
    for site_lib in lib_paths:
        if site_lib not in sitedirs:
            sitedirs.append(site_lib)

    if site.ENABLE_USER_SITE:
        sitedirs.append(site.USER_SITE)

    try:
        sitedirs.extend(site.getsitepackages())
    except AttributeError:
        pass

    sitedirs = list(map(normalize_path, sitedirs))

    return sitedirs
1138728
def pages(self):
        """"""
        rev = self.db.get('site:rev')
        if int(rev) != self.revision:
            self.reload_site()

        return self._pages
1135760
def get_sub_menu_template_names(self):
        
        site = self._contextual_vals.current_site
        level = self._contextual_vals.current_level
        handle = self.handle
        template_names = []
        if settings.SITE_SPECIFIC_TEMPLATE_DIRS and site:
            hostname = site.hostname
            template_names.extend([
                "menus/%s/flat/%s/level_%s.html" % (hostname, handle, level),
                "menus/%s/flat/%s/sub_menu.html" % (hostname, handle),
                "menus/%s/flat/%s_sub_menu.html" % (hostname, handle),
                "menus/%s/%s/level_%s.html" % (hostname, handle, level),
                "menus/%s/%s/sub_menu.html" % (hostname, handle),
                "menus/%s/%s_sub_menu.html" % (hostname, handle),
                "menus/%s/flat/level_%s.html" % (hostname, level),
                "menus/%s/flat/sub_menu.html" % hostname,
                "menus/%s/sub_menu.html" % hostname,
            ])
        template_names.extend([
            "menus/flat/%s/level_%s.html" % (handle, level),
            "menus/flat/%s/sub_menu.html" % handle,
            "menus/flat/%s_sub_menu.html" % handle,
            "menus/%s/level_%s.html" % (handle, level),
            "menus/%s/sub_menu.html" % handle,
            "menus/%s_sub_menu.html" % handle,
            "menus/flat/level_%s.html" % level,
            "menus/flat/sub_menu.html",
            settings.DEFAULT_SUB_MENU_TEMPLATE,
        ])
        return template_names
1280266
def get_names():
    """"""
    res = list(cmaps.keys())
    res = sorted(res, key=lambda s: s.lower())
    return res
1205206
def base_url(self):
        """"""
        if self.location in self.known_locations:
            return self.known_locations[self.location]
        elif '.' in self.location or self.location == 'localhost':
            return 'https://' + self.location
        else:
            return 'https://' + self.location + API_HOST_SUFFIX
209179
def load_site_config(name):
    """"""
    return _load_config_json(
        os.path.join(
            CONFIG_PATH,
            CONFIG_SITES_PATH,
            name + CONFIG_EXT
        )
    )
1142179
def get_urls(self):
        """"""
        urls = super(SimpleHistoryAdmin, self).get_urls()
        admin_site = self.admin_site
        opts = self.model._meta
        info = opts.app_label, opts.model_name
        history_urls = [
            url(
                "^([^/]+)/history/([^/]+)/$",
                admin_site.admin_view(self.history_form_view),
                name="%s_%s_simple_history" % info,
            )
        ]
        return history_urls + urls
293807
def get_name_locations(self, name):
        """"""
        result = []
        for module in self.names:
            if name in self.names[module]:
                try:
                    pymodule = self.project.get_module(module)
                    if name in pymodule:
                        pyname = pymodule[name]
                        module, lineno = pyname.get_definition_location()
                        if module is not None:
                            resource = module.get_module().get_resource()
                            if resource is not None and lineno is not None:
                                result.append((resource, lineno))
                except exceptions.ModuleNotFoundError:
                    pass
        return result
1047820
def _context_names():
    """"""
    import inspect

    from renku.models import provenance
    from renku.models._jsonld import JSONLDMixin

    for name in dir(provenance):
        cls = getattr(provenance, name)
        if inspect.isclass(cls) and issubclass(cls, JSONLDMixin):
            yield name