Get all the associations for this env.

        Root cannot have associations, so return None for root.

        returns a map of hostnames to environments.
765402
def get_associations(self, env):
        

        if env.is_root:
            return None

        associations = self.associations.get_all()
        return [assoc for assoc in associations
                if associations[assoc] == self._get_view_path(env)]
1197029
def to_env_vars(self):
        

        env = {
            'hosts': self.hosts, 'network_interface_name': self.network_interface_name,
            'hps': self.hyperparameters, 'user_entry_point': self.user_entry_point,
            'framework_params': self.additional_framework_parameters,
            'resource_config': self.resource_config, 'input_data_config': self.input_data_config,
            'output_data_dir': self.output_data_dir,
            'channels': sorted(self.channel_input_dirs.keys()),
            'current_host': self.current_host, 'module_name': self.module_name,
            'log_level': self.log_level,
            'framework_module': self.framework_module, 'input_dir': self.input_dir,
            'input_config_dir': self.input_config_dir, 'output_dir': self.output_dir,
            'num_cpus': self.num_cpus,
            'num_gpus': self.num_gpus, 'model_dir': self.model_dir, 'module_dir': self.module_dir,
            'training_env': dict(self), 'user_args': self.to_cmd_args(),
            'output_intermediate_dir': self.output_intermediate_dir
        }

        for name, path in self.channel_input_dirs.items():
            env['channel_%s' % name] = path

        for key, value in self.hyperparameters.items():
            env['hp_%s' % key] = value

        return _mapping.to_env_vars(env)
139743
def lists_from_env(key, default=""):
    
    try:
        val = os.environ.get(key, default)
        lists = val.split(":")
        return [i.split(',') for i in lists]
    except (KeyError, ValueError):
        return []
770283
def _include_paths_from_environ(env_prefix=''):
    """"""
    paths = os.environ.get(env_prefix + 'WSGI_AUTH_PATHS')
    if not paths:
        return []
    return paths.split(';')
587023
def get_environments():
    """"""
    envs = []
    for root, subfolders, files in os.walk('environments'):
        for filename in files:
            if filename.endswith(".json"):
                path = os.path.join(
                    root[len('environments'):], filename[:-len('.json')])
                envs.append(get_environment(path))
    return sorted(envs, key=lambda x: x['name'])
882293
def auth(self):
        
        return self.values.get(Config.AUTH, os.environ.get(AUTH_ENV_KEY_NAME, None))
846960
def get_all_hosts(resource_root, view=None):
  
  return call(resource_root.get, HOSTS_PATH, ApiHost, True,
          params=view and dict(view=view) or None)
925690
def get_mappings_in_network(network_id, network_2_id=None, **kwargs):
    
    qry = db.DBSession.query(ResourceAttrMap).filter(or_(ResourceAttrMap.network_a_id == network_id, ResourceAttrMap.network_b_id == network_id))

    if network_2_id is not None:
        qry = qry.filter(or_(ResourceAttrMap.network_a_id==network_2_id, ResourceAttrMap.network_b_id==network_2_id))

    return qry.all()
414638
def GetClientURNsForHostnames(hostnames, token=None):
  

  if data_store.RelationalDBEnabled():
    index = ClientIndex()
  else:
    index = CreateClientIndex(token=token)

  keywords = set()
  for hostname in hostnames:
    if hostname.startswith("host:"):
      keywords.add(hostname)
    else:
      keywords.add("host:%s" % hostname)
  results = index.ReadClientPostingLists(keywords)

  result = {}
  for keyword, hits in iteritems(results):
    result[keyword[len("host:"):]] = hits
  return result
1360290
def get_config(self, hostname):
        
        version, config = self._get(
            self.associations.get(hostname)
        )
        return config
978025
def list(self, environment_vip=None):
        

        uri = 'api/networkv6/?'
        if environment_vip:
            uri += 'environment_vip=%s' % environment_vip

        return super(ApiNetworkIPv6, self).get(uri)
939721
def get_current_roles():
    
    current_host = env.host_string
    roledefs = env.get('roledefs')
    if roledefs:
        return [role for role, hosts in six.iteritems(roledefs) if current_host in hosts]
    return []
1127795
def get_env():
    
    env = os.getenv('ENV', os.getenv('env', None))
    if env:
        env = env.lower()
    return env
1126412
def jinja_env(self) -> Environment:
        """"""
        if self._jinja_env is None:
            self._jinja_env = self.create_jinja_environment()
        return self._jinja_env
429218
def get_hosts(self):
        
        limited_hosts = {}
        if self.limit is not None:
            # Find hosts and groups of hosts to include
            for include in self.limit['include']:
                # Include whole group
                for hostname in self.hosts_in_group(include):
                    limited_hosts[hostname] = self.hosts[hostname]
                # Include individual host
                if include in self.hosts:
                    limited_hosts[include] = self.hosts[include]
            # Find hosts and groups of hosts to exclude
            for exclude in self.limit["exclude"]:
                # Exclude whole group
                for hostname in self.hosts_in_group(exclude):
                    if hostname in limited_hosts:
                        limited_hosts.pop(hostname)
                # Exclude individual host
                if exclude in limited_hosts:
                    limited_hosts.pop(exclude)

            return limited_hosts
        else:
            # Return all hosts
            return self.hosts
1183835
def envs(self):
        '''
        
        '''
        ref_paths = [x.path for x in self.repo.refs]
        return self._get_envs_from_ref_paths(ref_paths)
1097491
def list_roots():
    '''
    
    '''
    ret = {}
    for saltenv in __opts__['pillar_roots']:
        ret[saltenv] = []
        ret[saltenv].append(list_env(saltenv))
    return ret