passagemath-repl 10.5.1__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.
Files changed (162) hide show
  1. passagemath_repl-10.5.1.data/scripts/sage-cachegrind +25 -0
  2. passagemath_repl-10.5.1.data/scripts/sage-callgrind +16 -0
  3. passagemath_repl-10.5.1.data/scripts/sage-cleaner +230 -0
  4. passagemath_repl-10.5.1.data/scripts/sage-coverage +327 -0
  5. passagemath_repl-10.5.1.data/scripts/sage-eval +14 -0
  6. passagemath_repl-10.5.1.data/scripts/sage-fixdoctests +710 -0
  7. passagemath_repl-10.5.1.data/scripts/sage-inline-fortran +12 -0
  8. passagemath_repl-10.5.1.data/scripts/sage-ipynb2rst +50 -0
  9. passagemath_repl-10.5.1.data/scripts/sage-ipython +16 -0
  10. passagemath_repl-10.5.1.data/scripts/sage-massif +25 -0
  11. passagemath_repl-10.5.1.data/scripts/sage-notebook +267 -0
  12. passagemath_repl-10.5.1.data/scripts/sage-omega +25 -0
  13. passagemath_repl-10.5.1.data/scripts/sage-preparse +302 -0
  14. passagemath_repl-10.5.1.data/scripts/sage-run +27 -0
  15. passagemath_repl-10.5.1.data/scripts/sage-run-cython +10 -0
  16. passagemath_repl-10.5.1.data/scripts/sage-runtests +9 -0
  17. passagemath_repl-10.5.1.data/scripts/sage-startuptime.py +163 -0
  18. passagemath_repl-10.5.1.data/scripts/sage-valgrind +34 -0
  19. passagemath_repl-10.5.1.dist-info/METADATA +77 -0
  20. passagemath_repl-10.5.1.dist-info/RECORD +162 -0
  21. passagemath_repl-10.5.1.dist-info/WHEEL +5 -0
  22. passagemath_repl-10.5.1.dist-info/top_level.txt +1 -0
  23. sage/all__sagemath_repl.py +119 -0
  24. sage/doctest/__init__.py +4 -0
  25. sage/doctest/__main__.py +236 -0
  26. sage/doctest/all.py +4 -0
  27. sage/doctest/check_tolerance.py +261 -0
  28. sage/doctest/control.py +1727 -0
  29. sage/doctest/external.py +534 -0
  30. sage/doctest/fixtures.py +383 -0
  31. sage/doctest/forker.py +2665 -0
  32. sage/doctest/marked_output.py +102 -0
  33. sage/doctest/parsing.py +1708 -0
  34. sage/doctest/parsing_test.py +79 -0
  35. sage/doctest/reporting.py +733 -0
  36. sage/doctest/rif_tol.py +124 -0
  37. sage/doctest/sources.py +1657 -0
  38. sage/doctest/test.py +584 -0
  39. sage/doctest/tests/1second.rst +4 -0
  40. sage/doctest/tests/99seconds.rst +4 -0
  41. sage/doctest/tests/abort.rst +5 -0
  42. sage/doctest/tests/atexit.rst +7 -0
  43. sage/doctest/tests/fail_and_die.rst +6 -0
  44. sage/doctest/tests/initial.rst +15 -0
  45. sage/doctest/tests/interrupt.rst +7 -0
  46. sage/doctest/tests/interrupt_diehard.rst +14 -0
  47. sage/doctest/tests/keyboardinterrupt.rst +11 -0
  48. sage/doctest/tests/longtime.rst +5 -0
  49. sage/doctest/tests/nodoctest +5 -0
  50. sage/doctest/tests/random_seed.rst +4 -0
  51. sage/doctest/tests/show_skipped.rst +18 -0
  52. sage/doctest/tests/sig_on.rst +9 -0
  53. sage/doctest/tests/simple_failure.rst +8 -0
  54. sage/doctest/tests/sleep_and_raise.rst +106 -0
  55. sage/doctest/tests/tolerance.rst +31 -0
  56. sage/doctest/util.py +750 -0
  57. sage/interfaces/cleaner.py +48 -0
  58. sage/interfaces/quit.py +163 -0
  59. sage/misc/all__sagemath_repl.py +51 -0
  60. sage/misc/banner.py +235 -0
  61. sage/misc/benchmark.py +221 -0
  62. sage/misc/classgraph.py +134 -0
  63. sage/misc/copying.py +22 -0
  64. sage/misc/cython.py +694 -0
  65. sage/misc/dev_tools.py +745 -0
  66. sage/misc/edit_module.py +304 -0
  67. sage/misc/explain_pickle.py +3079 -0
  68. sage/misc/gperftools.py +361 -0
  69. sage/misc/inline_fortran.py +212 -0
  70. sage/misc/messaging.py +86 -0
  71. sage/misc/pager.py +21 -0
  72. sage/misc/profiler.py +179 -0
  73. sage/misc/python.py +70 -0
  74. sage/misc/remote_file.py +53 -0
  75. sage/misc/sage_eval.py +249 -0
  76. sage/misc/sage_input.py +3621 -0
  77. sage/misc/sagedoc.py +1742 -0
  78. sage/misc/sh.py +38 -0
  79. sage/misc/trace.py +90 -0
  80. sage/repl/__init__.py +16 -0
  81. sage/repl/all.py +15 -0
  82. sage/repl/attach.py +625 -0
  83. sage/repl/configuration.py +186 -0
  84. sage/repl/display/__init__.py +1 -0
  85. sage/repl/display/fancy_repr.py +354 -0
  86. sage/repl/display/formatter.py +318 -0
  87. sage/repl/display/jsmol_iframe.py +290 -0
  88. sage/repl/display/pretty_print.py +153 -0
  89. sage/repl/display/util.py +163 -0
  90. sage/repl/image.py +302 -0
  91. sage/repl/inputhook.py +91 -0
  92. sage/repl/interface_magic.py +298 -0
  93. sage/repl/interpreter.py +854 -0
  94. sage/repl/ipython_extension.py +593 -0
  95. sage/repl/ipython_kernel/__init__.py +1 -0
  96. sage/repl/ipython_kernel/__main__.py +4 -0
  97. sage/repl/ipython_kernel/all_jupyter.py +10 -0
  98. sage/repl/ipython_kernel/install.py +301 -0
  99. sage/repl/ipython_kernel/interact.py +278 -0
  100. sage/repl/ipython_kernel/kernel.py +217 -0
  101. sage/repl/ipython_kernel/widgets.py +466 -0
  102. sage/repl/ipython_kernel/widgets_sagenb.py +587 -0
  103. sage/repl/ipython_tests.py +163 -0
  104. sage/repl/load.py +326 -0
  105. sage/repl/preparse.py +2218 -0
  106. sage/repl/prompts.py +90 -0
  107. sage/repl/rich_output/__init__.py +4 -0
  108. sage/repl/rich_output/backend_base.py +648 -0
  109. sage/repl/rich_output/backend_doctest.py +316 -0
  110. sage/repl/rich_output/backend_emacs.py +151 -0
  111. sage/repl/rich_output/backend_ipython.py +596 -0
  112. sage/repl/rich_output/buffer.py +311 -0
  113. sage/repl/rich_output/display_manager.py +829 -0
  114. sage/repl/rich_output/example.avi +0 -0
  115. sage/repl/rich_output/example.canvas3d +1 -0
  116. sage/repl/rich_output/example.dvi +0 -0
  117. sage/repl/rich_output/example.flv +0 -0
  118. sage/repl/rich_output/example.gif +0 -0
  119. sage/repl/rich_output/example.jpg +0 -0
  120. sage/repl/rich_output/example.mkv +0 -0
  121. sage/repl/rich_output/example.mov +0 -0
  122. sage/repl/rich_output/example.mp4 +0 -0
  123. sage/repl/rich_output/example.ogv +0 -0
  124. sage/repl/rich_output/example.pdf +0 -0
  125. sage/repl/rich_output/example.png +0 -0
  126. sage/repl/rich_output/example.svg +54 -0
  127. sage/repl/rich_output/example.webm +0 -0
  128. sage/repl/rich_output/example.wmv +0 -0
  129. sage/repl/rich_output/example_jmol.spt.zip +0 -0
  130. sage/repl/rich_output/example_wavefront_scene.mtl +7 -0
  131. sage/repl/rich_output/example_wavefront_scene.obj +17 -0
  132. sage/repl/rich_output/output_basic.py +391 -0
  133. sage/repl/rich_output/output_browser.py +103 -0
  134. sage/repl/rich_output/output_catalog.py +54 -0
  135. sage/repl/rich_output/output_graphics.py +320 -0
  136. sage/repl/rich_output/output_graphics3d.py +345 -0
  137. sage/repl/rich_output/output_video.py +231 -0
  138. sage/repl/rich_output/preferences.py +432 -0
  139. sage/repl/rich_output/pretty_print.py +339 -0
  140. sage/repl/rich_output/test_backend.py +201 -0
  141. sage/repl/user_globals.py +214 -0
  142. sage/tests/all.py +0 -0
  143. sage/tests/all__sagemath_repl.py +3 -0
  144. sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +630 -0
  145. sage/tests/arxiv_0812_2725.py +351 -0
  146. sage/tests/benchmark.py +1925 -0
  147. sage/tests/book_schilling_zabrocki_kschur_primer.py +795 -0
  148. sage/tests/book_stein_ent.py +651 -0
  149. sage/tests/book_stein_modform.py +558 -0
  150. sage/tests/cmdline.py +796 -0
  151. sage/tests/combinatorial_hopf_algebras.py +52 -0
  152. sage/tests/finite_poset.py +623 -0
  153. sage/tests/functools_partial_src.py +27 -0
  154. sage/tests/gosper-sum.py +218 -0
  155. sage/tests/lazy_imports.py +28 -0
  156. sage/tests/modular_group_cohomology.py +80 -0
  157. sage/tests/numpy.py +21 -0
  158. sage/tests/parigp.py +76 -0
  159. sage/tests/startup.py +27 -0
  160. sage/tests/symbolic-series.py +76 -0
  161. sage/tests/sympy.py +16 -0
  162. sage/tests/test_deprecation.py +31 -0
