MCPcopy Create free account
hub / github.com/alibaba/GraphScope / as_default

Method as_default

python/graphscope/client/session.py:803–821  ·  view source on GitHub ↗

Obtain a context manager that make this object as default session. This method is used when a Session is constructed, which will immediately install self as a default session. Raises: ValueError: If default session exist in current context. Returns:

(self)

Source from the content-addressed store, hash-verified

801 pass
802
803 def as_default(self):
804 """Obtain a context manager that make this object as default session.
805
806 This method is used when a Session is constructed, which will immediately
807 install self as a default session.
808
809 Raises:
810 ValueError: If default session exist in current context.
811
812 Returns:
813 A context manager using this session as the default session.
814 """
815 if not _default_session_stack.is_cleared():
816 raise ValueError(
817 "A default session is already active. You must explicitly call Session.close()."
818 )
819 # session context manager
820 self._default_session = default_session(self)
821 self._default_session.__enter__()
822
823 def _unregister_default(self):
824 """Remove self from the default session stack."""

Callers 7

__enter__Method · 0.95
get_defaultMethod · 0.80
test_minimum_networkxFunction · 0.80
test_mars_sessionFunction · 0.80
sessFunction · 0.80
test_border_casesFunction · 0.80
graphscope_sessionFunction · 0.80

Calls 3

default_sessionFunction · 0.85
is_clearedMethod · 0.80
__enter__Method · 0.45

Tested by 5

test_minimum_networkxFunction · 0.64
test_mars_sessionFunction · 0.64
sessFunction · 0.64
test_border_casesFunction · 0.64
graphscope_sessionFunction · 0.64