221221
222222from sage .structure .parent import Parent
223223from .expect import Expect , ExpectElement , ExpectFunction , FunctionElement
224- PROMPT = ">>>"
225-
226- SAGE_REF = "_sage_ref"
227- SAGE_REF_RE = re .compile (r'%s\d+' % SAGE_REF )
228-
229224from sage .env import SAGE_EXTCODE , DOT_SAGE
230225import sage .misc .misc
231226import sage .misc .sage_eval
232227import sage .interfaces .abc
233228from sage .interfaces .tab_completion import ExtraTabCompletion
234229from sage .misc .instancedoc import instancedoc
235230
231+ PROMPT = ">>>"
232+
233+ SAGE_REF = "_sage_ref"
234+ SAGE_REF_RE = re .compile (r'%s\d+' % SAGE_REF )
235+
236236INTRINSIC_CACHE = '%s/magma_intrinsic_cache.sobj' % DOT_SAGE
237237EXTCODE_DIR = None
238238
239239
240- def extcode_dir (iface = None ):
240+ def extcode_dir (iface = None ) -> str :
241241 """
242- Return directory that contains all the Magma extcode. This is put
243- in a writable directory owned by the user, since when attached,
244- Magma has to write sig and lck files.
242+ Return directory that contains all the Magma extcode.
243+
244+ This is put in a writable directory owned by the user, since when
245+ attached, Magma has to write sig and lck files.
245246
246247 EXAMPLES::
247248
@@ -413,7 +414,7 @@ def __reduce__(self):
413414 """
414415 return reduce_load_Magma , tuple ([])
415416
416- def _read_in_file_command (self , filename ):
417+ def _read_in_file_command (self , filename ) -> str :
417418 """
418419 Return the command in Magma that reads in the contents of the given
419420 file.
@@ -433,7 +434,7 @@ def _read_in_file_command(self, filename):
433434 """
434435 return 'load "%s";' % filename
435436
436- def _post_process_from_file (self , s ):
437+ def _post_process_from_file (self , s ) -> str :
437438 r"""
438439 Used internally in the Magma interface to post-process the result
439440 of evaluating a string using a file. For Magma what this does is
@@ -462,7 +463,7 @@ def _post_process_from_file(self, s):
462463 return ''
463464 return s [i + 1 :]
464465
465- def __getattr__ (self , attrname ):
466+ def __getattr__ (self , attrname ) -> MagmaFunction :
466467 """
467468 Return a formal wrapper around a Magma function, or raise an
468469 :exc:`AttributeError` if attrname starts with an underscore.
@@ -494,7 +495,7 @@ def __getattr__(self, attrname):
494495 raise AttributeError
495496 return MagmaFunction (self , attrname )
496497
497- def eval (self , x , strip = True , ** kwds ):
498+ def eval (self , x , strip = True , ** kwds ) -> str :
498499 """
499500 Evaluate the given block x of code in Magma and return the output
500501 as a string.
@@ -553,7 +554,7 @@ def eval(self, x, strip=True, **kwds):
553554 raise RuntimeError ("Error evaluating Magma code.\n IN:%s\n OUT:%s" % (x , ans ))
554555 return ans
555556
556- def _preparse (self , s ):
557+ def _preparse (self , s ) -> str :
557558 """
558559 All input gets preparsed by calling this function before it gets evaluated.
559560
@@ -578,7 +579,7 @@ def _preparse(self, s):
578579 pass
579580 return s
580581
581- def _start (self ):
582+ def _start (self ) -> None :
582583 """
583584 Initialize a Magma interface instance. This involves (1) setting up
584585 an obfuscated prompt, and (2) attaching the MAGMA_SPEC file (see
@@ -619,7 +620,7 @@ def set(self, var, value):
619620 if out .lower ().find ("error" ) != - 1 :
620621 raise TypeError ("Error executing Magma code:\n %s" % out )
621622
622- def get (self , var ):
623+ def get (self , var ) -> str :
623624 """
624625 Get the value of the variable var.
625626
@@ -1880,10 +1881,11 @@ def __getattr__(self, attrname):
18801881
18811882 def _sage_ (self ):
18821883 """
1883- Return Sage version of this object. Use self.sage() to get the Sage
1884- version.
1884+ Return Sage version of this object.
1885+
1886+ Use self.sage() to get the Sage version.
18851887
1886- Edit src/ext/ magma/sage/basic.m to add functionality.
1888+ Edit `` src/sage/ext_data/ magma/sage/basic.m`` to add functionality.
18871889
18881890 EXAMPLES: Enumerated Sets::
18891891
0 commit comments