regina 7.4.1__cp314-cp314-macosx_10_13_x86_64.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.
- regina/.dylibs/libgmp.10.dylib +0 -0
- regina/.dylibs/libgmpxx.4.dylib +0 -0
- regina/__init__.py +192 -0
- regina/engine.cpython-314-darwin.so +0 -0
- regina/plainCompleter.py +221 -0
- regina/pyCensus/__init__.py +14 -0
- regina/pyCensus/christy-knots-links.tdb +0 -0
- regina/pyCensus/closed-hyp-census-full.tdb +0 -0
- regina/pyCensus/closed-nor-census-11.tdb +0 -0
- regina/pyCensus/closed-or-census-11.tdb +0 -0
- regina/pyCensus/cusped-hyp-nor-census-9.tdb +0 -0
- regina/pyCensus/cusped-hyp-or-census-9.tdb +0 -0
- regina/sageRegina/__init__.py +2 -0
- regina/sageRegina/config.py +9 -0
- regina/sageRegina/test.py +131 -0
- regina/sageRegina/testsuite/CMakeLists.txt +64 -0
- regina/sageRegina/testsuite/O2_1.rga +15 -0
- regina/sageRegina/testsuite/O2_1.tri +28 -0
- regina/sageRegina/testsuite/README.txt +21 -0
- regina/sageRegina/testsuite/alltypes-exc.out +698 -0
- regina/sageRegina/testsuite/alltypes-exc.test +92 -0
- regina/sageRegina/testsuite/alltypes-noexc.out +698 -0
- regina/sageRegina/testsuite/alltypes-noexc.test +85 -0
- regina/sageRegina/testsuite/alltypes.out +698 -0
- regina/sageRegina/testsuite/alltypes.test +85 -0
- regina/sageRegina/testsuite/angles.out +102 -0
- regina/sageRegina/testsuite/angles.test +70 -0
- regina/sageRegina/testsuite/arrow.out +86 -0
- regina/sageRegina/testsuite/arrow.test +224 -0
- regina/sageRegina/testsuite/base64.out +2 -0
- regina/sageRegina/testsuite/base64.test +37 -0
- regina/sageRegina/testsuite/basic_callback.out +124 -0
- regina/sageRegina/testsuite/basic_sub.out +7 -0
- regina/sageRegina/testsuite/binom.out +14 -0
- regina/sageRegina/testsuite/binom.test +69 -0
- regina/sageRegina/testsuite/bool.out +6 -0
- regina/sageRegina/testsuite/bool.test +62 -0
- regina/sageRegina/testsuite/bytes.out +17 -0
- regina/sageRegina/testsuite/bytes.test +76 -0
- regina/sageRegina/testsuite/callbacks.out +515 -0
- regina/sageRegina/testsuite/callbacks.test +279 -0
- regina/sageRegina/testsuite/census.out +120 -0
- regina/sageRegina/testsuite/census.test +156 -0
- regina/sageRegina/testsuite/clone.out +18 -0
- regina/sageRegina/testsuite/clone.test +99 -0
- regina/sageRegina/testsuite/comparison.out +41 -0
- regina/sageRegina/testsuite/comparison.test +47 -0
- regina/sageRegina/testsuite/construction.out +120 -0
- regina/sageRegina/testsuite/construction.test +63 -0
- regina/sageRegina/testsuite/constructors.out +14 -0
- regina/sageRegina/testsuite/constructors.test +95 -0
- regina/sageRegina/testsuite/cube.orb +87 -0
- regina/sageRegina/testsuite/discs.out +3 -0
- regina/sageRegina/testsuite/discs.test +38 -0
- regina/sageRegina/testsuite/docstrings.filter +22 -0
- regina/sageRegina/testsuite/docstrings.out +802 -0
- regina/sageRegina/testsuite/docstrings.out.v2 +799 -0
- regina/sageRegina/testsuite/docstrings.test +55 -0
- regina/sageRegina/testsuite/dodec.orb +309 -0
- regina/sageRegina/testsuite/embeddings.out +23 -0
- regina/sageRegina/testsuite/embeddings.test +87 -0
- regina/sageRegina/testsuite/enumerate.out +62 -0
- regina/sageRegina/testsuite/enumerate.test +80 -0
- regina/sageRegina/testsuite/equality.out +112 -0
- regina/sageRegina/testsuite/equality.test +308 -0
- regina/sageRegina/testsuite/euler.out +15 -0
- regina/sageRegina/testsuite/euler.test +93 -0
- regina/sageRegina/testsuite/exception.out +7 -0
- regina/sageRegina/testsuite/exception.test +98 -0
- regina/sageRegina/testsuite/facenumbering.out +546 -0
- regina/sageRegina/testsuite/facenumbering.test +72 -0
- regina/sageRegina/testsuite/faces.out +40 -0
- regina/sageRegina/testsuite/faces.test +70 -0
- regina/sageRegina/testsuite/file.out +1229 -0
- regina/sageRegina/testsuite/file.test +68 -0
- regina/sageRegina/testsuite/file1.rga +0 -0
- regina/sageRegina/testsuite/file2.rga +0 -0
- regina/sageRegina/testsuite/file3.rga +119 -0
- regina/sageRegina/testsuite/flags.out +38 -0
- regina/sageRegina/testsuite/flags.out.v2 +38 -0
- regina/sageRegina/testsuite/flags.test +81 -0
- regina/sageRegina/testsuite/flype.out +37 -0
- regina/sageRegina/testsuite/flype.test +48 -0
- regina/sageRegina/testsuite/generic.out +116 -0
- regina/sageRegina/testsuite/generic.test +74 -0
- regina/sageRegina/testsuite/groups.out +70 -0
- regina/sageRegina/testsuite/groups.test +115 -0
- regina/sageRegina/testsuite/hash.out +66 -0
- regina/sageRegina/testsuite/hash.test +84 -0
- regina/sageRegina/testsuite/hypersurfaces.out +681 -0
- regina/sageRegina/testsuite/hypersurfaces.test +89 -0
- regina/sageRegina/testsuite/i18n-latin1.rga +8 -0
- regina/sageRegina/testsuite/i18n-utf8.rga +8 -0
- regina/sageRegina/testsuite/i18n.out +6 -0
- regina/sageRegina/testsuite/i18n.test +89 -0
- regina/sageRegina/testsuite/id.out +2 -0
- regina/sageRegina/testsuite/id.test +45 -0
- regina/sageRegina/testsuite/index.out +2 -0
- regina/sageRegina/testsuite/index.test +41 -0
- regina/sageRegina/testsuite/integer.out +74 -0
- regina/sageRegina/testsuite/integer.test +54 -0
- regina/sageRegina/testsuite/italian.orb +90 -0
- regina/sageRegina/testsuite/iterators.out +118 -0
- regina/sageRegina/testsuite/iterators.test +126 -0
- regina/sageRegina/testsuite/knotted-Y.orb +47 -0
- regina/sageRegina/testsuite/listener.out +43 -0
- regina/sageRegina/testsuite/listener.test +99 -0
- regina/sageRegina/testsuite/listview.out +416 -0
- regina/sageRegina/testsuite/listview.test +251 -0
- regina/sageRegina/testsuite/lookup.out +13 -0
- regina/sageRegina/testsuite/lookup.test +42 -0
- regina/sageRegina/testsuite/lst.out +844 -0
- regina/sageRegina/testsuite/lst.test +195 -0
- regina/sageRegina/testsuite/memory1.out +62 -0
- regina/sageRegina/testsuite/memory1.test +152 -0
- regina/sageRegina/testsuite/memory2.out +62 -0
- regina/sageRegina/testsuite/memory2.test +122 -0
- regina/sageRegina/testsuite/memory3.out +92 -0
- regina/sageRegina/testsuite/memory3.test +214 -0
- regina/sageRegina/testsuite/misc.out +7 -0
- regina/sageRegina/testsuite/misc.test +54 -0
- regina/sageRegina/testsuite/operators.out +129 -0
- regina/sageRegina/testsuite/operators.test +59 -0
- regina/sageRegina/testsuite/orb.out +441 -0
- regina/sageRegina/testsuite/orb.test +47 -0
- regina/sageRegina/testsuite/pdf.out +4 -0
- regina/sageRegina/testsuite/pdf.test +47 -0
- regina/sageRegina/testsuite/perm.out +36 -0
- regina/sageRegina/testsuite/perm.test +74 -0
- regina/sageRegina/testsuite/plantri.out +12 -0
- regina/sageRegina/testsuite/plantri.test +58 -0
- regina/sageRegina/testsuite/poincare.tri +55 -0
- regina/sageRegina/testsuite/presentations.out +11 -0
- regina/sageRegina/testsuite/presentations.test +59 -0
- regina/sageRegina/testsuite/refs.out +51 -0
- regina/sageRegina/testsuite/refs.test +126 -0
- regina/sageRegina/testsuite/repr.out +951 -0
- regina/sageRegina/testsuite/repr.out.v2 +951 -0
- regina/sageRegina/testsuite/repr.test +546 -0
- regina/sageRegina/testsuite/runbasic.in +75 -0
- regina/sageRegina/testsuite/safeheldtype_basic.out +17 -0
- regina/sageRegina/testsuite/safeheldtype_basic.test +111 -0
- regina/sageRegina/testsuite/safeheldtype_packet.out +58 -0
- regina/sageRegina/testsuite/safeheldtype_packet.test +179 -0
- regina/sageRegina/testsuite/sample.pdf +0 -0
- regina/sageRegina/testsuite/sets.out +7 -0
- regina/sageRegina/testsuite/sets.test +42 -0
- regina/sageRegina/testsuite/skeleton.out +308 -0
- regina/sageRegina/testsuite/skeleton.test +52 -0
- regina/sageRegina/testsuite/snappea.out +90 -0
- regina/sageRegina/testsuite/snappea.test +133 -0
- regina/sageRegina/testsuite/snapshot.out +15 -0
- regina/sageRegina/testsuite/snapshot.test +76 -0
- regina/sageRegina/testsuite/sort.out +78 -0
- regina/sageRegina/testsuite/sort.test +58 -0
- regina/sageRegina/testsuite/special.out +4 -0
- regina/sageRegina/testsuite/special.test +45 -0
- regina/sageRegina/testsuite/standardtri.out +12101 -0
- regina/sageRegina/testsuite/standardtri.test +453 -0
- regina/sageRegina/testsuite/surfaces.out +2133 -0
- regina/sageRegina/testsuite/surfaces.test +112 -0
- regina/sageRegina/testsuite/swapping.out +25 -0
- regina/sageRegina/testsuite/swapping.test +86 -0
- regina/sageRegina/testsuite/testall.in +174 -0
- regina/sageRegina/testsuite/testbasic.in +277 -0
- regina/sageRegina/testsuite/testcallback.in +148 -0
- regina/sageRegina/testsuite/testsub.in +148 -0
- regina/sageRegina/testsuite/theta_in_solid_torus.orb +65 -0
- regina/sageRegina/testsuite/tightencode.out +40 -0
- regina/sageRegina/testsuite/tightencode.test +106 -0
- regina/sageRegina/testsuite/treedecomp.out +135 -0
- regina/sageRegina/testsuite/treedecomp.test +64 -0
- regina/sageRegina/testsuite/treetraversal.out +52 -0
- regina/sageRegina/testsuite/treetraversal.test +188 -0
- regina/sageRegina/testsuite/trigeneral.out +1251 -0
- regina/sageRegina/testsuite/trigeneral.test +153 -0
- regina/sageRegina/testsuite/utf8.out +42 -0
- regina/sageRegina/testsuite/utf8.test +92 -0
- regina/sageRegina/testsuite/whitehead.tri +47 -0
- regina/sageRegina/version.py +5 -0
- regina/sageSetup.py +41 -0
- regina/test.py +6 -0
- regina-7.4.1.dist-info/METADATA +109 -0
- regina-7.4.1.dist-info/RECORD +186 -0
- regina-7.4.1.dist-info/WHEEL +6 -0
- regina-7.4.1.dist-info/top_level.txt +4 -0
|
Binary file
|
|
Binary file
|
regina/__init__.py
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Regina - A Normal Surface Theory Calculator
|
|
2
|
+
# Python Module Initialisation
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2003-2025, Ben Burton
|
|
5
|
+
# For further details contact Ben Burton (bab@debian.org).
|
|
6
|
+
#
|
|
7
|
+
# This program is free software; you can redistribute it and/or
|
|
8
|
+
# modify it under the terms of the GNU General Public License as
|
|
9
|
+
# published by the Free Software Foundation; either version 2 of the
|
|
10
|
+
# License, or (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# As an exception, when this program is distributed through (i) the
|
|
13
|
+
# App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or
|
|
14
|
+
# (iii) Google Play by Google Inc., then that store may impose any
|
|
15
|
+
# digital rights management, device limits and/or redistribution
|
|
16
|
+
# restrictions that are required by its terms of service.
|
|
17
|
+
#
|
|
18
|
+
# This program is distributed in the hope that it will be useful, but
|
|
19
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
21
|
+
# General Public License for more details.
|
|
22
|
+
#
|
|
23
|
+
# You should have received a copy of the GNU General Public License
|
|
24
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
25
|
+
#
|
|
26
|
+
|
|
27
|
+
import sys, os
|
|
28
|
+
from . import engine
|
|
29
|
+
from .engine import *
|
|
30
|
+
|
|
31
|
+
if 'sage' in sys.modules:
|
|
32
|
+
# Typing "from regina import *" should not override certain
|
|
33
|
+
# names. This always applies to the built-in "open".
|
|
34
|
+
#
|
|
35
|
+
# Also: the Sage preparser adds "Integer" and relies on the name
|
|
36
|
+
# being bound to a Sage integer. If we override it, Sage
|
|
37
|
+
# breaks in multiple ways.
|
|
38
|
+
#
|
|
39
|
+
# We skip names_to_avoid in __all__.
|
|
40
|
+
names_to_avoid = set(['open', 'Integer'])
|
|
41
|
+
__all__ = (
|
|
42
|
+
[ name for name in engine.__dict__.keys()
|
|
43
|
+
if not name in names_to_avoid and not name.startswith('_') ] +
|
|
44
|
+
[ 'reginaSetup' ])
|
|
45
|
+
|
|
46
|
+
# All additional sage-related setup should be placed within sageSetup.py.
|
|
47
|
+
from . import sageSetup
|
|
48
|
+
del sageSetup
|
|
49
|
+
else:
|
|
50
|
+
# Typing "from regina import *" is not supposed to override the
|
|
51
|
+
# built-in "open". To achieve this, we skip it in __all__.
|
|
52
|
+
__all__ = (
|
|
53
|
+
[ name for name in engine.__dict__.keys()
|
|
54
|
+
if name != 'open' and not name.startswith('_') ] +
|
|
55
|
+
[ 'reginaSetup' ])
|
|
56
|
+
|
|
57
|
+
# In sageRegina, the census files are supplied differently.
|
|
58
|
+
# Set the location here.
|
|
59
|
+
try:
|
|
60
|
+
from .pyCensus import __path__ as _pyCensusPath
|
|
61
|
+
GlobalDirs.setDirs(
|
|
62
|
+
GlobalDirs.home(),
|
|
63
|
+
GlobalDirs.pythonModule(),
|
|
64
|
+
_pyCensusPath[0])
|
|
65
|
+
except ImportError:
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
def reginaSetup(quiet = False, readline = True, banner = False,
|
|
69
|
+
snappyPath = True, namespace = None, builtinOpen = True):
|
|
70
|
+
"""
|
|
71
|
+
Initialise a Regina python session.
|
|
72
|
+
|
|
73
|
+
Arguments:
|
|
74
|
+
quiet : If true, suppress informative messages that would
|
|
75
|
+
otherwise be written to standard output. If an error
|
|
76
|
+
occurs, details of the error will be written regardless.
|
|
77
|
+
readline : If true, attempt to enable tab completion.
|
|
78
|
+
snappyPath : Applies to platforms where SnapPy might not be installed
|
|
79
|
+
on the python path (e.g., macOS users with the SnapPy app
|
|
80
|
+
bundle). If true, this setup routine will (i) attempt
|
|
81
|
+
to locate SnapPy, and (ii) if successful, extend sys.path
|
|
82
|
+
to include the location of SnapPy's python module and its
|
|
83
|
+
dependencies.
|
|
84
|
+
banner : If true, print a welcome banner to standard output.
|
|
85
|
+
namespace : The global namespace in which the start-up library scripts
|
|
86
|
+
(if any) will be executed. This may be None, in which
|
|
87
|
+
case the caller's global namespace will be used.
|
|
88
|
+
builtinOpen: If true, sets "open" in the given namespace to Python's
|
|
89
|
+
builtin open() function. This is used to work around the
|
|
90
|
+
problem whereby "from regina import *", overrides Python's
|
|
91
|
+
open() function with Regina's. You will still be able to
|
|
92
|
+
access Regina's open() function by calling regina.open().
|
|
93
|
+
If the namespace argument above is None, then this option
|
|
94
|
+
has no effect.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
if readline:
|
|
98
|
+
# Enable tab completion through readline, if we can.
|
|
99
|
+
try:
|
|
100
|
+
import rlcompleter, readline
|
|
101
|
+
# readline by default completes an empty string, whereas if
|
|
102
|
+
# we press tab we want to insert an actual tab character,
|
|
103
|
+
# so we have our own completion function.
|
|
104
|
+
|
|
105
|
+
__internal_python_completer = readline.get_completer()
|
|
106
|
+
def regina_completer(text, state):
|
|
107
|
+
if not text:
|
|
108
|
+
return ('\t', None)[state]
|
|
109
|
+
else:
|
|
110
|
+
return __internal_python_completer(text, state)
|
|
111
|
+
readline.set_completer(regina_completer)
|
|
112
|
+
|
|
113
|
+
if 'libedit' in readline.__doc__:
|
|
114
|
+
# Some systems work with libedit, not libreadline, which
|
|
115
|
+
# supports a different set of commands.
|
|
116
|
+
readline.parse_and_bind('bind ^I rl_complete')
|
|
117
|
+
else:
|
|
118
|
+
readline.parse_and_bind('tab: complete')
|
|
119
|
+
except:
|
|
120
|
+
pass
|
|
121
|
+
|
|
122
|
+
if snappyPath:
|
|
123
|
+
# For the time being, only find SnapPy on macOS.
|
|
124
|
+
if sys.platform == 'darwin':
|
|
125
|
+
if sys.version_info[:2] == (3, 8):
|
|
126
|
+
# Ask macOS where SnapPy lives.
|
|
127
|
+
import subprocess
|
|
128
|
+
try:
|
|
129
|
+
app = subprocess.check_output(['mdfind',
|
|
130
|
+
'kMDItemDisplayName==SnapPy&&kMDItemKind==Application'])
|
|
131
|
+
if app:
|
|
132
|
+
app = app.strip().split('\n')[0]
|
|
133
|
+
except:
|
|
134
|
+
app = None
|
|
135
|
+
|
|
136
|
+
if not app:
|
|
137
|
+
app = '/Applications/SnapPy.app'
|
|
138
|
+
snappyLib = app + '/Contents/Resources/lib/python3.8'
|
|
139
|
+
snappyZip = app + '/Contents/Resources/lib/python38.zip'
|
|
140
|
+
if os.path.exists(snappyLib):
|
|
141
|
+
sys.path.append(snappyLib)
|
|
142
|
+
sys.path.append(snappyLib + '/site-packages.zip')
|
|
143
|
+
sys.path.append(snappyLib + '/lib-dynload')
|
|
144
|
+
if os.path.exists(snappyZip):
|
|
145
|
+
sys.path.append(snappyZip)
|
|
146
|
+
|
|
147
|
+
if banner:
|
|
148
|
+
print(engine.welcome())
|
|
149
|
+
|
|
150
|
+
if builtinOpen and namespace:
|
|
151
|
+
namespace['open'] = __builtins__['open']
|
|
152
|
+
|
|
153
|
+
def __execScript(namespace = None):
|
|
154
|
+
"""
|
|
155
|
+
For internal use by regina-python.
|
|
156
|
+
Executes a given python script.
|
|
157
|
+
|
|
158
|
+
The filename of the script should be in sys.argv[1], and
|
|
159
|
+
any arguments to the script should be in sys.argv[2:].
|
|
160
|
+
However, ipython sets things up a little differently (it includes two
|
|
161
|
+
additional arguments), and we attempt to compensate for this here.
|
|
162
|
+
|
|
163
|
+
SIDE-EFFECT: sys.argv will be truncated to include the script and
|
|
164
|
+
its arguments only (i.e., sys.argv[0] will be removed).
|
|
165
|
+
|
|
166
|
+
Arguments:
|
|
167
|
+
namespace : The global namespace in which the script will be executed.
|
|
168
|
+
This may be None, in which case the caller's global
|
|
169
|
+
namespace will be used.
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
try:
|
|
173
|
+
__IPYTHON__
|
|
174
|
+
# Although python sets sys.argv = [ '-c', script, arg, ... ],
|
|
175
|
+
# ipython sets sys.argv as the full original command line:
|
|
176
|
+
# [ ipython, '-c', command, script, arg, ... ], or
|
|
177
|
+
# [ ipython, '-i', '-c', command, script, arg, ... ].
|
|
178
|
+
# Repair things here.
|
|
179
|
+
if len(sys.argv) >= 3 and sys.argv[1] == '-c':
|
|
180
|
+
sys.argv = [ '-c' ] + sys.argv[3:]
|
|
181
|
+
elif len(sys.argv) >= 4 and sys.argv[1:3] == ['-i', '-c']:
|
|
182
|
+
sys.argv = [ '-c' ] + sys.argv[4:]
|
|
183
|
+
except:
|
|
184
|
+
pass
|
|
185
|
+
|
|
186
|
+
script = __builtins__['open'](sys.argv[1]).read()
|
|
187
|
+
sys.argv = sys.argv[1:]
|
|
188
|
+
if namespace:
|
|
189
|
+
exec(script, namespace)
|
|
190
|
+
else:
|
|
191
|
+
exec(script)
|
|
192
|
+
|
|
Binary file
|
regina/plainCompleter.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"""A copy of Python's rlcompleter module that removes all interaction
|
|
2
|
+
with the readline module. This is a trivial modification of rlcompleter.py
|
|
3
|
+
from Python 3.9, which is licensed under the Python Software Foundation
|
|
4
|
+
License Version 2.
|
|
5
|
+
|
|
6
|
+
This plainCompleter module is designed for use in Regina's GUI, which uses
|
|
7
|
+
Python subinterpreters. The readline module does not play well with
|
|
8
|
+
subinterpreters (due to the way it interacts with the GIL), and in some
|
|
9
|
+
settings this results in a completely reproducible deadlock. Such settings
|
|
10
|
+
include openSUSE Leap 15.2, and macOS 11.0 using the Python3 that is shipped
|
|
11
|
+
with Xcode.
|
|
12
|
+
|
|
13
|
+
This plainCompleter module still offers a Completer class (which is all
|
|
14
|
+
that the GUI needs), but it does not offer full readline functionality
|
|
15
|
+
at the command line. Crucially, importing this module will never attempt
|
|
16
|
+
to import the readline module as a side-effect.
|
|
17
|
+
|
|
18
|
+
Python's own rlcompleter documentation continues from here.
|
|
19
|
+
|
|
20
|
+
The completer completes keywords, built-ins and globals in a selectable
|
|
21
|
+
namespace (which defaults to __main__); when completing NAME.NAME..., it
|
|
22
|
+
evaluates (!) the expression up to the last dot and completes its attributes.
|
|
23
|
+
|
|
24
|
+
It's very cool to do "import sys" type "sys.", hit the completion key (twice),
|
|
25
|
+
and see the list of names defined by the sys module!
|
|
26
|
+
|
|
27
|
+
Tip: to use the tab key as the completion key, call
|
|
28
|
+
|
|
29
|
+
readline.parse_and_bind("tab: complete")
|
|
30
|
+
|
|
31
|
+
Notes:
|
|
32
|
+
|
|
33
|
+
- Exceptions raised by the completer function are *ignored* (and generally cause
|
|
34
|
+
the completion to fail). This is a feature -- since readline sets the tty
|
|
35
|
+
device in raw (or cbreak) mode, printing a traceback wouldn't work well
|
|
36
|
+
without some complicated hoopla to save, reset and restore the tty state.
|
|
37
|
+
|
|
38
|
+
- The evaluation of the NAME.NAME... form may cause arbitrary application
|
|
39
|
+
defined code to be executed if an object with a __getattr__ hook is found.
|
|
40
|
+
Since it is the responsibility of the application (or the user) to enable this
|
|
41
|
+
feature, I consider this an acceptable risk. More complicated expressions
|
|
42
|
+
(e.g. function calls or indexing operations) are *not* evaluated.
|
|
43
|
+
|
|
44
|
+
- When the original stdin is not a tty device, GNU readline is never
|
|
45
|
+
used, and this module (and the readline module) are silently inactive.
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
import atexit
|
|
50
|
+
import __main__
|
|
51
|
+
|
|
52
|
+
# The original rlcompleter simply imports the builtins module.
|
|
53
|
+
# However, we need to maintain compatibility with python 2 also.
|
|
54
|
+
try:
|
|
55
|
+
import builtins
|
|
56
|
+
except:
|
|
57
|
+
import __builtin__ as builtins
|
|
58
|
+
|
|
59
|
+
__all__ = ["Completer"]
|
|
60
|
+
|
|
61
|
+
class Completer:
|
|
62
|
+
def __init__(self, namespace = None):
|
|
63
|
+
"""Create a new completer for the command line.
|
|
64
|
+
|
|
65
|
+
Completer([namespace]) -> completer instance.
|
|
66
|
+
|
|
67
|
+
If unspecified, the default namespace where completions are performed
|
|
68
|
+
is __main__ (technically, __main__.__dict__). Namespaces should be
|
|
69
|
+
given as dictionaries.
|
|
70
|
+
|
|
71
|
+
Completer instances should be used as the completion mechanism of
|
|
72
|
+
readline via the set_completer() call:
|
|
73
|
+
|
|
74
|
+
readline.set_completer(Completer(my_namespace).complete)
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
if namespace and not isinstance(namespace, dict):
|
|
78
|
+
raise TypeError('namespace must be a dictionary')
|
|
79
|
+
|
|
80
|
+
# Don't bind to namespace quite yet, but flag whether the user wants a
|
|
81
|
+
# specific namespace or to use __main__.__dict__. This will allow us
|
|
82
|
+
# to bind to __main__.__dict__ at completion time, not now.
|
|
83
|
+
if namespace is None:
|
|
84
|
+
self.use_main_ns = 1
|
|
85
|
+
else:
|
|
86
|
+
self.use_main_ns = 0
|
|
87
|
+
self.namespace = namespace
|
|
88
|
+
|
|
89
|
+
def complete(self, text, state):
|
|
90
|
+
"""Return the next possible completion for 'text'.
|
|
91
|
+
|
|
92
|
+
This is called successively with state == 0, 1, 2, ... until it
|
|
93
|
+
returns None. The completion should begin with 'text'.
|
|
94
|
+
|
|
95
|
+
"""
|
|
96
|
+
if self.use_main_ns:
|
|
97
|
+
self.namespace = __main__.__dict__
|
|
98
|
+
|
|
99
|
+
if not text.strip():
|
|
100
|
+
if state == 0:
|
|
101
|
+
if _readline_available:
|
|
102
|
+
readline.insert_text('\t')
|
|
103
|
+
readline.redisplay()
|
|
104
|
+
return ''
|
|
105
|
+
else:
|
|
106
|
+
return '\t'
|
|
107
|
+
else:
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
if state == 0:
|
|
111
|
+
if "." in text:
|
|
112
|
+
self.matches = self.attr_matches(text)
|
|
113
|
+
else:
|
|
114
|
+
self.matches = self.global_matches(text)
|
|
115
|
+
try:
|
|
116
|
+
return self.matches[state]
|
|
117
|
+
except IndexError:
|
|
118
|
+
return None
|
|
119
|
+
|
|
120
|
+
def _callable_postfix(self, val, word):
|
|
121
|
+
if callable(val):
|
|
122
|
+
word = word + "("
|
|
123
|
+
return word
|
|
124
|
+
|
|
125
|
+
def global_matches(self, text):
|
|
126
|
+
"""Compute matches when text is a simple name.
|
|
127
|
+
|
|
128
|
+
Return a list of all keywords, built-in functions and names currently
|
|
129
|
+
defined in self.namespace that match.
|
|
130
|
+
|
|
131
|
+
"""
|
|
132
|
+
import keyword
|
|
133
|
+
matches = []
|
|
134
|
+
seen = {"__builtins__"}
|
|
135
|
+
n = len(text)
|
|
136
|
+
for word in keyword.kwlist:
|
|
137
|
+
if word[:n] == text:
|
|
138
|
+
seen.add(word)
|
|
139
|
+
if word in {'finally', 'try'}:
|
|
140
|
+
word = word + ':'
|
|
141
|
+
elif word not in {'False', 'None', 'True',
|
|
142
|
+
'break', 'continue', 'pass',
|
|
143
|
+
'else'}:
|
|
144
|
+
word = word + ' '
|
|
145
|
+
matches.append(word)
|
|
146
|
+
for nspace in [self.namespace, builtins.__dict__]:
|
|
147
|
+
for word, val in nspace.items():
|
|
148
|
+
if word[:n] == text and word not in seen:
|
|
149
|
+
seen.add(word)
|
|
150
|
+
matches.append(self._callable_postfix(val, word))
|
|
151
|
+
return matches
|
|
152
|
+
|
|
153
|
+
def attr_matches(self, text):
|
|
154
|
+
"""Compute matches when text contains a dot.
|
|
155
|
+
|
|
156
|
+
Assuming the text is of the form NAME.NAME....[NAME], and is
|
|
157
|
+
evaluable in self.namespace, it will be evaluated and its attributes
|
|
158
|
+
(as revealed by dir()) are used as possible completions. (For class
|
|
159
|
+
instances, class members are also considered.)
|
|
160
|
+
|
|
161
|
+
WARNING: this can still invoke arbitrary C code, if an object
|
|
162
|
+
with a __getattr__ hook is evaluated.
|
|
163
|
+
|
|
164
|
+
"""
|
|
165
|
+
import re
|
|
166
|
+
m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
|
|
167
|
+
if not m:
|
|
168
|
+
return []
|
|
169
|
+
expr, attr = m.group(1, 3)
|
|
170
|
+
try:
|
|
171
|
+
thisobject = eval(expr, self.namespace)
|
|
172
|
+
except Exception:
|
|
173
|
+
return []
|
|
174
|
+
|
|
175
|
+
# get the content of the object, except __builtins__
|
|
176
|
+
words = set(dir(thisobject))
|
|
177
|
+
words.discard("__builtins__")
|
|
178
|
+
|
|
179
|
+
if hasattr(thisobject, '__class__'):
|
|
180
|
+
words.add('__class__')
|
|
181
|
+
words.update(get_class_members(thisobject.__class__))
|
|
182
|
+
matches = []
|
|
183
|
+
n = len(attr)
|
|
184
|
+
if attr == '':
|
|
185
|
+
noprefix = '_'
|
|
186
|
+
elif attr == '_':
|
|
187
|
+
noprefix = '__'
|
|
188
|
+
else:
|
|
189
|
+
noprefix = None
|
|
190
|
+
while True:
|
|
191
|
+
for word in words:
|
|
192
|
+
if (word[:n] == attr and
|
|
193
|
+
not (noprefix and word[:n+1] == noprefix)):
|
|
194
|
+
match = "%s.%s" % (expr, word)
|
|
195
|
+
try:
|
|
196
|
+
val = getattr(thisobject, word)
|
|
197
|
+
except Exception:
|
|
198
|
+
pass # Include even if attribute not set
|
|
199
|
+
else:
|
|
200
|
+
match = self._callable_postfix(val, match)
|
|
201
|
+
matches.append(match)
|
|
202
|
+
if matches or not noprefix:
|
|
203
|
+
break
|
|
204
|
+
if noprefix == '_':
|
|
205
|
+
noprefix = '__'
|
|
206
|
+
else:
|
|
207
|
+
noprefix = None
|
|
208
|
+
matches.sort()
|
|
209
|
+
return matches
|
|
210
|
+
|
|
211
|
+
def get_class_members(klass):
|
|
212
|
+
ret = dir(klass)
|
|
213
|
+
if hasattr(klass,'__bases__'):
|
|
214
|
+
for base in klass.__bases__:
|
|
215
|
+
ret = ret + get_class_members(base)
|
|
216
|
+
return ret
|
|
217
|
+
|
|
218
|
+
# Regina's edits are here.
|
|
219
|
+
# Instead of trying to import the readline module, we just ignore it
|
|
220
|
+
# and treat this module as a standalone completion tool.
|
|
221
|
+
_readline_available = False
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Dummy module to obtain path for census files from python.
|
|
3
|
+
|
|
4
|
+
The TokyoCabinet database files .tdb are for versin version 1.0:910 and in
|
|
5
|
+
little endian encoding suitable. Note that sageRegina is compiling its own
|
|
6
|
+
version of TokyoCabinet so the files we supply should work on all operating
|
|
7
|
+
systems and little endian platforms.
|
|
8
|
+
|
|
9
|
+
The .tdb files will be incompatible with the TokyoCabinet version shipped
|
|
10
|
+
with Debian/Ubuntu because of a stupid bug: on these systems, TokyoCabinet
|
|
11
|
+
is always using non-native (!) endianess (since --enable-swap was
|
|
12
|
+
accidentally supplied to configure).
|
|
13
|
+
|
|
14
|
+
"""
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
tokyocabinet_uri = 'https://dbmx.net/tokyocabinet/tokyocabinet-1.4.48.tar.gz'
|
|
2
|
+
tokyocabinet_dir = 'tokyocabinet-1.4.48'
|
|
3
|
+
|
|
4
|
+
libxml_uri = 'http://xmlsoft.org/sources/libxml2-2.9.3.tar.gz'
|
|
5
|
+
libxml_dir = 'libxml2-2.9.3'
|
|
6
|
+
|
|
7
|
+
regina_hash = '219d658e5e51cc003807fc8' # regina-7.4.1
|
|
8
|
+
regina_uri = 'https://github.com/regina-normal/regina.git'
|
|
9
|
+
regina_dir = 'regina_%s' % regina_hash
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
|
|
3
|
+
#__all__ = ['runTests']
|
|
4
|
+
|
|
5
|
+
from .. import __dict__ as reginaDict
|
|
6
|
+
from . version import version
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
import os
|
|
10
|
+
import re
|
|
11
|
+
import glob
|
|
12
|
+
import difflib
|
|
13
|
+
import traceback
|
|
14
|
+
from io import StringIO
|
|
15
|
+
|
|
16
|
+
base_path = os.path.split(__file__)[0]
|
|
17
|
+
testsuite_path = os.path.join(base_path, 'testsuite')
|
|
18
|
+
|
|
19
|
+
def runSource(source):
|
|
20
|
+
|
|
21
|
+
original_stdout = sys.stdout
|
|
22
|
+
original_displayhook = sys.displayhook
|
|
23
|
+
original_argv = sys.argv
|
|
24
|
+
|
|
25
|
+
fakeout = StringIO()
|
|
26
|
+
|
|
27
|
+
sys.stdout = fakeout
|
|
28
|
+
sys.displayhook = sys.__displayhook__
|
|
29
|
+
sys.argv = ['regina', testsuite_path]
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
globs = reginaDict.copy()
|
|
33
|
+
# this is regina.open which would otherwise clobber the
|
|
34
|
+
# builtin open expected by the tests
|
|
35
|
+
del globs['open']
|
|
36
|
+
|
|
37
|
+
class ReginaWrapper:
|
|
38
|
+
pass
|
|
39
|
+
reginaWrapper = ReginaWrapper()
|
|
40
|
+
reginaWrapper.__dict__ = reginaDict.copy()
|
|
41
|
+
globs['regina'] = reginaWrapper
|
|
42
|
+
|
|
43
|
+
exception_info = None
|
|
44
|
+
try:
|
|
45
|
+
exec(source, globs)
|
|
46
|
+
except:
|
|
47
|
+
exception_info = sys.exc_info()
|
|
48
|
+
|
|
49
|
+
finally:
|
|
50
|
+
sys.stdout = original_stdout
|
|
51
|
+
sys.displayhook = original_displayhook
|
|
52
|
+
sys.argv = original_argv
|
|
53
|
+
|
|
54
|
+
return fakeout.getvalue(), exception_info
|
|
55
|
+
|
|
56
|
+
def runFile(path):
|
|
57
|
+
return runSource(open(path).read())
|
|
58
|
+
|
|
59
|
+
def findTests():
|
|
60
|
+
search_path = os.path.join(testsuite_path, '*.test')
|
|
61
|
+
return [
|
|
62
|
+
(os.path.splitext(os.path.basename(path))[0], path)
|
|
63
|
+
for path in glob.glob(search_path)]
|
|
64
|
+
|
|
65
|
+
def runTest(testName, testFile):
|
|
66
|
+
failed = ""
|
|
67
|
+
|
|
68
|
+
output, exception_info = runFile(testFile)
|
|
69
|
+
|
|
70
|
+
baseline = open(testFile.replace('.test', '.out')).read()
|
|
71
|
+
|
|
72
|
+
if testName == 'docstrings':
|
|
73
|
+
output = re.subn(r'(\s*)__pybind11_module_local_([a-zA-Z0-9_-]+) = <capsule.*\.\.\.',
|
|
74
|
+
r'\1__pybind11_module_local__ = ...', output)[0]
|
|
75
|
+
output = re.subn(r'(\s*)Methods( inherited from pybind11_object:)',
|
|
76
|
+
r'\1Static methods\2', output)[0]
|
|
77
|
+
output = re.subn(r'__new__\(\*args, \*\*kwargs\) class method of pybind11_builtins.pybind11_object',
|
|
78
|
+
r'__new__(*args, **kwargs) from pybind11_builtins.pybind11_type',
|
|
79
|
+
output)[0]
|
|
80
|
+
|
|
81
|
+
# For Python 3.12, there are trailing whitespace issues, so we
|
|
82
|
+
# normalize.
|
|
83
|
+
baseline = [line.strip() for line in baseline.split('\n')]
|
|
84
|
+
output = [line.strip() for line in output.split('\n')]
|
|
85
|
+
if output != baseline:
|
|
86
|
+
failed += "Difference between baseline and output:\n"
|
|
87
|
+
failed += '\n'.join(
|
|
88
|
+
difflib.context_diff(
|
|
89
|
+
baseline,
|
|
90
|
+
output,
|
|
91
|
+
fromfile = os.path.basename(testFile),
|
|
92
|
+
tofile = 'OUTPUT'))
|
|
93
|
+
|
|
94
|
+
if exception_info:
|
|
95
|
+
exception_type, exception, traceback_object = (
|
|
96
|
+
exception_info)
|
|
97
|
+
failed += "Raised exception: %s\n" % exception_type
|
|
98
|
+
failed += "Exception detail: %s\n" % exception
|
|
99
|
+
failed += "Trace:\n %s\n" % traceback.format_tb(traceback_object)
|
|
100
|
+
|
|
101
|
+
return failed
|
|
102
|
+
|
|
103
|
+
def runTests():
|
|
104
|
+
print("Testing Regina " + version)
|
|
105
|
+
failedTests = []
|
|
106
|
+
|
|
107
|
+
for testName, testFile in findTests():
|
|
108
|
+
if sys.version_info >= (3, 14) and testName == 'docstrings':
|
|
109
|
+
continue
|
|
110
|
+
|
|
111
|
+
print("Running test %s:" % (testName + (20 - len(testName)) * " "),
|
|
112
|
+
end = ' ')
|
|
113
|
+
sys.stdout.flush()
|
|
114
|
+
|
|
115
|
+
failureOutput = runTest(testName, testFile)
|
|
116
|
+
|
|
117
|
+
if failureOutput:
|
|
118
|
+
failedTests.append(testName)
|
|
119
|
+
print("FAILED!!!")
|
|
120
|
+
print(failureOutput)
|
|
121
|
+
else:
|
|
122
|
+
print("ok")
|
|
123
|
+
|
|
124
|
+
if failedTests:
|
|
125
|
+
print("The following %d test(s) failed: %s" % (
|
|
126
|
+
len(failedTests), ', '.join(failedTests)))
|
|
127
|
+
else:
|
|
128
|
+
print("All tests passed for Regina " + version)
|
|
129
|
+
|
|
130
|
+
return not failedTests
|
|
131
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
CONFIGURE_FILE(
|
|
3
|
+
testall.in
|
|
4
|
+
"${PROJECT_BINARY_DIR}/python/testsuite/testall"
|
|
5
|
+
@ONLY
|
|
6
|
+
)
|
|
7
|
+
CONFIGURE_FILE(
|
|
8
|
+
testbasic.in
|
|
9
|
+
"${PROJECT_BINARY_DIR}/python/testsuite/testbasic"
|
|
10
|
+
@ONLY
|
|
11
|
+
)
|
|
12
|
+
CONFIGURE_FILE(
|
|
13
|
+
testsub.in
|
|
14
|
+
"${PROJECT_BINARY_DIR}/python/testsuite/testsub"
|
|
15
|
+
@ONLY
|
|
16
|
+
)
|
|
17
|
+
CONFIGURE_FILE(
|
|
18
|
+
testcallback.in
|
|
19
|
+
"${PROJECT_BINARY_DIR}/python/testsuite/testcallback"
|
|
20
|
+
@ONLY
|
|
21
|
+
)
|
|
22
|
+
CONFIGURE_FILE(
|
|
23
|
+
runbasic.in
|
|
24
|
+
"${PROJECT_BINARY_DIR}/python/testsuite/runbasic"
|
|
25
|
+
@ONLY
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# A very basic interpreter (and related code) to use for testing:
|
|
29
|
+
INCLUDE_DIRECTORIES(${Python_INCLUDE_DIRS} ${ENGINE_INCLUDES} "${PROJECT_BINARY_DIR}/engine")
|
|
30
|
+
ADD_LINK_OPTIONS(${Python_LINK_OPTIONS})
|
|
31
|
+
add_executable(basic
|
|
32
|
+
basic.cpp
|
|
33
|
+
../gui/pythoninterpreter.cpp
|
|
34
|
+
../gui/pythonoutputstream.cpp)
|
|
35
|
+
target_link_libraries(basic ${ENGINE_LIBRARY} ${Python_LIBRARIES})
|
|
36
|
+
add_executable(basic_alltypes
|
|
37
|
+
basic_alltypes.cpp
|
|
38
|
+
../gui/pythoninterpreter.cpp
|
|
39
|
+
../gui/pythonoutputstream.cpp)
|
|
40
|
+
target_link_libraries(basic_alltypes ${ENGINE_LIBRARY} ${Python_LIBRARIES})
|
|
41
|
+
add_executable(basic_sub
|
|
42
|
+
basic_sub.cpp
|
|
43
|
+
../gui/pythoninterpreter.cpp
|
|
44
|
+
../gui/pythonoutputstream.cpp)
|
|
45
|
+
target_link_libraries(basic_sub ${ENGINE_LIBRARY} ${Python_LIBRARIES})
|
|
46
|
+
add_executable(basic_callback
|
|
47
|
+
basic_callback.cpp
|
|
48
|
+
../gui/pythoninterpreter.cpp
|
|
49
|
+
../gui/pythonoutputstream.cpp)
|
|
50
|
+
target_link_libraries(basic_callback ${ENGINE_LIBRARY} ${Python_LIBRARIES})
|
|
51
|
+
|
|
52
|
+
IF (WIN32)
|
|
53
|
+
ADD_TEST(python-test bash testall)
|
|
54
|
+
ADD_TEST(python-basic bash testbasic)
|
|
55
|
+
ADD_TEST(python-sub bash testsub)
|
|
56
|
+
ADD_TEST(python-callback bash testcallback)
|
|
57
|
+
# We do not need to add the engine DLL location to the path, since
|
|
58
|
+
# regina-python (used in testall) and testbasic (directly) do this for us.
|
|
59
|
+
ELSE (WIN32)
|
|
60
|
+
ADD_TEST(python-test ./testall)
|
|
61
|
+
ADD_TEST(python-basic ./testbasic)
|
|
62
|
+
ADD_TEST(python-sub ./testsub)
|
|
63
|
+
ADD_TEST(python-callback ./testcallback)
|
|
64
|
+
ENDIF (WIN32)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<reginadata engine="4.5">
|
|
3
|
+
<packet label="Container"
|
|
4
|
+
type="Container" typeid="1"
|
|
5
|
+
parent="">
|
|
6
|
+
<packet label="O2₁"
|
|
7
|
+
type="Triangulation" typeid="3"
|
|
8
|
+
parent="Container">
|
|
9
|
+
<tetrahedra ntet="2">
|
|
10
|
+
<tet desc=""> 1 180 1 30 1 39 1 114 </tet>
|
|
11
|
+
<tet desc=""> 0 180 0 141 0 39 0 75 </tet>
|
|
12
|
+
</tetrahedra>
|
|
13
|
+
</packet> <!-- O2₁ (Triangulation) -->
|
|
14
|
+
</packet> <!-- Container (Container) -->
|
|
15
|
+
</reginadata>
|