Return a fully-qualified environment_session_entity_type string.
777968
def environment_session_entity_type_path(cls, project, environment, user,
                                             session, entity_type):
        """"""
        return google.api_core.path_template.expand(
            'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}',
            project=project,
            environment=environment,
            user=user,
            session=session,
            entity_type=entity_type,
        )
454248
def entity_type_to_remote(value):
        """"""
        if value in DiasporaRetraction.mapped.values():
            values = list(DiasporaRetraction.mapped.values())
            index = values.index(value)
            return list(DiasporaRetraction.mapped.keys())[index]
        return value
63842
def _session_key(self):
        """"""

        if not hasattr(self, "_cached_session_key"):
            session_id_bytes = self.get_secure_cookie("session_id")
            session_id = None

            if session_id_bytes:
                try:
                    session_id = session_id_bytes.decode('utf-8')
                except:
                    pass

            if not session_id:
                session_id = oz.redis_sessions.random_hex(20)

            session_time = oz.settings["session_time"]
            kwargs = dict(
                name="session_id",
                value=session_id.encode('utf-8'),
                domain=oz.settings.get("cookie_domain"),
                httponly=True,
            )
            if session_time:
                kwargs["expires_days"] = round(session_time/60/60/24)

            self.set_secure_cookie(**kwargs)

            password_salt = oz.settings["session_salt"]
            self._cached_session_key = "session:%s:v4" % oz.redis_sessions.password_hash(session_id, password_salt=password_salt)

        return self._cached_session_key
543310
def to_cls(self):
        """"""
        # Checks if ``to_cls`` is a string
        #   If it is, checks if the entity is imported and available
        #   If it is, register the class
        try:
            if isinstance(self._to_cls, str):
                self._to_cls = fetch_entity_cls_from_registry(self._to_cls)
        except AssertionError:
            # Preserve ``to_cls`` as a string and we will hook up the entity later
            pass

        return self._to_cls
868793
public function getSessionKey(): ?string
    {
        $cacheKey = 'sessionkey';
        if (!isset(self::$cache[$cacheKey])) {
            $cookies = Internal\Cookies::getList(Internal\Cookies::TYPE_SERVER);
            $cookieKey = '_s';
            $key = isset($cookies[$cookieKey]) ? (string) $cookies[$cookieKey] : '';
            self::$cache[$cacheKey] = strlen((string) $key) > 70 ? $key : null;
        }
        return self::$cache[$cacheKey];
    }
545590
def env_vars(self):
        """"""
        if not self.no_libfaketime:
            faketime_filename = self.service_group.hitch_dir.faketime()

            env_vars = dict(os.environ)
            env_vars.update(self._env_vars)
            env_vars.update(faketime.get_environment_vars(faketime_filename))
        else:
            env_vars = dict(os.environ)
            env_vars.update(self._env_vars)
        return env_vars
228490
def get_environment_info() -> dict:
    
    data = _environ.systems.get_system_data()
    data['cauldron'] = _environ.package_settings.copy()
    return data
987356
def type(self):
        """"""
        return ffi.string(lib.EnvGetDefmessageHandlerType(
            self._env, self._cls, self._idx)).decode()
814990
def session(connection_string=None):
    """"""
    global _session_makers
    connection_string = connection_string or oz.settings["db"]

    if not connection_string in _session_makers:
        _session_makers[connection_string] = sessionmaker(bind=engine(connection_string=connection_string))

    return _session_makers[connection_string]()
948099
def get_shutit_pexpect_session_environment(self, environment_id):
		
		if not isinstance(environment_id, str):
			self.fail('Wrong argument type in get_shutit_pexpect_session_environment') # pragma: no cover
		for env in shutit_global.shutit_global_object.shutit_pexpect_session_environments:
			if env.environment_id == environment_id:
				return env
		return None
1031313
def ns(ns):
    """"""

    def setup_ns(cls):
        setattr(cls, ENTITY_DEFAULT_NS_ATTR, ns)
        return cls

    return setup_ns
625233
def get_db_session(engine):
    ""

    db = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
    db.configure(bind=engine)
    db.autoflush = True

    return db
607059
def _get_server_type(doc):
    """"""
    if not doc.get('ok'):
        return SERVER_TYPE.Unknown

    if doc.get('isreplicaset'):
        return SERVER_TYPE.RSGhost
    elif doc.get('setName'):
        if doc.get('hidden'):
            return SERVER_TYPE.RSOther
        elif doc.get('ismaster'):
            return SERVER_TYPE.RSPrimary
        elif doc.get('secondary'):
            return SERVER_TYPE.RSSecondary
        elif doc.get('arbiterOnly'):
            return SERVER_TYPE.RSArbiter
        else:
            return SERVER_TYPE.RSOther
    elif doc.get('msg') == 'isdbgrid':
        return SERVER_TYPE.Mongos
    else:
        return SERVER_TYPE.Standalone
1065327
public static function sessionEntityTypeName($project, $session, $entityType)
    {
        return self::getSessionEntityTypeNameTemplate()->render([
            'project' => $project,
            'session' => $session,
            'entity_type' => $entityType,
        ]);
    }
1171663
def _get_java_env(self):
        ""
        env = super(_DistributedSubmitter, self)._get_java_env()
        if self._streams_connection is not None:
            # Need to sure the environment matches the connection.
            sc = self._streams_connection
            if isinstance(sc._delegator, streamsx.rest_primitives._StreamsRestDelegator):
                 env.pop('STREAMS_DOMAIN_ID', None)
                 env.pop('STREAMS_INSTANCE_ID', None)
            else:
                 env['STREAMS_DOMAIN_ID'] = sc.get_domains()[0].id
            if not ConfigParams.SERVICE_DEFINITION in self._config():
                env['STREAMS_REST_URL'] = sc.resource_url
                env['STREAMS_USERNAME'] = sc.session.auth[0]
                env['STREAMS_PASSWORD'] = sc.session.auth[1]
        return env
883591
def environment_session_path(cls, project, environment, user, session):
        """"""
        return google.api_core.path_template.expand(
            'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}',
            project=project,
            environment=environment,
            user=user,
            session=session,
        )
851615
def default_entities(self):
        """"""
        return [str(i) for i in range(self.rows + self.columns)]