@@ -0,0 +1,214 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.modules
3
+ r"""
4
+ User-interface globals
5
+
6
+ These represent "globals" in the top-level user interface (command
7
+ line, notebook). When starting up Sage, ``user_globals`` becomes
8
+ identical to the ``globals()`` of the top-level frame. Later on,
9
+ functions can inject globals.
10
+
11
+ .. NOTE::
12
+
13
+ Injecting globals is a feature which has some legitimate uses, but
14
+ beware of over-using it. A natural use case for injecting globals is
15
+ for "compile-and-import" functions, such as :func:`cython`.
16
+
17
+ EXAMPLES:
18
+
19
+ This is how a typical user interface initializes the globals::
20
+
21
+ sage: ui_globals = globals() # or wherever the user interface stores its globals
22
+ sage: from sage import all_cmdline
23
+ sage: from sage.repl.user_globals import initialize_globals
24
+ sage: _ = initialize_globals(all_cmdline, ui_globals)
25
+
26
+ Now everything which was imported in ``all_cmdline`` is available as a
27
+ global::
28
+
29
+ sage: from sage.repl.user_globals import get_global, set_global
30
+ sage: get_global("Matrix")
31
+ <cyfunction matrix at ...>
32
+
33
+ This is exactly the same::
34
+
35
+ sage: ui_globals["Matrix"]
36
+ <cyfunction matrix at ...>
37
+
38
+ We inject a global::
39
+
40
+ sage: set_global("myvar", "Hello World!")
41
+ sage: get_global("myvar")
42
+ 'Hello World!'
43
+
44
+ If we set up things correctly, this new variable is now actually
45
+ available as global::
46
+
47
+ sage: myvar
48
+ 'Hello World!'
49
+
50
+ AUTHORS:
51
+
52
+ - Jeroen Demeyer (2015-03-30): initial version (:issue:`12446`)
53
+ """
54
+
55
+ # ****************************************************************************
56
+ # Copyright (C) 2015 Jeroen Demeyer <jdemeyer@cage.ugent.be>
57
+ #
58
+ # This program is free software: you can redistribute it and/or modify
59
+ # it under the terms of the GNU General Public License as published by
60
+ # the Free Software Foundation, either version 2 of the License, or
61
+ # (at your option) any later version.
62
+ # https://www.gnu.org/licenses/
63
+ # ****************************************************************************
64
+
65
+
66
+ user_globals = None
67
+
68
+
69
+ def _check():
70
+ """
71
+ Raise :exc:`RuntimeError` if ``user_globals`` has not been initialized.
72
+
73
+ EXAMPLES::
74
+
75
+ sage: import sage.repl.user_globals
76
+ sage: sage.repl.user_globals._check()
77
+ sage: sage.repl.user_globals.user_globals = None
78
+ sage: sage.repl.user_globals._check()
79
+ Traceback (most recent call last):
80
+ ...
81
+ RuntimeError: the user-space globals dictionary has not been initialized...
82
+ """
83
+ if user_globals is None:
84
+ raise RuntimeError(
85
+ "the user-space globals dictionary has not been initialized. "
86
+ "Use initialize_globals() or set_globals() or use a different "
87
+ "function which doesn't need these globals")
88
+
89
+
90
+ def get_globals():
91
+ """
92
+ Return the dictionary of all user globals.
93
+
94
+ EXAMPLES::
95
+
96
+ sage: from sage.repl.user_globals import get_globals, initialize_globals
97
+ sage: initialize_globals(sage.all)
98
+ sage: get_globals()["Matrix"]
99
+ <cyfunction matrix at ...>
100
+ """
101
+ _check()
102
+ return user_globals
103
+
104
+
105
+ def set_globals(g):
106
+ """
107
+ Set the dictionary of all user globals to ``g``.
108
+
109
+ INPUT:
110
+
111
+ - ``g`` -- dictionary; typically, this will be some dictionary
112
+ given by the user interface or just ``globals()``
113
+
114
+ EXAMPLES::
115
+
116
+ sage: from sage.repl.user_globals import get_globals, set_globals
117
+ sage: my_dict = dict()
118
+ sage: set_globals(my_dict)
119
+ sage: my_dict is get_globals()
120
+ True
121
+ """
122
+ global user_globals
123
+ user_globals = g
124
+
125
+
126
+ def initialize_globals(all, g=None):
127
+ """
128
+ Set the user globals dictionary to ``g`` and assign everything
129
+ which was imported in module ``all`` as global.
130
+
131
+ INPUT:
132
+
133
+ - ``all`` -- a module whose globals will be injected
134
+
135
+ - ``g`` -- dictionary; see :func:`set_globals`. If this is
136
+ ``None``, keep the current globals dictionary.
137
+
138
+ EXAMPLES::
139
+
140
+ sage: my_globs = {"foo": "bar"}
141
+ sage: from sage.repl.user_globals import initialize_globals
142
+ sage: initialize_globals(sage.all, my_globs)
143
+ sage: my_globs["foo"]
144
+ 'bar'
145
+ sage: my_globs["Matrix"]
146
+ <cyfunction matrix at ...>
147
+
148
+ Remove ``Matrix`` from the globals and initialize again without
149
+ changing the dictionary::
150
+
151
+ sage: del my_globs["Matrix"]
152
+ sage: initialize_globals(sage.all)
153
+ sage: my_globs["Matrix"]
154
+ <cyfunction matrix at ...>
155
+ """
156
+ if g is not None:
157
+ set_globals(g)
158
+ for key in dir(all):
159
+ if key[0] != '_':
160
+ user_globals[key] = getattr(all, key)
161
+ from sage.misc.lazy_import import clean_namespace
162
+ clean_namespace(user_globals)
163
+
164
+
165
+ def get_global(name):
166
+ """
167
+ Return the value of global variable ``name``.
168
+
169
+ Raise :exc:`NameError` if there is no such global variable.
170
+
171
+ INPUT:
172
+
173
+ - ``name`` -- string representing a variable name
174
+
175
+ OUTPUT: the value of variable ``name``
176
+
177
+ EXAMPLES::
178
+
179
+ sage: from sage.repl.user_globals import get_global
180
+ sage: the_answer = 42
181
+ sage: get_global("the_answer")
182
+ 42
183
+ sage: get_global("the_question")
184
+ Traceback (most recent call last):
185
+ ...
186
+ NameError: name 'the_question' is not defined
187
+ """
188
+ _check()
189
+ try:
190
+ return user_globals[name]
191
+ except KeyError:
192
+ raise NameError("name {!r} is not defined".format(name))
193
+
194
+
195
+ def set_global(name, value):
196
+ """
197
+ Assign ``value`` to global variable ``name``. This is equivalent
198
+ to executing ``name = value`` in the global namespace.
199
+
200
+ INPUT:
201
+
202
+ - ``name`` -- string representing a variable name
203
+
204
+ - ``value`` -- a value to assign to the variable
205
+
206
+ EXAMPLES::
207
+
208
+ sage: from sage.repl.user_globals import set_global
209
+ sage: set_global("the_answer", 42)
210
+ sage: the_answer
211
+ 42
212
+ """
213
+ _check()
214
+ user_globals[name] = value
sage/tests/all.py ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ """
3
+ """