code stringlengths 17 6.64M |
|---|
def init_subdoc(app):
'\n Init the merger depending on if we are compiling a sub-doc or the master\n doc itself.\n '
if app.config.multidocs_is_master:
logger.info(bold('Compiling the master document'))
app.connect('env-updated', merge_environment)
app.connect('html-collect-pa... |
def setup(app: Sphinx):
app.add_config_value('multidocs_is_master', True, True)
app.add_config_value('multidocs_subdoc_list', [], True)
app.add_config_value('multidoc_first_pass', 0, False)
app.connect('builder-inited', init_subdoc)
return {'parallel_read_safe': True}
|
def getdoc(obj, *args, **kwargs):
return sage_getdoc_original(obj)
|
def identity(x: Any) -> Any:
return x
|
class _All():
'A special value for ``:*-members:`` that matches to any member.'
def __contains__(self, item: Any) -> bool:
return True
def append(self, item: Any) -> None:
pass
|
class _Empty():
'A special value for :exclude-members: that never matches to any member.'
def __contains__(self, item: Any) -> bool:
return False
|
def members_option(arg: Any) -> Union[(object, List[str])]:
'Used to convert the :members: option to auto directives.'
if (arg in (None, True)):
return ALL
elif (arg is False):
return None
else:
return [x.strip() for x in arg.split(',') if x.strip()]
|
def exclude_members_option(arg: Any) -> Union[(object, Set[str])]:
'Used to convert the :exclude-members: option.'
if (arg in (None, True)):
return EMPTY
return {x.strip() for x in arg.split(',') if x.strip()}
|
def inherited_members_option(arg: Any) -> Set[str]:
'Used to convert the :inherited-members: option to auto directives.'
if (arg in (None, True)):
return {'object'}
elif arg:
return {x.strip() for x in arg.split(',')}
else:
return set()
|
def member_order_option(arg: Any) -> Optional[str]:
'Used to convert the :member-order: option to auto directives.'
if (arg in (None, True)):
return None
elif (arg in ('alphabetical', 'bysource', 'groupwise')):
return arg
else:
raise ValueError((__('invalid value for member-ord... |
def class_doc_from_option(arg: Any) -> Optional[str]:
'Used to convert the :class-doc-from: option to autoclass directives.'
if (arg in ('both', 'class', 'init')):
return arg
else:
raise ValueError((__('invalid value for class-doc-from option: %s') % arg))
|
def annotation_option(arg: Any) -> Any:
if (arg in (None, True)):
return SUPPRESS
else:
return arg
|
def bool_option(arg: Any) -> bool:
'Used to convert flag options to auto directives. (Instead of\n directives.flag(), which returns None).\n '
return True
|
def merge_members_option(options: Dict) -> None:
'Merge :private-members: and :special-members: options to the\n :members: option.\n '
if (options.get('members') is ALL):
return
members = options.setdefault('members', [])
for key in {'private-members', 'special-members'}:
if ((ke... |
def cut_lines(pre: int, post: int=0, what: str=None) -> Callable:
"Return a listener that removes the first *pre* and last *post*\n lines of every docstring. If *what* is a sequence of strings,\n only docstrings of a type in *what* will be processed.\n\n Use like this (e.g. in the ``setup()`` function o... |
def between(marker: str, what: Sequence[str]=None, keepempty: bool=False, exclude: bool=False) -> Callable:
'Return a listener that either keeps, or if *exclude* is True excludes,\n lines between lines that match the *marker* regular expression. If no line\n matches, the resulting docstring would be empty,... |
class Options(dict):
'A dict/attribute hybrid that returns None on nonexisting keys.'
def copy(self) -> 'Options':
return Options(super().copy())
def __getattr__(self, name: str) -> Any:
try:
return self[name.replace('_', '-')]
except KeyError:
return None... |
class ObjectMember(tuple):
'A member of object.\n\n This is used for the result of ``Documenter.get_object_members()`` to\n represent each member of the object.\n\n .. Note::\n\n An instance of this class behaves as a tuple of (name, object)\n for compatibility to old Sphinx. The behavior wi... |
class Documenter():
"\n A Documenter knows how to autodocument a single object type. When\n registered with the AutoDirective, it will be used to document objects\n of that type when needed by autodoc.\n\n Its *objtype* attribute selects what auto directive it is assigned to\n (the directive name ... |
class ModuleDocumenter(Documenter):
'\n Specialized Documenter subclass for modules.\n '
objtype = 'module'
content_indent = ''
titles_allowed = True
_extra_indent = ' '
option_spec: OptionSpec = {'members': members_option, 'undoc-members': bool_option, 'noindex': bool_option, 'inherit... |
class ModuleLevelDocumenter(Documenter):
'\n Specialized Documenter subclass for objects on module level (functions,\n classes, data/constants).\n '
def resolve_name(self, modname: str, parents: Any, path: str, base: Any) -> Tuple[(str, List[str])]:
if (modname is None):
if path:... |
class ClassLevelDocumenter(Documenter):
'\n Specialized Documenter subclass for objects on class level (methods,\n attributes).\n '
def resolve_name(self, modname: str, parents: Any, path: str, base: Any) -> Tuple[(str, List[str])]:
if (modname is None):
if path:
... |
class DocstringSignatureMixin():
'\n Mixin for FunctionDocumenter and MethodDocumenter to provide the\n feature of reading the signature from the docstring.\n '
_new_docstrings: List[List[str]] = None
_signatures: List[str] = None
def _find_signature(self) -> Tuple[(str, str)]:
valid... |
class DocstringStripSignatureMixin(DocstringSignatureMixin):
'\n Mixin for AttributeDocumenter to provide the\n feature of stripping any function signature from the docstring.\n '
def format_signature(self, **kwargs: Any) -> str:
if ((self.args is None) and self.config.autodoc_docstring_sign... |
class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter):
'\n Specialized Documenter subclass for functions.\n '
objtype = 'function'
member_order = 30
@classmethod
def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any) -> bool:
if (is_... |
class DecoratorDocumenter(FunctionDocumenter):
'\n Specialized Documenter subclass for decorator functions.\n '
objtype = 'decorator'
priority = (- 1)
def format_args(self, **kwargs: Any) -> Any:
args = super().format_args(**kwargs)
if (',' in args):
return args
... |
class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter):
'\n Specialized Documenter subclass for classes.\n '
objtype = 'class'
member_order = 20
option_spec: OptionSpec = {'members': members_option, 'undoc-members': bool_option, 'noindex': bool_option, 'inherited-members': inherit... |
class ExceptionDocumenter(ClassDocumenter):
'\n Specialized ClassDocumenter subclass for exceptions.\n '
objtype = 'exception'
member_order = 10
priority = 10
@classmethod
def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any) -> bool:
return (isin... |
class DataDocumenterMixinBase():
config: Config = None
env: BuildEnvironment = None
modname: str = None
parent: Any = None
object: Any = None
objpath: List[str] = None
def should_suppress_directive_header(self) -> bool:
'Check directive header should be suppressed.'
return... |
class GenericAliasMixin(DataDocumenterMixinBase):
'\n Mixin for DataDocumenter and AttributeDocumenter to provide the feature for\n supporting GenericAliases.\n '
def should_suppress_directive_header(self) -> bool:
return (inspect.isgenericalias(self.object) or super().should_suppress_direct... |
class NewTypeMixin(DataDocumenterMixinBase):
'\n Mixin for DataDocumenter and AttributeDocumenter to provide the feature for\n supporting NewTypes.\n '
def should_suppress_directive_header(self) -> bool:
return (inspect.isNewType(self.object) or super().should_suppress_directive_header())
... |
class TypeVarMixin(DataDocumenterMixinBase):
'\n Mixin for DataDocumenter and AttributeDocumenter to provide the feature for\n supporting TypeVars.\n '
def should_suppress_directive_header(self) -> bool:
return (isinstance(self.object, TypeVar) or super().should_suppress_directive_header())
... |
class UninitializedGlobalVariableMixin(DataDocumenterMixinBase):
'\n Mixin for DataDocumenter to provide the feature for supporting uninitialized\n (type annotation only) global variables.\n '
def import_object(self, raiseerror: bool=False) -> bool:
try:
return super().import_obj... |
class DataDocumenter(GenericAliasMixin, NewTypeMixin, TypeVarMixin, UninitializedGlobalVariableMixin, ModuleLevelDocumenter):
'\n Specialized Documenter subclass for data items.\n '
objtype = 'data'
member_order = 40
priority = (- 10)
option_spec: OptionSpec = dict(ModuleLevelDocumenter.opti... |
class NewTypeDataDocumenter(DataDocumenter):
'\n Specialized Documenter subclass for NewTypes.\n\n Note: This must be invoked before FunctionDocumenter because NewType is a kind of\n function object.\n '
objtype = 'newtypedata'
directivetype = 'data'
priority = (FunctionDocumenter.priority... |
class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter):
'\n Specialized Documenter subclass for methods (normal, static and class).\n '
objtype = 'method'
directivetype = 'method'
member_order = 50
priority = 1
@classmethod
def can_document_member(cls, member: Any, me... |
class NonDataDescriptorMixin(DataDocumenterMixinBase):
'\n Mixin for AttributeDocumenter to provide the feature for supporting non\n data-descriptors.\n\n .. note:: This mix-in must be inherited after other mix-ins. Otherwise, docstring\n and :value: header will be suppressed unexpectedly.\... |
class SlotsMixin(DataDocumenterMixinBase):
'\n Mixin for AttributeDocumenter to provide the feature for supporting __slots__.\n '
def isslotsattribute(self) -> bool:
'Check the subject is an attribute in __slots__.'
try:
__slots__ = inspect.getslots(self.parent)
... |
class RuntimeInstanceAttributeMixin(DataDocumenterMixinBase):
'\n Mixin for AttributeDocumenter to provide the feature for supporting runtime\n instance attributes (that are defined in __init__() methods with doc-comments).\n\n Example:\n\n class Foo:\n def __init__(self):\n ... |
class UninitializedInstanceAttributeMixin(DataDocumenterMixinBase):
'\n Mixin for AttributeDocumenter to provide the feature for supporting uninitialized\n instance attributes (PEP-526 styled, annotation only attributes).\n\n Example:\n\n class Foo:\n attr: int #: This is a target of t... |
class AttributeDocumenter(GenericAliasMixin, NewTypeMixin, SlotsMixin, TypeVarMixin, RuntimeInstanceAttributeMixin, UninitializedInstanceAttributeMixin, NonDataDescriptorMixin, DocstringStripSignatureMixin, ClassLevelDocumenter):
'\n Specialized Documenter subclass for attributes.\n '
objtype = 'attribu... |
class PropertyDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter):
'\n Specialized Documenter subclass for properties.\n '
objtype = 'property'
member_order = 60
priority = (AttributeDocumenter.priority + 1)
@classmethod
def can_document_member(cls, member: Any, membername: s... |
class NewTypeAttributeDocumenter(AttributeDocumenter):
'\n Specialized Documenter subclass for NewTypes.\n\n Note: This must be invoked before MethodDocumenter because NewType is a kind of\n function object.\n '
objtype = 'newvarattribute'
directivetype = 'attribute'
priority = (MethodDocu... |
def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs: Any) -> Any:
'Alternative getattr() for types'
for (typ, func) in app.registry.autodoc_attrgettrs.items():
if isinstance(obj, typ):
return func(obj, name, *defargs)
return safe_getattr(obj, name, *defargs)
|
def setup(app: Sphinx) -> Dict[(str, Any)]:
app.add_autodocumenter(ModuleDocumenter)
app.add_autodocumenter(ClassDocumenter)
app.add_autodocumenter(ExceptionDocumenter)
app.add_autodocumenter(DataDocumenter)
app.add_autodocumenter(NewTypeDataDocumenter)
app.add_autodocumenter(FunctionDocumente... |
def term_width_line(text):
return (text + '\n')
|
class SageSphinxLogger():
'\n This implements the file object interface to serve as\n ``sys.stdout``/``sys.stderr`` replacement.\n '
ansi_color = re.compile('\\x1b\\[[0-9;]*m')
ansi_reset = re.compile('\\x1b\\[39;49;00m')
prefix_len = 9
def __init__(self, stream, prefix):
self._i... |
def runsphinx():
output_dir = sys.argv[(- 1)]
saved_stdout = sys.stdout
saved_stderr = sys.stderr
try:
sys.stdout = SageSphinxLogger(sys.stdout, os.path.basename(output_dir))
sys.stderr = SageSphinxLogger(sys.stderr, os.path.basename(output_dir))
sphinx.cmd.build.main(sys.argv[... |
class RemoteException(Exception):
'\n Raised if an exception occurred in one of the child processes.\n '
tb: str
def __init__(self, tb: str):
'\n Initialize the exception.\n\n INPUT:\n\n - ``tb`` -- the traceback of the exception.\n '
self.tb = tb
de... |
class RemoteExceptionWrapper():
'\n Used by child processes to capture exceptions thrown during execution and\n report them to the main process, including the correct traceback.\n '
exc: BaseException
tb: str
def __init__(self, exc: BaseException):
'\n Initialize the exception... |
class WorkerDiedException(RuntimeError):
'Raised if a worker process dies unexpected.'
original_exception: Optional[BaseException]
def __init__(self, message: Optional[str], original_exception: Optional[BaseException]=None):
super().__init__(message)
self.original_exception = original_exc... |
def build_many(target, args, processes=None):
'\n Map a list of arguments in ``args`` to a single-argument target function\n ``target`` in parallel using ``multiprocessing.cpu_count()`` (or\n ``processes`` if given) simultaneous processes.\n\n This is a simplified version of ``multiprocessing.Pool.map... |
def autogen_all():
'\n Regenerate the automatically generated files of the Sage library.\n\n Return a list of sub-packages that should be appended to the list\n of packages built/installed by setup.py.\n '
from sage.env import SAGE_SRC
interpreters.rebuild(os.path.join(SAGE_SRC, 'sage', 'ext',... |
def build_interp(interp_spec, dir):
"\n Given an InterpreterSpec, write the C interpreter and the Cython\n wrapper (generate a pyx and a pxd file).\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.rdf import RDFInterpr... |
def rebuild(dirname, force=False, interpreters=None, distribution=None):
'\n Check whether the interpreter and wrapper sources have been written\n since the last time this module was changed. If not, write them.\n\n INPUT:\n\n - ``dirname`` -- name of the target directory for the generated sources\n\... |
class InterpreterGenerator(object):
'\n This class takes an InterpreterSpec and generates the corresponding\n C interpreter and Cython wrapper.\n\n See the documentation for methods get_wrapper and get_interpreter\n for more information.\n '
def __init__(self, spec):
'\n Initial... |
def params_gen(**chunks):
"\n Instructions have a parameter specification that says where they get\n their inputs and where their outputs go. Each parameter has\n the same form: it is a triple (chunk, addr, len). The chunk says\n where the parameter is read from/written to. The addr says which\n ... |
class InstrSpec(object):
"\n Each instruction in an interpreter is represented as an InstrSpec.\n This contains all the information that we need to generate code\n to interpret the instruction; it also is used to build the tables\n that fast_callable uses, so this is the nexus point between\n users... |
def instr_infix(name, io, op):
"\n A helper function for creating instructions implemented by\n a single infix binary operator.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.rdf import RDFInterpreter\n sage: ... |
def instr_funcall_2args(name, io, op):
"\n A helper function for creating instructions implemented by\n a two-argument function call.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.rdf import RDFInterpreter\n ... |
def instr_unary(name, io, op):
"\n A helper function for creating instructions with one input\n and one output.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.rdf import RDFInterpreter\n sage: pg = RDFInterpre... |
def instr_funcall_2args_mpfr(name, io, op):
"\n A helper function for creating MPFR instructions with two inputs\n and one output.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.rr import RRInterpreter\n sage:... |
def instr_funcall_1arg_mpfr(name, io, op):
"\n A helper function for creating MPFR instructions with one input\n and one output.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.rr import RRInterpreter\n sage: p... |
def instr_funcall_2args_mpc(name, io, op):
"\n A helper function for creating MPC instructions with two inputs\n and one output.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.cc import CCInterpreter\n sage: p... |
def instr_funcall_1arg_mpc(name, io, op):
"\n A helper function for creating MPC instructions with one input\n and one output.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: from sage_setup.autogen.interpreters.specs.cc import CCInterpreter\n sage: pg ... |
def string_of_addr(a):
"\n An address or a length from a parameter specification may be\n either None, an integer, or a MemoryChunk. If the address or\n length is an integer or a MemoryChunk, this function will convert\n it to a string giving an expression that will evaluate to the correct\n addre... |
class MemoryChunk(object):
'\n Memory chunks control allocation, deallocation, initialization,\n etc. of the vectors and objects in the interpreter. Basically,\n there is one memory chunk per argument to the C interpreter.\n\n There are three "generic" varieties of memory chunk: "constants",\n "a... |
class MemoryChunkLonglivedArray(MemoryChunk):
'\n MemoryChunkLonglivedArray is a subtype of MemoryChunk that deals\n with memory chunks that are both 1) allocated as class members (rather\n than being allocated in __call__) and 2) are arrays.\n '
def init_class_members(self):
"\n R... |
class MemoryChunkConstants(MemoryChunkLonglivedArray):
"\n MemoryChunkConstants is a subtype of MemoryChunkLonglivedArray.\n\n MemoryChunkConstants chunks have their contents set in the\n wrapper's __init__ method (and not changed afterward).\n "
def init_class_members(self):
"\n R... |
class MemoryChunkArguments(MemoryChunkLonglivedArray):
"\n MemoryChunkArguments is a subtype of MemoryChunkLonglivedArray,\n for dealing with arguments to the wrapper's ``__call__`` method.\n\n Currently the ``__call__`` method is declared to take a varargs\n `*args` argument tuple. We assume that th... |
class MemoryChunkScratch(MemoryChunkLonglivedArray):
'\n MemoryChunkScratch is a subtype of MemoryChunkLonglivedArray\n for dealing with memory chunks that are allocated in the wrapper,\n but only used in the interpreter -- stacks, scratch registers, etc.\n\n (Currently these are only used as stacks.)... |
class InterpreterSpec(object):
'\n Each interpreter to be generated by this module is represented\n by an InterpreterSpec.\n '
name = ''
def __init__(self):
"\n Initialize an InterpreterSpec.\n\n Initializes the following fields:\n\n - ``c_header`` -- a code snippet ... |
class StackInterpreter(InterpreterSpec):
'\n A subclass of InterpreterSpec, specialized for stack-based\n interpreters. (Currently all interpreters are stack-based.)\n '
def __init__(self, type, mc_retval=None):
"\n Initialize a StackInterpreter.\n\n INPUT:\n\n - type -... |
class MemoryChunkCCRetval(MemoryChunk):
'\n A special-purpose memory chunk, for dealing with the return value\n of the CC-based interpreter.\n '
def declare_class_members(self):
"\n Return a string giving the declarations of the class members\n in a wrapper class for this memor... |
class CCInterpreter(StackInterpreter):
'\n A subclass of StackInterpreter, specifying an interpreter over\n MPFR arbitrary-precision floating-point numbers.\n '
name = 'cc'
def __init__(self):
'\n Initialize a CCInterpreter.\n\n EXAMPLES::\n\n sage: from sage_set... |
class CDFInterpreter(StackInterpreter):
'\n A subclass of StackInterpreter, specifying an interpreter over\n complex machine-floating-point values (C doubles).\n '
name = 'cdf'
def __init__(self):
"\n Initialize a CDFInterpreter.\n\n EXAMPLES::\n\n sage: from sag... |
class MemoryChunkElementArguments(MemoryChunkPythonArguments):
"\n A special-purpose memory chunk, for the Python-object based\n interpreters that want to process (and perhaps modify) the data.\n\n We allocate a new list on every call to hold the modified arguments.\n That's not strictly necessary -- ... |
class ElementInterpreter(PythonInterpreter):
'\n A subclass of PythonInterpreter, specifying an interpreter over\n Sage elements with a particular parent.\n\n This is very similar to the PythonInterpreter, but after every\n instruction, the result is checked to make sure it actually an\n element wi... |
class MemoryChunkPythonArguments(MemoryChunk):
"\n A special-purpose memory chunk, for the generic Python-object based\n interpreter. Rather than copy the arguments into an array allocated\n in the wrapper, we use the PyTupleObject internals and pass the array\n that's inside the argument tuple.\n ... |
class MemoryChunkPyConstant(MemoryChunk):
'\n A special-purpose memory chunk, for holding a single Python constant\n and passing it to the interpreter as a PyObject*.\n '
def __init__(self, name):
"\n Initialize an instance of MemoryChunkPyConstant.\n\n Always uses the type ty_... |
class PythonInterpreter(StackInterpreter):
"\n A subclass of StackInterpreter, specifying an interpreter over\n Python objects.\n\n Let's discuss how the reference-counting works in Python-object\n based interpreters.\n\n There is a simple rule to remember: when executing the code\n snippets, th... |
class RDFInterpreter(StackInterpreter):
'\n A subclass of StackInterpreter, specifying an interpreter over\n machine-floating-point values (C doubles). This is used for\n both domain=RDF and domain=float; currently the only difference\n between the two is the type of the value returned from the\n ... |
class MemoryChunkRRRetval(MemoryChunk):
'\n A special-purpose memory chunk, for dealing with the return value\n of the RR-based interpreter.\n '
def declare_class_members(self):
"\n Return a string giving the declarations of the class members\n in a wrapper class for this memor... |
class RRInterpreter(StackInterpreter):
'\n A subclass of StackInterpreter, specifying an interpreter over\n MPFR arbitrary-precision floating-point numbers.\n '
name = 'rr'
def __init__(self):
'\n Initialize an RDFInterpreter.\n\n EXAMPLES::\n\n sage: from sage_s... |
class StorageType(object):
'\n A StorageType specifies the C types used to deal with values of a\n given type.\n\n We currently support three categories of types.\n\n First are the "simple" types. These are types where: the\n representation is small, functions expect arguments to be passed\n by... |
class StorageTypeAssignable(StorageType):
'\n StorageTypeAssignable is a subtype of StorageType that deals with\n types with cheap copies, like primitive types and PyObject*.\n '
def __init__(self, ty):
"\n Initializes the property type (the C/Cython name for this type),\n as w... |
class StorageTypeSimple(StorageTypeAssignable):
'\n StorageTypeSimple is a subtype of StorageTypeAssignable that deals\n with non-reference-counted types with cheap copies, like primitive\n types. As of yet, it has no functionality differences from\n StorageTypeAssignable.\n '
pass
|
class StorageTypeDoubleComplex(StorageTypeSimple):
'\n This is specific to the complex double type. It behaves exactly\n like a StorageTypeSimple in C, but needs a little help to do\n conversions in Cython.\n\n This uses functions defined in CDFInterpreter, and is for use in\n that context.\n '
... |
class StorageTypePython(StorageTypeAssignable):
"\n StorageTypePython is a subtype of StorageTypeAssignable that deals\n with Python objects.\n\n Just allocating an array full of PyObject* leads to problems,\n because the Python garbage collector must be able to get to every\n Python object, and it... |
class StorageTypeAutoReference(StorageType):
'\n StorageTypeAutoReference is a subtype of StorageType that deals with\n types in the style of GMP/MPIR/MPFR/MPFI/FLINT, where copies are\n not cheap, functions expect arguments to be passed by reference,\n and the API takes advantage of the C quirk where... |
class StorageTypeMPFR(StorageTypeAutoReference):
"\n StorageTypeMPFR is a subtype of StorageTypeAutoReference that deals\n the MPFR's mpfr_t type.\n\n For any given program that we're interpreting, ty_mpfr can only\n refer to a single precision. An interpreter that needs to use\n two precisions of... |
class StorageTypeMPC(StorageTypeAutoReference):
"\n StorageTypeMPC is a subtype of StorageTypeAutoReference that deals\n the MPC's mpc_t type.\n\n For any given program that we're interpreting, ty_mpc can only\n refer to a single precision. An interpreter that needs to use\n two precisions of mpc_... |
def je(template, **kwargs):
'\n A convenience method for creating strings with Jinja templates.\n\n The name je stands for "Jinja evaluate".\n\n The first argument is the template string; remaining keyword\n arguments define Jinja variables.\n\n If the first character in the template string is a ne... |
def indent_lines(n, text):
'\n Indent each line in text by ``n`` spaces.\n\n INPUT:\n\n - ``n`` -- indentation amount\n - ``text`` -- text to indent\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import indent_lines\n sage: indent_lines(3, "foo")\n \' foo\'\n ... |
def reindent_lines(n, text):
'\n Strip any existing indentation on the given text (while keeping\n relative indentation) then re-indents the text by ``n`` spaces.\n\n INPUT:\n\n - ``n`` -- indentation amount\n - ``text`` -- text to indent\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.i... |
def write_if_changed(fn, value):
"\n Write value to the file named fn, if value is different than\n the current contents.\n\n EXAMPLES::\n\n sage: from sage_setup.autogen.interpreters import *\n sage: def last_modification(fn): return os.stat(fn).st_mtime\n sage: fn = tmp_filename('g... |
def _remove(file_set, module_base, to_remove):
"\n Helper to remove files from a set of filenames.\n\n INPUT:\n\n - ``file_set`` -- a set of filenames.\n\n - ``module_base`` -- string. Name of a Python package/module.\n\n - ``to_remove`` -- list/tuple/iterable of strings. Either\n filenames or... |
def _find_stale_files(site_packages, python_packages, python_modules, ext_modules, data_files, nobase_data_files=()):
"\n Find stale files\n\n This method lists all files installed and then subtracts the ones\n which are intentionally being installed.\n\n EXAMPLES:\n\n It is crucial that only truly... |
def clean_install_dir(site_packages, python_packages, python_modules, ext_modules, data_files, nobase_data_files, *, distributions=None, exclude_distributions=None):
"\n Delete all modules that are **not** being installed\n\n If you switch branches it is common to (re)move the source for an\n already ins... |
class sage_build_cython(Command):
name = 'build_cython'
description = 'compile Cython extensions into C/C++ extensions'
user_options = [('profile', 'p', 'enable Cython profiling support'), ('parallel=', 'j', 'run cythonize in parallel with N processes'), ('force=', 'f', 'force files to be cythonized even ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.