passagemath-standard-no-symbolics 10.6.45__cp313-cp313-macosx_13_0_arm64.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.
Files changed (83) hide show
  1. passagemath_standard_no_symbolics/__init__.py +1 -0
  2. passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-grep +5 -0
  3. passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-grepdoc +5 -0
  4. passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-list-packages +103 -0
  5. passagemath_standard_no_symbolics-10.6.45.dist-info/METADATA +150 -0
  6. passagemath_standard_no_symbolics-10.6.45.dist-info/RECORD +83 -0
  7. passagemath_standard_no_symbolics-10.6.45.dist-info/WHEEL +6 -0
  8. passagemath_standard_no_symbolics-10.6.45.dist-info/top_level.txt +2 -0
  9. sage/all.py +207 -0
  10. sage/all_cmdline.py +36 -0
  11. sage/cli/__init__.py +61 -0
  12. sage/cli/__main__.py +5 -0
  13. sage/cli/eval_cmd.py +45 -0
  14. sage/cli/eval_cmd_test.py +25 -0
  15. sage/cli/interactive_shell_cmd.py +28 -0
  16. sage/cli/notebook_cmd.py +51 -0
  17. sage/cli/notebook_cmd_test.py +39 -0
  18. sage/cli/options.py +26 -0
  19. sage/cli/run_file_cmd.py +50 -0
  20. sage/cli/version_cmd.py +26 -0
  21. sage/databases/all.py +83 -0
  22. sage/databases/cubic_hecke_db.py +1527 -0
  23. sage/dynamics/all.py +31 -0
  24. sage/dynamics/surface_dynamics_deprecation.py +32 -0
  25. sage/ext_data/kenzo/CP2.txt +45 -0
  26. sage/ext_data/kenzo/CP3.txt +349 -0
  27. sage/ext_data/kenzo/CP4.txt +4774 -0
  28. sage/ext_data/kenzo/README.txt +49 -0
  29. sage/ext_data/kenzo/S4.txt +20 -0
  30. sage/ext_data/mwrank/PRIMES +1 -0
  31. sage/ext_data/nbconvert/postprocess.py +48 -0
  32. sage/ext_data/nbconvert/rst_sage.tpl +99 -0
  33. sage/ext_data/nodoctest +0 -0
  34. sage/ext_data/notebook-ipython/kernel.json.in +11 -0
  35. sage/ext_data/notebook-ipython/logo-64x64.png +0 -0
  36. sage/ext_data/notebook-ipython/logo.svg +352 -0
  37. sage/ext_data/valgrind/pyalloc.supp +58 -0
  38. sage/ext_data/valgrind/sage-additional.supp +417 -0
  39. sage/ext_data/valgrind/sage.supp +43 -0
  40. sage/ext_data/valgrind/valgrind-python.supp +480 -0
  41. sage/geometry/all.py +12 -0
  42. sage/groups/matrix_gps/pickling_overrides.py +110 -0
  43. sage/homology/tests.py +66 -0
  44. sage/interacts/algebra.py +20 -0
  45. sage/interacts/all.py +25 -0
  46. sage/interacts/calculus.py +24 -0
  47. sage/interacts/fractals.py +18 -0
  48. sage/interacts/geometry.py +19 -0
  49. sage/interacts/library.py +1950 -0
  50. sage/interacts/library_cython.cpython-313-darwin.so +0 -0
  51. sage/interacts/statistics.py +19 -0
  52. sage/interfaces/axiom.py +1002 -0
  53. sage/interfaces/kash.py +834 -0
  54. sage/interfaces/lie.py +950 -0
  55. sage/interfaces/matlab.py +413 -0
  56. sage/interfaces/mupad.py +686 -0
  57. sage/interfaces/octave.py +858 -0
  58. sage/interfaces/phc.py +943 -0
  59. sage/interfaces/psage.py +189 -0
  60. sage/interfaces/qsieve.py +4 -0
  61. sage/interfaces/r.py +2096 -0
  62. sage/interfaces/read_data.py +46 -0
  63. sage/interfaces/scilab.py +576 -0
  64. sage/interfaces/tests.py +81 -0
  65. sage/libs/all.py +11 -0
  66. sage/libs/cremona/__init__.py +0 -0
  67. sage/libs/mwrank/__init__.py +0 -0
  68. sage/logic/all.py +3 -0
  69. sage/logic/booleval.py +160 -0
  70. sage/logic/boolformula.py +1490 -0
  71. sage/logic/logic.py +856 -0
  72. sage/logic/logicparser.py +696 -0
  73. sage/logic/logictable.py +272 -0
  74. sage/logic/propcalc.py +311 -0
  75. sage/misc/all.py +28 -0
  76. sage/misc/lazy_attribute.pyi +11 -0
  77. sage/rings/all.py +48 -0
  78. sage/rings/commutative_algebra.py +38 -0
  79. sage/rings/finite_rings/all.py +21 -0
  80. sage/rings/numbers_abc.py +58 -0
  81. sage/rings/polynomial/all.py +22 -0
  82. sage/rings/polynomial/convolution.py +421 -0
  83. sage/symbolic/all__sagemath_standard_no_symbolics.py +0 -0
