This function returns a list of Site object.
504425
def get_forecast_sites(self):
        

        time_now = time()
        if (time_now - self.forecast_sites_last_update) > self.forecast_sites_update_time or self.forecast_sites_last_request is None:

            data = self.__call_api("sitelist/")
            sites = list()
            for jsoned in data['Locations']['Location']:
                site = Site()
                site.name = jsoned['name']
                site.id = jsoned['id']
                site.latitude = jsoned['latitude']
                site.longitude = jsoned['longitude']

                if 'region' in jsoned:
                    site.region = jsoned['region']

                if 'elevation' in jsoned:
                    site.elevation = jsoned['elevation']

                if 'unitaryAuthArea' in jsoned:
                    site.unitaryAuthArea = jsoned['unitaryAuthArea']

                if 'nationalPark' in jsoned:
                    site.nationalPark = jsoned['nationalPark']

                site.api_key = self.api_key

                sites.append(site)
            self.forecast_sites_last_request = sites
            # Only set self.sites_last_update once self.sites_last_request has
            # been set
            self.forecast_sites_last_update = time_now
        else:
            sites = self.forecast_sites_last_request

        return sites
644186
def clusters_sites_obj(clusters):
    
    result = {}
    all_clusters = get_all_clusters_sites()
    clusters_sites = {c: s for (c, s) in all_clusters.items()
                        if c in clusters}
    for cluster, site in clusters_sites.items():

        # here we want the site python-grid5000 site object
        result.update({cluster: get_site_obj(site)})
    return result
55585
def _site_users():
    
    userlist = sudo("cat /etc/passwd | awk '/site/'").split('\n')
    siteuserlist = [user.split(':')[0] for user in userlist if 'site_' in user]
    return siteuserlist
269563
def _get_site_class(self, sites):
        
        siteclass = sites.siteclass
        S = np.zeros_like(siteclass, dtype=np.float)
        S[(siteclass == b'C') | (siteclass == b'D')] = 1

        return S
366116
def pages(site_id):
    """"""
    start = int(flask.request.args.get("start", 0))
    end = int(flask.request.args.get("end", start + 90))
    reql = rr.table("pages").between(
            [site_id, 1, r.minval], [site_id, r.maxval, r.maxval],
            index="least_hops").order_by(index="least_hops")[start:end]
    logging.debug("querying rethinkdb: %s", reql)
    pages_ = reql.run()
    return flask.jsonify(pages=list(pages_))
914819
public function getSiteProperties() {

		if( !isset( $this->siteProperties ) ) {

			$this->siteProperties = SiteProperties::getInstance();
		}

		return $this->siteProperties;
	}
560823
def list_sites
      r = execute(make_xml('SiteListingRequest'))
      arr = []
      if r.success
        r.res.elements.each('SiteListingResponse/SiteSummary') do |site|
          arr << SiteSummary.new(site.attributes['id'].to_i,
                                 site.attributes['name'],
                                 site.attributes['description'],
                                 site.attributes['riskfactor'].to_f,
                                 site.attributes['riskscore'].to_f)
        end
      end
      arr
    end
1232460
def get_pmeshes(self, sites, permutation=None):
        
        pmeshes = []
        # _vertices = [site.coords for site in sites]
        if permutation is None:
            _vertices = [site.coords for site in sites]
        else:
            _vertices = [sites[ii].coords for ii in permutation]
        _face_centers = []
        number_of_faces = 0
        for face in self._faces:
            if len(face) in [3, 4]:
                number_of_faces += 1
            else:
                number_of_faces += len(face)

            _face_centers.append(np.array([np.mean([_vertices[face_vertex][ii]
                                                    for face_vertex in face])
                                           for ii in range(3)]))

        out = '{}\n'.format(len(_vertices) + len(_face_centers))
        for vv in _vertices:
            out += '{:15.8f} {:15.8f} {:15.8f}\n'.format(vv[0], vv[1], vv[2])
        for fc in _face_centers:
            out += '{:15.8f} {:15.8f} {:15.8f}\n'.format(fc[0], fc[1], fc[2])
        out += '{:d}\n'.format(number_of_faces)
        for iface, face in enumerate(self._faces):
            if len(face) == 3:
                out += '4\n'
            elif len(face) == 4:
                out += '5\n'
            else:
                for ii in range(len(face)):
                    out += '4\n'
                    out += '{:d}\n'.format(len(_vertices) + iface)
                    out += '{:d}\n'.format(face[ii])
                    out += '{:d}\n'.format(face[np.mod(ii + 1, len(face))])
                    out += '{:d}\n'.format(len(_vertices) + iface)
            if len(face) in [3, 4]:
                for face_vertex in face:
                    out += '{:d}\n'.format(face_vertex)
                out += '{:d}\n'.format(face[0])
        pmeshes.append({"pmesh_string": out})
        return pmeshes
