Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Removed code related to default session
Browse files Browse the repository at this point in the history
  • Loading branch information
merav-aharoni committed Aug 10, 2023
1 parent d5f5fd8 commit eacbe38
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions qiskit_ibm_provider/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,33 +102,3 @@ def active(self) -> bool:
def close(self) -> None:
"""Set the session._active status to False"""
self._active = False

def __enter__(self) -> "Session":
set_cm_session(self)
return self

def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None:
set_cm_session(None)


# Default session
_DEFAULT_SESSION: ContextVar[Optional[Session]] = ContextVar(
"_DEFAULT_SESSION", default=None
)
_IN_SESSION_CM: ContextVar[bool] = ContextVar("_IN_SESSION_CM", default=False)


def set_cm_session(session: Optional[Session]) -> None:
"""Set the context manager session."""
_DEFAULT_SESSION.set(session)
_IN_SESSION_CM.set(session is not None)


def get_cm_session() -> Session:
"""Return the context managed session."""
return _DEFAULT_SESSION.get()

0 comments on commit eacbe38

Please sign in to comment.