214214#
215215# https://www.gnu.org/licenses/
216216# ****************************************************************************
217- from __future__ import annotations
217+ from pathlib import Path
218218import re
219219import sys
220220import os
@@ -463,7 +463,7 @@ def _post_process_from_file(self, s) -> str:
463463 return ''
464464 return s [i + 1 :]
465465
466- def __getattr__ (self , attrname ) -> MagmaFunction :
466+ def __getattr__ (self , attrname ):
467467 """
468468 Return a formal wrapper around a Magma function, or raise an
469469 :exc:`AttributeError` if attrname starts with an underscore.
@@ -656,7 +656,7 @@ def objgens(self, value, gens):
656656
657657 sage: R = magma.objgens('PolynomialRing(Rationals(),2)', 'alpha,beta') # optional - magma
658658 sage: R.gens() # optional - magma
659- [ alpha, beta]
659+ ( alpha, beta)
660660
661661 Because of how Magma works you can use this to change the variable
662662 names of the generators of an object::
@@ -912,16 +912,15 @@ def cputime(self, t=None):
912912 sage: # optional - magma
913913 sage: type(magma.cputime())
914914 <... 'float'>
915- sage: magma.cputime()
915+ sage: magma.cputime() # random
916916 1.9399999999999999
917917 sage: t = magma.cputime()
918- sage: magma.cputime(t)
918+ sage: magma.cputime(t) # random
919919 0.02
920920 """
921921 if t :
922922 return float (self .eval ('Cputime(%s)' % t ))
923- else :
924- return float (self .eval ('Cputime()' ))
923+ return float (self .eval ('Cputime()' ))
925924
926925 def chdir (self , dir ):
927926 """
@@ -1004,7 +1003,7 @@ def load(self, filename):
10041003
10051004 Loading a file in Magma makes all the functions and procedures in
10061005 the file available. The file should not contain any intrinsics (or
1007- you'll get errors). It also runs code in the file, which can
1006+ you will get errors). It also runs code in the file, which can
10081007 produce output.
10091008
10101009 INPUT:
@@ -1019,14 +1018,15 @@ def load(self, filename):
10191018 sage: with NTF(mode='w+t', suffix='.m') as f: # optional - magma
10201019 ....: _ = f.write('function f(n) return n^2; end function;\nprint "hi";')
10211020 ....: print(magma.load(f.name))
1022- Loading ".../a .m"
1021+ Loading "....m"
10231022 hi
10241023 sage: magma('f(12)') # optional - magma
10251024 144
10261025 """
1027- return self .eval ('load "%s"' % filename )
1026+ p = Path (filename )
1027+ return self .eval ('load "%s"' % p .absolute ())
10281028
1029- def _next_var_name (self ):
1029+ def _next_var_name (self ) -> str :
10301030 """
10311031 Return the next available variable name in Magma.
10321032
@@ -2072,14 +2072,14 @@ def AssignNames(self, names):
20722072
20732073 def gen (self , n ):
20742074 """
2075- Return the `n`-th generator of this Magma element. Note that
2076- generators are 1-based in Magma rather than 0-based!
2075+ Return the `n`-th generator of this Magma element.
2076+
2077+ Note that generators are 1-based in Magma rather than 0-based!
20772078
20782079 INPUT:
20792080
20802081 - ``n`` -- *positive* integer
20812082
2082-
20832083 OUTPUT: :class:`MagmaElement`
20842084
20852085 EXAMPLES::
@@ -2102,7 +2102,7 @@ def gen(self, n):
21022102 sage: m.gen(4) # optional -- magma
21032103 Traceback (most recent call last):
21042104 ...
2105- IndexError: list index out of range
2105+ IndexError: tuple index out of range
21062106 """
21072107 if n <= 0 :
21082108 raise IndexError ("index must be positive since Magma indexes are 1-based" )
@@ -2114,7 +2114,7 @@ def gens(self) -> tuple:
21142114
21152115 If ``self`` is named X in Magma, this function evaluates X.1, X.2,
21162116 etc., in Magma until an error occurs. It then returns a Sage tuple
2117- of the resulting X.i. Note - I don't think there is a Magma command
2117+ of the resulting X.i. Note - I do not think there is a Magma command
21182118 that returns the list of valid X.i. There are numerous ad hoc
21192119 functions for various classes but nothing systematic. This function
21202120 gets around that problem. Again, this is something that should
@@ -2296,15 +2296,15 @@ def _polynomial_(self, R):
22962296 sage: R.<x> = QQ[]
22972297 sage: f = magma(x^2 + 2/3*x + 5) # optional - magma
22982298 sage: f # optional - magma
2299- t ^2 + 2/3*t + 5
2299+ x ^2 + 2/3*x + 5
23002300 sage: f.Type() # optional - magma
23012301 RngUPolElt
23022302 sage: f._polynomial_(R) # optional - magma
23032303 x^2 + 2/3*x + 5
23042304 """
23052305 return R (list (self .Eltseq ()))
23062306
2307- def _latex_ (self ):
2307+ def _latex_ (self ) -> str :
23082308 r"""
23092309 Return latex representation of ``self``.
23102310
@@ -2856,6 +2856,7 @@ def write(self, s):
28562856 sage: P.<x,y,z> = GF(32003)[]
28572857 sage: I = sage.rings.ideal.Katsura(P)
28582858 sage: _ = I.groebner_basis('magma',prot=True) # indirect doctest, optional - magma
2859+ ...
28592860 ********************
28602861 FAUGERE F4 ALGORITHM
28612862 ********************
0 commit comments