187436
private function getSitesFromIds($idSites, $limit = false)
    {
        $sites = $this->getModel()->getSitesFromIds($idSites, $limit);

        foreach ($sites as &$site) {
            $this->enrichSite($site);
        }

        $sites = Site::setSitesFromArray($sites);

        return $sites;
    }
304885
public static function getSiteRolesForSite($nb_site) : CNabuSiteRoleList
    {
        if (is_numeric($nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID))) {
            $retval = CNabuSiteRole::buildObjectListFromSQL(
                'nb_role_id',
                'select * '
                . 'from nb_site_role '
               . 'where nb_site_id=%site_id$d',
                array(
                    'site_id' => $nb_site_id
                )
            );
            if ($nb_site instanceof CNabuSite) {
                $retval->iterate(function($key, CNabuSiteRole $nb_site_role) use ($nb_site) {
                    $nb_site_role->setSite($nb_site);
                    return true;
                });
            }
        } else {
            $retval = new CNabuSiteRoleList();
        }

        return $retval;
    }
724056
def get_plugins(sites=None):
    
    plugins = []
    # collect GoScale plugins
    for plugin in CMSPlugin.objects.all():
        if plugin:
            cl = plugin.get_plugin_class().model
            if 'posts' in cl._meta.get_all_field_names():
                instance = plugin.get_plugin_instance()[0]
                plugins.append(instance)
        # Filter by sites
    if sites and len(sites) > 0:
        onsite = []
        for plugin in plugins:
            try:
                if plugin.page.site in sites:
                    onsite.append(plugin)
            except AttributeError:
                continue
        return onsite
    return plugins
387369
def all(cls, domain=None):
        
        Site = cls
        site = Session.query(Site)
        if domain:
            site.filter(Site.domain == domain)
        return site.all()
410752
def get_lines(self):
        
        lines = [["{:f}".format(self._cluster[0].x),
                  "{:f}".format(self._cluster[0].y),
                  "{:f}".format(self._cluster[0].z),
                  0, self.absorbing_atom, "0.0", 0]]
        for i, site in enumerate(self._cluster[1:]):
            site_symbol = re.sub(r"[^aA-zZ]+", "", site.species_string)
            ipot = self.pot_dict[site_symbol]
            lines.append(["{:f}".format(site.x), "{:f}".format(site.y),
                          "{:f}".format(site.z), ipot, site_symbol,
                          "{:f}".format(self._cluster.get_distance(0, i + 1)), i + 1])

        return sorted(lines, key=itemgetter(5))
468643
private static SiteDomainInfo getDomainInfo(CmsSite site) {

        List<String> urls = Lists.newArrayList();
        for (CmsSiteMatcher matcher : site.getAllMatchers()) {
            urls.add(matcher.getUrl());

        }
        return getDomainInfo(urls);
    }
404277
def _get_site_class(self, sites):
        
        vs30 = sites.vs30
        S = np.zeros_like(vs30)
        S[vs30 <= 760] = 1

        return S
568445
public function getSettingList(Site $site)
    {
        $settingList = [];
        /** @var $setting \PageBuilder\Entity\Setting */
        foreach ($site->getSettings() as $setting) {
            $code               = $setting->getSettingKey()->getCode();
            $value              = $setting->getSettingValue() ?: $setting->getSettingKey()->getDefaultValue();
            $settingList[$code] = $value;
        }

        $locale                = $site->getLocale() ?: 'en_GB';
        $settingList           = array_merge($settingList, \Locale::parseLocale($locale));
        $settingList['locale'] = $locale;

        return $settingList;
    }
11749
def get_queryset(self, *args, **kwargs):
        
        qs = super(TreeManager, self).get_queryset(*args, **kwargs)

        # Restrict operations to pages on the current site if needed
        if settings.PAGES_HIDE_SITES and settings.PAGES_USE_SITE_ID:
            return qs.order_by(self.tree_id_attr, self.left_attr).filter(sites=settings.SITE_ID)
        else:
            return qs.order_by(self.tree_id_attr, self.left_attr)