@@ -0,0 +1,189 @@
1
+ r"""
2
+ Parallel Interface to the Sage interpreter
3
+
4
+ This is an expect interface to \emph{multiple} copy of the \sage
5
+ interpreter, which can all run simultaneous calculations. A PSage
6
+ object does not work as well as the usual Sage object, but does have
7
+ the great property that when you construct an object in a PSage you
8
+ get back a prompt immediately. All objects constructed for that
9
+ PSage print <<currently executing code>> until code execution
10
+ completes, when they print as normal.
11
+
12
+ \note{BUG -- currently non-idle PSage subprocesses do not stop when
13
+ \sage exits. I would very much like to fix this but don't know how.}
14
+
15
+ EXAMPLES:
16
+
17
+ We illustrate how to factor 3 integers in parallel.
18
+ First start up 3 parallel Sage interfaces::
19
+
20
+ sage: v = [PSage() for _ in range(3)]
21
+
22
+ Next, request factorization of one random integer in each copy. ::
23
+
24
+ sage: w = [x('factor(2^%s-1)'% randint(250,310)) for x in v] # long time (5s on sage.math, 2011)
25
+
26
+ Print the status::
27
+
28
+ sage: w # long time, random output (depends on timing)
29
+ [3 * 11 * 31^2 * 311 * 11161 * 11471 * 73471 * 715827883 * 2147483647 * 4649919401 * 18158209813151 * 5947603221397891 * 29126056043168521,
30
+ <<currently executing code>>,
31
+ 9623 * 68492481833 * 23579543011798993222850893929565870383844167873851502677311057483194673]
32
+
33
+ Note that at the point when we printed two of the factorizations had
34
+ finished but a third one hadn't. A few seconds later all three have
35
+ finished::
36
+
37
+ sage: w # long time, random output
38
+ [3 * 11 * 31^2 * 311 * 11161 * 11471 * 73471 * 715827883 * 2147483647 * 4649919401 * 18158209813151 * 5947603221397891 * 29126056043168521,
39
+ 23^2 * 47 * 89 * 178481 * 4103188409 * 199957736328435366769577 * 44667711762797798403039426178361,
40
+ 9623 * 68492481833 * 23579543011798993222850893929565870383844167873851502677311057483194673]
41
+ """
42
+
43
+ import os
44
+ import time
45
+
46
+ from .sage0 import Sage, SageElement
47
+ from pexpect import ExceptionPexpect
48
+
49
+ number = 0
50
+
51
+
52
+ class PSage(Sage):
53
+ def __init__(self, **kwds):
54
+ if 'server' in kwds:
55
+ raise NotImplementedError("PSage doesn't work on remote server yet.")
56
+ Sage.__init__(self, **kwds)
57
+ import sage.misc.misc
58
+ T = sage.misc.temporary_file.tmp_dir('sage_smp')
59
+ self.__tmp_dir = T
60
+ self.__tmp = '%s/lock' % T
61
+ self._unlock()
62
+ self._unlock_code = "with open('%s', 'w') as f: f.write('__unlocked__')" % self.__tmp
63
+
64
+ global number
65
+ self._number = number
66
+ number += 1
67
+
68
+ def _repr_(self):
69
+ """
70
+ TESTS::
71
+
72
+ sage: from sage.interfaces.psage import PSage
73
+ sage: PSage() # indirect doctest
74
+ A running non-blocking (parallel) instance of Sage (number ...)
75
+ """
76
+ return 'A running non-blocking (parallel) instance of Sage (number %s)' % (self._number)
77
+
78
+ def _unlock(self):
79
+ self._locked = False
80
+ with open(self.__tmp, 'w') as fobj:
81
+ fobj.write('__unlocked__')
82
+
83
+ def _lock(self):
84
+ self._locked = True
85
+ with open(self.__tmp, 'w') as fobj:
86
+ fobj.write('__locked__')
87
+
88
+ def _start(self):
89
+ Sage._start(self)
90
+ self.expect().timeout = 0.25
91
+ self.expect().delaybeforesend = 0.01
92
+
93
+ def is_locked(self) -> bool:
94
+ try:
95
+ with open(self.__tmp) as fobj:
96
+ if fobj.read() != '__locked__':
97
+ return False
98
+ except FileNotFoundError:
99
+ # Directory may have already been deleted :issue:`30730`
100
+ return False
101
+ # looks like we are locked, but check health first
102
+ try:
103
+ self.expect().expect(self._prompt)
104
+ self.expect().expect(self._prompt)
105
+ except ExceptionPexpect:
106
+ return False
107
+ return True
108
+
109
+ def __del__(self):
110
+ """
111
+ TESTS:
112
+
113
+ Check that :issue:`29989` is fixed::
114
+
115
+ sage: PSage().__del__()
116
+ """
117
+ try:
118
+ files = os.listdir(self.__tmp_dir)
119
+ for x in files:
120
+ os.remove(os.path.join(self.__tmp_dir, x))
121
+ os.removedirs(self.__tmp_dir)
122
+ except OSError:
123
+ pass
124
+
125
+ if self._expect is not None:
126
+ cmd = 'kill -9 %s' % self._expect.pid
127
+ os.system(cmd)
128
+
129
+ def eval(self, x, strip=True, **kwds):
130
+ """
131
+ INPUT:
132
+
133
+ - ``x`` -- code
134
+ - ``strip`` --ignored
135
+ """
136
+ if self.is_locked():
137
+ return "<<currently executing code>>"
138
+ if self._locked:
139
+ self._locked = False
140
+ # self._expect.expect('__unlocked__')
141
+ self.expect().send('\n')
142
+ self.expect().expect(self._prompt)
143
+ self.expect().expect(self._prompt)
144
+ try:
145
+ return Sage.eval(self, x, **kwds)
146
+ except ExceptionPexpect:
147
+ return "<<currently executing code>>"
148
+
149
+ def get(self, var):
150
+ """
151
+ Get the value of the variable var.
152
+ """
153
+ try:
154
+ return self.eval('print(%s)' % var)
155
+ except ExceptionPexpect:
156
+ return "<<currently executing code>>"
157
+
158
+ def set(self, var, value):
159
+ """
160
+ Set the variable var to the given value.
161
+ """
162
+ cmd = '%s=%s' % (var, value)
163
+ self._send_nowait(cmd)
164
+ time.sleep(0.02)
165
+
166
+ def _send_nowait(self, x):
167
+ if x.find('\n') != -1:
168
+ raise ValueError("x must not have any newlines")
169
+ # Now we want the client Python process to execute two things.
170
+ # The first is x and the second is c. The effect of c
171
+ # will be to unlock the lock.
172
+ if self.is_locked():
173
+ return "<<currently executing code>>"
174
+ E = self.expect()
175
+ self._lock()
176
+ E.write(self.preparse(x) + '\n')
177
+ try:
178
+ E.expect(self._prompt)
179
+ except ExceptionPexpect:
180
+ pass
181
+ E.write(self._unlock_code + '\n\n')
182
+
183
+ def _object_class(self):
184
+ return PSageElement
185
+
186
+
187
+ class PSageElement(SageElement):
188
+ def is_locked(self):
189
+ return self.parent().is_locked()
@@ -0,0 +1,4 @@
1
+ from sage.misc.superseded import deprecated_function_alias
2
+ import sage.libs.flint.qsieve_sage
3
+
4
+ qsieve = deprecated_function_alias(1, sage.libs.flint.qsieve_sage.qsieve)