code stringlengths 17 6.64M |
|---|
def standardize_face_maps(*L):
'\n Return list of indices of face maps in standard (non-increasing)\n order.\n\n INPUT:\n\n - ``L`` -- list of integers, representing a composition of\n face maps in a simplicial set.\n\n OUTPUT:\n\n an equivalent list of face maps, standardized to be\n wr... |
def face_degeneracies(m, I):
'\n Return the result of applying the face map `d_m` to the iterated\n degeneracy `s_I = s_{i_1} s_{i_2} ... s_{i_n}`.\n\n INPUT:\n\n - ``m`` -- integer\n - ``I`` -- tuple ``(i_1, i_2, ..., i_n)`` of integers. We assume\n that this sequence is strictly decreasing.\... |
def shrink_simplicial_complex(K):
'\n Convert the simplicial complex ``K`` to a "small" simplicial set.\n\n First convert ``K`` naively, then mod out by a large contractible\n subcomplex, as found by\n :meth:`.simplicial_complex.SimplicialComplex._contractible_subcomplex`.\n This will produce a sim... |
class SubSimplicialSet(SimplicialSet_finite, UniqueRepresentation):
@staticmethod
def __classcall__(self, data, ambient=None):
'\n Convert ``data`` from a dict to a tuple.\n\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import SubSimplicialSet\n ... |
class PullbackOfSimplicialSets(SimplicialSet_arbitrary, UniqueRepresentation):
@staticmethod
def __classcall_private__(self, maps=None):
'\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import PullbackOfSimplicialSets\n sage: S2 = simplicial_sets.Sphe... |
class PullbackOfSimplicialSets_finite(PullbackOfSimplicialSets, SimplicialSet_finite):
"\n The pullback of finite simplicial sets obtained from ``maps``.\n\n When the simplicial sets involved are all finite, there are more\n methods available to the resulting pullback, as compared to case\n when some ... |
class Factors():
'\n Classes which inherit from this should define a ``_factors``\n attribute for their instances, and this class accesses that\n attribute. This is used by :class:`ProductOfSimplicialSets`,\n :class:`WedgeOfSimplicialSets`, and\n :class:`DisjointUnionOfSimplicialSets`.\n '
... |
class ProductOfSimplicialSets(PullbackOfSimplicialSets, Factors):
@staticmethod
def __classcall__(cls, factors=None):
'\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import ProductOfSimplicialSets\n sage: S2 = simplicial_sets.Sphere(2)\n s... |
class ProductOfSimplicialSets_finite(ProductOfSimplicialSets, PullbackOfSimplicialSets_finite):
'\n The product of finite simplicial sets.\n\n When the factors are all finite, there are more methods available\n for the resulting product, as compared to products with infinite\n factors: projection maps... |
class PushoutOfSimplicialSets(SimplicialSet_arbitrary, UniqueRepresentation):
@staticmethod
def __classcall_private__(cls, maps=None, vertex_name=None):
'\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import PushoutOfSimplicialSets\n sage: S2 = simpl... |
class PushoutOfSimplicialSets_finite(PushoutOfSimplicialSets, SimplicialSet_finite):
"\n The pushout of finite simplicial sets obtained from ``maps``.\n\n When the simplicial sets involved are all finite, there are more\n methods available to the resulting pushout, as compared to case\n when some of t... |
class QuotientOfSimplicialSet(PushoutOfSimplicialSets):
def __init__(self, inclusion, vertex_name='*'):
"\n Return the quotient of a simplicial set by a subsimplicial set.\n\n INPUT:\n\n - ``inclusion`` -- inclusion map of a subcomplex (=\n subsimplicial set) of a simplicial... |
class QuotientOfSimplicialSet_finite(QuotientOfSimplicialSet, PushoutOfSimplicialSets_finite):
'\n The quotient of finite simplicial sets.\n\n When the simplicial sets involved are finite, there is a\n :meth:`quotient_map` method available.\n '
def __init__(self, inclusion, vertex_name='*'):
... |
class SmashProductOfSimplicialSets_finite(QuotientOfSimplicialSet_finite, Factors):
@staticmethod
def __classcall__(cls, factors=None):
'\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import SmashProductOfSimplicialSets_finite as Smash\n sage: S2 = s... |
class WedgeOfSimplicialSets(PushoutOfSimplicialSets, Factors):
@staticmethod
def __classcall__(cls, factors=None):
'\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import WedgeOfSimplicialSets\n sage: S2 = simplicial_sets.Sphere(2)\n sage: ... |
class WedgeOfSimplicialSets_finite(WedgeOfSimplicialSets, PushoutOfSimplicialSets_finite):
'\n The wedge sum of finite pointed simplicial sets.\n '
def __init__(self, factors=None):
'\n Return the wedge sum of finite pointed simplicial sets.\n\n INPUT:\n\n - ``factors`` -- ... |
class DisjointUnionOfSimplicialSets(PushoutOfSimplicialSets, Factors):
@staticmethod
def __classcall__(cls, factors=None):
'\n TESTS::\n\n sage: from sage.topology.simplicial_set_constructions import DisjointUnionOfSimplicialSets\n sage: from sage.topology.simplicial_set_... |
class DisjointUnionOfSimplicialSets_finite(DisjointUnionOfSimplicialSets, PushoutOfSimplicialSets_finite):
'\n The disjoint union of finite simplicial sets.\n '
def __init__(self, factors=None):
'\n Return the disjoint union of finite simplicial sets.\n\n INPUT:\n\n - ``fac... |
class ConeOfSimplicialSet(SimplicialSet_arbitrary, UniqueRepresentation):
def __init__(self, base):
"\n Return the unreduced cone on a finite simplicial set.\n\n INPUT:\n\n - ``base`` -- return the cone on this simplicial set.\n\n Add a point `*` (which will become the base po... |
class ConeOfSimplicialSet_finite(ConeOfSimplicialSet, SimplicialSet_finite):
def __init__(self, base):
"\n Return the unreduced cone on a finite simplicial set.\n\n INPUT:\n\n - ``base`` -- return the cone on this simplicial set.\n\n Add a point `*` (which will become the base... |
class ReducedConeOfSimplicialSet(QuotientOfSimplicialSet):
def __init__(self, base):
"\n Return the reduced cone on a simplicial set.\n\n INPUT:\n\n - ``base`` -- return the cone on this simplicial set.\n\n Start with the unreduced cone: take ``base`` and add a point\n ... |
class ReducedConeOfSimplicialSet_finite(ReducedConeOfSimplicialSet, QuotientOfSimplicialSet_finite):
def __init__(self, base):
"\n Return the reduced cone on a simplicial set.\n\n INPUT:\n\n - ``base`` -- return the cone on this simplicial set.\n\n Start with the unreduced con... |
class SuspensionOfSimplicialSet(SimplicialSet_arbitrary, UniqueRepresentation):
def __init__(self, base):
'\n Return the (reduced) suspension of a simplicial set.\n\n INPUT:\n\n - ``base`` -- return the suspension of this simplicial set.\n\n If this simplicial set ``X=base`` i... |
class SuspensionOfSimplicialSet_finite(SuspensionOfSimplicialSet, QuotientOfSimplicialSet_finite):
'\n The (reduced) suspension of a finite simplicial set.\n\n See :class:`SuspensionOfSimplicialSet` for more information.\n '
def __init__(self, base):
'\n INPUT:\n\n - ``base`` -... |
class Nerve(SimplicialSet_arbitrary):
def __init__(self, monoid):
'\n The nerve of a multiplicative monoid.\n\n INPUT:\n\n - ``monoid`` -- a multiplicative monoid\n\n See\n :meth:`sage.categories.finite_monoids.FiniteMonoids.ParentMethods.nerve`\n for full docume... |
def Sphere(n):
'\n Return the `n`-sphere as a simplicial set.\n\n It is constructed with two non-degenerate simplices: a vertex\n `v_0` (which is the base point) and an `n`-simplex `\\sigma_n`.\n\n INPUT:\n\n - ``n`` -- integer\n\n EXAMPLES::\n\n sage: S0 = simplicial_sets.Sphere(0)\n ... |
def ClassifyingSpace(group):
'\n Return the classifying space of ``group``, as a simplicial set.\n\n INPUT:\n\n - ``group`` -- a finite group or finite monoid\n\n See\n :meth:`sage.categories.finite_monoids.FiniteMonoids.ParentMethods.nerve`\n for more details and more examples.\n\n EXAMPLES:... |
def RealProjectiveSpace(n):
'\n Return real `n`-dimensional projective space, as a simplicial set.\n\n This is constructed as the `n`-skeleton of the nerve of the group\n of order 2, and therefore has a single non-degenerate simplex in\n each dimension up to `n`.\n\n EXAMPLES::\n\n sage: # n... |
def KleinBottle():
'\n Return the Klein bottle as a simplicial set.\n\n This converts the `\\Delta`-complex version to a simplicial set. It\n has one 0-simplex, three 1-simplices, and two 2-simplices.\n\n EXAMPLES::\n\n sage: K = simplicial_sets.KleinBottle()\n sage: K.f_vector()\n ... |
def Torus():
'\n Return the torus as a simplicial set.\n\n This computes the product of the circle with itself, where the\n circle is represented using a single 0-simplex and a single\n 1-simplex. Thus it has one 0-simplex, three 1-simplices, and two\n 2-simplices.\n\n EXAMPLES::\n\n sage... |
def Simplex(n):
'\n Return the `n`-simplex as a simplicial set.\n\n EXAMPLES::\n\n sage: K = simplicial_sets.Simplex(2)\n sage: K\n 2-simplex\n sage: latex(K)\n \\Delta^{2}\n sage: K.n_cells(0)\n [(0,), (1,), (2,)]\n sage: K.n_cells(1)\n [(0, 1)... |
@cached_function
def Empty():
'\n Return the empty simplicial set.\n\n This should return the same simplicial set each time it is called.\n\n EXAMPLES::\n\n sage: from sage.topology.simplicial_set_examples import Empty\n sage: E = Empty()\n sage: E\n Empty simplicial set\n ... |
@cached_function
def Point():
'\n Return a single point called "*" as a simplicial set.\n\n This should return the same simplicial set each time it is called.\n\n EXAMPLES::\n\n sage: P = simplicial_sets.Point()\n sage: P.is_pointed()\n True\n sage: P.nondegenerate_simplices()... |
def Horn(n, k):
'\n Return the horn `\\Lambda^n_k`.\n\n This is the subsimplicial set of the `n`-simplex obtained by\n removing its `k`-th face.\n\n EXAMPLES::\n\n sage: L = simplicial_sets.Horn(3, 0)\n sage: L\n (3, 0)-Horn\n sage: L.n_cells(3)\n []\n sage: L... |
def ComplexProjectiveSpace(n):
'\n Return complex `n`-dimensional projective space, as a simplicial set.\n\n This is only defined when `n` is at most 4. It is constructed\n using the simplicial set decomposition provided by Kenzo, as\n described by Sergeraert [Ser2010]_\n\n EXAMPLES::\n\n sa... |
def simplicial_data_from_kenzo_output(filename):
"\n Return data to construct a simplicial set, given Kenzo output.\n\n INPUT:\n\n - ``filename`` -- name of file containing the output from Kenzo's\n :func:`show-structure` function\n\n OUTPUT: data to construct a simplicial set from the Kenzo outp... |
def HopfMap():
'\n Return a simplicial model of the Hopf map `S^3 \\to S^2`\n\n This is taken from Exemple II.1.19 in the thesis of Clemens Berger\n [Ber1991]_.\n\n The Hopf map is a fibration `S^3 \\to S^2`. If it is viewed as\n attaching a 4-cell to the 2-sphere, the resulting adjunction space\n ... |
def PresentationComplex(G):
'\n Return a simplicial set constructed from a group presentation.\n The result is a subdivision of the presentation complex.\n\n The presentation complex has a single vertex and it has one edge for\n each generator. Then triangles (and eventually new edges\n to glue the... |
class SimplicialSetHomset(Homset):
"\n A set of morphisms between simplicial sets.\n\n Once a homset has been constructed in Sage, typically via\n ``Hom(X,Y)`` or ``X.Hom(Y)``, one can use it to construct a\n morphism `f` by specifying a dictionary, the keys of which are the\n nondegenerate simplic... |
class SimplicialSetMorphism(Morphism):
def __init__(self, data=None, domain=None, codomain=None, constant=None, identity=False, check=True):
'\n Return a morphism of simplicial sets.\n\n INPUT:\n\n - ``data`` -- optional. Dictionary defining the map.\n - ``domain`` -- simplici... |
class AsciiArt(CharacterArt):
"\n An Ascii art object is an object with some specific representation for\n *printing*.\n\n INPUT:\n\n - ``lines`` -- the list of lines of the representation of the ascii art\n object\n\n - ``breakpoints`` -- the list of points where the representation can be\n ... |
def ascii_art(*obj, **kwds):
"\n Return an ASCII art representation\n\n INPUT:\n\n - ``*obj`` -- any number of positional arguments, of arbitrary\n type. The objects whose ascii art representation we want.\n\n - ``sep`` -- optional ``'sep=...'`` keyword argument (or ``'separator'``).\n Anyth... |
class CharacterArt(SageObject):
def __init__(self, lines=[], breakpoints=[], baseline=None):
'\n Abstract base class for character art\n\n INPUT:\n\n - ``lines`` -- the list of lines of the representation of the\n character art object\n\n - ``breakpoints`` -- the list... |
def _shifted_breakpoints(breakpoints, offset):
'\n Return an iterator that shifts all breakpoints by an offset.\n\n TESTS::\n\n sage: b = ascii_art([[1, 2, 3], [4, 5, 6]])._breakpoints; b\n [(2, [4, 7]), 14, (15, [4, 7])]\n sage: from sage.typeset.character_art import _shifted_breakpoin... |
class CharacterArtFactory(SageObject):
def __init__(self, art_type, string_type, magic_method_name, parenthesis, square_bracet, curly_brace):
"\n Abstract base class for character art factory\n\n This class is the common implementation behind\n :func:`~sage.typeset.ascii_art.ascii_ar... |
class CompoundSymbol(SageObject):
def __init__(self, character, top, extension, bottom, middle=None, middle_top=None, middle_bottom=None, top_2=None, bottom_2=None):
"\n A multi-character (ascii/unicode art) symbol\n\n INPUT:\n\n Instead of string, each of these can be unicode in Pyt... |
class CompoundAsciiSymbol(CompoundSymbol):
def character_art(self, num_lines):
'\n Return the ASCII art of the symbol\n\n EXAMPLES::\n\n sage: from sage.typeset.symbols import *\n sage: ascii_left_curly_brace.character_art(3)\n {\n {\n ... |
class CompoundUnicodeSymbol(CompoundSymbol):
def character_art(self, num_lines):
'\n Return the unicode art of the symbol\n\n EXAMPLES::\n\n sage: from sage.typeset.symbols import *\n sage: unicode_left_curly_brace.character_art(3)\n ⎧\n ⎨\n ... |
class UnicodeArt(CharacterArt):
"\n An Ascii art object is an object with some specific representation for\n *printing*.\n\n INPUT:\n\n - ``lines`` -- the list of lines of the representation of the ascii art\n object\n\n - ``breakpoints`` -- the list of points where the representation can be\n... |
def unicode_art(*obj, **kwds):
"\n Return an unicode art representation\n\n INPUT:\n\n\n - ``*obj`` -- any number of positional arguments, of arbitrary\n type. The objects whose ascii art representation we want.\n\n - ``sep`` -- optional ``'sep=...'`` keyword argument (or ``'separator'``).\n ... |
def unicode_superscript(x):
"\n Return the rational number ``x`` as a superscript.\n\n EXAMPLES::\n\n sage: from sage.typeset.unicode_art import unicode_superscript\n sage: unicode_superscript(15123902)\n '¹⁵¹²³⁹⁰²'\n sage: unicode_superscript(-712/5)\n '⁻⁷¹²ᐟ⁵'\n "
... |
def unicode_subscript(x):
"\n Return the integer ``x`` as a superscript.\n\n EXAMPLES::\n\n sage: from sage.typeset.unicode_art import unicode_subscript\n sage: unicode_subscript(15123902)\n '₁₅₁₂₃₉₀₂'\n sage: unicode_subscript(-712)\n '₋₇₁₂'\n "
return ''.join((_su... |
def format_columns(lst, align='<', cols=None, indent=4, pad=3, width=80):
"\n Utility function that formats a list as a simple table and returns\n a Unicode string representation.\n\n The number of columns is\n computed from the other options, unless it's passed as a keyword\n argument. For help o... |
def help_usage(s='', compact=False):
"\n Append and return a brief usage message for the Sage documentation builder.\n\n If 'compact' is False, the function adds a final newline character.\n "
s += 'sage --docbuild [OPTIONS] DOCUMENT (FORMAT | COMMAND)'
if (not compact):
s += '\n'
ret... |
def help_description(s='', compact=False):
"\n Append and return a brief description of the Sage documentation builder.\n\n If 'compact' is ``False``, the function adds a final newline character.\n "
s += 'Build or return information about Sage documentation. '
s += 'A DOCUMENT and either a FORMA... |
def help_examples(s=''):
'\n Append and return some usage examples for the Sage documentation builder.\n '
s += 'Examples:\n'
s += ' sage --docbuild -C all\n'
s += ' sage --docbuild constructions pdf\n'
s += ' sage --docbuild reference html -jv3\n'
s += ' sage --docbuild refe... |
def help_documents():
"\n Append and return a tabular list of documents, including a\n shortcut 'all' for all documents, available to the Sage\n documentation builder.\n "
docs = get_documents()
s = 'DOCUMENTs:\n'
s += format_columns(docs)
s += '\n'
if ('reference' in docs):
... |
def get_formats():
'\n Return a list of output formats the Sage documentation builder\n will accept on the command-line.\n '
tut_b = DocBuilder('en/tutorial')
formats = tut_b._output_formats()
formats.remove('html')
return (['html', 'pdf'] + formats)
|
def help_formats():
'\n Append and return a tabular list of output formats available to\n the Sage documentation builder.\n '
return ('FORMATs:\n' + format_columns(get_formats()))
|
def help_commands(name='all'):
'\n Append and return a tabular list of commands, if any, the Sage\n documentation builder can run on the indicated document. The\n default is to list all commands for all documents.\n '
s = ''
command_dict = {'reference': ['print_included_modules', 'print_modif... |
class help_message_long(argparse.Action):
'\n Print an extended help message for the Sage documentation builder\n and exits.\n '
def __call__(self, parser, namespace, values, option_string=None):
help_funcs = [help_usage, help_description, help_documents, help_formats, help_commands]
... |
class help_message_short(argparse.Action):
"\n Print a help message for the Sage documentation builder.\n\n The message includes command-line usage and a list of options.\n The message is printed only on the first call. If error is True\n during this call, the message is printed only if the user hasn... |
class help_wrapper(argparse.Action):
'\n A helper wrapper for command-line options to the Sage\n documentation builder that print lists, such as document names,\n formats, and document-specific commands.\n '
def __call__(self, parser, namespace, values, option_string=None):
if (option_str... |
def setup_parser():
'\n Set up and return a command-line ArgumentParser instance for the\n Sage documentation builder.\n '
parser = argparse.ArgumentParser(usage=help_usage(compact=True), description=help_description(compact=True), add_help=False)
standard = parser.add_argument_group('Standard')
... |
def setup_logger(verbose=1, color=True):
"\n Set up a Python Logger instance for the Sage documentation builder.\n\n The optional argument sets logger's level and message format.\n\n EXAMPLES::\n\n sage: from sage_docbuild.__main__ import setup_logger, logger\n sage: setup_logger()\n ... |
class IntersphinxCache():
'\n Replace sphinx.ext.intersphinx.fetch_inventory by an in-memory\n cached version.\n '
def __init__(self):
self.inventories = {}
self.real_fetch_inventory = sphinx.ext.intersphinx.fetch_inventory
sphinx.ext.intersphinx.fetch_inventory = self.fetch_... |
def main():
parser = setup_parser()
args = parser.parse_args()
DocBuilder._options = args
(name, typ) = (args.document, args.format)
if ((not name) or (not typ)):
parser.print_help()
sys.exit(1)
elif (name == 'all'):
sys.exit(os.system(f'cd {shlex.quote(SAGE_DOC_SRC)} &... |
def build_ref_doc(args):
doc = args[0]
lang = args[1]
format = args[2]
kwds = args[3]
args = args[4:]
if (format == 'inventory'):
kwds['use_multidoc_inventory'] = False
getattr(ReferenceSubBuilder(doc, lang), format)(*args, **kwds)
|
def builder_helper(type):
'\n Return a function which builds the documentation for\n output type ``type``.\n\n TESTS:\n\n Check that :trac:`25161` has been resolved::\n\n sage: from sage_docbuild.builders import DocBuilder\n sage: from sage_docbuild.__main__ import setup_parser\n ... |
class DocBuilder():
def __init__(self, name, lang='en'):
'\n INPUT:\n\n - ``name`` - the name of a subdirectory in SAGE_DOC_SRC, such as\n \'tutorial\' or \'bordeaux_2008\'\n\n - ``lang`` - (default "en") the language of the document.\n '
doc = name.split(os.p... |
def build_many(target, args, processes=None):
'\n Thin wrapper around `sage_docbuild.utils.build_many` which uses the\n docbuild settings ``NUM_THREADS`` and ``ABORT_ON_ERROR``.\n '
if (processes is None):
processes = build_options.NUM_THREADS
try:
_build_many(target, args, proces... |
def build_other_doc(args):
document = args[0]
name = args[1]
kwds = args[2]
args = args[3:]
logger.warning(('\nBuilding %s.\n' % document))
getattr(get_builder(document), name)(*args, **kwds)
|
class AllBuilder():
'\n A class used to build all of the documentation.\n '
def __getattr__(self, attr):
"\n For any attributes not explicitly defined, we just go through\n all of the documents and call their attr. For example,\n 'AllBuilder().json()' will go through all o... |
class WebsiteBuilder(DocBuilder):
def html(self):
'\n After we have finished building the website index page, we copy\n everything one directory up, that is, to the base diectory ``html/en``.\n\n In addition, an index file is installed into the root doc directory.\n\n Thus we ... |
class ReferenceBuilder(AllBuilder):
'\n This class builds the reference manual. It uses DocBuilder to\n build the top-level page and ReferenceSubBuilder for each\n sub-component.\n '
def __init__(self, name, lang='en'):
"\n Record the reference manual's name, in case it's not\n ... |
class ReferenceTopBuilder(DocBuilder):
'\n This class builds the top-level page of the reference manual.\n '
def __init__(self, *args, **kwds):
DocBuilder.__init__(self, *args, **kwds)
self.name = 'reference'
self.lang = 'en'
def _output_dir(self, type, lang=None):
... |
class ReferenceSubBuilder(DocBuilder):
'\n This class builds sub-components of the reference manual. It is\n responsible for making sure that the auto generated reST files for the\n Sage library are up to date.\n\n When building any output, we must first go through and check\n to see if we need to ... |
class SingleFileBuilder(DocBuilder):
'\n This is the class used to build the documentation for a single\n user-specified file. If the file is called \'foo.py\', then the\n documentation is built in ``DIR/foo/`` if the user passes the\n command line option "-o DIR", or in ``DOT_SAGE/docbuild/foo/``\n ... |
def get_builder(name):
'\n Return an appropriate *Builder* object for the document ``name``.\n\n DocBuilder and its subclasses do all the real work in building the\n documentation.\n '
if (name == 'all'):
from sage.misc.superseded import deprecation
deprecation(31948, 'avoid using ... |
def get_documents():
'\n Return a list of document names the Sage documentation builder\n will accept as command-line arguments.\n '
all_b = AllBuilder()
docs = all_b.get_all_documents()
docs = [(d[3:] if (d[0:3] == 'en/') else d) for d in docs]
return docs
|
def set_intersphinx_mappings(app, config):
'\n Add precompiled inventory (the objects.inv)\n '
refpath = os.path.join(SAGE_DOC, 'html', 'en', 'reference')
invpath = os.path.join(SAGE_DOC, 'inventory', 'en', 'reference')
if ((app.config.multidoc_first_pass == 1) or (not (os.path.exists(refpath) a... |
def add_page_context(app, pagename, templatename, context, doctree):
path1 = os.path.dirname(app.builder.get_outfilename(pagename))
path2 = os.path.join(SAGE_DOC, 'html', 'en')
relpath = os.path.relpath(path2, path1)
context['release'] = release
context['documentation_title'] = ('Sage {}'.format(r... |
def debug_inf(app, message):
if dangling_debug:
app.info(message)
|
def call_intersphinx(app, env, node, contnode):
'\n Call intersphinx and make links between Sage manuals relative.\n\n TESTS:\n\n Check that the link from the thematic tutorials to the reference\n manual is relative, see :trac:`20118`::\n\n sage: from sage.env import SAGE_DOC\n sage: the... |
def find_sage_dangling_links(app, env, node, contnode):
'\n Try to find dangling link in local module imports or all.py.\n '
debug_inf(app, '==================== find_sage_dangling_links ')
reftype = node['reftype']
reftarget = node['reftarget']
try:
doc = node['refdoc']
except K... |
def nitpick_patch_config(app):
"\n Patch the default config for nitpicky\n\n Calling path_config ensure that nitpicky is not considered as a Sphinx\n environment variable but rather as a Sage environment variable. As a\n consequence, changing it doesn't force the recompilation of the entire\n docum... |
def check_nested_class_picklability(app, what, name, obj, skip, options):
'\n Print a warning if pickling is broken for nested classes.\n '
if (hasattr(obj, '__dict__') and hasattr(obj, '__module__')):
module = sys.modules[obj.__module__]
for (nm, v) in obj.__dict__.items():
... |
def skip_member(app, what, name, obj, skip, options):
'\n To suppress Sphinx warnings / errors, we\n\n - Don\'t include [aliases of] builtins.\n\n - Don\'t include the docstring for any nested class which has been\n inserted into its module by\n :class:`sage.misc.NestedClassMetaclass` only for ... |
class SagecodeTransform(SphinxTransform):
'\n Transform a code block to a live code block enabled by jupyter-sphinx.\n\n Effectively a code block like::\n\n EXAMPLE::\n\n sage: 1 + 1\n 2\n\n is transformed into::\n\n EXAMPLE::\n\n sage: 1 + 1\n 2\... |
def setup(app):
app.connect('autodoc-process-docstring', process_docstring_cython)
app.connect('autodoc-process-docstring', process_directives)
app.connect('autodoc-process-docstring', process_docstring_module_title)
app.connect('autodoc-process-docstring', process_dollars)
app.connect('autodoc-pr... |
class InventoryBuilder(DummyBuilder):
'\n A customized builder which only generates intersphinx "object.inv"\n inventory files. The documentation files are not written.\n '
name = 'inventory'
format = 'inventory'
epilog = 'The inventory files are in %(outdir)s.'
def get_outdated_docs(sel... |
def setup(app: Sphinx) -> dict[(str, Any)]:
app.add_builder(InventoryBuilder)
return {'parallel_read_safe': True}
|
def merge_environment(app, env):
"\n Merge the following attributes of the sub-docs environment into the main\n environment:\n\n - ``titles`` -- Titles\n - ``todo_all_todos`` -- todo's\n - ``indexentries`` -- global python index\n - ``all_docs`` -- needed by the js index\n - ``citations`` -- ... |
def get_env(app, curdoc):
'\n Get the environment of a sub-doc from the pickle\n '
from sphinx.application import ENV_PICKLE_FILENAME
filename = os.path.join(app.env.doctreedir, curdoc, ENV_PICKLE_FILENAME)
try:
f = open(filename, 'rb')
except IOError:
logger.debug(f"Unable t... |
def merge_js_index(app):
'\n Merge the JS indexes of the sub-docs into the main JS index\n '
logger.info('')
logger.info(bold('Merging js index files...'))
mapping = app.builder.indexer._mapping
for curdoc in app.env.config.multidocs_subdoc_list:
logger.info((' %s:' % curdoc), non... |
def get_js_index(app, curdoc):
'\n Get the JS index of a sub-doc from the file\n '
from sphinx.search import IndexBuilder, languages
sphinx_version = __import__('sphinx').__version__
if (sphinx_version < '1.2'):
indexer = IndexBuilder(app.env, 'en', app.config.html_search_options)
el... |
def fix_path_html(app, pagename, templatename, ctx, event_arg):
'\n Fix the context so that the files\n\n - :file:`search.html`\n - :file:`genindex.html`\n - :file:`py-modindex.html`\n\n point to the right place, that is in :file:`reference/` instead of\n :file:`reference/subdocument`.\n '
... |
def citation_dir(app: Sphinx) -> Path:
outdir = Path(app.outdir).resolve()
sage_doc = Path(SAGE_DOC).resolve()
if (sage_doc in outdir.parents):
rel = outdir.relative_to(sage_doc)
dirs = list(rel.parts)
if (dirs[0] == '/'):
dirs.pop(0)
tail = dirs[1:]
cit... |
def write_citations(app: Sphinx, citations):
'\n Pickle the citation in a file.\n '
from sage.misc.temporary_file import atomic_write
outdir = citation_dir(app)
with atomic_write((outdir / CITE_FILENAME), binary=True) as f:
pickle.dump(citations, f)
logger.info(('Saved pickle file: %... |
def fetch_citation(app: Sphinx, env):
'\n Fetch the global citation index from the refman to allow for cross\n references.\n '
logger.info(bold('loading cross citations... '), nonl=1)
file = (citation_dir(app).parent / CITE_FILENAME)
if (not file.is_file()):
return
with open(file,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.