This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'public/build/startupWarning' of git://trac.sagemath.org…
…/sage into public/refactoring/pytest
- Loading branch information
Showing
4 changed files
with
33 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from contextlib import contextmanager | ||
|
||
IS_STARTUP: bool = False | ||
|
||
@contextmanager | ||
def startup(): | ||
""" | ||
Simple context manager to indicate whether Sage is currently starting, | ||
e.g. importing `sage.all` etc. | ||
EXAMPLES:: | ||
sage: import sage.misc.startup_guard as startup_guard | ||
sage: print(startup_guard.IS_STARTUP) | ||
False | ||
sage: with startup_guard.startup(): | ||
sage: print(startup_guard.IS_STARTUP) | ||
True | ||
sage: print(startup_guard.IS_STARTUP) | ||
False | ||
""" | ||
global IS_STARTUP | ||
IS_STARTUP = True | ||
yield | ||
IS_STARTUP = False |