passagemath-repl 10.5.42__py3-none-any.whl → 10.6.1rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_repl-10.6.1rc1.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.6.1rc1.dist-info}/METADATA +5 -6
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.6.1rc1.dist-info}/RECORD +56 -57
- sage/all__sagemath_repl.py +0 -6
- sage/doctest/__main__.py +1 -1
- sage/doctest/control.py +30 -28
- sage/doctest/external.py +31 -27
- sage/doctest/fixtures.py +37 -11
- sage/doctest/forker.py +8 -5
- sage/doctest/parsing.py +42 -27
- sage/doctest/sources.py +10 -0
- sage/doctest/test.py +18 -5
- sage/doctest/tests/fail_and_die.rst +4 -1
- sage/doctest/util.py +15 -6
- sage/misc/banner.py +12 -4
- sage/misc/cython.py +8 -5
- sage/misc/dev_tools.py +10 -84
- sage/misc/gperftools.py +13 -14
- sage/repl/configuration.py +4 -4
- sage/repl/ipython_extension.py +12 -8
- sage/repl/ipython_kernel/install.py +1 -1
- sage/repl/ipython_kernel/widgets.py +1 -1
- sage/repl/ipython_tests.py +19 -2
- sage/repl/rich_output/backend_ipython.py +0 -1
- sage/repl/rich_output/display_manager.py +1 -1
- sage/tests/all.py +1 -0
- sage/tests/benchmark.py +6 -2
- sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +1 -1
- sage/tests/cmdline.py +6 -4
- sage/tests/startup.py +1 -1
- passagemath_repl-10.5.42.data/data/share/jupyter/kernels/sagemath/kernel.json +0 -1
- sage/interfaces/cleaner.py +0 -48
- sage/interfaces/quit.py +0 -178
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/data/share/jupyter/kernels/sagemath/logo.svg +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.6.1rc1.dist-info}/WHEEL +0 -0
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.6.1rc1.dist-info}/top_level.txt +0 -0
sage/interfaces/quit.py
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
# sage_setup: distribution = sagemath-repl
|
2
|
-
"""
|
3
|
-
Quitting interfaces
|
4
|
-
"""
|
5
|
-
|
6
|
-
################################################################################
|
7
|
-
# Copyright (C) 2010 William Stein <wstein@gmail.com>
|
8
|
-
#
|
9
|
-
# Distributed under the terms of (any version of) the GNU
|
10
|
-
# General Public License (GPL). The full text of the GPL is available at:
|
11
|
-
#
|
12
|
-
# https://www.gnu.org/licenses/
|
13
|
-
################################################################################
|
14
|
-
|
15
|
-
from __future__ import annotations
|
16
|
-
|
17
|
-
import os
|
18
|
-
import subprocess
|
19
|
-
import sys
|
20
|
-
from typing import TYPE_CHECKING
|
21
|
-
|
22
|
-
from sage.env import DOT_SAGE, HOSTNAME
|
23
|
-
from sage.misc.cachefunc import cached_function
|
24
|
-
|
25
|
-
if TYPE_CHECKING:
|
26
|
-
from weakref import ReferenceType
|
27
|
-
|
28
|
-
from sage.interfaces.expect import Expect
|
29
|
-
|
30
|
-
|
31
|
-
@cached_function
|
32
|
-
def sage_spawned_process_file() -> str:
|
33
|
-
"""
|
34
|
-
EXAMPLES::
|
35
|
-
|
36
|
-
sage: from sage.interfaces.quit import sage_spawned_process_file
|
37
|
-
sage: len(sage_spawned_process_file()) > 1
|
38
|
-
True
|
39
|
-
"""
|
40
|
-
# This is the old value of SAGE_TMP. Until sage-cleaner is
|
41
|
-
# completely removed, we need to leave these spawned_processes
|
42
|
-
# files where sage-cleaner will look for them.
|
43
|
-
d = os.path.join(DOT_SAGE, "temp", HOSTNAME, str(os.getpid()))
|
44
|
-
os.makedirs(d, exist_ok=True)
|
45
|
-
return os.path.join(d, "spawned_processes")
|
46
|
-
|
47
|
-
|
48
|
-
def register_spawned_process(pid: int, cmd: str = "") -> None:
|
49
|
-
"""
|
50
|
-
Write a line to the ``spawned_processes`` file with the given
|
51
|
-
``pid`` and ``cmd``.
|
52
|
-
"""
|
53
|
-
if cmd != "":
|
54
|
-
cmd = cmd.strip().split()[0]
|
55
|
-
# This is safe, since only this process writes to this file.
|
56
|
-
try:
|
57
|
-
with open(sage_spawned_process_file(), "a") as file:
|
58
|
-
file.write("%s %s\n" % (pid, cmd))
|
59
|
-
except OSError:
|
60
|
-
pass
|
61
|
-
else:
|
62
|
-
# If sage is being used as a python library, we need to launch
|
63
|
-
# the cleaner ourselves upon being told that there will be
|
64
|
-
# something to clean.
|
65
|
-
from sage.interfaces.cleaner import start_cleaner
|
66
|
-
|
67
|
-
start_cleaner()
|
68
|
-
|
69
|
-
|
70
|
-
expect_objects: list[ReferenceType[Expect]] = []
|
71
|
-
|
72
|
-
|
73
|
-
def expect_quitall(verbose: bool = False) -> None:
|
74
|
-
"""
|
75
|
-
EXAMPLES::
|
76
|
-
|
77
|
-
sage: sage.interfaces.quit.expect_quitall()
|
78
|
-
sage: gp.eval('a=10') # needs sage.libs.pari
|
79
|
-
'10'
|
80
|
-
sage: gp('a') # needs sage.libs.pari
|
81
|
-
10
|
82
|
-
sage: sage.interfaces.quit.expect_quitall()
|
83
|
-
sage: gp('a') # needs sage.libs.pari
|
84
|
-
a
|
85
|
-
sage: sage.interfaces.quit.expect_quitall(verbose=True) # needs sage.libs.pari
|
86
|
-
Exiting PARI/GP interpreter with PID ... running .../gp --fast --emacs --quiet --stacksize 10000000
|
87
|
-
"""
|
88
|
-
for reference in expect_objects:
|
89
|
-
process = reference()
|
90
|
-
if process is not None:
|
91
|
-
try:
|
92
|
-
process.quit(verbose=verbose)
|
93
|
-
except RuntimeError:
|
94
|
-
pass
|
95
|
-
kill_spawned_jobs()
|
96
|
-
|
97
|
-
|
98
|
-
def kill_spawned_jobs(verbose: bool = False):
|
99
|
-
"""
|
100
|
-
INPUT:
|
101
|
-
|
102
|
-
- ``verbose`` -- boolean (default: ``False``); if ``True``, display a
|
103
|
-
message each time a process is sent a kill signal
|
104
|
-
|
105
|
-
EXAMPLES::
|
106
|
-
|
107
|
-
sage: gp.eval('a=10') # needs sage.libs.pari
|
108
|
-
'10'
|
109
|
-
sage: sage.interfaces.quit.kill_spawned_jobs(verbose=False)
|
110
|
-
sage: sage.interfaces.quit.expect_quitall()
|
111
|
-
sage: gp.eval('a=10') # needs sage.libs.pari
|
112
|
-
'10'
|
113
|
-
sage: sage.interfaces.quit.kill_spawned_jobs(verbose=True) # needs sage.libs.pari
|
114
|
-
Killing spawned job ...
|
115
|
-
|
116
|
-
After doing the above, we do the following to avoid confusion in other doctests::
|
117
|
-
|
118
|
-
sage: sage.interfaces.quit.expect_quitall()
|
119
|
-
"""
|
120
|
-
fname = sage_spawned_process_file()
|
121
|
-
if not os.path.exists(fname):
|
122
|
-
return
|
123
|
-
|
124
|
-
with open(fname) as file:
|
125
|
-
for line in file:
|
126
|
-
i = line.find(" ")
|
127
|
-
pid = line[:i].strip()
|
128
|
-
try:
|
129
|
-
if verbose:
|
130
|
-
print("Killing spawned job %s" % pid)
|
131
|
-
if sys.platform == "win32":
|
132
|
-
# From https://stackoverflow.com/a/47756757/873661
|
133
|
-
subprocess.call(["taskkill", "/F", "/T", "/PID", pid])
|
134
|
-
else:
|
135
|
-
os.killpg(int(pid), 9)
|
136
|
-
except OSError:
|
137
|
-
pass
|
138
|
-
|
139
|
-
|
140
|
-
def is_running(pid: int) -> bool:
|
141
|
-
"""
|
142
|
-
Return ``True`` if and only if there is a process with id pid running.
|
143
|
-
"""
|
144
|
-
try:
|
145
|
-
os.kill(int(pid), 0)
|
146
|
-
return True
|
147
|
-
except (OSError, ValueError):
|
148
|
-
return False
|
149
|
-
|
150
|
-
|
151
|
-
def invalidate_all() -> None:
|
152
|
-
"""
|
153
|
-
Invalidate all of the expect interfaces.
|
154
|
-
|
155
|
-
This is used, e.g., by the fork-based ``@parallel`` decorator.
|
156
|
-
|
157
|
-
EXAMPLES::
|
158
|
-
|
159
|
-
sage: # needs sage.libs.pari sage.symbolic
|
160
|
-
sage: a = maxima(2); b = gp(3)
|
161
|
-
sage: a, b
|
162
|
-
(2, 3)
|
163
|
-
sage: sage.interfaces.quit.invalidate_all()
|
164
|
-
sage: a
|
165
|
-
(invalid Maxima object -- The maxima session in which this object was defined is no longer running.)
|
166
|
-
sage: b
|
167
|
-
(invalid PARI/GP interpreter object -- The pari session in which this object was defined is no longer running.)
|
168
|
-
|
169
|
-
However the maxima and gp sessions should still work out, though with their state reset::
|
170
|
-
|
171
|
-
sage: a = maxima(2); b = gp(3) # needs sage.libs.pari sage.symbolic
|
172
|
-
sage: a, b # needs sage.libs.pari sage.symbolic
|
173
|
-
(2, 3)
|
174
|
-
"""
|
175
|
-
for reference in expect_objects:
|
176
|
-
process = reference()
|
177
|
-
if process:
|
178
|
-
process.detach()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-inline-fortran
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{passagemath_repl-10.5.42.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-startuptime.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|