From 23711dbb16b02f524678a944f5d7498be1121cc0 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Sat, 29 Jan 2022 17:41:22 +0800 Subject: [PATCH 001/338] power_mod() works in any ring with %; code tweaks --- src/sage/arith/misc.py | 59 ++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index 664e3ba924f..5f06b95cefe 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -2162,24 +2162,36 @@ def get_inverse_mod(order): def power_mod(a, n, m): """ - Return the ``n``-th power of ``a`` modulo the integer ``m``. + Return the `n`-th power of `a` modulo `m`, where `a` and `m` + are elements of a ring that implements the modulo operator ``%``. + + ALGORITHM: square-and-multiply EXAMPLES:: - sage: power_mod(0,0,5) - Traceback (most recent call last): - ... - ArithmeticError: 0^0 is undefined. + sage: power_mod(2,388,389) + 1 sage: power_mod(2,390,391) 285 sage: power_mod(2,-1,7) 4 sage: power_mod(11,1,7) 4 + + This function works for fairly general rings:: + sage: R. = ZZ[] sage: power_mod(3*x, 10, 7) 4*x^10 + sage: power_mod(-3*x^2+4, 7, 2*x^3-5) + x^14 + x^8 + x^6 + x^3 + 962509*x^2 - 791910*x - 698281 + + TESTS:: + sage: power_mod(0,0,5) + Traceback (most recent call last): + ... + ArithmeticError: 0^0 is undefined. sage: power_mod(11,1,0) Traceback (most recent call last): ... @@ -2193,30 +2205,37 @@ def power_mod(a, n, m): sage: from gmpy2 import mpz sage: power_mod(mpz(2),mpz(390),mpz(391)) mpz(285) + """ - if m == 0: + if not m: raise ZeroDivisionError("modulus must be nonzero.") + + a = a % m # this should coerce into a ring containing both a and m + if m == 1: - return 0 - if n < 0: - ainv = inverse_mod(a, m) - return power_mod(ainv, -n, m) - if n == 0: - if a == 0: + return a.parent().zero() + + n = Integer(n) + if not n: + if not a: raise ArithmeticError("0^0 is undefined.") - return 1 + return a.parent().one() + if n < 0: + a = inverse_mod(a, m) + n = -n - apow = a % m - while n&1 == 0: + apow = a + while not n&1: apow = (apow*apow) % m - n = n >> 1 + n >>= 1 + power = apow - n = n >> 1 - while n != 0: + n >>= 1 + while n: apow = (apow*apow) % m - if n&1 != 0: + if n&1: power = (power*apow) % m - n = n >> 1 + n >>= 1 return power From 7fffa61e4604a35a0b8572d9cbcbc9dd30fad95f Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Sat, 29 Jan 2022 19:27:47 +0800 Subject: [PATCH 002/338] 0^0 = 1 --- src/sage/arith/misc.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index 5f06b95cefe..71eed11de0a 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -2217,8 +2217,6 @@ def power_mod(a, n, m): n = Integer(n) if not n: - if not a: - raise ArithmeticError("0^0 is undefined.") return a.parent().one() if n < 0: a = inverse_mod(a, m) From 3d57d6363b7ee473d30a849723517e46a281587d Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Sun, 30 Jan 2022 01:26:57 +0800 Subject: [PATCH 003/338] update test for 0^0 --- src/sage/arith/misc.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index 71eed11de0a..36393112515 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -2189,9 +2189,7 @@ def power_mod(a, n, m): TESTS:: sage: power_mod(0,0,5) - Traceback (most recent call last): - ... - ArithmeticError: 0^0 is undefined. + 1 sage: power_mod(11,1,0) Traceback (most recent call last): ... From eb61abcaf9850aac53f5ed1f9b97b7f2b128ab3a Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 2 Mar 2022 13:18:58 +0800 Subject: [PATCH 004/338] one more instance of 0^0 = 1 --- src/sage/rings/polynomial/polynomial_template.pxi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/polynomial/polynomial_template.pxi b/src/sage/rings/polynomial/polynomial_template.pxi index 3027c7e6179..8d5adb3c306 100644 --- a/src/sage/rings/polynomial/polynomial_template.pxi +++ b/src/sage/rings/polynomial/polynomial_template.pxi @@ -597,9 +597,10 @@ cdef class Polynomial_template(Polynomial): elif e < 0: recip = 1 # delay because powering frac field elements is slow e = -e + if not self: - if e == 0: - raise ArithmeticError("0^0 is undefined.") + return (self)._parent(int(not e)) + cdef type T = type(self) cdef Polynomial_template r = T.__new__(T) From 7cce7a49f9b7227598a7e0e844e4c91cfe78baa9 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 25 Mar 2022 16:35:17 +0100 Subject: [PATCH 005/338] trac #33554: fix issues in graph_coloring.pyx --- src/sage/graphs/graph_coloring.pyx | 43 ++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index 50cb529f95f..55ecb12ea05 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -99,6 +99,11 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d ``True``, it returns a dictionary ``{vertex: color}``, otherwise it returns a dictionary ``{color: [list of vertices]}`` + .. WARNING:: + + This method considers only colorings using exactly `n` colors, even if a + coloring using fewer colors can be found. + The construction works as follows. Columns: * The first `|V|` columns correspond to a vertex -- a `1` in this column @@ -188,7 +193,7 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d G._scream_if_not_simple(allow_multiple_edges=True) - if not n: + if not n or n > G.order(): return if n < 0: raise ValueError("n must be non-negative") @@ -229,18 +234,20 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d cdef dict color_dict = {col: i for i, col in enumerate(colors)} cdef list ones_second = [ones[i].second for i in range(len(ones))] - cdef dict coloring = {} + cdef dict coloring + cdef set used_colors try: for a in DLXCPP(ones_second): - if count_only: - yield 1 - continue coloring = {} - if vertex_color_dict: + used_colors = set() + if count_only: + used_colors = set(colormap[x][1] for x in a if x in colormap) + elif vertex_color_dict: for x in a: if x in colormap: - v,c = colormap[x] + v, c = colormap[x] + used_colors.add(c) if hex_colors: coloring[v] = colors[c] else: @@ -248,7 +255,8 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d else: for x in a: if x in colormap: - v,c = colormap[x] + v, c = colormap[x] + used_colors.add(c) if hex_colors: if colors[c] in coloring: coloring[colors[c]].append(v) @@ -259,7 +267,11 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d coloring[color_dict[colors[c]]].append(v) else: coloring[color_dict[colors[c]]] = [v] - yield coloring + if len(used_colors) == n: + if count_only: + yield 1 + else: + yield coloring except RuntimeError: raise RuntimeError("too much recursion, Graph coloring failed") @@ -268,7 +280,8 @@ cpdef first_coloring(G, n=0, hex_colors=False): Return the first vertex coloring found. If a natural number `n` is provided, returns the first found coloring with - at least `n` colors. + at least `n` colors. That is, `n` is a lower bound on the number of colors + to use. INPUT: @@ -284,6 +297,14 @@ cpdef first_coloring(G, n=0, hex_colors=False): sage: G = Graph({0: [1, 2, 3], 1: [2]}) sage: sorted(first_coloring(G, 3)) [[0], [1, 3], [2]] + + TESTS: + + :trac:`33554` is fixed:: + + sage: P3 = graphs.PathGraph(3) + sage: [len(graph_coloring.first_coloring(P3, k)) for k in range(P3.order() + 1)] + [2, 2, 2, 3] """ G._scream_if_not_simple(allow_multiple_edges=True) cdef int o = G.order() @@ -337,7 +358,7 @@ cpdef numbers_of_colorings(G): sage: from sage.graphs.graph_coloring import numbers_of_colorings sage: G = Graph({0: [1, 2, 3], 1: [2]}) sage: numbers_of_colorings(G) - [0, 0, 0, 12, 72] + [0, 0, 0, 12, 24] """ cdef int o = G.order() cdef list answer = [number_of_n_colorings(G, n) for n in range(o + 1)] From 715c93a6121068fc8d52ebc9b20991fbf9c2a9f9 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 29 Mar 2022 19:51:12 +0000 Subject: [PATCH 006/338] Add furo --- build/pkgs/furo/SPKG.rst | 16 ++++++++++++++++ build/pkgs/furo/checksums.ini | 5 +++++ build/pkgs/furo/dependencies | 4 ++++ build/pkgs/furo/install-requires.txt | 1 + build/pkgs/furo/package-version.txt | 1 + build/pkgs/furo/spkg-install.in | 2 ++ build/pkgs/furo/type | 1 + 7 files changed, 30 insertions(+) create mode 100644 build/pkgs/furo/SPKG.rst create mode 100644 build/pkgs/furo/checksums.ini create mode 100644 build/pkgs/furo/dependencies create mode 100644 build/pkgs/furo/install-requires.txt create mode 100644 build/pkgs/furo/package-version.txt create mode 100644 build/pkgs/furo/spkg-install.in create mode 100644 build/pkgs/furo/type diff --git a/build/pkgs/furo/SPKG.rst b/build/pkgs/furo/SPKG.rst new file mode 100644 index 00000000000..ebbd1bba238 --- /dev/null +++ b/build/pkgs/furo/SPKG.rst @@ -0,0 +1,16 @@ +furo: A clean customisable Sphinx documentation theme. +====================================================== + +Description +----------- + +A clean customisable Sphinx documentation theme. + +License +------- + +Upstream Contact +---------------- + +https://pypi.org/project/furo/ + diff --git a/build/pkgs/furo/checksums.ini b/build/pkgs/furo/checksums.ini new file mode 100644 index 00000000000..e83445623a2 --- /dev/null +++ b/build/pkgs/furo/checksums.ini @@ -0,0 +1,5 @@ +tarball=furo-VERSION.tar.gz +sha1=97bb53a7aa15fc64ae2df9e71c4d8d50f17a1fbc +md5=71d64ed9a33646a0b7ec5753652c16f7 +cksum=2464346896 +upstream_url=https://pypi.io/packages/source/f/furo/furo-VERSION.tar.gz diff --git a/build/pkgs/furo/dependencies b/build/pkgs/furo/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/furo/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/furo/install-requires.txt b/build/pkgs/furo/install-requires.txt new file mode 100644 index 00000000000..a95ae18b4f9 --- /dev/null +++ b/build/pkgs/furo/install-requires.txt @@ -0,0 +1 @@ +furo diff --git a/build/pkgs/furo/package-version.txt b/build/pkgs/furo/package-version.txt new file mode 100644 index 00000000000..fd84d170fbe --- /dev/null +++ b/build/pkgs/furo/package-version.txt @@ -0,0 +1 @@ +2022.3.4 diff --git a/build/pkgs/furo/spkg-install.in b/build/pkgs/furo/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/furo/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/furo/type b/build/pkgs/furo/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/furo/type @@ -0,0 +1 @@ +optional From c4a3c28c5347993b7ec86e16cc0c0d99741bd720 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 29 Mar 2022 20:27:37 +0000 Subject: [PATCH 007/338] Add sphinx-theme-builder --- build/pkgs/furo/dependencies | 2 +- build/pkgs/sphinx_theme_builder/SPKG.rst | 16 ++++++++++++++++ build/pkgs/sphinx_theme_builder/checksums.ini | 5 +++++ build/pkgs/sphinx_theme_builder/dependencies | 4 ++++ .../sphinx_theme_builder/install-requires.txt | 1 + .../sphinx_theme_builder/package-version.txt | 1 + build/pkgs/sphinx_theme_builder/spkg-install.in | 2 ++ build/pkgs/sphinx_theme_builder/type | 1 + 8 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/sphinx_theme_builder/SPKG.rst create mode 100644 build/pkgs/sphinx_theme_builder/checksums.ini create mode 100644 build/pkgs/sphinx_theme_builder/dependencies create mode 100644 build/pkgs/sphinx_theme_builder/install-requires.txt create mode 100644 build/pkgs/sphinx_theme_builder/package-version.txt create mode 100644 build/pkgs/sphinx_theme_builder/spkg-install.in create mode 100644 build/pkgs/sphinx_theme_builder/type diff --git a/build/pkgs/furo/dependencies b/build/pkgs/furo/dependencies index 0738c2d7777..79eb3e339ae 100644 --- a/build/pkgs/furo/dependencies +++ b/build/pkgs/furo/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) sphinx_theme_builder | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinx_theme_builder/SPKG.rst b/build/pkgs/sphinx_theme_builder/SPKG.rst new file mode 100644 index 00000000000..47b5e8666f2 --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/SPKG.rst @@ -0,0 +1,16 @@ +sphinx_theme_builder: A tool for authoring Sphinx themes with a simple (opinionated) workflow. +============================================================================================== + +Description +----------- + +A tool for authoring Sphinx themes with a simple (opinionated) workflow. + +License +------- + +Upstream Contact +---------------- + +https://pypi.org/project/sphinx-theme-builder/ + diff --git a/build/pkgs/sphinx_theme_builder/checksums.ini b/build/pkgs/sphinx_theme_builder/checksums.ini new file mode 100644 index 00000000000..5d9ce40163e --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/checksums.ini @@ -0,0 +1,5 @@ +tarball=sphinx-theme-builder-VERSION.tar.gz +sha1=c4962660ccfc47282557359a980f1fb41154c449 +md5=7b7accee558a89f683561f6b3257ae8f +cksum=3904771227 +upstream_url=https://pypi.io/packages/source/s/sphinx_theme_builder/sphinx-theme-builder-VERSION.tar.gz diff --git a/build/pkgs/sphinx_theme_builder/dependencies b/build/pkgs/sphinx_theme_builder/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinx_theme_builder/install-requires.txt b/build/pkgs/sphinx_theme_builder/install-requires.txt new file mode 100644 index 00000000000..7c7d2d83756 --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/install-requires.txt @@ -0,0 +1 @@ +sphinx-theme-builder diff --git a/build/pkgs/sphinx_theme_builder/package-version.txt b/build/pkgs/sphinx_theme_builder/package-version.txt new file mode 100644 index 00000000000..9ab06c54acc --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/package-version.txt @@ -0,0 +1 @@ +0.2.0a14 diff --git a/build/pkgs/sphinx_theme_builder/spkg-install.in b/build/pkgs/sphinx_theme_builder/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/sphinx_theme_builder/type b/build/pkgs/sphinx_theme_builder/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/sphinx_theme_builder/type @@ -0,0 +1 @@ +optional From 67f127931decc1e79df87f1b5bd83498e3d78eb6 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 29 Mar 2022 22:02:03 +0000 Subject: [PATCH 008/338] Add initial config --- src/sage/docs/conf.py | 60 +++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 23ada2b43ca..787cf520343 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -17,13 +17,15 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sage_docbuild.ext.inventory_builder', - 'sage_docbuild.ext.multidocs', - 'sage_docbuild.ext.sage_autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.extlinks', - 'IPython.sphinxext.ipython_directive', - 'matplotlib.sphinxext.plot_directive'] +extensions = [ + "sage_docbuild.ext.inventory_builder", + "sage_docbuild.ext.multidocs", + "sage_docbuild.ext.sage_autodoc", + "sphinx.ext.todo", + "sphinx.ext.extlinks", + "IPython.sphinxext.ipython_directive", + #"matplotlib.sphinxext.plot_directive", +] # This code is executed before each ".. PLOT::" directive in the Sphinx # documentation. It defines a 'sphinx_plot' function that displays a Sage object @@ -142,10 +144,6 @@ def sphinx_plot(graphics, **kwds): # output. They are ignored by default. #show_authors = False -# The name of the Pygments (syntax highlighting) style to use. NOTE: -# This overrides a HTML theme's corresponding setting (see below). -pygments_style = 'sphinx' - # Default lexer to use when highlighting code blocks, using the IPython # console lexers. 'ipycon' is the IPython console, which is what we want # for most code blocks: anything with "sage:" prompts. For other IPython, @@ -200,19 +198,48 @@ def set_intersphinx_mappings(app, config): # Options for HTML output # ----------------------- - +import importlib.util + +if importlib.util.find_spec("furo") is not None: + html_theme = "furo" + + # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path + html_static_path = [ + os.path.join(SAGE_DOC_SRC, "common", "themes", "sage-classic", "static") + ] + + html_theme_options = { + # Hide project’s name in the sidebar of the documentation; + # the logo is enough. + # https://pradyunsg.me/furo/customisation/#sidebar-hide-name + "sidebar_hide_name": True, + # Change accent (used for stylising links, sidebar’s content etc) + "light_css_variables": { + "color-brand-primary": "#0f0fff", + "color-brand-content": "#0f0fff", + }, + # Add sage logo to sidebar + # https://pradyunsg.me/furo/customisation/logo/#different-logos-for-light-and-dark-mode + "light_logo": "logo_sagemath_black.svg", + "dark_logo": "logo_sagemath.svg", + } +else: # Sage default HTML theme. We use a custom theme to set a Pygments style, # stylesheet, and insert MathJax macros. See the directory # doc/common/themes/sage-classic/ for files comprising the custom theme. -html_theme = 'sage-classic' + html_theme = "sage-classic" + + # Add any paths that contain custom themes here, relative to this directory. + html_theme_path = [os.path.join(SAGE_DOC_SRC, "common", "themes")] # Theme options are theme-specific and customize the look and feel of # a theme further. For a list of options available for each theme, # see the documentation. html_theme_options = {} -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [os.path.join(SAGE_DOC_SRC, 'common', 'themes')] + # The name of the Pygments (syntax highlighting) style to use. NOTE: + # This overrides a HTML theme's corresponding setting (see below). + pygments_style = "sphinx" # HTML style sheet NOTE: This overrides a HTML theme's corresponding # setting. @@ -246,7 +273,8 @@ def set_intersphinx_mappings(app, config): mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js' from sage.misc.latex_macros import sage_mathjax_macros -html_theme_options['mathjax_macros'] = sage_mathjax_macros() + +#html_theme_options["mathjax_macros"] = sage_mathjax_macros() mathjax_relative = os.path.basename(MATHJAX_DIR) From b90316d145d7eff02092e01bafbf091b269ed8ef Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 29 Mar 2022 22:33:11 +0000 Subject: [PATCH 009/338] Configure mathjax in sphinx config --- src/sage/docs/conf.py | 35 ++++++++++++++++----------- src/sage/misc/latex_macros.py | 45 +++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 23ada2b43ca..4b939886f10 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -1,7 +1,8 @@ import sys import os import sphinx -from sage.env import SAGE_DOC_SRC, SAGE_DOC, SAGE_SRC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR +from sage.env import SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR +from sage.misc.latex_macros import sage_mathjax_macros import sage.version from sage.misc.sagedoc import extlinks import dateutil.parser @@ -12,18 +13,24 @@ import sphinx.ext.intersphinx as intersphinx from IPython.lib.lexers import IPythonConsoleLexer, IPyLexer + # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sage_docbuild.ext.inventory_builder', - 'sage_docbuild.ext.multidocs', - 'sage_docbuild.ext.sage_autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.extlinks', - 'IPython.sphinxext.ipython_directive', - 'matplotlib.sphinxext.plot_directive'] +extensions = [ + "sage_docbuild.ext.inventory_builder", + "sage_docbuild.ext.multidocs", + "sage_docbuild.ext.sage_autodoc", + "sphinx.ext.todo", + "sphinx.ext.extlinks", + # Mathjax integration + # https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax + "sphinx.ext.mathjax", + "IPython.sphinxext.ipython_directive", + "matplotlib.sphinxext.plot_directive", +] # This code is executed before each ".. PLOT::" directive in the Sphinx # documentation. It defines a 'sphinx_plot' function that displays a Sage object @@ -241,12 +248,12 @@ def set_intersphinx_mappings(app, config): html_common_static_path = [os.path.join(SAGE_DOC_SRC, 'common', 'static'), THEBE_DIR, 'static'] -# We use MathJax to build the documentation. -extensions.append('sphinx.ext.mathjax') -mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js' - -from sage.misc.latex_macros import sage_mathjax_macros -html_theme_options['mathjax_macros'] = sage_mathjax_macros() +# Configure MathJax +mathjax3_config = { + "tex": { + "macros": sage_mathjax_macros() + } +} mathjax_relative = os.path.basename(MATHJAX_DIR) diff --git a/src/sage/misc/latex_macros.py b/src/sage/misc/latex_macros.py index f1ac926c235..37d2bee6608 100644 --- a/src/sage/misc/latex_macros.py +++ b/src/sage/misc/latex_macros.py @@ -43,6 +43,7 @@ contain '\newcommand' lines for each of the entries in ``macros``. """ + def produce_latex_macro(name, *sample_args): r""" Produce a string defining a LaTeX macro. @@ -111,34 +112,35 @@ def convert_latex_macro_to_mathjax(macro): - ``macro`` - LaTeX macro definition See the web page - http://www.mathjax.org/docs/1.1/options/TeX.html for a + https://docs.mathjax.org/en/latest/input/tex/macros.html for a description of the format for MathJax macros. EXAMPLES:: sage: from sage.misc.latex_macros import convert_latex_macro_to_mathjax sage: convert_latex_macro_to_mathjax('\\newcommand{\\ZZ}{\\Bold{Z}}') - 'ZZ: "\\\\Bold{Z}"' + ('ZZ', '\\Bold{Z}') sage: convert_latex_macro_to_mathjax('\\newcommand{\\GF}[1]{\\Bold{F}_{#1}}') - 'GF: ["\\\\Bold{F}_{#1}",1]' + ('GF', ['\\Bold{F}_{#1}', 1]) """ - left_bracket = macro.find('[') - right_bracket = macro.find('[') + left_bracket = macro.find("[") + right_bracket = macro.find("[") if left_bracket >= 0: - right_bracket = macro.find(']') - num_args = macro[left_bracket+1:right_bracket] + right_bracket = macro.find("]") + num_args = int(macro[left_bracket + 1 : right_bracket]) else: num_args = 0 - start_name = macro.find('{') + 1 # add one to go past the backslash - end_name = macro.find('}') - name = macro[start_name+1:end_name] - start_defn = macro.find('{', end_name) - end_defn = macro.rfind('}') - defn = macro[start_defn+1: end_defn].replace('\\', '\\\\') + start_name = macro.find("{") + 1 # add one to go past the backslash + end_name = macro.find("}") + name = macro[start_name + 1 : end_name] + start_defn = macro.find("{", end_name) + end_defn = macro.rfind("}") + defn = macro[start_defn + 1 : end_defn] if num_args == 0: - return name + ': "' + defn + '"' + return name, defn else: - return name + ': ["' + defn + '",' + str(num_args) + ']' + return name, [defn, num_args] + # To add a new macro for use in the Sage documentation, add a list or # tuple to the following list. Each list (or tuple) should have the @@ -176,6 +178,7 @@ def convert_latex_macro_to_mathjax(macro): # mathbf vs mathbb. See latex.py for more information. sage_configurable_latex_macros = [r"\newcommand{\Bold}[1]{\mathbf{#1}}"] + def sage_latex_macros(): r""" Return list of LaTeX macros for Sage. This just runs the function @@ -193,15 +196,17 @@ def sage_latex_macros(): def sage_mathjax_macros(): r""" - Return list of MathJax macro definitions for Sage as - JavaScript. This feeds each item output by - :func:`sage_latex_macros` to + Return Sage's macro definitions for usage with MathJax. + + This feeds each item output by :func:`sage_latex_macros` to :func:`convert_latex_macro_to_mathjax`. EXAMPLES:: sage: from sage.misc.latex_macros import sage_mathjax_macros sage: sage_mathjax_macros() - ['ZZ: "\\\\Bold{Z}"', 'NN: "\\\\Bold{N}"', ... + {'Bold': ['\\mathbf{#1}', 1], 'CC': '\\Bold{C}', ... """ - return [convert_latex_macro_to_mathjax(m) for m in sage_latex_macros()] + return dict( + [convert_latex_macro_to_mathjax(m) for m in sage_latex_macros()] + ) From 9bc443204bed20fac922cc758ca51259e2cbfa45 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 13:46:45 +0000 Subject: [PATCH 010/338] Migrate rest of config --- .../sage-classic/static/mathjax_sage.js_t | 23 ------------------- src/doc/common/themes/sage-classic/theme.conf | 2 -- src/sage/docs/conf.py | 18 +++++++++++++-- src/sage/misc/sagedoc.py | 1 - 4 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 src/doc/common/themes/sage-classic/static/mathjax_sage.js_t diff --git a/src/doc/common/themes/sage-classic/static/mathjax_sage.js_t b/src/doc/common/themes/sage-classic/static/mathjax_sage.js_t deleted file mode 100644 index b261f2265a3..00000000000 --- a/src/doc/common/themes/sage-classic/static/mathjax_sage.js_t +++ /dev/null @@ -1,23 +0,0 @@ -MathJax.Hub.Config({ - imageFont: null, - tex2jax: { - inlineMath: [['$','$'],['\\(','\\)']], - processEscapes: true, - }, - styles: { - ".MathJax .mo, .MathJax .mi": { - color: "inherit ! important" - } - }, - TeX: { - MAXBUFFER: 50*1024, - - Macros: { - {{ theme_mathjax_macros|join(',\n') }} - } - } -}); - -// This path is a little funny because we have to load our local -// config file as '../mathjax_sage' in the theme conf.py -MathJax.Ajax.loadComplete("[MathJax]/config/../mathjax_sage.js") diff --git a/src/doc/common/themes/sage-classic/theme.conf b/src/doc/common/themes/sage-classic/theme.conf index cc6279a2633..fbde86a94ac 100644 --- a/src/doc/common/themes/sage-classic/theme.conf +++ b/src/doc/common/themes/sage-classic/theme.conf @@ -40,5 +40,3 @@ linkcolor = #45529B # Background color for code blocks: very pale yellow codebgcolor = #FFFFE5 -# MathJax settings filled in by conf.py -mathjax_macros = diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 4b939886f10..e14dce18c8e 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -249,11 +249,25 @@ def set_intersphinx_mappings(app, config): THEBE_DIR, 'static'] # Configure MathJax +# https://docs.mathjax.org/en/latest/options/input/tex.html mathjax3_config = { "tex": { - "macros": sage_mathjax_macros() - } + # Add custom sage macros + # http://docs.mathjax.org/en/latest/input/tex/macros.html + "macros": sage_mathjax_macros(), + # Add $...$ as possible inline math + # https://docs.mathjax.org/en/latest/input/tex/delimiters.html#tex-and-latex-math-delimiters + "inlineMath": [["$", "$"], ["\\(", "\\)"]], + # Increase the limit the size of the string to be processed + # https://docs.mathjax.org/en/latest/options/input/tex.html#option-descriptions + "maxBuffer": 50 * 1024, + # Use colorv2 extension instead of built-in color extension + # https://docs.mathjax.org/en/latest/input/tex/extensions/autoload.html#tex-autoload-options + # https://docs.mathjax.org/en/latest/input/tex/extensions/colorv2.html#tex-colorv2 + "autoload": {"color": [], "colorv2": ["color"]}, + }, } +mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" mathjax_relative = os.path.basename(MATHJAX_DIR) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 4b3853f3e8d..17fa004f904 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -1486,7 +1486,6 @@ def __call__(self, obj, output='html', view=True): - From cc0f093d842a92c6b1f770a36ffb4711d970790a Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 13:55:35 +0000 Subject: [PATCH 011/338] Use furo on ci --- .github/workflows/doc-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 1b501600e67..c0093688f00 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -24,6 +24,7 @@ jobs: # Reuse built SAGE_LOCAL contained in the Docker image ./bootstrap ./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv + make furo - name: Build run: make doc-html From 3be9522be5bcc98b6bae68d27d3181ae7c5ceb5a Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 18:50:11 +0000 Subject: [PATCH 012/338] Make furo a pip package --- build/pkgs/furo/checksums.ini | 5 ----- build/pkgs/furo/dependencies | 2 +- build/pkgs/furo/package-version.txt | 1 - .../{install-requires.txt => requirements.txt} | 0 build/pkgs/furo/spkg-install.in | 2 -- build/pkgs/sphinx_theme_builder/SPKG.rst | 16 ---------------- build/pkgs/sphinx_theme_builder/checksums.ini | 5 ----- build/pkgs/sphinx_theme_builder/dependencies | 4 ---- .../sphinx_theme_builder/install-requires.txt | 1 - .../sphinx_theme_builder/package-version.txt | 1 - build/pkgs/sphinx_theme_builder/spkg-install.in | 2 -- build/pkgs/sphinx_theme_builder/type | 1 - 12 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 build/pkgs/furo/checksums.ini delete mode 100644 build/pkgs/furo/package-version.txt rename build/pkgs/furo/{install-requires.txt => requirements.txt} (100%) delete mode 100644 build/pkgs/furo/spkg-install.in delete mode 100644 build/pkgs/sphinx_theme_builder/SPKG.rst delete mode 100644 build/pkgs/sphinx_theme_builder/checksums.ini delete mode 100644 build/pkgs/sphinx_theme_builder/dependencies delete mode 100644 build/pkgs/sphinx_theme_builder/install-requires.txt delete mode 100644 build/pkgs/sphinx_theme_builder/package-version.txt delete mode 100644 build/pkgs/sphinx_theme_builder/spkg-install.in delete mode 100644 build/pkgs/sphinx_theme_builder/type diff --git a/build/pkgs/furo/checksums.ini b/build/pkgs/furo/checksums.ini deleted file mode 100644 index e83445623a2..00000000000 --- a/build/pkgs/furo/checksums.ini +++ /dev/null @@ -1,5 +0,0 @@ -tarball=furo-VERSION.tar.gz -sha1=97bb53a7aa15fc64ae2df9e71c4d8d50f17a1fbc -md5=71d64ed9a33646a0b7ec5753652c16f7 -cksum=2464346896 -upstream_url=https://pypi.io/packages/source/f/furo/furo-VERSION.tar.gz diff --git a/build/pkgs/furo/dependencies b/build/pkgs/furo/dependencies index 79eb3e339ae..0738c2d7777 100644 --- a/build/pkgs/furo/dependencies +++ b/build/pkgs/furo/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) sphinx_theme_builder | $(PYTHON_TOOLCHAIN) +$(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/furo/package-version.txt b/build/pkgs/furo/package-version.txt deleted file mode 100644 index fd84d170fbe..00000000000 --- a/build/pkgs/furo/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -2022.3.4 diff --git a/build/pkgs/furo/install-requires.txt b/build/pkgs/furo/requirements.txt similarity index 100% rename from build/pkgs/furo/install-requires.txt rename to build/pkgs/furo/requirements.txt diff --git a/build/pkgs/furo/spkg-install.in b/build/pkgs/furo/spkg-install.in deleted file mode 100644 index 37ac1a53437..00000000000 --- a/build/pkgs/furo/spkg-install.in +++ /dev/null @@ -1,2 +0,0 @@ -cd src -sdh_pip_install . diff --git a/build/pkgs/sphinx_theme_builder/SPKG.rst b/build/pkgs/sphinx_theme_builder/SPKG.rst deleted file mode 100644 index 47b5e8666f2..00000000000 --- a/build/pkgs/sphinx_theme_builder/SPKG.rst +++ /dev/null @@ -1,16 +0,0 @@ -sphinx_theme_builder: A tool for authoring Sphinx themes with a simple (opinionated) workflow. -============================================================================================== - -Description ------------ - -A tool for authoring Sphinx themes with a simple (opinionated) workflow. - -License -------- - -Upstream Contact ----------------- - -https://pypi.org/project/sphinx-theme-builder/ - diff --git a/build/pkgs/sphinx_theme_builder/checksums.ini b/build/pkgs/sphinx_theme_builder/checksums.ini deleted file mode 100644 index 5d9ce40163e..00000000000 --- a/build/pkgs/sphinx_theme_builder/checksums.ini +++ /dev/null @@ -1,5 +0,0 @@ -tarball=sphinx-theme-builder-VERSION.tar.gz -sha1=c4962660ccfc47282557359a980f1fb41154c449 -md5=7b7accee558a89f683561f6b3257ae8f -cksum=3904771227 -upstream_url=https://pypi.io/packages/source/s/sphinx_theme_builder/sphinx-theme-builder-VERSION.tar.gz diff --git a/build/pkgs/sphinx_theme_builder/dependencies b/build/pkgs/sphinx_theme_builder/dependencies deleted file mode 100644 index 0738c2d7777..00000000000 --- a/build/pkgs/sphinx_theme_builder/dependencies +++ /dev/null @@ -1,4 +0,0 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) - ----------- -All lines of this file are ignored except the first. diff --git a/build/pkgs/sphinx_theme_builder/install-requires.txt b/build/pkgs/sphinx_theme_builder/install-requires.txt deleted file mode 100644 index 7c7d2d83756..00000000000 --- a/build/pkgs/sphinx_theme_builder/install-requires.txt +++ /dev/null @@ -1 +0,0 @@ -sphinx-theme-builder diff --git a/build/pkgs/sphinx_theme_builder/package-version.txt b/build/pkgs/sphinx_theme_builder/package-version.txt deleted file mode 100644 index 9ab06c54acc..00000000000 --- a/build/pkgs/sphinx_theme_builder/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -0.2.0a14 diff --git a/build/pkgs/sphinx_theme_builder/spkg-install.in b/build/pkgs/sphinx_theme_builder/spkg-install.in deleted file mode 100644 index 37ac1a53437..00000000000 --- a/build/pkgs/sphinx_theme_builder/spkg-install.in +++ /dev/null @@ -1,2 +0,0 @@ -cd src -sdh_pip_install . diff --git a/build/pkgs/sphinx_theme_builder/type b/build/pkgs/sphinx_theme_builder/type deleted file mode 100644 index 134d9bc32d5..00000000000 --- a/build/pkgs/sphinx_theme_builder/type +++ /dev/null @@ -1 +0,0 @@ -optional From c0bd95a3f04a2194356794caa0f21a53dfe9b856 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 18:50:59 +0000 Subject: [PATCH 013/338] Fix intend --- src/sage/docs/conf.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 787cf520343..45d6fff87b5 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -224,18 +224,18 @@ def set_intersphinx_mappings(app, config): "dark_logo": "logo_sagemath.svg", } else: -# Sage default HTML theme. We use a custom theme to set a Pygments style, -# stylesheet, and insert MathJax macros. See the directory -# doc/common/themes/sage-classic/ for files comprising the custom theme. + # Sage default HTML theme. We use a custom theme to set a Pygments style, + # stylesheet, and insert MathJax macros. See the directory + # doc/common/themes/sage-classic/ for files comprising the custom theme. html_theme = "sage-classic" # Add any paths that contain custom themes here, relative to this directory. html_theme_path = [os.path.join(SAGE_DOC_SRC, "common", "themes")] -# Theme options are theme-specific and customize the look and feel of -# a theme further. For a list of options available for each theme, -# see the documentation. -html_theme_options = {} + # Theme options are theme-specific and customize the look and feel of + # a theme further. For a list of options available for each theme, + # see the documentation. + html_theme_options = {} # The name of the Pygments (syntax highlighting) style to use. NOTE: # This overrides a HTML theme's corresponding setting (see below). From 8e8c76b1575ad1304fbb6e5f556cbd67b31e234a Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 20:16:10 +0000 Subject: [PATCH 014/338] Reactivate matplotlib --- src/sage/docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 45d6fff87b5..b1841006411 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -24,7 +24,7 @@ "sphinx.ext.todo", "sphinx.ext.extlinks", "IPython.sphinxext.ipython_directive", - #"matplotlib.sphinxext.plot_directive", + "matplotlib.sphinxext.plot_directive", ] # This code is executed before each ".. PLOT::" directive in the Sphinx From 6260621dc310a0a9312f6b8e77aef92332ff2da3 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 20:17:27 +0000 Subject: [PATCH 015/338] cleanup --- src/sage/docs/conf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index b1841006411..e9f490d3d9a 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -1,3 +1,4 @@ +import importlib.util import sys import os import sphinx @@ -198,8 +199,6 @@ def set_intersphinx_mappings(app, config): # Options for HTML output # ----------------------- -import importlib.util - if importlib.util.find_spec("furo") is not None: html_theme = "furo" From 516dfe85b21eafae4f042320e5dcf61ad14fe780 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 30 Mar 2022 21:17:40 +0000 Subject: [PATCH 016/338] Try with _static folder --- src/sage_docbuild/__init__.py | 2 +- src/sage_docbuild/ext/inventory_builder.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py index f2df893ffcb..27ced1dacf5 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py @@ -1689,7 +1689,7 @@ def main(): # Get the name and type (target format) of the document we are # trying to build. name, typ = args.document, args.format - if not name or not type: + if not name or not typ: parser.print_help() sys.exit(1) diff --git a/src/sage_docbuild/ext/inventory_builder.py b/src/sage_docbuild/ext/inventory_builder.py index a4941c21981..f3fb44bcd35 100644 --- a/src/sage_docbuild/ext/inventory_builder.py +++ b/src/sage_docbuild/ext/inventory_builder.py @@ -87,8 +87,8 @@ def cleanup(self): may be created by the graphviz extension. Its presence will break the docbuild later on, so remove it. """ - if path.isdir(path.join(self.outdir, '_static')): - shutil.rmtree(path.join(self.outdir, '_static')) + #if path.isdir(path.join(self.outdir, '_static')): + # shutil.rmtree(path.join(self.outdir, '_static')) copy_image_files = removed_method_error From e4e1118f3099113768dfee029146e63614a46391 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 31 Mar 2022 11:53:17 +0000 Subject: [PATCH 017/338] Convert double quotes to single quotes --- src/sage/docs/conf.py | 16 ++++++++-------- src/sage/misc/latex_macros.py | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index e14dce18c8e..d6a72bf1709 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -20,16 +20,16 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ - "sage_docbuild.ext.inventory_builder", - "sage_docbuild.ext.multidocs", - "sage_docbuild.ext.sage_autodoc", - "sphinx.ext.todo", - "sphinx.ext.extlinks", + 'sage_docbuild.ext.inventory_builder', + 'sage_docbuild.ext.multidocs', + 'sage_docbuild.ext.sage_autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.extlinks', # Mathjax integration # https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax - "sphinx.ext.mathjax", - "IPython.sphinxext.ipython_directive", - "matplotlib.sphinxext.plot_directive", + 'sphinx.ext.mathjax', + 'IPython.sphinxext.ipython_directive', + 'matplotlib.sphinxext.plot_directive', ] # This code is executed before each ".. PLOT::" directive in the Sphinx diff --git a/src/sage/misc/latex_macros.py b/src/sage/misc/latex_macros.py index 37d2bee6608..729a7ba49f0 100644 --- a/src/sage/misc/latex_macros.py +++ b/src/sage/misc/latex_macros.py @@ -123,18 +123,18 @@ def convert_latex_macro_to_mathjax(macro): sage: convert_latex_macro_to_mathjax('\\newcommand{\\GF}[1]{\\Bold{F}_{#1}}') ('GF', ['\\Bold{F}_{#1}', 1]) """ - left_bracket = macro.find("[") - right_bracket = macro.find("[") + left_bracket = macro.find('[') + right_bracket = macro.find('[') if left_bracket >= 0: - right_bracket = macro.find("]") + right_bracket = macro.find(']') num_args = int(macro[left_bracket + 1 : right_bracket]) else: num_args = 0 - start_name = macro.find("{") + 1 # add one to go past the backslash - end_name = macro.find("}") + start_name = macro.find('{') + 1 # add one to go past the backslash + end_name = macro.find('}') name = macro[start_name + 1 : end_name] - start_defn = macro.find("{", end_name) - end_defn = macro.rfind("}") + start_defn = macro.find('{', end_name) + end_defn = macro.rfind('}') defn = macro[start_defn + 1 : end_defn] if num_args == 0: return name, defn From 2269f1981d9f4de55482e487a3eded4a72c4ed4b Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 1 Apr 2022 16:32:21 +0000 Subject: [PATCH 018/338] Add dependencies --- build/pkgs/furo/dependencies | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/pkgs/furo/dependencies b/build/pkgs/furo/dependencies index 0738c2d7777..9544f8d9e55 100644 --- a/build/pkgs/furo/dependencies +++ b/build/pkgs/furo/dependencies @@ -1,4 +1,9 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) beautifulsoup4 sphinx pygments | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. + +From https://github.com/pradyunsg/furo/blob/b4c8010cff5e494a93d617069897964c60b820e9/pyproject.toml#L18-L22 + "beautifulsoup4", + "sphinx ~= 4.0", + "pygments ~= 2.7", From 097c034ada7ce77afedb20da5705e50f5d3a0737 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 6 Apr 2022 10:24:30 +0900 Subject: [PATCH 019/338] Minor edits --- src/sage/docs/conf.py | 2 -- src/sage/misc/latex_macros.py | 13 ++++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index aeb7ef7ee45..e9730488d12 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -25,8 +25,6 @@ 'sage_docbuild.ext.sage_autodoc', 'sphinx.ext.todo', 'sphinx.ext.extlinks', - # Mathjax integration - # https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax 'sphinx.ext.mathjax', 'IPython.sphinxext.ipython_directive', 'matplotlib.sphinxext.plot_directive', diff --git a/src/sage/misc/latex_macros.py b/src/sage/misc/latex_macros.py index 729a7ba49f0..22d1f2efe30 100644 --- a/src/sage/misc/latex_macros.py +++ b/src/sage/misc/latex_macros.py @@ -50,8 +50,9 @@ def produce_latex_macro(name, *sample_args): INPUT: - - ``name`` - name of macro to be defined, also name of corresponding Sage object - - ``sample_args`` - (optional) sample arguments for this Sage object + - ``name`` -- name of macro to be defined, also name of corresponding Sage object + + - ``sample_args`` -- (optional) sample arguments for this Sage object EXAMPLES:: @@ -109,7 +110,7 @@ def convert_latex_macro_to_mathjax(macro): INPUT: - - ``macro`` - LaTeX macro definition + - ``macro`` -- LaTeX macro definition See the web page https://docs.mathjax.org/en/latest/input/tex/macros.html for a @@ -197,7 +198,7 @@ def sage_latex_macros(): def sage_mathjax_macros(): r""" Return Sage's macro definitions for usage with MathJax. - + This feeds each item output by :func:`sage_latex_macros` to :func:`convert_latex_macro_to_mathjax`. @@ -207,6 +208,4 @@ def sage_mathjax_macros(): sage: sage_mathjax_macros() {'Bold': ['\\mathbf{#1}', 1], 'CC': '\\Bold{C}', ... """ - return dict( - [convert_latex_macro_to_mathjax(m) for m in sage_latex_macros()] - ) + return dict(convert_latex_macro_to_mathjax(m) for m in sage_latex_macros()) From 46d0d69257a0aec45e1a0b139390f56dba72ff2f Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 13:50:19 +0900 Subject: [PATCH 020/338] Add sage package mathjax3 --- .../mathjax3/MathJax-3.2.0/CONTRIBUTING.md | 314 ++++++++++++++++++ build/pkgs/mathjax3/MathJax-3.2.0/LICENSE | 202 +++++++++++ build/pkgs/mathjax3/MathJax-3.2.0/README.md | 237 +++++++++++++ build/pkgs/mathjax3/MathJax-3.2.0/bower.json | 11 + .../pkgs/mathjax3/MathJax-3.2.0/composer.json | 14 + .../pkgs/mathjax3/MathJax-3.2.0/package.json | 59 ++++ build/pkgs/mathjax3/SPKG.rst | 32 ++ build/pkgs/mathjax3/checksums.ini | 4 + build/pkgs/mathjax3/distros/conda.txt | 1 + build/pkgs/mathjax3/distros/opensuse.txt | 1 + build/pkgs/mathjax3/distros/repology.txt | 1 + build/pkgs/mathjax3/distros/void.txt | 1 + build/pkgs/mathjax3/package-version.txt | 1 + build/pkgs/mathjax3/spkg-install.in | 4 + build/pkgs/mathjax3/spkg-src | 34 ++ build/pkgs/mathjax3/type | 1 + 16 files changed, 917 insertions(+) create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/LICENSE create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/README.md create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/bower.json create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/composer.json create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/package.json create mode 100644 build/pkgs/mathjax3/SPKG.rst create mode 100644 build/pkgs/mathjax3/checksums.ini create mode 100644 build/pkgs/mathjax3/distros/conda.txt create mode 100644 build/pkgs/mathjax3/distros/opensuse.txt create mode 100644 build/pkgs/mathjax3/distros/repology.txt create mode 100644 build/pkgs/mathjax3/distros/void.txt create mode 100644 build/pkgs/mathjax3/package-version.txt create mode 100644 build/pkgs/mathjax3/spkg-install.in create mode 100755 build/pkgs/mathjax3/spkg-src create mode 100644 build/pkgs/mathjax3/type diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md b/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md new file mode 100644 index 00000000000..7153d85d6b6 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md @@ -0,0 +1,314 @@ +# Contributing to MathJax + +You are interested in giving us a hand? That's awesome! We've put +together some brief guidelines that should help you get started +quickly and easily. + +There are lots and lots of ways to get involved, this document covers: + +* [reporting an issue](#reporting-an-issue) + * [bug reports](#bug-reports) + * [feature requests](#feature-requests) + * [change requests](#change-requests) +* [working on MathJax core](#working-on-mathjax-core) + * [key branches and tags](#key-branches--tags) + * [submitting pull requests](#submitting-pull-requests) + * [testing and quality assurance](#testing-and-quality-assurance) + * [writing documentation](#writing-documentation) + * [translation](#translation) +* [Conduct](#conduct) + + +## Reporting An Issue + +If you're about to raise an issue because you think you've found a +problem with MathJax, or you'd like to make a request for a new +feature in the codebase, or any other reason, please read this first. + +The [MathJax issue +tracker](https://github.com/mathjax/MathJax/issues) is the +preferred channel for [bug reports](#bug-reports), [feature +requests](#feature-requests), [change requests](#change-requests), and +[submitting pull requests](#submitting-pull-requests), but please +respect the following restrictions: + +* Please **search for existing issues**. Help us keep duplicate issues + to a minimum by checking to see if someone has already reported your + problem or requested your idea. + +* Please **do not** use the issue tracker for personal support + requests (use [the MathJax User Group](https://groups.google.com/forum/#!forum/mathjax-users)). + +* Please **be civil**. Keep the discussion on topic and respect the + opinions of others. See also our [Conduct Guidelines](#conduct) + +### Bug Reports + +A bug is a *demonstrable problem* that is caused by the code in the +repository. Good bug reports are extremely helpful — thank you! + +Guidelines for bug reports: + +1. **Use the GitHub issue search** — check if the issue has already been + reported. + +2. **Check if the issue has been fixed** — look for [closed + issues in the current + milestone](https://github.com/mathjax/MathJax/issues?q=is%3Aclosed) + or try to reproduce it using the latest `develop` branch. Please + note that you will need to + [compile MathJax and make the components](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) + in order to test MathJax from the source repository. + +3. **Share a live sample of the problem** — without a live page + it is usually impossible to debug problems; see also the [Bug Report + Template](#template) below. + +4. **Isolate the problem** — a live sample is a starting point + but if you want to speed things up, create a [reduced test + case](http://css-tricks.com/6263-reduced-test-cases/). Be specific + about your setup (browser, OS versions, etc). Use services like + [jsbin](http://jsbin.com), [CodePen](http://codepen.io), or + [jsFiddle](http://jsfiddle.com) to make collaboration on minimal + test cases easier for everyone. + +5. **Include a screenshot/cast as a last resort** — Is your + issue about a layout or design feature or bug that is hard to reproduce + or isolate? Then please provide a screenshot or screencast. Tools + like [LICEcap](http://www.cockos.com/licecap/) or + [SauceLabs](http://www.saucelabs.com) allow you to quickly and + easily record a screencasts. If you make it an animated gif, you can + embed it directly into your GitHub issue. + +6. Use the [Bug Report Template](#template) below or [click this + link](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20) + to start creating a bug report with the template automatically. + +A good bug report shouldn't leave others needing to request +more information from you. Be sure to include the details of your environment. + + + +Template Example ([click to use](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20)): + +``` +Short and descriptive example bug report title + +### Issue Summary + +A summary of the issue and the browser/OS environment in which it occurs. If +suitable, include the steps required to reproduce the bug. + +### Steps to Reproduce + +1. This is the first step +2. This is the second step +3. Further steps, etc. + +Any other information you want to share that is relevant to the issue +being reported. Especially, why do you consider this to be a bug? What +do you expect to happen instead? + +### Technical details: + +* MathJax Version: 2.3 (latest commit: f3aaf3a2a3e964df2770dc4aaaa9c87ce5f47e2c) +* Client OS: Mac OS X 10.8.4 +* Browser: Chrome 29.0.1547.57 +``` + + +### Feature Requests + +Feature requests are welcome. Before you submit one, be sure to have: + +1. **Used the GitHub search** to check that the feature hasn't already + been requested. +2. Take a moment to think about whether your idea fits with the scope + and aims of the project, or if it might better fit being a [custom + extension](https://github.com/mathjax/MathJax-third-party-extensions). +3. Remember, it's up to *you* to make a strong case to convince the + project's leaders of the merits of this feature. Please provide as + much detail and context as possible, this means explaining the use + case and why it is likely to be common. + +### Change Requests + +Change requests cover both architectural and functional changes to how +MathJax works. If you have an idea for a new or different dependency, +a refactor, or an improvement to a feature, etc., please be sure to: + +1. **Use the GitHub search** to check that someone else didn't get there first. +2. Take a moment to think about the best way to make a case for, and + explain what you're thinking. Are you sure this shouldn't really be + a [bug report](#bug-reports) or a [feature + request](#feature-requests)? Is it really one idea or is it many? + What's the context? What problem are you solving? Why is what you + are suggesting better than what's already there? + +## Working on MathJax core + +You want to contribute code? We describe how below. First, note that +the MathJax source code is in the + repository, not the + repository, which contains the +packaged component files for distribution on CDNs and the [mathjax npm +package](https://www.npmjs.com/package/mathjax) (the source code is +included in the [mathjax-full npm +package](https://www.npmjs.com/package/mathjax-full)). + +### Key Branches & Tags + +MathJax uses several permanent branches in the [MathJax source repository](https://github.com/mathjax/MathJax-src): + +- **[develop](https://github.com/mathjax/MathJax-src/tree/develop)** + is the development branch. All work on the next release happens here + so you should generally branch off `develop` if you are going to + submit a pull request. Do **NOT** use this branch for a production + site. + +- **[master](https://github.com/mathjax/MathJax-src)** contains the latest + release of MathJax. This branch may be used in production. Do + **NOT** use this branch to work on MathJax's source. + +These branches reflect version 3 of MathJax, which is substantially +different from the version 2 codebase. Version 2 will continue to be +maintained while web sites transition to version 3, with work being +done using the following branches in the [MathJax distribution +repository](https://github.com/mathjax/MathJax): + +- **[legacy-v2-develop](https://github.com/mathjax/MathJax/tree/legacy-v2-develop)** + is the development branch for changes to the legacy version 2 code. + Any pull requests for version 2 should be branched from here. Do + **NOT** use this branch for a production site. + +- **[legacy-v2](https://github.com/mathjax/MathJax/tree/legacy-v2)** + is the branch that contains any updates to version 2 following + the release of version 3. Do **NOT** use this branch to work on + MathJax's source. + +In addition to these branches, MathJax uses tags to identify the +various versions. These can be checked out to obtain the specified +release; for example, `git checkout 2.7.5` would get you the files for +version 2.7.5 of MathJax. + +Note that version 3 is written in Typescript, and so must be compiled +to obtain usable javascript files, and that the components need to be +built once that is done. See the +[documentation](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) +for details. For version 2, the source javascript files are not +compressed until a release is made, so you should use the copies in +the `unpacked` directory during development. + + +### Submitting Pull Requests + +Pull requests are welcome. If you're looking to submit a PR for +something that doesn't have an open issue, please consider [raising an +issue](#reporting-an-issue) that your PR can close, especially if +you're fixing a bug. This makes it more likely that there will be +enough information available for your PR to be properly tested and +merged. + +##### Need Help? + +If you're not completely clear on how to submit/update/*do* Pull +Requests, please check out our [source control +policies](https://github.com/mathjax/MathJax/wiki/Source-control-policies). For +more insights, check the excellent in depth [Git Workflow +guide](https://github.com/TryGhost/Ghost/wiki/Git-Workflow) from +Ghost, in particular + +* [Ghost Workflow guide: commit messages](https://github.com/TryGhost/Ghost/wiki/Git-workflow#commit-messages) + +### Testing and Quality Assurance + +If you're +looking to get involved with the code base and don't know where to +start, checking out and testing a pull request is one of the most +useful things you could do. + +These are some [excellent +instructions](https://gist.github.com/piscisaureus/3342247) on +configuring your GitHub repository to allow you to checkout pull +requests in the same way as branches. + + +### Writing documentation + +MathJax's main documentation can be found at [docs.mathjax.org](http://docs.mathjax.org). +The source of the docs is hosted in the +[mathjax/MathJax-docs](http://github.com/mathjax/MathJax-docs) repo here on GitHub. + +The documentation is generated using +[Sphinx-doc](http://sphinx-doc.org/) and hosted on [Read the +docs](http://readthedocs.org). You can clone the repo and submit pull +requests following the [pull-request](#submitting-pull-requests) +guidelines. + + +### Translation + +If you wish to add or update translations of MathJax, please do it on +[TranslateWiki.net](https://translatewiki.net/w/i.php?title=Special:Translate&group=out-mathjax-0-all) +(and while you're there you can help other open source projects, +too). + +For bug reports and other questions that don't fit on +TranslateWiki.net, head over to the +[mathjax/mathjax-i18n](https://github.com/mathjax/MathJax-i18n) +repository. + +The translation files currently are for version 2, as localization +hasn't been added to version 3 yet. + +## Conduct + +As a NumFOCUS fiscally sponsored project, MathJax is governed by the +[NumFOCUS code of conduct](https://numfocus.org/code-of-conduct), +which we summarize as follows: + +We are committed to providing a friendly, safe and welcoming +environment for all, regardless of gender, sexual orientation, +disability, ethnicity, religion, or similar personal characteristic. + +Please be kind and courteous. There's no need to be mean or rude. +Respect that people have differences of opinion and that every design +or implementation choice carries a trade-off and numerous costs. There +is seldom a right answer, merely an optimal answer given a set of +values and circumstances. + +Please keep unstructured critique to a minimum. If you have solid +ideas you want to experiment with, make a fork and see how it works. + +We will exclude you from interaction if you insult, demean or harass +anyone. That is not welcome behaviour. We interpret the term +"harassment" as including the definition in the [Unacceptable +Behavior](https://numfocus.org/code-of-conduct#unacceptable-behavior) +section of the [NumFOCUS code of +conduct](https://numfocus.org/code-of-conduct); if you have any lack +of clarity about what might be included in that concept, please read +that definition. In particular, we don't tolerate behavior that +excludes people in socially marginalized groups. + +Private harassment is also unacceptable. No matter who you are, if you +feel you have been or are being harassed or made uncomfortable by a +community member, please contact one of the channel ops or any of the +[MathJax](https://github.com/MathJax/MathJax) core team +immediately. Whether you're a regular contributor or a newcomer, we +care about making this community a safe place for you and we've got +your back. + +Likewise any spamming, trolling, flaming, baiting, or other +attention-stealing behaviour is not welcome. + +We also recommend that you read [discourse's +rules](http://blog.discourse.org/2013/03/the-universal-rules-of-civilized-discourse/) +for further suggestions on appropriate behavior. + +## References + +* We heavily borrowed from Mozilla and Ghost -- thank you! + * + * +* +* diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE b/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/README.md b/build/pkgs/mathjax3/MathJax-3.2.0/README.md new file mode 100644 index 00000000000..94186007ac0 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/README.md @@ -0,0 +1,237 @@ +# MathJax +## Beautiful math in all browsers + +![GitHub release version](https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver) +![GitHub release version (v2)](https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg?label=release-v2) +![NPM version](https://img.shields.io/npm/v/mathjax.svg?style=flat) +![powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat) +![jsdelivr rank](https://flat.badgen.net/jsdelivr/rank/npm/mathjax?color=green) +![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/mathjax) +![npm monthly downloads (full)](https://img.shields.io/npm/dm/mathjax?label=npm) +![npm total downloads](https://img.shields.io/npm/dt/mathjax.svg?style=flat&label=npm%20total) + +MathJax is an open-source JavaScript display engine for LaTeX, MathML, +and AsciiMath notation that works in all modern browsers. It was +designed with the goal of consolidating the recent advances in web +technologies into a single, definitive, math-on-the-web platform +supporting the major browsers and operating systems. It requires no +setup on the part of the user (no plugins to download or software to +install), so the page author can write web documents that include +mathematics and be confident that users will be able to view it +naturally and easily. Simply include MathJax and some mathematics in +a web page, and MathJax does the rest. + +Some of the main features of MathJax include: + +- High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages + +- Supported in most browsers with no plug-ins, extra fonts, or special + setup for the reader + +- Easy for authors, flexible for publishers, extensible for developers + +- Supports math accessibility, cut-and-paste interoperability, and other + advanced functionality + +- Powerful API for integration with other web applications + +See for additional details about MathJax, +and for the MathJax documentation. + +## MathJax Components + +MathJax version 3 uses files called *components* that contain the +various MathJax modules that you can include in your web pages or +access on a server through NodeJS. Some components combine all the +pieces you need to run MathJax with one or more input formats and a +particular output format, while other components are pieces that can +be loaded on demand when needed, or by a configuration that specifies +the pieces you want to combine in a custom way. For usage +instructions, see the [MathJax documentation](https://docs.mathjax.org). + +Components provide a convenient packaging of MathJax's modules, but it +is possible for you to form your own custom components, or to use +MathJax's modules directly in a node application on a server. There +are [web examples](https://github.com/mathjax/MathJax-demos-web) +showing how to use MathJax in web pages and how to build your own +components, and [node +examples](https://github.com/mathjax/MathJax-demos-node) illustrating +how to use components in node applications or call MathJax modules +directly. + +## What's in this Repository + +This repository contains only the component files for MathJax, not the +source code for MathJax (which are available in a separate [MathJax +source repository](https://github.com/mathjax/MathJax-src/)). These +component files are the ones served by the CDNs that offer MathJax to +the web. In version 2, the files used on the web were also the source +files for MathJax, but in version 3, the source files are no longer on +the CDN, as they are not what are run in the browser. + +The components are stored in the `es5` directory, and are in ES5 format +for the widest possible compatibility. In the future, we may make an +`es6` directory containing ES6 versions of the components. + +## Installation and Use + +### Using MathJax components from a CDN on the web + +If you are loading MathJax from a CDN into a web page, there is no +need to install anything. Simply use a `script` tag that loads +MathJax from the CDN. E.g., + +``` html + +``` + +See the [MathJax +documentation](https://docs.mathjax.org/en/latest/index.html#browser-components), +the [MathJax Web Demos](https://github.com/mathjax/MathJax-demos-web), +and the [MathJax Component +Repository](https://github.com/mathjax/MathJax-demos-web) for more information. + +### Hosting your own copy of the MathJax Components + +If you want to host MathJax from your own server, you can do so by +installing the `mathjax` package using `npm` and moving the `es5` +directory to an appropriate location on your server: + +``` bash +npm install mathjax@3 +mv node_modules/mathjax/es5 /mathjax +``` + +Note that we are still making updates to version 2, so include `@3` +when you install, since the latest chronological version may not be +version 3. + +Alternatively, you can get the files via GitHub: + +``` bash +git clone https://github.com/mathjax/MathJax.git mj-tmp +mv mj-tmp/es5 /mathjax +rm -rf mj-tmp +``` + +Then (in either case) you can use a script tag like the following: + +``` html + +``` + +where `` is replaced by the URL to the location +where you moved the MathJax files above. + +See the +[documentation](https://docs.mathjax.org/en/latest/web/hosting.html) +for details. + +### Using MathJax components in a node application + +To use MathJax components in a node application, install the `mathjax` package: + +``` bash +npm install mathjax@3 +``` + +(we are still making updates to version 2, so you should include `@3` +since the latest chronological version may not be version 3). + +Then require `mathjax` within your application: + +```js +require('mathjax').init({ ... }).then((MathJax) => { ... }); +``` + +where the first `{ ... }` is a MathJax configuration, and the second +`{ ... }` is the code to run after MathJax has been loaded. E.g. + +```js +require('mathjax').init({ + loader: {load: ['input/tex', 'output/svg']} +}).then((MathJax) => { + const svg = MathJax.tex2svg('\\frac{1}{x^2-1}', {display: true}); + console.log(MathJax.startup.adaptor.outerHTML(svg)); +}).catch((err) => console.log(err.message)); +``` + +**Note:** this technique is for node-based application only, not for +browser applications. This method sets up an alternative DOM +implementation, which you don't need in the browser, and tells MathJax +to use node's `require()` command to load external modules. This +setup will not work properly in the browser, even if you webpack it or +bundle it in other ways. + +See the +[documentation](https://docs.mathjax.org/en/latest/index.html#server-nodejs) +and the [MathJax Node +Repository](https://github.com/mathjax/MathJax-demos-node) for more details. + +## Reducing the Size of the Components Directory + +Since the `es5` directory contains *all* the component files, so if +you are only planning one use one configuration, you can reduce the +size of the MathJax directory by removing unused components. For +example, if you are using the `tex-chtml.js` component, then you can +remove the `tex-mml-chtml.js`, `tex-svg.js`, `tex-mml-svg.js`, +`tex-chtml-full.js`, and `tex-svg-full.js` configurations, which will +save considerable space. Indeed, you should be able to remove +everything other than `tex-chtml.js`, and the `input/tex/extensions`, +`output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre` +directories. If you are using the results only on the web, you can +remove `adaptors` as well. + +If you are not using A11Y support (e.g., speech generation, or +semantic enrichment), then you can remove `a11y` and `sre` as well +(though in this case you may need to disable the assistive tools in +the MathJax contextual menu in order to avoid MathJax trying to load +them when they aren't there). + +If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js` +rather than `tex-chtml.js`), you can remove the +`output/chtml/fonts/woff-v2` directory. If you are using MathML input +rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`), +then you can remove `input/tex/extensions` as well. + + +## The Component Files and Pull Requests + +The `es5` directory is generated automatically from the contents of the +MathJax source repository. You can rebuild the components using the +command + +``` bash +npm run make-es5 --silent +``` + +Note that since the contents of this repository are generated +automatically, you should not submit pull requests that modify the +contents of the `es5` directory. If you wish to submit a modification +to MathJax, you should make a pull request in the [MathJax source +repository](https://github.com/mathjax/MathJax-src). + +## MathJax Community + +The main MathJax website is , and it includes +announcements and other important information. A [MathJax user +forum](http://groups.google.com/group/mathjax-users) for asking +questions and getting assistance is hosted at Google, and the [MathJax +bug tracker](https://github.com/mathjax/MathJax/issues) is hosted +at GitHub. + +Before reporting a bug, please check that it has not already been +reported. Also, please use the bug tracker (rather than the help +forum) for reporting bugs, and use the user's forum (rather than the +bug tracker) for questions about how to use MathJax. + +## MathJax Resources + +* [MathJax Documentation](https://docs.mathjax.org) +* [MathJax Components](https://github.com/mathjax/MathJax) +* [MathJax Source Code](https://github.com/mathjax/MathJax-src) +* [MathJax Web Examples](https://github.com/mathjax/MathJax-demos-web) +* [MathJax Node Examples](https://github.com/mathjax/MathJax-demos-node) +* [MathJax Bug Tracker](https://github.com/mathjax/MathJax/issues) +* [MathJax Users' Group](http://groups.google.com/group/mathjax-users) + diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/bower.json b/build/pkgs/mathjax3/MathJax-3.2.0/bower.json new file mode 100644 index 00000000000..6b214b933ea --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/bower.json @@ -0,0 +1,11 @@ +{ + "name": "MathJax", + "main": "./MathJax.js", + "homepage": "http://www.mathjax.org/", + "ignore": [ + "**/.*", + "node_modules", + "components" + ], + "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"] +} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/composer.json b/build/pkgs/mathjax3/MathJax-3.2.0/composer.json new file mode 100644 index 00000000000..b1b9d27aed6 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/composer.json @@ -0,0 +1,14 @@ +{ + "name": "mathjax/mathjax", + "type": "library", + "description": "MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.", + "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"], + "homepage": "http://www.mathjax.org/", + "license": "Apache-2.0", + "authors": [ + { + "name": "MathJax Consortium", + "homepage": "https://github.com/mathjax" + } + ] +} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/package.json b/build/pkgs/mathjax3/MathJax-3.2.0/package.json new file mode 100644 index 00000000000..6706949557b --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/package.json @@ -0,0 +1,59 @@ +{ + "name": "mathjax", + "version": "3.2.0", + "description": "Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source code).", + "keywords": [ + "math", + "svg", + "mathml", + "tex", + "latex", + "asciimath", + "browser", + "node" + ], + "devDependencies": { + "mathjax-full": "3.2.0" + }, + "maintainers": [ + "MathJax Consortium (http://www.mathjax.org)" + ], + "bugs": { + "url": "http://github.com/mathjax/MathJax/issues" + }, + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git://github.com/mathjax/MathJax.git" + }, + "main": "es5/node-main.js", + "files": [ + "/es5" + ], + "scripts": { + "test": "echo 'No tests defined'", + "clean": "npm run --silent clean:es5 && npm run --silent clean:node", + "clean:es5": "rm -rf es5", + "clean:node": "rm -rf node_modules package-lock.json", + "message": "echo \"$(tput setaf 4)${npm_package_config_message}$(tput setaf 0)\" && echo", + "line": "echo '--------------------------------------------'", + "title": "npm run --silent line && npm run --silent message --mathjax:message=\"${npm_package_config_title}\"", + "preinstall:mj3": "npm run --silent title --mathjax:title='Installing MathJax...'", + "install:mj3": "npm install", + "preinstall:mj3-deps": "npm run --silent message --mathjax:message='Installing MathJax Dependencies...'", + "install:mj3-deps": "cd node_modules/mathjax-full && npm install", + "install:all": "npm run --silent install:mj3 && npm run --silent install:mj3-deps", + "precompile": "npm run --silent title --mathjax:title='Compiling MathJax...'", + "compile": "cd node_modules/mathjax-full && npm run --silent compile", + "precomponents": "npm run --silent title --mathjax:title='Building MathJax Components...'", + "components": "cd node_modules/mathjax-full && npm run --silent make-components", + "premove": "npm run --silent title --mathjax:title='Moving MathJax Components...'", + "move": "npm run --silent clean:es5 && mv node_modules/mathjax-full/es5 .", + "premake-es5": "npm run --silent clean:node", + "make-es5": "npm run --silent install:all && npm run --silent compile && npm run --silent components && npm run --silent move", + "postmake-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node", + "preget-es5": "npm run --silent clean:node", + "get-es5": "npm run --silent install:mj3 && npm run --silent move", + "postget-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node" + } +} diff --git a/build/pkgs/mathjax3/SPKG.rst b/build/pkgs/mathjax3/SPKG.rst new file mode 100644 index 00000000000..b957186a448 --- /dev/null +++ b/build/pkgs/mathjax3/SPKG.rst @@ -0,0 +1,32 @@ +mathjax3: A JavaScript library for displaying mathematical formulas +=================================================================== + +Description +----------- + +MathJax3 is a JavaScript library for displaying mathematical formulas. + +MathJax3 is used by the Sage documentation built by Sphinx. + +License +------- + +Apache License, version 2.0 + + +Upstream Contact +---------------- + +Home page: https://www.mathjax.org/ + +Dependencies +------------ + +None + + +Special Update/Build Instructions +--------------------------------- + +None + diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini new file mode 100644 index 00000000000..4ffadfb32b1 --- /dev/null +++ b/build/pkgs/mathjax3/checksums.ini @@ -0,0 +1,4 @@ +tarball=mathjax-VERSION.tar.gz +sha1=4fec236527498c480b92032afe36d06d2741973c +md5=6eb4395cd91b71be846623d30a9bff70 +cksum=2042371852 diff --git a/build/pkgs/mathjax3/distros/conda.txt b/build/pkgs/mathjax3/distros/conda.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/conda.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/distros/opensuse.txt b/build/pkgs/mathjax3/distros/opensuse.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/opensuse.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/distros/repology.txt b/build/pkgs/mathjax3/distros/repology.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/repology.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/distros/void.txt b/build/pkgs/mathjax3/distros/void.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/void.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/package-version.txt b/build/pkgs/mathjax3/package-version.txt new file mode 100644 index 00000000000..944880fa15e --- /dev/null +++ b/build/pkgs/mathjax3/package-version.txt @@ -0,0 +1 @@ +3.2.0 diff --git a/build/pkgs/mathjax3/spkg-install.in b/build/pkgs/mathjax3/spkg-install.in new file mode 100644 index 00000000000..4429a680a53 --- /dev/null +++ b/build/pkgs/mathjax3/spkg-install.in @@ -0,0 +1,4 @@ +TARGET="${SAGE_SHARE}/mathjax3" +# Cleanup installed version +rm -rf "${TARGET}" +sdh_install src/* "${TARGET}" diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src new file mode 100755 index 00000000000..dadb1411c6f --- /dev/null +++ b/build/pkgs/mathjax3/spkg-src @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -e + +[ -n "${SAGE_ROOT}" ] || SAGE_ROOT="$(pwd)/../../../" + + +# determine latest version. +GIT_VERSION="$(curl https://github.com/mathjax/MathJax/releases | grep 'MathJax v' | head -1 | sed 's|^.*MathJax v||g' | sed 's/\s*$//g')" +echo "GIT_VERSION=$GIT_VERSION" + +# fetch and rename latest version. +URL="https://github.com/mathjax/MathJax/archive/refs/tags/${GIT_VERSION}.zip" +echo "Downloading $URL" +rm -rf src +if [ -z "$UPSTREAM_SOURCE_TARBALL" ]; then + tar xzf <( curl -L "$URL" ) +else + tar xzf "$UPSTREAM_SOURCE_TARBALL" +fi + +mv MathJax-${GIT_VERSION}/es5 src + +PACKAGE_VERSION=${GIT_VERSION} + +# repack +tar czf "$SAGE_ROOT/upstream/mathjax-${PACKAGE_VERSION}.tar.gz" src +rm -rf src + +# update package info +echo "${PACKAGE_VERSION}" > 'package-version.txt' +"$SAGE_ROOT"/sage --package fix-checksum mathjax3 + + diff --git a/build/pkgs/mathjax3/type b/build/pkgs/mathjax3/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/mathjax3/type @@ -0,0 +1 @@ +standard From 6da197eaba5d868ee70a71819b7ce4572a679d6d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 14:07:39 +0900 Subject: [PATCH 021/338] Remove garbage files --- .../mathjax3/MathJax-3.2.0/CONTRIBUTING.md | 314 ------------------ build/pkgs/mathjax3/MathJax-3.2.0/LICENSE | 202 ----------- build/pkgs/mathjax3/MathJax-3.2.0/README.md | 237 ------------- build/pkgs/mathjax3/MathJax-3.2.0/bower.json | 11 - .../pkgs/mathjax3/MathJax-3.2.0/composer.json | 14 - .../pkgs/mathjax3/MathJax-3.2.0/package.json | 59 ---- build/pkgs/mathjax3/checksums.ini | 6 +- build/pkgs/mathjax3/spkg-src | 1 + 8 files changed, 4 insertions(+), 840 deletions(-) delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/LICENSE delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/README.md delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/bower.json delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/composer.json delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/package.json diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md b/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md deleted file mode 100644 index 7153d85d6b6..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md +++ /dev/null @@ -1,314 +0,0 @@ -# Contributing to MathJax - -You are interested in giving us a hand? That's awesome! We've put -together some brief guidelines that should help you get started -quickly and easily. - -There are lots and lots of ways to get involved, this document covers: - -* [reporting an issue](#reporting-an-issue) - * [bug reports](#bug-reports) - * [feature requests](#feature-requests) - * [change requests](#change-requests) -* [working on MathJax core](#working-on-mathjax-core) - * [key branches and tags](#key-branches--tags) - * [submitting pull requests](#submitting-pull-requests) - * [testing and quality assurance](#testing-and-quality-assurance) - * [writing documentation](#writing-documentation) - * [translation](#translation) -* [Conduct](#conduct) - - -## Reporting An Issue - -If you're about to raise an issue because you think you've found a -problem with MathJax, or you'd like to make a request for a new -feature in the codebase, or any other reason, please read this first. - -The [MathJax issue -tracker](https://github.com/mathjax/MathJax/issues) is the -preferred channel for [bug reports](#bug-reports), [feature -requests](#feature-requests), [change requests](#change-requests), and -[submitting pull requests](#submitting-pull-requests), but please -respect the following restrictions: - -* Please **search for existing issues**. Help us keep duplicate issues - to a minimum by checking to see if someone has already reported your - problem or requested your idea. - -* Please **do not** use the issue tracker for personal support - requests (use [the MathJax User Group](https://groups.google.com/forum/#!forum/mathjax-users)). - -* Please **be civil**. Keep the discussion on topic and respect the - opinions of others. See also our [Conduct Guidelines](#conduct) - -### Bug Reports - -A bug is a *demonstrable problem* that is caused by the code in the -repository. Good bug reports are extremely helpful — thank you! - -Guidelines for bug reports: - -1. **Use the GitHub issue search** — check if the issue has already been - reported. - -2. **Check if the issue has been fixed** — look for [closed - issues in the current - milestone](https://github.com/mathjax/MathJax/issues?q=is%3Aclosed) - or try to reproduce it using the latest `develop` branch. Please - note that you will need to - [compile MathJax and make the components](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) - in order to test MathJax from the source repository. - -3. **Share a live sample of the problem** — without a live page - it is usually impossible to debug problems; see also the [Bug Report - Template](#template) below. - -4. **Isolate the problem** — a live sample is a starting point - but if you want to speed things up, create a [reduced test - case](http://css-tricks.com/6263-reduced-test-cases/). Be specific - about your setup (browser, OS versions, etc). Use services like - [jsbin](http://jsbin.com), [CodePen](http://codepen.io), or - [jsFiddle](http://jsfiddle.com) to make collaboration on minimal - test cases easier for everyone. - -5. **Include a screenshot/cast as a last resort** — Is your - issue about a layout or design feature or bug that is hard to reproduce - or isolate? Then please provide a screenshot or screencast. Tools - like [LICEcap](http://www.cockos.com/licecap/) or - [SauceLabs](http://www.saucelabs.com) allow you to quickly and - easily record a screencasts. If you make it an animated gif, you can - embed it directly into your GitHub issue. - -6. Use the [Bug Report Template](#template) below or [click this - link](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20) - to start creating a bug report with the template automatically. - -A good bug report shouldn't leave others needing to request -more information from you. Be sure to include the details of your environment. - - - -Template Example ([click to use](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20)): - -``` -Short and descriptive example bug report title - -### Issue Summary - -A summary of the issue and the browser/OS environment in which it occurs. If -suitable, include the steps required to reproduce the bug. - -### Steps to Reproduce - -1. This is the first step -2. This is the second step -3. Further steps, etc. - -Any other information you want to share that is relevant to the issue -being reported. Especially, why do you consider this to be a bug? What -do you expect to happen instead? - -### Technical details: - -* MathJax Version: 2.3 (latest commit: f3aaf3a2a3e964df2770dc4aaaa9c87ce5f47e2c) -* Client OS: Mac OS X 10.8.4 -* Browser: Chrome 29.0.1547.57 -``` - - -### Feature Requests - -Feature requests are welcome. Before you submit one, be sure to have: - -1. **Used the GitHub search** to check that the feature hasn't already - been requested. -2. Take a moment to think about whether your idea fits with the scope - and aims of the project, or if it might better fit being a [custom - extension](https://github.com/mathjax/MathJax-third-party-extensions). -3. Remember, it's up to *you* to make a strong case to convince the - project's leaders of the merits of this feature. Please provide as - much detail and context as possible, this means explaining the use - case and why it is likely to be common. - -### Change Requests - -Change requests cover both architectural and functional changes to how -MathJax works. If you have an idea for a new or different dependency, -a refactor, or an improvement to a feature, etc., please be sure to: - -1. **Use the GitHub search** to check that someone else didn't get there first. -2. Take a moment to think about the best way to make a case for, and - explain what you're thinking. Are you sure this shouldn't really be - a [bug report](#bug-reports) or a [feature - request](#feature-requests)? Is it really one idea or is it many? - What's the context? What problem are you solving? Why is what you - are suggesting better than what's already there? - -## Working on MathJax core - -You want to contribute code? We describe how below. First, note that -the MathJax source code is in the - repository, not the - repository, which contains the -packaged component files for distribution on CDNs and the [mathjax npm -package](https://www.npmjs.com/package/mathjax) (the source code is -included in the [mathjax-full npm -package](https://www.npmjs.com/package/mathjax-full)). - -### Key Branches & Tags - -MathJax uses several permanent branches in the [MathJax source repository](https://github.com/mathjax/MathJax-src): - -- **[develop](https://github.com/mathjax/MathJax-src/tree/develop)** - is the development branch. All work on the next release happens here - so you should generally branch off `develop` if you are going to - submit a pull request. Do **NOT** use this branch for a production - site. - -- **[master](https://github.com/mathjax/MathJax-src)** contains the latest - release of MathJax. This branch may be used in production. Do - **NOT** use this branch to work on MathJax's source. - -These branches reflect version 3 of MathJax, which is substantially -different from the version 2 codebase. Version 2 will continue to be -maintained while web sites transition to version 3, with work being -done using the following branches in the [MathJax distribution -repository](https://github.com/mathjax/MathJax): - -- **[legacy-v2-develop](https://github.com/mathjax/MathJax/tree/legacy-v2-develop)** - is the development branch for changes to the legacy version 2 code. - Any pull requests for version 2 should be branched from here. Do - **NOT** use this branch for a production site. - -- **[legacy-v2](https://github.com/mathjax/MathJax/tree/legacy-v2)** - is the branch that contains any updates to version 2 following - the release of version 3. Do **NOT** use this branch to work on - MathJax's source. - -In addition to these branches, MathJax uses tags to identify the -various versions. These can be checked out to obtain the specified -release; for example, `git checkout 2.7.5` would get you the files for -version 2.7.5 of MathJax. - -Note that version 3 is written in Typescript, and so must be compiled -to obtain usable javascript files, and that the components need to be -built once that is done. See the -[documentation](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) -for details. For version 2, the source javascript files are not -compressed until a release is made, so you should use the copies in -the `unpacked` directory during development. - - -### Submitting Pull Requests - -Pull requests are welcome. If you're looking to submit a PR for -something that doesn't have an open issue, please consider [raising an -issue](#reporting-an-issue) that your PR can close, especially if -you're fixing a bug. This makes it more likely that there will be -enough information available for your PR to be properly tested and -merged. - -##### Need Help? - -If you're not completely clear on how to submit/update/*do* Pull -Requests, please check out our [source control -policies](https://github.com/mathjax/MathJax/wiki/Source-control-policies). For -more insights, check the excellent in depth [Git Workflow -guide](https://github.com/TryGhost/Ghost/wiki/Git-Workflow) from -Ghost, in particular - -* [Ghost Workflow guide: commit messages](https://github.com/TryGhost/Ghost/wiki/Git-workflow#commit-messages) - -### Testing and Quality Assurance - -If you're -looking to get involved with the code base and don't know where to -start, checking out and testing a pull request is one of the most -useful things you could do. - -These are some [excellent -instructions](https://gist.github.com/piscisaureus/3342247) on -configuring your GitHub repository to allow you to checkout pull -requests in the same way as branches. - - -### Writing documentation - -MathJax's main documentation can be found at [docs.mathjax.org](http://docs.mathjax.org). -The source of the docs is hosted in the -[mathjax/MathJax-docs](http://github.com/mathjax/MathJax-docs) repo here on GitHub. - -The documentation is generated using -[Sphinx-doc](http://sphinx-doc.org/) and hosted on [Read the -docs](http://readthedocs.org). You can clone the repo and submit pull -requests following the [pull-request](#submitting-pull-requests) -guidelines. - - -### Translation - -If you wish to add or update translations of MathJax, please do it on -[TranslateWiki.net](https://translatewiki.net/w/i.php?title=Special:Translate&group=out-mathjax-0-all) -(and while you're there you can help other open source projects, -too). - -For bug reports and other questions that don't fit on -TranslateWiki.net, head over to the -[mathjax/mathjax-i18n](https://github.com/mathjax/MathJax-i18n) -repository. - -The translation files currently are for version 2, as localization -hasn't been added to version 3 yet. - -## Conduct - -As a NumFOCUS fiscally sponsored project, MathJax is governed by the -[NumFOCUS code of conduct](https://numfocus.org/code-of-conduct), -which we summarize as follows: - -We are committed to providing a friendly, safe and welcoming -environment for all, regardless of gender, sexual orientation, -disability, ethnicity, religion, or similar personal characteristic. - -Please be kind and courteous. There's no need to be mean or rude. -Respect that people have differences of opinion and that every design -or implementation choice carries a trade-off and numerous costs. There -is seldom a right answer, merely an optimal answer given a set of -values and circumstances. - -Please keep unstructured critique to a minimum. If you have solid -ideas you want to experiment with, make a fork and see how it works. - -We will exclude you from interaction if you insult, demean or harass -anyone. That is not welcome behaviour. We interpret the term -"harassment" as including the definition in the [Unacceptable -Behavior](https://numfocus.org/code-of-conduct#unacceptable-behavior) -section of the [NumFOCUS code of -conduct](https://numfocus.org/code-of-conduct); if you have any lack -of clarity about what might be included in that concept, please read -that definition. In particular, we don't tolerate behavior that -excludes people in socially marginalized groups. - -Private harassment is also unacceptable. No matter who you are, if you -feel you have been or are being harassed or made uncomfortable by a -community member, please contact one of the channel ops or any of the -[MathJax](https://github.com/MathJax/MathJax) core team -immediately. Whether you're a regular contributor or a newcomer, we -care about making this community a safe place for you and we've got -your back. - -Likewise any spamming, trolling, flaming, baiting, or other -attention-stealing behaviour is not welcome. - -We also recommend that you read [discourse's -rules](http://blog.discourse.org/2013/03/the-universal-rules-of-civilized-discourse/) -for further suggestions on appropriate behavior. - -## References - -* We heavily borrowed from Mozilla and Ghost -- thank you! - * - * -* -* diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE b/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE deleted file mode 100644 index d6456956733..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/README.md b/build/pkgs/mathjax3/MathJax-3.2.0/README.md deleted file mode 100644 index 94186007ac0..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/README.md +++ /dev/null @@ -1,237 +0,0 @@ -# MathJax -## Beautiful math in all browsers - -![GitHub release version](https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver) -![GitHub release version (v2)](https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg?label=release-v2) -![NPM version](https://img.shields.io/npm/v/mathjax.svg?style=flat) -![powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat) -![jsdelivr rank](https://flat.badgen.net/jsdelivr/rank/npm/mathjax?color=green) -![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/mathjax) -![npm monthly downloads (full)](https://img.shields.io/npm/dm/mathjax?label=npm) -![npm total downloads](https://img.shields.io/npm/dt/mathjax.svg?style=flat&label=npm%20total) - -MathJax is an open-source JavaScript display engine for LaTeX, MathML, -and AsciiMath notation that works in all modern browsers. It was -designed with the goal of consolidating the recent advances in web -technologies into a single, definitive, math-on-the-web platform -supporting the major browsers and operating systems. It requires no -setup on the part of the user (no plugins to download or software to -install), so the page author can write web documents that include -mathematics and be confident that users will be able to view it -naturally and easily. Simply include MathJax and some mathematics in -a web page, and MathJax does the rest. - -Some of the main features of MathJax include: - -- High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages - -- Supported in most browsers with no plug-ins, extra fonts, or special - setup for the reader - -- Easy for authors, flexible for publishers, extensible for developers - -- Supports math accessibility, cut-and-paste interoperability, and other - advanced functionality - -- Powerful API for integration with other web applications - -See for additional details about MathJax, -and for the MathJax documentation. - -## MathJax Components - -MathJax version 3 uses files called *components* that contain the -various MathJax modules that you can include in your web pages or -access on a server through NodeJS. Some components combine all the -pieces you need to run MathJax with one or more input formats and a -particular output format, while other components are pieces that can -be loaded on demand when needed, or by a configuration that specifies -the pieces you want to combine in a custom way. For usage -instructions, see the [MathJax documentation](https://docs.mathjax.org). - -Components provide a convenient packaging of MathJax's modules, but it -is possible for you to form your own custom components, or to use -MathJax's modules directly in a node application on a server. There -are [web examples](https://github.com/mathjax/MathJax-demos-web) -showing how to use MathJax in web pages and how to build your own -components, and [node -examples](https://github.com/mathjax/MathJax-demos-node) illustrating -how to use components in node applications or call MathJax modules -directly. - -## What's in this Repository - -This repository contains only the component files for MathJax, not the -source code for MathJax (which are available in a separate [MathJax -source repository](https://github.com/mathjax/MathJax-src/)). These -component files are the ones served by the CDNs that offer MathJax to -the web. In version 2, the files used on the web were also the source -files for MathJax, but in version 3, the source files are no longer on -the CDN, as they are not what are run in the browser. - -The components are stored in the `es5` directory, and are in ES5 format -for the widest possible compatibility. In the future, we may make an -`es6` directory containing ES6 versions of the components. - -## Installation and Use - -### Using MathJax components from a CDN on the web - -If you are loading MathJax from a CDN into a web page, there is no -need to install anything. Simply use a `script` tag that loads -MathJax from the CDN. E.g., - -``` html - -``` - -See the [MathJax -documentation](https://docs.mathjax.org/en/latest/index.html#browser-components), -the [MathJax Web Demos](https://github.com/mathjax/MathJax-demos-web), -and the [MathJax Component -Repository](https://github.com/mathjax/MathJax-demos-web) for more information. - -### Hosting your own copy of the MathJax Components - -If you want to host MathJax from your own server, you can do so by -installing the `mathjax` package using `npm` and moving the `es5` -directory to an appropriate location on your server: - -``` bash -npm install mathjax@3 -mv node_modules/mathjax/es5 /mathjax -``` - -Note that we are still making updates to version 2, so include `@3` -when you install, since the latest chronological version may not be -version 3. - -Alternatively, you can get the files via GitHub: - -``` bash -git clone https://github.com/mathjax/MathJax.git mj-tmp -mv mj-tmp/es5 /mathjax -rm -rf mj-tmp -``` - -Then (in either case) you can use a script tag like the following: - -``` html - -``` - -where `` is replaced by the URL to the location -where you moved the MathJax files above. - -See the -[documentation](https://docs.mathjax.org/en/latest/web/hosting.html) -for details. - -### Using MathJax components in a node application - -To use MathJax components in a node application, install the `mathjax` package: - -``` bash -npm install mathjax@3 -``` - -(we are still making updates to version 2, so you should include `@3` -since the latest chronological version may not be version 3). - -Then require `mathjax` within your application: - -```js -require('mathjax').init({ ... }).then((MathJax) => { ... }); -``` - -where the first `{ ... }` is a MathJax configuration, and the second -`{ ... }` is the code to run after MathJax has been loaded. E.g. - -```js -require('mathjax').init({ - loader: {load: ['input/tex', 'output/svg']} -}).then((MathJax) => { - const svg = MathJax.tex2svg('\\frac{1}{x^2-1}', {display: true}); - console.log(MathJax.startup.adaptor.outerHTML(svg)); -}).catch((err) => console.log(err.message)); -``` - -**Note:** this technique is for node-based application only, not for -browser applications. This method sets up an alternative DOM -implementation, which you don't need in the browser, and tells MathJax -to use node's `require()` command to load external modules. This -setup will not work properly in the browser, even if you webpack it or -bundle it in other ways. - -See the -[documentation](https://docs.mathjax.org/en/latest/index.html#server-nodejs) -and the [MathJax Node -Repository](https://github.com/mathjax/MathJax-demos-node) for more details. - -## Reducing the Size of the Components Directory - -Since the `es5` directory contains *all* the component files, so if -you are only planning one use one configuration, you can reduce the -size of the MathJax directory by removing unused components. For -example, if you are using the `tex-chtml.js` component, then you can -remove the `tex-mml-chtml.js`, `tex-svg.js`, `tex-mml-svg.js`, -`tex-chtml-full.js`, and `tex-svg-full.js` configurations, which will -save considerable space. Indeed, you should be able to remove -everything other than `tex-chtml.js`, and the `input/tex/extensions`, -`output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre` -directories. If you are using the results only on the web, you can -remove `adaptors` as well. - -If you are not using A11Y support (e.g., speech generation, or -semantic enrichment), then you can remove `a11y` and `sre` as well -(though in this case you may need to disable the assistive tools in -the MathJax contextual menu in order to avoid MathJax trying to load -them when they aren't there). - -If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js` -rather than `tex-chtml.js`), you can remove the -`output/chtml/fonts/woff-v2` directory. If you are using MathML input -rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`), -then you can remove `input/tex/extensions` as well. - - -## The Component Files and Pull Requests - -The `es5` directory is generated automatically from the contents of the -MathJax source repository. You can rebuild the components using the -command - -``` bash -npm run make-es5 --silent -``` - -Note that since the contents of this repository are generated -automatically, you should not submit pull requests that modify the -contents of the `es5` directory. If you wish to submit a modification -to MathJax, you should make a pull request in the [MathJax source -repository](https://github.com/mathjax/MathJax-src). - -## MathJax Community - -The main MathJax website is , and it includes -announcements and other important information. A [MathJax user -forum](http://groups.google.com/group/mathjax-users) for asking -questions and getting assistance is hosted at Google, and the [MathJax -bug tracker](https://github.com/mathjax/MathJax/issues) is hosted -at GitHub. - -Before reporting a bug, please check that it has not already been -reported. Also, please use the bug tracker (rather than the help -forum) for reporting bugs, and use the user's forum (rather than the -bug tracker) for questions about how to use MathJax. - -## MathJax Resources - -* [MathJax Documentation](https://docs.mathjax.org) -* [MathJax Components](https://github.com/mathjax/MathJax) -* [MathJax Source Code](https://github.com/mathjax/MathJax-src) -* [MathJax Web Examples](https://github.com/mathjax/MathJax-demos-web) -* [MathJax Node Examples](https://github.com/mathjax/MathJax-demos-node) -* [MathJax Bug Tracker](https://github.com/mathjax/MathJax/issues) -* [MathJax Users' Group](http://groups.google.com/group/mathjax-users) - diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/bower.json b/build/pkgs/mathjax3/MathJax-3.2.0/bower.json deleted file mode 100644 index 6b214b933ea..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "MathJax", - "main": "./MathJax.js", - "homepage": "http://www.mathjax.org/", - "ignore": [ - "**/.*", - "node_modules", - "components" - ], - "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"] -} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/composer.json b/build/pkgs/mathjax3/MathJax-3.2.0/composer.json deleted file mode 100644 index b1b9d27aed6..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/composer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "mathjax/mathjax", - "type": "library", - "description": "MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.", - "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"], - "homepage": "http://www.mathjax.org/", - "license": "Apache-2.0", - "authors": [ - { - "name": "MathJax Consortium", - "homepage": "https://github.com/mathjax" - } - ] -} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/package.json b/build/pkgs/mathjax3/MathJax-3.2.0/package.json deleted file mode 100644 index 6706949557b..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "mathjax", - "version": "3.2.0", - "description": "Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source code).", - "keywords": [ - "math", - "svg", - "mathml", - "tex", - "latex", - "asciimath", - "browser", - "node" - ], - "devDependencies": { - "mathjax-full": "3.2.0" - }, - "maintainers": [ - "MathJax Consortium (http://www.mathjax.org)" - ], - "bugs": { - "url": "http://github.com/mathjax/MathJax/issues" - }, - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "git://github.com/mathjax/MathJax.git" - }, - "main": "es5/node-main.js", - "files": [ - "/es5" - ], - "scripts": { - "test": "echo 'No tests defined'", - "clean": "npm run --silent clean:es5 && npm run --silent clean:node", - "clean:es5": "rm -rf es5", - "clean:node": "rm -rf node_modules package-lock.json", - "message": "echo \"$(tput setaf 4)${npm_package_config_message}$(tput setaf 0)\" && echo", - "line": "echo '--------------------------------------------'", - "title": "npm run --silent line && npm run --silent message --mathjax:message=\"${npm_package_config_title}\"", - "preinstall:mj3": "npm run --silent title --mathjax:title='Installing MathJax...'", - "install:mj3": "npm install", - "preinstall:mj3-deps": "npm run --silent message --mathjax:message='Installing MathJax Dependencies...'", - "install:mj3-deps": "cd node_modules/mathjax-full && npm install", - "install:all": "npm run --silent install:mj3 && npm run --silent install:mj3-deps", - "precompile": "npm run --silent title --mathjax:title='Compiling MathJax...'", - "compile": "cd node_modules/mathjax-full && npm run --silent compile", - "precomponents": "npm run --silent title --mathjax:title='Building MathJax Components...'", - "components": "cd node_modules/mathjax-full && npm run --silent make-components", - "premove": "npm run --silent title --mathjax:title='Moving MathJax Components...'", - "move": "npm run --silent clean:es5 && mv node_modules/mathjax-full/es5 .", - "premake-es5": "npm run --silent clean:node", - "make-es5": "npm run --silent install:all && npm run --silent compile && npm run --silent components && npm run --silent move", - "postmake-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node", - "preget-es5": "npm run --silent clean:node", - "get-es5": "npm run --silent install:mj3 && npm run --silent move", - "postget-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node" - } -} diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini index 4ffadfb32b1..c46436941ad 100644 --- a/build/pkgs/mathjax3/checksums.ini +++ b/build/pkgs/mathjax3/checksums.ini @@ -1,4 +1,4 @@ tarball=mathjax-VERSION.tar.gz -sha1=4fec236527498c480b92032afe36d06d2741973c -md5=6eb4395cd91b71be846623d30a9bff70 -cksum=2042371852 +sha1=60445ab91fdec88b5bff750e604adca1defe0019 +md5=84145ea49e91b5317385705d37060c4e +cksum=3733185847 diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src index dadb1411c6f..266e5e2554d 100755 --- a/build/pkgs/mathjax3/spkg-src +++ b/build/pkgs/mathjax3/spkg-src @@ -20,6 +20,7 @@ else fi mv MathJax-${GIT_VERSION}/es5 src +rm -r MathJax-${GIT_VERSION} PACKAGE_VERSION=${GIT_VERSION} From bd60742011ccf822629c8dda8a35315da839459d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 16:32:34 +0900 Subject: [PATCH 022/338] Put into mathjax subdirectory --- build/pkgs/mathjax3/checksums.ini | 6 +++--- build/pkgs/mathjax3/spkg-src | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini index c46436941ad..2cfe5869dd5 100644 --- a/build/pkgs/mathjax3/checksums.ini +++ b/build/pkgs/mathjax3/checksums.ini @@ -1,4 +1,4 @@ tarball=mathjax-VERSION.tar.gz -sha1=60445ab91fdec88b5bff750e604adca1defe0019 -md5=84145ea49e91b5317385705d37060c4e -cksum=3733185847 +sha1=ed325638d807fac93e4b1b9d052e2a72164bbaba +md5=7a78a9e649f69a295ad11cb476857cd5 +cksum=1951447424 diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src index 266e5e2554d..b20462e48d1 100755 --- a/build/pkgs/mathjax3/spkg-src +++ b/build/pkgs/mathjax3/spkg-src @@ -4,7 +4,6 @@ set -e [ -n "${SAGE_ROOT}" ] || SAGE_ROOT="$(pwd)/../../../" - # determine latest version. GIT_VERSION="$(curl https://github.com/mathjax/MathJax/releases | grep 'MathJax v' | head -1 | sed 's|^.*MathJax v||g' | sed 's/\s*$//g')" echo "GIT_VERSION=$GIT_VERSION" @@ -19,7 +18,8 @@ else tar xzf "$UPSTREAM_SOURCE_TARBALL" fi -mv MathJax-${GIT_VERSION}/es5 src +mkdir src +mv MathJax-${GIT_VERSION}/es5 src/mathjax rm -r MathJax-${GIT_VERSION} PACKAGE_VERSION=${GIT_VERSION} From d647ea6665a878e0edf2d4a732fba53d13773304 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 13:50:19 +0900 Subject: [PATCH 023/338] Add sage package mathjax3 --- .../mathjax3/MathJax-3.2.0/CONTRIBUTING.md | 314 ++++++++++++++++++ build/pkgs/mathjax3/MathJax-3.2.0/LICENSE | 202 +++++++++++ build/pkgs/mathjax3/MathJax-3.2.0/README.md | 237 +++++++++++++ build/pkgs/mathjax3/MathJax-3.2.0/bower.json | 11 + .../pkgs/mathjax3/MathJax-3.2.0/composer.json | 14 + .../pkgs/mathjax3/MathJax-3.2.0/package.json | 59 ++++ build/pkgs/mathjax3/SPKG.rst | 32 ++ build/pkgs/mathjax3/checksums.ini | 4 + build/pkgs/mathjax3/distros/conda.txt | 1 + build/pkgs/mathjax3/distros/opensuse.txt | 1 + build/pkgs/mathjax3/distros/repology.txt | 1 + build/pkgs/mathjax3/distros/void.txt | 1 + build/pkgs/mathjax3/package-version.txt | 1 + build/pkgs/mathjax3/spkg-install.in | 4 + build/pkgs/mathjax3/spkg-src | 34 ++ build/pkgs/mathjax3/type | 1 + 16 files changed, 917 insertions(+) create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/LICENSE create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/README.md create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/bower.json create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/composer.json create mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/package.json create mode 100644 build/pkgs/mathjax3/SPKG.rst create mode 100644 build/pkgs/mathjax3/checksums.ini create mode 100644 build/pkgs/mathjax3/distros/conda.txt create mode 100644 build/pkgs/mathjax3/distros/opensuse.txt create mode 100644 build/pkgs/mathjax3/distros/repology.txt create mode 100644 build/pkgs/mathjax3/distros/void.txt create mode 100644 build/pkgs/mathjax3/package-version.txt create mode 100644 build/pkgs/mathjax3/spkg-install.in create mode 100755 build/pkgs/mathjax3/spkg-src create mode 100644 build/pkgs/mathjax3/type diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md b/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md new file mode 100644 index 00000000000..7153d85d6b6 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md @@ -0,0 +1,314 @@ +# Contributing to MathJax + +You are interested in giving us a hand? That's awesome! We've put +together some brief guidelines that should help you get started +quickly and easily. + +There are lots and lots of ways to get involved, this document covers: + +* [reporting an issue](#reporting-an-issue) + * [bug reports](#bug-reports) + * [feature requests](#feature-requests) + * [change requests](#change-requests) +* [working on MathJax core](#working-on-mathjax-core) + * [key branches and tags](#key-branches--tags) + * [submitting pull requests](#submitting-pull-requests) + * [testing and quality assurance](#testing-and-quality-assurance) + * [writing documentation](#writing-documentation) + * [translation](#translation) +* [Conduct](#conduct) + + +## Reporting An Issue + +If you're about to raise an issue because you think you've found a +problem with MathJax, or you'd like to make a request for a new +feature in the codebase, or any other reason, please read this first. + +The [MathJax issue +tracker](https://github.com/mathjax/MathJax/issues) is the +preferred channel for [bug reports](#bug-reports), [feature +requests](#feature-requests), [change requests](#change-requests), and +[submitting pull requests](#submitting-pull-requests), but please +respect the following restrictions: + +* Please **search for existing issues**. Help us keep duplicate issues + to a minimum by checking to see if someone has already reported your + problem or requested your idea. + +* Please **do not** use the issue tracker for personal support + requests (use [the MathJax User Group](https://groups.google.com/forum/#!forum/mathjax-users)). + +* Please **be civil**. Keep the discussion on topic and respect the + opinions of others. See also our [Conduct Guidelines](#conduct) + +### Bug Reports + +A bug is a *demonstrable problem* that is caused by the code in the +repository. Good bug reports are extremely helpful — thank you! + +Guidelines for bug reports: + +1. **Use the GitHub issue search** — check if the issue has already been + reported. + +2. **Check if the issue has been fixed** — look for [closed + issues in the current + milestone](https://github.com/mathjax/MathJax/issues?q=is%3Aclosed) + or try to reproduce it using the latest `develop` branch. Please + note that you will need to + [compile MathJax and make the components](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) + in order to test MathJax from the source repository. + +3. **Share a live sample of the problem** — without a live page + it is usually impossible to debug problems; see also the [Bug Report + Template](#template) below. + +4. **Isolate the problem** — a live sample is a starting point + but if you want to speed things up, create a [reduced test + case](http://css-tricks.com/6263-reduced-test-cases/). Be specific + about your setup (browser, OS versions, etc). Use services like + [jsbin](http://jsbin.com), [CodePen](http://codepen.io), or + [jsFiddle](http://jsfiddle.com) to make collaboration on minimal + test cases easier for everyone. + +5. **Include a screenshot/cast as a last resort** — Is your + issue about a layout or design feature or bug that is hard to reproduce + or isolate? Then please provide a screenshot or screencast. Tools + like [LICEcap](http://www.cockos.com/licecap/) or + [SauceLabs](http://www.saucelabs.com) allow you to quickly and + easily record a screencasts. If you make it an animated gif, you can + embed it directly into your GitHub issue. + +6. Use the [Bug Report Template](#template) below or [click this + link](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20) + to start creating a bug report with the template automatically. + +A good bug report shouldn't leave others needing to request +more information from you. Be sure to include the details of your environment. + + + +Template Example ([click to use](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20)): + +``` +Short and descriptive example bug report title + +### Issue Summary + +A summary of the issue and the browser/OS environment in which it occurs. If +suitable, include the steps required to reproduce the bug. + +### Steps to Reproduce + +1. This is the first step +2. This is the second step +3. Further steps, etc. + +Any other information you want to share that is relevant to the issue +being reported. Especially, why do you consider this to be a bug? What +do you expect to happen instead? + +### Technical details: + +* MathJax Version: 2.3 (latest commit: f3aaf3a2a3e964df2770dc4aaaa9c87ce5f47e2c) +* Client OS: Mac OS X 10.8.4 +* Browser: Chrome 29.0.1547.57 +``` + + +### Feature Requests + +Feature requests are welcome. Before you submit one, be sure to have: + +1. **Used the GitHub search** to check that the feature hasn't already + been requested. +2. Take a moment to think about whether your idea fits with the scope + and aims of the project, or if it might better fit being a [custom + extension](https://github.com/mathjax/MathJax-third-party-extensions). +3. Remember, it's up to *you* to make a strong case to convince the + project's leaders of the merits of this feature. Please provide as + much detail and context as possible, this means explaining the use + case and why it is likely to be common. + +### Change Requests + +Change requests cover both architectural and functional changes to how +MathJax works. If you have an idea for a new or different dependency, +a refactor, or an improvement to a feature, etc., please be sure to: + +1. **Use the GitHub search** to check that someone else didn't get there first. +2. Take a moment to think about the best way to make a case for, and + explain what you're thinking. Are you sure this shouldn't really be + a [bug report](#bug-reports) or a [feature + request](#feature-requests)? Is it really one idea or is it many? + What's the context? What problem are you solving? Why is what you + are suggesting better than what's already there? + +## Working on MathJax core + +You want to contribute code? We describe how below. First, note that +the MathJax source code is in the + repository, not the + repository, which contains the +packaged component files for distribution on CDNs and the [mathjax npm +package](https://www.npmjs.com/package/mathjax) (the source code is +included in the [mathjax-full npm +package](https://www.npmjs.com/package/mathjax-full)). + +### Key Branches & Tags + +MathJax uses several permanent branches in the [MathJax source repository](https://github.com/mathjax/MathJax-src): + +- **[develop](https://github.com/mathjax/MathJax-src/tree/develop)** + is the development branch. All work on the next release happens here + so you should generally branch off `develop` if you are going to + submit a pull request. Do **NOT** use this branch for a production + site. + +- **[master](https://github.com/mathjax/MathJax-src)** contains the latest + release of MathJax. This branch may be used in production. Do + **NOT** use this branch to work on MathJax's source. + +These branches reflect version 3 of MathJax, which is substantially +different from the version 2 codebase. Version 2 will continue to be +maintained while web sites transition to version 3, with work being +done using the following branches in the [MathJax distribution +repository](https://github.com/mathjax/MathJax): + +- **[legacy-v2-develop](https://github.com/mathjax/MathJax/tree/legacy-v2-develop)** + is the development branch for changes to the legacy version 2 code. + Any pull requests for version 2 should be branched from here. Do + **NOT** use this branch for a production site. + +- **[legacy-v2](https://github.com/mathjax/MathJax/tree/legacy-v2)** + is the branch that contains any updates to version 2 following + the release of version 3. Do **NOT** use this branch to work on + MathJax's source. + +In addition to these branches, MathJax uses tags to identify the +various versions. These can be checked out to obtain the specified +release; for example, `git checkout 2.7.5` would get you the files for +version 2.7.5 of MathJax. + +Note that version 3 is written in Typescript, and so must be compiled +to obtain usable javascript files, and that the components need to be +built once that is done. See the +[documentation](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) +for details. For version 2, the source javascript files are not +compressed until a release is made, so you should use the copies in +the `unpacked` directory during development. + + +### Submitting Pull Requests + +Pull requests are welcome. If you're looking to submit a PR for +something that doesn't have an open issue, please consider [raising an +issue](#reporting-an-issue) that your PR can close, especially if +you're fixing a bug. This makes it more likely that there will be +enough information available for your PR to be properly tested and +merged. + +##### Need Help? + +If you're not completely clear on how to submit/update/*do* Pull +Requests, please check out our [source control +policies](https://github.com/mathjax/MathJax/wiki/Source-control-policies). For +more insights, check the excellent in depth [Git Workflow +guide](https://github.com/TryGhost/Ghost/wiki/Git-Workflow) from +Ghost, in particular + +* [Ghost Workflow guide: commit messages](https://github.com/TryGhost/Ghost/wiki/Git-workflow#commit-messages) + +### Testing and Quality Assurance + +If you're +looking to get involved with the code base and don't know where to +start, checking out and testing a pull request is one of the most +useful things you could do. + +These are some [excellent +instructions](https://gist.github.com/piscisaureus/3342247) on +configuring your GitHub repository to allow you to checkout pull +requests in the same way as branches. + + +### Writing documentation + +MathJax's main documentation can be found at [docs.mathjax.org](http://docs.mathjax.org). +The source of the docs is hosted in the +[mathjax/MathJax-docs](http://github.com/mathjax/MathJax-docs) repo here on GitHub. + +The documentation is generated using +[Sphinx-doc](http://sphinx-doc.org/) and hosted on [Read the +docs](http://readthedocs.org). You can clone the repo and submit pull +requests following the [pull-request](#submitting-pull-requests) +guidelines. + + +### Translation + +If you wish to add or update translations of MathJax, please do it on +[TranslateWiki.net](https://translatewiki.net/w/i.php?title=Special:Translate&group=out-mathjax-0-all) +(and while you're there you can help other open source projects, +too). + +For bug reports and other questions that don't fit on +TranslateWiki.net, head over to the +[mathjax/mathjax-i18n](https://github.com/mathjax/MathJax-i18n) +repository. + +The translation files currently are for version 2, as localization +hasn't been added to version 3 yet. + +## Conduct + +As a NumFOCUS fiscally sponsored project, MathJax is governed by the +[NumFOCUS code of conduct](https://numfocus.org/code-of-conduct), +which we summarize as follows: + +We are committed to providing a friendly, safe and welcoming +environment for all, regardless of gender, sexual orientation, +disability, ethnicity, religion, or similar personal characteristic. + +Please be kind and courteous. There's no need to be mean or rude. +Respect that people have differences of opinion and that every design +or implementation choice carries a trade-off and numerous costs. There +is seldom a right answer, merely an optimal answer given a set of +values and circumstances. + +Please keep unstructured critique to a minimum. If you have solid +ideas you want to experiment with, make a fork and see how it works. + +We will exclude you from interaction if you insult, demean or harass +anyone. That is not welcome behaviour. We interpret the term +"harassment" as including the definition in the [Unacceptable +Behavior](https://numfocus.org/code-of-conduct#unacceptable-behavior) +section of the [NumFOCUS code of +conduct](https://numfocus.org/code-of-conduct); if you have any lack +of clarity about what might be included in that concept, please read +that definition. In particular, we don't tolerate behavior that +excludes people in socially marginalized groups. + +Private harassment is also unacceptable. No matter who you are, if you +feel you have been or are being harassed or made uncomfortable by a +community member, please contact one of the channel ops or any of the +[MathJax](https://github.com/MathJax/MathJax) core team +immediately. Whether you're a regular contributor or a newcomer, we +care about making this community a safe place for you and we've got +your back. + +Likewise any spamming, trolling, flaming, baiting, or other +attention-stealing behaviour is not welcome. + +We also recommend that you read [discourse's +rules](http://blog.discourse.org/2013/03/the-universal-rules-of-civilized-discourse/) +for further suggestions on appropriate behavior. + +## References + +* We heavily borrowed from Mozilla and Ghost -- thank you! + * + * +* +* diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE b/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/README.md b/build/pkgs/mathjax3/MathJax-3.2.0/README.md new file mode 100644 index 00000000000..94186007ac0 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/README.md @@ -0,0 +1,237 @@ +# MathJax +## Beautiful math in all browsers + +![GitHub release version](https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver) +![GitHub release version (v2)](https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg?label=release-v2) +![NPM version](https://img.shields.io/npm/v/mathjax.svg?style=flat) +![powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat) +![jsdelivr rank](https://flat.badgen.net/jsdelivr/rank/npm/mathjax?color=green) +![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/mathjax) +![npm monthly downloads (full)](https://img.shields.io/npm/dm/mathjax?label=npm) +![npm total downloads](https://img.shields.io/npm/dt/mathjax.svg?style=flat&label=npm%20total) + +MathJax is an open-source JavaScript display engine for LaTeX, MathML, +and AsciiMath notation that works in all modern browsers. It was +designed with the goal of consolidating the recent advances in web +technologies into a single, definitive, math-on-the-web platform +supporting the major browsers and operating systems. It requires no +setup on the part of the user (no plugins to download or software to +install), so the page author can write web documents that include +mathematics and be confident that users will be able to view it +naturally and easily. Simply include MathJax and some mathematics in +a web page, and MathJax does the rest. + +Some of the main features of MathJax include: + +- High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages + +- Supported in most browsers with no plug-ins, extra fonts, or special + setup for the reader + +- Easy for authors, flexible for publishers, extensible for developers + +- Supports math accessibility, cut-and-paste interoperability, and other + advanced functionality + +- Powerful API for integration with other web applications + +See for additional details about MathJax, +and for the MathJax documentation. + +## MathJax Components + +MathJax version 3 uses files called *components* that contain the +various MathJax modules that you can include in your web pages or +access on a server through NodeJS. Some components combine all the +pieces you need to run MathJax with one or more input formats and a +particular output format, while other components are pieces that can +be loaded on demand when needed, or by a configuration that specifies +the pieces you want to combine in a custom way. For usage +instructions, see the [MathJax documentation](https://docs.mathjax.org). + +Components provide a convenient packaging of MathJax's modules, but it +is possible for you to form your own custom components, or to use +MathJax's modules directly in a node application on a server. There +are [web examples](https://github.com/mathjax/MathJax-demos-web) +showing how to use MathJax in web pages and how to build your own +components, and [node +examples](https://github.com/mathjax/MathJax-demos-node) illustrating +how to use components in node applications or call MathJax modules +directly. + +## What's in this Repository + +This repository contains only the component files for MathJax, not the +source code for MathJax (which are available in a separate [MathJax +source repository](https://github.com/mathjax/MathJax-src/)). These +component files are the ones served by the CDNs that offer MathJax to +the web. In version 2, the files used on the web were also the source +files for MathJax, but in version 3, the source files are no longer on +the CDN, as they are not what are run in the browser. + +The components are stored in the `es5` directory, and are in ES5 format +for the widest possible compatibility. In the future, we may make an +`es6` directory containing ES6 versions of the components. + +## Installation and Use + +### Using MathJax components from a CDN on the web + +If you are loading MathJax from a CDN into a web page, there is no +need to install anything. Simply use a `script` tag that loads +MathJax from the CDN. E.g., + +``` html + +``` + +See the [MathJax +documentation](https://docs.mathjax.org/en/latest/index.html#browser-components), +the [MathJax Web Demos](https://github.com/mathjax/MathJax-demos-web), +and the [MathJax Component +Repository](https://github.com/mathjax/MathJax-demos-web) for more information. + +### Hosting your own copy of the MathJax Components + +If you want to host MathJax from your own server, you can do so by +installing the `mathjax` package using `npm` and moving the `es5` +directory to an appropriate location on your server: + +``` bash +npm install mathjax@3 +mv node_modules/mathjax/es5 /mathjax +``` + +Note that we are still making updates to version 2, so include `@3` +when you install, since the latest chronological version may not be +version 3. + +Alternatively, you can get the files via GitHub: + +``` bash +git clone https://github.com/mathjax/MathJax.git mj-tmp +mv mj-tmp/es5 /mathjax +rm -rf mj-tmp +``` + +Then (in either case) you can use a script tag like the following: + +``` html + +``` + +where `` is replaced by the URL to the location +where you moved the MathJax files above. + +See the +[documentation](https://docs.mathjax.org/en/latest/web/hosting.html) +for details. + +### Using MathJax components in a node application + +To use MathJax components in a node application, install the `mathjax` package: + +``` bash +npm install mathjax@3 +``` + +(we are still making updates to version 2, so you should include `@3` +since the latest chronological version may not be version 3). + +Then require `mathjax` within your application: + +```js +require('mathjax').init({ ... }).then((MathJax) => { ... }); +``` + +where the first `{ ... }` is a MathJax configuration, and the second +`{ ... }` is the code to run after MathJax has been loaded. E.g. + +```js +require('mathjax').init({ + loader: {load: ['input/tex', 'output/svg']} +}).then((MathJax) => { + const svg = MathJax.tex2svg('\\frac{1}{x^2-1}', {display: true}); + console.log(MathJax.startup.adaptor.outerHTML(svg)); +}).catch((err) => console.log(err.message)); +``` + +**Note:** this technique is for node-based application only, not for +browser applications. This method sets up an alternative DOM +implementation, which you don't need in the browser, and tells MathJax +to use node's `require()` command to load external modules. This +setup will not work properly in the browser, even if you webpack it or +bundle it in other ways. + +See the +[documentation](https://docs.mathjax.org/en/latest/index.html#server-nodejs) +and the [MathJax Node +Repository](https://github.com/mathjax/MathJax-demos-node) for more details. + +## Reducing the Size of the Components Directory + +Since the `es5` directory contains *all* the component files, so if +you are only planning one use one configuration, you can reduce the +size of the MathJax directory by removing unused components. For +example, if you are using the `tex-chtml.js` component, then you can +remove the `tex-mml-chtml.js`, `tex-svg.js`, `tex-mml-svg.js`, +`tex-chtml-full.js`, and `tex-svg-full.js` configurations, which will +save considerable space. Indeed, you should be able to remove +everything other than `tex-chtml.js`, and the `input/tex/extensions`, +`output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre` +directories. If you are using the results only on the web, you can +remove `adaptors` as well. + +If you are not using A11Y support (e.g., speech generation, or +semantic enrichment), then you can remove `a11y` and `sre` as well +(though in this case you may need to disable the assistive tools in +the MathJax contextual menu in order to avoid MathJax trying to load +them when they aren't there). + +If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js` +rather than `tex-chtml.js`), you can remove the +`output/chtml/fonts/woff-v2` directory. If you are using MathML input +rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`), +then you can remove `input/tex/extensions` as well. + + +## The Component Files and Pull Requests + +The `es5` directory is generated automatically from the contents of the +MathJax source repository. You can rebuild the components using the +command + +``` bash +npm run make-es5 --silent +``` + +Note that since the contents of this repository are generated +automatically, you should not submit pull requests that modify the +contents of the `es5` directory. If you wish to submit a modification +to MathJax, you should make a pull request in the [MathJax source +repository](https://github.com/mathjax/MathJax-src). + +## MathJax Community + +The main MathJax website is , and it includes +announcements and other important information. A [MathJax user +forum](http://groups.google.com/group/mathjax-users) for asking +questions and getting assistance is hosted at Google, and the [MathJax +bug tracker](https://github.com/mathjax/MathJax/issues) is hosted +at GitHub. + +Before reporting a bug, please check that it has not already been +reported. Also, please use the bug tracker (rather than the help +forum) for reporting bugs, and use the user's forum (rather than the +bug tracker) for questions about how to use MathJax. + +## MathJax Resources + +* [MathJax Documentation](https://docs.mathjax.org) +* [MathJax Components](https://github.com/mathjax/MathJax) +* [MathJax Source Code](https://github.com/mathjax/MathJax-src) +* [MathJax Web Examples](https://github.com/mathjax/MathJax-demos-web) +* [MathJax Node Examples](https://github.com/mathjax/MathJax-demos-node) +* [MathJax Bug Tracker](https://github.com/mathjax/MathJax/issues) +* [MathJax Users' Group](http://groups.google.com/group/mathjax-users) + diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/bower.json b/build/pkgs/mathjax3/MathJax-3.2.0/bower.json new file mode 100644 index 00000000000..6b214b933ea --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/bower.json @@ -0,0 +1,11 @@ +{ + "name": "MathJax", + "main": "./MathJax.js", + "homepage": "http://www.mathjax.org/", + "ignore": [ + "**/.*", + "node_modules", + "components" + ], + "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"] +} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/composer.json b/build/pkgs/mathjax3/MathJax-3.2.0/composer.json new file mode 100644 index 00000000000..b1b9d27aed6 --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/composer.json @@ -0,0 +1,14 @@ +{ + "name": "mathjax/mathjax", + "type": "library", + "description": "MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.", + "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"], + "homepage": "http://www.mathjax.org/", + "license": "Apache-2.0", + "authors": [ + { + "name": "MathJax Consortium", + "homepage": "https://github.com/mathjax" + } + ] +} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/package.json b/build/pkgs/mathjax3/MathJax-3.2.0/package.json new file mode 100644 index 00000000000..6706949557b --- /dev/null +++ b/build/pkgs/mathjax3/MathJax-3.2.0/package.json @@ -0,0 +1,59 @@ +{ + "name": "mathjax", + "version": "3.2.0", + "description": "Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source code).", + "keywords": [ + "math", + "svg", + "mathml", + "tex", + "latex", + "asciimath", + "browser", + "node" + ], + "devDependencies": { + "mathjax-full": "3.2.0" + }, + "maintainers": [ + "MathJax Consortium (http://www.mathjax.org)" + ], + "bugs": { + "url": "http://github.com/mathjax/MathJax/issues" + }, + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git://github.com/mathjax/MathJax.git" + }, + "main": "es5/node-main.js", + "files": [ + "/es5" + ], + "scripts": { + "test": "echo 'No tests defined'", + "clean": "npm run --silent clean:es5 && npm run --silent clean:node", + "clean:es5": "rm -rf es5", + "clean:node": "rm -rf node_modules package-lock.json", + "message": "echo \"$(tput setaf 4)${npm_package_config_message}$(tput setaf 0)\" && echo", + "line": "echo '--------------------------------------------'", + "title": "npm run --silent line && npm run --silent message --mathjax:message=\"${npm_package_config_title}\"", + "preinstall:mj3": "npm run --silent title --mathjax:title='Installing MathJax...'", + "install:mj3": "npm install", + "preinstall:mj3-deps": "npm run --silent message --mathjax:message='Installing MathJax Dependencies...'", + "install:mj3-deps": "cd node_modules/mathjax-full && npm install", + "install:all": "npm run --silent install:mj3 && npm run --silent install:mj3-deps", + "precompile": "npm run --silent title --mathjax:title='Compiling MathJax...'", + "compile": "cd node_modules/mathjax-full && npm run --silent compile", + "precomponents": "npm run --silent title --mathjax:title='Building MathJax Components...'", + "components": "cd node_modules/mathjax-full && npm run --silent make-components", + "premove": "npm run --silent title --mathjax:title='Moving MathJax Components...'", + "move": "npm run --silent clean:es5 && mv node_modules/mathjax-full/es5 .", + "premake-es5": "npm run --silent clean:node", + "make-es5": "npm run --silent install:all && npm run --silent compile && npm run --silent components && npm run --silent move", + "postmake-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node", + "preget-es5": "npm run --silent clean:node", + "get-es5": "npm run --silent install:mj3 && npm run --silent move", + "postget-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node" + } +} diff --git a/build/pkgs/mathjax3/SPKG.rst b/build/pkgs/mathjax3/SPKG.rst new file mode 100644 index 00000000000..b957186a448 --- /dev/null +++ b/build/pkgs/mathjax3/SPKG.rst @@ -0,0 +1,32 @@ +mathjax3: A JavaScript library for displaying mathematical formulas +=================================================================== + +Description +----------- + +MathJax3 is a JavaScript library for displaying mathematical formulas. + +MathJax3 is used by the Sage documentation built by Sphinx. + +License +------- + +Apache License, version 2.0 + + +Upstream Contact +---------------- + +Home page: https://www.mathjax.org/ + +Dependencies +------------ + +None + + +Special Update/Build Instructions +--------------------------------- + +None + diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini new file mode 100644 index 00000000000..4ffadfb32b1 --- /dev/null +++ b/build/pkgs/mathjax3/checksums.ini @@ -0,0 +1,4 @@ +tarball=mathjax-VERSION.tar.gz +sha1=4fec236527498c480b92032afe36d06d2741973c +md5=6eb4395cd91b71be846623d30a9bff70 +cksum=2042371852 diff --git a/build/pkgs/mathjax3/distros/conda.txt b/build/pkgs/mathjax3/distros/conda.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/conda.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/distros/opensuse.txt b/build/pkgs/mathjax3/distros/opensuse.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/opensuse.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/distros/repology.txt b/build/pkgs/mathjax3/distros/repology.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/repology.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/distros/void.txt b/build/pkgs/mathjax3/distros/void.txt new file mode 100644 index 00000000000..37aaaac759c --- /dev/null +++ b/build/pkgs/mathjax3/distros/void.txt @@ -0,0 +1 @@ +mathjax diff --git a/build/pkgs/mathjax3/package-version.txt b/build/pkgs/mathjax3/package-version.txt new file mode 100644 index 00000000000..944880fa15e --- /dev/null +++ b/build/pkgs/mathjax3/package-version.txt @@ -0,0 +1 @@ +3.2.0 diff --git a/build/pkgs/mathjax3/spkg-install.in b/build/pkgs/mathjax3/spkg-install.in new file mode 100644 index 00000000000..4429a680a53 --- /dev/null +++ b/build/pkgs/mathjax3/spkg-install.in @@ -0,0 +1,4 @@ +TARGET="${SAGE_SHARE}/mathjax3" +# Cleanup installed version +rm -rf "${TARGET}" +sdh_install src/* "${TARGET}" diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src new file mode 100755 index 00000000000..dadb1411c6f --- /dev/null +++ b/build/pkgs/mathjax3/spkg-src @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -e + +[ -n "${SAGE_ROOT}" ] || SAGE_ROOT="$(pwd)/../../../" + + +# determine latest version. +GIT_VERSION="$(curl https://github.com/mathjax/MathJax/releases | grep 'MathJax v' | head -1 | sed 's|^.*MathJax v||g' | sed 's/\s*$//g')" +echo "GIT_VERSION=$GIT_VERSION" + +# fetch and rename latest version. +URL="https://github.com/mathjax/MathJax/archive/refs/tags/${GIT_VERSION}.zip" +echo "Downloading $URL" +rm -rf src +if [ -z "$UPSTREAM_SOURCE_TARBALL" ]; then + tar xzf <( curl -L "$URL" ) +else + tar xzf "$UPSTREAM_SOURCE_TARBALL" +fi + +mv MathJax-${GIT_VERSION}/es5 src + +PACKAGE_VERSION=${GIT_VERSION} + +# repack +tar czf "$SAGE_ROOT/upstream/mathjax-${PACKAGE_VERSION}.tar.gz" src +rm -rf src + +# update package info +echo "${PACKAGE_VERSION}" > 'package-version.txt' +"$SAGE_ROOT"/sage --package fix-checksum mathjax3 + + diff --git a/build/pkgs/mathjax3/type b/build/pkgs/mathjax3/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/mathjax3/type @@ -0,0 +1 @@ +standard From 7c2984dab2fe058b448ff6eb8178a235c1c28eca Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 14:07:39 +0900 Subject: [PATCH 024/338] Remove garbage files --- .../mathjax3/MathJax-3.2.0/CONTRIBUTING.md | 314 ------------------ build/pkgs/mathjax3/MathJax-3.2.0/LICENSE | 202 ----------- build/pkgs/mathjax3/MathJax-3.2.0/README.md | 237 ------------- build/pkgs/mathjax3/MathJax-3.2.0/bower.json | 11 - .../pkgs/mathjax3/MathJax-3.2.0/composer.json | 14 - .../pkgs/mathjax3/MathJax-3.2.0/package.json | 59 ---- build/pkgs/mathjax3/checksums.ini | 6 +- build/pkgs/mathjax3/spkg-src | 1 + 8 files changed, 4 insertions(+), 840 deletions(-) delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/LICENSE delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/README.md delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/bower.json delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/composer.json delete mode 100644 build/pkgs/mathjax3/MathJax-3.2.0/package.json diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md b/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md deleted file mode 100644 index 7153d85d6b6..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/CONTRIBUTING.md +++ /dev/null @@ -1,314 +0,0 @@ -# Contributing to MathJax - -You are interested in giving us a hand? That's awesome! We've put -together some brief guidelines that should help you get started -quickly and easily. - -There are lots and lots of ways to get involved, this document covers: - -* [reporting an issue](#reporting-an-issue) - * [bug reports](#bug-reports) - * [feature requests](#feature-requests) - * [change requests](#change-requests) -* [working on MathJax core](#working-on-mathjax-core) - * [key branches and tags](#key-branches--tags) - * [submitting pull requests](#submitting-pull-requests) - * [testing and quality assurance](#testing-and-quality-assurance) - * [writing documentation](#writing-documentation) - * [translation](#translation) -* [Conduct](#conduct) - - -## Reporting An Issue - -If you're about to raise an issue because you think you've found a -problem with MathJax, or you'd like to make a request for a new -feature in the codebase, or any other reason, please read this first. - -The [MathJax issue -tracker](https://github.com/mathjax/MathJax/issues) is the -preferred channel for [bug reports](#bug-reports), [feature -requests](#feature-requests), [change requests](#change-requests), and -[submitting pull requests](#submitting-pull-requests), but please -respect the following restrictions: - -* Please **search for existing issues**. Help us keep duplicate issues - to a minimum by checking to see if someone has already reported your - problem or requested your idea. - -* Please **do not** use the issue tracker for personal support - requests (use [the MathJax User Group](https://groups.google.com/forum/#!forum/mathjax-users)). - -* Please **be civil**. Keep the discussion on topic and respect the - opinions of others. See also our [Conduct Guidelines](#conduct) - -### Bug Reports - -A bug is a *demonstrable problem* that is caused by the code in the -repository. Good bug reports are extremely helpful — thank you! - -Guidelines for bug reports: - -1. **Use the GitHub issue search** — check if the issue has already been - reported. - -2. **Check if the issue has been fixed** — look for [closed - issues in the current - milestone](https://github.com/mathjax/MathJax/issues?q=is%3Aclosed) - or try to reproduce it using the latest `develop` branch. Please - note that you will need to - [compile MathJax and make the components](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) - in order to test MathJax from the source repository. - -3. **Share a live sample of the problem** — without a live page - it is usually impossible to debug problems; see also the [Bug Report - Template](#template) below. - -4. **Isolate the problem** — a live sample is a starting point - but if you want to speed things up, create a [reduced test - case](http://css-tricks.com/6263-reduced-test-cases/). Be specific - about your setup (browser, OS versions, etc). Use services like - [jsbin](http://jsbin.com), [CodePen](http://codepen.io), or - [jsFiddle](http://jsfiddle.com) to make collaboration on minimal - test cases easier for everyone. - -5. **Include a screenshot/cast as a last resort** — Is your - issue about a layout or design feature or bug that is hard to reproduce - or isolate? Then please provide a screenshot or screencast. Tools - like [LICEcap](http://www.cockos.com/licecap/) or - [SauceLabs](http://www.saucelabs.com) allow you to quickly and - easily record a screencasts. If you make it an animated gif, you can - embed it directly into your GitHub issue. - -6. Use the [Bug Report Template](#template) below or [click this - link](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20) - to start creating a bug report with the template automatically. - -A good bug report shouldn't leave others needing to request -more information from you. Be sure to include the details of your environment. - - - -Template Example ([click to use](https://github.com/MathJax/MathJax/issues/new?title=Bug%3A&body=%23%23%23%20Issue%20Summary%0A%0A%23%23%23%20Steps%20to%20Reproduce%0A%0A1.%20This%20is%20the%20first%20step%0A%0AThis%20is%20a%20bug%20because...%0A%0A%23%23%23%20Technical%20details%0A%0A*%20MathJax%20Version%3A%20master%20-%20latest%20commit%3A%20%20INSERT%20COMMIT%20REF%0A*%20Client%20OS%3A%20%0A*%20Browser%3A%20%0A*%20)): - -``` -Short and descriptive example bug report title - -### Issue Summary - -A summary of the issue and the browser/OS environment in which it occurs. If -suitable, include the steps required to reproduce the bug. - -### Steps to Reproduce - -1. This is the first step -2. This is the second step -3. Further steps, etc. - -Any other information you want to share that is relevant to the issue -being reported. Especially, why do you consider this to be a bug? What -do you expect to happen instead? - -### Technical details: - -* MathJax Version: 2.3 (latest commit: f3aaf3a2a3e964df2770dc4aaaa9c87ce5f47e2c) -* Client OS: Mac OS X 10.8.4 -* Browser: Chrome 29.0.1547.57 -``` - - -### Feature Requests - -Feature requests are welcome. Before you submit one, be sure to have: - -1. **Used the GitHub search** to check that the feature hasn't already - been requested. -2. Take a moment to think about whether your idea fits with the scope - and aims of the project, or if it might better fit being a [custom - extension](https://github.com/mathjax/MathJax-third-party-extensions). -3. Remember, it's up to *you* to make a strong case to convince the - project's leaders of the merits of this feature. Please provide as - much detail and context as possible, this means explaining the use - case and why it is likely to be common. - -### Change Requests - -Change requests cover both architectural and functional changes to how -MathJax works. If you have an idea for a new or different dependency, -a refactor, or an improvement to a feature, etc., please be sure to: - -1. **Use the GitHub search** to check that someone else didn't get there first. -2. Take a moment to think about the best way to make a case for, and - explain what you're thinking. Are you sure this shouldn't really be - a [bug report](#bug-reports) or a [feature - request](#feature-requests)? Is it really one idea or is it many? - What's the context? What problem are you solving? Why is what you - are suggesting better than what's already there? - -## Working on MathJax core - -You want to contribute code? We describe how below. First, note that -the MathJax source code is in the - repository, not the - repository, which contains the -packaged component files for distribution on CDNs and the [mathjax npm -package](https://www.npmjs.com/package/mathjax) (the source code is -included in the [mathjax-full npm -package](https://www.npmjs.com/package/mathjax-full)). - -### Key Branches & Tags - -MathJax uses several permanent branches in the [MathJax source repository](https://github.com/mathjax/MathJax-src): - -- **[develop](https://github.com/mathjax/MathJax-src/tree/develop)** - is the development branch. All work on the next release happens here - so you should generally branch off `develop` if you are going to - submit a pull request. Do **NOT** use this branch for a production - site. - -- **[master](https://github.com/mathjax/MathJax-src)** contains the latest - release of MathJax. This branch may be used in production. Do - **NOT** use this branch to work on MathJax's source. - -These branches reflect version 3 of MathJax, which is substantially -different from the version 2 codebase. Version 2 will continue to be -maintained while web sites transition to version 3, with work being -done using the following branches in the [MathJax distribution -repository](https://github.com/mathjax/MathJax): - -- **[legacy-v2-develop](https://github.com/mathjax/MathJax/tree/legacy-v2-develop)** - is the development branch for changes to the legacy version 2 code. - Any pull requests for version 2 should be branched from here. Do - **NOT** use this branch for a production site. - -- **[legacy-v2](https://github.com/mathjax/MathJax/tree/legacy-v2)** - is the branch that contains any updates to version 2 following - the release of version 3. Do **NOT** use this branch to work on - MathJax's source. - -In addition to these branches, MathJax uses tags to identify the -various versions. These can be checked out to obtain the specified -release; for example, `git checkout 2.7.5` would get you the files for -version 2.7.5 of MathJax. - -Note that version 3 is written in Typescript, and so must be compiled -to obtain usable javascript files, and that the components need to be -built once that is done. See the -[documentation](https://docs.mathjax.org/en/latest/web/hosting.html#getting-mathjax-via-git) -for details. For version 2, the source javascript files are not -compressed until a release is made, so you should use the copies in -the `unpacked` directory during development. - - -### Submitting Pull Requests - -Pull requests are welcome. If you're looking to submit a PR for -something that doesn't have an open issue, please consider [raising an -issue](#reporting-an-issue) that your PR can close, especially if -you're fixing a bug. This makes it more likely that there will be -enough information available for your PR to be properly tested and -merged. - -##### Need Help? - -If you're not completely clear on how to submit/update/*do* Pull -Requests, please check out our [source control -policies](https://github.com/mathjax/MathJax/wiki/Source-control-policies). For -more insights, check the excellent in depth [Git Workflow -guide](https://github.com/TryGhost/Ghost/wiki/Git-Workflow) from -Ghost, in particular - -* [Ghost Workflow guide: commit messages](https://github.com/TryGhost/Ghost/wiki/Git-workflow#commit-messages) - -### Testing and Quality Assurance - -If you're -looking to get involved with the code base and don't know where to -start, checking out and testing a pull request is one of the most -useful things you could do. - -These are some [excellent -instructions](https://gist.github.com/piscisaureus/3342247) on -configuring your GitHub repository to allow you to checkout pull -requests in the same way as branches. - - -### Writing documentation - -MathJax's main documentation can be found at [docs.mathjax.org](http://docs.mathjax.org). -The source of the docs is hosted in the -[mathjax/MathJax-docs](http://github.com/mathjax/MathJax-docs) repo here on GitHub. - -The documentation is generated using -[Sphinx-doc](http://sphinx-doc.org/) and hosted on [Read the -docs](http://readthedocs.org). You can clone the repo and submit pull -requests following the [pull-request](#submitting-pull-requests) -guidelines. - - -### Translation - -If you wish to add or update translations of MathJax, please do it on -[TranslateWiki.net](https://translatewiki.net/w/i.php?title=Special:Translate&group=out-mathjax-0-all) -(and while you're there you can help other open source projects, -too). - -For bug reports and other questions that don't fit on -TranslateWiki.net, head over to the -[mathjax/mathjax-i18n](https://github.com/mathjax/MathJax-i18n) -repository. - -The translation files currently are for version 2, as localization -hasn't been added to version 3 yet. - -## Conduct - -As a NumFOCUS fiscally sponsored project, MathJax is governed by the -[NumFOCUS code of conduct](https://numfocus.org/code-of-conduct), -which we summarize as follows: - -We are committed to providing a friendly, safe and welcoming -environment for all, regardless of gender, sexual orientation, -disability, ethnicity, religion, or similar personal characteristic. - -Please be kind and courteous. There's no need to be mean or rude. -Respect that people have differences of opinion and that every design -or implementation choice carries a trade-off and numerous costs. There -is seldom a right answer, merely an optimal answer given a set of -values and circumstances. - -Please keep unstructured critique to a minimum. If you have solid -ideas you want to experiment with, make a fork and see how it works. - -We will exclude you from interaction if you insult, demean or harass -anyone. That is not welcome behaviour. We interpret the term -"harassment" as including the definition in the [Unacceptable -Behavior](https://numfocus.org/code-of-conduct#unacceptable-behavior) -section of the [NumFOCUS code of -conduct](https://numfocus.org/code-of-conduct); if you have any lack -of clarity about what might be included in that concept, please read -that definition. In particular, we don't tolerate behavior that -excludes people in socially marginalized groups. - -Private harassment is also unacceptable. No matter who you are, if you -feel you have been or are being harassed or made uncomfortable by a -community member, please contact one of the channel ops or any of the -[MathJax](https://github.com/MathJax/MathJax) core team -immediately. Whether you're a regular contributor or a newcomer, we -care about making this community a safe place for you and we've got -your back. - -Likewise any spamming, trolling, flaming, baiting, or other -attention-stealing behaviour is not welcome. - -We also recommend that you read [discourse's -rules](http://blog.discourse.org/2013/03/the-universal-rules-of-civilized-discourse/) -for further suggestions on appropriate behavior. - -## References - -* We heavily borrowed from Mozilla and Ghost -- thank you! - * - * -* -* diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE b/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE deleted file mode 100644 index d6456956733..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/README.md b/build/pkgs/mathjax3/MathJax-3.2.0/README.md deleted file mode 100644 index 94186007ac0..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/README.md +++ /dev/null @@ -1,237 +0,0 @@ -# MathJax -## Beautiful math in all browsers - -![GitHub release version](https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver) -![GitHub release version (v2)](https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg?label=release-v2) -![NPM version](https://img.shields.io/npm/v/mathjax.svg?style=flat) -![powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat) -![jsdelivr rank](https://flat.badgen.net/jsdelivr/rank/npm/mathjax?color=green) -![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/mathjax) -![npm monthly downloads (full)](https://img.shields.io/npm/dm/mathjax?label=npm) -![npm total downloads](https://img.shields.io/npm/dt/mathjax.svg?style=flat&label=npm%20total) - -MathJax is an open-source JavaScript display engine for LaTeX, MathML, -and AsciiMath notation that works in all modern browsers. It was -designed with the goal of consolidating the recent advances in web -technologies into a single, definitive, math-on-the-web platform -supporting the major browsers and operating systems. It requires no -setup on the part of the user (no plugins to download or software to -install), so the page author can write web documents that include -mathematics and be confident that users will be able to view it -naturally and easily. Simply include MathJax and some mathematics in -a web page, and MathJax does the rest. - -Some of the main features of MathJax include: - -- High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages - -- Supported in most browsers with no plug-ins, extra fonts, or special - setup for the reader - -- Easy for authors, flexible for publishers, extensible for developers - -- Supports math accessibility, cut-and-paste interoperability, and other - advanced functionality - -- Powerful API for integration with other web applications - -See for additional details about MathJax, -and for the MathJax documentation. - -## MathJax Components - -MathJax version 3 uses files called *components* that contain the -various MathJax modules that you can include in your web pages or -access on a server through NodeJS. Some components combine all the -pieces you need to run MathJax with one or more input formats and a -particular output format, while other components are pieces that can -be loaded on demand when needed, or by a configuration that specifies -the pieces you want to combine in a custom way. For usage -instructions, see the [MathJax documentation](https://docs.mathjax.org). - -Components provide a convenient packaging of MathJax's modules, but it -is possible for you to form your own custom components, or to use -MathJax's modules directly in a node application on a server. There -are [web examples](https://github.com/mathjax/MathJax-demos-web) -showing how to use MathJax in web pages and how to build your own -components, and [node -examples](https://github.com/mathjax/MathJax-demos-node) illustrating -how to use components in node applications or call MathJax modules -directly. - -## What's in this Repository - -This repository contains only the component files for MathJax, not the -source code for MathJax (which are available in a separate [MathJax -source repository](https://github.com/mathjax/MathJax-src/)). These -component files are the ones served by the CDNs that offer MathJax to -the web. In version 2, the files used on the web were also the source -files for MathJax, but in version 3, the source files are no longer on -the CDN, as they are not what are run in the browser. - -The components are stored in the `es5` directory, and are in ES5 format -for the widest possible compatibility. In the future, we may make an -`es6` directory containing ES6 versions of the components. - -## Installation and Use - -### Using MathJax components from a CDN on the web - -If you are loading MathJax from a CDN into a web page, there is no -need to install anything. Simply use a `script` tag that loads -MathJax from the CDN. E.g., - -``` html - -``` - -See the [MathJax -documentation](https://docs.mathjax.org/en/latest/index.html#browser-components), -the [MathJax Web Demos](https://github.com/mathjax/MathJax-demos-web), -and the [MathJax Component -Repository](https://github.com/mathjax/MathJax-demos-web) for more information. - -### Hosting your own copy of the MathJax Components - -If you want to host MathJax from your own server, you can do so by -installing the `mathjax` package using `npm` and moving the `es5` -directory to an appropriate location on your server: - -``` bash -npm install mathjax@3 -mv node_modules/mathjax/es5 /mathjax -``` - -Note that we are still making updates to version 2, so include `@3` -when you install, since the latest chronological version may not be -version 3. - -Alternatively, you can get the files via GitHub: - -``` bash -git clone https://github.com/mathjax/MathJax.git mj-tmp -mv mj-tmp/es5 /mathjax -rm -rf mj-tmp -``` - -Then (in either case) you can use a script tag like the following: - -``` html - -``` - -where `` is replaced by the URL to the location -where you moved the MathJax files above. - -See the -[documentation](https://docs.mathjax.org/en/latest/web/hosting.html) -for details. - -### Using MathJax components in a node application - -To use MathJax components in a node application, install the `mathjax` package: - -``` bash -npm install mathjax@3 -``` - -(we are still making updates to version 2, so you should include `@3` -since the latest chronological version may not be version 3). - -Then require `mathjax` within your application: - -```js -require('mathjax').init({ ... }).then((MathJax) => { ... }); -``` - -where the first `{ ... }` is a MathJax configuration, and the second -`{ ... }` is the code to run after MathJax has been loaded. E.g. - -```js -require('mathjax').init({ - loader: {load: ['input/tex', 'output/svg']} -}).then((MathJax) => { - const svg = MathJax.tex2svg('\\frac{1}{x^2-1}', {display: true}); - console.log(MathJax.startup.adaptor.outerHTML(svg)); -}).catch((err) => console.log(err.message)); -``` - -**Note:** this technique is for node-based application only, not for -browser applications. This method sets up an alternative DOM -implementation, which you don't need in the browser, and tells MathJax -to use node's `require()` command to load external modules. This -setup will not work properly in the browser, even if you webpack it or -bundle it in other ways. - -See the -[documentation](https://docs.mathjax.org/en/latest/index.html#server-nodejs) -and the [MathJax Node -Repository](https://github.com/mathjax/MathJax-demos-node) for more details. - -## Reducing the Size of the Components Directory - -Since the `es5` directory contains *all* the component files, so if -you are only planning one use one configuration, you can reduce the -size of the MathJax directory by removing unused components. For -example, if you are using the `tex-chtml.js` component, then you can -remove the `tex-mml-chtml.js`, `tex-svg.js`, `tex-mml-svg.js`, -`tex-chtml-full.js`, and `tex-svg-full.js` configurations, which will -save considerable space. Indeed, you should be able to remove -everything other than `tex-chtml.js`, and the `input/tex/extensions`, -`output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre` -directories. If you are using the results only on the web, you can -remove `adaptors` as well. - -If you are not using A11Y support (e.g., speech generation, or -semantic enrichment), then you can remove `a11y` and `sre` as well -(though in this case you may need to disable the assistive tools in -the MathJax contextual menu in order to avoid MathJax trying to load -them when they aren't there). - -If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js` -rather than `tex-chtml.js`), you can remove the -`output/chtml/fonts/woff-v2` directory. If you are using MathML input -rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`), -then you can remove `input/tex/extensions` as well. - - -## The Component Files and Pull Requests - -The `es5` directory is generated automatically from the contents of the -MathJax source repository. You can rebuild the components using the -command - -``` bash -npm run make-es5 --silent -``` - -Note that since the contents of this repository are generated -automatically, you should not submit pull requests that modify the -contents of the `es5` directory. If you wish to submit a modification -to MathJax, you should make a pull request in the [MathJax source -repository](https://github.com/mathjax/MathJax-src). - -## MathJax Community - -The main MathJax website is , and it includes -announcements and other important information. A [MathJax user -forum](http://groups.google.com/group/mathjax-users) for asking -questions and getting assistance is hosted at Google, and the [MathJax -bug tracker](https://github.com/mathjax/MathJax/issues) is hosted -at GitHub. - -Before reporting a bug, please check that it has not already been -reported. Also, please use the bug tracker (rather than the help -forum) for reporting bugs, and use the user's forum (rather than the -bug tracker) for questions about how to use MathJax. - -## MathJax Resources - -* [MathJax Documentation](https://docs.mathjax.org) -* [MathJax Components](https://github.com/mathjax/MathJax) -* [MathJax Source Code](https://github.com/mathjax/MathJax-src) -* [MathJax Web Examples](https://github.com/mathjax/MathJax-demos-web) -* [MathJax Node Examples](https://github.com/mathjax/MathJax-demos-node) -* [MathJax Bug Tracker](https://github.com/mathjax/MathJax/issues) -* [MathJax Users' Group](http://groups.google.com/group/mathjax-users) - diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/bower.json b/build/pkgs/mathjax3/MathJax-3.2.0/bower.json deleted file mode 100644 index 6b214b933ea..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "MathJax", - "main": "./MathJax.js", - "homepage": "http://www.mathjax.org/", - "ignore": [ - "**/.*", - "node_modules", - "components" - ], - "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"] -} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/composer.json b/build/pkgs/mathjax3/MathJax-3.2.0/composer.json deleted file mode 100644 index b1b9d27aed6..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/composer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "mathjax/mathjax", - "type": "library", - "description": "MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.", - "keywords": ["math", "js", "LaTeX", "MathML", "AsciiMath"], - "homepage": "http://www.mathjax.org/", - "license": "Apache-2.0", - "authors": [ - { - "name": "MathJax Consortium", - "homepage": "https://github.com/mathjax" - } - ] -} diff --git a/build/pkgs/mathjax3/MathJax-3.2.0/package.json b/build/pkgs/mathjax3/MathJax-3.2.0/package.json deleted file mode 100644 index 6706949557b..00000000000 --- a/build/pkgs/mathjax3/MathJax-3.2.0/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "mathjax", - "version": "3.2.0", - "description": "Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source code).", - "keywords": [ - "math", - "svg", - "mathml", - "tex", - "latex", - "asciimath", - "browser", - "node" - ], - "devDependencies": { - "mathjax-full": "3.2.0" - }, - "maintainers": [ - "MathJax Consortium (http://www.mathjax.org)" - ], - "bugs": { - "url": "http://github.com/mathjax/MathJax/issues" - }, - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "git://github.com/mathjax/MathJax.git" - }, - "main": "es5/node-main.js", - "files": [ - "/es5" - ], - "scripts": { - "test": "echo 'No tests defined'", - "clean": "npm run --silent clean:es5 && npm run --silent clean:node", - "clean:es5": "rm -rf es5", - "clean:node": "rm -rf node_modules package-lock.json", - "message": "echo \"$(tput setaf 4)${npm_package_config_message}$(tput setaf 0)\" && echo", - "line": "echo '--------------------------------------------'", - "title": "npm run --silent line && npm run --silent message --mathjax:message=\"${npm_package_config_title}\"", - "preinstall:mj3": "npm run --silent title --mathjax:title='Installing MathJax...'", - "install:mj3": "npm install", - "preinstall:mj3-deps": "npm run --silent message --mathjax:message='Installing MathJax Dependencies...'", - "install:mj3-deps": "cd node_modules/mathjax-full && npm install", - "install:all": "npm run --silent install:mj3 && npm run --silent install:mj3-deps", - "precompile": "npm run --silent title --mathjax:title='Compiling MathJax...'", - "compile": "cd node_modules/mathjax-full && npm run --silent compile", - "precomponents": "npm run --silent title --mathjax:title='Building MathJax Components...'", - "components": "cd node_modules/mathjax-full && npm run --silent make-components", - "premove": "npm run --silent title --mathjax:title='Moving MathJax Components...'", - "move": "npm run --silent clean:es5 && mv node_modules/mathjax-full/es5 .", - "premake-es5": "npm run --silent clean:node", - "make-es5": "npm run --silent install:all && npm run --silent compile && npm run --silent components && npm run --silent move", - "postmake-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node", - "preget-es5": "npm run --silent clean:node", - "get-es5": "npm run --silent install:mj3 && npm run --silent move", - "postget-es5": "npm run --silent title --mathjax:title='Cleaning Up...' && npm run --silent clean:node" - } -} diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini index 4ffadfb32b1..c46436941ad 100644 --- a/build/pkgs/mathjax3/checksums.ini +++ b/build/pkgs/mathjax3/checksums.ini @@ -1,4 +1,4 @@ tarball=mathjax-VERSION.tar.gz -sha1=4fec236527498c480b92032afe36d06d2741973c -md5=6eb4395cd91b71be846623d30a9bff70 -cksum=2042371852 +sha1=60445ab91fdec88b5bff750e604adca1defe0019 +md5=84145ea49e91b5317385705d37060c4e +cksum=3733185847 diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src index dadb1411c6f..266e5e2554d 100755 --- a/build/pkgs/mathjax3/spkg-src +++ b/build/pkgs/mathjax3/spkg-src @@ -20,6 +20,7 @@ else fi mv MathJax-${GIT_VERSION}/es5 src +rm -r MathJax-${GIT_VERSION} PACKAGE_VERSION=${GIT_VERSION} From 321c8b5ae2ba3265e803c77c9b66d43f8dace092 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 16:32:34 +0900 Subject: [PATCH 025/338] Put into mathjax subdirectory --- build/pkgs/mathjax3/checksums.ini | 6 +++--- build/pkgs/mathjax3/spkg-src | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini index c46436941ad..2cfe5869dd5 100644 --- a/build/pkgs/mathjax3/checksums.ini +++ b/build/pkgs/mathjax3/checksums.ini @@ -1,4 +1,4 @@ tarball=mathjax-VERSION.tar.gz -sha1=60445ab91fdec88b5bff750e604adca1defe0019 -md5=84145ea49e91b5317385705d37060c4e -cksum=3733185847 +sha1=ed325638d807fac93e4b1b9d052e2a72164bbaba +md5=7a78a9e649f69a295ad11cb476857cd5 +cksum=1951447424 diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src index 266e5e2554d..bf5d7e4144b 100755 --- a/build/pkgs/mathjax3/spkg-src +++ b/build/pkgs/mathjax3/spkg-src @@ -4,7 +4,6 @@ set -e [ -n "${SAGE_ROOT}" ] || SAGE_ROOT="$(pwd)/../../../" - # determine latest version. GIT_VERSION="$(curl https://github.com/mathjax/MathJax/releases | grep 'MathJax v' | head -1 | sed 's|^.*MathJax v||g' | sed 's/\s*$//g')" echo "GIT_VERSION=$GIT_VERSION" @@ -19,9 +18,11 @@ else tar xzf "$UPSTREAM_SOURCE_TARBALL" fi -mv MathJax-${GIT_VERSION}/es5 src +mkdir src +mv MathJax-${GIT_VERSION}/es5 src/mathjax rm -r MathJax-${GIT_VERSION} + PACKAGE_VERSION=${GIT_VERSION} # repack From 7cc5eb75f791eabf5a594e9fc548d324fb23d7ac Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 16:48:21 +0900 Subject: [PATCH 026/338] Build doc with mathjax3 (default: offline) --- build/pkgs/mathjax3/spkg-src | 1 - src/sage/docs/conf.py | 19 ++++++++++--------- src/sage/env.py | 2 +- src/sage_docbuild/__init__.py | 13 ++++++++++++- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src index bf5d7e4144b..b20462e48d1 100755 --- a/build/pkgs/mathjax3/spkg-src +++ b/build/pkgs/mathjax3/spkg-src @@ -22,7 +22,6 @@ mkdir src mv MathJax-${GIT_VERSION}/es5 src/mathjax rm -r MathJax-${GIT_VERSION} - PACKAGE_VERSION=${GIT_VERSION} # repack diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index e9730488d12..828d50c6064 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -1,7 +1,7 @@ import sys import os import sphinx -from sage.env import SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR +from sage.env import SAGE_SHARE, SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS from sage.misc.latex_macros import sage_mathjax_macros import sage.version from sage.misc.sagedoc import extlinks @@ -284,16 +284,17 @@ def set_intersphinx_mappings(app, config): "autoload": {"color": [], "colorv2": ["color"]}, }, } -mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" -mathjax_relative = os.path.basename(MATHJAX_DIR) +if os.environ.get('SAGE_OFFLINE_DOC', 'no') == 'yes': + mathjax_path = 'mathjax/tex-chtml.js' + html_common_static_path += [os.path.join(SAGE_SHARE, 'mathjax3')] +else: + mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" -# It would be really nice if sphinx would copy the entire mathjax -# directory, (so we could have a _static/mathjax directory), rather than -# the contents of the directory -html_common_static_path.append(MATHJAX_DIR) -exclude_patterns += ['**/' + os.path.join(mathjax_relative, i) - for i in ('docs', 'README*', 'test', 'unpacked', 'LICENSE')] +# A list of glob-style patterns that should be excluded when looking for source +# files. They are matched against the source file names relative to the +# source directory, using slashes as directory separators on all platforms. +exclude_patterns = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/src/sage/env.py b/src/sage/env.py index 1b8aacc87b1..98d1e520eb2 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -203,7 +203,7 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona")) CREMONA_LARGE_DATA_DIR = var("CREMONA_LARGE_DATA_DIR", join(SAGE_SHARE, "cremona")) JMOL_DIR = var("JMOL_DIR", join(SAGE_SHARE, "jmol")) -MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax")) +MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax3")) MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe")) THREEJS_DIR = var("THREEJS_DIR", join(SAGE_SHARE, "threejs-sage")) PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy")) diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py index 75978e7c63d..fd61ef9b268 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py @@ -47,6 +47,7 @@ import time import types import warnings +from pathlib import Path import sphinx.util.console import sphinx.ext.intersphinx @@ -54,7 +55,7 @@ import sage.all from sage.misc.cachefunc import cached_method # Do not import SAGE_DOC globally as it interferes with doctesting with a random replacement -from sage.env import SAGE_DOC_SRC, SAGE_SRC, DOT_SAGE +from sage.env import SAGE_SHARE, SAGE_DOC_SRC, SAGE_SRC, DOT_SAGE from .build_options import (LANGUAGES, SPHINXOPTS, OMIT, ALLSPHINXOPTS, NUM_THREADS, WEBSITESPHINXOPTS, @@ -153,6 +154,11 @@ def f(self, *args, **kwds): if ABORT_ON_ERROR: raise Exception("Non-exception during docbuild: %s" % (e,), e) +# if type == 'html' and os.environ.get('SAGE_OFFLINE_DOC', 'no') == 'yes': +# if Path(self.dir).parent.parent.name == 'doc': +# logger.warning("Copying mathjax files...") +# shutil.copytree(os.path.join(SAGE_SHARE, 'mathjax3'), output_dir) + if "/latex" in output_dir: logger.warning("LaTeX file written to {}".format(output_dir)) else: @@ -1576,6 +1582,9 @@ def setup_parser(): standard.add_argument("-N", "--no-colors", dest="color", action="store_false", help="do not color output; does not affect children") + standard.add_argument("--offline-doc", dest="offline_doc", default=True, + action="store_true", + help="do not assume internet connection; in particular, do not use MathJax CDN") standard.add_argument("-q", "--quiet", dest="verbose", action="store_const", const=0, help="work quietly; same as --verbose=0") @@ -1741,6 +1750,8 @@ def excepthook(*exc_info): os.environ['SAGE_SKIP_PLOT_DIRECTIVE'] = 'yes' if args.skip_tests: os.environ['SAGE_SKIP_TESTS_BLOCKS'] = 'True' + if args.offline_doc: + os.environ['SAGE_OFFLINE_DOC'] = 'yes' ABORT_ON_ERROR = not args.keep_going From c92b6c0bc236152687c2b9b03a20941901bb4057 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 7 Apr 2022 17:07:27 +0900 Subject: [PATCH 027/338] Remove commented-out lines --- src/sage_docbuild/__init__.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py index fd61ef9b268..5161009da35 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py @@ -47,7 +47,6 @@ import time import types import warnings -from pathlib import Path import sphinx.util.console import sphinx.ext.intersphinx @@ -154,11 +153,6 @@ def f(self, *args, **kwds): if ABORT_ON_ERROR: raise Exception("Non-exception during docbuild: %s" % (e,), e) -# if type == 'html' and os.environ.get('SAGE_OFFLINE_DOC', 'no') == 'yes': -# if Path(self.dir).parent.parent.name == 'doc': -# logger.warning("Copying mathjax files...") -# shutil.copytree(os.path.join(SAGE_SHARE, 'mathjax3'), output_dir) - if "/latex" in output_dir: logger.warning("LaTeX file written to {}".format(output_dir)) else: @@ -1579,12 +1573,12 @@ def setup_parser(): standard.add_argument("--no-prune-empty-dirs", dest="no_prune_empty_dirs", action="store_true", help="do not prune empty directories in the documentation sources") - standard.add_argument("-N", "--no-colors", dest="color", - action="store_false", - help="do not color output; does not affect children") standard.add_argument("--offline-doc", dest="offline_doc", default=True, action="store_true", help="do not assume internet connection; in particular, do not use MathJax CDN") + standard.add_argument("-N", "--no-colors", dest="color", + action="store_false", + help="do not color output; does not affect children") standard.add_argument("-q", "--quiet", dest="verbose", action="store_const", const=0, help="work quietly; same as --verbose=0") From 5b47d224f3c41232f73f64467288ca191ec75244 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 8 Apr 2022 10:05:36 +0900 Subject: [PATCH 028/338] Fix checksums --- build/pkgs/mathjax3/checksums.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini index 2cfe5869dd5..d901f9b84de 100644 --- a/build/pkgs/mathjax3/checksums.ini +++ b/build/pkgs/mathjax3/checksums.ini @@ -1,4 +1,4 @@ tarball=mathjax-VERSION.tar.gz -sha1=ed325638d807fac93e4b1b9d052e2a72164bbaba -md5=7a78a9e649f69a295ad11cb476857cd5 -cksum=1951447424 +sha1=19aacb6eab541724db8f718c4ad160a182145454 +md5=7ba585fa20cbc6fb893a90e1b2ce4d1f +cksum=2990336228 From 5412dcb00418d1c1eacf161393837f56237e369d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 8 Apr 2022 10:16:53 +0900 Subject: [PATCH 029/338] Rename config variable to --use-cdns --- src/sage/docs/conf.py | 6 +++--- src/sage_docbuild/__init__.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 828d50c6064..0ff96e19984 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -285,11 +285,11 @@ def set_intersphinx_mappings(app, config): }, } -if os.environ.get('SAGE_OFFLINE_DOC', 'no') == 'yes': +if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes': + mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" +else: mathjax_path = 'mathjax/tex-chtml.js' html_common_static_path += [os.path.join(SAGE_SHARE, 'mathjax3')] -else: - mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" # A list of glob-style patterns that should be excluded when looking for source # files. They are matched against the source file names relative to the diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py index 5161009da35..ad857d0f078 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py @@ -54,7 +54,7 @@ import sage.all from sage.misc.cachefunc import cached_method # Do not import SAGE_DOC globally as it interferes with doctesting with a random replacement -from sage.env import SAGE_SHARE, SAGE_DOC_SRC, SAGE_SRC, DOT_SAGE +from sage.env import SAGE_DOC_SRC, SAGE_SRC, DOT_SAGE from .build_options import (LANGUAGES, SPHINXOPTS, OMIT, ALLSPHINXOPTS, NUM_THREADS, WEBSITESPHINXOPTS, @@ -1573,9 +1573,9 @@ def setup_parser(): standard.add_argument("--no-prune-empty-dirs", dest="no_prune_empty_dirs", action="store_true", help="do not prune empty directories in the documentation sources") - standard.add_argument("--offline-doc", dest="offline_doc", default=True, + standard.add_argument("--use-cdns", dest="use-cdns", default=False, action="store_true", - help="do not assume internet connection; in particular, do not use MathJax CDN") + help="assume internet connection and use CDNs; in particular, use MathJax CDN") standard.add_argument("-N", "--no-colors", dest="color", action="store_false", help="do not color output; does not affect children") @@ -1744,8 +1744,8 @@ def excepthook(*exc_info): os.environ['SAGE_SKIP_PLOT_DIRECTIVE'] = 'yes' if args.skip_tests: os.environ['SAGE_SKIP_TESTS_BLOCKS'] = 'True' - if args.offline_doc: - os.environ['SAGE_OFFLINE_DOC'] = 'yes' + if args.use_cdns: + os.environ['SAGE_USE_CDNS'] = 'yes' ABORT_ON_ERROR = not args.keep_going From 2a186d24b571358b52340e6b908b4f0f23d7544d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 8 Apr 2022 10:34:17 +0900 Subject: [PATCH 030/338] Fix a typo --- src/sage_docbuild/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py index ad857d0f078..f11842feca8 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py @@ -1573,7 +1573,7 @@ def setup_parser(): standard.add_argument("--no-prune-empty-dirs", dest="no_prune_empty_dirs", action="store_true", help="do not prune empty directories in the documentation sources") - standard.add_argument("--use-cdns", dest="use-cdns", default=False, + standard.add_argument("--use-cdns", dest="use_cdns", default=False, action="store_true", help="assume internet connection and use CDNs; in particular, use MathJax CDN") standard.add_argument("-N", "--no-colors", dest="color", From c42ec232510584689911696655f18b4395acdd81 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 8 Apr 2022 15:11:34 +0900 Subject: [PATCH 031/338] Use MATHJAX_DIR --- src/sage/docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 0ff96e19984..e1b471aa917 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -1,7 +1,7 @@ import sys import os import sphinx -from sage.env import SAGE_SHARE, SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS +from sage.env import SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR from sage.misc.latex_macros import sage_mathjax_macros import sage.version from sage.misc.sagedoc import extlinks @@ -289,7 +289,7 @@ def set_intersphinx_mappings(app, config): mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" else: mathjax_path = 'mathjax/tex-chtml.js' - html_common_static_path += [os.path.join(SAGE_SHARE, 'mathjax3')] + html_common_static_path += [MATHJAX_DIR] # A list of glob-style patterns that should be excluded when looking for source # files. They are matched against the source file names relative to the From 8df9661a421c7a735c667c7e5457638b3847c557 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 8 Apr 2022 21:18:42 +0900 Subject: [PATCH 032/338] Upgrade mathjax package to mathjax3 --- build/pkgs/mathjax/SPKG.rst | 12 +--- build/pkgs/mathjax/checksums.ini | 6 +- build/pkgs/mathjax/package-version.txt | 2 +- build/pkgs/mathjax/spkg-src | 88 +++++++++++++----------- build/pkgs/mathjax3/SPKG.rst | 32 --------- build/pkgs/mathjax3/checksums.ini | 4 -- build/pkgs/mathjax3/distros/conda.txt | 1 - build/pkgs/mathjax3/distros/opensuse.txt | 1 - build/pkgs/mathjax3/distros/repology.txt | 1 - build/pkgs/mathjax3/distros/void.txt | 1 - build/pkgs/mathjax3/package-version.txt | 1 - build/pkgs/mathjax3/spkg-install.in | 4 -- build/pkgs/mathjax3/spkg-src | 35 ---------- build/pkgs/mathjax3/type | 1 - src/sage/docs/conf.py | 14 ++-- 15 files changed, 61 insertions(+), 142 deletions(-) delete mode 100644 build/pkgs/mathjax3/SPKG.rst delete mode 100644 build/pkgs/mathjax3/checksums.ini delete mode 100644 build/pkgs/mathjax3/distros/conda.txt delete mode 100644 build/pkgs/mathjax3/distros/opensuse.txt delete mode 100644 build/pkgs/mathjax3/distros/repology.txt delete mode 100644 build/pkgs/mathjax3/distros/void.txt delete mode 100644 build/pkgs/mathjax3/package-version.txt delete mode 100644 build/pkgs/mathjax3/spkg-install.in delete mode 100755 build/pkgs/mathjax3/spkg-src delete mode 100644 build/pkgs/mathjax3/type diff --git a/build/pkgs/mathjax/SPKG.rst b/build/pkgs/mathjax/SPKG.rst index e7c0a7edb27..2cb2508b733 100644 --- a/build/pkgs/mathjax/SPKG.rst +++ b/build/pkgs/mathjax/SPKG.rst @@ -6,7 +6,7 @@ Description MathJax is a JavaScript library for displaying mathematical formulas. -MathJax is used by the Jupyter notebook and the Sphinx documentation. +MathJax is used by the Sage documentation built by Sphinx. License ------- @@ -22,17 +22,11 @@ Home page: https://www.mathjax.org/ Dependencies ------------ -None. +None Special Update/Build Instructions --------------------------------- -None. +None -Patches -------- - -- nopng_config.patch: prevent font warning messages since png files are - removed. See section "Trimming II -- not strictly necessary" of - https://github.com/mathjax/MathJax-docs/wiki/Guide%3A-reducing-size-of-a-mathjax-installation diff --git a/build/pkgs/mathjax/checksums.ini b/build/pkgs/mathjax/checksums.ini index 4a2ee5ab7da..6a6b233b2ae 100644 --- a/build/pkgs/mathjax/checksums.ini +++ b/build/pkgs/mathjax/checksums.ini @@ -1,4 +1,4 @@ tarball=mathjax-VERSION.tar.gz -sha1=a1b31066a541167c65d6b43f24f3a06f03760662 -md5=02d1067dc06d9ca7d380457a49404766 -cksum=1204309472 +sha1=3f7abecf8cacd7f5d7f9ae6c3baca7739101c17d +md5=ba1a65ab58aaad6c84f39735c619bc34 +cksum=1142131398 diff --git a/build/pkgs/mathjax/package-version.txt b/build/pkgs/mathjax/package-version.txt index 65f95911c0b..944880fa15e 100644 --- a/build/pkgs/mathjax/package-version.txt +++ b/build/pkgs/mathjax/package-version.txt @@ -1 +1 @@ -2.7.4.p0 +3.2.0 diff --git a/build/pkgs/mathjax/spkg-src b/build/pkgs/mathjax/spkg-src index f77a8d88360..49f81e7a993 100755 --- a/build/pkgs/mathjax/spkg-src +++ b/build/pkgs/mathjax/spkg-src @@ -4,13 +4,12 @@ set -e [ -n "${SAGE_ROOT}" ] || SAGE_ROOT="$(pwd)/../../../" - -# determine latest version. -GIT_VERSION="$(curl http://docs.mathjax.org/en/latest/installation.html | grep 'Current Version' | sed 's|^.*archive/||g' | sed 's/.zip".*//g')" +# Determine the latest version +GIT_VERSION="$(curl https://github.com/mathjax/MathJax/releases | grep 'MathJax v' | head -1 | sed 's|^.*MathJax v||g' | sed 's/\s*$//g')" echo "GIT_VERSION=$GIT_VERSION" -# fetch and rename latest version. -URL="https://github.com/mathjax/MathJax/archive/${GIT_VERSION}.zip" +# Fetch and rename the latest version +URL="https://github.com/mathjax/MathJax/archive/refs/tags/${GIT_VERSION}.zip" echo "Downloading $URL" rm -rf src if [ -z "$UPSTREAM_SOURCE_TARBALL" ]; then @@ -18,43 +17,52 @@ if [ -z "$UPSTREAM_SOURCE_TARBALL" ]; then else tar xzf "$UPSTREAM_SOURCE_TARBALL" fi -mv MathJax-${GIT_VERSION} src - -# Strip mathjax according to -# https://github.com/mathjax/MathJax-docs/wiki/Guide%3A-reducing-size-of-a-mathjax-installation - -# Trimming I -- removing files unnecessary for deployment -FILEDIRS_TO_REMOVE='docs/ test/ unpacked/ .gitignore README-branch.txt README.md bower.json' -for filedir in ${FILEDIRS_TO_REMOVE} ; do - rm -rf "src/${filedir}" -done - -# Trimming II -- not strictly necessary (requires the patch nopng_config.patch) -rm -rf 'src/fonts/HTML-CSS/TeX/png/' - -# Trimming III -- fonts -FONTS_TO_REMOVE='Asana-Math Gyre-Pagella Gyre-Termes Latin-Modern Neo-Euler' -for font in ${FONTS_TO_REMOVE} ; do - find . -type d -name "${font}" -prune -exec rm -rf {} \; -done - -FONT_FORMATS_TO_REMOVE='eot otf svg' -for fontformat in ${FONT_FORMATS_TO_REMOVE} ; do - find . -type d -name "${fontformat}" -prune -exec rm -rf {} \; -done - -# Trimming IV -- reducing input and output options -OUTPUT_OPTIONS_TO_REMOVE='NativeMML SVG' -for output in ${OUTPUT_OPTIONS_TO_REMOVE} ; do - rm -rf "src/jax/output/${output}" -done - -# repack -tar czf "$SAGE_ROOT/upstream/mathjax-${GIT_VERSION}.tar.gz" src + +# Put files under mathjax directory +mkdir src +mv MathJax-${GIT_VERSION}/es5 src/mathjax +rm -r MathJax-${GIT_VERSION} + + +# The following block of commented-out lines were used to reduce the package +# size of MathJax2. We keep these lines for the future when we will want to +# reuse and rewrite them to remove unnecessary font files from MathJax3. + +## Trimming I -- removing files unnecessary for deployment +#FILEDIRS_TO_REMOVE='docs/ test/ unpacked/ .gitignore README-branch.txt README.md bower.json' +#for filedir in ${FILEDIRS_TO_REMOVE} ; do +# rm -rf "src/${filedir}" +#done +# +## Trimming II -- not strictly necessary (requires the patch nopng_config.patch) +#rm -rf 'src/fonts/HTML-CSS/TeX/png/' +# +## Trimming III -- fonts +#FONTS_TO_REMOVE='Asana-Math Gyre-Pagella Gyre-Termes Latin-Modern Neo-Euler' +#for font in ${FONTS_TO_REMOVE} ; do +# find . -type d -name "${font}" -prune -exec rm -rf {} \; +#done +# +#FONT_FORMATS_TO_REMOVE='eot otf svg' +#for fontformat in ${FONT_FORMATS_TO_REMOVE} ; do +# find . -type d -name "${fontformat}" -prune -exec rm -rf {} \; +#done +# +## Trimming IV -- reducing input and output options +#OUTPUT_OPTIONS_TO_REMOVE='NativeMML SVG' +#for output in ${OUTPUT_OPTIONS_TO_REMOVE} ; do +# rm -rf "src/jax/output/${output}" +#done + + +PACKAGE_VERSION=${GIT_VERSION} + +# Repackage. +tar czf "$SAGE_ROOT/upstream/mathjax-${PACKAGE_VERSION}.tar.gz" src rm -rf src -# update package info -echo "${GIT_VERSION}" > 'package-version.txt' +# Update package info +echo "${PACKAGE_VERSION}" > 'package-version.txt' "$SAGE_ROOT"/sage --package fix-checksum mathjax diff --git a/build/pkgs/mathjax3/SPKG.rst b/build/pkgs/mathjax3/SPKG.rst deleted file mode 100644 index b957186a448..00000000000 --- a/build/pkgs/mathjax3/SPKG.rst +++ /dev/null @@ -1,32 +0,0 @@ -mathjax3: A JavaScript library for displaying mathematical formulas -=================================================================== - -Description ------------ - -MathJax3 is a JavaScript library for displaying mathematical formulas. - -MathJax3 is used by the Sage documentation built by Sphinx. - -License -------- - -Apache License, version 2.0 - - -Upstream Contact ----------------- - -Home page: https://www.mathjax.org/ - -Dependencies ------------- - -None - - -Special Update/Build Instructions ---------------------------------- - -None - diff --git a/build/pkgs/mathjax3/checksums.ini b/build/pkgs/mathjax3/checksums.ini deleted file mode 100644 index d901f9b84de..00000000000 --- a/build/pkgs/mathjax3/checksums.ini +++ /dev/null @@ -1,4 +0,0 @@ -tarball=mathjax-VERSION.tar.gz -sha1=19aacb6eab541724db8f718c4ad160a182145454 -md5=7ba585fa20cbc6fb893a90e1b2ce4d1f -cksum=2990336228 diff --git a/build/pkgs/mathjax3/distros/conda.txt b/build/pkgs/mathjax3/distros/conda.txt deleted file mode 100644 index 37aaaac759c..00000000000 --- a/build/pkgs/mathjax3/distros/conda.txt +++ /dev/null @@ -1 +0,0 @@ -mathjax diff --git a/build/pkgs/mathjax3/distros/opensuse.txt b/build/pkgs/mathjax3/distros/opensuse.txt deleted file mode 100644 index 37aaaac759c..00000000000 --- a/build/pkgs/mathjax3/distros/opensuse.txt +++ /dev/null @@ -1 +0,0 @@ -mathjax diff --git a/build/pkgs/mathjax3/distros/repology.txt b/build/pkgs/mathjax3/distros/repology.txt deleted file mode 100644 index 37aaaac759c..00000000000 --- a/build/pkgs/mathjax3/distros/repology.txt +++ /dev/null @@ -1 +0,0 @@ -mathjax diff --git a/build/pkgs/mathjax3/distros/void.txt b/build/pkgs/mathjax3/distros/void.txt deleted file mode 100644 index 37aaaac759c..00000000000 --- a/build/pkgs/mathjax3/distros/void.txt +++ /dev/null @@ -1 +0,0 @@ -mathjax diff --git a/build/pkgs/mathjax3/package-version.txt b/build/pkgs/mathjax3/package-version.txt deleted file mode 100644 index 944880fa15e..00000000000 --- a/build/pkgs/mathjax3/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -3.2.0 diff --git a/build/pkgs/mathjax3/spkg-install.in b/build/pkgs/mathjax3/spkg-install.in deleted file mode 100644 index 4429a680a53..00000000000 --- a/build/pkgs/mathjax3/spkg-install.in +++ /dev/null @@ -1,4 +0,0 @@ -TARGET="${SAGE_SHARE}/mathjax3" -# Cleanup installed version -rm -rf "${TARGET}" -sdh_install src/* "${TARGET}" diff --git a/build/pkgs/mathjax3/spkg-src b/build/pkgs/mathjax3/spkg-src deleted file mode 100755 index b20462e48d1..00000000000 --- a/build/pkgs/mathjax3/spkg-src +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -set -e - -[ -n "${SAGE_ROOT}" ] || SAGE_ROOT="$(pwd)/../../../" - -# determine latest version. -GIT_VERSION="$(curl https://github.com/mathjax/MathJax/releases | grep 'MathJax v' | head -1 | sed 's|^.*MathJax v||g' | sed 's/\s*$//g')" -echo "GIT_VERSION=$GIT_VERSION" - -# fetch and rename latest version. -URL="https://github.com/mathjax/MathJax/archive/refs/tags/${GIT_VERSION}.zip" -echo "Downloading $URL" -rm -rf src -if [ -z "$UPSTREAM_SOURCE_TARBALL" ]; then - tar xzf <( curl -L "$URL" ) -else - tar xzf "$UPSTREAM_SOURCE_TARBALL" -fi - -mkdir src -mv MathJax-${GIT_VERSION}/es5 src/mathjax -rm -r MathJax-${GIT_VERSION} - -PACKAGE_VERSION=${GIT_VERSION} - -# repack -tar czf "$SAGE_ROOT/upstream/mathjax-${PACKAGE_VERSION}.tar.gz" src -rm -rf src - -# update package info -echo "${PACKAGE_VERSION}" > 'package-version.txt' -"$SAGE_ROOT"/sage --package fix-checksum mathjax3 - - diff --git a/build/pkgs/mathjax3/type b/build/pkgs/mathjax3/type deleted file mode 100644 index a6a7b9cd726..00000000000 --- a/build/pkgs/mathjax3/type +++ /dev/null @@ -1 +0,0 @@ -standard diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index d067335e489..8f9fceb4d94 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -262,19 +262,17 @@ def set_intersphinx_mappings(app, config): # We use MathJax to build the documentation. extensions.append('sphinx.ext.mathjax') -mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js' +mathjax_path = 'mathjax/tex-chtml.js' from sage.misc.latex_macros import sage_mathjax_macros html_theme_options['mathjax_macros'] = sage_mathjax_macros() -mathjax_relative = os.path.basename(MATHJAX_DIR) - -# It would be really nice if sphinx would copy the entire mathjax -# directory, (so we could have a _static/mathjax directory), rather than -# the contents of the directory html_common_static_path.append(MATHJAX_DIR) -exclude_patterns += ['**/' + os.path.join(mathjax_relative, i) - for i in ('docs', 'README*', 'test', 'unpacked', 'LICENSE')] + +# A list of glob-style patterns that should be excluded when looking for source +# files. They are matched against the source file names relative to the +# source directory, using slashes as directory separators on all platforms. +exclude_patterns = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. From 89ec41751c94cd12136596e15375b2a1a183258d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 8 Apr 2022 21:49:15 +0900 Subject: [PATCH 033/338] Fix MATHJAX_DIR env variable --- src/sage/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/env.py b/src/sage/env.py index 98d1e520eb2..1b8aacc87b1 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -203,7 +203,7 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona")) CREMONA_LARGE_DATA_DIR = var("CREMONA_LARGE_DATA_DIR", join(SAGE_SHARE, "cremona")) JMOL_DIR = var("JMOL_DIR", join(SAGE_SHARE, "jmol")) -MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax3")) +MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax")) MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe")) THREEJS_DIR = var("THREEJS_DIR", join(SAGE_SHARE, "threejs-sage")) PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy")) From 804b062b8701604b4075037de7adc14f547bc970 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 10 Apr 2022 15:41:12 +0200 Subject: [PATCH 034/338] trac #33365: add interface to nauty genbg --- src/sage/graphs/graph_generators.py | 153 ++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 8dcceb07fe4..540cad5315c 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -262,6 +262,8 @@ def __append_to_doc(methods): "MuzychukS6Graph", "MycielskiGraph", "MycielskiStep", + "nauty_geng", + "nauty_genbg", "NKStarGraph", "NStarGraph", "OddGraph", @@ -269,6 +271,7 @@ def __append_to_doc(methods): "PasechnikGraph", "petersen_family", "planar_graphs", + "plantri_gen", "quadrangulations", "RingedTree", "SierpinskiGasketGraph", @@ -977,6 +980,156 @@ def nauty_geng(self, options="", debug=False): G = graph.Graph(s[:-1], format='graph6') yield G + def nauty_genbg(self, options="", debug=False): + r""" + Return a generator which creates bipartite graphs from nauty's ``genbg`` + program. + + INPUT: + + - ``options`` -- string (default: ``""``); a string passed to ``genbg`` + as if it was run at a system command line. At a minimum, you *must* + pass the number of vertices you desire in each side. Sage expects the + bipartite graphs to be in nauty's "graph6" format, do not set an + option to change this default or results will be unpredictable. + + - ``debug`` -- boolean (default: ``False``); if ``True`` the first line + of ``geng``'s output to standard error is captured and the first call + to the generator's ``next()`` function will return this line as a + string. A line leading with ">A" indicates a successful initiation of + the program with some information on the arguments, while a line + beginning with ">E" indicates an error with the input. + + The possible options, obtained as output of ``genbg --help``:: + + n1 : the number of vertices in the first class + n2 : the number of vertices in the second class + mine:maxe : : a range for the number of edges + :0 means ' or more' except in the case 0:0 + res/mod : only generate subset res out of subsets 0..mod-1 + -c : only write connected graphs + -z : all the vertices in the second class must have + different neighbourhoods + -F : the vertices in the second class must have at least + two neighbours of degree at least 2 + -L : there is no vertex in the first class whose removal + leaves the vertices in the second class unreachable + from each other + -Y : two vertices in the second class must have at least + common neighbours + -Z : two vertices in the second class must have at most + common neighbours + -A : no vertex in the second class has a neighbourhood + which is a subset of another vertex's neighbourhood + in the second class + -D : specify an upper bound for the maximum degree + Example: -D6. You can also give separate maxima for + the two parts, for example: -D5:6 + -d : specify a lower bound for the minimum degree + Again, you can specify it separately for the two parts, + for example -d1:2 + -v : display counts by number of edges to stder + -l : canonically label output graphs + -q : suppress auxiliary output (except from -v) + + Options which cause ``genbg`` to use an output format different than the + ``graph6`` format are not listed above (-s, -a) as they will confuse the + creation of a Sage graph. The res/mod option can be useful when using + the output in a routine run several times in parallel. + + OUTPUT: + + A generator which will produce the graphs as + :class:`~sage/graphs.bipartite_graph.BipartiteGraph`. These will be + simple bipartite graphs: no loops, no multiple edges, no directed edges. + + EXAMPLES: + + The generator can be used to construct biparrtite graphs for testing, + one at a time (usually inside a loop). Or it can be used to + create an entire list all at once if there is sufficient memory + to contain it:: + + sage: gen = graphs.nauty_genbg("1 1") + sage: next(gen) + Bipartite graph on 2 vertices + sage: next(gen) + Bipartite graph on 2 vertices + sage: next(gen) + Traceback (most recent call last): + ... + StopIteration + + Connected bipartite graphs of order 6 with different number of vertices + in each side:: + + sage: gen = graphs.nauty_genbg("1 5 -c") + sage: len(list(gen)) + 1 + sage: gen = graphs.nauty_genbg("2 4 -c") + sage: len(list(gen)) + 6 + sage: gen = graphs.nauty_genbg("3 3 -c") + sage: len(list(gen)) + 13 + + Use :meth:`nauty_geng` instead if you want the list of all bipartite + graphs of order `n`. For instance, the list of all connected bipartite + graphs of order 6, which agrees with :oeis:`A005142`:: + + sage: gen = graphs.nauty_geng("-b -c 6") + sage: len(list(gen)) + 17 + + The ``debug`` switch can be used to examine ``genbg``'s reaction to the + input in the ``options`` string. We illustrate success. (A failure + will be a string beginning with ">E".) Passing the "-q" switch to + ``genbg`` will suppress the indicator of a successful initiation, and so + the first returned value might be an empty string if ``debug`` is + ``True``:: + + sage: gen = graphs.nauty_genbg("2 3", debug=True) + sage: print(next(gen)) + >A ...genbg n=2+3 e=0:6 d=0:0 D=3:2 + sage: gen = graphs.nauty_genbg("2 3 -q", debug=True) + sage: next(gen) + '' + + TESTS: + + Wrong input:: + + sage: list(graphs.nauty_genbg("-c1 2", debug=False)) + Traceback (most recent call last): + ... + ValueError: wrong format of parameter option + sage: list(graphs.nauty_genbg("-c1 2", debug=True)) + ['>E Usage: ...genbg [-c -ugs -vq -lzF] [-Z#] [-D#] [-A] [-d#|-d#:#] [-D#|-D#:#] n1 n2... + sage: list(graphs.nauty_genbg("-c 1 2", debug=True)) + ['>A ...genbg n=1+2 e=2:2 d=1:1 D=2:1 c\n', Bipartite graph on 3 vertices] + """ + import shlex + from sage.features.nauty import NautyExecutable + genbg_path = NautyExecutable("genbg").absolute_filename() + sp = subprocess.Popen(shlex.quote(genbg_path) + " {0}".format(options), shell=True, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, close_fds=True, + encoding='latin-1') + msg = sp.stderr.readline() + if debug: + yield msg + elif msg.startswith('>E'): + raise ValueError('wrong format of parameter option') + gen = sp.stdout + from sage.graphs.bipartite_graph import BipartiteGraph + while True: + try: + s = next(gen) + except StopIteration: + # Exhausted list of bipartite graphs from nauty genbg + return + G = BipartiteGraph(s[:-1], format='graph6') + yield G def cospectral_graphs(self, vertices, matrix_function=lambda g: g.adjacency_matrix(), graphs=None): r""" From e57e4561f3402641c366aedb4a4db38695bbad3c Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 10 Apr 2022 19:22:23 +0200 Subject: [PATCH 035/338] trac #33365: ensure that the partition respects the requirement --- src/sage/graphs/graph_generators.py | 54 +++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 540cad5315c..7a918812367 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -1028,14 +1028,19 @@ def nauty_genbg(self, options="", debug=False): -d : specify a lower bound for the minimum degree Again, you can specify it separately for the two parts, for example -d1:2 - -v : display counts by number of edges to stder + -v : display counts by number of edges to stderr -l : canonically label output graphs - -q : suppress auxiliary output (except from -v) Options which cause ``genbg`` to use an output format different than the ``graph6`` format are not listed above (-s, -a) as they will confuse the - creation of a Sage graph. The res/mod option can be useful when using - the output in a routine run several times in parallel. + creation of a Sage graph. Option ``-q`` which suppress auxiliary output + (except from ``-v``) should never be used as we are unable to recover + the partition of the vertices of the bipartite graph without the + auxilary output. Hence the partition of the vertices of returned + bipartite graphs might not respect the requirement. + + The res/mod option can be useful when using the output in a routine run + several times in parallel. OUTPUT: @@ -1082,18 +1087,23 @@ def nauty_genbg(self, options="", debug=False): 17 The ``debug`` switch can be used to examine ``genbg``'s reaction to the - input in the ``options`` string. We illustrate success. (A failure - will be a string beginning with ">E".) Passing the "-q" switch to - ``genbg`` will suppress the indicator of a successful initiation, and so - the first returned value might be an empty string if ``debug`` is - ``True``:: + input in the ``options`` string. A message starting with ">A" indicates + success and a message starting with ">E" indicates a failure:: sage: gen = graphs.nauty_genbg("2 3", debug=True) sage: print(next(gen)) >A ...genbg n=2+3 e=0:6 d=0:0 D=3:2 - sage: gen = graphs.nauty_genbg("2 3 -q", debug=True) + sage: gen = graphs.nauty_genbg("-c2 3", debug=True) sage: next(gen) - '' + '>E Usage: ...genbg [-c -ugs -vq -lzF] [-Z#] [-D#] [-A] [-d#|-d#:#] [-D#|-D#:#] n1 n2... + + Check that the partition of the bipartite graph is consistent:: + + sage: gen = graphs.nauty_genbg("3 3") + sage: left = set(range(3)) + sage: for g in gen: + ....: if g.left != left: + ....: raise ValueError('wrong partition') TESTS: @@ -1102,7 +1112,7 @@ def nauty_genbg(self, options="", debug=False): sage: list(graphs.nauty_genbg("-c1 2", debug=False)) Traceback (most recent call last): ... - ValueError: wrong format of parameter option + ValueError: wrong format of parameter options sage: list(graphs.nauty_genbg("-c1 2", debug=True)) ['>E Usage: ...genbg [-c -ugs -vq -lzF] [-Z#] [-D#] [-A] [-d#|-d#:#] [-D#|-D#:#] n1 n2... sage: list(graphs.nauty_genbg("-c 1 2", debug=True)) @@ -1119,7 +1129,23 @@ def nauty_genbg(self, options="", debug=False): if debug: yield msg elif msg.startswith('>E'): - raise ValueError('wrong format of parameter option') + raise ValueError('wrong format of parameter options') + + if msg.startswith('>A'): + # We extract the partition of the vertices from the msg string + for s in msg.split(' '): + if s.startswith('n='): + from sage.rings.integer import Integer + n1, n2 = [Integer(t) for t in s[2:].split('+') if t.isdigit()] + partition = [set(range(n1)), set(range(n1, n1 + n2))] + break + else: + # should never happen + raise ValueError('unable to recover the partition') + else: + # Either msg starts with >E or option -q has been given + partition = None + gen = sp.stdout from sage.graphs.bipartite_graph import BipartiteGraph while True: @@ -1128,7 +1154,7 @@ def nauty_genbg(self, options="", debug=False): except StopIteration: # Exhausted list of bipartite graphs from nauty genbg return - G = BipartiteGraph(s[:-1], format='graph6') + G = BipartiteGraph(s[:-1], format='graph6', partition=partition) yield G def cospectral_graphs(self, vertices, matrix_function=lambda g: g.adjacency_matrix(), graphs=None): From 933ab142a203f94ab2198f52accc17180909e5c6 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 21:19:48 +0000 Subject: [PATCH 036/338] Inital try --- .gitpod.yml | 53 +++-------- src/environment-dev.yml | 196 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+), 40 deletions(-) create mode 100644 src/environment-dev.yml diff --git a/.gitpod.yml b/.gitpod.yml index f57b047b8e1..89b581262bc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,12 +1,5 @@ -# Use custom docker image. https://www.gitpod.io/docs/config-docker -image: -# Each of these two options works: -# - Directly use the "-with-targets" image built by .github/workflows/tox.yml -# image: ghcr.io/sagemath/sage/sage-docker-gitpod-standard-with-targets:dev -# - or go through a custom Dockerfile, which builds a smaller image -# based on the "-with-system-packages" image built by .github/workflows/tox.yml -# with the built SAGE_LOCAL from the "-with-targets" image copied in. - file: docker/.gitpod.Dockerfile +# Use minimal Ubuntu installation that includes mamba +image: condaforge/mambaforge # We use the following layout: # @@ -64,39 +57,19 @@ tasks: ## No need for pyenv pyenv shell --unset 2> /dev/null pyenv global system 2> /dev/null - if [ -d local ]; then - mkdir -p logs && echo '### .gitpod.yml Setup.before: Prebuild init script has been run. Running "make" again in case the build had timed out.' >> logs/install.log - # The init script has already populated the SAGE_LOCAL, - # but only /workspace is preserved; and the $HOME/sage-local may contain a resurrected - # copy of sage-local. Replace it again by a symlink. - rm -Rf $HOME/sage-local - ln -sf $(pwd)/local $HOME/sage-local - # Now run make. No timeout here. - MAKE='make -j24' make build V=0 - else - # Prebuild init script has not been run - # Only /workspace is preserved during build. - # If the Docker image contains a built SAGE_LOCAL, use it to populate the SAGE_LOCAL in the workspace. - if [ -d $HOME/sage-local ]; then - mv $HOME/sage-local local - fi - rm -Rf $HOME/sage-local - ln -sf $(pwd)/local $HOME/sage-local - # Save the logs of the source tree used by the Docker build - if [ -d $HOME/sage/logs ]; then - mv $HOME/sage/logs logs - fi - fi - # Remove the source tree used by the Docker build and replace it by a symlink - rm -Rf $HOME/sage - ln -s $(pwd) $HOME/sage + + # Create conda environment + mamba create --name sage-dev --file src/environment-dev.yml + conda activate sage-dev + + # Build sage + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX + pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup + pip install --no-build-isolation -v -v -e src + init: | # Start build - mkdir -p logs && echo '### .gitpod.yml Setup.init: Starting build' >> logs/install.log - ./bootstrap - ./configure --enable-editable --enable-download-from-upstream-url --prefix=$HOME/sage-local --with-sage-venv - ## Gitpod has a timeout of 1h, so make sure we are below this to ensure that the prebuild is always successful - MAKE='make -j24' timeout 51m make build V=0 || echo "(ignoring error)" + env: SAGE_NUM_THREADS: 8 diff --git a/src/environment-dev.yml b/src/environment-dev.yml new file mode 100644 index 00000000000..3ee62968cec --- /dev/null +++ b/src/environment-dev.yml @@ -0,0 +1,196 @@ +name: sage +channels: + - conda-forge + - nodefaults +dependencies: + - compilers + - make + - m4 + - perl + - python + - tar + - bc + - pkg-config + - arb + - boost-cpp + - brial + - bzip2 + - cddlib + - cliquer + - cmake + - curl + - ecl + - eclib + - ecm + - fflas-ffpack + - libflint + - flintqs + - fplll + - freetype + - bdw-gc + - gengetopt + - gf2x + - gfan + - fortran-compiler + - giac + - givaro + - glpk + - gmp + - gsl + - iml + - lcalc + - libatomic_ops + - libbraiding + - libffi + - libgd + - libhomfly + - xz + - libpng + - linbox + - lrcalc + - m4ri + - m4rie + - mpc + - mpfi + - mpfr + - nauty + - ncurses + - ntl + - openblas + - blas=2.*=openblas + - openssl + - palp + - pari + - pari-elldata + - pari-galdata + - pari-galpol + - pari-seadata + - pari-galdata + - pari-seadata-small + - patch + - pcre + - pkg-config + - planarity + - ppl + - primecount + - primesieve + - qhull + - r + - r-essentials + - readline + - rw + - singular + - sqlite + - suitesparse + - symmetrica + - sympow + - tachyon + - tox + - xz + - zeromq + - zlib + - zn_poly + - alabaster + - attrs + - babel + - backcall + - beautifulsoup4 + - bleach + - certifi + - cffi + - sagemath-db-combinatorial-designs + - sagemath-db-conway-polynomials + - cvxopt + - cycler + - cypari2 + - cysignals + - cython + - python-dateutil + - decorator + - defusedxml + - docutils + - sagemath-db-elliptic-curves + - entrypoints + - fpylll + - gap-defaults + - gmpy2 + - sagemath-db-graphs + - html5lib + - imagesize + - importlib_metadata + - ipykernel + - ipython + - ipython_genutils + - ipywidgets + - jedi + - jinja2 + - jmol + - jsonschema + - jupyter_client + - jupyter_core + - kiwisolver + - python-lrcalc + - markupsafe + - mathjax + - "matplotlib>=3.5.1" + - maxima + - memory-allocator + - mistune + - mpmath + - nbconvert + - nbformat + - networkx + - notebook + - numpy + - packaging + - pandocfilters + - parso + - pexpect + - pickleshare + - pillow + - pip + - pkgconfig + - sagemath-db-polytopes + - pplpy + - primecountpy + - prometheus_client + - prompt_toolkit + - ptyprocess + - pybind11 + - pycparser + - pygments + - pyparsing + - pyrsistent + - pytz + - pyzmq + - requests + - rpy2 + - sagetex + - scipy + - send2trash + - setuptools + - setuptools_scm + - simplegeneric + - six + - snowballstemmer + - sphinx + - sphinxcontrib-applehelp + - sphinxcontrib-devhelp + - sphinxcontrib-htmlhelp + - sphinxcontrib-jsmath + - sphinxcontrib-qthelp + - sphinxcontrib-serializinghtml + - sphinxcontrib-websupport + - sympy + - terminado + - testpath + - three.js + - tornado + - traitlets + - tzlocal + - vcversioner + - wcwidth + - webencodings + - wheel + - widgetsnbextension + - zipp From c3400241873b0ff322159c9cd74702d097db4ba1 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 21:28:22 +0000 Subject: [PATCH 037/338] Remove init completly --- .gitpod.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 89b581262bc..30e2d09b4dc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -67,9 +67,6 @@ tasks: pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup pip install --no-build-isolation -v -v -e src - init: | - # Start build - env: SAGE_NUM_THREADS: 8 From accc23258416cb7bea10bb688765dd5c2c482dfd Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 21:43:23 +0000 Subject: [PATCH 038/338] Remove name in conda env config --- src/environment-dev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/environment-dev.yml b/src/environment-dev.yml index 3ee62968cec..aa45b3a444b 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -1,4 +1,3 @@ -name: sage channels: - conda-forge - nodefaults From 419c787e787b0fc11f474f99b4287e50dbfae546 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 22:10:44 +0000 Subject: [PATCH 039/338] Fix conda env creation --- .gitpod.yml | 2 +- src/environment-dev.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 30e2d09b4dc..e5e2e7f5a01 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -59,7 +59,7 @@ tasks: pyenv global system 2> /dev/null # Create conda environment - mamba create --name sage-dev --file src/environment-dev.yml + mamba env create --name sage-dev --file src/environment-dev.yml conda activate sage-dev # Build sage diff --git a/src/environment-dev.yml b/src/environment-dev.yml index aa45b3a444b..6019cdd5371 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -1,3 +1,4 @@ +name: sage-dev channels: - conda-forge - nodefaults From e924e71b397512f2b9c25397202d9033a0eae854 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 22:11:36 +0000 Subject: [PATCH 040/338] Also install openssh --- src/environment-dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/environment-dev.yml b/src/environment-dev.yml index 6019cdd5371..3c68c458194 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -194,3 +194,5 @@ dependencies: - wheel - widgetsnbextension - zipp + # Additional dev tools + - openssh From 1d84ec2d447c5b9a19e7cef145f681e967779cc8 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 22:20:53 +0000 Subject: [PATCH 041/338] Create conda env already at start --- .gitpod.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index e5e2e7f5a01..85bcac5b2e0 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -29,6 +29,10 @@ image: condaforge/mambaforge tasks: - name: Setup before: | + # Create conda environment + mamba env create --name sage-dev --file src/environment-dev.yml + conda activate sage-dev + # Setup trac as remote ## In order to push to trac, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$( /dev/null pyenv global system 2> /dev/null - # Create conda environment - mamba env create --name sage-dev --file src/environment-dev.yml - conda activate sage-dev - # Build sage ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup From 638e5bd1c13a13b9d178f78ace357c807c5e4011 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 22:22:51 +0000 Subject: [PATCH 042/338] Run bootstrap before configure --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 85bcac5b2e0..f89f23dcea5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -63,6 +63,7 @@ tasks: pyenv global system 2> /dev/null # Build sage + ./bootstrap ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup pip install --no-build-isolation -v -v -e src From a35455a46e247ca8ead14cb89cbfd24349f64d1f Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 22:48:05 +0000 Subject: [PATCH 043/338] Add packages needed for bootstrap --- src/environment-dev.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/environment-dev.yml b/src/environment-dev.yml index 3c68c458194..31f80ec7399 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -194,5 +194,10 @@ dependencies: - wheel - widgetsnbextension - zipp + # Packages needed for ./bootstrap + - gettext + - autoconf + - automake + - libtool # Additional dev tools - openssh From eade9f41710493ecc072df31c2140528f68e7dc6 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 23:13:39 +0000 Subject: [PATCH 044/338] Create conda env in local folder --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index f89f23dcea5..ce3e3a8d090 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -30,7 +30,7 @@ tasks: - name: Setup before: | # Create conda environment - mamba env create --name sage-dev --file src/environment-dev.yml + mamba env create --name sage-dev --file src/environment-dev.yml --prefix venv conda activate sage-dev # Setup trac as remote From d99bcabeb534fa4c3c7106af0c47c8f679501af7 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 23:25:02 +0000 Subject: [PATCH 045/338] Remove name argument which is incompatible with prefix --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index ce3e3a8d090..14e737d7cc3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -30,7 +30,7 @@ tasks: - name: Setup before: | # Create conda environment - mamba env create --name sage-dev --file src/environment-dev.yml --prefix venv + mamba env create --file src/environment-dev.yml --prefix venv conda activate sage-dev # Setup trac as remote From 072e5ec5576f1499500e5911f11d0d6d7c362f75 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 18 Apr 2022 23:29:31 +0000 Subject: [PATCH 046/338] Correct name of conda env --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 14e737d7cc3..e3784f740e7 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -31,7 +31,7 @@ tasks: before: | # Create conda environment mamba env create --file src/environment-dev.yml --prefix venv - conda activate sage-dev + conda activate /workspace/sagetrac-mirror/venv # Setup trac as remote ## In order to push to trac, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$( Date: Mon, 18 Apr 2022 23:29:58 +0000 Subject: [PATCH 047/338] Remove special treatment of pyenv --- .gitpod.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index e3784f740e7..2725826c9fb 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -58,10 +58,6 @@ tasks: git remote set-url --push trac pushing-needs-ssh-key fi - ## No need for pyenv - pyenv shell --unset 2> /dev/null - pyenv global system 2> /dev/null - # Build sage ./bootstrap ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX From 8e912cb8987b7b344d928a0a22f67ccaf521e3d6 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 19 Apr 2022 00:24:07 +0000 Subject: [PATCH 048/338] Use init and command instead of before --- .gitpod.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 2725826c9fb..16e2f0586ee 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -28,11 +28,18 @@ image: condaforge/mambaforge # Start up tasks. https://www.gitpod.io/docs/config-start-tasks/ tasks: - name: Setup - before: | + init: | # Create conda environment mamba env create --file src/environment-dev.yml --prefix venv conda activate /workspace/sagetrac-mirror/venv + + # Build sage + ./bootstrap + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX + pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup + pip install --no-build-isolation -v -v -e src + command: | # Setup trac as remote ## In order to push to trac, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$( Date: Tue, 19 Apr 2022 20:12:50 +0000 Subject: [PATCH 049/338] Cleanup --- .gitpod.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 16e2f0586ee..1546cd23f99 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,30 +1,6 @@ # Use minimal Ubuntu installation that includes mamba image: condaforge/mambaforge -# We use the following layout: -# -# $HOME/sage Source tree used by the Docker build; see SAGE_ROOT/tox.ini (gitpod). -# - We delete it in every invocation of the 'before' script -# and replace it by a symlink to /workspace/... -# (This symlink is needed because the package-removal scripts -# ({prefix,venv}/var/lib/sage/scripts/*/{spkg-piprm,spkg-prerm,spkg-postrm) -# hardcode SAGE_ROOT and SAGE_SRC from package installation time) -# $HOME/sage/logs Logs of the Docker build. -# - In the first invocation of the 'before' script, we move it -# to /workspace/.../logs -# $HOME/sage-local The configured prefix (SAGE_LOCAL) of the Sage installation. -# - During the Docker build, this is the physical location. -# - In the first invocation of the 'before' script, we move it -# to the new physical location /workspace/.../local -# (because gitpod only preserves the contents of /workspace) -# and replace it by a symlink to the new physical location. -# - In subsequent invocations of the 'before' script, we -# remove it and replace it by a symlink to the physical -# location /workspace/.../local -# /worktree/.../local The physical location of the Sage installation, -# established in the first run of the 'before' script and -# preserved by gitpod. - # Start up tasks. https://www.gitpod.io/docs/config-start-tasks/ tasks: - name: Setup From ea0a92e3956d63be8e819bf84fff08c762580adf Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 19 Apr 2022 20:13:37 +0000 Subject: [PATCH 050/338] Activate conda env in cmd task --- .gitpod.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 1546cd23f99..cd689be86f7 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -16,6 +16,9 @@ tasks: pip install --no-build-isolation -v -v -e src command: | + # Activate conda environment + conda activate /workspace/sagetrac-mirror/venv + # Setup trac as remote ## In order to push to trac, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$( Date: Tue, 19 Apr 2022 20:31:19 +0000 Subject: [PATCH 051/338] Start ssh agent --- .gitpod.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index cd689be86f7..5865e65ae63 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -25,12 +25,15 @@ tasks: ## Afterwards, create a new gitpod workspace. git remote remove trac 2> /dev/null # might still exists from a previous run/prebuild if [[ -n "${PRIVATE_SSH_KEY}" ]]; then + # Start ssh agent + eval $(ssh-agent -s) + # Setup ssh key for authentication with trac mkdir -p ~/.ssh echo $PRIVATE_SSH_KEY | sed 's/\(-----\(BEGIN\|END\) OPENSSH PRIVATE KEY-----\)/\n\1\n/g' > ~/.ssh/id_rsa sed -i '/^$/d' ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - unset PRIVATE_SSH_KEY + ssh-add ~/.ssh/id_rsa ssh-keyscan -H trac.sagemath.org >> ~/.ssh/known_hosts # Setup trac repo From 617b443c5a78abed98c45b299f67fad23db9b204 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 19 Apr 2022 21:20:05 +0000 Subject: [PATCH 052/338] Enable deprecated rsa algo --- .gitpod.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 5865e65ae63..6f103e44672 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -25,15 +25,12 @@ tasks: ## Afterwards, create a new gitpod workspace. git remote remove trac 2> /dev/null # might still exists from a previous run/prebuild if [[ -n "${PRIVATE_SSH_KEY}" ]]; then - # Start ssh agent - eval $(ssh-agent -s) - # Setup ssh key for authentication with trac mkdir -p ~/.ssh echo $PRIVATE_SSH_KEY | sed 's/\(-----\(BEGIN\|END\) OPENSSH PRIVATE KEY-----\)/\n\1\n/g' > ~/.ssh/id_rsa sed -i '/^$/d' ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - ssh-add ~/.ssh/id_rsa + echo "PubkeyAcceptedKeyTypes +ssh-rsa" > ~/.ssh/config ssh-keyscan -H trac.sagemath.org >> ~/.ssh/known_hosts # Setup trac repo From dee54036d85b37c56fad81cb707a1e21407ba57f Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 10:05:51 +0000 Subject: [PATCH 053/338] Tell conda about our env --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 6f103e44672..de1a2a6b06b 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,6 +7,7 @@ tasks: init: | # Create conda environment mamba env create --file src/environment-dev.yml --prefix venv + conda config --append envs_dirs /workspace/sagetrac-mirror conda activate /workspace/sagetrac-mirror/venv # Build sage From ce2cc77dc451a884fddbded1e16b0b6b0895ad6b Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 10:06:11 +0000 Subject: [PATCH 054/338] Add testing and linting to env --- .vscode/settings.json | 2 ++ src/environment-dev.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5844f80998f..05cf388c093 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,4 +19,6 @@ "src" ], "python.testing.unittestEnabled": false, + "python.linting.pycodestyleEnabled": true, + "python.linting.enabled": true, } diff --git a/src/environment-dev.yml b/src/environment-dev.yml index 31f80ec7399..f16d0b4f589 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -201,3 +201,5 @@ dependencies: - libtool # Additional dev tools - openssh + - pycodestyle + - pytest From 9d6374e52b28ddc61f132b2039e9397ab6944ef4 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 11:32:44 +0000 Subject: [PATCH 055/338] Add esbonio --- src/environment-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/environment-dev.yml b/src/environment-dev.yml index f16d0b4f589..6eadda66b05 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -203,3 +203,4 @@ dependencies: - openssh - pycodestyle - pytest + - esbonio From a8aaf487526b7a0c6f50fb243ef145d22cb98b48 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 11:34:44 +0000 Subject: [PATCH 056/338] Add conda config also in cmd to persist it --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index de1a2a6b06b..32d536b2f68 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -18,6 +18,7 @@ tasks: command: | # Activate conda environment + conda config --append envs_dirs /workspace/sagetrac-mirror conda activate /workspace/sagetrac-mirror/venv # Setup trac as remote From 2970e5e6f859ff90dd5a16428f3c89d66dcc69fc Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 18:50:21 +0000 Subject: [PATCH 057/338] Install esbonio via pip --- .gitpod.yml | 2 ++ src/environment-dev.yml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 32d536b2f68..f04efbeea31 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,6 +9,8 @@ tasks: mamba env create --file src/environment-dev.yml --prefix venv conda config --append envs_dirs /workspace/sagetrac-mirror conda activate /workspace/sagetrac-mirror/venv + ## Install esbonio via pip as long as there is no conda package for it: https://github.com/swyddfa/esbonio/issues/371 + pip install esbonio # Build sage ./bootstrap diff --git a/src/environment-dev.yml b/src/environment-dev.yml index 6eadda66b05..f16d0b4f589 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -203,4 +203,3 @@ dependencies: - openssh - pycodestyle - pytest - - esbonio From f9169c7437f64f1bccc1bd3ad66c28fea984add9 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 21:25:18 +0000 Subject: [PATCH 058/338] Try to auto-activate conda env --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index f04efbeea31..210dab82b53 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -11,6 +11,7 @@ tasks: conda activate /workspace/sagetrac-mirror/venv ## Install esbonio via pip as long as there is no conda package for it: https://github.com/swyddfa/esbonio/issues/371 pip install esbonio + echo 'conda activate /workspace/sagetrac-mirror/venv' >> ~/.bash_profile # Build sage ./bootstrap From 5f2c355eaeac3b299d7dc808076dfacda99af56d Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 21:51:43 +0000 Subject: [PATCH 059/338] Add jupyter_sphinx for esbonio --- src/environment-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/environment-dev.yml b/src/environment-dev.yml index f16d0b4f589..6d99447b852 100644 --- a/src/environment-dev.yml +++ b/src/environment-dev.yml @@ -203,3 +203,4 @@ dependencies: - openssh - pycodestyle - pytest + - jupyter_sphinx From 9c3b38b80e2203b221fbe88a73f2bf30ae812bb6 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 22:05:46 +0000 Subject: [PATCH 060/338] Try to set path in docker image --- .gitpod.yml | 3 ++- docker/.gitpod.Dockerfile | 15 +++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 210dab82b53..1e727383ae0 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,6 @@ # Use minimal Ubuntu installation that includes mamba -image: condaforge/mambaforge +image: + file: .gitpod.Dockerfile # Start up tasks. https://www.gitpod.io/docs/config-start-tasks/ tasks: diff --git a/docker/.gitpod.Dockerfile b/docker/.gitpod.Dockerfile index 56f2370ea0d..7939c88dfd0 100644 --- a/docker/.gitpod.Dockerfile +++ b/docker/.gitpod.Dockerfile @@ -1,12 +1,3 @@ -ARG BASE_GITHUB_REPOSITORY=sagemath/sage -ARG BASE_TAG=dev -FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-targets:${BASE_TAG} as with-targets -RUN sudo rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Fast doc rebuilds do not work because -# "loading pickled environment... failed; source directory has changed" -# Until this is fixed, we can as well remove the whole documentation, which saves a lot of space. -RUN rm -Rf /home/gitpod/sage-local/share/doc/sage - -FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-system-packages:${BASE_TAG} -COPY --chown=gitpod:gitpod --from=with-targets /home/gitpod/sage/logs /home/gitpod/sage/logs -COPY --chown=gitpod:gitpod --from=with-targets /home/gitpod/sage-local /home/gitpod/sage-local +FROM condaforge/mambaforge +ENV PATH $PATH:/workspace/sagetrac-mirror/venv/bin +USER gitpod \ No newline at end of file From abf784e89037346fc8f7a5ad7fc774b24c34b233 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 20 Apr 2022 22:18:31 +0000 Subject: [PATCH 061/338] Fix path to docker file --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 1e727383ae0..bccea4bafdd 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,6 +1,6 @@ # Use minimal Ubuntu installation that includes mamba image: - file: .gitpod.Dockerfile + file: docker/.gitpod.Dockerfile # Start up tasks. https://www.gitpod.io/docs/config-start-tasks/ tasks: From 005f923365b17f27e7c4e1b92029185bccb401a8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 11 Jun 2021 13:14:05 -0700 Subject: [PATCH 062/338] build/pkgs/markupsafe: Update to 2.0.1 --- build/pkgs/markupsafe/checksums.ini | 9 +++++---- build/pkgs/markupsafe/package-version.txt | 2 +- build/pkgs/markupsafe/spkg-install.in | 12 ------------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/build/pkgs/markupsafe/checksums.ini b/build/pkgs/markupsafe/checksums.ini index 3f0471b552e..8037d765361 100644 --- a/build/pkgs/markupsafe/checksums.ini +++ b/build/pkgs/markupsafe/checksums.ini @@ -1,4 +1,5 @@ -tarball=markupsafe-VERSION.tar.gz -sha1=f70e5fd3c120a1b108d4347ea1115e3962c42026 -md5=43fd756864fe42063068e092e220c57b -cksum=310980784 +tarball=MarkupSafe-VERSION.tar.gz +sha1=e1b766b2b1601fde67b3b19ed2f13b9746bb1cca +md5=892e0fefa3c488387e5cc0cad2daa523 +cksum=124987148 +upstream_url=https://pypi.io/packages/source/m/markupsafe/MarkupSafe-VERSION.tar.gz diff --git a/build/pkgs/markupsafe/package-version.txt b/build/pkgs/markupsafe/package-version.txt index 524cb55242b..38f77a65b30 100644 --- a/build/pkgs/markupsafe/package-version.txt +++ b/build/pkgs/markupsafe/package-version.txt @@ -1 +1 @@ -1.1.1 +2.0.1 diff --git a/build/pkgs/markupsafe/spkg-install.in b/build/pkgs/markupsafe/spkg-install.in index b9bfecbfd50..37ac1a53437 100644 --- a/build/pkgs/markupsafe/spkg-install.in +++ b/build/pkgs/markupsafe/spkg-install.in @@ -1,14 +1,2 @@ -if [ -z "$SAGE_LOCAL" ]; then - echo >&2 "SAGE_LOCAL undefined ... exiting" - echo >&2 "Maybe run 'sage --sh'?" - exit 1 -fi - cd src - sdh_pip_install . - -if [ $? -ne 0 ]; then - echo "Error installing markupsafe ... exiting" - exit 1 -fi From 3fd3429919fe2df3c3698200682649e5de90fa3c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 11 Jun 2021 13:15:54 -0700 Subject: [PATCH 063/338] build/pkgs/jinja2: Update to 3.0.1 --- build/pkgs/jinja2/checksums.ini | 10 +++++----- build/pkgs/jinja2/package-version.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/pkgs/jinja2/checksums.ini b/build/pkgs/jinja2/checksums.ini index e84600dd23a..e8ed52c3b83 100644 --- a/build/pkgs/jinja2/checksums.ini +++ b/build/pkgs/jinja2/checksums.ini @@ -1,5 +1,5 @@ -tarball=jinja2-VERSION.tar.gz -sha1=1017138fd4cb627204d3109b75c107c3d6f3f7fb -md5=0362203b22547abca06ed1082bc1e7b4 -cksum=1208782876 -upstream_url=https://pypi.io/packages/source/J/Jinja2/Jinja2-VERSION.tar.gz +tarball=Jinja2-VERSION.tar.gz +sha1=f001b6056a0d95c5d1ff1cec7a0df22426de8ed3 +md5=25ba6ef98c164878acff1036fbd72a1d +cksum=3023773642 +upstream_url=https://pypi.io/packages/source/j/jinja2/Jinja2-VERSION.tar.gz diff --git a/build/pkgs/jinja2/package-version.txt b/build/pkgs/jinja2/package-version.txt index 9e5bb77a3ba..cb2b00e4f7a 100644 --- a/build/pkgs/jinja2/package-version.txt +++ b/build/pkgs/jinja2/package-version.txt @@ -1 +1 @@ -2.11.2 +3.0.1 From dd9604c6764e676aa006cef20363cf639cff95e4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 21:24:25 -0700 Subject: [PATCH 064/338] build/pkgs/jinja2: Update to 3.1.1 --- build/pkgs/jinja2/checksums.ini | 6 +++--- build/pkgs/jinja2/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jinja2/checksums.ini b/build/pkgs/jinja2/checksums.ini index e8ed52c3b83..1e2005c59d9 100644 --- a/build/pkgs/jinja2/checksums.ini +++ b/build/pkgs/jinja2/checksums.ini @@ -1,5 +1,5 @@ tarball=Jinja2-VERSION.tar.gz -sha1=f001b6056a0d95c5d1ff1cec7a0df22426de8ed3 -md5=25ba6ef98c164878acff1036fbd72a1d -cksum=3023773642 +sha1=40278c4dfbbd6d21dc570bee0c63e32504e5442e +md5=964afcd0853f67f20f7b2e34e5935564 +cksum=380272436 upstream_url=https://pypi.io/packages/source/j/jinja2/Jinja2-VERSION.tar.gz diff --git a/build/pkgs/jinja2/package-version.txt b/build/pkgs/jinja2/package-version.txt index cb2b00e4f7a..94ff29cc4de 100644 --- a/build/pkgs/jinja2/package-version.txt +++ b/build/pkgs/jinja2/package-version.txt @@ -1 +1 @@ -3.0.1 +3.1.1 From 6dbbf393d0271d9a946441100b49e0cc3162f4db Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 21:26:10 -0700 Subject: [PATCH 065/338] build/pkgs/markupsafe: Update to 2.1.1 --- build/pkgs/markupsafe/checksums.ini | 6 +++--- build/pkgs/markupsafe/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/markupsafe/checksums.ini b/build/pkgs/markupsafe/checksums.ini index 8037d765361..5939d7266eb 100644 --- a/build/pkgs/markupsafe/checksums.ini +++ b/build/pkgs/markupsafe/checksums.ini @@ -1,5 +1,5 @@ tarball=MarkupSafe-VERSION.tar.gz -sha1=e1b766b2b1601fde67b3b19ed2f13b9746bb1cca -md5=892e0fefa3c488387e5cc0cad2daa523 -cksum=124987148 +sha1=8bd9855f5b92145b6bc0d38cc241d0253cccc5a8 +md5=9809f9fdd98bc835b0c21aa8f79cbf30 +cksum=928883078 upstream_url=https://pypi.io/packages/source/m/markupsafe/MarkupSafe-VERSION.tar.gz diff --git a/build/pkgs/markupsafe/package-version.txt b/build/pkgs/markupsafe/package-version.txt index 38f77a65b30..3e3c2f1e5ed 100644 --- a/build/pkgs/markupsafe/package-version.txt +++ b/build/pkgs/markupsafe/package-version.txt @@ -1 +1 @@ -2.0.1 +2.1.1 From a1602c9b06c66281c9221a79d1e4857e48db8ed9 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 21 Apr 2022 11:01:02 +0000 Subject: [PATCH 066/338] Disable python recommendation dialog --- .gitpod.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index bccea4bafdd..8e19fd993c3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -25,6 +25,10 @@ tasks: conda config --append envs_dirs /workspace/sagetrac-mirror conda activate /workspace/sagetrac-mirror/venv + # RestructuredText extension recommends python extension, although we have already installed it + ## So disable the recommendation dialog + echo "{\"restructuredtext.pythonRecommendation.disabled\": true}" > /workspace/.vscode-remote/data/Machine/settings.json + # Setup trac as remote ## In order to push to trac, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$( Date: Thu, 21 Apr 2022 11:26:25 +0000 Subject: [PATCH 067/338] Cleanup --- .gitpod.yml | 5 +++-- docker/.gitpod.Dockerfile | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 8e19fd993c3..3bb3366443a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -# Use minimal Ubuntu installation that includes mamba +# Use custom docker image. https://www.gitpod.io/docs/config-docker image: file: docker/.gitpod.Dockerfile @@ -12,7 +12,6 @@ tasks: conda activate /workspace/sagetrac-mirror/venv ## Install esbonio via pip as long as there is no conda package for it: https://github.com/swyddfa/esbonio/issues/371 pip install esbonio - echo 'conda activate /workspace/sagetrac-mirror/venv' >> ~/.bash_profile # Build sage ./bootstrap @@ -66,6 +65,8 @@ vscode: - lextudio.restructuredtext - streetsidesoftware.code-spell-checker - ms-toolsai.jupyter + - ms-toolsai.jupyter-keymap + - ms-toolsai.jupyter-renderers # https://www.gitpod.io/docs/prebuilds#github-specific-configuration github: diff --git a/docker/.gitpod.Dockerfile b/docker/.gitpod.Dockerfile index 7939c88dfd0..ff17d331515 100644 --- a/docker/.gitpod.Dockerfile +++ b/docker/.gitpod.Dockerfile @@ -1,3 +1,6 @@ +# Use minimal Ubuntu installation that includes mamba FROM condaforge/mambaforge +# Workaround so that vscode internals (such as git) find things installed in the conda env (notably ssh which is required to contribute to trac) ENV PATH $PATH:/workspace/sagetrac-mirror/venv/bin -USER gitpod \ No newline at end of file +# Default to non-admin user +USER gitpod From bd2f3d3bc7829f1ccc30f1aa274259d8ab138603 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 21 Apr 2022 11:28:47 +0000 Subject: [PATCH 068/338] Remove gitpod docker image build --- .github/workflows/tox.yml | 2 +- tox.ini | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 3050255d228..ef221e42719 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false max-parallel: 20 matrix: - tox_system_factor: [gitpod, ubuntu-trusty, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, centos-7, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, slackware-14.2, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386] + tox_system_factor: [ubuntu-trusty, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, centos-7, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, slackware-14.2, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386] tox_packages_factor: [minimal, standard] env: TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} diff --git a/tox.ini b/tox.ini index 47c10c364ef..d0975b516dc 100644 --- a/tox.ini +++ b/tox.ini @@ -438,22 +438,6 @@ setenv = ubuntu-bionic-nvidia-cuda: BASE_TAG=ubuntu18.04 ubuntu-xenial-nvidia-cuda: BASE_TAG=ubuntu16.04 # - # https://hub.docker.com/r/gitpod/ - # - gitpod: SYSTEM=debian - gitpod: BASE_IMAGE=gitpod/workspace-base - gitpod-full: BASE_IMAGE=gitpod/workspace-full - gitpod: CONFIG_CONFIGURE_ARGS_ROOT=--prefix=/home/gitpod/sage-local --with-sage-venv - gitpod: __SUDO=--sudo - gitpod: __CHOWN=--chown=gitpod:gitpod - # Play safe and make sure that the image build succeeds even - # if packages that do not exist on ubuntu-focal are added to debian.txt - gitpod: IGNORE_MISSING_SYSTEM_PACKAGES=yes - # As of 2022-01, gitpod/workspace-base is based on ubuntu-focal. - # To save space, we filter out some packages that are too old and - # will be rejected by our configure script. - gitpod-standard: SAGE_PACKAGE_LIST_ARGS=--has-file=spkg-configure.m4 :standard: --exclude pari --exclude eclib --exclude lcalc --exclude giac --exclude singular - # # Resulting full image:tag name # docker: FULL_BASE_IMAGE_AND_TAG={env:ARCH_IMAGE_PREFIX:}{env:BASE_IMAGE}{env:ARCH_IMAGE_SUFFIX:}:{env:ARCH_TAG_PREFIX:}{env:BASE_TAG}{env:ARCH_TAG_SUFFIX:} From c000c8c89ed17cde730b171ef938f0c539547478 Mon Sep 17 00:00:00 2001 From: Darij Grinberg Date: Mon, 25 Apr 2022 11:03:38 +0900 Subject: [PATCH 069/338] Better normalize permutations for Schubert polynomials --- src/sage/combinat/permutation.py | 13 +++++++++++++ src/sage/combinat/schubert_polynomial.py | 18 ++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 8eae4b7c84c..1dce5cdfa06 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -4756,6 +4756,13 @@ def remove_extra_fixed_points(self): """ Return the permutation obtained by removing any fixed points at the end of ``self``. + However, return ``[1]`` rather than ``[]`` if ``self`` is the + identity permutation. + + This is mostly a helper method for + :module:`sage.combinat.schubert_polynomial`, where it is + used to normalize finitary permutations of + `\{1,2,3,\ldots\}`. EXAMPLES:: @@ -4763,11 +4770,17 @@ def remove_extra_fixed_points(self): [2, 1] sage: Permutation([1,2,3,4]).remove_extra_fixed_points() [1] + sage: Permutation([2,1]).remove_extra_fixed_points() + [2, 1] + sage: Permutation([]).remove_extra_fixed_points() + [1] .. SEEALSO:: :meth:`retract_plain` """ + if not self: + return Permutations()([1]) #Strip off all extra fixed points at the end of #the permutation. i = len(self)-1 diff --git a/src/sage/combinat/schubert_polynomial.py b/src/sage/combinat/schubert_polynomial.py index af28a8e45d7..b939754716c 100644 --- a/src/sage/combinat/schubert_polynomial.py +++ b/src/sage/combinat/schubert_polynomial.py @@ -66,9 +66,7 @@ def expand(self): TESTS: Calling .expand() should always return an element of an - MPolynomialRing - - :: + MPolynomialRing:: sage: X = SchubertPolynomialRing(ZZ) sage: f = X([1]); f @@ -83,10 +81,16 @@ def expand(self): sage: f = X([1,3,2,4]) sage: type(f.expand()) + + Now we check for correct handling of the empty + permutation (:trac:`23443`):: + + sage: X([1]).expand() * X([2,1]).expand() + x0 """ p = symmetrica.t_SCHUBERT_POLYNOM(self) if not is_MPolynomial(p): - R = PolynomialRing(self.parent().base_ring(), 1, 'x') + R = PolynomialRing(self.parent().base_ring(), 1, 'x0') p = R(p) return p @@ -361,6 +365,12 @@ def _element_constructor_(self, x): Traceback (most recent call last): ... ValueError: The input [1, 2, 1] is not a valid permutation + + Now we check for correct handling of the empty + permutation (:trac:`23443`):: + + sage: X([]) + X[1] """ if isinstance(x, list): # checking the input to avoid symmetrica crashing Sage, see trac 12924 From 3bf8620258a6c3431cea12ee2f65cbb0513535af Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 28 Apr 2022 21:51:26 +0000 Subject: [PATCH 070/338] Clean furo package description --- .vscode/settings.json | 3 +++ build/pkgs/furo/SPKG.rst | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5844f80998f..c3f2f466c35 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,4 +19,7 @@ "src" ], "python.testing.unittestEnabled": false, + "cSpell.words": [ + "furo" + ], } diff --git a/build/pkgs/furo/SPKG.rst b/build/pkgs/furo/SPKG.rst index ebbd1bba238..368eff31748 100644 --- a/build/pkgs/furo/SPKG.rst +++ b/build/pkgs/furo/SPKG.rst @@ -1,10 +1,10 @@ -furo: A clean customisable Sphinx documentation theme. -====================================================== +furo: A clean customizable Sphinx documentation theme +===================================================== Description ----------- -A clean customisable Sphinx documentation theme. +A clean customizable Sphinx documentation theme. License ------- From 8e7548b77d084a2268824c40be92f5a075f68886 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 30 Apr 2022 12:58:23 +0200 Subject: [PATCH 071/338] trac #33776: move distance_graph to graph.py --- src/sage/graphs/generic_graph.py | 161 ------------------------------- src/sage/graphs/graph.py | 161 +++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 161 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index a57e74c632a..29f6dfd7b80 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -216,7 +216,6 @@ :meth:`~GenericGraph.distance` | Return the (directed) distance from u to v in the (di)graph :meth:`~GenericGraph.distance_all_pairs` | Return the distances between all pairs of vertices. :meth:`~GenericGraph.distances_distribution` | Return the distances distribution of the (di)graph in a dictionary. - :meth:`~GenericGraph.distance_graph` | Return the graph on the same vertex set as the original graph but vertices are adjacent in the returned graph if and only if they are at specified distances in the original graph. :meth:`~GenericGraph.girth` | Return the girth of the graph. :meth:`~GenericGraph.odd_girth` | Return the odd girth of the graph. :meth:`~GenericGraph.shortest_path` | Return a list of vertices representing some shortest path from `u` to `v` @@ -14924,166 +14923,6 @@ def distance_all_pairs(self, by_weight=False, algorithm=None, weight_function=weight_function, check_weight=check_weight)[0] - def distance_graph(self, dist): - r""" - Return the graph on the same vertex set as the original graph but - vertices are adjacent in the returned graph if and only if they are at - specified distances in the original graph. - - INPUT: - - - ``dist`` -- a nonnegative integer or a list of nonnegative integers; - specified distance(s) for the connecting vertices. ``Infinity`` may - be used here to describe vertex pairs in separate components. - - OUTPUT: - - The returned value is an undirected graph. The vertex set is identical - to the calling graph, but edges of the returned graph join vertices - whose distance in the calling graph are present in the input ``dist``. - Loops will only be present if distance 0 is included. If the original - graph has a position dictionary specifying locations of vertices for - plotting, then this information is copied over to the distance graph. - In some instances this layout may not be the best, and might even be - confusing when edges run on top of each other due to symmetries chosen - for the layout. - - EXAMPLES:: - - sage: G = graphs.CompleteGraph(3) - sage: H = G.cartesian_product(graphs.CompleteGraph(2)) - sage: K = H.distance_graph(2) - sage: K.am() - [0 0 0 1 0 1] - [0 0 1 0 1 0] - [0 1 0 0 0 1] - [1 0 0 0 1 0] - [0 1 0 1 0 0] - [1 0 1 0 0 0] - - To obtain the graph where vertices are adjacent if their distance apart - is ``d`` or less use a ``range()`` command to create the input, using - ``d + 1`` as the input to ``range``. Notice that this will include - distance 0 and hence place a loop at each vertex. To avoid this, use - ``range(1, d + 1)``:: - - sage: G = graphs.OddGraph(4) - sage: d = G.diameter() - sage: n = G.num_verts() - sage: H = G.distance_graph(list(range(d+1))) - sage: H.is_isomorphic(graphs.CompleteGraph(n)) - False - sage: H = G.distance_graph(list(range(1,d+1))) - sage: H.is_isomorphic(graphs.CompleteGraph(n)) - True - - A complete collection of distance graphs will have adjacency matrices - that sum to the matrix of all ones:: - - sage: P = graphs.PathGraph(20) - sage: all_ones = sum([P.distance_graph(i).am() for i in range(20)]) - sage: all_ones == matrix(ZZ, 20, 20, [1]*400) - True - - Four-bit strings differing in one bit is the same as - four-bit strings differing in three bits:: - - sage: G = graphs.CubeGraph(4) - sage: H = G.distance_graph(3) - sage: G.is_isomorphic(H) - True - - The graph of eight-bit strings, adjacent if different in an odd number - of bits:: - - sage: G = graphs.CubeGraph(8) # long time - sage: H = G.distance_graph([1,3,5,7]) # long time - sage: degrees = [0]*sum([binomial(8,j) for j in [1,3,5,7]]) # long time - sage: degrees.append(2^8) # long time - sage: degrees == H.degree_histogram() # long time - True - - An example of using ``Infinity`` as the distance in a graph that is not - connected:: - - sage: G = graphs.CompleteGraph(3) - sage: H = G.disjoint_union(graphs.CompleteGraph(2)) - sage: L = H.distance_graph(Infinity) - sage: L.am() - [0 0 0 1 1] - [0 0 0 1 1] - [0 0 0 1 1] - [1 1 1 0 0] - [1 1 1 0 0] - - TESTS: - - Empty input, or unachievable distances silently yield empty graphs:: - - sage: G = graphs.CompleteGraph(5) - sage: G.distance_graph([]).num_edges() - 0 - sage: G = graphs.CompleteGraph(5) - sage: G.distance_graph(23).num_edges() - 0 - - It is an error to provide a distance that is not an integer type:: - - sage: G = graphs.CompleteGraph(5) - sage: G.distance_graph('junk') - Traceback (most recent call last): - ... - TypeError: unable to convert 'junk' to an integer - - It is an error to provide a negative distance:: - - sage: G = graphs.CompleteGraph(5) - sage: G.distance_graph(-3) - Traceback (most recent call last): - ... - ValueError: distance graph for a negative distance (d=-3) is not defined - - AUTHOR: - - Rob Beezer, 2009-11-25 - """ - from sage.rings.infinity import Infinity - # If input is not a list, make a list with this single object - if not isinstance(dist, list): - dist = [dist] - # Create a list of positive integer (or infinite) distances - distances = [] - for d in dist: - if d == Infinity: - distances.append(d) - else: - dint = ZZ(d) - if dint < 0: - raise ValueError('distance graph for a negative distance (d=%d) is not defined' % dint) - distances.append(dint) - # Build a graph on the same vertex set, with loops for distance 0 - vertices = {v: {} for v in self} - positions = copy(self.get_pos()) - if ZZ(0) in distances: - looped = True - else: - looped = False - from sage.graphs.graph import Graph - D = Graph(vertices, pos=positions, multiedges=False, loops=looped) - if len(distances) == 1: - dstring = "distance " + str(distances[0]) - else: - dstring = "distances " + str(sorted(distances)) - D.name("Distance graph for %s in " % dstring + self.name()) - - # Create the appropriate edges - d = self.distance_all_pairs() - for u in self: - for v in self: - if d[u].get(v, Infinity) in distances: - D.add_edge(u, v) - return D - def girth(self, certificate=False): """ Return the girth of the graph. diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index a4de61e3c0f..1d1aee130e1 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -5475,6 +5475,167 @@ def periphery(self, by_weight=False, algorithm=None, weight_function=None, return [] return [v for v in self if ecc[v] == d] + @doc_index("Distances") + def distance_graph(self, dist): + r""" + Return the graph on the same vertex set as the original graph but + vertices are adjacent in the returned graph if and only if they are at + specified distances in the original graph. + + INPUT: + + - ``dist`` -- a nonnegative integer or a list of nonnegative integers; + specified distance(s) for the connecting vertices. ``Infinity`` may + be used here to describe vertex pairs in separate components. + + OUTPUT: + + The returned value is an undirected graph. The vertex set is identical + to the calling graph, but edges of the returned graph join vertices + whose distance in the calling graph are present in the input ``dist``. + Loops will only be present if distance 0 is included. If the original + graph has a position dictionary specifying locations of vertices for + plotting, then this information is copied over to the distance graph. + In some instances this layout may not be the best, and might even be + confusing when edges run on top of each other due to symmetries chosen + for the layout. + + EXAMPLES:: + + sage: G = graphs.CompleteGraph(3) + sage: H = G.cartesian_product(graphs.CompleteGraph(2)) + sage: K = H.distance_graph(2) + sage: K.am() + [0 0 0 1 0 1] + [0 0 1 0 1 0] + [0 1 0 0 0 1] + [1 0 0 0 1 0] + [0 1 0 1 0 0] + [1 0 1 0 0 0] + + To obtain the graph where vertices are adjacent if their distance apart + is ``d`` or less use a ``range()`` command to create the input, using + ``d + 1`` as the input to ``range``. Notice that this will include + distance 0 and hence place a loop at each vertex. To avoid this, use + ``range(1, d + 1)``:: + + sage: G = graphs.OddGraph(4) + sage: d = G.diameter() + sage: n = G.num_verts() + sage: H = G.distance_graph(list(range(d+1))) + sage: H.is_isomorphic(graphs.CompleteGraph(n)) + False + sage: H = G.distance_graph(list(range(1,d+1))) + sage: H.is_isomorphic(graphs.CompleteGraph(n)) + True + + A complete collection of distance graphs will have adjacency matrices + that sum to the matrix of all ones:: + + sage: P = graphs.PathGraph(20) + sage: all_ones = sum([P.distance_graph(i).am() for i in range(20)]) + sage: all_ones == matrix(ZZ, 20, 20, [1]*400) + True + + Four-bit strings differing in one bit is the same as + four-bit strings differing in three bits:: + + sage: G = graphs.CubeGraph(4) + sage: H = G.distance_graph(3) + sage: G.is_isomorphic(H) + True + + The graph of eight-bit strings, adjacent if different in an odd number + of bits:: + + sage: G = graphs.CubeGraph(8) # long time + sage: H = G.distance_graph([1,3,5,7]) # long time + sage: degrees = [0]*sum([binomial(8,j) for j in [1,3,5,7]]) # long time + sage: degrees.append(2^8) # long time + sage: degrees == H.degree_histogram() # long time + True + + An example of using ``Infinity`` as the distance in a graph that is not + connected:: + + sage: G = graphs.CompleteGraph(3) + sage: H = G.disjoint_union(graphs.CompleteGraph(2)) + sage: L = H.distance_graph(Infinity) + sage: L.am() + [0 0 0 1 1] + [0 0 0 1 1] + [0 0 0 1 1] + [1 1 1 0 0] + [1 1 1 0 0] + + TESTS: + + Empty input, or unachievable distances silently yield empty graphs:: + + sage: G = graphs.CompleteGraph(5) + sage: G.distance_graph([]).num_edges() + 0 + sage: G = graphs.CompleteGraph(5) + sage: G.distance_graph(23).num_edges() + 0 + + It is an error to provide a distance that is not an integer type:: + + sage: G = graphs.CompleteGraph(5) + sage: G.distance_graph('junk') + Traceback (most recent call last): + ... + TypeError: unable to convert 'junk' to an integer + + It is an error to provide a negative distance:: + + sage: G = graphs.CompleteGraph(5) + sage: G.distance_graph(-3) + Traceback (most recent call last): + ... + ValueError: distance graph for a negative distance (d=-3) is not defined + + AUTHOR: + + Rob Beezer, 2009-11-25, :trac:`7533` + """ + from sage.rings.infinity import Infinity + # If input is not a list, make a list with this single object + if not isinstance(dist, list): + dist = [dist] + # Create a list of positive integer (or infinite) distances + distances = [] + for d in dist: + if d == Infinity: + distances.append(d) + else: + dint = ZZ(d) + if dint < 0: + raise ValueError('distance graph for a negative distance (d=%d) is not defined' % dint) + distances.append(dint) + # Build a graph on the same vertex set, with loops for distance 0 + vertices = {v: {} for v in self} + positions = copy(self.get_pos()) + if ZZ(0) in distances: + looped = True + else: + looped = False + from sage.graphs.graph import Graph + D = Graph(vertices, pos=positions, multiedges=False, loops=looped) + if len(distances) == 1: + dstring = "distance " + str(distances[0]) + else: + dstring = "distances " + str(sorted(distances)) + D.name("Distance graph for %s in " % dstring + self.name()) + + # Create the appropriate edges + d = self.distance_all_pairs() + for u in self: + for v in self: + if d[u].get(v, Infinity) in distances: + D.add_edge(u, v) + return D + ### Constructors @doc_index("Basic methods") From f71557684cbca2aa8792d5fbe93f342e6d4bd2bb Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 30 Apr 2022 13:04:51 +0200 Subject: [PATCH 072/338] trac #33776: speed up --- src/sage/graphs/graph.py | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 1d1aee130e1..22a1108261a 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -5605,35 +5605,47 @@ def distance_graph(self, dist): dist = [dist] # Create a list of positive integer (or infinite) distances distances = [] + s_distances = set() + b_oo = False for d in dist: if d == Infinity: - distances.append(d) + b_oo = True + distances.append(Infinity) else: dint = ZZ(d) if dint < 0: raise ValueError('distance graph for a negative distance (d=%d) is not defined' % dint) distances.append(dint) + s_distances.add(dint) # Build a graph on the same vertex set, with loops for distance 0 - vertices = {v: {} for v in self} - positions = copy(self.get_pos()) - if ZZ(0) in distances: - looped = True - else: - looped = False - from sage.graphs.graph import Graph - D = Graph(vertices, pos=positions, multiedges=False, loops=looped) if len(distances) == 1: dstring = "distance " + str(distances[0]) else: dstring = "distances " + str(sorted(distances)) - D.name("Distance graph for %s in " % dstring + self.name()) + name = "Distance graph for %s in " % dstring + self.name() + looped = ZZ(0) in s_distances + from sage.graphs.graph import Graph + D = Graph([self, []], format='vertices_and_edges', + multiedges=False, loops=looped, + pos=copy(self.get_pos()), name=name) # Create the appropriate edges - d = self.distance_all_pairs() - for u in self: - for v in self: - if d[u].get(v, Infinity) in distances: + import itertools + if self.is_connected(): + CC = [self] + else: + CC = self.connected_components_subgraphs() + if b_oo: + # add edges between connected components + for A, B in itertools.combinations(CC, 2): + D.add_edges(itertools.product(A, B)) + for g in CC: + d = g.distance_all_pairs() + for u, v in itertools.combinations(g, 2): + if d[u][v] in s_distances: D.add_edge(u, v) + if looped: + D.add_edges((u, u) for u in self) return D ### Constructors From 1edf47a2da179e8d20418c2f157af16663e462ee Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 30 Apr 2022 13:27:17 +0200 Subject: [PATCH 073/338] trac #33776: some care --- src/sage/graphs/graph.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 22a1108261a..9718a82b992 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -5485,7 +5485,7 @@ def distance_graph(self, dist): INPUT: - ``dist`` -- a nonnegative integer or a list of nonnegative integers; - specified distance(s) for the connecting vertices. ``Infinity`` may + specified distance(s) for the connecting vertices. ``Infinity`` may be used here to describe vertex pairs in separate components. OUTPUT: @@ -5493,7 +5493,7 @@ def distance_graph(self, dist): The returned value is an undirected graph. The vertex set is identical to the calling graph, but edges of the returned graph join vertices whose distance in the calling graph are present in the input ``dist``. - Loops will only be present if distance 0 is included. If the original + Loops will only be present if distance 0 is included. If the original graph has a position dictionary specifying locations of vertices for plotting, then this information is copied over to the distance graph. In some instances this layout may not be the best, and might even be @@ -5515,8 +5515,8 @@ def distance_graph(self, dist): To obtain the graph where vertices are adjacent if their distance apart is ``d`` or less use a ``range()`` command to create the input, using - ``d + 1`` as the input to ``range``. Notice that this will include - distance 0 and hence place a loop at each vertex. To avoid this, use + ``d + 1`` as the input to ``range``. Notice that this will include + distance 0 and hence place a loop at each vertex. To avoid this, use ``range(1, d + 1)``:: sage: G = graphs.OddGraph(4) @@ -5548,11 +5548,11 @@ def distance_graph(self, dist): The graph of eight-bit strings, adjacent if different in an odd number of bits:: - sage: G = graphs.CubeGraph(8) # long time - sage: H = G.distance_graph([1,3,5,7]) # long time - sage: degrees = [0]*sum([binomial(8,j) for j in [1,3,5,7]]) # long time - sage: degrees.append(2^8) # long time - sage: degrees == H.degree_histogram() # long time + sage: G = graphs.CubeGraph(8) # long time + sage: H = G.distance_graph([1,3,5,7]) # long time + sage: degrees = [0]*sum([binomial(8,j) for j in [1,3,5,7]]) # long time + sage: degrees.append(2^8) # long time + sage: degrees == H.degree_histogram() # long time True An example of using ``Infinity`` as the distance in a graph that is not @@ -5567,6 +5567,8 @@ def distance_graph(self, dist): [0 0 0 1 1] [1 1 1 0 0] [1 1 1 0 0] + sage: L.is_isomorphic(graphs.CompleteBipartiteGraph(3, 2)) + True TESTS: @@ -5605,18 +5607,15 @@ def distance_graph(self, dist): dist = [dist] # Create a list of positive integer (or infinite) distances distances = [] - s_distances = set() - b_oo = False for d in dist: if d == Infinity: - b_oo = True distances.append(Infinity) else: dint = ZZ(d) if dint < 0: raise ValueError('distance graph for a negative distance (d=%d) is not defined' % dint) distances.append(dint) - s_distances.add(dint) + s_distances = set(distances) # Build a graph on the same vertex set, with loops for distance 0 if len(distances) == 1: dstring = "distance " + str(distances[0]) @@ -5635,7 +5634,7 @@ def distance_graph(self, dist): CC = [self] else: CC = self.connected_components_subgraphs() - if b_oo: + if Infinity in s_distances: # add edges between connected components for A, B in itertools.combinations(CC, 2): D.add_edges(itertools.product(A, B)) From b50896bf5119c52dafa1506be5953caebf764a79 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 26 Nov 2021 20:35:34 -0800 Subject: [PATCH 074/338] pkgs/sagemath-environment: Copy/symlink from pkgs/sagemath-objects --- pkgs/sagemath-environment/MANIFEST.in | 10 ++++++ pkgs/sagemath-environment/README.rst | 23 ++++++++++++++ pkgs/sagemath-environment/VERSION.txt | 1 + pkgs/sagemath-environment/pyproject.toml.m4 | 9 ++++++ pkgs/sagemath-environment/requirements.txt.m4 | 0 pkgs/sagemath-environment/sage | 1 + pkgs/sagemath-environment/setup.cfg.m4 | 31 +++++++++++++++++++ pkgs/sagemath-environment/setup.py | 1 + pkgs/sagemath-environment/tox.ini | 27 ++++++++++++++++ 9 files changed, 103 insertions(+) create mode 100644 pkgs/sagemath-environment/MANIFEST.in create mode 100644 pkgs/sagemath-environment/README.rst create mode 120000 pkgs/sagemath-environment/VERSION.txt create mode 100644 pkgs/sagemath-environment/pyproject.toml.m4 create mode 100644 pkgs/sagemath-environment/requirements.txt.m4 create mode 120000 pkgs/sagemath-environment/sage create mode 100644 pkgs/sagemath-environment/setup.cfg.m4 create mode 120000 pkgs/sagemath-environment/setup.py create mode 100644 pkgs/sagemath-environment/tox.ini diff --git a/pkgs/sagemath-environment/MANIFEST.in b/pkgs/sagemath-environment/MANIFEST.in new file mode 100644 index 00000000000..2a62340508e --- /dev/null +++ b/pkgs/sagemath-environment/MANIFEST.in @@ -0,0 +1,10 @@ +prune sage +include sage/env.py +include sage/version.py +include sage/misc/package.py +include sage/misc/viewer.py +graft sage/features + +include VERSION.txt + +global-exclude *.py[co] diff --git a/pkgs/sagemath-environment/README.rst b/pkgs/sagemath-environment/README.rst new file mode 100644 index 00000000000..f5c52660ca8 --- /dev/null +++ b/pkgs/sagemath-environment/README.rst @@ -0,0 +1,23 @@ +========================================================================= + Sage: Open Source Mathematics Software: System and software environment +========================================================================= + +About SageMath +-------------- + + "Creating a Viable Open Source Alternative to + Magma, Maple, Mathematica, and MATLAB" + + Copyright (C) 2005-2020 The Sage Development Team + + https://www.sagemath.org + +SageMath fully supports all major Linux distributions, recent versions of macOS, and Windows (using Cygwin or Windows Subsystem for Linux). + +The traditional and recommended way to install SageMath is from source via Sage-the-distribution (https://www.sagemath.org/download-source.html). Sage-the-distribution first builds a large number of open source packages from source (unless it finds suitable versions installed in the system) and then installs the Sage Library (sagelib, implemented in Python and Cython). + + +About this experimental pip-installable source distribution +----------------------------------------------------------- + +This pip-installable source distribution `sagemath-environment` is an experimental distribution of a small part of the Sage Library. Use at your own risk. It provides a small, fundamental subset of the modules of the Sage library ("sagelib", `sagemath-standard`), providing the connection to the system and software environment. diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt new file mode 120000 index 00000000000..43f4773d7de --- /dev/null +++ b/pkgs/sagemath-environment/VERSION.txt @@ -0,0 +1 @@ +../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-environment/pyproject.toml.m4 b/pkgs/sagemath-environment/pyproject.toml.m4 new file mode 100644 index 00000000000..f4df12f5d11 --- /dev/null +++ b/pkgs/sagemath-environment/pyproject.toml.m4 @@ -0,0 +1,9 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = [ + esyscmd(`sage-get-system-packages install-requires-toml \ + setuptools \ + wheel \ + sage_setup \ + ')] +build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-environment/requirements.txt.m4 b/pkgs/sagemath-environment/requirements.txt.m4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/sagemath-environment/sage b/pkgs/sagemath-environment/sage new file mode 120000 index 00000000000..e0da5daa6f2 --- /dev/null +++ b/pkgs/sagemath-environment/sage @@ -0,0 +1 @@ +../../src/sage \ No newline at end of file diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 new file mode 100644 index 00000000000..f43a24aadaf --- /dev/null +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -0,0 +1,31 @@ +# -*- conf-unix -*- +[metadata] +name = sagemath-environment +version = file: VERSION.txt +description = Sage: Open Source Mathematics Software: System and software environment +long_description = file: README.rst +long_description_content_type = text/x-rst +license = GNU General Public License (GPL) v2 or later +author = The Sage Developers +author_email = sage-support@googlegroups.com +url = https://www.sagemath.org + +classifiers = + Development Status :: 6 - Mature + Intended Audience :: Education + Intended Audience :: Science/Research + License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + Topic :: Scientific/Engineering :: Mathematics + +[options] +python_requires = >=3.7, <3.10 +install_requires = + esyscmd(`sage-get-system-packages install-requires \ + | sed "2,\$s/^/ /;"')dnl diff --git a/pkgs/sagemath-environment/setup.py b/pkgs/sagemath-environment/setup.py new file mode 120000 index 00000000000..144436eac59 --- /dev/null +++ b/pkgs/sagemath-environment/setup.py @@ -0,0 +1 @@ +../sagemath-objects/setup.py \ No newline at end of file diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini new file mode 100644 index 00000000000..0ccc2aeccfc --- /dev/null +++ b/pkgs/sagemath-environment/tox.ini @@ -0,0 +1,27 @@ +# To build and test in the tox environment: +# +# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v)' +# +# To test interactively: +# +# pkgs/sagemath-environment/.tox/python/bin/python +# +[tox] + +[testenv] +deps = -rrequirements.txt + +setenv = + # Sage scripts such as sage-runtests like to use $HOME/.sage + HOME={envdir} + +passenv = + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + +whitelist_externals = + bash + +commands = + # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. + python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.features' From 68178f5205d50ea90e9d6dd7b7b22a3370e28bb4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 27 Nov 2021 16:00:44 -0800 Subject: [PATCH 075/338] src/doc/en/developer/packaging_sage_library.rst: Explain build/pkgs --- src/doc/en/developer/packaging_sage_library.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index a8ea6c8bd40..7f2ce9c9057 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -171,6 +171,12 @@ When adding a new distribution package that uses a symbolic link pointing into Some of these files may actually be generated from source files with suffix ``.m4`` by the ``SAGE_ROOT/bootstrap`` script via the ``m4`` macro processor. +For every distribution package, there is also a subdirectory of ``SAGE_ROOT/build/pkgs/``, +which contains the build infrastructure that is specific to Sage-the-distribution. +Note that these subdirectories follows a different naming convention, +using underscores instead of dashes, see :ref:`section-directory-structure`. +Because the distribution packages are included in the source tree, we set them +up as "script packages" instead of "normal packages", see :ref:`section-package-source-types`. From dcf076dfa9aeda2e722cb874cccbbe26d3deb44f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 29 Nov 2021 18:42:43 -0800 Subject: [PATCH 076/338] build/pkgs/sagemath_environment: New --- build/pkgs/sagemath_environment/SPKG.rst | 1 + build/pkgs/sagemath_environment/bootstrap | 1 + build/pkgs/sagemath_environment/dependencies | 1 + .../sagemath_environment/package-version.txt | 1 + build/pkgs/sagemath_environment/spkg-install | 1 + build/pkgs/sagemath_environment/spkg-src | 21 +++++++++++++++++++ build/pkgs/sagemath_environment/src | 1 + build/pkgs/sagemath_environment/type | 1 + 8 files changed, 28 insertions(+) create mode 120000 build/pkgs/sagemath_environment/SPKG.rst create mode 120000 build/pkgs/sagemath_environment/bootstrap create mode 120000 build/pkgs/sagemath_environment/dependencies create mode 120000 build/pkgs/sagemath_environment/package-version.txt create mode 120000 build/pkgs/sagemath_environment/spkg-install create mode 100755 build/pkgs/sagemath_environment/spkg-src create mode 120000 build/pkgs/sagemath_environment/src create mode 100644 build/pkgs/sagemath_environment/type diff --git a/build/pkgs/sagemath_environment/SPKG.rst b/build/pkgs/sagemath_environment/SPKG.rst new file mode 120000 index 00000000000..b4545b4bda6 --- /dev/null +++ b/build/pkgs/sagemath_environment/SPKG.rst @@ -0,0 +1 @@ +src/README.rst \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/bootstrap b/build/pkgs/sagemath_environment/bootstrap new file mode 120000 index 00000000000..40542346a4e --- /dev/null +++ b/build/pkgs/sagemath_environment/bootstrap @@ -0,0 +1 @@ +../sagelib/bootstrap \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/dependencies b/build/pkgs/sagemath_environment/dependencies new file mode 120000 index 00000000000..55c209e6418 --- /dev/null +++ b/build/pkgs/sagemath_environment/dependencies @@ -0,0 +1 @@ +../sagemath_objects/dependencies \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/package-version.txt b/build/pkgs/sagemath_environment/package-version.txt new file mode 120000 index 00000000000..cf10fe4b4e4 --- /dev/null +++ b/build/pkgs/sagemath_environment/package-version.txt @@ -0,0 +1 @@ +../sagelib/package-version.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/spkg-install b/build/pkgs/sagemath_environment/spkg-install new file mode 120000 index 00000000000..e60fac9ffa1 --- /dev/null +++ b/build/pkgs/sagemath_environment/spkg-install @@ -0,0 +1 @@ +../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/spkg-src b/build/pkgs/sagemath_environment/spkg-src new file mode 100755 index 00000000000..327d51651b9 --- /dev/null +++ b/build/pkgs/sagemath_environment/spkg-src @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Script to prepare an sdist tarball for sagemath-categories +# This script is not used during build. +# +# HOW TO MAKE THE TARBALL: +# ./sage --sh build/pkgs/sagemath_categories/spkg-src + +if [ -z "$SAGE_ROOT" ] ; then + echo >&2 "Error - SAGE_ROOT undefined ... exiting" + echo >&2 "Maybe run 'sage -sh'?" + exit 1 +fi + +# Exit on failure +set -e + +cd build/pkgs/sagemath_categories + +cd src +python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_environment/src b/build/pkgs/sagemath_environment/src new file mode 120000 index 00000000000..a6bd42f71d3 --- /dev/null +++ b/build/pkgs/sagemath_environment/src @@ -0,0 +1 @@ +../../../pkgs/sagemath-environment \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/type b/build/pkgs/sagemath_environment/type new file mode 100644 index 00000000000..9839eb20815 --- /dev/null +++ b/build/pkgs/sagemath_environment/type @@ -0,0 +1 @@ +experimental From 15b45049bfe25d21ea985ed744aed36b096d09cd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Dec 2021 18:15:53 -0800 Subject: [PATCH 077/338] src/sage/env.py: Get SAGE_LIB via sage.env's __file__ --- src/sage/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/env.py b/src/sage/env.py index 6d933757730..6ac4b07e28e 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -167,7 +167,7 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st # virtual environment where sagelib is installed SAGE_VENV = var("SAGE_VENV", os.path.abspath(sys.prefix)) -SAGE_LIB = var("SAGE_LIB", os.path.dirname(os.path.dirname(sage.__file__))) +SAGE_LIB = var("SAGE_LIB", os.path.dirname(os.path.dirname(__file__))) SAGE_EXTCODE = var("SAGE_EXTCODE", join(SAGE_LIB, "sage", "ext_data")) SAGE_VENV_SPKG_INST = var("SAGE_VENV_SPKG_INST", join(SAGE_VENV, "var", "lib", "sage", "installed")) From 0f426b205b652ce558692f7772c64e24c928ad1e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Dec 2021 18:28:00 -0800 Subject: [PATCH 078/338] pkgs/sagemath-environment: Change to a setup.py-less build, remove sage-setup dependency --- pkgs/sagemath-environment/pyproject.toml.m4 | 1 - pkgs/sagemath-environment/setup.cfg.m4 | 9 +++++++++ pkgs/sagemath-environment/setup.py | 1 - pkgs/sagemath-environment/tox.ini | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) delete mode 120000 pkgs/sagemath-environment/setup.py diff --git a/pkgs/sagemath-environment/pyproject.toml.m4 b/pkgs/sagemath-environment/pyproject.toml.m4 index f4df12f5d11..686515673fc 100644 --- a/pkgs/sagemath-environment/pyproject.toml.m4 +++ b/pkgs/sagemath-environment/pyproject.toml.m4 @@ -4,6 +4,5 @@ requires = [ esyscmd(`sage-get-system-packages install-requires-toml \ setuptools \ wheel \ - sage_setup \ ')] build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index f43a24aadaf..bbbbca19802 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -29,3 +29,12 @@ python_requires = >=3.7, <3.10 install_requires = esyscmd(`sage-get-system-packages install-requires \ | sed "2,\$s/^/ /;"')dnl + +py_modules = + sage.env + sage.version + sage.misc.package + sage.misc.viewer + +packages = + sage.features diff --git a/pkgs/sagemath-environment/setup.py b/pkgs/sagemath-environment/setup.py deleted file mode 120000 index 144436eac59..00000000000 --- a/pkgs/sagemath-environment/setup.py +++ /dev/null @@ -1 +0,0 @@ -../sagemath-objects/setup.py \ No newline at end of file diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index 0ccc2aeccfc..cc5d4200157 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -7,6 +7,7 @@ # pkgs/sagemath-environment/.tox/python/bin/python # [tox] +isolated_build = True [testenv] deps = -rrequirements.txt From 90790bcb5bbbb207de406921880cca43e1d23e23 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Dec 2021 19:28:53 -0800 Subject: [PATCH 079/338] pkgs/sagemath-environment/tox.ini: Test all_features --- pkgs/sagemath-environment/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index cc5d4200157..e083ba6ea19 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -25,4 +25,4 @@ whitelist_externals = commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.features' + python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name))' From 7fafb00a8366cb0570882f93eb980766b8def133 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Dec 2021 19:32:00 -0800 Subject: [PATCH 080/338] src/sage/features/{csdp,lrs}.py: Move imports from sage.cpython inside method --- src/sage/features/csdp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/features/csdp.py b/src/sage/features/csdp.py index d08c0089cf9..e86ec415d09 100644 --- a/src/sage/features/csdp.py +++ b/src/sage/features/csdp.py @@ -6,7 +6,6 @@ import os import re import subprocess -from sage.cpython.string import bytes_to_str from . import Executable, FeatureTestResult @@ -44,6 +43,8 @@ def is_functional(self): FeatureTestResult('csdp', True) """ from sage.misc.temporary_file import tmp_filename + from sage.cpython.string import bytes_to_str + tf_name = tmp_filename() with open(tf_name, 'wb') as tf: tf.write("2\n1\n1 1".encode()) From c9b3e5e9a309723e66328b80f8d95ad0ed765ca4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Dec 2021 19:42:51 -0800 Subject: [PATCH 081/338] pkgs/sagemath-environment/tox.ini: Also test import sage.misc.package --- pkgs/sagemath-environment/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index e083ba6ea19..f28e260b196 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -25,4 +25,4 @@ whitelist_externals = commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name))' + python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name)); import sage.misc.package' From a40f15db40e82492dcbaa1de9c48d185bf312419 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Dec 2021 21:13:05 -0800 Subject: [PATCH 082/338] pkgs/sagemath-repl, build/pkgs/sagemath_repl: New --- .gitignore | 6 ++ build/pkgs/sagemath_repl/SPKG.rst | 1 + build/pkgs/sagemath_repl/bootstrap | 1 + build/pkgs/sagemath_repl/dependencies | 1 + build/pkgs/sagemath_repl/package-version.txt | 1 + build/pkgs/sagemath_repl/spkg-install | 1 + build/pkgs/sagemath_repl/spkg-src | 21 ++++++ build/pkgs/sagemath_repl/src | 1 + build/pkgs/sagemath_repl/type | 1 + pkgs/sagemath-repl/MANIFEST.in | 8 +++ pkgs/sagemath-repl/README.rst | 23 ++++++ pkgs/sagemath-repl/VERSION.txt | 1 + pkgs/sagemath-repl/bin | 1 + pkgs/sagemath-repl/pyproject.toml.m4 | 8 +++ pkgs/sagemath-repl/requirements.txt.m4 | 0 pkgs/sagemath-repl/sage | 1 + pkgs/sagemath-repl/setup.cfg.m4 | 76 ++++++++++++++++++++ pkgs/sagemath-repl/tox.ini | 30 ++++++++ 18 files changed, 182 insertions(+) create mode 120000 build/pkgs/sagemath_repl/SPKG.rst create mode 120000 build/pkgs/sagemath_repl/bootstrap create mode 120000 build/pkgs/sagemath_repl/dependencies create mode 120000 build/pkgs/sagemath_repl/package-version.txt create mode 120000 build/pkgs/sagemath_repl/spkg-install create mode 100755 build/pkgs/sagemath_repl/spkg-src create mode 120000 build/pkgs/sagemath_repl/src create mode 100644 build/pkgs/sagemath_repl/type create mode 100644 pkgs/sagemath-repl/MANIFEST.in create mode 100644 pkgs/sagemath-repl/README.rst create mode 120000 pkgs/sagemath-repl/VERSION.txt create mode 120000 pkgs/sagemath-repl/bin create mode 100644 pkgs/sagemath-repl/pyproject.toml.m4 create mode 100644 pkgs/sagemath-repl/requirements.txt.m4 create mode 120000 pkgs/sagemath-repl/sage create mode 100644 pkgs/sagemath-repl/setup.cfg.m4 create mode 100644 pkgs/sagemath-repl/tox.ini diff --git a/.gitignore b/.gitignore index 942a4388eeb..4778898b367 100644 --- a/.gitignore +++ b/.gitignore @@ -165,10 +165,16 @@ build/bin/sage-build-env-config /pkgs/sagemath-objects/setup.cfg /pkgs/sagemath-categories/setup.cfg +/pkgs/sagemath-environment/setup.cfg +/pkgs/sagemath-repl/setup.cfg /pkgs/sagemath-objects/pyproject.toml /pkgs/sagemath-categories/pyproject.toml +/pkgs/sagemath-environment/pyproject.toml +/pkgs/sagemath-repl/pyproject.toml /pkgs/sagemath-objects/requirements.txt /pkgs/sagemath-categories/requirements.txt +/pkgs/sagemath-environment/requirements.txt +/pkgs/sagemath-repl/requirements.txt /pkgs/sagemath-categories/MANIFEST.in # same for old locations - before Trac #31577 diff --git a/build/pkgs/sagemath_repl/SPKG.rst b/build/pkgs/sagemath_repl/SPKG.rst new file mode 120000 index 00000000000..b4545b4bda6 --- /dev/null +++ b/build/pkgs/sagemath_repl/SPKG.rst @@ -0,0 +1 @@ +src/README.rst \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/bootstrap b/build/pkgs/sagemath_repl/bootstrap new file mode 120000 index 00000000000..40542346a4e --- /dev/null +++ b/build/pkgs/sagemath_repl/bootstrap @@ -0,0 +1 @@ +../sagelib/bootstrap \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/dependencies b/build/pkgs/sagemath_repl/dependencies new file mode 120000 index 00000000000..55c209e6418 --- /dev/null +++ b/build/pkgs/sagemath_repl/dependencies @@ -0,0 +1 @@ +../sagemath_objects/dependencies \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/package-version.txt b/build/pkgs/sagemath_repl/package-version.txt new file mode 120000 index 00000000000..cf10fe4b4e4 --- /dev/null +++ b/build/pkgs/sagemath_repl/package-version.txt @@ -0,0 +1 @@ +../sagelib/package-version.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/spkg-install b/build/pkgs/sagemath_repl/spkg-install new file mode 120000 index 00000000000..e60fac9ffa1 --- /dev/null +++ b/build/pkgs/sagemath_repl/spkg-install @@ -0,0 +1 @@ +../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/spkg-src b/build/pkgs/sagemath_repl/spkg-src new file mode 100755 index 00000000000..327d51651b9 --- /dev/null +++ b/build/pkgs/sagemath_repl/spkg-src @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Script to prepare an sdist tarball for sagemath-categories +# This script is not used during build. +# +# HOW TO MAKE THE TARBALL: +# ./sage --sh build/pkgs/sagemath_categories/spkg-src + +if [ -z "$SAGE_ROOT" ] ; then + echo >&2 "Error - SAGE_ROOT undefined ... exiting" + echo >&2 "Maybe run 'sage -sh'?" + exit 1 +fi + +# Exit on failure +set -e + +cd build/pkgs/sagemath_categories + +cd src +python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_repl/src b/build/pkgs/sagemath_repl/src new file mode 120000 index 00000000000..87bcc53def5 --- /dev/null +++ b/build/pkgs/sagemath_repl/src @@ -0,0 +1 @@ +../../../pkgs/sagemath-repl \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/type b/build/pkgs/sagemath_repl/type new file mode 100644 index 00000000000..9839eb20815 --- /dev/null +++ b/build/pkgs/sagemath_repl/type @@ -0,0 +1 @@ +experimental diff --git a/pkgs/sagemath-repl/MANIFEST.in b/pkgs/sagemath-repl/MANIFEST.in new file mode 100644 index 00000000000..2def3da597b --- /dev/null +++ b/pkgs/sagemath-repl/MANIFEST.in @@ -0,0 +1,8 @@ +prune sage + +graft sage/doctest +graft sage/repl + +include VERSION.txt + +global-exclude *.py[co] diff --git a/pkgs/sagemath-repl/README.rst b/pkgs/sagemath-repl/README.rst new file mode 100644 index 00000000000..c240fbc1bac --- /dev/null +++ b/pkgs/sagemath-repl/README.rst @@ -0,0 +1,23 @@ +=================================================================================== + Sage: Open Source Mathematics Software: IPython kernel, Sage preparser, doctester +=================================================================================== + +About SageMath +-------------- + + "Creating a Viable Open Source Alternative to + Magma, Maple, Mathematica, and MATLAB" + + Copyright (C) 2005-2020 The Sage Development Team + + https://www.sagemath.org + +SageMath fully supports all major Linux distributions, recent versions of macOS, and Windows (using Cygwin or Windows Subsystem for Linux). + +The traditional and recommended way to install SageMath is from source via Sage-the-distribution (https://www.sagemath.org/download-source.html). Sage-the-distribution first builds a large number of open source packages from source (unless it finds suitable versions installed in the system) and then installs the Sage Library (sagelib, implemented in Python and Cython). + + +About this experimental pip-installable source distribution +----------------------------------------------------------- + +This pip-installable source distribution `sagemath-repl` is an experimental distribution of a small part of the Sage Library. Use at your own risk. It provides a small, fundamental subset of the modules of the Sage library ("sagelib", `sagemath-standard`), providing the IPython kernel, Sage preparser, and doctester. diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt new file mode 120000 index 00000000000..43f4773d7de --- /dev/null +++ b/pkgs/sagemath-repl/VERSION.txt @@ -0,0 +1 @@ +../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-repl/bin b/pkgs/sagemath-repl/bin new file mode 120000 index 00000000000..2f8b9b30ee7 --- /dev/null +++ b/pkgs/sagemath-repl/bin @@ -0,0 +1 @@ +../../src/bin \ No newline at end of file diff --git a/pkgs/sagemath-repl/pyproject.toml.m4 b/pkgs/sagemath-repl/pyproject.toml.m4 new file mode 100644 index 00000000000..686515673fc --- /dev/null +++ b/pkgs/sagemath-repl/pyproject.toml.m4 @@ -0,0 +1,8 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = [ + esyscmd(`sage-get-system-packages install-requires-toml \ + setuptools \ + wheel \ + ')] +build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-repl/requirements.txt.m4 b/pkgs/sagemath-repl/requirements.txt.m4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/sagemath-repl/sage b/pkgs/sagemath-repl/sage new file mode 120000 index 00000000000..e0da5daa6f2 --- /dev/null +++ b/pkgs/sagemath-repl/sage @@ -0,0 +1 @@ +../../src/sage \ No newline at end of file diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 new file mode 100644 index 00000000000..8236fa2b1c9 --- /dev/null +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -0,0 +1,76 @@ +# -*- conf-unix -*- +[metadata] +name = sagemath-repl +version = file: VERSION.txt +description = Sage: Open Source Mathematics Software: System and software environment +long_description = file: README.rst +long_description_content_type = text/x-rst +license = GNU General Public License (GPL) v2 or later +author = The Sage Developers +author_email = sage-support@googlegroups.com +url = https://www.sagemath.org + +classifiers = + Development Status :: 6 - Mature + Intended Audience :: Education + Intended Audience :: Science/Research + License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + Topic :: Scientific/Engineering :: Mathematics + +[options] +python_requires = >=3.7, <3.10 +install_requires = + esyscmd(`sage-get-system-packages install-requires \ + sagemath_objects \ + sagemath_environment \ + | sed "2,\$s/^/ /;"')dnl + +py_modules = + +packages = + sage.doctest + sage.repl + +scripts = + # The sage script + bin/sage + # Other scripts that should be in the path also for OS packaging of sage: + bin/sage-eval + # Included because it is useful for doctesting/coverage testing user scripts too: + bin/sage-runtests + bin/sage-fixdoctests + bin/sage-coverage + # Helper scripts invoked by sage script + # (they would actually belong to something like libexec) + bin/sage-cachegrind + bin/sage-callgrind + bin/sage-massif + bin/sage-omega + bin/sage-valgrind + bin/sage-venv-config + bin/sage-version.sh + bin/sage-cleaner + # Uncategorized scripts in alphabetical order + bin/sage-env + # sage-env-config -- installed by sage_conf + # sage-env-config.in -- not to be installed + bin/sage-gdb-commands + bin/sage-inline-fortran + bin/sage-ipynb2rst + bin/sage-ipython + bin/sage-native-execute + bin/sage-notebook + bin/sage-num-threads.py + bin/sage-open + bin/sage-preparse + bin/sage-python + bin/sage-run + bin/sage-run-cython + bin/sage-startuptime.py diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini new file mode 100644 index 00000000000..3bb7ce27214 --- /dev/null +++ b/pkgs/sagemath-repl/tox.ini @@ -0,0 +1,30 @@ +# To build and test in the tox environment: +# +# ./sage -sh -c '(cd pkgs/sagemath-repl && tox -v -v)' +# +# To test interactively: +# +# pkgs/sagemath-repl/.tox/python/bin/python +# +[tox] +isolated_build = True + +[testenv] +deps = -rrequirements.txt + +setenv = + # Sage scripts such as sage-runtests like to use $HOME/.sage + HOME={envdir} + +passenv = + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + +whitelist_externals = + bash + +commands = + # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. + python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' + + bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_objects --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest || echo "(lots of doctest failures are expected)"' From 31a07dcf290cfd090595194a0b6ff4d7a5cfc9fe Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 00:16:46 -0800 Subject: [PATCH 083/338] Makefile (pypi-sdists): Add sagemath_environment, sagemath_repl --- Makefile | 2 ++ build/pkgs/sagemath_environment/spkg-src | 2 +- build/pkgs/sagemath_repl/spkg-src | 2 +- pkgs/sagemath-environment/setup.py | 3 +++ pkgs/sagemath-repl/setup.py | 3 +++ 5 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 pkgs/sagemath-environment/setup.py create mode 100644 pkgs/sagemath-repl/setup.py diff --git a/Makefile b/Makefile index 9e8955a07f6..fd60446336f 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,8 @@ pypi-sdists: sage_setup ./sage --sh build/pkgs/sagelib/spkg-src ./sage --sh build/pkgs/sagemath_objects/spkg-src ./sage --sh build/pkgs/sagemath_categories/spkg-src + ./sage --sh build/pkgs/sagemath_environment/spkg-src + ./sage --sh build/pkgs/sagemath_repl/spkg-src @echo "Built sdists are in upstream/" # ssl: build Sage, and also install pyOpenSSL. This is necessary for diff --git a/build/pkgs/sagemath_environment/spkg-src b/build/pkgs/sagemath_environment/spkg-src index 327d51651b9..4e2b7503da2 100755 --- a/build/pkgs/sagemath_environment/spkg-src +++ b/build/pkgs/sagemath_environment/spkg-src @@ -15,7 +15,7 @@ fi # Exit on failure set -e -cd build/pkgs/sagemath_categories +cd build/pkgs/sagemath_environment cd src python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_repl/spkg-src b/build/pkgs/sagemath_repl/spkg-src index 327d51651b9..b20ea463784 100755 --- a/build/pkgs/sagemath_repl/spkg-src +++ b/build/pkgs/sagemath_repl/spkg-src @@ -15,7 +15,7 @@ fi # Exit on failure set -e -cd build/pkgs/sagemath_categories +cd build/pkgs/sagemath_repl cd src python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" diff --git a/pkgs/sagemath-environment/setup.py b/pkgs/sagemath-environment/setup.py new file mode 100644 index 00000000000..606849326a4 --- /dev/null +++ b/pkgs/sagemath-environment/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/pkgs/sagemath-repl/setup.py b/pkgs/sagemath-repl/setup.py new file mode 100644 index 00000000000..606849326a4 --- /dev/null +++ b/pkgs/sagemath-repl/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() From fc61b57aa4c74421f369cdae04bd978afe63fd05 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 00:50:41 -0800 Subject: [PATCH 084/338] build/pkgs/sagemath_environment/install-requires.txt: New --- build/pkgs/sagemath_environment/install-requires.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/pkgs/sagemath_environment/install-requires.txt diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt new file mode 100644 index 00000000000..de8dccbaf67 --- /dev/null +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -0,0 +1 @@ +sagemath-environment From f02794fb84417cdf056269a659465c48b5f8e59d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 01:01:18 -0800 Subject: [PATCH 085/338] pkgs/sagemath-repl/setup.cfg.m4: Add ipython --- pkgs/sagemath-repl/setup.cfg.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 8236fa2b1c9..2c97c4adfc3 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -30,6 +30,7 @@ install_requires = esyscmd(`sage-get-system-packages install-requires \ sagemath_objects \ sagemath_environment \ + ipython \ | sed "2,\$s/^/ /;"')dnl py_modules = From 05dda08447d953c865662c32fc188e0089482f00 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 11:29:30 -0800 Subject: [PATCH 086/338] pkgs/sagemath-environment/setup.cfg.m4: Add sage_conf as extras_require --- pkgs/sagemath-environment/setup.cfg.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index bbbbca19802..4cf2ad6127e 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -38,3 +38,7 @@ py_modules = packages = sage.features + +[options.extras_require] +# sage.env can optionally use sage_conf +sage_conf = esyscmd(`sage-get-system-packages install-requires sage_conf') From 40dfac6bf23fdce6471c8012c3c8dc92637089d4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 11:29:50 -0800 Subject: [PATCH 087/338] src/doc/en/developer/packaging_sage_library.rst: Add sage_conf, sagemath-environment in diagram --- .../en/developer/packaging_sage_library.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index 7f2ce9c9057..c206e512475 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -459,12 +459,17 @@ Hierarchy of distribution packages def node(label, pos): return text(label, (3*pos[0],2*pos[1]), background_color='pink', color='black') - def edge(start, end): - return arrow((3*start[0],2*start[1]+.5),(3*end[0],2*end[1]-.5), arrowsize=2) + def edge(start, end, **kwds): + return arrow((3*start[0],2*start[1]+.5),(3*end[0],2*end[1]-.5), arrowsize=2, **kwds) + def extras_require(start, end): + return edge(start, end, linestyle='dashed') g = Graphics() - g += (node("sagemath-objects", (1,0)) + edge((1,0),(1,1))) - g += (node("sagemath-categories", (1,1)) + edge((1,1),(0,2)) + - edge((1,1),(1,2)) + edge((1,1),(2,2))) + g += (node("sage_conf", (0.5,0)) + extras_require((0.5,0),(0.5,1))) + g += (node("sagemath-objects", (1.5,0)) + edge((1.5,0),(1.5,1))) + g += (node("sagemath-environment", (0.5,1)) + + edge((0.5,1),(0,2)) + edge((0.5,1),(1,2)) + edge((0.5,1),(2,2))) + g += (node("sagemath-categories", (1.5,1)) + edge((1.5,1),(0,2)) + + edge((1.5,1),(1,2)) + edge((1.5,1),(2,2))) g += (node("sagemath-graphs", (0,2)) + node("sagemath-polyhedra", (1,2)) + node("sagemath-singular", (2,2)) + edge((0,2),(0,3)) + edge((0,2),(1,3)) + edge((1,2),(1,3)) + edge((2,2),(2,3))) g += (node("sagemath-tdlib", (0,3)) + node("sagemath-standard-no-symbolics", (1,3)) + node("sagemath-symbolics", (2,3)) + @@ -473,6 +478,10 @@ Hierarchy of distribution packages sphinx_plot(g, figsize=(8, 4), axes=False) +Solid arrows indicate ``install_requires``, i.e., a declared runtime dependency. +Dashed arrows indicate ``extras_require``, i.e., a declared optional runtime dependency. + + Testing distribution packages ============================= From 180f51bd6b1a4372a685bf2a660f7850007ed82f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 13:26:57 -0800 Subject: [PATCH 088/338] build/pkgs/sagemath_{objects,categories}/install-requires.txt: Add version constraints --- build/pkgs/sagemath_categories/install-requires.txt | 1 + build/pkgs/sagemath_objects/install-requires.txt | 1 + 2 files changed, 2 insertions(+) create mode 100644 build/pkgs/sagemath_categories/install-requires.txt create mode 100644 build/pkgs/sagemath_objects/install-requires.txt diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt new file mode 100644 index 00000000000..e35667f8201 --- /dev/null +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -0,0 +1 @@ +sagemath-categories ~= 9.5b6 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt new file mode 100644 index 00000000000..a37f924ca11 --- /dev/null +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -0,0 +1 @@ +sagemath-objects ~= 9.5b6 From ea9dcdbf9bfc19364eb2d88ffca936ca9cfd3c80 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 13:49:44 -0800 Subject: [PATCH 089/338] src/sage/all__sagemath_repl.py: New --- pkgs/sagemath-repl/MANIFEST.in | 2 ++ pkgs/sagemath-repl/setup.cfg.m4 | 1 + pkgs/sagemath-repl/tox.ini | 2 +- src/sage/all__sagemath_repl.py | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/sage/all__sagemath_repl.py diff --git a/pkgs/sagemath-repl/MANIFEST.in b/pkgs/sagemath-repl/MANIFEST.in index 2def3da597b..ad8213ea383 100644 --- a/pkgs/sagemath-repl/MANIFEST.in +++ b/pkgs/sagemath-repl/MANIFEST.in @@ -1,5 +1,7 @@ prune sage +global-include all__sagemath_repl.py + graft sage/doctest graft sage/repl diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 2c97c4adfc3..5a854e540c7 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -34,6 +34,7 @@ install_requires = | sed "2,\$s/^/ /;"')dnl py_modules = + sage.all__sagemath_repl packages = sage.doctest diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini index 3bb7ce27214..e91057497f3 100644 --- a/pkgs/sagemath-repl/tox.ini +++ b/pkgs/sagemath-repl/tox.ini @@ -27,4 +27,4 @@ commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' - bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_objects --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest || echo "(lots of doctest failures are expected)"' + bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_repl --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest || echo "(lots of doctest failures are expected)"' diff --git a/src/sage/all__sagemath_repl.py b/src/sage/all__sagemath_repl.py new file mode 100644 index 00000000000..ac70dfbb443 --- /dev/null +++ b/src/sage/all__sagemath_repl.py @@ -0,0 +1,10 @@ +from .all__sagemath_objects import * + +# FIXME: all.py should import from here and remove these imports. +from sage.doctest.all import * +from sage.repl.all import * + +# For doctesting. These are overwritten later + +Integer = int +RealNumber = float From 5e94be85b12966f00e41b025b3dc74d8e91191ef Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 13:59:22 -0800 Subject: [PATCH 090/338] src/sage/doctest/forker.py: Mark a doctest # optional - sage.symbolic --- src/sage/doctest/forker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index 39967cfbbe6..c6def71f9f0 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -2116,7 +2116,7 @@ def run(self): TESTS:: - sage: run_doctests(sage.symbolic.units) # indirect doctest + sage: run_doctests(sage.symbolic.units) # indirect doctest # optional - sage.symbolic Running doctests with ID ... Doctesting 1 file. sage -t .../sage/symbolic/units.py From b9e6d8d91c918bfb8231aaa4a83d77e22501e259 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 14:12:52 -0800 Subject: [PATCH 091/338] src/sage/repl/rich_output/pretty_print.py: Do not fail if sage.plot, sage.graphs cannot be imported --- src/sage/repl/rich_output/pretty_print.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/sage/repl/rich_output/pretty_print.py b/src/sage/repl/rich_output/pretty_print.py index f45ca3d126b..ebf48d3c662 100644 --- a/src/sage/repl/rich_output/pretty_print.py +++ b/src/sage/repl/rich_output/pretty_print.py @@ -166,8 +166,14 @@ def pretty_print(self): ... TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels' """ - from sage.plot.plot import Graphics - from sage.graphs.graph import GenericGraph + try: + from sage.plot.plot import Graphics + except ImportError: + Graphics = () + try: + from sage.graphs.graph import GenericGraph + except ImportError: + GenericGraph = () if self.is_homogeneous(GenericGraph): args = self._concatenate_graphs() kwds = dict() @@ -324,7 +330,10 @@ def show(*args, **kwds): sage: show(1) 1 """ - from sage.graphs.generic_graph import GenericGraph + try: + from sage.graphs.generic_graph import GenericGraph + except ImportError: + GenericGraph = () if len(args) == 1 and isinstance(args[0], GenericGraph): # Graphs are special, they ride the short bus... # Please, somebody help me get rid of this! #18289 From 88e18740969c91ca64eb5eee9705b13158422354 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 14:38:03 -0800 Subject: [PATCH 092/338] pkgs/sagemath-environment/MANIFEST.in: Add sage/misc/temporary_file.py --- pkgs/sagemath-environment/MANIFEST.in | 1 + pkgs/sagemath-environment/setup.cfg.m4 | 1 + 2 files changed, 2 insertions(+) diff --git a/pkgs/sagemath-environment/MANIFEST.in b/pkgs/sagemath-environment/MANIFEST.in index 2a62340508e..875a183b746 100644 --- a/pkgs/sagemath-environment/MANIFEST.in +++ b/pkgs/sagemath-environment/MANIFEST.in @@ -2,6 +2,7 @@ prune sage include sage/env.py include sage/version.py include sage/misc/package.py +include sage/misc/temporary_file.py include sage/misc/viewer.py graft sage/features diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index 4cf2ad6127e..ccaa48e315b 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -34,6 +34,7 @@ py_modules = sage.env sage.version sage.misc.package + sage.misc.temporary_file sage.misc.viewer packages = From c3ae43be1829fd9939ce9b4cd2e710577ffb540b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 14:47:32 -0800 Subject: [PATCH 093/338] src/sage, src/sage/misc: Add all__sagemath_environment.py --- pkgs/sagemath-environment/MANIFEST.in | 3 +++ pkgs/sagemath-environment/setup.cfg.m4 | 2 ++ src/sage/all.py | 2 +- src/sage/all__sagemath_environment.py | 3 +++ src/sage/all__sagemath_repl.py | 1 + src/sage/misc/all.py | 3 +-- src/sage/misc/all__sagemath_environment.py | 1 + 7 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 src/sage/all__sagemath_environment.py create mode 100644 src/sage/misc/all__sagemath_environment.py diff --git a/pkgs/sagemath-environment/MANIFEST.in b/pkgs/sagemath-environment/MANIFEST.in index 875a183b746..2b0fe25f371 100644 --- a/pkgs/sagemath-environment/MANIFEST.in +++ b/pkgs/sagemath-environment/MANIFEST.in @@ -1,4 +1,7 @@ prune sage + +global-include all__sagemath_environment.py + include sage/env.py include sage/version.py include sage/misc/package.py diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index ccaa48e315b..0957cbc9fd1 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -31,8 +31,10 @@ install_requires = | sed "2,\$s/^/ /;"')dnl py_modules = + sage.all__sagemath_environment sage.env sage.version + sage.misc.all__sagemath_environment sage.misc.package sage.misc.temporary_file sage.misc.viewer diff --git a/src/sage/all.py b/src/sage/all.py index 584c0614181..8c2514ecd96 100644 --- a/src/sage/all.py +++ b/src/sage/all.py @@ -103,7 +103,7 @@ ################ end setup warnings ############################### -from sage.env import SAGE_ROOT, SAGE_SRC, SAGE_DOC_SRC, SAGE_LOCAL, DOT_SAGE, SAGE_ENV +from .all__sagemath_environment import * ################################################################### diff --git a/src/sage/all__sagemath_environment.py b/src/sage/all__sagemath_environment.py new file mode 100644 index 00000000000..f68c74ab115 --- /dev/null +++ b/src/sage/all__sagemath_environment.py @@ -0,0 +1,3 @@ +from sage.env import SAGE_ROOT, SAGE_SRC, SAGE_DOC_SRC, SAGE_LOCAL, DOT_SAGE, SAGE_ENV + +from sage.misc.all__sagemath_environment import * diff --git a/src/sage/all__sagemath_repl.py b/src/sage/all__sagemath_repl.py index ac70dfbb443..40ffca002ea 100644 --- a/src/sage/all__sagemath_repl.py +++ b/src/sage/all__sagemath_repl.py @@ -1,4 +1,5 @@ from .all__sagemath_objects import * +from .all__sagemath_environment import * # FIXME: all.py should import from here and remove these imports. from sage.doctest.all import * diff --git a/src/sage/misc/all.py b/src/sage/misc/all.py index 56d66f0f5f0..3a19db0962e 100644 --- a/src/sage/misc/all.py +++ b/src/sage/misc/all.py @@ -2,6 +2,7 @@ from .lazy_import import lazy_import from .all__sagemath_objects import * +from .all__sagemath_environment import * from .misc import (BackslashOperator, cputime, @@ -17,8 +18,6 @@ from .banner import version, banner -from .temporary_file import tmp_dir, tmp_filename - from .dev_tools import runsnake, import_statements from .html import html, pretty_print_default diff --git a/src/sage/misc/all__sagemath_environment.py b/src/sage/misc/all__sagemath_environment.py new file mode 100644 index 00000000000..f25faa1289d --- /dev/null +++ b/src/sage/misc/all__sagemath_environment.py @@ -0,0 +1 @@ +from .temporary_file import tmp_dir, tmp_filename From 67022fb798d169b1dcaac7faa35a1bd8ba042221 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 17:12:29 -0800 Subject: [PATCH 094/338] src/sage/repl/rich_output/pretty_print.py: Mark doctests # optional - sage.graphs, sage.plot, sage.symbolic, sage.combinat --- src/sage/repl/rich_output/pretty_print.py | 38 +++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/sage/repl/rich_output/pretty_print.py b/src/sage/repl/rich_output/pretty_print.py index ebf48d3c662..f4a6a46cfd9 100644 --- a/src/sage/repl/rich_output/pretty_print.py +++ b/src/sage/repl/rich_output/pretty_print.py @@ -117,10 +117,10 @@ def _concatenate_graphs(self): EXAMPLES:: sage: from sage.repl.rich_output.pretty_print import SequencePrettyPrinter - sage: plt = SequencePrettyPrinter(*list(graphs(3)))._concatenate_graphs() - sage: type(plt) + sage: plt = SequencePrettyPrinter(*list(graphs(3)))._concatenate_graphs() # optional - sage.graphs # optional - sage.plot + sage: type(plt) # optional - sage.graphs # optional - sage.plot - sage: plt + sage: plt # optional - sage.graphs # optional - sage.plot Graphics Array of size 1 x 4 """ import sage.graphs.graph_list as graphs_list @@ -137,10 +137,10 @@ def _concatenate_graphics(self): EXAMPLES:: sage: from sage.repl.rich_output.pretty_print import SequencePrettyPrinter - sage: ga = SequencePrettyPrinter(*[Graphics()]*5)._concatenate_graphics() - sage: type(ga) + sage: ga = SequencePrettyPrinter(*[Graphics()]*5)._concatenate_graphics() # optional - sage.plot + sage: type(ga) # optional - sage.plot - sage: ga.nrows(), ga.ncols() + sage: ga.nrows(), ga.ncols() # optional - sage.plot (2, 4) """ from sage.plot.plot import graphics_array @@ -159,9 +159,9 @@ def pretty_print(self): The keyword arguments are only used the first time graphics output is generated:: - sage: seq = SequencePrettyPrinter(Graph(), Graph(), edge_labels=True) - sage: seq.pretty_print() # does not pass edge_labels to graphics object - sage: seq._concatenate_graphs().show(edge_labels=True) + sage: seq = SequencePrettyPrinter(Graph(), Graph(), edge_labels=True) # optional - sage.plot + sage: seq.pretty_print() # does not pass edge_labels to graphics object # optional - sage.plot + sage: seq._concatenate_graphs().show(edge_labels=True) # optional - sage.plot Traceback (most recent call last): ... TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels' @@ -243,13 +243,13 @@ def pretty_print(*args, **kwds): For text-based backends, the default text display preference is to output plain text which is usually the same as using ``print()``:: - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic x^2/(x + 1) - sage: t = BinaryTrees(3).first() - sage: pretty_print(t) + sage: t = BinaryTrees(3).first() # optional - sage.combinat + sage: pretty_print(t) # optional - sage.combinat [., [., [., .]]] - sage: print(t) + sage: print(t) # optional - sage.combinat [., [., [., .]]] TESTS:: @@ -263,7 +263,7 @@ def pretty_print(*args, **kwds): The following illustrates a possible use-case:: sage: %display ascii_art # not tested - sage: for t in BinaryTrees(3)[:3]: + sage: for t in BinaryTrees(3)[:3]: # optional - sage.combinat ....: pretty_print(t) o \ @@ -279,7 +279,7 @@ def pretty_print(*args, **kwds): / \ o o - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic 2 x ----- @@ -293,10 +293,10 @@ def pretty_print(*args, **kwds): :: - sage: plt = plot(sin) - sage: pretty_print(plt) # graphics output - sage: pretty_print(plt, plt) # graphics output - sage: pretty_print(ZZ, 123, plt) + sage: plt = plot(sin) # optional - sage.symbolic # optional - sage.plot + sage: pretty_print(plt) # graphics output # optional - sage.symbolic # optional - sage.plot + sage: pretty_print(plt, plt) # graphics output # optional - sage.symbolic # optional - sage.plot + sage: pretty_print(ZZ, 123, plt) # optional - sage.symbolic # optional - sage.plot Integer Ring 123 Graphics object consisting of 1 graphics primitive """ dm = get_display_manager() From cb76042cd36b0585fbb13e6a3e2e10b32872472a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 20:16:44 -0800 Subject: [PATCH 095/338] pkgs/sagemath-repl/setup.cfg.m4: Add package_data --- pkgs/sagemath-repl/setup.cfg.m4 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 5a854e540c7..6f2a1d49d96 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -76,3 +76,11 @@ scripts = bin/sage-run bin/sage-run-cython bin/sage-startuptime.py + +[options.package_data] + +sage.doctest = + tests/* + +sage.repl.rich_output = + example* From b705ee797a3482b5ca800164e6e7a7434dfabb86 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 6 Dec 2021 11:28:43 -0800 Subject: [PATCH 096/338] pkgs/sagemath-repl/setup.cfg.m4: List subpackages --- pkgs/sagemath-repl/setup.cfg.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 6f2a1d49d96..be2c97dd92b 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -39,6 +39,9 @@ py_modules = packages = sage.doctest sage.repl + sage.repl.display + sage.repl.ipython_kernel + sage.repl.rich_output scripts = # The sage script From d4042bfc137f0f85b15c3238fd23223ec47111c4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 6 Dec 2021 18:11:02 -0800 Subject: [PATCH 097/338] pkgs/sagemath-repl/setup.cfg.m4 (install_requires): Add ipwidgets --- pkgs/sagemath-repl/setup.cfg.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index be2c97dd92b..8fc27039531 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -31,6 +31,7 @@ install_requires = sagemath_objects \ sagemath_environment \ ipython \ + ipywidgets \ | sed "2,\$s/^/ /;"')dnl py_modules = From c8542db0b6cd685f6cf26c61344a746afe589647 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 6 Dec 2021 18:24:28 -0800 Subject: [PATCH 098/338] src/sage/repl/rich_output/pretty_print.py: Add more # optional --- src/sage/repl/rich_output/pretty_print.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/repl/rich_output/pretty_print.py b/src/sage/repl/rich_output/pretty_print.py index f4a6a46cfd9..154f17b8290 100644 --- a/src/sage/repl/rich_output/pretty_print.py +++ b/src/sage/repl/rich_output/pretty_print.py @@ -12,7 +12,7 @@ sage: pretty_print(1, 2, 3) 1 2 3 - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic x^2/(x + 1) TESTS:: @@ -23,7 +23,7 @@ EXAMPLES:: sage: %display ascii_art # not tested - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic 2 x ----- @@ -41,9 +41,9 @@ :func:`pretty_print` does not print anything and just shows the graphics instead:: - sage: print(plot(sin)) + sage: print(plot(sin)) # optional - sage.symbolic # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: pretty_print(plot(sin)) + sage: pretty_print(plot(sin)) # optional - sage.symbolic # optional - sage.plot """ # **************************************************************************** From c2d70ea5cfa9a238f9a035c1f6578d162dff400e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 6 Dec 2021 18:52:48 -0800 Subject: [PATCH 099/338] src/sage/doctest/forker.py: Mark doctests # optional - sage.symbolic --- src/sage/doctest/forker.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index c6def71f9f0..52e73cf6151 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -131,10 +131,10 @@ def init_sage(controller=None): Check that SymPy equation pretty printer is limited in doctest mode to default width (80 chars):: - sage: from sympy import sympify - sage: from sympy.printing.pretty.pretty import PrettyPrinter - sage: s = sympify('+x^'.join(str(i) for i in range(30))) - sage: print(PrettyPrinter(settings={'wrap_line':True}).doprint(s)) + sage: from sympy import sympify # optional - sage.symbolic + sage: from sympy.printing.pretty.pretty import PrettyPrinter # optional - sage.symbolic + sage: s = sympify('+x^'.join(str(i) for i in range(30))) # optional - sage.symbolic + sage: print(PrettyPrinter(settings={'wrap_line': True}).doprint(s)) # optional - sage.symbolic 29 28 27 26 25 24 23 22 21 20 19 18 17 x + x + x + x + x + x + x + x + x + x + x + x + x + From 89d7b08e0da245002fe6d6064cecd637d6beec8d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 10 Dec 2021 23:45:19 -0800 Subject: [PATCH 100/338] pkgs/sagemath-repl: Include sage.misc.sage_input, sage.misc.sage_eval --- pkgs/sagemath-repl/MANIFEST.in | 2 ++ pkgs/sagemath-repl/setup.cfg.m4 | 3 +++ pkgs/sagemath-repl/tox.ini | 2 +- src/sage/all__sagemath_repl.py | 1 + src/sage/misc/all.py | 5 +---- src/sage/misc/all__sagemath_repl.py | 3 +++ 6 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 src/sage/misc/all__sagemath_repl.py diff --git a/pkgs/sagemath-repl/MANIFEST.in b/pkgs/sagemath-repl/MANIFEST.in index ad8213ea383..bcbeef379a1 100644 --- a/pkgs/sagemath-repl/MANIFEST.in +++ b/pkgs/sagemath-repl/MANIFEST.in @@ -4,6 +4,8 @@ global-include all__sagemath_repl.py graft sage/doctest graft sage/repl +include sage/misc/sage_input.py +include sage/misc/sage_eval.py include VERSION.txt diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 8fc27039531..5d243dd5bc4 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -36,6 +36,9 @@ install_requires = py_modules = sage.all__sagemath_repl + sage.misc.all__sagemath_repl + sage.misc.sage_input + sage.misc.sage_eval packages = sage.doctest diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini index e91057497f3..0405938001f 100644 --- a/pkgs/sagemath-repl/tox.ini +++ b/pkgs/sagemath-repl/tox.ini @@ -27,4 +27,4 @@ commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' - bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_repl --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest || echo "(lots of doctest failures are expected)"' + bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_repl --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest $SAGE_SRC/sage/misc/sage_input.py $SAGE_SRC/sage/misc/sage_eval.py || echo "(lots of doctest failures are expected)"' diff --git a/src/sage/all__sagemath_repl.py b/src/sage/all__sagemath_repl.py index 40ffca002ea..c9508c15bbe 100644 --- a/src/sage/all__sagemath_repl.py +++ b/src/sage/all__sagemath_repl.py @@ -4,6 +4,7 @@ # FIXME: all.py should import from here and remove these imports. from sage.doctest.all import * from sage.repl.all import * +from sage.misc.all__sagemath_repl import * # For doctesting. These are overwritten later diff --git a/src/sage/misc/all.py b/src/sage/misc/all.py index 3a19db0962e..c5b9120da9a 100644 --- a/src/sage/misc/all.py +++ b/src/sage/misc/all.py @@ -3,6 +3,7 @@ from .all__sagemath_objects import * from .all__sagemath_environment import * +from .all__sagemath_repl import * from .misc import (BackslashOperator, cputime, @@ -63,10 +64,6 @@ from .defaults import (set_default_variable_name, series_precision, set_series_precision) -from .sage_eval import sage_eval, sageobj - -from .sage_input import sage_input - lazy_import("sage.misc.cython", "cython_lambda") lazy_import("sage.misc.cython", "cython_compile", "cython") diff --git a/src/sage/misc/all__sagemath_repl.py b/src/sage/misc/all__sagemath_repl.py new file mode 100644 index 00000000000..f5891ff1242 --- /dev/null +++ b/src/sage/misc/all__sagemath_repl.py @@ -0,0 +1,3 @@ +from .sage_eval import sage_eval, sageobj + +from .sage_input import sage_input From 5a13e76bc19639532443f61a353ce388acf3277d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Dec 2021 20:09:54 -0800 Subject: [PATCH 101/338] src/sage/repl/ipython_extension.py: Make import from sage.misc.edit_module lazy --- src/sage/repl/ipython_extension.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py index eb508b067f5..f9ed38b3ef6 100644 --- a/src/sage/repl/ipython_extension.py +++ b/src/sage/repl/ipython_extension.py @@ -427,8 +427,7 @@ def __init__(self, shell=None): self.auto_magics = SageMagics(shell) self.shell.register_magics(self.auto_magics) - import sage.misc.edit_module as edit_module - self.shell.set_hook('editor', edit_module.edit_devel) + self.shell.set_hook('editor', LazyImport("sage.misc.edit_module", "edit_devel")) self.init_inspector() self.init_line_transforms() From 787ddd9bc5cff4be18ea082a453cce4c32d6d471 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Dec 2021 20:10:25 -0800 Subject: [PATCH 102/338] src/sage/repl/ipython_extension.py: Fall back to importing sage.all__sagemath_repl if sage.all is not available --- src/sage/repl/ipython_extension.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py index f9ed38b3ef6..2846df77bef 100644 --- a/src/sage/repl/ipython_extension.py +++ b/src/sage/repl/ipython_extension.py @@ -432,7 +432,10 @@ def __init__(self, shell=None): self.init_inspector() self.init_line_transforms() - import sage.all # until sage's import hell is fixed + try: + import sage.all # until sage's import hell is fixed + except ImportError: + import sage.all__sagemath_repl self.shell.verbose_quit = True From 26533bd2e85f93e4d047106601bd2c83970fbf41 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Dec 2021 21:38:02 -0800 Subject: [PATCH 103/338] pkgs/sagemath-repl/MANIFEST.in: Add sage.misc.sagedoc --- pkgs/sagemath-repl/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/sagemath-repl/MANIFEST.in b/pkgs/sagemath-repl/MANIFEST.in index bcbeef379a1..9b3b76eaac4 100644 --- a/pkgs/sagemath-repl/MANIFEST.in +++ b/pkgs/sagemath-repl/MANIFEST.in @@ -4,6 +4,7 @@ global-include all__sagemath_repl.py graft sage/doctest graft sage/repl +include sage/misc/sagedoc.py include sage/misc/sage_input.py include sage/misc/sage_eval.py From 1e0fa9c17707092c6446a86d6f5baedb444e9891 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Dec 2021 21:50:20 -0800 Subject: [PATCH 104/338] src/sage/repl/interface_magic.py: Do not fail if sage.interfaces.all is not available --- src/sage/repl/interface_magic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/repl/interface_magic.py b/src/sage/repl/interface_magic.py index a93e1c9e04c..8d4df7c48f5 100644 --- a/src/sage/repl/interface_magic.py +++ b/src/sage/repl/interface_magic.py @@ -92,7 +92,10 @@ def all_iter(cls): sage: next(InterfaceMagic.all_iter()) """ - import sage.interfaces.all + try: + import sage.interfaces.all + except ImportError: + return for name, obj in sage.interfaces.all.__dict__.items(): if isinstance(obj, sage.interfaces.interface.Interface): yield cls(name, obj) From d0fa11db1f5e6ac8020fbd124bc87f46128e5a42 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Dec 2021 22:04:38 -0800 Subject: [PATCH 105/338] src/sage/repl/ipython_extension.py (SageCustomizations): Fall back to sage.all__sagemath_repl if sage.all_cmdline is not available --- src/sage/repl/ipython_extension.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py index 2846df77bef..34e4725d49a 100644 --- a/src/sage/repl/ipython_extension.py +++ b/src/sage/repl/ipython_extension.py @@ -463,7 +463,10 @@ def all_globals(): sage: SageCustomizations.all_globals() """ - from sage import all_cmdline + try: + from sage import all_cmdline + except ImportError: + from sage import all__sagemath_repl as all_cmdline return all_cmdline def init_environment(self): From 3ea20df0377ce1a5f682a3b88ba14d39563579df Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 17 Dec 2021 21:47:57 -0800 Subject: [PATCH 106/338] pkgs/sagemath-environment/MANIFEST.in: Add sage.misc.package_dir --- pkgs/sagemath-environment/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/sagemath-environment/MANIFEST.in b/pkgs/sagemath-environment/MANIFEST.in index 2b0fe25f371..36f8fae1845 100644 --- a/pkgs/sagemath-environment/MANIFEST.in +++ b/pkgs/sagemath-environment/MANIFEST.in @@ -5,6 +5,7 @@ global-include all__sagemath_environment.py include sage/env.py include sage/version.py include sage/misc/package.py +include sage/misc/package_dir.py include sage/misc/temporary_file.py include sage/misc/viewer.py graft sage/features From 437f949274e43e2939c63cacb3fedae8aad583de Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 17 Dec 2021 21:51:58 -0800 Subject: [PATCH 107/338] pkgs/sagemath-{environment,repl}/setup.cfg.m4: Allow python 3.10 --- pkgs/sagemath-environment/setup.cfg.m4 | 2 +- pkgs/sagemath-repl/setup.cfg.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index 0957cbc9fd1..06efc8cd59f 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -25,7 +25,7 @@ classifiers = Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.10 +python_requires = >=3.7, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ | sed "2,\$s/^/ /;"')dnl diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 5d243dd5bc4..8ca7509ab0b 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -25,7 +25,7 @@ classifiers = Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.10 +python_requires = >=3.7, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ sagemath_objects \ From 0921b56dddfb52c85fd6b2676f278f347e2e486c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 4 May 2022 14:02:11 -0700 Subject: [PATCH 108/338] pkgs/sagemath-repl/setup.cfg.m4: Remove sage-native-execute, sage-open --- pkgs/sagemath-repl/setup.cfg.m4 | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 8ca7509ab0b..0f37c549e66 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -74,10 +74,8 @@ scripts = bin/sage-inline-fortran bin/sage-ipynb2rst bin/sage-ipython - bin/sage-native-execute bin/sage-notebook bin/sage-num-threads.py - bin/sage-open bin/sage-preparse bin/sage-python bin/sage-run From f4bfd26a8338470839962c7228bc8c6efa350be2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 4 May 2022 14:47:14 -0700 Subject: [PATCH 109/338] build/pkgs/sagemath_{environment,objects}/install-requires.txt: Pin versions to ensure sage.misc.package_dirs is provided --- build/pkgs/sagemath_environment/install-requires.txt | 2 +- build/pkgs/sagemath_objects/install-requires.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index de8dccbaf67..2a9064d9451 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1 +1 @@ -sagemath-environment +sagemath-environment ~= 9.6rc3 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index a37f924ca11..3effb11e48f 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1 +1,2 @@ -sagemath-objects ~= 9.5b6 +# Trac +sagemath-objects == 9.6rc3.post1 From a9354335ce3329cc33c7441c6366fb42964a988b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 4 May 2022 15:10:03 -0700 Subject: [PATCH 110/338] pkgs/sagemath-objects/MANIFEST.in: Add sage.misc.sagedoc --- build/pkgs/sagemath_objects/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 3effb11e48f..9573366b41d 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ # Trac -sagemath-objects == 9.6rc3.post1 +sagemath-objects == 9.6rc3.post2 From 306aab6b5a8cdbf661f0a791ed836d47622f6abc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 4 May 2022 15:15:34 -0700 Subject: [PATCH 111/338] src/sage/repl/preparse.py: Mark some doctests # optional - sage.symbolic --- src/sage/repl/preparse.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/repl/preparse.py b/src/sage/repl/preparse.py index 7c0b63c53ae..37b3b36d042 100644 --- a/src/sage/repl/preparse.py +++ b/src/sage/repl/preparse.py @@ -82,18 +82,18 @@ Symbolic functional notation:: - sage: a=10; f(theta, beta) = theta + beta; b = x^2 + theta - sage: f + sage: a=10; f(theta, beta) = theta + beta; b = x^2 + theta # optional - sage.symbolic + sage: f # optional - sage.symbolic (theta, beta) |--> beta + theta - sage: a + sage: a # optional - sage.symbolic 10 - sage: b + sage: b # optional - sage.symbolic x^2 + theta - sage: f(theta,theta) + sage: f(theta,theta) # optional - sage.symbolic 2*theta - sage: a = 5; f(x,y) = x*y*sqrt(a) - sage: f + sage: a = 5; f(x,y) = x*y*sqrt(a) # optional - sage.symbolic + sage: f # optional - sage.symbolic (x, y) |--> sqrt(5)*x*y This involves an =-, but should still be turned into a symbolic @@ -101,8 +101,8 @@ sage: preparse('a(x) =- 5') '__tmp__=var("x"); a = symbolic_expression(- Integer(5)).function(x)' - sage: f(x)=-x - sage: f(10) + sage: f(x)=-x # optional - sage.symbolic + sage: f(10) # optional - sage.symbolic -10 This involves -=, which should not be turned into a symbolic From 48e80a934f65670818d4a0b2bfae51677f6a13e9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 4 May 2022 16:28:26 -0700 Subject: [PATCH 112/338] Replace imports of sage_eval from sage.all by more specific imports --- src/sage/algebras/free_algebra.py | 2 +- src/sage/rings/polynomial/polynomial_quotient_ring.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 06cc97dc106..08326db9c10 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -600,7 +600,7 @@ def exp_to_monomial(T): return self.element_class(self, {exp_to_monomial(T):c for T,c in x.letterplace_polynomial().dict().items()}) # ok, not a free algebra element (or should not be viewed as one). if isinstance(x, str): - from sage.all import sage_eval + from sage.misc.sage_eval import sage_eval G = self.gens() d = {str(v): G[i] for i,v in enumerate(self.variable_names())} return self(sage_eval(x, locals=d)) diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 4bf9538f12f..feb7483f5a7 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -57,7 +57,6 @@ from sage.structure.factory import UniqueFactory from sage.rings.polynomial.infinite_polynomial_ring import GenDictWithBasering -from sage.all import sage_eval from sage.structure.richcmp import richcmp @@ -520,6 +519,7 @@ def _element_constructor_(self, x): # resort to sage_eval. # Interpretation in self has priority over interpretation in self.__ring try: + from sage.misc.sage_eval import sage_eval out = sage_eval(x, GenDictWithBasering(self,self.gens_dict())) if out.parent() is not self: return self(out) From 67d634ecb4c33fdd6424992074c482b37be113ab Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 11:52:43 -0700 Subject: [PATCH 113/338] pkgs/sagemath-environment/setup.cfg.m4: Move some scripts here from sagemath-repl --- pkgs/sagemath-environment/setup.cfg.m4 | 16 ++++++++++++++++ pkgs/sagemath-repl/setup.cfg.m4 | 9 --------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index 06efc8cd59f..e35695f3b99 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -42,6 +42,22 @@ py_modules = packages = sage.features +scripts = + # The sage script + bin/sage + # Auxiliary scripts for setting up the environment + bin/sage-env + bin/sage-num-threads.py + bin/sage-venv-config + bin/sage-version.sh + # Auxiliary script for invoking Python in the Sage environment + bin/sage-python + # Not included: + # - bin/sage-env-config -- installed by sage_conf + # - bin/sage-env-config.in -- not to be installed + # - bin/sage-run, bin/sage-runtests, ... -- installed by sagemath-repl + # - bin/sage-ipython -- uses sage.repl, so installed by sagemath-repl + [options.extras_require] # sage.env can optionally use sage_conf sage_conf = esyscmd(`sage-get-system-packages install-requires sage_conf') diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 0f37c549e66..c242bcdfd11 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -48,8 +48,6 @@ packages = sage.repl.rich_output scripts = - # The sage script - bin/sage # Other scripts that should be in the path also for OS packaging of sage: bin/sage-eval # Included because it is useful for doctesting/coverage testing user scripts too: @@ -63,21 +61,14 @@ scripts = bin/sage-massif bin/sage-omega bin/sage-valgrind - bin/sage-venv-config - bin/sage-version.sh bin/sage-cleaner # Uncategorized scripts in alphabetical order - bin/sage-env - # sage-env-config -- installed by sage_conf - # sage-env-config.in -- not to be installed bin/sage-gdb-commands bin/sage-inline-fortran bin/sage-ipynb2rst bin/sage-ipython bin/sage-notebook - bin/sage-num-threads.py bin/sage-preparse - bin/sage-python bin/sage-run bin/sage-run-cython bin/sage-startuptime.py From 5ed2c187e72e9e6e5b9399f27081b4381ac15ae1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 12:04:07 -0700 Subject: [PATCH 114/338] build/pkgs/sagemath_environment/install-requires.txt: Pin to 9.6rc3.post2 --- build/pkgs/sagemath_environment/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index 2a9064d9451..bea4334d7e4 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1 +1 @@ -sagemath-environment ~= 9.6rc3 +sagemath-environment == 9.6rc3.post2 From 4da1003e3eaaa5ac08d9bb667dad893d12383281 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 13:21:50 -0700 Subject: [PATCH 115/338] pkgs/sagemath-repl: Add sage.misc.banner, sage.misc.sagedoc --- pkgs/sagemath-repl/MANIFEST.in | 1 + pkgs/sagemath-repl/setup.cfg.m4 | 2 ++ 2 files changed, 3 insertions(+) diff --git a/pkgs/sagemath-repl/MANIFEST.in b/pkgs/sagemath-repl/MANIFEST.in index 9b3b76eaac4..9bee69fd999 100644 --- a/pkgs/sagemath-repl/MANIFEST.in +++ b/pkgs/sagemath-repl/MANIFEST.in @@ -4,6 +4,7 @@ global-include all__sagemath_repl.py graft sage/doctest graft sage/repl +include sage/misc/banner.py include sage/misc/sagedoc.py include sage/misc/sage_input.py include sage/misc/sage_eval.py diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index c242bcdfd11..96f554b8de1 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -37,6 +37,8 @@ install_requires = py_modules = sage.all__sagemath_repl sage.misc.all__sagemath_repl + sage.misc.banner + sage.misc.sagedoc sage.misc.sage_input sage.misc.sage_eval From f7bd866a0da91fa02026128a5a4015ddcc8712a0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 13:54:24 -0700 Subject: [PATCH 116/338] src/sage/misc/banner.py: Warn if sage.all is not available --- src/sage/misc/banner.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sage/misc/banner.py b/src/sage/misc/banner.py index 990fc9a12d4..bae5db95d29 100644 --- a/src/sage/misc/banner.py +++ b/src/sage/misc/banner.py @@ -67,13 +67,21 @@ def banner_text(full=True): a(u"│ %-66s │\n" % 'Using Python {}.{}.{}. Type "help()" for help.'.format(*python_version)) a(u'└' + bars + u'┘') pre = version_dict()['prerelease'] - if pre: + try: + import sage.all + have_sage_all = True + except ImportError: + have_sage_all = False + if pre or not have_sage_all: red_in = '\033[31m' red_out = '\033[0m' bars2 = bars.replace(u'─', u'━') a('\n') a(red_in + u'┏' + bars2 + u'┓' + '\n') - a(u"┃ %-66s ┃\n" % 'Warning: this is a prerelease version, and it may be unstable.') + if pre: + a(u"┃ %-66s ┃\n" % 'Warning: this is a prerelease version, and it may be unstable.') + if not have_sage_all: + a(u"┃ %-66s ┃\n" % 'Warning: sage.all is not available; this is a limited REPL.') a(u'┗' + bars2 + u'┛' + red_out) return u''.join(s) From 7b3e419176ee8eb0306f4b73b6ce037a8ac71e2c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 13:55:51 -0700 Subject: [PATCH 117/338] pkgs/sagemath-environment/bin: Add missing symlink --- pkgs/sagemath-environment/bin | 1 + 1 file changed, 1 insertion(+) create mode 120000 pkgs/sagemath-environment/bin diff --git a/pkgs/sagemath-environment/bin b/pkgs/sagemath-environment/bin new file mode 120000 index 00000000000..2f8b9b30ee7 --- /dev/null +++ b/pkgs/sagemath-environment/bin @@ -0,0 +1 @@ +../../src/bin \ No newline at end of file From 8a6aefd440b92a65c99122e7e6ff218209bbc626 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 17:52:41 -0700 Subject: [PATCH 118/338] src/sage/misc/sagedoc.py: Do not fail when sage.all cannot be imported --- src/sage/misc/sagedoc.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 08c4225b87f..89c9a90afec 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -710,7 +710,11 @@ def format(s, embedded=False): if 'noreplace' in directives or 'nodetex' in directives: s = s[first_newline + len(os.linesep):] - import sage.all + try: + import sage.all + except ImportError: + pass + docs = set([]) if 'noreplace' not in directives: i_0 = 0 @@ -774,7 +778,12 @@ def format_src(s): if not isinstance(s, str): raise TypeError("s must be a string") docs = set([]) - import sage.all + + try: + import sage.all + except ImportError: + pass + while True: i = s.find("<<<") if i == -1: From a5994c589973ad632b05ae06ba7b965503705a12 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 18:19:59 -0700 Subject: [PATCH 119/338] pkgs/sagemath-environment/setup.cfg.m4: Add extras-require for packages that implement options of the sage script --- pkgs/sagemath-environment/setup.cfg.m4 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index e35695f3b99..c67043cb715 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -60,4 +60,16 @@ scripts = [options.extras_require] # sage.env can optionally use sage_conf -sage_conf = esyscmd(`sage-get-system-packages install-requires sage_conf') +conf = esyscmd(`sage-get-system-packages install-requires sage_conf') +# For "sage --docbuild" +docbuild = esyscmd(`sage-get-system-packages install-requires sage_docbuild') +# For "sage", "sage -t", ... +sage = esyscmd(`sage-get-system-packages install-requires sagelib') +# For "sage --cython" +cython = esyscmd(`sage-get-system-packages install-requires cython') +# For "sage --pytest" +pytest = esyscmd(`sage-get-system-packages install-requires pytest') +# For "sage --rst2ipynb" +rst2ipynb = esyscmd(`sage-get-system-packages install-requires rst2ipynb') +# For "sage --sws2rst" +sws2rst = esyscmd(`sage-get-system-packages install-requires sage_sws2rst') From a026c9d5de7fb1cf80ad5f3aace330db3d694f66 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 20:52:18 -0700 Subject: [PATCH 120/338] src/bin/sage: In the short help message, suppress options that are not available --- src/bin/sage | 54 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index e94cc50940e..efb23d0eac3 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -102,33 +102,51 @@ usage() { #### 1.......................26..................................................78 #### |.....................--.|...................................................| echo - echo "Optional arguments:" - echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" - echo " --advanced -- list all command line options" - echo " -c -- Evaluates cmd as sage code" + echo "Running Sage:" + if command -v sage-ipython &>/dev/null; then + echo + echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" + echo " -c -- evaluate cmd as sage code" + echo " --notebook=[...] -- start the Sage notebook (valid options are" + echo " 'default', 'jupyter', 'jupyterlab', and 'export')" + echo " Current default is 'jupyter'" + echo " -n, --notebook -- shortcut for --notebook=default" + echo " --nodotsage -- run Sage without using the user's .sage directory:" + echo " create and use a temporary .sage directory instead" + echo " -t [options] <--all|files|dir>" + echo " -- test examples in .py, .pyx, .sage, .tex or .rst files" + echo " selected options:" + echo " --long - include lines with the phrase 'long time'" + echo " --verbose - print debugging output during the test" + echo " --optional - controls which optional tests are run" + echo " --help - show all testing options" + else + echo " (not installed currently, " + echo " to install, run sage --pip install sagemath-repl)" + fi + echo + echo "Running external programs:" + echo + command -v gap &>/dev/null && \ echo " --gap [...] -- run Sage's Gap with given arguments" + command -v gp &>/dev/null && \ echo " --gp [...] -- run Sage's PARI/GP calculator with given arguments" - echo " -h -- print this help message" echo " --pip [...] -- invoke pip, the Python package manager" + command -v maxima &>/dev/null && \ echo " --maxima [...] -- run Sage's Maxima with given arguments" + command -v mwrank &>/dev/null && \ echo " --mwrank [...] -- run Sage's mwrank with given arguments" - echo " --notebook=[...] -- start the Sage notebook (valid options are" - echo " 'default', 'jupyter', 'jupyterlab', and 'export')" - echo " Current default is 'jupyter'" - echo " -n, --notebook -- shortcut for --notebook=default" echo " --python [...], --python3 [...] -- run the Python 3 interpreter" + command -v R &>/dev/null && \ echo " -R [...] -- run Sage's R with given arguments" + command -v singular &>/dev/null && \ echo " --singular [...] -- run Sage's singular with given arguments" - echo " --nodotsage -- run Sage without using the user's .sage directory:" - echo " create and use a temporary .sage directory instead" - echo " -t [options] <--all|files|dir>" - echo " -- test examples in .py, .pyx, .sage, .tex or .rst files" - echo " selected options:" - echo " --long - include lines with the phrase 'long time'" - echo " --verbose - print debugging output during the test" - echo " --optional - controls which optional tests are run" - echo " --help - show all testing options" + echo + echo "Getting help:" + echo echo " -v, --version -- display Sage version information" + echo " -h, -?, --help -- print this help message" + echo " --advanced -- list all command line options" if [ -d "$SAGE_ROOT" ]; then exec "$SAGE_ROOT/build/bin/sage-site" "-h" fi From 9314977746e25f624735ffd4627cc3642930bb13 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 21:09:52 -0700 Subject: [PATCH 121/338] src/bin/sage: In the advanced help message, suppress options that are not available --- src/bin/sage | 87 +++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index efb23d0eac3..5e8a43cbf87 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -319,55 +319,48 @@ usage_advanced() { #### 1.......................26..................................................78 #### |.....................--.|...................................................| echo - echo "Running Sage, the most common options:" - echo - echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" - echo " -h, -?, --help -- print a short help message" - echo " -v, --version -- print the Sage version" - echo " --advanced -- print this list of Sage options" - echo " -c cmd -- evaluate cmd as sage code. For example," - echo " \"sage -c 'print(factor(35))'\" will" - echo " print \"5 * 7\"." - echo - echo "Running Sage, other options:" - echo - echo " --dumpversion -- print brief Sage version" - echo " --preparse file.sage -- preparse \"file.sage\", and produce" - echo " the corresponding Python file" - echo " \"file.sage.py\"" - echo " -q -- quiet; start with no banner" - echo " --min -- do not populate global namespace" - echo " (must be first option)" - echo " --nodotsage -- run Sage without using the user's" - echo " .sage directory: create and use a temporary" - echo " .sage directory instead." - echo " --gthread, --qthread, --q4thread, --wthread, --pylab" - echo " -- pass the option through to IPython" - echo " --simple-prompt -- pass the option through to IPython: use" - echo " this option with sage-shell mode in emacs" - if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then - echo " --grep [options] " - echo " -- regular expression search through the Sage" - echo " library for \"string\". Any options will" - echo " get passed to the \"grep\" command." - echo " --grepdoc [options] " - echo " -- regular expression search through the" - echo " Sage documentation for \"string\"." - echo " --search_src ... -- same as --grep" - echo " --search_doc ... -- same as --grepdoc" + if command -v sage-ipython &>/dev/null; then + echo "Running Sage, the most common options:" + echo + echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" + echo " -c cmd -- evaluate cmd as sage code. For example," + echo " \"sage -c 'print(factor(35))'\" will" + echo " print \"5 * 7\"." + echo + echo "Running Sage, other options:" + echo + echo " --preparse file.sage -- preparse \"file.sage\", and produce" + echo " the corresponding Python file" + echo " \"file.sage.py\"" + echo " -q -- quiet; start with no banner" + echo " --min -- do not populate global namespace" + echo " (must be first option)" + echo " --nodotsage -- run Sage without using the user's" + echo " .sage directory: create and use a temporary" + echo " .sage directory instead." + echo " --gthread, --qthread, --q4thread, --wthread, --pylab" + echo " -- pass the option through to IPython" + echo " --simple-prompt -- pass the option through to IPython: use" + echo " this option with sage-shell mode in emacs" + echo " --gdb -- run Sage under the control of gdb" + echo " --gdb-ipython -- run Sage's IPython under the control of gdb" + else + echo "Running Sage:" + echo " (not installed currently, " + echo " to install, run sage --pip install sagemath-repl)" fi echo echo "Running external programs:" echo echo " --cython [...] -- run Cython with the given arguments" + command -v cython &>/dev/null || \ + echo " (not installed, run sage --pip install cython)" echo " --ecl [...], --lisp [...] -- run Sage's copy of ECL (Embeddable" echo " Common Lisp) with the given arguments" echo " --gap [...] -- run Sage's Gap with the given arguments" echo " --gap3 [...] -- run Sage's Gap3 with the given arguments" command -v gap3 &>/dev/null || \ echo " (not installed currently, run sage -i gap3)" - echo " --gdb -- run Sage under the control of gdb" - echo " --gdb-ipython -- run Sage's IPython under the control of gdb" echo " --git [...] -- run Sage's Git with the given arguments" echo " --gp [...] -- run Sage's PARI/GP calculator with the" echo " given arguments" @@ -469,6 +462,17 @@ usage_advanced() { echo echo "Some developer utilities:" echo + if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then + echo " --grep [options] " + echo " -- regular expression search through the Sage" + echo " library for \"string\". Any options will" + echo " get passed to the \"grep\" command." + echo " --grepdoc [options] " + echo " -- regular expression search through the" + echo " Sage documentation for \"string\"." + echo " --search_src ... -- same as --grep" + echo " --search_doc ... -- same as --grepdoc" + fi echo " --sh [...] -- run a shell with Sage environment variables" echo " as they are set in the runtime of Sage" echo " --cleaner -- run the Sage cleaner. This cleans up after Sage," @@ -510,6 +514,13 @@ usage_advanced() { echo " files are named sage-omega.PID can be found in" echo " \$DOT_SAGE" echo " --valgrind -- this is an alias for --memcheck" + echo + echo "Getting help:" + echo + echo " -v, --version -- display Sage version information" + echo " --dumpversion -- print brief Sage version" + echo " -h, -?, --help -- print this help message" + echo " --advanced -- list all command line options" if [ -d "$SAGE_ROOT" ]; then exec "$SAGE_ROOT/build/bin/sage-site" "--advanced" fi From dee75e81f2a22c12b2e394ee17c18a094f465c44 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 5 May 2022 23:44:47 -0700 Subject: [PATCH 122/338] src/bin/sage: Fix up --- src/bin/sage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/sage b/src/bin/sage index 5e8a43cbf87..64b1d354fc2 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -519,7 +519,7 @@ usage_advanced() { echo echo " -v, --version -- display Sage version information" echo " --dumpversion -- print brief Sage version" - echo " -h, -?, --help -- print this help message" + echo " -h, -?, --help -- print a short help message" echo " --advanced -- list all command line options" if [ -d "$SAGE_ROOT" ]; then exec "$SAGE_ROOT/build/bin/sage-site" "--advanced" From d437146728067d47505b619fc95e621adfceef31 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 00:12:51 -0700 Subject: [PATCH 123/338] src/bin/sage: In sage -advanced, suppress options of sage -t when not installed --- src/bin/sage | 95 ++++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index 64b1d354fc2..e86327b85b1 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -399,50 +399,57 @@ usage_advanced() { #### |.....................--.|...................................................| echo "Testing files:" echo - echo " -t [options] -- test examples in .py, .pyx, .sage" - echo " or .tex files. Options:" - echo " --long -- include lines with the phrase 'long time'" - echo " --verbose -- print debugging output during the test" - echo " --all -- test all files" - echo " --optional -- also test all examples labeled \"# optional\"" - echo " --only-optional[=tags]" - echo " -- if no 'tags' are specified, only run" - echo " blocks of tests containing a line labeled" - echo " \"# optional\". If a comma-separated" - echo " list of tags is specified, only run block" - echo " containing a line labeled \"# optional tag\"" - echo " for any of the tags given, and in these blocks" - echo " only run the lines which are unlabeled or" - echo " labeled \"# optional\" or labeled" - echo " \"# optional tag\" for any of the tags given." - echo " --randorder[=seed] -- randomize order of tests" - echo " --random-seed[=seed] -- random seed (integer) for fuzzing doctests" - echo " --new -- only test files modified since last commit" - echo " --initial -- only show the first failure per block" - echo " --debug -- drop into PDB after an unexpected error" - echo " --failed -- only test files that failed last test" - echo " --warn-long [timeout] -- warning if doctest is slow" - echo " --only-errors -- only output failures, not successes" - echo " --gc=GC -- control garbarge collection (ALWAYS:" - echo " collect garbage before every test; NEVER:" - echo " disable gc; DEFAULT: Python default)" - echo " --short[=secs] -- run as many doctests as possible in about 300" - echo " seconds (or the number of seconds given.) This runs" - echo " the tests for each module from the top of the file" - echo " and skips tests once it exceeds the budget" - echo " allocated for that file." - echo " --help -- show all doctesting options" - echo " --tnew [...] -- equivalent to -t --new" - echo " -tp [...] -- like -t above, but tests in parallel using" - echo " N threads, with 0 interpreted as min(8, cpu_count())" - echo " --testall [options] -- equivalent to -t --all" - echo - echo " --coverage -- give information about doctest coverage of files" - echo " --coverageall -- give summary info about doctest coverage of" - echo " all files in the Sage library" - echo " --startuptime [module] -- display how long each component of Sage takes to" - echo " start up; optionally specify a module to get more" - echo " details about that particular module" + if command -v sage-runtests &>/dev/null; then + echo " -t [options] -- test examples in .py, .pyx, .sage" + echo " or .tex files. Options:" + echo " --long -- include lines with the phrase 'long time'" + echo " --verbose -- print debugging output during the test" + echo " --all -- test all files" + echo " --optional -- also test all examples labeled \"# optional\"" + echo " --only-optional[=tags]" + echo " -- if no 'tags' are specified, only run" + echo " blocks of tests containing a line labeled" + echo " \"# optional\". If a comma-separated" + echo " list of tags is specified, only run block" + echo " containing a line labeled \"# optional tag\"" + echo " for any of the tags given, and in these blocks" + echo " only run the lines which are unlabeled or" + echo " labeled \"# optional\" or labeled" + echo " \"# optional tag\" for any of the tags given." + echo " --randorder[=seed] -- randomize order of tests" + echo " --random-seed[=seed] -- random seed (integer) for fuzzing doctests" + echo " --new -- only test files modified since last commit" + echo " --initial -- only show the first failure per block" + echo " --debug -- drop into PDB after an unexpected error" + echo " --failed -- only test files that failed last test" + echo " --warn-long [timeout] -- warning if doctest is slow" + echo " --only-errors -- only output failures, not successes" + echo " --gc=GC -- control garbarge collection (ALWAYS:" + echo " collect garbage before every test; NEVER:" + echo " disable gc; DEFAULT: Python default)" + echo " --short[=secs] -- run as many doctests as possible in about 300" + echo " seconds (or the number of seconds given.) This runs" + echo " the tests for each module from the top of the file" + echo " and skips tests once it exceeds the budget" + echo " allocated for that file." + echo " --help -- show all doctesting options" + echo " --tnew [...] -- equivalent to -t --new" + echo " -tp [...] -- like -t above, but tests in parallel using" + echo " N threads, with 0 interpreted as min(8, cpu_count())" + echo " --testall [options] -- equivalent to -t --all" + echo + echo " --coverage -- give information about doctest coverage of files" + echo " --coverageall -- give summary info about doctest coverage of" + echo " all files in the Sage library" + echo " --startuptime [module] -- display how long each component of Sage takes to" + echo " start up; optionally specify a module to get more" + echo " details about that particular module" + else + echo " -t [options] -- test examples in .py, .pyx, .sage" + echo " or .tex files." + echo " (not installed currently, to install," + echo " run sage --pip install sagemath-repl)" + fi if [ -n "$SAGE_SRC" -a -f "$SAGE_SRC/tox.ini" ]; then echo " --tox [options] -- general entry point for testing" echo " and linting of the Sage library" From 6da9d79f0254d535524f44d89fbd043b460814ff Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 16:12:53 -0700 Subject: [PATCH 124/338] pkgs/sagemath-objects/MANIFEST.in: Work around sage/__init__.py still being present --- build/pkgs/sagemath_objects/install-requires.txt | 4 ++-- pkgs/sagemath-objects/MANIFEST.in | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 9573366b41d..a94dfc6cb08 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ -# Trac -sagemath-objects == 9.6rc3.post2 +# Pinned in Trac #29941 until proper namespace packages are supported in #28925. +sagemath-objects == 9.6rc3.post3 diff --git a/pkgs/sagemath-objects/MANIFEST.in b/pkgs/sagemath-objects/MANIFEST.in index 652d209713c..999493923c8 100644 --- a/pkgs/sagemath-objects/MANIFEST.in +++ b/pkgs/sagemath-objects/MANIFEST.in @@ -88,7 +88,8 @@ graft sage/libs/gmp # sage/misc/latex -- this should really go to another package -## For doctesting +## For doctesting -- this duplication will be removed in #28925 +global-include all__sagemath_repl.py include bin/sage include bin/sage-env include bin/sage-env-config @@ -101,6 +102,9 @@ include sage/misc/misc.* # walltime, cputime # graft sage/features include sage/misc/package.* include sage/misc/sagedoc.py +include sage/misc/banner.py +include sage/misc/sage_input.py +include sage/misc/sage_eval.py graft sage/repl graft sage/server From d9d02d552e203ee76c30e57b627b2ae942093a51 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 09:52:14 -0700 Subject: [PATCH 125/338] pkgs/sagemath-objects/MANIFEST.in: Another work around for sage/__init__.py still being present --- pkgs/sagemath-objects/MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/sagemath-objects/MANIFEST.in b/pkgs/sagemath-objects/MANIFEST.in index 999493923c8..bf5aa6a65c0 100644 --- a/pkgs/sagemath-objects/MANIFEST.in +++ b/pkgs/sagemath-objects/MANIFEST.in @@ -89,6 +89,7 @@ graft sage/libs/gmp ## For doctesting -- this duplication will be removed in #28925 +global-include all__sagemath_environment.py global-include all__sagemath_repl.py include bin/sage include bin/sage-env @@ -105,6 +106,7 @@ include sage/misc/sagedoc.py include sage/misc/banner.py include sage/misc/sage_input.py include sage/misc/sage_eval.py +include sage/misc/viewer.py graft sage/repl graft sage/server From 60675ba81dbe135114a6cf455c78f6eca94e282a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 10:34:01 -0700 Subject: [PATCH 126/338] pkgs/*/VERSION.txt: Change from symlink to separate regular files, updated by sage-update-version --- build/pkgs/sage_conf/package-version.txt | 2 +- build/pkgs/sage_docbuild/package-version.txt | 2 +- build/pkgs/sage_setup/package-version.txt | 2 +- build/pkgs/sage_sws2rst/package-version.txt | 2 +- build/pkgs/sagelib/package-version.txt | 2 +- build/pkgs/sagemath_categories/package-version.txt | 2 +- build/pkgs/sagemath_environment/package-version.txt | 2 +- build/pkgs/sagemath_objects/package-version.txt | 2 +- build/pkgs/sagemath_repl/package-version.txt | 2 +- pkgs/sage-conf_pypi/VERSION.txt | 2 +- pkgs/sage-docbuild/VERSION.txt | 2 +- pkgs/sage-setup/VERSION.txt | 2 +- pkgs/sage-sws2rst/VERSION.txt | 2 +- pkgs/sagemath-categories/VERSION.txt | 2 +- pkgs/sagemath-environment/VERSION.txt | 2 +- pkgs/sagemath-objects/VERSION.txt | 2 +- pkgs/sagemath-repl/VERSION.txt | 2 +- src/bin/sage-update-version | 7 ++++++- src/doc/en/developer/packaging_sage_library.rst | 10 +++++++++- 19 files changed, 32 insertions(+), 19 deletions(-) mode change 100644 => 120000 build/pkgs/sagelib/package-version.txt mode change 120000 => 100644 pkgs/sage-conf_pypi/VERSION.txt mode change 120000 => 100644 pkgs/sage-docbuild/VERSION.txt mode change 120000 => 100644 pkgs/sage-setup/VERSION.txt mode change 120000 => 100644 pkgs/sage-sws2rst/VERSION.txt mode change 120000 => 100644 pkgs/sagemath-categories/VERSION.txt mode change 120000 => 100644 pkgs/sagemath-environment/VERSION.txt mode change 120000 => 100644 pkgs/sagemath-objects/VERSION.txt mode change 120000 => 100644 pkgs/sagemath-repl/VERSION.txt diff --git a/build/pkgs/sage_conf/package-version.txt b/build/pkgs/sage_conf/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_conf/package-version.txt +++ b/build/pkgs/sage_conf/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sage_docbuild/package-version.txt b/build/pkgs/sage_docbuild/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_docbuild/package-version.txt +++ b/build/pkgs/sage_docbuild/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sage_setup/package-version.txt b/build/pkgs/sage_setup/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_setup/package-version.txt +++ b/build/pkgs/sage_setup/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sage_sws2rst/package-version.txt b/build/pkgs/sage_sws2rst/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_sws2rst/package-version.txt +++ b/build/pkgs/sage_sws2rst/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagelib/package-version.txt b/build/pkgs/sagelib/package-version.txt deleted file mode 100644 index 24562793a28..00000000000 --- a/build/pkgs/sagelib/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -9.6.rc3 diff --git a/build/pkgs/sagelib/package-version.txt b/build/pkgs/sagelib/package-version.txt new file mode 120000 index 00000000000..c4540217bba --- /dev/null +++ b/build/pkgs/sagelib/package-version.txt @@ -0,0 +1 @@ +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_categories/package-version.txt b/build/pkgs/sagemath_categories/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sagemath_categories/package-version.txt +++ b/build/pkgs/sagemath_categories/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/package-version.txt b/build/pkgs/sagemath_environment/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sagemath_environment/package-version.txt +++ b/build/pkgs/sagemath_environment/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_objects/package-version.txt b/build/pkgs/sagemath_objects/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sagemath_objects/package-version.txt +++ b/build/pkgs/sagemath_objects/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/package-version.txt b/build/pkgs/sagemath_repl/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sagemath_repl/package-version.txt +++ b/build/pkgs/sagemath_repl/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-docbuild/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sage-docbuild/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-setup/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sage-setup/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-sws2rst/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sagemath-categories/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sagemath-categories/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sagemath-environment/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sagemath-environment/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sagemath-objects/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sagemath-objects/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sagemath-repl/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sagemath-repl/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index cdf165694f7..39b50463e75 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -36,7 +36,12 @@ SAGE_VERSION=`echo "$1" | sed 's/^sage-//'` SAGE_RELEASE_DATE=`date -u +'%Y-%m-%d'` SAGE_VERSION_BANNER="SageMath version $SAGE_VERSION, Release Date: $SAGE_RELEASE_DATE" -echo $SAGE_VERSION | tee "$SAGE_SRC/VERSION.txt" > "$SAGE_ROOT/build/pkgs/sagelib/package-version.txt" +# Update Sage version file for all distribution packages +for version_file in "$SAGE_ROOT/pkgs/*/VERSION.txt"; do + if [ -f "$version_file" ]; then + echo $SAGE_VERSION > "$version_file" + fi +done # Update Sage version file for Python in SAGE_SRC/sage cat < "$SAGE_SRC/sage/version.py" diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index c206e512475..2f407815cf2 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -152,9 +152,17 @@ The source directory of a distribution package, such as - ``README.rst`` -- a description of the distribution -- ``VERSION.txt``, ``LICENSE.txt`` -- relative symbolic links to the same files +- ``LICENSE.txt`` -- relative symbolic link to the same files in ``SAGE_ROOT/src`` +- ``VERSION.txt`` -- package version. This file is updated by the release manager by + running the ``sage-update-version`` script. Sometimes when working on tickets it + may be necessary to increment the version manually by adding a suffix ``.post1``, + ``.post2`` ... + (see `PEP 440 on post-releases `_). + After the ticket is merged in the next development version, it will be + synchronized again with the other package versions. + - ``setup.py`` -- a `setuptools `_-based installation script From 4d47f0c01885021f2cc92376aed41848246694c7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 10:38:57 -0700 Subject: [PATCH 127/338] pkgs/sagemath-{objects,environment}/VERSION.txt: Bump to post4, post2 --- pkgs/sagemath-environment/VERSION.txt | 2 +- pkgs/sagemath-objects/VERSION.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 24562793a28..27f66583915 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.6.rc3.post2 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 24562793a28..be2310e2ea1 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.6.rc3.post4 From be5cf79d22eeb96b2d0a9d896bd43dbb380cc64d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 10:43:43 -0700 Subject: [PATCH 128/338] pkgs/sage-conf/VERSION.txt: New --- pkgs/sage-conf/VERSION.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 pkgs/sage-conf/VERSION.txt diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt new file mode 100644 index 00000000000..24562793a28 --- /dev/null +++ b/pkgs/sage-conf/VERSION.txt @@ -0,0 +1 @@ +9.6.rc3 From e50dae2fdfb872ba2ce16eca6d479ff517828ad4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 10:53:25 -0700 Subject: [PATCH 129/338] src/bin/sage-update-version: Fix up --- src/bin/sage-update-version | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index 39b50463e75..be312ed5775 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -37,7 +37,7 @@ SAGE_RELEASE_DATE=`date -u +'%Y-%m-%d'` SAGE_VERSION_BANNER="SageMath version $SAGE_VERSION, Release Date: $SAGE_RELEASE_DATE" # Update Sage version file for all distribution packages -for version_file in "$SAGE_ROOT/pkgs/*/VERSION.txt"; do +for version_file in "$SAGE_ROOT"/pkgs/*/VERSION.txt; do if [ -f "$version_file" ]; then echo $SAGE_VERSION > "$version_file" fi @@ -81,7 +81,7 @@ git commit -m "Updated SageMath version to $SAGE_VERSION" -- \ "$SAGE_SRC/bin/sage-version.sh" \ "$SAGE_ROOT/build/pkgs/configure/checksums.ini" \ "$SAGE_ROOT/build/pkgs/configure/package-version.txt" \ - "$SAGE_ROOT/build/pkgs/sagelib/package-version.txt" \ + "$SAGE_ROOT"/pkgs/*/VERSION.txt \ || die "Error committing to the repository." git tag -a "$SAGE_VERSION" -m "$SAGE_VERSION_BANNER" \ From 45cfe8c0e13b21d7808ac73d3164f563038ec453 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 11:15:46 -0700 Subject: [PATCH 130/338] src/doc/en/developer/packaging_sage_library.rst: Expand on post and dev versions --- .../en/developer/packaging_sage_library.rst | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index 2f407815cf2..0515f5b2a34 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -156,12 +156,28 @@ The source directory of a distribution package, such as in ``SAGE_ROOT/src`` - ``VERSION.txt`` -- package version. This file is updated by the release manager by - running the ``sage-update-version`` script. Sometimes when working on tickets it - may be necessary to increment the version manually by adding a suffix ``.post1``, - ``.post2`` ... - (see `PEP 440 on post-releases `_). - After the ticket is merged in the next development version, it will be - synchronized again with the other package versions. + running the ``sage-update-version`` script. + + Sometimes it may be necessary to upload a hotfix for a distribution + package to PyPI. These should be marked by adding a suffix + ``.post1``, ``.post2``; see `PEP 440 on post-releases + `_. For example, if + the current development release is ``9.7.beta8``, then such a + version could be marked ``9.7.beta8.post1``. + + Also sometimes when working on tickets it may be necessary to + increment the version because a new feature is needed in another + distribution package. Such versions should be marked by using the + version number of the anticipated next development release and + adding a suffix ``.dev1``, ``.dev2`` ... (see `PEP 440 on + developmental releases + `_). + For example, if the current development release is ``9.7.beta8``, + use ``9.7.beta9.dev1``. If the current development release is + the stable release ``9.8``, use ``9.9.beta0.dev1``. + + After the ticket is merged in the next development version, it will + be synchronized again with the other package versions. - ``setup.py`` -- a `setuptools `_-based installation script From 4b52f085f8eb3fc9b81f4f37e4e5ef7f197d0248 Mon Sep 17 00:00:00 2001 From: "aram.dermenjian" Date: Tue, 29 Sep 2020 15:11:43 -0400 Subject: [PATCH 131/338] Add Nu Dyck Words and Nu Tamari Lattice --- src/doc/en/reference/combinat/module_list.rst | 2 + src/doc/en/reference/references/index.rst | 7 + src/sage/combinat/all.py | 1 + src/sage/combinat/nu_dyck_word.py | 1403 +++++++++++++++++ src/sage/combinat/nu_tamari_lattice.py | 105 ++ src/sage/combinat/words/paths.py | 38 + 6 files changed, 1556 insertions(+) create mode 100644 src/sage/combinat/nu_dyck_word.py create mode 100644 src/sage/combinat/nu_tamari_lattice.py diff --git a/src/doc/en/reference/combinat/module_list.rst b/src/doc/en/reference/combinat/module_list.rst index d1da854a364..7a97a40e30d 100644 --- a/src/doc/en/reference/combinat/module_list.rst +++ b/src/doc/en/reference/combinat/module_list.rst @@ -164,6 +164,8 @@ Comprehensive Module List sage/combinat/ncsym/ncsym sage/combinat/necklace sage/combinat/non_decreasing_parking_function + sage/combinat/nu_dyck_word + sage/combinat/nu_tamari_lattice sage/combinat/ordered_tree sage/combinat/output sage/combinat/parallelogram_polyomino diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 46e46557a02..04547fd8456 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -998,6 +998,9 @@ REFERENCES: lacunas of the Thue-Morse word*, Proc. GASCOM 2008 (June 16-20 2008, Bibbiena, Arezzo-Italia), 53--67. +.. [BMFPR] \M. Bousquet-Melou, E. Fusy, L.-F. Preville Ratelle. + *The number of intervals in the m-Tamari lattices*. :arxiv:`1106.1498` + .. [BMS2006] Bugeaud, Mignotte, and Siksek. "Classical and modular approaches to exponential Diophantine equations: I. Fibonacci and Lucas perfect powers." Annals @@ -4775,6 +4778,10 @@ REFERENCES: *PICARO - a block cipher allowing efficient higher-order side-channel resistance*; in ACNS, (2012), pp. 311-328. +.. [PRV2017] \L.-F. Préville-Ratelle and X. Viennot, + *The enumeration of generalized Tamari intervals*. + Trans. Amer. Math. Soc. 369 (2017), pp 5219--5239 + .. [Prototype_pattern] Prototype pattern, :wikipedia:`Prototype_pattern` diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 953c6b29761..00153b736e5 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -216,6 +216,7 @@ from .subset import Subsets from .necklace import Necklaces lazy_import('sage.combinat.dyck_word', ('DyckWords', 'DyckWord')) +lazy_import('sage.combinat.nu_dyck_word', ('NuDyckWords', 'NuDyckWord')) from .sloane_functions import sloane lazy_import('sage.combinat.superpartition', ('SuperPartition', 'SuperPartitions')) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py new file mode 100644 index 00000000000..07b39d3e965 --- /dev/null +++ b/src/sage/combinat/nu_dyck_word.py @@ -0,0 +1,1403 @@ +# -*- coding: utf-8 -*- +r""" +`\nu`-Dyck Words + +A class of the `\nu`-Dyck word, see [PRV2017]_ for details. + +AUTHORS: + +- Aram Dermenjian (2020-09-26) + +This file is based off the class ``DyckWords`` written by Mke Hansen, Dan +Drake, Florent Hivert, Christian Stump, Mike Zabrocki, Jean--Baptiste Priez +and Travis Scrimshaw + +""" + +# **************************************************************************** +# Copyright (C) 2020 Aram Dermenjian , +# +# Distributed under the terms of the GNU General Public License (GPL) +# +# This code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# The full text of the GPL is available at: +# +# https://www.gnu.org/licenses/ +# **************************************************************************** + +from sage.structure.element import Element +from sage.rings.integer import Integer +from sage.combinat.combinat import CombinatorialElement +from sage.structure.global_options import GlobalOptions +from sage.structure.parent import Parent +from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets +from sage.combinat.permutation import Permutations +from sage.misc.latex import latex + +from sage.combinat.words.paths import WordPaths_north_east +from sage.combinat.words.paths import FiniteWordPath_north_east + +ndw_open_symbol = 1 +ndw_close_symbol = 0 + + +def update_ndw_symbols(os, cs): + r""" + A way to alter the open and close symbols from sage + + INPUT: + + - ``os`` -- The open symbol + - ``cs`` -- The close symbol + """ + global ndw_open_symbol + global ndw_close_symbol + ndw_open_symbol = os + ndw_close_symbol = cs + + +def replace_dyck_char(x): + r""" + A map sending an opening character (``'1'``, ``'N'``, and ``'('``) to + ``ndw_open_symbol`` and a closing character (``'0'``, ``'E'``, and ``')'``) to + ``ndw_close_symbol``, and raising an error on any input other than one of the + opening or closing characters. + + This is the inverse map of :func:`replace_dyck_symbol`. + + INPUT: + + - ``x`` -- str - A ``'1'``, ``'0'``, ``'N'``, ``'E'``, ``'('`` or ``')'`` + + OUTPUT: + + - If ``x`` is an opening character, replace ``x`` with the + constant ``ndw_open_symbol``. + + - If ``x`` is a closing character, replace ``x`` with the + constant ``ndw_close_symbol``. + + - Raise a ``ValueError`` if ``x`` is neither an opening nor a + closing character. + + .. SEEALSO:: :func:`replace_dyck_symbol` + + EXAMPLES:: + + sage: from sage.combinat.nu_dyck_word import replace_dyck_char + sage: replace_dyck_char('(') + 1 + sage: replace_dyck_char(')') + 0 + sage: replace_dyck_char(1) + Traceback (most recent call last): + ... + ValueError + """ + if x == '(' or x == 'N' or x == str(ndw_open_symbol): + return ndw_open_symbol + elif x == ')' or x == 'E' or x == str(ndw_close_symbol): + return ndw_close_symbol + else: + raise ValueError + + +def replace_dyck_symbol(x, open_char='N', close_char='E'): + r""" + A map sending ``ndw_open_symbol`` to ``open_char`` and ``ndw_close_symbol`` to + ``close_char``, and raising an error on any input other than + ``ndw_open_symbol`` and ``ndw_close_symbol``. The values of the constants + ``ndw_open_symbol`` and ``ndw_close_symbol`` are subject to change. + + This is the inverse map of :func:`replace_dyck_char`. + + INPUT: + + - ``x`` -- either ``ndw_open_symbol`` or ``ndw_close_symbol``. + + - ``open_char`` -- str (optional) default ``'N'`` + + - ``close_char`` -- str (optional) default ``'E'`` + + OUTPUT: + + - If ``x`` is ``ndw_open_symbol``, replace ``x`` with ``open_char``. + + - If ``x`` is ``ndw_close_symbol``, replace ``x`` with ``close_char``. + + - If ``x`` is neither ``ndw_open_symbol`` nor ``ndw_close_symbol``, a + ``ValueError`` is raised. + + .. SEEALSO:: :func:`replace_dyck_char` + + EXAMPLES:: + + sage: from sage.combinat.nu_dyck_word import replace_dyck_symbol + sage: replace_dyck_symbol(1) + 'N' + sage: replace_dyck_symbol(0) + 'E' + sage: replace_dyck_symbol(3) + Traceback (most recent call last): + ... + ValueError + """ + if x == ndw_open_symbol: + return open_char + elif x == ndw_close_symbol: + return close_char + else: + raise ValueError + + +class NuDyckWord(CombinatorialElement): + r""" + A `\nu`-Dyck word. + + Given a lattice path `\nu` in the `\ZZ^2` grid starting at the origin + `(0,0)` consisting of North `N = (0,1)` and East `E = (1,0)` steps, a + `\nu`-Dyck path is a lattice path in the `\ZZ^2` grid starting at the + origin `(0,0)` and ending at the same coordinate as `\nu` such that it is + weakly above `\nu`. A `\nu`-Dyck word is the representation of a + `\nu`-Dyck path where a North step is represented by a 1 and an East step + is represented by a 0. + + INPUT: + + - k1 -- A path for the `\nu`-Dyck word + + - k2 -- A path for `\nu` + + EXAMPLES:: + + sage: dw = NuDyckWord([1,0,1,0],[1,0,0,1]); dw + [1, 0, 1, 0] + sage: print(dw) + NENE + sage: dw.height() + 2 + + :: + + sage: dw = NuDyckWord('1010',[1,0,0,1]); dw + [1, 0, 1, 0] + + :: + + sage: dw = NuDyckWord('NENE',[1,0,0,1]); dw + [1, 0, 1, 0] + + :: + + sage: NuDyckWord([1,0,1,0],[1,0,0,1]).pretty_print() + __ + _|x + | . . + + :: + + sage: from sage.combinat.nu_dyck_word import update_ndw_symbols + sage: update_ndw_symbols(0,1) + sage: dw = NuDyckWord('0101001','0110010'); dw + [0, 1, 0, 1, 0, 0, 1] + sage: dw.pp() + __ + |x + _| . + _|x . + | . . . + sage: update_ndw_symbols(1,0) + + """ + @staticmethod + def __classcall_private__(cls, dw=None, nu=None, **kwargs): + """ + Return an element with the appropriate parent. + + EXAMPLES:: + + sage: NuDyckWord('110100','101010') + [1, 1, 0, 1, 0, 0] + sage: NuDyckWord('010','010') + [0, 1, 0] + """ + + # if dw is none, then we might have a normal Dyck word + if dw is None: + from sage.combinat.dyck_word import DyckWord + return DyckWord(dw, kwargs) + + if isinstance(dw, NuDyckWord): + return dw + + if nu is None: + raise ValueError("nu required") + + dw = to_word_path(dw) + nu = to_word_path(nu) + + if path_weakly_above_other(dw, nu): + return NuDyckWords(nu)(dw) + + raise ValueError("invalid nu-Dyck word") + + def __init__(self, parent, dw, latex_options={}): + Element.__init__(self, parent) + self._path = to_word_path(dw) + + if parent is None: + raise ValueError("Need Parent object") + + self._nu = parent._nu + + self._latex_options = dict(latex_options) + + def _list(self): + """ + Return list of self + """ + return list(self._path) + + def __eq__(self, other): + """ + Return if two paths are equal + """ + if type(other) != type(self): + return False + return self._path == other._path and self._nu == other._nu + + def __neq__(self, other): + """ + Return if two paths are not equal + """ + return not self.__eq__(other) + + def __le__(self, other): + """ + Returns if one path is included in another + """ + if self._nu == other._nu: + return path_weakly_above_other(other._path, self._path) + return False + + def __lt__(self, other): + """ + Returns if one path is strictly included in another + """ + return self.__le__(other) and not self.__eq__(other) + + def __ge__(self, other): + """ + Returns if one path is included in another + """ + if self._nu == other._nu: + return path_weakly_above_other(self._path, other._path) + return False + + def __gt__(self, other): + """ + Returns if one path is strictly included in another + """ + return self.__ge__(other) and not self.__eq__(other) + + def _cache_key(self): + """ + Return a cache key + """ + return str(self._path) + "-" + str(self._nu) + + def __hash__(self): + return hash(''.join([str(i) for i in self._list()])) + + def set_latex_options(self, D): + r""" + Set the latex options for use in the ``_latex_`` function. + + The default values are set in the ``__init__`` function. + + - ``color`` -- (default: black) the line color. + + - ``line width`` -- (default: `2 \times` ``tikz_scale``) value representing the + line width. + + - ``nu_options`` -- (default: ``'rounded corners=1, color=red, line + width=1'``) str to indicate what the tikz options should be for path + of `\nu`. + + - ``points_color`` -- (default: ``'black'``) str to indicate color + points should be drawn with. + + - ``show_grid`` -- (default: ``True``) boolean value to indicate if + grid should be shown. + + - ``show_nu`` -- (default: ``True``) boolean value to indicate if `\nu` + should be shown. + + - ``show_points`` -- (default: ``False``) boolean value to indicate + if points should be shown on path. + + - ``tikz_scale`` -- (default: 1) scale for use with the tikz package. + + INPUT: + + - ``D`` -- a dictionary with a list of latex parameters to change + + EXAMPLES:: + + sage: NDW = NuDyckWord('010','010') + sage: NDW.set_latex_options({"tikz_scale":2}) + sage: NDW.set_latex_options({"color":"blue", "show_points":True}) + + .. TODO:: + + This should probably be merged into NuDyckWord.options. + """ + for opt in D: + self._latex_options[opt] = D[opt] + + def latex_options(self): + r""" + Return the latex options for use in the ``_latex_`` function as a + dictionary. + + The default values are set using the options. + + - ``color`` -- (default: black) the line color. + + - ``line width`` -- (default: 2*``tikz_scale``) value representing the + line width. + + - ``nu_options`` -- (default: ``'rounded corners=1, color=red, line + width=1'``) str to indicate what the tikz options should be for path + of `\nu`. + + - ``points_color`` -- (default: ``'black'``) str to indicate color + points should be drawn with. + + - ``show_grid`` -- (default: ``True``) boolean value to indicate if + grid should be shown. + + - ``show_nu`` -- (default: ``True``) boolean value to indicate if `\nu` + should be shown. + + - ``show_points`` -- (default: ``False``) boolean value to indicate + if points should be shown on path. + + - ``tikz_scale`` -- (default: 1) scale for use with the tikz package. + + EXAMPLES:: + + sage: NDW = NuDyckWord('010','010') + sage: NDW.latex_options() + {'color': black, + 'line width': 2, + 'nu_options': rounded corners=1, color=red, line width=1, + 'points_color': black, + 'show_grid': True, + 'show_nu': True, + 'show_points': False, + 'tikz_scale': 1} + + .. TODO:: + + This should probably be merged into NuDyckWord.options. + """ + d = self._latex_options.copy() + opts = self.parent().options + if "tikz_scale" not in d: + d["tikz_scale"] = opts.latex_tikz_scale + if "line width" not in d: + d["line width"] = opts.latex_line_width_scalar * d["tikz_scale"] + if "color" not in d: + d["color"] = opts.latex_color + if "show_points" not in d: + d["show_points"] = opts.latex_show_points + if "points_color" not in d: + d["points_color"] = opts.latex_points_color + if "show_grid" not in d: + d["show_grid"] = opts.latex_show_grid + if "show_nu" not in d: + d["show_nu"] = opts.latex_show_nu + if "nu_options" not in d: + d["nu_options"] = opts.latex_nu_options + return d + + def _repr_(self): + r""" + Return a string representation of ``self`` depending on + :meth:`NuDyckWords.options`. + + TESTS:: + + sage: NuDyckWord('01010','00011') + [0, 1, 0, 1, 0] + sage: NuDyckWord('10010','00011') + [1, 0, 0, 1, 0] + sage: NuDyckWords.options.display="lattice" + sage: NuDyckWord('10010','00011') + __ + ___|x + |x x x + + sage: NuDyckWords.options._reset() + """ + return self.parent().options._dispatch(self, '_repr_', 'display') + + def _repr_list(self): + r""" + Return a string representation of ``self`` as a list. + + TESTS:: + + sage: NuDyckWord([1,1,0],[1,0,1]) + [1, 1, 0] + sage: NuDyckWord('NNEE','NENE') + [1, 1, 0, 0] + """ + return str(list(self._path)) + + def _repr_lattice(self, type=None, labelling=None): + r""" + See :meth:`pretty_print()`. + + TESTS:: + + sage: print(NuDyckWord('00011001000100','00011001000100')._repr_lattice(type='N-E', labelling=[1,2,3,4])) + ____ + _____| . . 4 + ___| . . . . . 3 + | . . . . . . . 2 + ______| . . . . . . . 1 + + + sage: print(NuDyckWord('100101','010011')._repr_lattice()) + _| + ___|x + |x . . + + sage: print(NuDyckWord('110010','001011')._repr_lattice()) + __ + ___|x + |x x x + |x x . + + + """ + if type is None: + type = self.parent().options.diagram_style + if type == "grid": + type = "N-E" + + if type == "N-E": + path_length = self._path.length() + height = self._path.height() + width = self._path.width() + if path_length == 0: + return ".\n" + + # Handle right-hand side labels + if labelling is None: + labels = [" "] * height + else: + if len(labelling) != height: + raise ValueError( + "The given labelling has the wrong length. {num} needed".format(num=height)) + labels = [str(label) for label in labelling] + max_length = max(len(label) for label in labels) + labels = [lbl.rjust(max_length + 1) for lbl in labels] + + rev_path = list(self._path.reversal()) + rev_nu_path = list(self._nu.reversal()) + ts = "" + + # Grab first line + cur_pos = rev_path.index(ndw_open_symbol) + cur_nu_pos = rev_nu_path.index(ndw_open_symbol) + if cur_pos > 0: + ts += " " * (width - cur_pos) + ts += " _" + "__" * (cur_pos-1) + ts += "_\n" + + # Middle Lines + for i in range(height-1): + old_pos = cur_pos + old_nu_pos = cur_nu_pos + cur_pos = rev_path.index(ndw_open_symbol, cur_pos + 1) + cur_nu_pos = rev_nu_path.index(ndw_open_symbol, cur_nu_pos + 1) + + ts += " " * (width - cur_pos + i + 1) + if cur_pos != old_pos + 1: + ts += " _" + "__" * (cur_pos - old_pos - 2) + ts += "|" + if old_pos >= 0: + ts += "x " * (old_pos - old_nu_pos) + ts += " ." * (old_nu_pos - i) + ts += labels[height-i-1] + ts += "\n" + + # Final line + ts += "__" * (path_length - cur_pos - 1) + ts += "|" + ts += "x " * (cur_pos - cur_nu_pos) + ts += " ." * (cur_nu_pos - i - 1) + ts += labels[0] + ts += "\n" + return ts + else: + raise ValueError("The given type (=%s) is not valid." % type) + + def _ascii_art_(self): + r""" + Return an ASCII art representation of ``self``. + + TESTS:: + + sage: ascii_art(NuDyckWord('00011001000100','00011001000100')) + ____ + _____| . . + ___| . . . . . + | . . . . . . . + ______| . . . . . . . + + """ + from sage.typeset.ascii_art import AsciiArt + rep = self.parent().options.ascii_art + if rep == "pretty_output": + ret = self._repr_lattice() + return AsciiArt(ret.splitlines(), baseline=0) + + def __str__(self): + r""" + Return a string consisting of N and E steps corresponding to + the `\nu`-Dyck word. + + EXAMPLES:: + + sage: str(NuDyckWord('100101','010011')) + 'NEENEN' + sage: str(NuDyckWord('101010','100110')) + 'NENENE' + """ + return "".join(map(replace_dyck_symbol, list(self._path))) + + def pretty_print(self, type=None, labelling=None): + r""" + Display a NuDyckWord as a lattice path in the `\ZZ^2` grid. + + If the ``type`` is "N-E", then a cell below the diagonal is + indicated by a period, whereas a cell below the path but above + the diagonal is indicated by an x. If a list of labels is + included, they are displayed along the vertical edges of the + Dyck path. + + INPUT: + + - ``type`` -- (default: ``None``) can either be: + + - ``None`` to use the option default + - "N-E" to show ``self`` as a path of north and east steps, or + + - ``labelling`` -- (if type is "N-E") a list of labels assigned to + the up steps in ``self``. + + - ``underpath`` -- (if type is "N-E", default: ``True``) If ``True``, + an ``x`` to show the boxes between `\nu` and the `\nu`-Dyck Path. + + EXAMPLES:: + + sage: for ND in NuDyckWords('101010'): ND.pretty_print() + ______ + |x x . + |x . . + | . . . + ____ + _|x . + |x . . + | . . . + __ + ___| . + |x . . + | . . . + ____ + |x . + _| . . + | . . . + __ + _| . + _| . . + | . . . + + :: + + sage: ND = NuDyckWord([1,1,1,0,1,0,0,1,1,0,0,0],[1,0,1,0,1,0,1,0,1,0,1,0]) + sage: ND.pretty_print() + ______ + |x x . + ___|x . . + _|x x . . . + |x x . . . . + |x . . . . . + | . . . . . . + + :: + + sage: NuDyckWord([1,1,0,0,1,0],[1,0,1,0,1,0]).pretty_print( + ....: labelling=[1,3,2]) + __ + ___| . 2 + |x . . 3 + | . . . 1 + + :: + + sage: NuDyckWord('1101110011010010001101111000110000', + ....: '1010101010101010101010101010101010').pretty_print( + ....: labelling=list(range(1,18))) + ________ + |x x x . 17 + _____|x x . . 16 + |x x x x . . . 15 + |x x x . . . . 14 + |x x . . . . . 13 + _|x . . . . . . 12 + |x . . . . . . . 11 + _____| . . . . . . . . 10 + ___|x x . . . . . . . . . 9 + _|x x x . . . . . . . . . . 8 + |x x x . . . . . . . . . . . 7 + ___|x x . . . . . . . . . . . . 6 + |x x x . . . . . . . . . . . . . 5 + |x x . . . . . . . . . . . . . . 4 + _|x . . . . . . . . . . . . . . . 3 + |x . . . . . . . . . . . . . . . . 2 + | . . . . . . . . . . . . . . . . . 1 + + + :: + + sage: NuDyckWord().pretty_print() + . + """ + print(self._repr_lattice(type, labelling)) + + pp = pretty_print + + def _latex_(self): + r""" + A latex representation of ``self`` using the tikzpicture package. + + EXAMPLES:: + sage: NDW = NuDyckWord('010','010') + sage: NDW.set_latex_options({"show_points":True}) + sage: latex(NDW) + \vcenter{\hbox{$\begin{tikzpicture}[scale=1] + \draw[dotted] (0, 0) grid (2, 1); + \draw[line width=2,color=black,fill=black](0, 0) circle (0.21); + \draw[line width=2,color=black,fill=black](1, 0) circle (0.21); + \draw[line width=2,color=black,fill=black](1, 1) circle (0.21); + \draw[line width=2,color=black,fill=black](2, 1) circle (0.21); + \draw[rounded corners=1, color=red, line width=1] (0, 0) -- (1, 0) -- (1, 1) -- (2, 1); + \draw[rounded corners=1, color=black, line width=2] (0, 0) -- (1, 0) -- (1, 1) -- (2, 1); + \end{tikzpicture}$}} + sage: NuDyckWord('01','01')._latex_() + '\\vcenter{\\hbox{$\\begin{tikzpicture}[scale=1]\n \\draw[dotted] (0, 0) grid (1, 1);\n \\draw[rounded corners=1, color=red, line width=1] (0, 0) -- (1, 0) -- (1, 1);\n \\draw[rounded corners=1, color=black, line width=2] (0, 0) -- (1, 0) -- (1, 1);\n\\end{tikzpicture}$}}' + sage: NuDyckWord('101100','101010')._latex_() + '\\vcenter{\\hbox{$\\begin{tikzpicture}[scale=1]\n \\draw[dotted] (0, 0) grid (3, 3);\n \\draw[rounded corners=1, color=red, line width=1] (0, 0) -- (0, 1) -- (1, 1) -- (1, 2) -- (2, 2) -- (2, 3) -- (3, 3);\n \\draw[rounded corners=1, color=black, line width=2] (0, 0) -- (0, 1) -- (1, 1) -- (1, 2) -- (1, 3) -- (2, 3) -- (3, 3);\n\\end{tikzpicture}$}}' + """ + latex.add_package_to_preamble_if_available("tikz") + latex_options = self.latex_options() + + # Start setting up tikz + res = "\\vcenter{\\hbox{$\\begin{tikzpicture}" + res += "[scale=" + str(latex_options['tikz_scale']) + "]" + res += "\n" + + # Setup background grid + if latex_options['show_grid']: + grid = [((0, 0), (self.width(), self.height()))] + for v1, v2 in grid: + res += " \\draw[dotted] %s grid %s;" % (str(v1), str(v2)) + res += "\n" + + # Add points if wanted + if latex_options['show_points']: + pt_color = latex_options['points_color'] + radius = 0.15 + .03 * latex_options['line width'] + for v in self.points(): + res += " \\draw[line width=2," + res += "color=%s,fill=%s]" % (pt_color, pt_color) + res += "%s circle (%s);" % (str(v), str(radius)) + res += "\n" + + # Add nu if wanted + if latex_options['show_nu']: + res += " \\draw[%s]" % (str(latex_options['nu_options'])) + for k, p in enumerate(self._nu.points()): + if k == 0: + res += " %s" % (str(p)) + else: + res += " -- %s" % (str(p)) + res += ";\n" + + # setup Path + res += " \\draw[rounded corners=1, color=%s, line width=%s]" % ( + latex_options['color'], + str(latex_options['line width']) + ) + for k, p in enumerate(self._path.points()): + if k == 0: + res += " %s" % (str(p)) + else: + res += " -- %s" % (str(p)) + res += ";\n" + res += "\\end{tikzpicture}$}}" + return res + + def plot(self, **kwds): + r""" + Plot a `\nu`-Dyck word as a continuous path. + + EXAMPLES:: + + sage: NDW = NuDyckWord('010','010') + sage: NDW.plot() + Graphics object consisting of 1 graphics primitive + """ + from sage.plot.plot import list_plot + return list_plot(list(self.points()), plotjoined=True, **kwds) + + def path(self): + r""" + Return the underlying path object + + EXAMPLES:: + + sage: NDW = NuDyckWord('10011001000','00100101001') + sage: NDW.path() + Path: 10011001000 + """ + return self._path + + def height(self): + r""" + Return the height of ``self``. + + The height is the number of ``north`` steps. + + EXAMPLES:: + + sage: NuDyckWord('1101110011010010001101111000110000', + ....: '1010101010101010101010101010101010').height() + 17 + """ + return self._path.height() + + def width(self): + r""" + Return the width of ``self``. + + The width is the number of ``east`` steps. + + EXAMPLES:: + + sage: NuDyckWord('110111001101001000110111100011000', + ....: '101010101010101010101010101010101').width() + 16 + """ + return self._path.width() + + def length(self): + r""" + Return the length of ``self``. + + The length is the total number of steps. + + EXAMPLES:: + + sage: NDW = NuDyckWord('10011001000','00100101001') + sage: NDW.length() + 11 + """ + return self._path.length() + + def points(self): + r""" + Returns an iter with the points on the `\nu`-Dyck path. + + EXAMPLES:: + + sage: list(NuDyckWord('110111001101001000110111100011000', + ....: '101010101010101010101010101010101')._path.points()) + [(0, 0), + (0, 1), + (0, 2), + (1, 2), + (1, 3), + (1, 4), + (1, 5), + (2, 5), + (3, 5), + (3, 6), + (3, 7), + (4, 7), + (4, 8), + (5, 8), + (6, 8), + (6, 9), + (7, 9), + (8, 9), + (9, 9), + (9, 10), + (9, 11), + (10, 11), + (10, 12), + (10, 13), + (10, 14), + (10, 15), + (11, 15), + (12, 15), + (13, 15), + (13, 16), + (13, 17), + (14, 17), + (15, 17), + (16, 17)] + """ + return self._path.points() + + def heights(self): + r""" + Return the heights of each point on ``self``. + + We view the Dyck word as a Dyck path from `(0,0)` to + `(x,y)` in the first quadrant by letting ``1``'s represent + steps in the direction `(0,1)` and ``0``'s represent steps in + the direction `(1,0)`. + + The heights is the sequence of the `y`-coordinates of all + `x+y` lattice points along the path. + + EXAMPLES:: + + sage: NuDyckWord('010','010').heights() + [0, 0, 1, 1] + sage: NuDyckWord('110100','101010').heights() + [0, 1, 2, 2, 3, 3, 3] + sage: NuDyckWord('110111001101001000110111100011000', + ....: '101010101010101010101010101010101').heights() + [0, + 1, + 2, + 2, + 3, + 4, + 5, + 5, + 5, + 6, + 7, + 7, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 10, + 11, + 11, + 12, + 13, + 14, + 15, + 15, + 15, + 15, + 16, + 17, + 17, + 17, + 17] + """ + return self._path.height_vector() + + def widths(self): + r""" + Return the widths of each point on ``self``. + + We view the Dyck word as a Dyck path from `(0,0)` to + `(x,y)` in the first quadrant by letting ``1``'s represent + steps in the direction `(0,1)` and ``0``'s represent steps in + the direction `(1,0)`. + + The widths is the sequence of the `x`-coordinates of all + `x+y` lattice points along the path. + + EXAMPLES:: + + sage: NuDyckWord('010','010').widths() + [0, 1, 1, 2] + sage: NuDyckWord('110100','101010').widths() + [0, 0, 0, 1, 1, 2, 3] + sage: NuDyckWord('110111001101001000110111100011000', + ....: '101010101010101010101010101010101').widths() + [0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 3, + 3, + 3, + 4, + 4, + 5, + 6, + 6, + 7, + 8, + 9, + 9, + 9, + 10, + 10, + 10, + 10, + 10, + 11, + 12, + 13, + 13, + 13, + 14, + 15, + 16] + """ + return self._path.width_vector() + + def horizontal_distance(self): + r""" + Return a list of how far each point is from `\nu`. + + EXAMPLES:: + + sage: NDW = NuDyckWord('10010100','00000111') + sage: NDW.horizontal_distance() + [5, 5, 4, 3, 3, 2, 2, 1, 0] + sage: NDW = NuDyckWord('10010100','00001011') + sage: NDW.horizontal_distance() + [4, 5, 4, 3, 3, 2, 2, 1, 0] + sage: NDW = NuDyckWord('10011001000','00100101001') + sage: NDW.horizontal_distance() + [2, 4, 3, 2, 3, 5, 4, 3, 3, 2, 1, 0] + + + """ + # Grab furthest east point at each height of nu + nu_points = list(self._nu.points()) + nu_easts = [max([i for i, j in nu_points if j == k]) + for k in range(self._nu.height()+1)] + + points = list(self._path.points()) + return [nu_easts[j] - i for i, j in points] + + def can_mutate(self, i): + """ + Return True/False based off if mutatable at height `i`. + + Can only mutate if an east step is followed by a north step at height + `i`. + + OUTPUT: + + - Whether we can mutate at height of `i`. + """ + if i > self.height() or i <= 0: + raise ValueError('Can\'t mutate above or below path') + + # Find the ith north step + level = 0 + ndw = self._list() + for j, k in enumerate(ndw): + if k == ndw_open_symbol: + level += 1 + if level == i: + break + if j > 0 and ndw[j-1] == ndw_close_symbol: + return j + return False + + def mutate(self, i): + r""" + return a new `\nu`-Dyck Word if possible. + + We mutate ``dEfg`` to ``dfEg`` where: + + - d is everything up until EN + + - f is everything between N and where horiz is same + + - g is everything after + """ + mutation_index = self.can_mutate(i) + if not mutation_index: + return None + + horiz = self.horizontal_distance() + # Find horiz in between East and North Step + horiz_num = horiz[mutation_index] + other_index = len(horiz) + for i in range(mutation_index + 1, len(horiz)): + if horiz[i] == horiz_num: + other_index = i + break + ndw = self._list() + d = ndw[0:mutation_index-1] + e = ndw[mutation_index:other_index] + f = ndw[other_index:] + return NuDyckWord(d + e + [ndw_close_symbol] + f, self._nu) + + +class NuDyckWords(Parent): + r""" + `\nu`-Dyck words. + + Given a lattice path `\nu` in the `\ZZ^2` grid starting at the origin + `(0,0)` consisting of North `N = (0,1)` and East `E = (1,0)` steps, a + `\nu`-Dyck path is a lattice path in the`\ZZ^2` grid starting at the + origin `(0,0)` and ending at the same coordinate as `\nu` such that it is + weakly above `\nu`. A `\nu`-Dyck word is the representation of a + `\nu`-Dyck path where a North step is represented by a 1 and an East step + is represented by a 0. + + INPUT: + + - ``nu`` -- the base lattice path. + + EXAMPLES:: + + sage: NDW = NuDyckWords('1010'); NDW + [1, 0, 1, 0] Dyck words + sage: [1,0,1,0] in NDW + True + sage: [1,1,0,0] in NDW + True + sage: [1,0,0,1] in NDW + False + sage: [0,1,0,1] in NDW + False + sage: NDW.cardinality() + 2 + """ + + Element = NuDyckWord + + def __init__(self, nu=tuple()): + """ + Intialize ``self``. + + EXAMPLES:: + + sage: TestSuite(NuDyckWords(nu=[1,0,1])).run() + """ + Parent.__init__(self, category=FiniteEnumeratedSets()) + + self._nu = to_word_path(nu) + if self._nu is None: + raise ValueError("Invalud nu supplied") + + # add options to class + class options(GlobalOptions): + r""" + Set and display the options for `\nu`-Dyck words. If no parameters + are set, then the function returns a copy of the options dictionary. + + The ``options`` to `\nu`-Dyck words can be accessed as the method + :meth:`NuDyckWords.options` of :class:`NuDyckWords` and + related parent classes. + + @OPTIONS + + EXAMPLES:: + + sage: ND = NuDyckWords('101') + sage: ND + [1, 0, 1] Dyck words + sage: ND.options + Current options for NuDyckWords + - ascii_art: pretty_output + - diagram_style: grid + - display: list + - latex_color: black + - latex_line_width_scalar: 2 + - latex_nu_options: rounded corners=1, color=red, line width=1 + - latex_points_color: black + - latex_show_grid: True + - latex_show_nu: True + - latex_show_points: False + - latex_tikz_scale: 1 + """ + NAME = 'NuDyckWords' + module = 'sage.combinat.nu_dyck_path' + display = dict(default="list", + description='Specifies how nu Dyck words should be printed', + values=dict(list='displayed as a list', + lattice='displayed on the lattice defined by ``diagram_style``'), + case_sensitive=False) + ascii_art = dict(default="pretty_output", + description='Specifies how the ascii art of nu Dyck words should be printed', + values=dict(pretty_output="Using pretty printing"), + alias=dict(pretty_print="pretty_output",), + case_sensitive=False) + diagram_style = dict(default="grid", + values=dict( + grid='printing as paths on a grid using N and E steps',), + alias={'N-E': 'grid'}, + case_sensitive=False) + latex_tikz_scale = dict(default=1, + description='The default value for the tikz scale when latexed', + checker=lambda x: True) # More trouble than it's worth to check + latex_line_width_scalar = dict(default=2, + description='The default value for the line width as a ' + 'multiple of the tikz scale when latexed', + checker=lambda x: True) # More trouble than it's worth to check + latex_color = dict(default="black", + description='The default value for the color when latexed', + checker=lambda x: isinstance(x, str)) + latex_show_points = dict(default=False, + description='The default value for showing points', + checker=lambda x: isinstance(x, bool)) + latex_points_color = dict(default='black', + description='The default value for path color.', + checker=lambda x: isinstance(x, str)) + latex_show_grid = dict(default=True, + description='The default value for showing grid', + checker=lambda x: isinstance(x, bool)) + latex_show_nu = dict(default=True, + description='The default value for showing nu', + checker=lambda x: isinstance(x, bool)) + latex_nu_options = dict(default='rounded corners=1, color=red, line width=1', + description='The default value for options for nu path', + checker=lambda x: isinstance(x, str)) + + def _element_constructor_(self, word): + """ + Construct an element of ``self``. + + EXAMPLES:: + + sage: NDW = NuDyckWords('101') + sage: elt = NDW('110'); elt + [1, 1, 0] + sage: elt.parent() is NDW + True + + """ + if isinstance(word, NuDyckWord) and word.parent() is self: + return word + return self.element_class(self, to_word_path(word)) + + def __contains__(self, x): + r""" + TESTS:: + + sage: NDW = NuDyckWords([1,0,1,1]) + sage: [1,1,0,1] in NDW + True + sage: [1,0,1,1] in NDW + True + sage: [0] in NDW + False + sage: [1, 0] in NDW + False + """ + return path_weakly_above_other(to_word_path(x), self._nu) + + def __eq__(self, other): + """ + Return equality. + """ + if type(other) != type(self): + return False + return self._nu == other._nu + + def __neq__(self, other): + """ + Return inequality. + """ + return not self.__eq__(other) + + def _repr_(self): + r""" + TESTS:: + + sage: NuDyckWords([1,0,1,1]) + [1, 0, 1, 1] Dyck words + """ + return "{nu} Dyck words".format(nu=list(self._nu)) + + def _cache_key(self): + """ + Return a cache key + """ + return str(self._nu) + + def _an_element_(self): + r""" + TESTS:: + + sage: NuDyckWords('101').an_element() + [1, 0, 1] + + """ + return self.element_class(self, self._nu) + + def __iter__(self): + """ + Iterate over ``self``. + + EXAMPLES:: + + sage: it = NuDyckWords('101010').__iter__() + sage: [i for i in it] + [[1, 1, 1, 0, 0, 0], + [1, 1, 0, 1, 0, 0], + [1, 1, 0, 0, 1, 0], + [1, 0, 1, 1, 0, 0], + [1, 0, 1, 0, 1, 0]] + + """ + P = Permutations(list(self._nu)) + for p in P: + if path_weakly_above_other(to_word_path(p), self._nu): + yield self.element_class(self, list(p)) + + def cardinality(self): + r""" + Return the number of `\nu`-Dyck words. + + EXAMPLES:: + + sage: NDW = NuDyckWords('101010'); NDW.cardinality() + 5 + sage: NDW = NuDyckWords('1010010'); NDW.cardinality() + 7 + sage: NDW = NuDyckWords('100100100'); NDW.cardinality() + 12 + """ + i = 0 + for i, j in enumerate(self): + pass + return Integer(i + 1) + + +def to_word_path(word): + r""" + Helper function which converts input into a word path over an appropriate + alphabet. + + INPUT: + + - ``word`` -- word to convert to wordpath + + OUTPUT: + + - A ``FiniteWordPath_north_east`` object. + + EXAMPLES:: + + sage: from sage.combinat.nu_dyck_word import to_word_path + sage: wp = to_word_path('NEENENEN'); wp + Path: 10010101 + sage: from sage.combinat.words.paths import FiniteWordPath_north_east + sage: isinstance(wp,FiniteWordPath_north_east) + True + sage: to_word_path('1001') + Path: 1001 + sage: to_word_path([0,1,0,0,1,0]) + Path: 010010 + """ + + # If we already have the object, don't worry + if isinstance(word, FiniteWordPath_north_east): + return word + + # If we have a Nu Dyck Path, return the path it contains + if isinstance(word, NuDyckWord): + return word.path() + + # if we have a string, convert to list + if isinstance(word, str): + word = map(replace_dyck_char, word) + + # By default "north" is first symbol, "east" is second symbol + P = WordPaths_north_east([ndw_open_symbol, ndw_close_symbol]) + + return P(word) + + +def path_weakly_above_other(path, other): + r""" + Tests if ``path`` is weakly above ``other``. + + A path `P` is wealy above another path `Q` if `P` and `Q` are the same + length and if any prefix of length `n` of `Q` contains more North steps + than the prefix of length `n` of `P`. + + INPUT: + + - ``path`` -- The path to verify is weakly above the other path. + + - ``other`` -- The other path to verify is weakly below the path. + + OUTPUT: + + - bool + + EXAMPLES:: + + sage: from sage.combinat.nu_dyck_word import path_weakly_above_other + sage: path_weakly_above_other('1001','0110') + False + sage: path_weakly_above_other('1001','0101') + True + sage: path_weakly_above_other('1111','0101') + False + sage: path_weakly_above_other('111100','0101') + False + """ + # Ensure we have word paths: + path = to_word_path(path) + other = to_word_path(other) + + # Must be same length and must have same height + if path.length() != other.length() or path.height() != other.height(): + return False + + # path is above other if height is always >= height of other + p_height = path.height_vector() + o_height = other.height_vector() + for i, j in enumerate(p_height): + if(o_height[i] > j): + return False + return True + + +def is_nu_path(path, nu): + r""" + Test if ``path`` is a `\nu`-Dyck word. + + A ``path`` is a `\nu`-Dyck word if ``path`` is weakly above the path of + `\nu`. + + .. SEEALSO:: :meth:`path_weakly_above_other` + """ + return path_weakly_above_other(path, nu) diff --git a/src/sage/combinat/nu_tamari_lattice.py b/src/sage/combinat/nu_tamari_lattice.py new file mode 100644 index 00000000000..5762ba8aae2 --- /dev/null +++ b/src/sage/combinat/nu_tamari_lattice.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +r""" +`\nu`-Tamari lattice + +A class of the `\nu`-Tamari lattice, see [PRV2017]_ for details. + +These lattices depend on one parameter `\nu` where `\nu` is a path of North +and East steps. + +The elements are :func:`\nu-Dyck paths` +which are weakly above `\nu`. + +To use the provided functionality, you should import `\nu`-Tamari lattices by +typing:: + + sage: from sage.combinat.nu_tamari_lattice import NuTamariLattice + +Then, :: + + sage: NuTamariLattice([1,1,1,0,0,1,1,0]) + Finite lattice containing 6 elements + sage: NuTamariLattice([0,0,0,1,1,0,0,1]) + Finite lattice containing 40 elements + +The classical **Tamari lattices** and the **Generalized Tamari lattices** are +special cases of this construction and are also available with this poset:: + + sage: NuTamariLattice([1,0,1,0,1,0]) + Finite lattice containing 5 elements + + sage: NuTamariLattice([1,0,0,1,0,0,1,0,0]) + Finite lattice containing 12 elements + +.. SEEALSO:: + + For more detailed information see :meth:`NuTamariLattice`. For more + information on the standard Tamari lattice see + :meth:`sage.combinat.tamari_lattices.TamariLattice`, + :meth:`sage.combinat.tamar_lattices.GeneralizedTamariLattice` +""" +# **************************************************************************** +# Copyright (C) 2020-2020 Aram Dermenjian +# +# Distributed under the terms of the GNU General Public License (GPL) +# +# This code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# The full text of the GPL is available at: +# +# https://www.gnu.org/licenses/ +# **************************************************************************** +from sage.combinat.nu_dyck_word import NuDyckWords +from sage.combinat.posets.lattices import LatticePoset + + +def NuTamariLattice(nu): + r""" + Return the `\nu`-Tamari lattice. + + INPUT: + + - `\nu` -- a list of of 0s and 1s or a string of 0s and 1s. + + OUTPUT: + + - a finite lattice + + The elements of the lattice are + :func:`\nu-Dyck paths` weakly above + `\nu`. + + The usual :wikipedia:`Tamari lattice` is the special case + where `\nu = (NE)^h` where `h` is the height. + + Other special cases give the `m`-Tamari lattices studied in [BMFPR]_. + + EXAMPLES:: + + sage: from sage.combinat.nu_tamari_lattices import NuTamariLattice + sage: NuTamariLattice([1,0,1,0,0,1,0]) + Finite lattice containing 7 elements + sage: NuTamariLattice([1,0,1,0,1,0]) + Finite lattice containing 5 elements + sage: NuTamariLattice([1,0,1,0,1,0,1,0]) + Finite lattice containing 14 elements + sage: NuTamariLattice([1,0,1,0,1,0,0,0,1]) + Finite lattice containing 24 elements + + """ + + NDW = NuDyckWords(nu) + + covers = [] + elements = [] + height = NDW[0].height() + for ndw in NDW: + elements.append(ndw) + for i in range(1, height+1): + new_ndw = ndw.mutate(i) + if new_ndw is not None: + covers.append([ndw, new_ndw]) + return LatticePoset([elements, covers]) diff --git a/src/sage/combinat/words/paths.py b/src/sage/combinat/words/paths.py index 2a847391252..b0f0d8c1427 100644 --- a/src/sage/combinat/words/paths.py +++ b/src/sage/combinat/words/paths.py @@ -1781,6 +1781,25 @@ def height(self): """ return self.ymax() - self.ymin() + def height_vector(self): + r""" + Returns the height at each point. + """ + h_vec = [] + y_min = None + y_max = None + for (_, y) in self.points(): + if y_min is None: + y_min = y + y_max = y + else: + if y > y_max: + y_max = y + if y < y_min: + y_min = y + h_vec.append(y_max - y_min) + return h_vec + def width(self): r""" Returns the width of self. @@ -1822,6 +1841,25 @@ def width(self): """ return self.xmax() - self.xmin() + def width_vector(self): + r""" + Returns the width at each point. + """ + w_vec = [] + x_min = None + x_max = None + for (x, _) in self.points(): + if x_min is None: + x_min = x + x_max = x + else: + if x > x_max: + x_max = x + if x < x_min: + x_min = x + w_vec.append(x_max - x_min) + return w_vec + def xmin(self): r""" Returns the minimum of the x-coordinates of the path. From 1cdf03896235ad84c8b524d5d3293d20a06c763e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 7 May 2022 20:43:07 +0200 Subject: [PATCH 132/338] reviewer commit --- src/sage/combinat/nu_dyck_word.py | 177 +++++++------------------ src/sage/combinat/nu_tamari_lattice.py | 6 +- 2 files changed, 52 insertions(+), 131 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index 07b39d3e965..633ddf7bd44 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -8,12 +8,12 @@ - Aram Dermenjian (2020-09-26) -This file is based off the class ``DyckWords`` written by Mke Hansen, Dan +This file is based off the class +:func:`DyckWords` written by Mike Hansen, Dan Drake, Florent Hivert, Christian Stump, Mike Zabrocki, Jean--Baptiste Priez and Travis Scrimshaw """ - # **************************************************************************** # Copyright (C) 2020 Aram Dermenjian , # @@ -100,10 +100,9 @@ def replace_dyck_char(x): """ if x == '(' or x == 'N' or x == str(ndw_open_symbol): return ndw_open_symbol - elif x == ')' or x == 'E' or x == str(ndw_close_symbol): + if x == ')' or x == 'E' or x == str(ndw_close_symbol): return ndw_close_symbol - else: - raise ValueError + raise ValueError def replace_dyck_symbol(x, open_char='N', close_char='E'): @@ -148,10 +147,9 @@ def replace_dyck_symbol(x, open_char='N', close_char='E'): """ if x == ndw_open_symbol: return open_char - elif x == ndw_close_symbol: + if x == ndw_close_symbol: return close_char - else: - raise ValueError + raise ValueError class NuDyckWord(CombinatorialElement): @@ -225,7 +223,6 @@ def __classcall_private__(cls, dw=None, nu=None, **kwargs): sage: NuDyckWord('010','010') [0, 1, 0] """ - # if dw is none, then we might have a normal Dyck word if dw is None: from sage.combinat.dyck_word import DyckWord @@ -250,7 +247,7 @@ def __init__(self, parent, dw, latex_options={}): self._path = to_word_path(dw) if parent is None: - raise ValueError("Need Parent object") + raise ValueError("need parent object") self._nu = parent._nu @@ -460,7 +457,7 @@ def _repr_list(self): """ return str(list(self._path)) - def _repr_lattice(self, type=None, labelling=None): + def _repr_lattice(self, typ=None, labelling=None): r""" See :meth:`pretty_print()`. @@ -487,12 +484,12 @@ def _repr_lattice(self, type=None, labelling=None): """ - if type is None: - type = self.parent().options.diagram_style - if type == "grid": - type = "N-E" + if typ is None: + typ = self.parent().options.diagram_style + if typ == "grid": + typ = "N-E" - if type == "N-E": + if typ == "N-E": path_length = self._path.length() height = self._path.height() width = self._path.width() @@ -505,7 +502,7 @@ def _repr_lattice(self, type=None, labelling=None): else: if len(labelling) != height: raise ValueError( - "The given labelling has the wrong length. {num} needed".format(num=height)) + "the given labelling has the wrong length: {num} needed".format(num=height)) labels = [str(label) for label in labelling] max_length = max(len(label) for label in labels) labels = [lbl.rjust(max_length + 1) for lbl in labels] @@ -519,11 +516,11 @@ def _repr_lattice(self, type=None, labelling=None): cur_nu_pos = rev_nu_path.index(ndw_open_symbol) if cur_pos > 0: ts += " " * (width - cur_pos) - ts += " _" + "__" * (cur_pos-1) + ts += " _" + "__" * (cur_pos - 1) ts += "_\n" # Middle Lines - for i in range(height-1): + for i in range(height - 1): old_pos = cur_pos old_nu_pos = cur_nu_pos cur_pos = rev_path.index(ndw_open_symbol, cur_pos + 1) @@ -536,7 +533,7 @@ def _repr_lattice(self, type=None, labelling=None): if old_pos >= 0: ts += "x " * (old_pos - old_nu_pos) ts += " ." * (old_nu_pos - i) - ts += labels[height-i-1] + ts += labels[height - i - 1] ts += "\n" # Final line @@ -547,8 +544,7 @@ def _repr_lattice(self, type=None, labelling=None): ts += labels[0] ts += "\n" return ts - else: - raise ValueError("The given type (=%s) is not valid." % type) + raise ValueError(f"the given type (={typ}) is not valid") def _ascii_art_(self): r""" @@ -691,6 +687,7 @@ def _latex_(self): A latex representation of ``self`` using the tikzpicture package. EXAMPLES:: + sage: NDW = NuDyckWord('010','010') sage: NDW.set_latex_options({"show_points":True}) sage: latex(NDW) @@ -772,7 +769,7 @@ def plot(self, **kwds): def path(self): r""" - Return the underlying path object + Return the underlying path object. EXAMPLES:: @@ -826,7 +823,7 @@ def length(self): def points(self): r""" - Returns an iter with the points on the `\nu`-Dyck path. + Return an iterator for the points on the `\nu`-Dyck path. EXAMPLES:: @@ -887,42 +884,6 @@ def heights(self): [0, 0, 1, 1] sage: NuDyckWord('110100','101010').heights() [0, 1, 2, 2, 3, 3, 3] - sage: NuDyckWord('110111001101001000110111100011000', - ....: '101010101010101010101010101010101').heights() - [0, - 1, - 2, - 2, - 3, - 4, - 5, - 5, - 5, - 6, - 7, - 7, - 8, - 8, - 8, - 9, - 9, - 9, - 9, - 10, - 11, - 11, - 12, - 13, - 14, - 15, - 15, - 15, - 15, - 16, - 17, - 17, - 17, - 17] """ return self._path.height_vector() @@ -944,42 +905,6 @@ def widths(self): [0, 1, 1, 2] sage: NuDyckWord('110100','101010').widths() [0, 0, 0, 1, 1, 2, 3] - sage: NuDyckWord('110111001101001000110111100011000', - ....: '101010101010101010101010101010101').widths() - [0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 3, - 3, - 3, - 4, - 4, - 5, - 6, - 6, - 7, - 8, - 9, - 9, - 9, - 10, - 10, - 10, - 10, - 10, - 11, - 12, - 13, - 13, - 13, - 14, - 15, - 16] """ return self._path.width_vector() @@ -998,20 +923,18 @@ def horizontal_distance(self): sage: NDW = NuDyckWord('10011001000','00100101001') sage: NDW.horizontal_distance() [2, 4, 3, 2, 3, 5, 4, 3, 3, 2, 1, 0] - - """ # Grab furthest east point at each height of nu - nu_points = list(self._nu.points()) - nu_easts = [max([i for i, j in nu_points if j == k]) - for k in range(self._nu.height()+1)] + nu_points = self._nu.points() + nu_easts = [max(i for i, j in nu_points if j == k) + for k in range(self._nu.height() + 1)] points = list(self._path.points()) return [nu_easts[j] - i for i, j in points] - def can_mutate(self, i): + def can_mutate(self, i) -> bool: """ - Return True/False based off if mutatable at height `i`. + Return True/False based off if mutable at height `i`. Can only mutate if an east step is followed by a north step at height `i`. @@ -1021,7 +944,7 @@ def can_mutate(self, i): - Whether we can mutate at height of `i`. """ if i > self.height() or i <= 0: - raise ValueError('Can\'t mutate above or below path') + raise ValueError('cannot mutate above or below path') # Find the ith north step level = 0 @@ -1031,21 +954,26 @@ def can_mutate(self, i): level += 1 if level == i: break - if j > 0 and ndw[j-1] == ndw_close_symbol: + if j > 0 and ndw[j - 1] == ndw_close_symbol: return j return False def mutate(self, i): r""" - return a new `\nu`-Dyck Word if possible. + Return a new `\nu`-Dyck Word if possible. - We mutate ``dEfg`` to ``dfEg`` where: + If at height `i` we have an east step E meeting a north step N then we + calculate all horizontal distances from this point until we find + the first point that has the same horizontal distance to `\nu`. We let - - d is everything up until EN + - d is everything up until EN (not including EN) - - f is everything between N and where horiz is same + - f be everything between N and the point with the same horizontal + distance (including N) - - g is everything after + - g is everything after f + + .. SEEALSO:: :meth:`can_mutate` """ mutation_index = self.can_mutate(i) if not mutation_index: @@ -1060,7 +988,7 @@ def mutate(self, i): other_index = i break ndw = self._list() - d = ndw[0:mutation_index-1] + d = ndw[0:mutation_index - 1] e = ndw[mutation_index:other_index] f = ndw[other_index:] return NuDyckWord(d + e + [ndw_close_symbol] + f, self._nu) @@ -1100,7 +1028,7 @@ class NuDyckWords(Parent): Element = NuDyckWord - def __init__(self, nu=tuple()): + def __init__(self, nu=()): """ Intialize ``self``. @@ -1112,7 +1040,7 @@ def __init__(self, nu=tuple()): self._nu = to_word_path(nu) if self._nu is None: - raise ValueError("Invalud nu supplied") + raise ValueError("invalid nu supplied") # add options to class class options(GlobalOptions): @@ -1199,13 +1127,12 @@ def _element_constructor_(self, word): [1, 1, 0] sage: elt.parent() is NDW True - """ if isinstance(word, NuDyckWord) and word.parent() is self: return word return self.element_class(self, to_word_path(word)) - def __contains__(self, x): + def __contains__(self, x) -> bool: r""" TESTS:: @@ -1225,7 +1152,7 @@ def __eq__(self, other): """ Return equality. """ - if type(other) != type(self): + if not isinstance(other, NuDyckWords): return False return self._nu == other._nu @@ -1256,7 +1183,6 @@ def _an_element_(self): sage: NuDyckWords('101').an_element() [1, 0, 1] - """ return self.element_class(self, self._nu) @@ -1273,10 +1199,8 @@ def __iter__(self): [1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0]] - """ - P = Permutations(list(self._nu)) - for p in P: + for p in Permutations(list(self._nu)): if path_weakly_above_other(to_word_path(p), self._nu): yield self.element_class(self, list(p)) @@ -1293,9 +1217,7 @@ def cardinality(self): sage: NDW = NuDyckWords('100100100'); NDW.cardinality() 12 """ - i = 0 - for i, j in enumerate(self): - pass + i = len(list(self)) return Integer(i + 1) @@ -1325,7 +1247,6 @@ def to_word_path(word): sage: to_word_path([0,1,0,0,1,0]) Path: 010010 """ - # If we already have the object, don't worry if isinstance(word, FiniteWordPath_north_east): return word @@ -1344,9 +1265,9 @@ def to_word_path(word): return P(word) -def path_weakly_above_other(path, other): +def path_weakly_above_other(path, other) -> bool: r""" - Tests if ``path`` is weakly above ``other``. + Test if ``path`` is weakly above ``other``. A path `P` is wealy above another path `Q` if `P` and `Q` are the same length and if any prefix of length `n` of `Q` contains more North steps @@ -1360,7 +1281,7 @@ def path_weakly_above_other(path, other): OUTPUT: - - bool + bool EXAMPLES:: @@ -1391,7 +1312,7 @@ def path_weakly_above_other(path, other): return True -def is_nu_path(path, nu): +def is_nu_path(path, nu) -> bool: r""" Test if ``path`` is a `\nu`-Dyck word. diff --git a/src/sage/combinat/nu_tamari_lattice.py b/src/sage/combinat/nu_tamari_lattice.py index 5762ba8aae2..f6cb83bbd5b 100644 --- a/src/sage/combinat/nu_tamari_lattice.py +++ b/src/sage/combinat/nu_tamari_lattice.py @@ -36,7 +36,7 @@ For more detailed information see :meth:`NuTamariLattice`. For more information on the standard Tamari lattice see :meth:`sage.combinat.tamari_lattices.TamariLattice`, - :meth:`sage.combinat.tamar_lattices.GeneralizedTamariLattice` + :meth:`sage.combinat.tamari_lattices.GeneralizedTamariLattice` """ # **************************************************************************** # Copyright (C) 2020-2020 Aram Dermenjian @@ -79,7 +79,7 @@ def NuTamariLattice(nu): EXAMPLES:: - sage: from sage.combinat.nu_tamari_lattices import NuTamariLattice + sage: from sage.combinat.nu_tamari_lattice import NuTamariLattice sage: NuTamariLattice([1,0,1,0,0,1,0]) Finite lattice containing 7 elements sage: NuTamariLattice([1,0,1,0,1,0]) @@ -98,7 +98,7 @@ def NuTamariLattice(nu): height = NDW[0].height() for ndw in NDW: elements.append(ndw) - for i in range(1, height+1): + for i in range(1, height + 1): new_ndw = ndw.mutate(i) if new_ndw is not None: covers.append([ndw, new_ndw]) From 45ac1d12adf984889700b52357bc1288e131d07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 7 May 2022 21:22:13 +0200 Subject: [PATCH 133/338] adding doctests in words.paths --- src/sage/combinat/words/paths.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/words/paths.py b/src/sage/combinat/words/paths.py index b0f0d8c1427..3a6ac3ef29b 100644 --- a/src/sage/combinat/words/paths.py +++ b/src/sage/combinat/words/paths.py @@ -1783,12 +1783,19 @@ def height(self): def height_vector(self): r""" - Returns the height at each point. + Return the height at each point. + + EXAMPLES:: + + sage: Paths = WordPaths('ab', steps=[(1,0),(0,1)]) + sage: p = Paths('abbba') + sage: p.height_vector() + [0, 0, 1, 2, 3, 3] """ h_vec = [] y_min = None y_max = None - for (_, y) in self.points(): + for _, y in self.points(): if y_min is None: y_min = y y_max = y @@ -1843,12 +1850,19 @@ def width(self): def width_vector(self): r""" - Returns the width at each point. + Return the width at each point. + + EXAMPLES:: + + sage: Paths = WordPaths('ab', steps=[(1,0),(0,1)]) + sage: p = Paths('abbba') + sage: p.width_vector() + [0, 1, 1, 1, 1, 2] """ w_vec = [] x_min = None x_max = None - for (x, _) in self.points(): + for x, _ in self.points(): if x_min is None: x_min = x x_max = x From 71c60d6fb5adcfbfe29db98837bedb458ae0c776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 7 May 2022 21:38:33 +0200 Subject: [PATCH 134/338] fix back the doctests --- src/sage/combinat/nu_dyck_word.py | 53 ++++++++++++++----------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index 633ddf7bd44..dad59c801b1 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -255,27 +255,27 @@ def __init__(self, parent, dw, latex_options={}): def _list(self): """ - Return list of self + Return list of ``self``. """ return list(self._path) def __eq__(self, other): """ - Return if two paths are equal + Return if two paths are equal. """ - if type(other) != type(self): + if not isinstance(other, NuDyckWord): return False return self._path == other._path and self._nu == other._nu def __neq__(self, other): """ - Return if two paths are not equal + Return if two paths are not equal. """ return not self.__eq__(other) def __le__(self, other): """ - Returns if one path is included in another + Return if one path is included in another. """ if self._nu == other._nu: return path_weakly_above_other(other._path, self._path) @@ -457,13 +457,13 @@ def _repr_list(self): """ return str(list(self._path)) - def _repr_lattice(self, typ=None, labelling=None): + def _repr_lattice(self, style=None, labelling=None): r""" See :meth:`pretty_print()`. TESTS:: - sage: print(NuDyckWord('00011001000100','00011001000100')._repr_lattice(type='N-E', labelling=[1,2,3,4])) + sage: print(NuDyckWord('00011001000100','00011001000100')._repr_lattice(style='N-E', labelling=[1,2,3,4])) ____ _____| . . 4 ___| . . . . . 3 @@ -481,15 +481,13 @@ def _repr_lattice(self, typ=None, labelling=None): ___|x |x x x |x x . - - """ - if typ is None: - typ = self.parent().options.diagram_style - if typ == "grid": - typ = "N-E" + if style is None: + style = self.parent().options.diagram_style + if style == "grid": + style = "N-E" - if typ == "N-E": + if style == "N-E": path_length = self._path.length() height = self._path.height() width = self._path.width() @@ -501,8 +499,7 @@ def _repr_lattice(self, typ=None, labelling=None): labels = [" "] * height else: if len(labelling) != height: - raise ValueError( - "the given labelling has the wrong length: {num} needed".format(num=height)) + raise ValueError(f"the given labelling has the wrong length: {height} needed") labels = [str(label) for label in labelling] max_length = max(len(label) for label in labels) labels = [lbl.rjust(max_length + 1) for lbl in labels] @@ -544,7 +541,7 @@ def _repr_lattice(self, typ=None, labelling=None): ts += labels[0] ts += "\n" return ts - raise ValueError(f"the given type (={typ}) is not valid") + raise ValueError(f"the given style (={style}) is not valid") def _ascii_art_(self): r""" @@ -580,11 +577,11 @@ def __str__(self): """ return "".join(map(replace_dyck_symbol, list(self._path))) - def pretty_print(self, type=None, labelling=None): + def pretty_print(self, style=None, labelling=None): r""" Display a NuDyckWord as a lattice path in the `\ZZ^2` grid. - If the ``type`` is "N-E", then a cell below the diagonal is + If the ``style`` is "N-E", then a cell below the diagonal is indicated by a period, whereas a cell below the path but above the diagonal is indicated by an x. If a list of labels is included, they are displayed along the vertical edges of the @@ -592,15 +589,15 @@ def pretty_print(self, type=None, labelling=None): INPUT: - - ``type`` -- (default: ``None``) can either be: + - ``style`` -- (default: ``None``) can either be: - ``None`` to use the option default - "N-E" to show ``self`` as a path of north and east steps, or - - ``labelling`` -- (if type is "N-E") a list of labels assigned to + - ``labelling`` -- (if style is "N-E") a list of labels assigned to the up steps in ``self``. - - ``underpath`` -- (if type is "N-E", default: ``True``) If ``True``, + - ``underpath`` -- (if style is "N-E", default: ``True``) If ``True``, an ``x`` to show the boxes between `\nu` and the `\nu`-Dyck Path. EXAMPLES:: @@ -678,7 +675,7 @@ def pretty_print(self, type=None, labelling=None): sage: NuDyckWord().pretty_print() . """ - print(self._repr_lattice(type, labelling)) + print(self._repr_lattice(style, labelling)) pp = pretty_print @@ -925,7 +922,7 @@ def horizontal_distance(self): [2, 4, 3, 2, 3, 5, 4, 3, 3, 2, 1, 0] """ # Grab furthest east point at each height of nu - nu_points = self._nu.points() + nu_points = list(self._nu.points()) nu_easts = [max(i for i, j in nu_points if j == k) for k in range(self._nu.height() + 1)] @@ -1217,8 +1214,7 @@ def cardinality(self): sage: NDW = NuDyckWords('100100100'); NDW.cardinality() 12 """ - i = len(list(self)) - return Integer(i + 1) + return Integer(len([1 for _ in self.__iter__()])) def to_word_path(word): @@ -1306,10 +1302,7 @@ def path_weakly_above_other(path, other) -> bool: # path is above other if height is always >= height of other p_height = path.height_vector() o_height = other.height_vector() - for i, j in enumerate(p_height): - if(o_height[i] > j): - return False - return True + return all(p_h >= o_h for p_h, o_h in zip(p_height, o_height)) def is_nu_path(path, nu) -> bool: From eef9e4163ad14b49c09480f08af03c8ce582d367 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 21:55:58 -0700 Subject: [PATCH 135/338] build/pkgs/python3/spkg-configure.m4: Check for module ensurepip --- build/pkgs/python3/spkg-configure.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4 index 27af5be576d..a4605a001fa 100644 --- a/build/pkgs/python3/spkg-configure.m4 +++ b/build/pkgs/python3/spkg-configure.m4 @@ -24,7 +24,7 @@ SAGE_SPKG_CONFIGURE([python3], [ dnl Check if we can do venv with a system python3 dnl instead of building our own copy. dnl Trac #31160: We no longer check for readline here. - check_modules="sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core, ssl" + check_modules="sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core, ssl, ensurepip" AC_CACHE_CHECK([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules], [ac_cv_path_PYTHON3], [ AS_IF([test x"$ac_path_PYTHON3" != x], [dnl checking explicitly specified $with_python AC_MSG_RESULT([]) From 1340d95257a0e795c0a989f9b21dadad6500a736 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 21:56:31 -0700 Subject: [PATCH 136/338] build/pkgs/python3/distros/debian.txt: Add python3-venv --- build/pkgs/python3/distros/debian.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pkgs/python3/distros/debian.txt b/build/pkgs/python3/distros/debian.txt index c647aec3c34..6b3ebf766dc 100644 --- a/build/pkgs/python3/distros/debian.txt +++ b/build/pkgs/python3/distros/debian.txt @@ -1,3 +1,4 @@ python3 libpython3-dev python3-distutils +python3-venv From 3a5323ebf0d369c96a85c5d65aaf2092d9df7c0c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 22:56:29 -0700 Subject: [PATCH 137/338] .github/workflows/build.yml: Install python3-venv --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8e901d82af..1070f3fa2d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,11 +29,11 @@ jobs: - name: Prepare run: | + # Install test tools + apt-get install -y git python3-venv # Reuse built SAGE_LOCAL contained in the Docker image ./bootstrap ./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv --enable-editable --enable-download-from-upstream-url - # Install test tools - apt-get install -y git - name: Static code check with pyright run: pyright From c7fa2b09d7966b13a20c84443e1d4ce3e069fbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 8 May 2022 09:46:06 +0200 Subject: [PATCH 138/338] add some doctests and type annotations --- src/sage/combinat/nu_dyck_word.py | 86 ++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 25 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index dad59c801b1..71b459c4b10 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -28,7 +28,7 @@ # # https://www.gnu.org/licenses/ # **************************************************************************** - +from __future__ import annotations from sage.structure.element import Element from sage.rings.integer import Integer from sage.combinat.combinat import CombinatorialElement @@ -105,7 +105,7 @@ def replace_dyck_char(x): raise ValueError -def replace_dyck_symbol(x, open_char='N', close_char='E'): +def replace_dyck_symbol(x, open_char='N', close_char='E') -> str: r""" A map sending ``ndw_open_symbol`` to ``open_char`` and ``ndw_close_symbol`` to ``close_char``, and raising an error on any input other than @@ -179,25 +179,17 @@ class NuDyckWord(CombinatorialElement): sage: dw.height() 2 - :: - sage: dw = NuDyckWord('1010',[1,0,0,1]); dw [1, 0, 1, 0] - :: - sage: dw = NuDyckWord('NENE',[1,0,0,1]); dw [1, 0, 1, 0] - :: - sage: NuDyckWord([1,0,1,0],[1,0,0,1]).pretty_print() __ _|x | . . - :: - sage: from sage.combinat.nu_dyck_word import update_ndw_symbols sage: update_ndw_symbols(0,1) sage: dw = NuDyckWord('0101001','0110010'); dw @@ -209,7 +201,6 @@ class NuDyckWord(CombinatorialElement): _|x . | . . . sage: update_ndw_symbols(1,0) - """ @staticmethod def __classcall_private__(cls, dw=None, nu=None, **kwargs): @@ -242,7 +233,7 @@ def __classcall_private__(cls, dw=None, nu=None, **kwargs): raise ValueError("invalid nu-Dyck word") - def __init__(self, parent, dw, latex_options={}): + def __init__(self, parent, dw, latex_options=None): Element.__init__(self, parent) self._path = to_word_path(dw) @@ -251,17 +242,36 @@ def __init__(self, parent, dw, latex_options={}): self._nu = parent._nu + if latex_options is None: + latex_options = {} self._latex_options = dict(latex_options) def _list(self): """ Return list of ``self``. + + EXAMPLES:: + + sage: w = NuDyckWord('110100','101010') + sage: w._list() + [1, 1, 0, 1, 0, 0] """ return list(self._path) def __eq__(self, other): """ Return if two paths are equal. + + EXAMPLES:: + + sage: u = NuDyckWord('010','010') + sage: w = NuDyckWord('110100','101010') + sage: w == w + True + sage: u == w + False + sage: u == 4 + False """ if not isinstance(other, NuDyckWord): return False @@ -270,6 +280,17 @@ def __eq__(self, other): def __neq__(self, other): """ Return if two paths are not equal. + + EXAMPLES:: + + sage: u = NuDyckWord('010','010') + sage: w = NuDyckWord('110100','101010') + sage: w != w + False + sage: u != w + True + sage: u != 4 + True """ return not self.__eq__(other) @@ -283,13 +304,13 @@ def __le__(self, other): def __lt__(self, other): """ - Returns if one path is strictly included in another + Return if one path is strictly included in another """ return self.__le__(other) and not self.__eq__(other) def __ge__(self, other): """ - Returns if one path is included in another + Return if one path is included in another """ if self._nu == other._nu: return path_weakly_above_other(self._path, other._path) @@ -297,18 +318,33 @@ def __ge__(self, other): def __gt__(self, other): """ - Returns if one path is strictly included in another + Return if one path is strictly included in another """ return self.__ge__(other) and not self.__eq__(other) - def _cache_key(self): + def _cache_key(self) -> tuple: """ - Return a cache key + Return a cache key for ``self``. + + EXAMPLES:: + + sage: u = NuDyckWord('010','010') + sage: u._cache_key() + (0, 1, 0, 0, 1, 0) + """ + return tuple(self._path) + tuple(self._nu) + + def __hash__(self) -> int: """ - return str(self._path) + "-" + str(self._nu) + Return a hash for ``self``. - def __hash__(self): - return hash(''.join([str(i) for i in self._list()])) + EXAMPLES:: + + sage: u = NuDyckWord('010','010') + sage: hash(u) # random + -4577085166836515071 + """ + return hash(''.join(str(i) for i in self._list())) def set_latex_options(self, D): r""" @@ -356,7 +392,7 @@ def set_latex_options(self, D): for opt in D: self._latex_options[opt] = D[opt] - def latex_options(self): + def latex_options(self) -> dict: r""" Return the latex options for use in the ``_latex_`` function as a dictionary. @@ -423,7 +459,7 @@ def latex_options(self): d["nu_options"] = opts.latex_nu_options return d - def _repr_(self): + def _repr_(self) -> str: r""" Return a string representation of ``self`` depending on :meth:`NuDyckWords.options`. @@ -444,7 +480,7 @@ def _repr_(self): """ return self.parent().options._dispatch(self, '_repr_', 'display') - def _repr_list(self): + def _repr_list(self) -> str: r""" Return a string representation of ``self`` as a list. @@ -563,7 +599,7 @@ def _ascii_art_(self): ret = self._repr_lattice() return AsciiArt(ret.splitlines(), baseline=0) - def __str__(self): + def __str__(self) -> str: r""" Return a string consisting of N and E steps corresponding to the `\nu`-Dyck word. @@ -575,7 +611,7 @@ def __str__(self): sage: str(NuDyckWord('101010','100110')) 'NENENE' """ - return "".join(map(replace_dyck_symbol, list(self._path))) + return "".join(replace_dyck_symbol(let) for let in self._path) def pretty_print(self, style=None, labelling=None): r""" From 3df515d5bd8230d8f4be23d5c4bcaad0785da189 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 8 May 2022 08:59:09 +0000 Subject: [PATCH 139/338] Small cleanup of mathjax spkg --- build/pkgs/mathjax/SPKG.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/build/pkgs/mathjax/SPKG.rst b/build/pkgs/mathjax/SPKG.rst index de7b4baa3ff..f3a14458327 100644 --- a/build/pkgs/mathjax/SPKG.rst +++ b/build/pkgs/mathjax/SPKG.rst @@ -13,7 +13,6 @@ License Apache License, version 2.0 - Upstream Contact ---------------- @@ -22,16 +21,8 @@ Home page: https://www.mathjax.org/ Dependencies ------------ -None - - Special Update/Build Instructions --------------------------------- -None - - Patches ------- - -None. From 171d2c983650a7762b8006698dcbfd00b37e5939 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 8 May 2022 09:06:38 +0000 Subject: [PATCH 140/338] Move changes to new sage_docbuild --- src/sage/docs/conf.py | 1007 +------------------------------------ src/sage_docbuild/conf.py | 58 ++- 2 files changed, 42 insertions(+), 1023 deletions(-) diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index c67e56c57c5..8dbc27d90e0 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -1,1009 +1,4 @@ from sage.misc.superseded import deprecation deprecation(33763, "This module is deprecated. Use sage_docbuild.conf instead.") -import sys -import os -import sphinx -from sage.env import SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR -from sage.misc.latex_macros import sage_mathjax_macros -import sage.version -from sage.misc.sagedoc import extlinks -import dateutil.parser -from docutils import nodes -from docutils.transforms import Transform -from sphinx.ext.doctest import blankline_re -from sphinx import highlighting -import sphinx.ext.intersphinx as intersphinx -from IPython.lib.lexers import IPythonConsoleLexer, IPyLexer - - -# General configuration -# --------------------- - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sage_docbuild.ext.inventory_builder', - 'sage_docbuild.ext.multidocs', - 'sage_docbuild.ext.sage_autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.extlinks', - 'sphinx.ext.mathjax', - 'IPython.sphinxext.ipython_directive', - 'matplotlib.sphinxext.plot_directive', - 'jupyter_sphinx', -] - -jupyter_execute_default_kernel = 'sagemath' - -jupyter_sphinx_thebelab_config = { - 'requestKernel': True, - 'binderOptions': { - 'repo': "sagemath/sage-binder-env", - }, - 'kernelOptions': { - 'name': "sagemath", - 'kernelName': "sagemath", - 'path': ".", - }, -} - -# This code is executed before each ".. PLOT::" directive in the Sphinx -# documentation. It defines a 'sphinx_plot' function that displays a Sage object -# through matplotlib, so that it will be displayed in the HTML doc -plot_html_show_source_link = False -plot_pre_code = r""" -# Set locale to prevent having commas in decimal numbers -# in tachyon input (see https://trac.sagemath.org/ticket/28971) -import locale -locale.setlocale(locale.LC_NUMERIC, 'C') -def sphinx_plot(graphics, **kwds): - import matplotlib.image as mpimg - import matplotlib.pyplot as plt - from sage.misc.temporary_file import tmp_filename - from sage.plot.graphics import _parse_figsize - if os.environ.get('SAGE_SKIP_PLOT_DIRECTIVE', 'no') != 'yes': - ## Option handling is taken from Graphics.save - options = dict() - if isinstance(graphics, sage.plot.graphics.Graphics): - options.update(sage.plot.graphics.Graphics.SHOW_OPTIONS) - options.update(graphics._extra_kwds) - options.update(kwds) - elif isinstance(graphics, sage.plot.multigraphics.MultiGraphics): - options.update(kwds) - else: - graphics = graphics.plot(**kwds) - dpi = options.pop('dpi', None) - transparent = options.pop('transparent', None) - fig_tight = options.pop('fig_tight', None) - figsize = options.pop('figsize', None) - if figsize is not None: - figsize = _parse_figsize(figsize) - plt.figure(figsize=figsize) - figure = plt.gcf() - if isinstance(graphics, (sage.plot.graphics.Graphics, - sage.plot.multigraphics.MultiGraphics)): - graphics.matplotlib(figure=figure, figsize=figsize, **options) - if isinstance(graphics, (sage.plot.graphics.Graphics, - sage.plot.multigraphics.GraphicsArray)): - # for Graphics and GraphicsArray, tight_layout adjusts the - # *subplot* parameters so ticks aren't cut off, etc. - figure.tight_layout() - else: - # 3d graphics via png - import matplotlib as mpl - mpl.rcParams['image.interpolation'] = 'bilinear' - mpl.rcParams['image.resample'] = False - mpl.rcParams['figure.figsize'] = [8.0, 6.0] - mpl.rcParams['figure.dpi'] = 80 - mpl.rcParams['savefig.dpi'] = 100 - fn = tmp_filename(ext=".png") - graphics.save(fn) - img = mpimg.imread(fn) - plt.imshow(img) - plt.axis("off") - plt.margins(0) - if not isinstance(graphics, sage.plot.multigraphics.MultiGraphics): - plt.tight_layout(pad=0) - -from sage.all_cmdline import * -""" - -plot_html_show_formats = False -plot_formats = ['svg', 'pdf', 'png'] - -# We do *not* fully initialize intersphinx since we call it by hand -# in find_sage_dangling_links. -#, 'sphinx.ext.intersphinx'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = [os.path.join(SAGE_DOC_SRC, 'common', 'templates'), 'templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = "" -copyright = "2005--{}, The Sage Development Team".format(dateutil.parser.parse(sage.version.date).year) - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -version = sage.version.version -release = sage.version.version - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of glob-style patterns that should be excluded when looking for -# source files. [1] They are matched against the source file names -# relative to the source directory, using slashes as directory -# separators on all platforms. -exclude_patterns = ['.build'] - -# The reST default role (used for this markup: `text`) to use for all documents. -default_role = 'math' - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# Default lexer to use when highlighting code blocks, using the IPython -# console lexers. 'ipycon' is the IPython console, which is what we want -# for most code blocks: anything with "sage:" prompts. For other IPython, -# like blocks which might appear in a notebook cell, use 'ipython'. -highlighting.lexers['ipycon'] = IPythonConsoleLexer(in1_regex=r'sage: ', in2_regex=r'[.][.][.][.]: ') -highlighting.lexers['ipython'] = IPyLexer() -highlight_language = 'ipycon' - -# Extension configuration -# ----------------------- - -# include the todos -todo_include_todos = True - -# Cross-links to other project's online documentation. -python_version = sys.version_info.major - -def set_intersphinx_mappings(app, config): - """ - Add precompiled inventory (the objects.inv) - """ - 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) and os.path.exists(invpath)): - app.config.intersphinx_mapping = {} - return - - app.config.intersphinx_mapping = { - 'python': ('https://docs.python.org/', - os.path.join(SAGE_DOC_SRC, "common", - "python{}.inv".format(python_version))), - 'pplpy': (PPLPY_DOCS, None)} - - # Add master intersphinx mapping - dst = os.path.join(invpath, 'objects.inv') - app.config.intersphinx_mapping['sagemath'] = (refpath, dst) - - # Add intersphinx mapping for subdirectories - # We intentionally do not name these such that these get higher - # priority in case of conflicts - for directory in os.listdir(os.path.join(invpath)): - if directory == 'jupyter_execute': - # This directory is created by jupyter-sphinx extension for - # internal use and should be ignored here. See trac #33507. - continue - if os.path.isdir(os.path.join(invpath, directory)): - src = os.path.join(refpath, directory) - dst = os.path.join(invpath, directory, 'objects.inv') - app.config.intersphinx_mapping[src] = dst - - intersphinx.normalize_intersphinx_mapping(app, config) - -# By default document are not master. -multidocs_is_master = True - -# Options for HTML output -# ----------------------- -if importlib.util.find_spec("furo") is not None: - html_theme = "furo" - - # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path - html_static_path = [ - os.path.join(SAGE_DOC_SRC, "common", "themes", "sage-classic", "static") - ] - - html_theme_options = { - # Hide project’s name in the sidebar of the documentation; - # the logo is enough. - # https://pradyunsg.me/furo/customisation/#sidebar-hide-name - "sidebar_hide_name": True, - # Change accent (used for stylising links, sidebar’s content etc) - "light_css_variables": { - "color-brand-primary": "#0f0fff", - "color-brand-content": "#0f0fff", - }, - # Add sage logo to sidebar - # https://pradyunsg.me/furo/customisation/logo/#different-logos-for-light-and-dark-mode - "light_logo": "logo_sagemath_black.svg", - "dark_logo": "logo_sagemath.svg", - } -else: - # Sage default HTML theme. We use a custom theme to set a Pygments style, - # stylesheet, and insert MathJax macros. See the directory - # doc/common/themes/sage-classic/ for files comprising the custom theme. - html_theme = "sage-classic" - - # Add any paths that contain custom themes here, relative to this directory. - html_theme_path = [os.path.join(SAGE_DOC_SRC, "common", "themes")] - - # Theme options are theme-specific and customize the look and feel of - # a theme further. For a list of options available for each theme, - # see the documentation. - html_theme_options = {} - - # The name of the Pygments (syntax highlighting) style to use. NOTE: - # This overrides a HTML theme's corresponding setting (see below). - pygments_style = "sphinx" - -# HTML style sheet NOTE: This overrides a HTML theme's corresponding -# setting. -#html_style = 'default.css' - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (within the static path) to place at the top of -# the sidebar. -#html_logo = 'sagelogo-word.ico' - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -html_favicon = 'favicon.ico' - -# html_static_path defined here and imported in the actual configuration file -# conf.py read by Sphinx was the cause of subtle bugs in builders (see #30418 for -# instance). Hence now html_common_static_path contains the common paths to static -# files, and is combined to html_static_path in each conf.py file read by Sphinx. -html_common_static_path = [os.path.join(SAGE_DOC_SRC, 'common', 'static'), - THEBE_DIR, 'static'] - -# Configure MathJax -# https://docs.mathjax.org/en/latest/options/input/tex.html -mathjax3_config = { - "tex": { - # Add custom sage macros - # http://docs.mathjax.org/en/latest/input/tex/macros.html - "macros": sage_mathjax_macros(), - # Add $...$ as possible inline math - # https://docs.mathjax.org/en/latest/input/tex/delimiters.html#tex-and-latex-math-delimiters - "inlineMath": [["$", "$"], ["\\(", "\\)"]], - # Increase the limit the size of the string to be processed - # https://docs.mathjax.org/en/latest/options/input/tex.html#option-descriptions - "maxBuffer": 50 * 1024, - # Use colorv2 extension instead of built-in color extension - # https://docs.mathjax.org/en/latest/input/tex/extensions/autoload.html#tex-autoload-options - # https://docs.mathjax.org/en/latest/input/tex/extensions/colorv2.html#tex-colorv2 - "autoload": {"color": [], "colorv2": ["color"]}, - }, -} - -if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes': - mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" -else: - mathjax_path = 'mathjax/tex-chtml.js' - html_common_static_path += [MATHJAX_DIR] - -# A list of glob-style patterns that should be excluded when looking for source -# files. They are matched against the source file names relative to the -# source directory, using slashes as directory separators on all platforms. -exclude_patterns = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_use_modindex = True - -# A list of prefixes that are ignored for sorting the Python module index ( if -# this is set to ['foo.'], then foo.bar is shown under B, not F). Works only -# for the HTML builder currently. -modindex_common_prefix = ['sage.'] - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -html_split_index = True - -# If true, the reST sources are included in the HTML build as _sources/. -#html_copy_source = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' - -# Output file base name for HTML help builder. -#htmlhelp_basename = '' - -# Options for LaTeX output -# ------------------------ -# See http://sphinx-doc.org/config.html#confval-latex_elements -latex_elements = {} - -# The paper size ('letterpaper' or 'a4paper'). -#latex_elements['papersize'] = 'letterpaper' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_elements['pointsize'] = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, document class [howto/manual]). -latex_documents = [] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = 'sagelogo-word.png' - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# Additional stuff for the LaTeX preamble. -latex_elements['preamble'] = r""" -\usepackage{amsmath} -\usepackage{amssymb} -\usepackage{textcomp} -\usepackage{mathrsfs} -\usepackage{iftex} - -% Only declare unicode characters when compiling with pdftex; E.g. japanese -% tutorial does not use pdftex -\ifPDFTeX - \DeclareUnicodeCharacter{01CE}{\capitalcaron a} - \DeclareUnicodeCharacter{0428}{cyrillic Sha} - \DeclareUnicodeCharacter{250C}{+} - \DeclareUnicodeCharacter{2510}{+} - \DeclareUnicodeCharacter{2514}{+} - \DeclareUnicodeCharacter{2518}{+} - \DeclareUnicodeCharacter{253C}{+} - - \DeclareUnicodeCharacter{03B1}{\ensuremath{\alpha}} - \DeclareUnicodeCharacter{03B2}{\ensuremath{\beta}} - \DeclareUnicodeCharacter{03B3}{\ensuremath{\gamma}} - \DeclareUnicodeCharacter{0393}{\ensuremath{\Gamma}} - \DeclareUnicodeCharacter{03B4}{\ensuremath{\delta}} - \DeclareUnicodeCharacter{0394}{\ensuremath{\Delta}} - \DeclareUnicodeCharacter{03B5}{\ensuremath{\varepsilon}} - \DeclareUnicodeCharacter{03B6}{\ensuremath{\zeta}} - \DeclareUnicodeCharacter{03B7}{\ensuremath{\eta}} - \DeclareUnicodeCharacter{03B8}{\ensuremath{\vartheta}} - \DeclareUnicodeCharacter{0398}{\ensuremath{\Theta}} - \DeclareUnicodeCharacter{03BA}{\ensuremath{\kappa}} - \DeclareUnicodeCharacter{03BB}{\ensuremath{\lambda}} - \DeclareUnicodeCharacter{039B}{\ensuremath{\Lambda}} - \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} % micron sign - \DeclareUnicodeCharacter{03BC}{\ensuremath{\mu}} - \DeclareUnicodeCharacter{03BD}{\ensuremath{\nu}} - \DeclareUnicodeCharacter{03BE}{\ensuremath{\xi}} - \DeclareUnicodeCharacter{039E}{\ensuremath{\Xi}} - \DeclareUnicodeCharacter{03B9}{\ensuremath{\iota}} - \DeclareUnicodeCharacter{03C0}{\ensuremath{\pi}} - \DeclareUnicodeCharacter{03A0}{\ensuremath{\Pi}} - \DeclareUnicodeCharacter{03C1}{\ensuremath{\rho}} - \DeclareUnicodeCharacter{03C3}{\ensuremath{\sigma}} - \DeclareUnicodeCharacter{03A3}{\ensuremath{\Sigma}} - \DeclareUnicodeCharacter{03C4}{\ensuremath{\tau}} - \DeclareUnicodeCharacter{03C6}{\ensuremath{\varphi}} - \DeclareUnicodeCharacter{03A6}{\ensuremath{\Phi}} - \DeclareUnicodeCharacter{03C7}{\ensuremath{\chi}} - \DeclareUnicodeCharacter{03C8}{\ensuremath{\psi}} - \DeclareUnicodeCharacter{03A8}{\ensuremath{\Psi}} - \DeclareUnicodeCharacter{03C9}{\ensuremath{\omega}} - \DeclareUnicodeCharacter{03A9}{\ensuremath{\Omega}} - \DeclareUnicodeCharacter{03C5}{\ensuremath{\upsilon}} - \DeclareUnicodeCharacter{03A5}{\ensuremath{\Upsilon}} - \DeclareUnicodeCharacter{2113}{\ell} - - \DeclareUnicodeCharacter{2148}{\ensuremath{\id}} - \DeclareUnicodeCharacter{2202}{\ensuremath{\partial}} - \DeclareUnicodeCharacter{2205}{\ensuremath{\emptyset}} - \DeclareUnicodeCharacter{2208}{\ensuremath{\in}} - \DeclareUnicodeCharacter{2209}{\ensuremath{\notin}} - \DeclareUnicodeCharacter{2211}{\ensuremath{\sum}} - \DeclareUnicodeCharacter{221A}{\ensuremath{\sqrt{}}} - \DeclareUnicodeCharacter{221E}{\ensuremath{\infty}} - \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} - \DeclareUnicodeCharacter{2228}{\ensuremath{\vee}} - \DeclareUnicodeCharacter{2229}{\ensuremath{\cap}} - \DeclareUnicodeCharacter{222A}{\ensuremath{\cup}} - \DeclareUnicodeCharacter{222B}{\ensuremath{\int}} - \DeclareUnicodeCharacter{2248}{\ensuremath{\approx}} - \DeclareUnicodeCharacter{2260}{\ensuremath{\neq}} - \DeclareUnicodeCharacter{2264}{\ensuremath{\leq}} - \DeclareUnicodeCharacter{2265}{\ensuremath{\geq}} - \DeclareUnicodeCharacter{2293}{\ensuremath{\sqcap}} - \DeclareUnicodeCharacter{2294}{\ensuremath{\sqcup}} - \DeclareUnicodeCharacter{22C0}{\ensuremath{\bigwedge}} - \DeclareUnicodeCharacter{22C1}{\ensuremath{\bigvee}} - \DeclareUnicodeCharacter{22C2}{\ensuremath{\bigcap}} - \DeclareUnicodeCharacter{22C3}{\ensuremath{\bigcup}} - \DeclareUnicodeCharacter{2323}{\ensuremath{\smile}} % cup product - \DeclareUnicodeCharacter{00B1}{\ensuremath{\pm}} - \DeclareUnicodeCharacter{2A02}{\ensuremath{\bigotimes}} - \DeclareUnicodeCharacter{2297}{\ensuremath{\otimes}} - \DeclareUnicodeCharacter{2A01}{\ensuremath{\oplus}} - \DeclareUnicodeCharacter{00BD}{\ensuremath{\nicefrac{1}{2}}} - \DeclareUnicodeCharacter{00D7}{\ensuremath{\times}} - \DeclareUnicodeCharacter{00B7}{\ensuremath{\cdot}} - \DeclareUnicodeCharacter{230A}{\ensuremath{\lfloor}} - \DeclareUnicodeCharacter{230B}{\ensuremath{\rfloor}} - \DeclareUnicodeCharacter{2308}{\ensuremath{\lceil}} - \DeclareUnicodeCharacter{2309}{\ensuremath{\rceil}} - \DeclareUnicodeCharacter{22C5}{\ensuremath{\cdot}} - \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} - \DeclareUnicodeCharacter{22C0}{\ensuremath{\bigwedge}} - \DeclareUnicodeCharacter{2192}{\ensuremath{\to}} - \DeclareUnicodeCharacter{21A6}{\ensuremath{\mapsto}} - \DeclareUnicodeCharacter{2102}{\ensuremath{\mathbb{C}}} - \DeclareUnicodeCharacter{211A}{\ensuremath{\mathbb{Q}}} - \DeclareUnicodeCharacter{211D}{\ensuremath{\mathbb{R}}} - \DeclareUnicodeCharacter{2124}{\ensuremath{\mathbb{Z}}} - \DeclareUnicodeCharacter{2202}{\ensuremath{\partial}} - - \DeclareUnicodeCharacter{2070}{\ensuremath{{}^0}} - \DeclareUnicodeCharacter{00B9}{\ensuremath{{}^1}} - \DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}} - \DeclareUnicodeCharacter{00B3}{\ensuremath{{}^3}} - \DeclareUnicodeCharacter{2074}{\ensuremath{{}^4}} - \DeclareUnicodeCharacter{2075}{\ensuremath{{}^5}} - \DeclareUnicodeCharacter{2076}{\ensuremath{{}^6}} - \DeclareUnicodeCharacter{2077}{\ensuremath{{}^7}} - \DeclareUnicodeCharacter{2078}{\ensuremath{{}^8}} - \DeclareUnicodeCharacter{2079}{\ensuremath{{}^9}} - \DeclareUnicodeCharacter{207A}{\ensuremath{{}^+}} - \DeclareUnicodeCharacter{207B}{\ensuremath{{}^-}} - \DeclareUnicodeCharacter{141F}{\ensuremath{{}^/}} - \DeclareUnicodeCharacter{2080}{\ensuremath{{}_0}} - \DeclareUnicodeCharacter{2081}{\ensuremath{{}_1}} - \DeclareUnicodeCharacter{2082}{\ensuremath{{}_2}} - \DeclareUnicodeCharacter{2083}{\ensuremath{{}_3}} - \DeclareUnicodeCharacter{2084}{\ensuremath{{}_4}} - \DeclareUnicodeCharacter{2085}{\ensuremath{{}_5}} - \DeclareUnicodeCharacter{2086}{\ensuremath{{}_6}} - \DeclareUnicodeCharacter{2087}{\ensuremath{{}_7}} - \DeclareUnicodeCharacter{2088}{\ensuremath{{}_8}} - \DeclareUnicodeCharacter{2089}{\ensuremath{{}_9}} - \DeclareUnicodeCharacter{208A}{\ensuremath{{}_+}} - \DeclareUnicodeCharacter{208B}{\ensuremath{{}_-}} - \DeclareUnicodeCharacter{1D62}{\ensuremath{{}_i}} - \DeclareUnicodeCharacter{2C7C}{\ensuremath{{}_j}} - - \newcommand{\sageMexSymbol}[1] - {{\fontencoding{OMX}\fontfamily{cmex}\selectfont\raisebox{0.75em}{\symbol{#1}}}} - \DeclareUnicodeCharacter{239B}{\sageMexSymbol{"30}} % parenlefttp - \DeclareUnicodeCharacter{239C}{\sageMexSymbol{"42}} % parenleftex - \DeclareUnicodeCharacter{239D}{\sageMexSymbol{"40}} % parenleftbt - \DeclareUnicodeCharacter{239E}{\sageMexSymbol{"31}} % parenrighttp - \DeclareUnicodeCharacter{239F}{\sageMexSymbol{"43}} % parenrightex - \DeclareUnicodeCharacter{23A0}{\sageMexSymbol{"41}} % parenrightbt - \DeclareUnicodeCharacter{23A1}{\sageMexSymbol{"32}} % bracketlefttp - \DeclareUnicodeCharacter{23A2}{\sageMexSymbol{"36}} % bracketleftex - \DeclareUnicodeCharacter{23A3}{\sageMexSymbol{"34}} % bracketleftbt - \DeclareUnicodeCharacter{23A4}{\sageMexSymbol{"33}} % bracketrighttp - \DeclareUnicodeCharacter{23A5}{\sageMexSymbol{"37}} % bracketrightex - \DeclareUnicodeCharacter{23A6}{\sageMexSymbol{"35}} % bracketrightbt - - \DeclareUnicodeCharacter{23A7}{\sageMexSymbol{"38}} % curly brace left top - \DeclareUnicodeCharacter{23A8}{\sageMexSymbol{"3C}} % curly brace left middle - \DeclareUnicodeCharacter{23A9}{\sageMexSymbol{"3A}} % curly brace left bottom - \DeclareUnicodeCharacter{23AA}{\sageMexSymbol{"3E}} % curly brace extension - \DeclareUnicodeCharacter{23AB}{\sageMexSymbol{"39}} % curly brace right top - \DeclareUnicodeCharacter{23AC}{\sageMexSymbol{"3D}} % curly brace right middle - \DeclareUnicodeCharacter{23AD}{\sageMexSymbol{"3B}} % curly brace right bottom - \DeclareUnicodeCharacter{23B0}{\{} % 2-line curly brace left top half (not in cmex) - \DeclareUnicodeCharacter{23B1}{\}} % 2-line curly brace right top half (not in cmex) - - \DeclareUnicodeCharacter{2320}{\ensuremath{\int}} % top half integral - \DeclareUnicodeCharacter{2321}{\ensuremath{\int}} % bottom half integral - \DeclareUnicodeCharacter{23AE}{\ensuremath{\|}} % integral extenison - - % Box drawings light - \DeclareUnicodeCharacter{2500}{-} % h - \DeclareUnicodeCharacter{2502}{|} % v - \DeclareUnicodeCharacter{250C}{+} % dr - \DeclareUnicodeCharacter{2510}{+} % dl - \DeclareUnicodeCharacter{2514}{+} % ur - \DeclareUnicodeCharacter{2518}{+} % ul - \DeclareUnicodeCharacter{251C}{+} % vr - \DeclareUnicodeCharacter{2524}{+} % vl - \DeclareUnicodeCharacter{252C}{+} % dh - \DeclareUnicodeCharacter{2534}{+} % uh - \DeclareUnicodeCharacter{253C}{+} % vh - \DeclareUnicodeCharacter{2571}{/} % upper right to lower left - \DeclareUnicodeCharacter{2571}{\setminus} % upper left to lower right - - \DeclareUnicodeCharacter{25CF}{\ensuremath{\bullet}} % medium black circle - \DeclareUnicodeCharacter{26AC}{\ensuremath{\circ}} % medium small white circle - \DeclareUnicodeCharacter{256D}{+} - \DeclareUnicodeCharacter{256E}{+} - \DeclareUnicodeCharacter{256F}{+} - \DeclareUnicodeCharacter{2570}{+} -\fi - -\let\textLaTeX\LaTeX -\AtBeginDocument{\renewcommand*{\LaTeX}{\hbox{\textLaTeX}}} - -% Workaround for a LaTeX bug -- see trac #31397 and -% https://tex.stackexchange.com/questions/583391/mactex-2020-error-with-report-hyperref-mathbf-in-chapter. -\makeatletter -\pdfstringdefDisableCommands{% - \let\mathbf\@firstofone -} -\makeatother -""" - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_use_modindex = True - -##################################################### -# add LaTeX macros for Sage - -from sage.misc.latex_macros import sage_latex_macros - -try: - pngmath_latex_preamble # check whether this is already defined -except NameError: - pngmath_latex_preamble = "" - -for macro in sage_latex_macros(): - # used when building latex and pdf versions - latex_elements['preamble'] += macro + '\n' - # used when building html version - pngmath_latex_preamble += macro + '\n' - -##################################################### -# add custom context variables for templates - -def add_page_context(app, pagename, templatename, context, doctree): - # # The template function - # def template_function(arg): - # return "Your string is " + arg - # # Add it to the page's context - # context['template_function'] = template_function - 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(release) + ' Documentation' - context['documentation_root'] = os.path.join(relpath, 'index.html') - if 'website' in path1: - context['title'] = 'Documentation' - context['website'] = True - - if 'reference' in path1 and not path1.endswith('reference'): - path2 = os.path.join(SAGE_DOC, 'html', 'en', 'reference') - relpath = os.path.relpath(path2, path1) - context['reference_title'] = 'Reference Manual' - context['reference_root'] = os.path.join(relpath, 'index.html') - context['refsub'] = True - -##################################################### - -def process_docstring_aliases(app, what, name, obj, options, docstringlines): - """ - Change the docstrings for aliases to point to the original object. - """ - basename = name.rpartition('.')[2] - if hasattr(obj, '__name__') and obj.__name__ != basename: - docstringlines[:] = ['See :obj:`%s`.' % name] - -def process_directives(app, what, name, obj, options, docstringlines): - """ - Remove 'nodetex' and other directives from the first line of any - docstring where they appear. - """ - if len(docstringlines) == 0: - return - first_line = docstringlines[0] - directives = [ d.lower() for d in first_line.split(',') ] - if 'nodetex' in directives: - docstringlines.pop(0) - -def process_docstring_cython(app, what, name, obj, options, docstringlines): - """ - Remove Cython's filename and location embedding. - """ - if len(docstringlines) <= 1: - return - - first_line = docstringlines[0] - if first_line.startswith('File:') and '(starting at' in first_line: - #Remove the first two lines - docstringlines.pop(0) - docstringlines.pop(0) - -def process_docstring_module_title(app, what, name, obj, options, docstringlines): - """ - Removes the first line from the beginning of the module's docstring. This - corresponds to the title of the module's documentation page. - """ - if what != "module": - return - - #Remove any additional blank lines at the beginning - title_removed = False - while len(docstringlines) > 1 and not title_removed: - if docstringlines[0].strip() != "": - title_removed = True - docstringlines.pop(0) - - #Remove any additional blank lines at the beginning - while len(docstringlines) > 1: - if docstringlines[0].strip() == "": - docstringlines.pop(0) - else: - break - -skip_picklability_check_modules = [ - #'sage.misc.test_nested_class', # for test only - 'sage.misc.latex', - 'sage.misc.explain_pickle', - '__builtin__', -] - -def check_nested_class_picklability(app, what, name, obj, skip, options): - """ - Print a warning if pickling is broken for nested classes. - """ - if hasattr(obj, '__dict__') and hasattr(obj, '__module__'): - # Check picklability of nested classes. Adapted from - # sage.misc.nested_class.modify_for_nested_pickle. - module = sys.modules[obj.__module__] - for (nm, v) in obj.__dict__.items(): - if (isinstance(v, type) and - v.__name__ == nm and - v.__module__ == module.__name__ and - getattr(module, nm, None) is not v and - v.__module__ not in skip_picklability_check_modules): - # OK, probably this is an *unpicklable* nested class. - app.warn('Pickling of nested class %r is probably broken. ' - 'Please set the metaclass of the parent class to ' - 'sage.misc.nested_class.NestedClassMetaclass.' % ( - v.__module__ + '.' + name + '.' + nm)) - - -def skip_member(app, what, name, obj, skip, options): - """ - To suppress Sphinx warnings / errors, we - - - Don't include [aliases of] builtins. - - - Don't include the docstring for any nested class which has been - inserted into its module by - :class:`sage.misc.NestedClassMetaclass` only for pickling. The - class will be properly documented inside its surrounding class. - - - Optionally, check whether pickling is broken for nested classes. - - - Optionally, include objects whose name begins with an underscore - ('_'), i.e., "private" or "hidden" attributes, methods, etc. - - Otherwise, we abide by Sphinx's decision. Note: The object - ``obj`` is excluded (included) if this handler returns True - (False). - """ - if 'SAGE_CHECK_NESTED' in os.environ: - check_nested_class_picklability(app, what, name, obj, skip, options) - - if getattr(obj, '__module__', None) == '__builtin__': - return True - - objname = getattr(obj, "__name__", None) - if objname is not None: - # check if name was inserted to the module by NestedClassMetaclass - if name.find('.') != -1 and objname.find('.') != -1: - if objname.split('.')[-1] == name.split('.')[-1]: - return True - - if 'SAGE_DOC_UNDERSCORE' in os.environ: - if name.split('.')[-1].startswith('_'): - return False - - return skip - - -def process_dollars(app, what, name, obj, options, docstringlines): - r""" - Replace dollar signs with backticks. - - See sage.misc.sagedoc.process_dollars for more information. - """ - if len(docstringlines) and name.find("process_dollars") == -1: - from sage.misc.sagedoc import process_dollars as sagedoc_dollars - s = sagedoc_dollars("\n".join(docstringlines)) - lines = s.split("\n") - for i in range(len(lines)): - docstringlines[i] = lines[i] - -def process_inherited(app, what, name, obj, options, docstringlines): - """ - If we're including inherited members, omit their docstrings. - """ - if not options.get('inherited-members'): - return - - if what in ['class', 'data', 'exception', 'function', 'module']: - return - - name = name.split('.')[-1] - - if what == 'method' and hasattr(obj, 'im_class'): - if name in obj.im_class.__dict__.keys(): - return - - if what == 'attribute' and hasattr(obj, '__objclass__'): - if name in obj.__objclass__.__dict__.keys(): - return - - for i in range(len(docstringlines)): - docstringlines.pop() - -dangling_debug = False - -def debug_inf(app, message): - if dangling_debug: - app.info(message) - -def call_intersphinx(app, env, node, contnode): - r""" - Call intersphinx and make links between Sage manuals relative. - - TESTS: - - Check that the link from the thematic tutorials to the reference - manual is relative, see :trac:`20118`:: - - sage: from sage.env import SAGE_DOC - sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html") - sage: for line in open(thematic_index).readlines(): # optional - sagemath_doc_html - ....: if "padics" in line: - ....: _ = sys.stdout.write(line) -
  • Introduction to the p-adics

  • - """ - debug_inf(app, "???? Trying intersphinx for %s" % node['reftarget']) - builder = app.builder - res = intersphinx.missing_reference( - app, env, node, contnode) - if res: - # Replace absolute links to $SAGE_DOC by relative links: this - # allows to copy the whole documentation tree somewhere else - # without breaking links, see Trac #20118. - if res['refuri'].startswith(SAGE_DOC): - here = os.path.dirname(os.path.join(builder.outdir, - node['refdoc'])) - res['refuri'] = os.path.relpath(res['refuri'], here) - debug_inf(app, "++++ Found at %s" % res['refuri']) - else: - debug_inf(app, "---- Intersphinx: %s not Found" % node['reftarget']) - return res - -def find_sage_dangling_links(app, env, node, contnode): - r""" - Try to find dangling link in local module imports or all.py. - """ - debug_inf(app, "==================== find_sage_dangling_links ") - - reftype = node['reftype'] - reftarget = node['reftarget'] - try: - doc = node['refdoc'] - except KeyError: - debug_inf(app, "-- no refdoc in node %s" % node) - return None - - debug_inf(app, "Searching %s from %s"%(reftarget, doc)) - - # Workaround: in Python's doc 'object', 'list', ... are documented as a - # function rather than a class - if reftarget in base_class_as_func and reftype == 'class': - node['reftype'] = 'func' - - res = call_intersphinx(app, env, node, contnode) - if res: - debug_inf(app, "++ DONE %s"%(res['refuri'])) - return res - - if node.get('refdomain') != 'py': # not a python file - return None - - try: - module = node['py:module'] - cls = node['py:class'] - except KeyError: - debug_inf(app, "-- no module or class for :%s:%s"%(reftype, reftarget)) - return None - - basename = reftarget.split(".")[0] - try: - target_module = getattr(sys.modules['sage.all'], basename).__module__ - debug_inf(app, "++ found %s using sage.all in %s" % (basename, target_module)) - except AttributeError: - try: - target_module = getattr(sys.modules[node['py:module']], basename).__module__ - debug_inf(app, "++ found %s in this module" % (basename,)) - except AttributeError: - debug_inf(app, "-- %s not found in sage.all or this module" % (basename)) - return None - except KeyError: - target_module = None - if target_module is None: - target_module = "" - debug_inf(app, "?? found in None !!!") - - newtarget = target_module+'.'+reftarget - node['reftarget'] = newtarget - - # adapted from sphinx/domains/python.py - builder = app.builder - searchmode = node.hasattr('refspecific') and 1 or 0 - matches = builder.env.domains['py'].find_obj( - builder.env, module, cls, newtarget, reftype, searchmode) - if not matches: - debug_inf(app, "?? no matching doc for %s"%newtarget) - return call_intersphinx(app, env, node, contnode) - elif len(matches) > 1: - env.warn(target_module, - 'more than one target found for cross-reference ' - '%r: %s' % (newtarget, - ', '.join(match[0] for match in matches)), - node.line) - name, obj = matches[0] - debug_inf(app, "++ match = %s %s"%(name, obj)) - - from docutils import nodes - newnode = nodes.reference('', '', internal=True) - if name == target_module: - newnode['refid'] = name - else: - newnode['refuri'] = builder.get_relative_uri(node['refdoc'], obj[0]) - newnode['refuri'] += '#' + name - debug_inf(app, "++ DONE at URI %s"%(newnode['refuri'])) - newnode['reftitle'] = name - newnode.append(contnode) - return newnode - -# lists of basic Python class which are documented as functions -base_class_as_func = [ - 'bool', 'complex', 'dict', 'file', 'float', - 'frozenset', 'int', 'list', 'long', 'object', - 'set', 'slice', 'str', 'tuple', 'type', 'unicode', 'xrange'] - -# Nit picky option configuration: Put here broken links we want to ignore. For -# link to the Python documentation several links where broken because there -# where class listed as functions. Expand the list 'base_class_as_func' above -# instead of marking the link as broken. -nitpick_ignore = [ - ('py:class', 'twisted.web2.resource.Resource'), - ('py:class', 'twisted.web2.resource.PostableResource')] - -def nitpick_patch_config(app): - """ - Patch the default config for nitpicky - - Calling path_config ensure that nitpicky is not considered as a Sphinx - environment variable but rather as a Sage environment variable. As a - consequence, changing it doesn't force the recompilation of the entire - documentation. - """ - app.config.values['nitpicky'] = (False, 'sage') - app.config.values['nitpick_ignore'] = ([], 'sage') - -def skip_TESTS_block(app, what, name, obj, options, docstringlines): - """ - Skip blocks labeled "TESTS:". - - See sage.misc.sagedoc.skip_TESTS_block for more information. - """ - from sage.misc.sagedoc import skip_TESTS_block as sagedoc_skip_TESTS - if not docstringlines: - # No docstring, so don't do anything. See Trac #19932. - return - s = sagedoc_skip_TESTS("\n".join(docstringlines)) - lines = s.split("\n") - for i in range(len(lines)): - docstringlines[i] = lines[i] - while len(docstringlines) > len(lines): - del docstringlines[len(lines)] - -class SagemathTransform(Transform): - """ - Transform for code-blocks. - - This allows Sphinx to treat code-blocks with prompt "sage:" as - associated with the pycon lexer, and in particular, to change - "" to a blank line. - """ - default_priority = 500 - - def apply(self): - for node in self.document.traverse(nodes.literal_block): - if node.get('language') is None and node.astext().startswith('sage:'): - node['language'] = 'ipycon' - source = node.rawsource - source = blankline_re.sub('', source) - node.rawsource = source - node[:] = [nodes.Text(source)] - -from sage.misc.sageinspect import sage_getargspec -autodoc_builtin_argspec = sage_getargspec - -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-process-docstring', process_inherited) - if os.environ.get('SAGE_SKIP_TESTS_BLOCKS', False): - app.connect('autodoc-process-docstring', skip_TESTS_block) - app.connect('autodoc-skip-member', skip_member) - app.add_transform(SagemathTransform) - - # When building the standard docs, app.srcdir is set to SAGE_DOC_SRC + - # 'LANGUAGE/DOCNAME', but when doing introspection, app.srcdir is - # set to a temporary directory. We don't want to use intersphinx, - # etc., when doing introspection. - if app.srcdir.startswith(SAGE_DOC_SRC): - app.add_config_value('intersphinx_mapping', {}, False) - app.add_config_value('intersphinx_cache_limit', 5, False) - app.add_config_value('intersphinx_disabled_reftypes', [], False) - app.connect('config-inited', set_intersphinx_mappings) - app.connect('builder-inited', intersphinx.load_mappings) - # We do *not* fully initialize intersphinx since we call it by hand - # in find_sage_dangling_links. - # app.connect('missing-reference', missing_reference) - app.connect('missing-reference', find_sage_dangling_links) - app.connect('builder-inited', nitpick_patch_config) - app.connect('html-page-context', add_page_context) +from sage_docbuild.conf import * diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 13c969a0ec8..c0866c0af75 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -1,3 +1,4 @@ +import importlib import sys import os import sphinx @@ -162,10 +163,6 @@ def sphinx_plot(graphics, **kwds): # output. They are ignored by default. #show_authors = False -# The name of the Pygments (syntax highlighting) style to use. NOTE: -# This overrides a HTML theme's corresponding setting (see below). -pygments_style = 'sphinx' - # Default lexer to use when highlighting code blocks, using the IPython # console lexers. 'ipycon' is the IPython console, which is what we want # for most code blocks: anything with "sage:" prompts. For other IPython, @@ -224,19 +221,46 @@ def set_intersphinx_mappings(app, config): # Options for HTML output # ----------------------- - -# Sage default HTML theme. We use a custom theme to set a Pygments style, -# stylesheet, and insert MathJax macros. See the directory -# doc/common/themes/sage-classic/ for files comprising the custom theme. -html_theme = 'sage-classic' - -# Theme options are theme-specific and customize the look and feel of -# a theme further. For a list of options available for each theme, -# see the documentation. -html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [os.path.join(SAGE_DOC_SRC, 'common', 'themes')] +if importlib.util.find_spec("furo") is not None: + html_theme = "furo" + + # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path + html_static_path = [ + os.path.join(SAGE_DOC_SRC, "common", "themes", "sage-classic", "static") + ] + + html_theme_options = { + # Hide project’s name in the sidebar of the documentation; + # the logo is enough. + # https://pradyunsg.me/furo/customisation/#sidebar-hide-name + "sidebar_hide_name": True, + # Change accent (used for stylising links, sidebar’s content etc) + "light_css_variables": { + "color-brand-primary": "#0f0fff", + "color-brand-content": "#0f0fff", + }, + # Add sage logo to sidebar + # https://pradyunsg.me/furo/customisation/logo/#different-logos-for-light-and-dark-mode + "light_logo": "logo_sagemath_black.svg", + "dark_logo": "logo_sagemath.svg", + } +else: + # Sage default HTML theme. We use a custom theme to set a Pygments style, + # stylesheet, and insert MathJax macros. See the directory + # doc/common/themes/sage-classic/ for files comprising the custom theme. + html_theme = "sage-classic" + + # Add any paths that contain custom themes here, relative to this directory. + html_theme_path = [os.path.join(SAGE_DOC_SRC, "common", "themes")] + + # Theme options are theme-specific and customize the look and feel of + # a theme further. For a list of options available for each theme, + # see the documentation. + html_theme_options = {} + + # The name of the Pygments (syntax highlighting) style to use. NOTE: + # This overrides a HTML theme's corresponding setting (see below). + pygments_style = "sphinx" # HTML style sheet NOTE: This overrides a HTML theme's corresponding # setting. From b8882f2105662881e0220ad27197d864b33500b3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 05:46:53 -0700 Subject: [PATCH 141/338] build/pkgs/sagemath_objects/install-requires.txt: Update --- build/pkgs/sagemath_objects/install-requires.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index a94dfc6cb08..06766454a53 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ # Pinned in Trac #29941 until proper namespace packages are supported in #28925. -sagemath-objects == 9.6rc3.post3 +sagemath-objects == 9.6rc3.post4 From 67c74f2bc1ed80e81ceb599e7d5cb64570157378 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 9 May 2022 22:50:01 +0000 Subject: [PATCH 142/338] Update based on recent changes in deps --- .gitpod.yml | 5 +- src/environment-dev.yml | 206 ---------------------------------------- 2 files changed, 3 insertions(+), 208 deletions(-) delete mode 100644 src/environment-dev.yml diff --git a/.gitpod.yml b/.gitpod.yml index 3bb3366443a..c3d5a05087d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,6 +7,7 @@ tasks: - name: Setup init: | # Create conda environment + ./bootstrap-conda mamba env create --file src/environment-dev.yml --prefix venv conda config --append envs_dirs /workspace/sagetrac-mirror conda activate /workspace/sagetrac-mirror/venv @@ -16,8 +17,8 @@ tasks: # Build sage ./bootstrap ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX - pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup - pip install --no-build-isolation -v -v -e src + pip install --no-build-isolation -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup + pip install --no-build-isolation -v -v -e ./src command: | # Activate conda environment diff --git a/src/environment-dev.yml b/src/environment-dev.yml deleted file mode 100644 index 6d99447b852..00000000000 --- a/src/environment-dev.yml +++ /dev/null @@ -1,206 +0,0 @@ -name: sage-dev -channels: - - conda-forge - - nodefaults -dependencies: - - compilers - - make - - m4 - - perl - - python - - tar - - bc - - pkg-config - - arb - - boost-cpp - - brial - - bzip2 - - cddlib - - cliquer - - cmake - - curl - - ecl - - eclib - - ecm - - fflas-ffpack - - libflint - - flintqs - - fplll - - freetype - - bdw-gc - - gengetopt - - gf2x - - gfan - - fortran-compiler - - giac - - givaro - - glpk - - gmp - - gsl - - iml - - lcalc - - libatomic_ops - - libbraiding - - libffi - - libgd - - libhomfly - - xz - - libpng - - linbox - - lrcalc - - m4ri - - m4rie - - mpc - - mpfi - - mpfr - - nauty - - ncurses - - ntl - - openblas - - blas=2.*=openblas - - openssl - - palp - - pari - - pari-elldata - - pari-galdata - - pari-galpol - - pari-seadata - - pari-galdata - - pari-seadata-small - - patch - - pcre - - pkg-config - - planarity - - ppl - - primecount - - primesieve - - qhull - - r - - r-essentials - - readline - - rw - - singular - - sqlite - - suitesparse - - symmetrica - - sympow - - tachyon - - tox - - xz - - zeromq - - zlib - - zn_poly - - alabaster - - attrs - - babel - - backcall - - beautifulsoup4 - - bleach - - certifi - - cffi - - sagemath-db-combinatorial-designs - - sagemath-db-conway-polynomials - - cvxopt - - cycler - - cypari2 - - cysignals - - cython - - python-dateutil - - decorator - - defusedxml - - docutils - - sagemath-db-elliptic-curves - - entrypoints - - fpylll - - gap-defaults - - gmpy2 - - sagemath-db-graphs - - html5lib - - imagesize - - importlib_metadata - - ipykernel - - ipython - - ipython_genutils - - ipywidgets - - jedi - - jinja2 - - jmol - - jsonschema - - jupyter_client - - jupyter_core - - kiwisolver - - python-lrcalc - - markupsafe - - mathjax - - "matplotlib>=3.5.1" - - maxima - - memory-allocator - - mistune - - mpmath - - nbconvert - - nbformat - - networkx - - notebook - - numpy - - packaging - - pandocfilters - - parso - - pexpect - - pickleshare - - pillow - - pip - - pkgconfig - - sagemath-db-polytopes - - pplpy - - primecountpy - - prometheus_client - - prompt_toolkit - - ptyprocess - - pybind11 - - pycparser - - pygments - - pyparsing - - pyrsistent - - pytz - - pyzmq - - requests - - rpy2 - - sagetex - - scipy - - send2trash - - setuptools - - setuptools_scm - - simplegeneric - - six - - snowballstemmer - - sphinx - - sphinxcontrib-applehelp - - sphinxcontrib-devhelp - - sphinxcontrib-htmlhelp - - sphinxcontrib-jsmath - - sphinxcontrib-qthelp - - sphinxcontrib-serializinghtml - - sphinxcontrib-websupport - - sympy - - terminado - - testpath - - three.js - - tornado - - traitlets - - tzlocal - - vcversioner - - wcwidth - - webencodings - - wheel - - widgetsnbextension - - zipp - # Packages needed for ./bootstrap - - gettext - - autoconf - - automake - - libtool - # Additional dev tools - - openssh - - pycodestyle - - pytest - - jupyter_sphinx From 52dca7db2eec2d0536e6ce14de3b2232305a4fcd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 10 May 2022 11:27:04 -0700 Subject: [PATCH 143/338] .github/workflows/build.yml: Add comment on python3-venv --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1070f3fa2d7..635389e9bdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,9 @@ jobs: - name: Prepare run: | - # Install test tools + # Install test tools. + # Installation of python3-venv can be removed as soon as a + # base image with a release including #33822 is available apt-get install -y git python3-venv # Reuse built SAGE_LOCAL contained in the Docker image ./bootstrap From d7a226ce7251706fa92a8a99bba6788115e504e4 Mon Sep 17 00:00:00 2001 From: "Trevor K. Karn" Date: Wed, 11 May 2022 14:30:01 -0500 Subject: [PATCH 144/338] Initial commit --- src/sage/matroids/matroid.pyx | 50 ++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index ef9096fa1d9..3941e6682c9 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -133,6 +133,7 @@ additional functionality (e.g. linear extensions). - Construction - :meth:`union() ` + - :math:`direct_sum() ` - Misc - :meth:`broken_circuit_complex() ` @@ -8011,7 +8012,7 @@ cdef class Matroid(SageObject): OUTPUT: - An instance of MatroidUnion. + An instance of :class:`MatroidUnion `. EXAMPLES:: @@ -8035,3 +8036,50 @@ cdef class Matroid(SageObject): # place this matroid at the beginning of the list matroids.insert(0, self) return union_matroid.MatroidUnion(iter(matroids)) + + def direct_sum(self, matroids): + r""" + Return the matroid direct sum with another matroid or list of + matroids. + + Let `(M_1, M_2, \ldots, M_k)` be a list of matroids where each `M_i` + has ground set `E_i`. The matroid sum `(E_1,I_1),\ldots,(E_n,I_n)` + is a matroid `(E,I)` where `E= \bigsqcup_{i=1}^n E_i` and + `I= \bigsqcup_{i=1}^n I_i`. + + INPUT: + + - ``matroids`` - a matroid or list of matroids + + OUTPUT: + + An instance of :class:`MatroidSum ` + + EXAMPLES:: + + sage: M = matroids.named_matroids.Pappus() + sage: N = matroids.named_matroids.Fano().direct_sum(M); N + Matroid of rank 6 on 16 elements as matroid sum of + Binary matroid of rank 3 on 7 elements, type (3, 0) + Matroid of rank 3 on 9 elements with circuit-closures + {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'}, {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}} + sage: len(N.independent_sets()) + 6897 + sage: len(N.bases()) + 2100 + """ + + from . import union_matroid + if isinstance(matroids, Matroid): + matroids = [matroids] + else: + for M in matroids: + if not isinstance(M, Matroid): + raise TypeError("can only take the sum with a " + "matroid or list of matroids") + matroids = [M for M in matroids if M] + if not matroids: + return self + # place this matroid at the beginning of the list + matroids.insert(0, self) + return union_matroid.MatroidSum(iter(matroids)) From f56a535d712eb598b207c5d88d3c2f32fbbcafaa Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 13 May 2022 22:12:01 +0000 Subject: [PATCH 145/338] Install esbonio using conda --- .gitpod.yml | 2 -- bootstrap-conda | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index c3d5a05087d..6017bd072e8 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -11,8 +11,6 @@ tasks: mamba env create --file src/environment-dev.yml --prefix venv conda config --append envs_dirs /workspace/sagetrac-mirror conda activate /workspace/sagetrac-mirror/venv - ## Install esbonio via pip as long as there is no conda package for it: https://github.com/swyddfa/esbonio/issues/371 - pip install esbonio # Build sage ./bootstrap diff --git a/bootstrap-conda b/bootstrap-conda index 356c621895b..40287f81803 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -65,6 +65,7 @@ echo " # Additional dev tools" >> src/environment-dev.yml echo " - openssh" >> src/environment-dev.yml echo " - pycodestyle" >> src/environment-dev.yml echo " - pytest" >> src/environment-dev.yml +echo " - esbonio" >> src/environment-dev.yml cp environment.yml environment-optional.yml echo " # optional packages" >> environment-optional.yml From ccbc21ad139c604078e2066bd9d34d514072eade Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 14:07:31 -0700 Subject: [PATCH 146/338] bootstrap, bootstrap-conda, src/doc/bootstrap: Use build/bin/sage-package directly --- bootstrap | 14 +++++++------- bootstrap-conda | 4 +++- src/doc/bootstrap | 10 +++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/bootstrap b/bootstrap index d059afc0482..bf6b2716674 100755 --- a/bootstrap +++ b/bootstrap @@ -85,12 +85,12 @@ bootstrap () { rm -f m4/sage_spkg_configures.m4 spkg_configures="" # initialize SAGE_ENABLE... options for standard packages - for pkgname in $(./sage --package list :standard: | sort); do + for pkgname in $(sage-package list :standard: | sort); do spkg_configures="$spkg_configures AS_VAR_SET_IF([SAGE_ENABLE_$pkgname], [], [AS_VAR_SET([SAGE_ENABLE_$pkgname], [yes])])" done # --enable-SPKG options - for pkgname in $(./sage --package list :optional: :experimental: | sort); do + for pkgname in $(sage-package list :optional: :experimental: | sort); do # Trac #29629: Temporary solution for Sage 9.1: Do not provide # --enable-SPKG options for installing pip packages if [ ! -f build/pkgs/$pkgname/requirements.txt ]; then @@ -109,12 +109,12 @@ SAGE_SPKG_ENABLE([$pkgname], [$pkgtype], [$(grep -v ^= build/pkgs/$pkgname/SPKG. esac fi done - for pkgname in $(./sage --package list --has-file spkg-configure.m4 | sort); do + for pkgname in $(sage-package list --has-file spkg-configure.m4 | sort); do echo "m4_sinclude([build/pkgs/$pkgname/spkg-configure.m4])" spkg_configures="$spkg_configures SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')" done >> m4/sage_spkg_configures.m4 - for pkgname in $(./sage --package list | sort); do + for pkgname in $(sage-package list | sort); do DIR=build/pkgs/$pkgname pkgtype="$(cat $DIR/type)" if test -f "$DIR/requirements.txt"; then @@ -143,7 +143,7 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" done echo "$spkg_configures" >> m4/sage_spkg_configures.m4 - for pkgname in $(./sage --package list --has-file bootstrap); do + for pkgname in $(sage-package list --has-file bootstrap); do (cd build/pkgs/$pkgname && ./bootstrap) || exit 1 done @@ -262,10 +262,10 @@ save () { # Compute checksum if [ "${BOOTSTRAP_QUIET}" = "no" ]; then - ./sage --package fix-checksum configure + sage-package fix-checksum configure else # Hide the "Updating checksum..." message - ./sage --package fix-checksum configure > /dev/null + sage-package fix-checksum configure > /dev/null fi } diff --git a/bootstrap-conda b/bootstrap-conda index 356c621895b..92aea50f939 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -4,6 +4,8 @@ # Generate auto-generated conda environment files ######################################################################### +export PATH="$(pwd)/build/bin:$PATH" + STRIP_COMMENTS="sed s/#.*//;" RECOMMENDED_SPKG_PATTERN="@(_recommended$(for a in $(head -n 1 build/pkgs/_recommended/dependencies); do echo -n "|"$a; done))" @@ -13,7 +15,7 @@ OPTIONAL_SYSTEM_PACKAGES= SAGELIB_SYSTEM_PACKAGES= SAGELIB_OPTIONAL_SYSTEM_PACKAGES= RECOMMENDED_SYSTEM_PACKAGES= -for PKG_BASE in $(./sage --package list --has-file distros/conda.txt); do +for PKG_BASE in $(sage-package list --has-file distros/conda.txt); do PKG_SCRIPTS=build/pkgs/$PKG_BASE SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/conda.txt PKG_TYPE=$(cat $PKG_SCRIPTS/type) diff --git a/src/doc/bootstrap b/src/doc/bootstrap index 90ae09160ba..7c7c5c9978c 100755 --- a/src/doc/bootstrap +++ b/src/doc/bootstrap @@ -33,7 +33,7 @@ for SYSTEM in arch debian fedora cygwin homebrew; do SAGELIB_SYSTEM_PACKAGES= SAGELIB_OPTIONAL_SYSTEM_PACKAGES= RECOMMENDED_SYSTEM_PACKAGES= - for PKG_BASE in $(./sage --package list --has-file distros/$SYSTEM.txt); do + for PKG_BASE in $(sage-package list --has-file distros/$SYSTEM.txt); do PKG_SCRIPTS=build/pkgs/$PKG_BASE SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/$SYSTEM.txt PKG_TYPE=$(cat $PKG_SCRIPTS/type) @@ -91,7 +91,7 @@ Sage depends. It installs them automatically if it does not find equivalent system packages. EOF -for PKG_BASE in $(./sage --package list --has-file SPKG.rst :standard: | sort); do +for PKG_BASE in $(sage-package list --has-file SPKG.rst :standard: | sort); do echo "* :ref:\`spkg_$PKG_BASE\`" done >> "$OUTPUT_INDEX" cat >> "$OUTPUT_INDEX" <> "$OUTPUT_INDEX" cat >> "$OUTPUT_INDEX" <> "$OUTPUT_INDEX" cat >> "$OUTPUT_INDEX" < Date: Sat, 14 May 2022 14:23:39 -0700 Subject: [PATCH 147/338] src/doc/Makefile: Remove explicit use of SAGE_ROOT and the top-level sage script --- src/doc/Makefile | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/doc/Makefile b/src/doc/Makefile index 90bea5dfac5..7a83422d481 100644 --- a/src/doc/Makefile +++ b/src/doc/Makefile @@ -3,10 +3,12 @@ # 'make doc-html' (synonym for 'make' and 'make all') builds the html documentation. # 'make doc-pdf' builds the PDF documentation. # -# SAGE_ROOT must be defined for these to work, so these commands -# should be called by build/make/Makefile. +# The "sage" script must be in PATH, and the Sage library and the package sage_docbuild +# must be installed for these to work. +# These commands are intended to be called by build/make/Makefile via +# build/pkgs/sagemath_doc_{html,pdf}/spkg-install. # -# 'make clean' removes build artifacts; SAGE_ROOT need not be defined for this to work. +# 'make clean' removes build artifacts; the "sage" script is not needed for this to work. all: doc-html @@ -17,11 +19,11 @@ clean: # Matches doc-inventory--reference-manifolds etc. doc-inventory--%: - cd $(SAGE_ROOT) && ./sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-inventory--,,$@)) inventory $(SAGE_DOCBUILD_OPTS) + sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-inventory--,,$@)) inventory $(SAGE_DOCBUILD_OPTS) # Matches doc-html--developer, doc-html--reference-manifolds etc. doc-html--%: - cd $(SAGE_ROOT) && ./sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-html--,,$@)) html $(SAGE_DOCBUILD_OPTS) + sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-html--,,$@)) html $(SAGE_DOCBUILD_OPTS) # reference manual, inventory ifndef SAGE_ROOT @@ -29,8 +31,8 @@ doc-inventory-reference: $(error SAGE_ROOT undefined. This Makefile needs to be invoked by build/make/install) else doc-inventory-reference: - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents reference)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents reference)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) doc-inventory--$(subst /,-,$(BIBLIO)) @@ -40,8 +42,8 @@ endif # reference manual, html doc-html-reference: doc-inventory-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents reference)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents reference)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-html--$(subst /,-,$(BIBLIO)) @@ -50,20 +52,20 @@ doc-html-reference: doc-inventory-reference # other documentation, html doc-html-other: doc-html-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents all)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents all)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-html--$(subst /,-,$(doc))) doc-html: doc-html-reference doc-html-other # Matches doc-pdf--developer, doc-pdf--reference-manifolds etc. doc-pdf--%: - cd $(SAGE_ROOT) && ./sage --docbuild $(subst -,/,$(subst doc-pdf--,,$@)) pdf $(SAGE_DOCBUILD_OPTS) + sage --docbuild $(subst -,/,$(subst doc-pdf--,,$@)) pdf $(SAGE_DOCBUILD_OPTS) # reference manual, pdf doc-pdf-reference: doc-inventory-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents reference)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents reference)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-pdf--$(subst /,-,$(BIBLIO)) @@ -72,13 +74,13 @@ doc-pdf-reference: doc-inventory-reference # other documentation, pdf doc-pdf-other: doc-html-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents all)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents all)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-pdf--$(subst /,-,$(doc))) # website with pdf links doc-pdf-website: - cd $(SAGE_ROOT) && ./sage --docbuild website html $(SAGE_DOCBUILD_OPTS) + sage --docbuild website html $(SAGE_DOCBUILD_OPTS) doc-pdf: doc-pdf-reference doc-pdf-other doc-pdf-website From 7759f3c23b07b56897a691baf57e6f00b98d78b6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 14:36:37 -0700 Subject: [PATCH 148/338] Generate en/reference/repl/options.txt at build time, not bootstrap time --- Makefile | 1 - bootstrap | 1 - src/doc/Makefile | 8 +++++++- src/doc/bootstrap | 9 --------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 08c0d1b6beb..6f60bf31d3d 100644 --- a/Makefile +++ b/Makefile @@ -168,7 +168,6 @@ bootstrap-clean: rm -rf config configure build/make/Makefile-auto.in rm -f src/doc/en/installation/*.txt rm -rf src/doc/en/reference/spkg/*.rst - rm -f src/doc/en/reference/repl/*.txt rm -f environment.yml rm -f src/environment.yml rm -f src/environment-dev.yml diff --git a/bootstrap b/bootstrap index bf6b2716674..4d7021c4823 100755 --- a/bootstrap +++ b/bootstrap @@ -247,7 +247,6 @@ save () { build/make/Makefile-auto.in \ src/doc/en/installation/*.txt \ src/doc/en/reference/spkg/*.rst \ - src/doc/en/reference/repl/*.txt \ environment.yml \ src/environment.yml \ environment-optional.yml \ diff --git a/src/doc/Makefile b/src/doc/Makefile index 7a83422d481..62fb1cafd18 100644 --- a/src/doc/Makefile +++ b/src/doc/Makefile @@ -17,6 +17,11 @@ clean: rm -rf en/reference/sage rm -f common/*.pyc +# Sources generated at build time. (For sources generated at bootstrap time, see bootstrap.) +doc-src: + mkdir -p en/reference/repl + sage -advanced > en/reference/repl/options.txt + # Matches doc-inventory--reference-manifolds etc. doc-inventory--%: sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-inventory--,,$@)) inventory $(SAGE_DOCBUILD_OPTS) @@ -30,7 +35,7 @@ ifndef SAGE_ROOT doc-inventory-reference: $(error SAGE_ROOT undefined. This Makefile needs to be invoked by build/make/install) else -doc-inventory-reference: +doc-inventory-reference: doc-src $(eval DOCS = $(shell sage --docbuild --all-documents reference)) @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) @@ -85,6 +90,7 @@ doc-pdf-website: doc-pdf: doc-pdf-reference doc-pdf-other doc-pdf-website .PHONY: all clean \ + doc-src \ doc-html doc-pdf \ doc-inventory-reference doc-html-reference doc-pdf-reference \ doc-html-other doc-pdf-other diff --git a/src/doc/bootstrap b/src/doc/bootstrap index 7c7c5c9978c..44c94627a53 100755 --- a/src/doc/bootstrap +++ b/src/doc/bootstrap @@ -151,12 +151,3 @@ for PKG_BASE in $(sage-package list --has-file SPKG.rst | sort); do (echo ".. _spkg_$PKG_BASE:" && echo && OUTPUT_RST=1 sage-spkg-info $PKG_BASE) | sed -e "s|https://trac.sagemath.org/ticket/\([0-9]*\)|:trac:\`\1\`|g" -e "s|https://arxiv.org/abs/cs/\([0-9]*\)|:arxiv:\`cs/\1\`|g" > "$OUTPUT_DIR"/$PKG_BASE.rst echo >> "$OUTPUT_INDEX" " $PKG_BASE" done - -# #30064: Create the directory first -OUTPUT_DIR="src/doc/en/reference/repl" -mkdir -p "$OUTPUT_DIR" -OUTPUT="$OUTPUT_DIR/options.txt" -if [ "${BOOTSTRAP_QUIET}" = "no" ]; then - echo >&2 $0:$LINENO: installing "$OUTPUT" -fi -./sage -advanced > "$OUTPUT" From 67c8238c067ffb62f17a7e338dab57bc7d24ce70 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 17:46:11 -0700 Subject: [PATCH 149/338] src/bin/sage: Print error to error output --- src/bin/sage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/sage b/src/bin/sage index e94cc50940e..c2fab94a77b 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -208,7 +208,7 @@ case "$1" in exec "$SAGE_ROOT/build/bin/sage-site" "$@" # fallthrough if there is no sage-site script fi - echo "Error: unknown option: $1" + echo >&2 "Error: unknown option: $1" exit 1 ;; esac From 49ad190464acfa0105371dbffe96b5f757fd0082 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 19:27:16 -0700 Subject: [PATCH 150/338] m4/sage_spkg_collect.m4: Read files dependencies_{optional,order_only,check} --- m4/sage_spkg_collect.m4 | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index b89985efbaa..c1d33f1073c 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -322,22 +322,28 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl dnl dnl Determine package dependencies dnl - DEP_FILE="$DIR/dependencies" - if test -f "$DEP_FILE"; then + AS_IF([test -f "$DIR/dependencies"], [dnl dnl - the # symbol is treated as comment which is removed - DEPS=`sed 's/^ *//; s/ *#.*//; q' $DEP_FILE` - else - m4_define([ORDER_ONLY_DEPS], [])dnl - m4_case(SPKG_SOURCE, - [pip], [dnl - m4_define([ORDER_ONLY_DEPS], [pip])dnl - ])dnl - m4_ifval(ORDER_ONLY_DEPS, [dnl - DEPS="| ORDER_ONLY_DEPS" - ], [dnl - DEPS="" - ])dnl - fi + AS_VAR_SET([DEPS], [`sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies`]) + ], [dnl + AS_VAR_SET([DEPS], []) + ]) + AS_IF([test -f "$DIR/dependencies_optional"], [dnl + for a in $(sed 's/^ *//; s/ *#.*//; q' "$DIR/dependencies_optional"); do + AS_VAR_APPEND([DEPS], ['$(findstring '$a',$(OPTIONAL_INSTALLED_PACKAGES)) ']) + done + ]) + AS_CASE([$DEPS], [*\|*], [], [AS_VAR_APPEND([DEPS], [" |"])]) + AS_IF([test -f "$DIR/dependencies_order_only"], [dnl + AS_VAR_APPEND([DEPS], [' '$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_order_only))]) + ], [dnl + m4_case(SPKG_SOURCE, [pip], [AS_VAR_APPEND([DEPS], [' pip'])])dnl + ]) + AS_IF([test -f "$DIR/dependencies_check"], [dnl + AS_VAR_APPEND([DEPS], [' $(and $(filter-out no,$(SAGE_CHECK_]SPKG_NAME[)), ']) + AS_VAR_APPEND([DEPS], [$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_check))]) + AS_VAR_APPEND([DEPS], [')'])dnl + ]) dnl SAGE_PACKAGE_DEPENDENCIES="${SAGE_PACKAGE_DEPENDENCIES}$(printf '\ndeps_')SPKG_NAME = ${DEPS}" dnl From d0162546ab9ff0c560f095409317921ade917472 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 19:37:43 -0700 Subject: [PATCH 151/338] build/pkgs: Split dependencies_optional and dependencies_check out from dependencies --- build/pkgs/cvxopt/dependencies | 5 +---- build/pkgs/cvxopt/dependencies_check | 5 +++++ build/pkgs/database_knotinfo/dependencies | 2 +- build/pkgs/database_knotinfo/dependencies_check | 1 + build/pkgs/ipympl/dependencies | 2 +- build/pkgs/ipympl/dependencies_optional | 1 + build/pkgs/latte_int/dependencies | 3 +-- build/pkgs/latte_int/dependencies_optional | 1 + build/pkgs/mathics/dependencies | 2 +- build/pkgs/mathics/dependencies_check | 1 + build/pkgs/networkx/dependencies | 2 +- build/pkgs/polymake/dependencies | 3 +-- build/pkgs/polymake/dependencies_optional | 1 + build/pkgs/rpy2/dependencies | 3 +-- build/pkgs/rpy2/dependencies_check | 1 + build/pkgs/sage_sws2rst/dependencies | 2 +- build/pkgs/sage_sws2rst/dependencies_check | 1 + build/pkgs/sagemath_objects/dependencies | 2 +- build/pkgs/sagemath_objects/dependencies_check | 1 + build/pkgs/sagetex/dependencies | 6 +----- build/pkgs/sagetex/dependencies_check | 7 +++++++ build/pkgs/symengine_py/dependencies | 2 +- build/pkgs/symengine_py/dependencies_check | 1 + 23 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 build/pkgs/cvxopt/dependencies_check create mode 100644 build/pkgs/database_knotinfo/dependencies_check create mode 100644 build/pkgs/ipympl/dependencies_optional create mode 100644 build/pkgs/latte_int/dependencies_optional create mode 100644 build/pkgs/mathics/dependencies_check create mode 100644 build/pkgs/polymake/dependencies_optional create mode 100644 build/pkgs/rpy2/dependencies_check create mode 100644 build/pkgs/sage_sws2rst/dependencies_check create mode 100644 build/pkgs/sagemath_objects/dependencies_check create mode 100644 build/pkgs/sagetex/dependencies_check create mode 100644 build/pkgs/symengine_py/dependencies_check diff --git a/build/pkgs/cvxopt/dependencies b/build/pkgs/cvxopt/dependencies index 2354fdb1c1e..d47ae01f215 100644 --- a/build/pkgs/cvxopt/dependencies +++ b/build/pkgs/cvxopt/dependencies @@ -1,7 +1,4 @@ -$(PYTHON) numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig matplotlib $(and $(filter-out no,$(SAGE_CHECK_cvxopt)), pytest) - -matplotlib is needed to test cvxopt (i.e., if SAGE_CHECK=yes). See #12742. +$(PYTHON) numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cvxopt/dependencies_check b/build/pkgs/cvxopt/dependencies_check new file mode 100644 index 00000000000..68469b0ce91 --- /dev/null +++ b/build/pkgs/cvxopt/dependencies_check @@ -0,0 +1,5 @@ +matplotlib pytest + +# matplotlib is needed to test cvxopt (i.e., if SAGE_CHECK=yes). See #12742. +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/database_knotinfo/dependencies b/build/pkgs/database_knotinfo/dependencies index 30b944a731d..0738c2d7777 100644 --- a/build/pkgs/database_knotinfo/dependencies +++ b/build/pkgs/database_knotinfo/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_database_knotinfo)), $(SAGERUNTIME) ipywidgets sympy singular gap libhomfly libbraiding matplotlib) +$(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/database_knotinfo/dependencies_check b/build/pkgs/database_knotinfo/dependencies_check new file mode 100644 index 00000000000..3543bac84df --- /dev/null +++ b/build/pkgs/database_knotinfo/dependencies_check @@ -0,0 +1 @@ +$(SAGERUNTIME) ipywidgets sympy singular gap libhomfly libbraiding matplotlib diff --git a/build/pkgs/ipympl/dependencies b/build/pkgs/ipympl/dependencies index 56687b4dda0..b217268db20 100644 --- a/build/pkgs/ipympl/dependencies +++ b/build/pkgs/ipympl/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipywidgets matplotlib ipykernel jupyter_packaging $(findstring jupyterlab,$(OPTIONAL_INSTALLED_PACKAGES)) +$(PYTHON) | $(PYTHON_TOOLCHAIN) ipywidgets matplotlib ipykernel jupyter_packaging ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipympl/dependencies_optional b/build/pkgs/ipympl/dependencies_optional new file mode 100644 index 00000000000..c9356a72837 --- /dev/null +++ b/build/pkgs/ipympl/dependencies_optional @@ -0,0 +1 @@ +jupyterlab diff --git a/build/pkgs/latte_int/dependencies b/build/pkgs/latte_int/dependencies index ddfda62bcdb..412db1855de 100644 --- a/build/pkgs/latte_int/dependencies +++ b/build/pkgs/latte_int/dependencies @@ -1,5 +1,4 @@ -$(MP_LIBRARY) ntl 4ti2 cddlib lidia $(findstring lrslib,$(OPTIONAL_INSTALLED_PACKAGES)) +$(MP_LIBRARY) ntl 4ti2 cddlib lidia ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/latte_int/dependencies_optional b/build/pkgs/latte_int/dependencies_optional new file mode 100644 index 00000000000..c762c018aa3 --- /dev/null +++ b/build/pkgs/latte_int/dependencies_optional @@ -0,0 +1 @@ +lrslib diff --git a/build/pkgs/mathics/dependencies b/build/pkgs/mathics/dependencies index ab33cbad598..ac723a5ac26 100644 --- a/build/pkgs/mathics/dependencies +++ b/build/pkgs/mathics/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pint palettable mathics_scanner $(and $(filter-out no,$(SAGE_CHECK_mathics)), $(SAGERUNTIME) ipywidgets importlib_metadata sympy mpmath matplotlib) +$(PYTHON) | $(PYTHON_TOOLCHAIN) pint palettable mathics_scanner ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/mathics/dependencies_check b/build/pkgs/mathics/dependencies_check new file mode 100644 index 00000000000..a2c2a63716e --- /dev/null +++ b/build/pkgs/mathics/dependencies_check @@ -0,0 +1 @@ +$(SAGERUNTIME) ipywidgets importlib_metadata sympy mpmath matplotlib diff --git a/build/pkgs/networkx/dependencies b/build/pkgs/networkx/dependencies index 2a20cb459ba..f26477f0d95 100644 --- a/build/pkgs/networkx/dependencies +++ b/build/pkgs/networkx/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy $(and $(filter-out no,$(SAGE_CHECK_networkx)), pytest) +$(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/polymake/dependencies b/build/pkgs/polymake/dependencies index 7d77b977a21..b3ed8ed4299 100644 --- a/build/pkgs/polymake/dependencies +++ b/build/pkgs/polymake/dependencies @@ -1,5 +1,4 @@ -$(MP_LIBRARY) bliss cddlib $(findstring lrslib,$(OPTIONAL_INSTALLED_PACKAGES)) normaliz perl_term_readline_gnu ppl perl_cpan_polymake_prereq libxml2 | ninja_build +$(MP_LIBRARY) bliss cddlib normaliz perl_term_readline_gnu ppl perl_cpan_polymake_prereq libxml2 | ninja_build ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polymake/dependencies_optional b/build/pkgs/polymake/dependencies_optional new file mode 100644 index 00000000000..c762c018aa3 --- /dev/null +++ b/build/pkgs/polymake/dependencies_optional @@ -0,0 +1 @@ +lrslib diff --git a/build/pkgs/rpy2/dependencies b/build/pkgs/rpy2/dependencies index 35bbdcc39c9..862745ba3e0 100644 --- a/build/pkgs/rpy2/dependencies +++ b/build/pkgs/rpy2/dependencies @@ -1,5 +1,4 @@ -$(PYTHON) r cffi tzlocal pytz | $(PYTHON_TOOLCHAIN) pycparser $(and $(filter-out no,$(SAGE_CHECK_rpy2)), pytest numpy ipython) +$(PYTHON) r cffi tzlocal pytz | $(PYTHON_TOOLCHAIN) pycparser ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rpy2/dependencies_check b/build/pkgs/rpy2/dependencies_check new file mode 100644 index 00000000000..22c6e400a59 --- /dev/null +++ b/build/pkgs/rpy2/dependencies_check @@ -0,0 +1 @@ +pytest numpy ipython diff --git a/build/pkgs/sage_sws2rst/dependencies b/build/pkgs/sage_sws2rst/dependencies index ec13b4746e1..5ca5e27df75 100644 --- a/build/pkgs/sage_sws2rst/dependencies +++ b/build/pkgs/sage_sws2rst/dependencies @@ -1 +1 @@ -$(PYTHON) beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_sage_sws2rst)), tox) +$(PYTHON) beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) diff --git a/build/pkgs/sage_sws2rst/dependencies_check b/build/pkgs/sage_sws2rst/dependencies_check new file mode 100644 index 00000000000..053148f8486 --- /dev/null +++ b/build/pkgs/sage_sws2rst/dependencies_check @@ -0,0 +1 @@ +tox diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index fcacb179b57..9aff58ee6b1 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,4 +1,4 @@ -FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig $(and $(filter-out no,$(SAGE_CHECK)), tox) +FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig # FORCE: Always run the spkg-install script # ipython - for the doctester diff --git a/build/pkgs/sagemath_objects/dependencies_check b/build/pkgs/sagemath_objects/dependencies_check new file mode 100644 index 00000000000..053148f8486 --- /dev/null +++ b/build/pkgs/sagemath_objects/dependencies_check @@ -0,0 +1 @@ +tox diff --git a/build/pkgs/sagetex/dependencies b/build/pkgs/sagetex/dependencies index 43e658b4ff3..29f49d5c215 100644 --- a/build/pkgs/sagetex/dependencies +++ b/build/pkgs/sagetex/dependencies @@ -1,8 +1,4 @@ -$(PYTHON) maxima scipy matplotlib pillow tachyon | $(and $(filter-out no,$(SAGE_CHECK_sagetex)), $(SAGERUNTIME) sympy elliptic_curves jmol) - -To build SageTeX, you just need Python, but to test (SAGE_CHECK=yes) -SageTeX, you actually need to run Sage, produce plots,... +$(PYTHON) maxima scipy matplotlib pillow tachyon ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sagetex/dependencies_check b/build/pkgs/sagetex/dependencies_check new file mode 100644 index 00000000000..d24e23242d4 --- /dev/null +++ b/build/pkgs/sagetex/dependencies_check @@ -0,0 +1,7 @@ +$(SAGERUNTIME) sympy elliptic_curves jmol + +To build SageTeX, you just need Python, but to test (SAGE_CHECK=yes) +SageTeX, you actually need to run Sage, produce plots,... + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/symengine_py/dependencies b/build/pkgs/symengine_py/dependencies index a48b85c68e8..b041a3d5d3a 100644 --- a/build/pkgs/symengine_py/dependencies +++ b/build/pkgs/symengine_py/dependencies @@ -1,4 +1,4 @@ -symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_symengine_py)), pytest) +symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/symengine_py/dependencies_check b/build/pkgs/symengine_py/dependencies_check new file mode 100644 index 00000000000..e079f8a6038 --- /dev/null +++ b/build/pkgs/symengine_py/dependencies_check @@ -0,0 +1 @@ +pytest From a9eed4432ad2339062c99f921cd96a83cee57473 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 19:56:19 -0700 Subject: [PATCH 152/338] build/bin/sage-spkg-info: Restore message '(none known)' for packages without system package info --- build/bin/sage-spkg-info | 1 + 1 file changed, 1 insertion(+) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 3b6e2621d71..1043c3e1b04 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -56,6 +56,7 @@ done if [ $have_repology = yes ]; then systems="$systems repology" fi +system= for system in $systems; do system_package_file="$PKG_DISTROS"/$system.txt system_packages="$(echo $(sed 's/#.*//;' $system_package_file))" From 23e7a0b45744a829df093fd8f023c0996d664b09 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 20:05:21 -0700 Subject: [PATCH 153/338] build/bin/sage-spkg-info: Format dependencies --- build/bin/sage-spkg-info | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 1043c3e1b04..31cf05c8ff4 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -22,6 +22,36 @@ if [ -r "$PKG_SCRIPTS/type" ] ; then echo fi echo +echo "Dependencies" +echo "------------" +echo +dep= +for dep_file in dependencies dependencies_order_only; do + if [ -r "$PKG_SCRIPTS/$dep_file" ] ; then + for dep in $(sed 's/^ *//; s/ *#.*//; q' "$PKG_SCRIPTS/$dep_file"); do + case "$dep" in + # Do not use order-only syntax, too much information + \|) ;; + # Suppress dependencies on source file of the form $(SAGE_ROOT)/..., $(SAGE_SRC)/... + \$\(SAGE_*) ;; + # Suppress FORCE + FORCE) ;; + # Dependencies like $(BLAS) + \$\(*) echo "- $dep";; + # Looks like a package + *) if [ -n "$OUTPUT_RST" -a -d "$SAGE_ROOT/build/pkgs/$dep" ]; then + echo "- :ref:\`$dep\`" + else + echo "- $dep" + fi;; + esac + done + fi +done +if [ -z "$dep" ]; then + echo "None" +fi +echo echo "Version Information" echo "-------------------" echo From 5f67829480b58627197b0cb7c7788ad9651cfc2f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 20:26:44 -0700 Subject: [PATCH 154/338] build/pkgs/memory_allocator/SPKG.rst: Fix markup --- build/pkgs/memory_allocator/SPKG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/memory_allocator/SPKG.rst b/build/pkgs/memory_allocator/SPKG.rst index 42975c02f55..2c36e5f1105 100644 --- a/build/pkgs/memory_allocator/SPKG.rst +++ b/build/pkgs/memory_allocator/SPKG.rst @@ -1,5 +1,5 @@ -MemoryAllocator: An extension class to allocate memory easily with cython. -========================================================================== +memory\_allocator: An extension class to allocate memory easily with Cython +=========================================================================== This extension class started as part of the Sage software. From e8c283049743a282c47853eacd7f6c8a0a6ef6e2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 21:03:49 -0700 Subject: [PATCH 155/338] build/pkgs/mathics/SPKG.rst: Fix title --- build/pkgs/mathics/SPKG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/mathics/SPKG.rst b/build/pkgs/mathics/SPKG.rst index db4a63b84f1..09f9e87aea0 100644 --- a/build/pkgs/mathics/SPKG.rst +++ b/build/pkgs/mathics/SPKG.rst @@ -1,5 +1,5 @@ -Mathics3: A general-purpose computer algebra system. -==================================================== +mathics: A general-purpose computer algebra system +================================================== Description ----------- From 9761ef777a3c4cc679cd9a3df9da3eb7435b50e2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 21:11:43 -0700 Subject: [PATCH 156/338] build/bin/sage-spkg-info: Fix rst label --- build/bin/sage-spkg-info | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 31cf05c8ff4..5e762084183 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -39,8 +39,9 @@ for dep_file in dependencies dependencies_order_only; do # Dependencies like $(BLAS) \$\(*) echo "- $dep";; # Looks like a package - *) if [ -n "$OUTPUT_RST" -a -d "$SAGE_ROOT/build/pkgs/$dep" ]; then - echo "- :ref:\`$dep\`" + *) if [ -n "$OUTPUT_RST" -a -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then + # This RST label is set in src/doc/bootstrap + echo "- :ref:\`spkg_$dep\`" else echo "- $dep" fi;; From 5b2ed40b44354a26a42e10af6c327c270aed9d4b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 21:40:32 -0700 Subject: [PATCH 157/338] build/pkgs/[a-f]*/SPKG.rst: Remove redundant Dependencies sections; incidental cleanup --- build/pkgs/4ti2/SPKG.rst | 5 ---- build/pkgs/attrs/SPKG.rst | 5 ---- build/pkgs/awali/SPKG.rst | 11 -------- build/pkgs/benzene/SPKG.rst | 5 ---- build/pkgs/bleach/SPKG.rst | 5 ---- build/pkgs/bleach/dependencies | 3 +-- build/pkgs/bliss/SPKG.rst | 5 ---- build/pkgs/boost_cropped/SPKG.rst | 5 ---- build/pkgs/buckygen/SPKG.rst | 5 ---- build/pkgs/bzip2/SPKG.rst | 6 ----- build/pkgs/certifi/SPKG.rst | 5 ---- build/pkgs/cliquer/SPKG.rst | 5 ---- build/pkgs/cmake/SPKG.rst | 8 ------ build/pkgs/combinatorial_designs/SPKG.rst | 5 ---- build/pkgs/configure/SPKG.rst | 6 ----- build/pkgs/conway_polynomials/SPKG.rst | 5 ---- build/pkgs/coxeter3/SPKG.rst | 6 ----- build/pkgs/csdp/SPKG.rst | 4 --- build/pkgs/curl/SPKG.rst | 11 -------- build/pkgs/cvxopt/SPKG.rst | 27 ------------------- build/pkgs/cycler/SPKG.rst | 7 ----- build/pkgs/cypari/SPKG.rst | 8 ------ build/pkgs/cython/SPKG.rst | 5 ---- build/pkgs/d3js/SPKG.rst | 6 ----- build/pkgs/database_cremona_ellcurve/SPKG.rst | 11 -------- build/pkgs/database_jones_numfield/SPKG.rst | 6 ----- build/pkgs/database_mutation_class/SPKG.rst | 5 ---- build/pkgs/database_odlyzko_zeta/SPKG.rst | 5 ---- build/pkgs/database_stein_watkins/SPKG.rst | 10 ------- .../pkgs/database_stein_watkins_mini/SPKG.rst | 10 ------- build/pkgs/database_symbolic_data/SPKG.rst | 9 ------- build/pkgs/dateutil/SPKG.rst | 6 ----- build/pkgs/docutils/SPKG.rst | 11 -------- build/pkgs/eclib/SPKG.rst | 7 ----- build/pkgs/fflas_ffpack/SPKG.rst | 18 ------------- build/pkgs/fplll/SPKG.rst | 6 ----- build/pkgs/fpylll/SPKG.rst | 8 ------ build/pkgs/freetype/SPKG.rst | 5 ---- build/pkgs/fricas/SPKG.rst | 5 ---- 39 files changed, 1 insertion(+), 284 deletions(-) diff --git a/build/pkgs/4ti2/SPKG.rst b/build/pkgs/4ti2/SPKG.rst index 8b13ac91bcb..1a3a5e5c9c4 100644 --- a/build/pkgs/4ti2/SPKG.rst +++ b/build/pkgs/4ti2/SPKG.rst @@ -20,8 +20,3 @@ Upstream Contact - Raymond Hemmecke, TU Munich, Germany - Matthias Köppe, UC Davis, CA, USA - -Dependencies ------------- - -GLPK, GMP. diff --git a/build/pkgs/attrs/SPKG.rst b/build/pkgs/attrs/SPKG.rst index 12e3ed868e5..8f25e11d68f 100644 --- a/build/pkgs/attrs/SPKG.rst +++ b/build/pkgs/attrs/SPKG.rst @@ -18,8 +18,3 @@ Upstream Contact ---------------- Home page: https://www.attrs.org - -Dependencies ------------- - -Python diff --git a/build/pkgs/awali/SPKG.rst b/build/pkgs/awali/SPKG.rst index 845e3dda372..117b27010ed 100644 --- a/build/pkgs/awali/SPKG.rst +++ b/build/pkgs/awali/SPKG.rst @@ -28,16 +28,5 @@ Upstream Contact Dependencies ------------ -- Python -- CMake -- Cython -- ncurses - - graphviz must be installed from your distro, and available in the path. - - -Special Update/Build Instructions ---------------------------------- - -- None diff --git a/build/pkgs/benzene/SPKG.rst b/build/pkgs/benzene/SPKG.rst index 9a31276399b..6dd94f0bb7e 100644 --- a/build/pkgs/benzene/SPKG.rst +++ b/build/pkgs/benzene/SPKG.rst @@ -24,8 +24,3 @@ version was adapted by Gunnar Brinkmann and Nico Van Cleemput for Grinvin. http://www.grinvin.org/ - -Dependencies ------------- - -- None diff --git a/build/pkgs/bleach/SPKG.rst b/build/pkgs/bleach/SPKG.rst index 688e9214eda..f7a1b5ecc64 100644 --- a/build/pkgs/bleach/SPKG.rst +++ b/build/pkgs/bleach/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact ---------------- Home Page: https://github.com/mozilla/bleach - -Dependencies ------------- - -Python, html5lib, six diff --git a/build/pkgs/bleach/dependencies b/build/pkgs/bleach/dependencies index 7b139dc904c..4a74f9bfd68 100644 --- a/build/pkgs/bleach/dependencies +++ b/build/pkgs/bleach/dependencies @@ -1,5 +1,4 @@ -$(PYTHON) packaging six | $(PYTHON_TOOLCHAIN) +$(PYTHON) packaging six webencodings | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/bliss/SPKG.rst b/build/pkgs/bliss/SPKG.rst index 236b87a1990..875bc39a2df 100644 --- a/build/pkgs/bliss/SPKG.rst +++ b/build/pkgs/bliss/SPKG.rst @@ -24,8 +24,3 @@ We apply patches generated from https://github.com/mkoeppe/bliss (branch apply_debian_patches) as our upstream. This tracks the patches from the Debian package, adding an autotools build system and adjusting the include file locations. - -Dependencies ------------- - -None diff --git a/build/pkgs/boost_cropped/SPKG.rst b/build/pkgs/boost_cropped/SPKG.rst index 2aa8d4992a1..4efa07ea966 100644 --- a/build/pkgs/boost_cropped/SPKG.rst +++ b/build/pkgs/boost_cropped/SPKG.rst @@ -31,8 +31,3 @@ Upstream Contact Website: http://www.boost.org/ See mailing list page at http://www.boost.org/community/groups.html - -Dependencies ------------- - -None diff --git a/build/pkgs/buckygen/SPKG.rst b/build/pkgs/buckygen/SPKG.rst index b522376e3c7..63a9dbef355 100644 --- a/build/pkgs/buckygen/SPKG.rst +++ b/build/pkgs/buckygen/SPKG.rst @@ -22,8 +22,3 @@ Buckygen was mainly written by Jan Goedgebeur, jan.goedgebeur[at]ugent.be. http://caagt.ugent.be/buckygen/ - -Dependencies ------------- - -- None diff --git a/build/pkgs/bzip2/SPKG.rst b/build/pkgs/bzip2/SPKG.rst index 30b3de98ac5..6aa6cda65b6 100644 --- a/build/pkgs/bzip2/SPKG.rst +++ b/build/pkgs/bzip2/SPKG.rst @@ -23,12 +23,6 @@ Upstream Contact - Website http://bzip.org/ - Author: Julian Seward -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/certifi/SPKG.rst b/build/pkgs/certifi/SPKG.rst index 222b3923976..3b06f9d655c 100644 --- a/build/pkgs/certifi/SPKG.rst +++ b/build/pkgs/certifi/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact ---------------- Home page: https://pypi.python.org/pypi/certifi - -Dependencies ------------- - -Python, Setuptools diff --git a/build/pkgs/cliquer/SPKG.rst b/build/pkgs/cliquer/SPKG.rst index 9c0a7e25687..270e001ee6d 100644 --- a/build/pkgs/cliquer/SPKG.rst +++ b/build/pkgs/cliquer/SPKG.rst @@ -22,11 +22,6 @@ Cliquer was mainly written by Sampo Niskanen, sampo.niskanenQiki.fi https://users.aalto.fi/~pat/cliquer.html -Dependencies ------------- - -- None - Patches ------- diff --git a/build/pkgs/cmake/SPKG.rst b/build/pkgs/cmake/SPKG.rst index 0cc5039b297..33eeabf7367 100644 --- a/build/pkgs/cmake/SPKG.rst +++ b/build/pkgs/cmake/SPKG.rst @@ -27,11 +27,3 @@ Upstream Contact - https://cmake.org/ - cmake-developers@cmake.org - -Dependencies ------------- - -- curl -- zlib -- bzip2 -- xz diff --git a/build/pkgs/combinatorial_designs/SPKG.rst b/build/pkgs/combinatorial_designs/SPKG.rst index 0f2c0fbb687..f6ebb33642f 100644 --- a/build/pkgs/combinatorial_designs/SPKG.rst +++ b/build/pkgs/combinatorial_designs/SPKG.rst @@ -19,8 +19,3 @@ Upstream Contact ---------------- None - -Dependencies ------------- - -N/A diff --git a/build/pkgs/configure/SPKG.rst b/build/pkgs/configure/SPKG.rst index 29846d5e379..6b1365806d0 100644 --- a/build/pkgs/configure/SPKG.rst +++ b/build/pkgs/configure/SPKG.rst @@ -20,12 +20,6 @@ Upstream Contact Automatically generated by Sage, use trac and/or sage-devel for questions. -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/conway_polynomials/SPKG.rst b/build/pkgs/conway_polynomials/SPKG.rst index f3673e36f12..64a5bad04df 100644 --- a/build/pkgs/conway_polynomials/SPKG.rst +++ b/build/pkgs/conway_polynomials/SPKG.rst @@ -6,11 +6,6 @@ Description Frank Lübeck's tables of Conway polynomials over finite fields. -Dependencies ------------- - -- Sage library - Upstream contact ---------------- diff --git a/build/pkgs/coxeter3/SPKG.rst b/build/pkgs/coxeter3/SPKG.rst index fa546b079d2..6efb3da16a2 100644 --- a/build/pkgs/coxeter3/SPKG.rst +++ b/build/pkgs/coxeter3/SPKG.rst @@ -37,12 +37,6 @@ Alas, Fokko Ducloux passed away in 2006. http://math.univ-lyon1.fr/~ducloux/du_Cloux.html -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/csdp/SPKG.rst b/build/pkgs/csdp/SPKG.rst index a6776483533..b65b9305e66 100644 --- a/build/pkgs/csdp/SPKG.rst +++ b/build/pkgs/csdp/SPKG.rst @@ -19,10 +19,6 @@ Upstream Contact Dmitrii Pasechnik -Dependencies ------------- - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/curl/SPKG.rst b/build/pkgs/curl/SPKG.rst index d19345aca4f..33fac1d71e9 100644 --- a/build/pkgs/curl/SPKG.rst +++ b/build/pkgs/curl/SPKG.rst @@ -18,14 +18,3 @@ Upstream Contact According to the file README at the root of the tarball, contact is done by mailing https://curl.haxx.se/mail/ - -Dependencies ------------- - -None listed. - - -Special Update/Build Instructions ---------------------------------- - -None. diff --git a/build/pkgs/cvxopt/SPKG.rst b/build/pkgs/cvxopt/SPKG.rst index 1bb5f3813ae..0730481d997 100644 --- a/build/pkgs/cvxopt/SPKG.rst +++ b/build/pkgs/cvxopt/SPKG.rst @@ -27,30 +27,3 @@ License GPLv3 or later. Includes parts under GPLv2, GNU Lesser General Public License, v2.1. See src/LICENSE for more details. (Sage-compatible) - -Dependencies ------------- - -- GNU patch -- GSL -- GLPK - - -Special Update/Build Instructions ---------------------------------- - -- cvxopt.h.patch: Fix building with GCC on Solaris. - -- setup.py.patch: look for libraries and includes in $SAGE_LOCAL - instead of /usr. Add fortran, blas,... libraries if needed. - Build with GSL and GLPK support. - -- remove doc/html/, as it can be rebuild by invoking 'sage -sh' and - running 'make html' in doc/ - -- TODO: Add more tests in spkg-check - -- TODO: one might want to enhance the code to allow other Sage - random sources, at the moment only GSL is used in CVXOPT-1.1.3 - spkg, apparently it will need an unclear to me "with seed(..)" - construct. diff --git a/build/pkgs/cycler/SPKG.rst b/build/pkgs/cycler/SPKG.rst index 93cbed9e199..750580f9869 100644 --- a/build/pkgs/cycler/SPKG.rst +++ b/build/pkgs/cycler/SPKG.rst @@ -20,10 +20,3 @@ cycler is developed on github: https://github.com/matplotlib/cycler A more informative webpage about cycler, its motivation and usage is at http://tacaswell.github.io/cycler/ - -Dependencies ------------- - -- python -- setuptools -- six diff --git a/build/pkgs/cypari/SPKG.rst b/build/pkgs/cypari/SPKG.rst index f9473ab6206..0dd0ee8b31f 100644 --- a/build/pkgs/cypari/SPKG.rst +++ b/build/pkgs/cypari/SPKG.rst @@ -16,11 +16,3 @@ Upstream Contact ---------------- https://github.com/defeo/cypari2 - -Dependencies ------------- - -- Python -- Cython -- PARI -- cysignals diff --git a/build/pkgs/cython/SPKG.rst b/build/pkgs/cython/SPKG.rst index e7a958c78be..da9be186bde 100644 --- a/build/pkgs/cython/SPKG.rst +++ b/build/pkgs/cython/SPKG.rst @@ -30,8 +30,3 @@ Upstream Contact - http://www.cython.org/ - cython-devel@python.org - -Dependencies ------------- - -- Python diff --git a/build/pkgs/d3js/SPKG.rst b/build/pkgs/d3js/SPKG.rst index c5d838f1c84..219f731d168 100644 --- a/build/pkgs/d3js/SPKG.rst +++ b/build/pkgs/d3js/SPKG.rst @@ -20,12 +20,6 @@ Upstream Contact - Author: Mike Bostock (http://bost.ocks.org/mike/) - Home page: http://d3js.org/ -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/database_cremona_ellcurve/SPKG.rst b/build/pkgs/database_cremona_ellcurve/SPKG.rst index 9341e1bd335..7d37832e6cb 100644 --- a/build/pkgs/database_cremona_ellcurve/SPKG.rst +++ b/build/pkgs/database_cremona_ellcurve/SPKG.rst @@ -15,17 +15,6 @@ License Public Domain -Dependencies ------------- - -None - -Patches -~~~~~~~ - -- None - - Upstream Contact ---------------- diff --git a/build/pkgs/database_jones_numfield/SPKG.rst b/build/pkgs/database_jones_numfield/SPKG.rst index 1d5f81b68f0..14c4c73cf1d 100644 --- a/build/pkgs/database_jones_numfield/SPKG.rst +++ b/build/pkgs/database_jones_numfield/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact sage-devel@googlegroups.com -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/database_mutation_class/SPKG.rst b/build/pkgs/database_mutation_class/SPKG.rst index e73e2c0be80..761db83425b 100644 --- a/build/pkgs/database_mutation_class/SPKG.rst +++ b/build/pkgs/database_mutation_class/SPKG.rst @@ -25,8 +25,3 @@ SPKG Maintainers ---------------- - C. Stump - -Dependencies ------------- - -- None diff --git a/build/pkgs/database_odlyzko_zeta/SPKG.rst b/build/pkgs/database_odlyzko_zeta/SPKG.rst index 17d0c366bf2..b58185fcaee 100644 --- a/build/pkgs/database_odlyzko_zeta/SPKG.rst +++ b/build/pkgs/database_odlyzko_zeta/SPKG.rst @@ -8,8 +8,3 @@ Table of zeros of the Riemann zeta function by Andrew Odlyzko. This package contains the file 'zeros6' with the first 2,001,052 zeros of the Riemann zeta function, accurate to within 4*10^(-9). - -Dependencies ------------- - -- Sage library diff --git a/build/pkgs/database_stein_watkins/SPKG.rst b/build/pkgs/database_stein_watkins/SPKG.rst index 28746bfc826..74484171f7c 100644 --- a/build/pkgs/database_stein_watkins/SPKG.rst +++ b/build/pkgs/database_stein_watkins/SPKG.rst @@ -14,13 +14,3 @@ License ------- Public Domain - -Dependencies ------------- - -None - -Patches -~~~~~~~ - -None diff --git a/build/pkgs/database_stein_watkins_mini/SPKG.rst b/build/pkgs/database_stein_watkins_mini/SPKG.rst index d9b14940131..e82989564b2 100644 --- a/build/pkgs/database_stein_watkins_mini/SPKG.rst +++ b/build/pkgs/database_stein_watkins_mini/SPKG.rst @@ -14,13 +14,3 @@ License ------- Public Domain - -Dependencies ------------- - -None - -Patches -~~~~~~~ - -None diff --git a/build/pkgs/database_symbolic_data/SPKG.rst b/build/pkgs/database_symbolic_data/SPKG.rst index f809a76ec96..18f7dc963ff 100644 --- a/build/pkgs/database_symbolic_data/SPKG.rst +++ b/build/pkgs/database_symbolic_data/SPKG.rst @@ -35,12 +35,3 @@ Upstream Contact ---------------- - Andreas Nareike - -Dependencies ------------- - - -Special Update/Build Instructions ---------------------------------- - -List patches that need to be applied and what they do diff --git a/build/pkgs/dateutil/SPKG.rst b/build/pkgs/dateutil/SPKG.rst index 796cbdb2f56..8d26c6dceb7 100644 --- a/build/pkgs/dateutil/SPKG.rst +++ b/build/pkgs/dateutil/SPKG.rst @@ -21,9 +21,3 @@ Author: Gustavo Niemeyer Home page: http://labix.org/python-dateutil https://pypi.org/project/python-dateutil/ - -Dependencies ------------- - -- Python -- Six diff --git a/build/pkgs/docutils/SPKG.rst b/build/pkgs/docutils/SPKG.rst index 2547e4facfd..c0c6da387c7 100644 --- a/build/pkgs/docutils/SPKG.rst +++ b/build/pkgs/docutils/SPKG.rst @@ -21,14 +21,3 @@ Upstream Contact Author: David Goodger Home Page: http://docutils.sourceforge.net/ - -Dependencies ------------- - -None - - -Special Update/Build Instructions ---------------------------------- - -None diff --git a/build/pkgs/eclib/SPKG.rst b/build/pkgs/eclib/SPKG.rst index cca1baa0670..5627fdcb57c 100644 --- a/build/pkgs/eclib/SPKG.rst +++ b/build/pkgs/eclib/SPKG.rst @@ -32,10 +32,3 @@ Upstream Contact - Website: http://homepages.warwick.ac.uk/staff/J.E.Cremona/mwrank/index.html - Repository: https://github.com/JohnCremona/eclib - -Dependencies ------------- - -- PARI -- NTL -- FLINT diff --git a/build/pkgs/fflas_ffpack/SPKG.rst b/build/pkgs/fflas_ffpack/SPKG.rst index 26c7e6385a1..0e3a7efdc70 100644 --- a/build/pkgs/fflas_ffpack/SPKG.rst +++ b/build/pkgs/fflas_ffpack/SPKG.rst @@ -15,25 +15,7 @@ License LGPL V2.1 or later -SPKG Repository ---------------- - - https://bitbucket.org/malb/fflas-ffpack-spkg - - Upstream Contact ---------------- - - -Dependencies ------------- - -- Givaro -- a BLAS implementation such as openblas - - -Patches -------- - -- bash.patch: fix shebang line to "#!/usr/bin/env bash" diff --git a/build/pkgs/fplll/SPKG.rst b/build/pkgs/fplll/SPKG.rst index d7c3ade83c0..2fe28e50e25 100644 --- a/build/pkgs/fplll/SPKG.rst +++ b/build/pkgs/fplll/SPKG.rst @@ -21,9 +21,3 @@ Upstream Contact - Martin Albrecht - Mailing List https://groups.google.com/forum/#!forum/fplll-devel - -Dependencies ------------- - -- gmp -- mpfr diff --git a/build/pkgs/fpylll/SPKG.rst b/build/pkgs/fpylll/SPKG.rst index 84d7bcbf7ac..199893d5761 100644 --- a/build/pkgs/fpylll/SPKG.rst +++ b/build/pkgs/fpylll/SPKG.rst @@ -16,11 +16,3 @@ Upstream Contact ---------------- https://github.com/fplll/fpylll - -Dependencies ------------- - -- Cython -- fplll -- Sage (optional) -- NumPy (optional) diff --git a/build/pkgs/freetype/SPKG.rst b/build/pkgs/freetype/SPKG.rst index 74b3f67df71..368a6763462 100644 --- a/build/pkgs/freetype/SPKG.rst +++ b/build/pkgs/freetype/SPKG.rst @@ -45,8 +45,3 @@ Upstream Contact - official: http://git.savannah.gnu.org/cgit/freetype - mirror: https://github.com/aseprite/freetype2/ - -Dependencies ------------- - -See the ``dependencies`` file. diff --git a/build/pkgs/fricas/SPKG.rst b/build/pkgs/fricas/SPKG.rst index 7d18dd6fa78..5f8e01324ef 100644 --- a/build/pkgs/fricas/SPKG.rst +++ b/build/pkgs/fricas/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact ---------------- http://fricas.sourceforge.net/ - -Dependencies ------------- - -- ecl From f9e76d552d5f64df4b3925b447fa3b10895fbdab Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 21:45:21 -0700 Subject: [PATCH 158/338] build/pkgs/*/dependencies: Remove outdated boilerplate comment --- build/pkgs/4ti2/dependencies | 1 - build/pkgs/alabaster/dependencies | 1 - build/pkgs/appnope/dependencies | 1 - build/pkgs/arb/dependencies | 1 - build/pkgs/attrs/dependencies | 1 - build/pkgs/awali/dependencies | 1 - build/pkgs/babel/dependencies | 1 - build/pkgs/backcall/dependencies | 1 - build/pkgs/barvinok/dependencies | 1 - build/pkgs/bliss/dependencies | 1 - build/pkgs/boost_cropped/dependencies | 1 - build/pkgs/brial/dependencies | 1 - build/pkgs/buckygen/dependencies | 1 - build/pkgs/bzip2/dependencies | 1 - build/pkgs/cbc/dependencies | 1 - build/pkgs/ccache/dependencies | 1 - build/pkgs/cddlib/dependencies | 1 - build/pkgs/certifi/dependencies | 1 - build/pkgs/cffi/dependencies | 1 - build/pkgs/cliquer/dependencies | 1 - build/pkgs/cmake/dependencies | 1 - build/pkgs/cocoalib/dependencies | 1 - build/pkgs/combinatorial_designs/dependencies | 1 - build/pkgs/conway_polynomials/dependencies | 1 - build/pkgs/cppy/dependencies | 1 - build/pkgs/cryptominisat/dependencies | 1 - build/pkgs/csdp/dependencies | 1 - build/pkgs/curl/dependencies | 1 - build/pkgs/cycler/dependencies | 1 - build/pkgs/cypari/dependencies | 1 - build/pkgs/cysignals/dependencies | 1 - build/pkgs/cython/dependencies | 1 - build/pkgs/d3js/dependencies | 1 - build/pkgs/database_cremona_ellcurve/dependencies | 1 - build/pkgs/database_jones_numfield/dependencies | 1 - build/pkgs/database_odlyzko_zeta/dependencies | 1 - build/pkgs/database_stein_watkins/dependencies | 1 - build/pkgs/database_stein_watkins_mini/dependencies | 1 - build/pkgs/database_symbolic_data/dependencies | 1 - build/pkgs/dateutil/dependencies | 1 - build/pkgs/deformation/dependencies | 1 - build/pkgs/docutils/dependencies | 1 - build/pkgs/dot2tex/dependencies | 1 - build/pkgs/e_antic/dependencies | 1 - build/pkgs/ecl/dependencies | 1 - build/pkgs/eclib/dependencies | 1 - build/pkgs/ecm/dependencies | 1 - build/pkgs/elliptic_curves/dependencies | 1 - build/pkgs/entrypoints/dependencies | 1 - build/pkgs/fflas_ffpack/dependencies | 1 - build/pkgs/flint/dependencies | 1 - build/pkgs/flintqs/dependencies | 1 - build/pkgs/fplll/dependencies | 1 - build/pkgs/fpylll/dependencies | 1 - build/pkgs/freetype/dependencies | 1 - build/pkgs/fricas/dependencies | 1 - build/pkgs/gambit/dependencies | 1 - build/pkgs/gap/dependencies | 1 - build/pkgs/gap_packages/dependencies | 1 - build/pkgs/gc/dependencies | 1 - build/pkgs/gdb/dependencies | 1 - build/pkgs/gengetopt/dependencies | 1 - build/pkgs/gfan/dependencies | 1 - build/pkgs/giac/dependencies | 1 - build/pkgs/givaro/dependencies | 1 - build/pkgs/glpk/dependencies | 1 - build/pkgs/glucose/dependencies | 1 - build/pkgs/gmpy2/dependencies | 1 - build/pkgs/gp2c/dependencies | 1 - build/pkgs/graphs/dependencies | 1 - build/pkgs/gsl/dependencies | 1 - build/pkgs/html5lib/dependencies | 1 - build/pkgs/iconv/dependencies | 1 - build/pkgs/imagesize/dependencies | 1 - build/pkgs/iml/dependencies | 1 - build/pkgs/importlib_metadata/dependencies | 1 - build/pkgs/info/dependencies | 1 - build/pkgs/ipykernel/dependencies | 1 - build/pkgs/ipython/dependencies | 1 - build/pkgs/ipython_genutils/dependencies | 1 - build/pkgs/ipywidgets/dependencies | 1 - build/pkgs/isl/dependencies | 1 - build/pkgs/jedi/dependencies | 1 - build/pkgs/jinja2/dependencies | 1 - build/pkgs/jmol/dependencies | 1 - build/pkgs/jsonschema/dependencies | 1 - build/pkgs/jupymake/dependencies | 1 - build/pkgs/jupyter_client/dependencies | 1 - build/pkgs/jupyter_core/dependencies | 1 - build/pkgs/jupyterlab/dependencies | 1 - build/pkgs/kenzo/dependencies | 1 - build/pkgs/kiwisolver/dependencies | 1 - build/pkgs/lcalc/dependencies | 1 - build/pkgs/libatomic_ops/dependencies | 1 - build/pkgs/libffi/dependencies | 1 - build/pkgs/libgd/dependencies | 1 - build/pkgs/liblzma/dependencies | 1 - build/pkgs/libnauty/dependencies | 1 - build/pkgs/libogg/dependencies | 1 - build/pkgs/libpng/dependencies | 1 - build/pkgs/libsemigroups/dependencies | 1 - build/pkgs/libtheora/dependencies | 1 - build/pkgs/libxml2/dependencies | 1 - build/pkgs/lidia/dependencies | 1 - build/pkgs/lie/dependencies | 1 - build/pkgs/linbox/dependencies | 1 - build/pkgs/lrcalc/dependencies | 1 - build/pkgs/lrcalc_python/dependencies | 1 - build/pkgs/lrslib/dependencies | 1 - build/pkgs/m4ri/dependencies | 1 - build/pkgs/m4rie/dependencies | 1 - build/pkgs/markupsafe/dependencies | 1 - build/pkgs/matplotlib/dependencies | 1 - build/pkgs/maxima/dependencies | 1 - build/pkgs/memory_allocator/dependencies | 1 - build/pkgs/mistune/dependencies | 1 - build/pkgs/mpc/dependencies | 1 - build/pkgs/mpfi/dependencies | 1 - build/pkgs/mpfr/dependencies | 1 - build/pkgs/mpfrcx/dependencies | 1 - build/pkgs/mpmath/dependencies | 1 - build/pkgs/nauty/dependencies | 1 - build/pkgs/nbconvert/dependencies | 1 - build/pkgs/nbformat/dependencies | 1 - build/pkgs/ncurses/dependencies | 1 - build/pkgs/networkx/dependencies | 1 - build/pkgs/ninja_build/dependencies | 1 - build/pkgs/nodeenv/dependencies | 1 - build/pkgs/nodejs/dependencies | 1 - build/pkgs/normaliz/dependencies | 1 - build/pkgs/notebook/dependencies | 1 - build/pkgs/notedown/dependencies | 1 - build/pkgs/ntl/dependencies | 1 - build/pkgs/numpy/dependencies | 1 - build/pkgs/openblas/dependencies | 1 - build/pkgs/openssl/dependencies | 1 - build/pkgs/ore_algebra/dependencies | 1 - build/pkgs/packaging/dependencies | 1 - build/pkgs/pandoc_attributes/dependencies | 1 - build/pkgs/pandocfilters/dependencies | 1 - build/pkgs/pari/dependencies | 1 - build/pkgs/pari_elldata/dependencies | 1 - build/pkgs/pari_galdata/dependencies | 1 - build/pkgs/pari_galpol/dependencies | 1 - build/pkgs/pari_nftables/dependencies | 1 - build/pkgs/pari_seadata/dependencies | 1 - build/pkgs/pari_seadata_small/dependencies | 1 - build/pkgs/parso/dependencies | 1 - build/pkgs/patch/dependencies | 1 - build/pkgs/pcre/dependencies | 1 - build/pkgs/perl_term_readline_gnu/dependencies | 1 - build/pkgs/pexpect/dependencies | 1 - build/pkgs/pickleshare/dependencies | 1 - build/pkgs/pillow/dependencies | 1 - build/pkgs/pip/dependencies | 1 - build/pkgs/pkgconf/dependencies | 1 - build/pkgs/pkgconfig/dependencies | 1 - build/pkgs/planarity/dependencies | 1 - build/pkgs/plantri/dependencies | 1 - build/pkgs/polylib/dependencies | 1 - build/pkgs/polytopes_db/dependencies | 1 - build/pkgs/ppl/dependencies | 1 - build/pkgs/prometheus_client/dependencies | 1 - build/pkgs/prompt_toolkit/dependencies | 1 - build/pkgs/ptyprocess/dependencies | 1 - build/pkgs/pycosat/dependencies | 1 - build/pkgs/pycparser/dependencies | 1 - build/pkgs/pycryptosat/dependencies | 1 - build/pkgs/pycygwin/dependencies | 1 - build/pkgs/pygments/dependencies | 1 - build/pkgs/pynormaliz/dependencies | 1 - build/pkgs/pyparsing/dependencies | 1 - build/pkgs/pyrsistent/dependencies | 1 - build/pkgs/python3/dependencies | 1 - build/pkgs/python_igraph/dependencies | 1 - build/pkgs/pytz/dependencies | 1 - build/pkgs/pyzmq/dependencies | 1 - build/pkgs/qepcad/dependencies | 1 - build/pkgs/qhull/dependencies | 1 - build/pkgs/r/dependencies | 1 - build/pkgs/readline/dependencies | 1 - build/pkgs/requests/dependencies | 1 - build/pkgs/rst2ipynb/dependencies | 1 - build/pkgs/rubiks/dependencies | 1 - build/pkgs/rw/dependencies | 1 - build/pkgs/saclib/dependencies | 1 - build/pkgs/sage_numerical_backends_coin/dependencies | 1 - build/pkgs/sage_numerical_backends_cplex/dependencies | 1 - build/pkgs/sage_numerical_backends_gurobi/dependencies | 1 - build/pkgs/sage_setup/dependencies | 1 - build/pkgs/sagelib/dependencies | 1 - build/pkgs/sagenb_export/dependencies | 1 - build/pkgs/scipoptsuite/dependencies | 1 - build/pkgs/scipy/dependencies | 1 - build/pkgs/setuptools/dependencies | 1 - build/pkgs/setuptools_scm/dependencies | 1 - build/pkgs/setuptools_wheel/dependencies | 1 - build/pkgs/simplegeneric/dependencies | 1 - build/pkgs/singular/dependencies | 1 - build/pkgs/sip/dependencies | 1 - build/pkgs/six/dependencies | 1 - build/pkgs/snowballstemmer/dependencies | 1 - build/pkgs/sphinx/dependencies | 1 - build/pkgs/sphinxcontrib_applehelp/dependencies | 1 - build/pkgs/sphinxcontrib_devhelp/dependencies | 1 - build/pkgs/sphinxcontrib_htmlhelp/dependencies | 1 - build/pkgs/sphinxcontrib_jsmath/dependencies | 1 - build/pkgs/sphinxcontrib_qthelp/dependencies | 1 - build/pkgs/sphinxcontrib_serializinghtml/dependencies | 1 - build/pkgs/sphinxcontrib_websupport/dependencies | 1 - build/pkgs/sqlite/dependencies | 1 - build/pkgs/surf/dependencies | 1 - build/pkgs/symengine/dependencies | 1 - build/pkgs/symengine_py/dependencies | 1 - build/pkgs/symmetrica/dependencies | 1 - build/pkgs/sympow/dependencies | 1 - build/pkgs/sympy/dependencies | 1 - build/pkgs/tachyon/dependencies | 1 - build/pkgs/terminado/dependencies | 1 - build/pkgs/testpath/dependencies | 1 - build/pkgs/texttable/dependencies | 1 - build/pkgs/tides/dependencies | 1 - build/pkgs/topcom/dependencies | 1 - build/pkgs/tornado/dependencies | 1 - build/pkgs/tox/dependencies | 1 - build/pkgs/traitlets/dependencies | 1 - build/pkgs/tzlocal/dependencies | 1 - build/pkgs/valgrind/dependencies | 1 - build/pkgs/vcversioner/dependencies | 1 - build/pkgs/wcwidth/dependencies | 1 - build/pkgs/webencodings/dependencies | 1 - build/pkgs/wheel/dependencies | 1 - build/pkgs/widgetsnbextension/dependencies | 1 - build/pkgs/xz/dependencies | 1 - build/pkgs/zeromq/dependencies | 1 - build/pkgs/zipp/dependencies | 1 - build/pkgs/zlib/dependencies | 1 - build/pkgs/zn_poly/dependencies | 1 - 238 files changed, 238 deletions(-) diff --git a/build/pkgs/4ti2/dependencies b/build/pkgs/4ti2/dependencies index 2b36820a7c5..72c4505b110 100644 --- a/build/pkgs/4ti2/dependencies +++ b/build/pkgs/4ti2/dependencies @@ -2,4 +2,3 @@ zlib $(MP_LIBRARY) glpk ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/alabaster/dependencies b/build/pkgs/alabaster/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/alabaster/dependencies +++ b/build/pkgs/alabaster/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/appnope/dependencies b/build/pkgs/appnope/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/appnope/dependencies +++ b/build/pkgs/appnope/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/arb/dependencies b/build/pkgs/arb/dependencies index 09c8e56f94a..c95d2836ce5 100644 --- a/build/pkgs/arb/dependencies +++ b/build/pkgs/arb/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr flint ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/attrs/dependencies b/build/pkgs/attrs/dependencies index 8b3637a0a0e..4361e46ddaf 100644 --- a/build/pkgs/attrs/dependencies +++ b/build/pkgs/attrs/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/awali/dependencies b/build/pkgs/awali/dependencies index ad153b34f3e..b125e2ded92 100644 --- a/build/pkgs/awali/dependencies +++ b/build/pkgs/awali/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cmake cython nbconvert ncurses ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/babel/dependencies b/build/pkgs/babel/dependencies index 2fabe3177df..41462907c20 100644 --- a/build/pkgs/babel/dependencies +++ b/build/pkgs/babel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pytz ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/backcall/dependencies b/build/pkgs/backcall/dependencies index 35228f20368..902a5feed13 100644 --- a/build/pkgs/backcall/dependencies +++ b/build/pkgs/backcall/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) flit_core tomli ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/barvinok/dependencies b/build/pkgs/barvinok/dependencies index e564790ea88..02d761438ff 100644 --- a/build/pkgs/barvinok/dependencies +++ b/build/pkgs/barvinok/dependencies @@ -2,4 +2,3 @@ ntl isl polylib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/bliss/dependencies b/build/pkgs/bliss/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/bliss/dependencies +++ b/build/pkgs/bliss/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/boost_cropped/dependencies b/build/pkgs/boost_cropped/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/boost_cropped/dependencies +++ b/build/pkgs/boost_cropped/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/brial/dependencies b/build/pkgs/brial/dependencies index 1944cbeb530..fdc17b08c96 100644 --- a/build/pkgs/brial/dependencies +++ b/build/pkgs/brial/dependencies @@ -2,4 +2,3 @@ boost_cropped m4ri libpng | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/buckygen/dependencies b/build/pkgs/buckygen/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/buckygen/dependencies +++ b/build/pkgs/buckygen/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/bzip2/dependencies b/build/pkgs/bzip2/dependencies index dae4f925522..5598eb21a8b 100644 --- a/build/pkgs/bzip2/dependencies +++ b/build/pkgs/bzip2/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cbc/dependencies b/build/pkgs/cbc/dependencies index 7137ee6f521..bdec3fbe76e 100644 --- a/build/pkgs/cbc/dependencies +++ b/build/pkgs/cbc/dependencies @@ -2,4 +2,3 @@ readline zlib bzip2 $(BLAS) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ccache/dependencies b/build/pkgs/ccache/dependencies index 4c0aa5c0d31..a1eb8a80d3d 100644 --- a/build/pkgs/ccache/dependencies +++ b/build/pkgs/ccache/dependencies @@ -2,4 +2,3 @@ zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cddlib/dependencies b/build/pkgs/cddlib/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/cddlib/dependencies +++ b/build/pkgs/cddlib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/certifi/dependencies b/build/pkgs/certifi/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/certifi/dependencies +++ b/build/pkgs/certifi/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cffi/dependencies b/build/pkgs/cffi/dependencies index aef34bf5a4d..9e4c266ad69 100644 --- a/build/pkgs/cffi/dependencies +++ b/build/pkgs/cffi/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pycparser ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cliquer/dependencies b/build/pkgs/cliquer/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/cliquer/dependencies +++ b/build/pkgs/cliquer/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cmake/dependencies b/build/pkgs/cmake/dependencies index 2b79396e60e..614b742ab6d 100644 --- a/build/pkgs/cmake/dependencies +++ b/build/pkgs/cmake/dependencies @@ -2,4 +2,3 @@ curl zlib bzip2 liblzma ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cocoalib/dependencies b/build/pkgs/cocoalib/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/cocoalib/dependencies +++ b/build/pkgs/cocoalib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/combinatorial_designs/dependencies b/build/pkgs/combinatorial_designs/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/combinatorial_designs/dependencies +++ b/build/pkgs/combinatorial_designs/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/conway_polynomials/dependencies b/build/pkgs/conway_polynomials/dependencies index 304d0c987a2..1700e743d59 100644 --- a/build/pkgs/conway_polynomials/dependencies +++ b/build/pkgs/conway_polynomials/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cppy/dependencies b/build/pkgs/cppy/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/cppy/dependencies +++ b/build/pkgs/cppy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cryptominisat/dependencies b/build/pkgs/cryptominisat/dependencies index 18f1811f305..15e88888b6d 100644 --- a/build/pkgs/cryptominisat/dependencies +++ b/build/pkgs/cryptominisat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) m4ri zlib libpng | cmake boost_cropped ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/csdp/dependencies b/build/pkgs/csdp/dependencies index 052eb4373db..40ad3c0e9b6 100644 --- a/build/pkgs/csdp/dependencies +++ b/build/pkgs/csdp/dependencies @@ -2,4 +2,3 @@ $(BLAS) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/curl/dependencies b/build/pkgs/curl/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/curl/dependencies +++ b/build/pkgs/curl/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cycler/dependencies b/build/pkgs/cycler/dependencies index fd848c100a8..730af09b339 100644 --- a/build/pkgs/cycler/dependencies +++ b/build/pkgs/cycler/dependencies @@ -1,5 +1,4 @@ $(PYTHON) six | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cypari/dependencies b/build/pkgs/cypari/dependencies index 3f04dd2b8f3..72b5af7ad81 100644 --- a/build/pkgs/cypari/dependencies +++ b/build/pkgs/cypari/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython pari cysignals | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cysignals/dependencies b/build/pkgs/cysignals/dependencies index 19bc31a739c..d3225d480f1 100644 --- a/build/pkgs/cysignals/dependencies +++ b/build/pkgs/cysignals/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython pari | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cython/dependencies b/build/pkgs/cython/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/cython/dependencies +++ b/build/pkgs/cython/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/d3js/dependencies b/build/pkgs/d3js/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/d3js/dependencies +++ b/build/pkgs/d3js/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_cremona_ellcurve/dependencies b/build/pkgs/database_cremona_ellcurve/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_cremona_ellcurve/dependencies +++ b/build/pkgs/database_cremona_ellcurve/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_jones_numfield/dependencies b/build/pkgs/database_jones_numfield/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_jones_numfield/dependencies +++ b/build/pkgs/database_jones_numfield/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_odlyzko_zeta/dependencies b/build/pkgs/database_odlyzko_zeta/dependencies index c1b713883fe..ec44bfaa468 100644 --- a/build/pkgs/database_odlyzko_zeta/dependencies +++ b/build/pkgs/database_odlyzko_zeta/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_stein_watkins/dependencies b/build/pkgs/database_stein_watkins/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_stein_watkins/dependencies +++ b/build/pkgs/database_stein_watkins/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_stein_watkins_mini/dependencies b/build/pkgs/database_stein_watkins_mini/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_stein_watkins_mini/dependencies +++ b/build/pkgs/database_stein_watkins_mini/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_symbolic_data/dependencies b/build/pkgs/database_symbolic_data/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_symbolic_data/dependencies +++ b/build/pkgs/database_symbolic_data/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/dateutil/dependencies b/build/pkgs/dateutil/dependencies index 4db01013112..7a972de985e 100644 --- a/build/pkgs/dateutil/dependencies +++ b/build/pkgs/dateutil/dependencies @@ -2,4 +2,3 @@ $(PYTHON) six | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/deformation/dependencies b/build/pkgs/deformation/dependencies index 09c8e56f94a..c95d2836ce5 100644 --- a/build/pkgs/deformation/dependencies +++ b/build/pkgs/deformation/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr flint ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/docutils/dependencies b/build/pkgs/docutils/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/docutils/dependencies +++ b/build/pkgs/docutils/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/dot2tex/dependencies b/build/pkgs/dot2tex/dependencies index e88742b6c74..c1925d16b73 100644 --- a/build/pkgs/dot2tex/dependencies +++ b/build/pkgs/dot2tex/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pyparsing ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/e_antic/dependencies b/build/pkgs/e_antic/dependencies index 895cffa0013..ff67f31325b 100644 --- a/build/pkgs/e_antic/dependencies +++ b/build/pkgs/e_antic/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) flint arb ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ecl/dependencies b/build/pkgs/ecl/dependencies index bf96c4ff887..cda6316bf5a 100644 --- a/build/pkgs/ecl/dependencies +++ b/build/pkgs/ecl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) readline gc libffi ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/eclib/dependencies b/build/pkgs/eclib/dependencies index 54e7e242559..b73cfa3391a 100644 --- a/build/pkgs/eclib/dependencies +++ b/build/pkgs/eclib/dependencies @@ -2,4 +2,3 @@ pari ntl flint ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ecm/dependencies b/build/pkgs/ecm/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/ecm/dependencies +++ b/build/pkgs/ecm/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/elliptic_curves/dependencies b/build/pkgs/elliptic_curves/dependencies index 1a36cc52351..6b134137610 100644 --- a/build/pkgs/elliptic_curves/dependencies +++ b/build/pkgs/elliptic_curves/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/entrypoints/dependencies b/build/pkgs/entrypoints/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/entrypoints/dependencies +++ b/build/pkgs/entrypoints/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fflas_ffpack/dependencies b/build/pkgs/fflas_ffpack/dependencies index 9aba473c01b..dbb5493271d 100644 --- a/build/pkgs/fflas_ffpack/dependencies +++ b/build/pkgs/fflas_ffpack/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) givaro gsl $(BLAS) | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/flint/dependencies b/build/pkgs/flint/dependencies index 2a23f3894a5..385df4faa7d 100644 --- a/build/pkgs/flint/dependencies +++ b/build/pkgs/flint/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ntl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/flintqs/dependencies b/build/pkgs/flintqs/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/flintqs/dependencies +++ b/build/pkgs/flintqs/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fplll/dependencies b/build/pkgs/fplll/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/fplll/dependencies +++ b/build/pkgs/fplll/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fpylll/dependencies b/build/pkgs/fpylll/dependencies index cc84e797e80..4b4fb1b44fb 100644 --- a/build/pkgs/fpylll/dependencies +++ b/build/pkgs/fpylll/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython cysignals numpy fplll ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/freetype/dependencies b/build/pkgs/freetype/dependencies index d4365d93067..af0f47547a8 100644 --- a/build/pkgs/freetype/dependencies +++ b/build/pkgs/freetype/dependencies @@ -2,4 +2,3 @@ libpng bzip2 ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fricas/dependencies b/build/pkgs/fricas/dependencies index ed6be201375..fffb89e2050 100644 --- a/build/pkgs/fricas/dependencies +++ b/build/pkgs/fricas/dependencies @@ -2,4 +2,3 @@ ecl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gambit/dependencies b/build/pkgs/gambit/dependencies index 2040b648774..1f00cbf5321 100644 --- a/build/pkgs/gambit/dependencies +++ b/build/pkgs/gambit/dependencies @@ -2,4 +2,3 @@ cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gap/dependencies b/build/pkgs/gap/dependencies index e0367988d88..a0bd86b58a1 100644 --- a/build/pkgs/gap/dependencies +++ b/build/pkgs/gap/dependencies @@ -2,4 +2,3 @@ ncurses readline zlib $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gap_packages/dependencies b/build/pkgs/gap_packages/dependencies index 21b057d2e47..342d2c8edd1 100644 --- a/build/pkgs/gap_packages/dependencies +++ b/build/pkgs/gap_packages/dependencies @@ -2,4 +2,3 @@ gap libsemigroups planarity | $(SAGERUNTIME) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gc/dependencies b/build/pkgs/gc/dependencies index 28dadf07615..471ebd6cd85 100644 --- a/build/pkgs/gc/dependencies +++ b/build/pkgs/gc/dependencies @@ -1,4 +1,3 @@ libatomic_ops ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gdb/dependencies b/build/pkgs/gdb/dependencies index 30508b35c45..bdf81f77180 100644 --- a/build/pkgs/gdb/dependencies +++ b/build/pkgs/gdb/dependencies @@ -2,4 +2,3 @@ mpfr zlib ncurses $(PYTHON) xz ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gengetopt/dependencies b/build/pkgs/gengetopt/dependencies index 7a7b9cf8a80..eb5b66f34f2 100644 --- a/build/pkgs/gengetopt/dependencies +++ b/build/pkgs/gengetopt/dependencies @@ -4,4 +4,3 @@ xz is needed for unpacking the tarball when sage-bootstrap-python is ancient ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gfan/dependencies b/build/pkgs/gfan/dependencies index 674fe7612fd..4c6301e2e5d 100644 --- a/build/pkgs/gfan/dependencies +++ b/build/pkgs/gfan/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) cddlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/giac/dependencies b/build/pkgs/giac/dependencies index c36972a1011..ddc04d1e402 100644 --- a/build/pkgs/giac/dependencies +++ b/build/pkgs/giac/dependencies @@ -2,4 +2,3 @@ readline libpng $(MP_LIBRARY) mpfr mpfi ntl gsl pari glpk curl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/install into SAGE_ROOT/build/Makefile. diff --git a/build/pkgs/givaro/dependencies b/build/pkgs/givaro/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/givaro/dependencies +++ b/build/pkgs/givaro/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/glpk/dependencies b/build/pkgs/glpk/dependencies index 6f9a6c00fe9..9b1acf2f429 100644 --- a/build/pkgs/glpk/dependencies +++ b/build/pkgs/glpk/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/glucose/dependencies b/build/pkgs/glucose/dependencies index 4c0aa5c0d31..a1eb8a80d3d 100644 --- a/build/pkgs/glucose/dependencies +++ b/build/pkgs/glucose/dependencies @@ -2,4 +2,3 @@ zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gmpy2/dependencies b/build/pkgs/gmpy2/dependencies index 510fc637e95..98c6065dc87 100644 --- a/build/pkgs/gmpy2/dependencies +++ b/build/pkgs/gmpy2/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(MP_LIBRARY) mpfr mpc | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gp2c/dependencies b/build/pkgs/gp2c/dependencies index 7537ca02746..92256baba2a 100644 --- a/build/pkgs/gp2c/dependencies +++ b/build/pkgs/gp2c/dependencies @@ -2,4 +2,3 @@ pari ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/install into SAGE_ROOT/build/Makefile. diff --git a/build/pkgs/graphs/dependencies b/build/pkgs/graphs/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/graphs/dependencies +++ b/build/pkgs/graphs/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gsl/dependencies b/build/pkgs/gsl/dependencies index 576809127c7..8073e1a7f67 100644 --- a/build/pkgs/gsl/dependencies +++ b/build/pkgs/gsl/dependencies @@ -2,4 +2,3 @@ $(BLAS) | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/html5lib/dependencies b/build/pkgs/html5lib/dependencies index cdcfeeba041..89200065387 100644 --- a/build/pkgs/html5lib/dependencies +++ b/build/pkgs/html5lib/dependencies @@ -2,4 +2,3 @@ $(PYTHON) webencodings | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/iconv/dependencies b/build/pkgs/iconv/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/iconv/dependencies +++ b/build/pkgs/iconv/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/imagesize/dependencies b/build/pkgs/imagesize/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/imagesize/dependencies +++ b/build/pkgs/imagesize/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/iml/dependencies b/build/pkgs/iml/dependencies index 5a73e699d00..be919463819 100644 --- a/build/pkgs/iml/dependencies +++ b/build/pkgs/iml/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) $(BLAS) | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/importlib_metadata/dependencies b/build/pkgs/importlib_metadata/dependencies index 9fcc3b0cc65..77aa2a42f93 100644 --- a/build/pkgs/importlib_metadata/dependencies +++ b/build/pkgs/importlib_metadata/dependencies @@ -2,4 +2,3 @@ $(PYTHON) zipp typing_extensions | $(PYTHON_TOOLCHAIN) tomli ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/info/dependencies b/build/pkgs/info/dependencies index c2c72b44a87..5405130e47b 100644 --- a/build/pkgs/info/dependencies +++ b/build/pkgs/info/dependencies @@ -7,4 +7,3 @@ system despite not being listed explicitly anywhere. ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipykernel/dependencies b/build/pkgs/ipykernel/dependencies index 5b3708a31fc..03ac4f70504 100644 --- a/build/pkgs/ipykernel/dependencies +++ b/build/pkgs/ipykernel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ipython_genutils importlib_metadata argcomplete matplotlib_inline ipyt ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipython/dependencies b/build/pkgs/ipython/dependencies index f15f6f0aca1..afe4e745f2d 100644 --- a/build/pkgs/ipython/dependencies +++ b/build/pkgs/ipython/dependencies @@ -2,4 +2,3 @@ $(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets | $(PYTHON_TO ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipython_genutils/dependencies b/build/pkgs/ipython_genutils/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/ipython_genutils/dependencies +++ b/build/pkgs/ipython_genutils/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipywidgets/dependencies b/build/pkgs/ipywidgets/dependencies index e719deacdd0..e6cc2ed95d5 100644 --- a/build/pkgs/ipywidgets/dependencies +++ b/build/pkgs/ipywidgets/dependencies @@ -2,4 +2,3 @@ $(PYTHON) widgetsnbextension | $(PYTHON_TOOLCHAIN) ipykernel ipython traitlets ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/isl/dependencies b/build/pkgs/isl/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/isl/dependencies +++ b/build/pkgs/isl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jedi/dependencies b/build/pkgs/jedi/dependencies index 0f21b645bd9..60b5f820a37 100644 --- a/build/pkgs/jedi/dependencies +++ b/build/pkgs/jedi/dependencies @@ -2,4 +2,3 @@ $(PYTHON) parso | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jinja2/dependencies b/build/pkgs/jinja2/dependencies index e8739c35b16..6947978ec42 100644 --- a/build/pkgs/jinja2/dependencies +++ b/build/pkgs/jinja2/dependencies @@ -2,4 +2,3 @@ $(PYTHON) markupsafe docutils | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jmol/dependencies b/build/pkgs/jmol/dependencies index 50320851772..3edeff40436 100644 --- a/build/pkgs/jmol/dependencies +++ b/build/pkgs/jmol/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jsonschema/dependencies b/build/pkgs/jsonschema/dependencies index c4bb27ca08e..543eb556459 100644 --- a/build/pkgs/jsonschema/dependencies +++ b/build/pkgs/jsonschema/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner attrs importlib_metadata pyrsistent | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupymake/dependencies b/build/pkgs/jupymake/dependencies index bcbd220117e..c8ed956ad6a 100644 --- a/build/pkgs/jupymake/dependencies +++ b/build/pkgs/jupymake/dependencies @@ -2,4 +2,3 @@ $(PYTHON) polymake | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyter_client/dependencies b/build/pkgs/jupyter_client/dependencies index d405e7b48d7..5e9a6c75874 100644 --- a/build/pkgs/jupyter_client/dependencies +++ b/build/pkgs/jupyter_client/dependencies @@ -2,4 +2,3 @@ $(PYTHON) jupyter_core | $(PYTHON_TOOLCHAIN) pyzmq dateutil nest_asyncio tornado ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyter_core/dependencies b/build/pkgs/jupyter_core/dependencies index 5dcd07f89fa..6aeda10f20d 100644 --- a/build/pkgs/jupyter_core/dependencies +++ b/build/pkgs/jupyter_core/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) traitlets ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyterlab/dependencies b/build/pkgs/jupyterlab/dependencies index 463f6e9d917..98ad2e94050 100644 --- a/build/pkgs/jupyterlab/dependencies +++ b/build/pkgs/jupyterlab/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner jupyter_core jupyter_client jinja2 tornado ipython packagi ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/kenzo/dependencies b/build/pkgs/kenzo/dependencies index ed6be201375..fffb89e2050 100644 --- a/build/pkgs/kenzo/dependencies +++ b/build/pkgs/kenzo/dependencies @@ -2,4 +2,3 @@ ecl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/kiwisolver/dependencies b/build/pkgs/kiwisolver/dependencies index 80b9352eb76..5df13094620 100644 --- a/build/pkgs/kiwisolver/dependencies +++ b/build/pkgs/kiwisolver/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cppy | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lcalc/dependencies b/build/pkgs/lcalc/dependencies index d42038dce36..ad46cc7f320 100644 --- a/build/pkgs/lcalc/dependencies +++ b/build/pkgs/lcalc/dependencies @@ -2,4 +2,3 @@ pari | gengetopt ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libatomic_ops/dependencies b/build/pkgs/libatomic_ops/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libatomic_ops/dependencies +++ b/build/pkgs/libatomic_ops/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libffi/dependencies b/build/pkgs/libffi/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libffi/dependencies +++ b/build/pkgs/libffi/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libgd/dependencies b/build/pkgs/libgd/dependencies index 998d7d01593..e2cbc65b7da 100644 --- a/build/pkgs/libgd/dependencies +++ b/build/pkgs/libgd/dependencies @@ -3,4 +3,3 @@ libpng freetype xz # xz needed to unpack tarball when sage-bootstrap-python is Python < 3.3 ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/liblzma/dependencies b/build/pkgs/liblzma/dependencies index f111204fa1f..52b7ce903f8 100644 --- a/build/pkgs/liblzma/dependencies +++ b/build/pkgs/liblzma/dependencies @@ -2,7 +2,6 @@ $(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/xz-$(vers_xz) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. Adding the above instead of "xz" makes sure that the dependency is not replaced by ".dummy". In this way, liblzma delegates building to xz when diff --git a/build/pkgs/libnauty/dependencies b/build/pkgs/libnauty/dependencies index 88254f7b556..cc6b7527ab9 100644 --- a/build/pkgs/libnauty/dependencies +++ b/build/pkgs/libnauty/dependencies @@ -2,7 +2,6 @@ $(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/nauty-$(vers_nauty) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. Adding the above instead of "nauty" makes sure that the dependency is not replaced by ".dummy". In this way, libnauty delegates building to nauty when diff --git a/build/pkgs/libogg/dependencies b/build/pkgs/libogg/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libogg/dependencies +++ b/build/pkgs/libogg/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libpng/dependencies b/build/pkgs/libpng/dependencies index 4c0aa5c0d31..a1eb8a80d3d 100644 --- a/build/pkgs/libpng/dependencies +++ b/build/pkgs/libpng/dependencies @@ -2,4 +2,3 @@ zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libsemigroups/dependencies b/build/pkgs/libsemigroups/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libsemigroups/dependencies +++ b/build/pkgs/libsemigroups/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libtheora/dependencies b/build/pkgs/libtheora/dependencies index 42f4da7f9d4..e62d879d3a4 100644 --- a/build/pkgs/libtheora/dependencies +++ b/build/pkgs/libtheora/dependencies @@ -2,4 +2,3 @@ libogg libpng ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libxml2/dependencies b/build/pkgs/libxml2/dependencies index 6a9b467fe73..e1903120ece 100644 --- a/build/pkgs/libxml2/dependencies +++ b/build/pkgs/libxml2/dependencies @@ -2,4 +2,3 @@ iconv zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lidia/dependencies b/build/pkgs/lidia/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/lidia/dependencies +++ b/build/pkgs/lidia/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lie/dependencies b/build/pkgs/lie/dependencies index 299ba61f5b7..9f475af894a 100644 --- a/build/pkgs/lie/dependencies +++ b/build/pkgs/lie/dependencies @@ -2,4 +2,3 @@ readline ncurses ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/linbox/dependencies b/build/pkgs/linbox/dependencies index 98b93071996..16264e23edc 100644 --- a/build/pkgs/linbox/dependencies +++ b/build/pkgs/linbox/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ntl givaro mpfr iml flint fflas_ffpack ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lrcalc/dependencies b/build/pkgs/lrcalc/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/lrcalc/dependencies +++ b/build/pkgs/lrcalc/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lrcalc_python/dependencies b/build/pkgs/lrcalc_python/dependencies index 63e5177ae0d..27c96045586 100644 --- a/build/pkgs/lrcalc_python/dependencies +++ b/build/pkgs/lrcalc_python/dependencies @@ -2,4 +2,3 @@ $(PYTHON) lrcalc | $(PYTHON_TOOLCHAIN) cython ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lrslib/dependencies b/build/pkgs/lrslib/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/lrslib/dependencies +++ b/build/pkgs/lrslib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/m4ri/dependencies b/build/pkgs/m4ri/dependencies index a32404ffb8e..a6ce9ea4411 100644 --- a/build/pkgs/m4ri/dependencies +++ b/build/pkgs/m4ri/dependencies @@ -2,4 +2,3 @@ libpng ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/m4rie/dependencies b/build/pkgs/m4rie/dependencies index 4756344de51..8c26128557d 100644 --- a/build/pkgs/m4rie/dependencies +++ b/build/pkgs/m4rie/dependencies @@ -2,4 +2,3 @@ m4ri ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/markupsafe/dependencies b/build/pkgs/markupsafe/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/markupsafe/dependencies +++ b/build/pkgs/markupsafe/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/matplotlib/dependencies b/build/pkgs/matplotlib/dependencies index 0b3e62b01c1..1fcb30a9c9d 100644 --- a/build/pkgs/matplotlib/dependencies +++ b/build/pkgs/matplotlib/dependencies @@ -2,4 +2,3 @@ $(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull font ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/maxima/dependencies b/build/pkgs/maxima/dependencies index ed6be201375..fffb89e2050 100644 --- a/build/pkgs/maxima/dependencies +++ b/build/pkgs/maxima/dependencies @@ -2,4 +2,3 @@ ecl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/memory_allocator/dependencies b/build/pkgs/memory_allocator/dependencies index d3dac75e5f2..296a2bebad3 100644 --- a/build/pkgs/memory_allocator/dependencies +++ b/build/pkgs/memory_allocator/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mistune/dependencies b/build/pkgs/mistune/dependencies index d3dac75e5f2..296a2bebad3 100644 --- a/build/pkgs/mistune/dependencies +++ b/build/pkgs/mistune/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpc/dependencies b/build/pkgs/mpc/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/mpc/dependencies +++ b/build/pkgs/mpc/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpfi/dependencies b/build/pkgs/mpfi/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/mpfi/dependencies +++ b/build/pkgs/mpfi/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpfr/dependencies b/build/pkgs/mpfr/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/mpfr/dependencies +++ b/build/pkgs/mpfr/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpfrcx/dependencies b/build/pkgs/mpfrcx/dependencies index f51a741fc82..1c5fe72f749 100644 --- a/build/pkgs/mpfrcx/dependencies +++ b/build/pkgs/mpfrcx/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr mpc ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpmath/dependencies b/build/pkgs/mpmath/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/mpmath/dependencies +++ b/build/pkgs/mpmath/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nauty/dependencies b/build/pkgs/nauty/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/nauty/dependencies +++ b/build/pkgs/nauty/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nbconvert/dependencies b/build/pkgs/nbconvert/dependencies index 86e4ceccf2e..5f8b20ddcf8 100644 --- a/build/pkgs/nbconvert/dependencies +++ b/build/pkgs/nbconvert/dependencies @@ -2,4 +2,3 @@ $(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints b ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nbformat/dependencies b/build/pkgs/nbformat/dependencies index c6dc6e3aed4..252d9165ae1 100644 --- a/build/pkgs/nbformat/dependencies +++ b/build/pkgs/nbformat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) jsonschema ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ncurses/dependencies b/build/pkgs/ncurses/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/ncurses/dependencies +++ b/build/pkgs/ncurses/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/networkx/dependencies b/build/pkgs/networkx/dependencies index f26477f0d95..8eb6920e25d 100644 --- a/build/pkgs/networkx/dependencies +++ b/build/pkgs/networkx/dependencies @@ -2,4 +2,3 @@ $(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ninja_build/dependencies b/build/pkgs/ninja_build/dependencies index 1a36cc52351..6b134137610 100644 --- a/build/pkgs/ninja_build/dependencies +++ b/build/pkgs/ninja_build/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nodeenv/dependencies b/build/pkgs/nodeenv/dependencies index dc5a209df7b..16df46f57ee 100644 --- a/build/pkgs/nodeenv/dependencies +++ b/build/pkgs/nodeenv/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) certifi ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nodejs/dependencies b/build/pkgs/nodejs/dependencies index 943a10ee5f5..a8de0ed1559 100644 --- a/build/pkgs/nodejs/dependencies +++ b/build/pkgs/nodejs/dependencies @@ -2,4 +2,3 @@ nodeenv ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/normaliz/dependencies b/build/pkgs/normaliz/dependencies index 66f3b59c2d2..a809da4b16d 100644 --- a/build/pkgs/normaliz/dependencies +++ b/build/pkgs/normaliz/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) flint e_antic libnauty ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/notebook/dependencies b/build/pkgs/notebook/dependencies index ba4f335e19a..9f5cb330ae2 100644 --- a/build/pkgs/notebook/dependencies +++ b/build/pkgs/notebook/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython jupyter_client ipykernel nbconvert nbfor ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/notedown/dependencies b/build/pkgs/notedown/dependencies index 229a2ffe418..ea77eefc7f4 100644 --- a/build/pkgs/notedown/dependencies +++ b/build/pkgs/notedown/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(PYTHON_TOOLCHAIN) | pip nbformat nbconvert six pandoc_attributes ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ntl/dependencies b/build/pkgs/ntl/dependencies index e675d884464..c447688066a 100644 --- a/build/pkgs/ntl/dependencies +++ b/build/pkgs/ntl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) gf2x ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/numpy/dependencies b/build/pkgs/numpy/dependencies index f46820d1797..d3c0f0055e4 100644 --- a/build/pkgs/numpy/dependencies +++ b/build/pkgs/numpy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(BLAS) gfortran | $(PYTHON_TOOLCHAIN) pkgconfig cython ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/openblas/dependencies b/build/pkgs/openblas/dependencies index 46757bc2b61..a475340050b 100644 --- a/build/pkgs/openblas/dependencies +++ b/build/pkgs/openblas/dependencies @@ -2,4 +2,3 @@ gfortran | $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/openssl/dependencies b/build/pkgs/openssl/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/openssl/dependencies +++ b/build/pkgs/openssl/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ore_algebra/dependencies b/build/pkgs/ore_algebra/dependencies index fef6fe44862..05ba0d8954b 100644 --- a/build/pkgs/ore_algebra/dependencies +++ b/build/pkgs/ore_algebra/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/packaging/dependencies b/build/pkgs/packaging/dependencies index 2c5e2481b17..2323f9df04a 100644 --- a/build/pkgs/packaging/dependencies +++ b/build/pkgs/packaging/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | setuptools pip wheel pyparsing setuptools_wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pandoc_attributes/dependencies b/build/pkgs/pandoc_attributes/dependencies index 30b8148c07f..64f88253c78 100644 --- a/build/pkgs/pandoc_attributes/dependencies +++ b/build/pkgs/pandoc_attributes/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(PYTHON_TOOLCHAIN) | pip pandocfilters ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pandocfilters/dependencies b/build/pkgs/pandocfilters/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pandocfilters/dependencies +++ b/build/pkgs/pandocfilters/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari/dependencies b/build/pkgs/pari/dependencies index 06ef082e690..c8379ce537b 100644 --- a/build/pkgs/pari/dependencies +++ b/build/pkgs/pari/dependencies @@ -2,4 +2,3 @@ readline $(MP_LIBRARY) | pari_galdata pari_seadata_small ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_elldata/dependencies b/build/pkgs/pari_elldata/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_elldata/dependencies +++ b/build/pkgs/pari_elldata/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_galdata/dependencies b/build/pkgs/pari_galdata/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_galdata/dependencies +++ b/build/pkgs/pari_galdata/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_galpol/dependencies b/build/pkgs/pari_galpol/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_galpol/dependencies +++ b/build/pkgs/pari_galpol/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_nftables/dependencies b/build/pkgs/pari_nftables/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_nftables/dependencies +++ b/build/pkgs/pari_nftables/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_seadata/dependencies b/build/pkgs/pari_seadata/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_seadata/dependencies +++ b/build/pkgs/pari_seadata/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_seadata_small/dependencies b/build/pkgs/pari_seadata_small/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_seadata_small/dependencies +++ b/build/pkgs/pari_seadata_small/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/parso/dependencies b/build/pkgs/parso/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/parso/dependencies +++ b/build/pkgs/parso/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/patch/dependencies b/build/pkgs/patch/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/patch/dependencies +++ b/build/pkgs/patch/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pcre/dependencies b/build/pkgs/pcre/dependencies index 0dd12df6ad1..1ccba14e349 100644 --- a/build/pkgs/pcre/dependencies +++ b/build/pkgs/pcre/dependencies @@ -2,4 +2,3 @@ bzip2 ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/perl_term_readline_gnu/dependencies b/build/pkgs/perl_term_readline_gnu/dependencies index 6a04d4dc1ff..7d283a67703 100644 --- a/build/pkgs/perl_term_readline_gnu/dependencies +++ b/build/pkgs/perl_term_readline_gnu/dependencies @@ -2,4 +2,3 @@ readline ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pexpect/dependencies b/build/pkgs/pexpect/dependencies index c320fcc874e..4a942502496 100644 --- a/build/pkgs/pexpect/dependencies +++ b/build/pkgs/pexpect/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ptyprocess | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pickleshare/dependencies b/build/pkgs/pickleshare/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pickleshare/dependencies +++ b/build/pkgs/pickleshare/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pillow/dependencies b/build/pkgs/pillow/dependencies index 48498b499f5..2ece64e58e8 100644 --- a/build/pkgs/pillow/dependencies +++ b/build/pkgs/pillow/dependencies @@ -2,4 +2,3 @@ $(PYTHON) zlib freetype | $(PYTHON_TOOLCHAIN) pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pip/dependencies b/build/pkgs/pip/dependencies index 6f2aa240c02..618d627629a 100644 --- a/build/pkgs/pip/dependencies +++ b/build/pkgs/pip/dependencies @@ -2,4 +2,3 @@ $(PYTHON) setuptools wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pkgconf/dependencies b/build/pkgs/pkgconf/dependencies index 5b535343f8d..47088a97fec 100644 --- a/build/pkgs/pkgconf/dependencies +++ b/build/pkgs/pkgconf/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pkgconfig/dependencies b/build/pkgs/pkgconfig/dependencies index 628b27750cd..79554fc438d 100644 --- a/build/pkgs/pkgconfig/dependencies +++ b/build/pkgs/pkgconfig/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/planarity/dependencies b/build/pkgs/planarity/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/planarity/dependencies +++ b/build/pkgs/planarity/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/plantri/dependencies b/build/pkgs/plantri/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/plantri/dependencies +++ b/build/pkgs/plantri/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polylib/dependencies b/build/pkgs/polylib/dependencies index 2a23f3894a5..385df4faa7d 100644 --- a/build/pkgs/polylib/dependencies +++ b/build/pkgs/polylib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ntl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polytopes_db/dependencies b/build/pkgs/polytopes_db/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/polytopes_db/dependencies +++ b/build/pkgs/polytopes_db/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ppl/dependencies b/build/pkgs/ppl/dependencies index e9c206ff16e..7af120e99c2 100644 --- a/build/pkgs/ppl/dependencies +++ b/build/pkgs/ppl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) glpk ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/prometheus_client/dependencies b/build/pkgs/prometheus_client/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/prometheus_client/dependencies +++ b/build/pkgs/prometheus_client/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/prompt_toolkit/dependencies b/build/pkgs/prompt_toolkit/dependencies index 35259ef6b78..57465daf937 100644 --- a/build/pkgs/prompt_toolkit/dependencies +++ b/build/pkgs/prompt_toolkit/dependencies @@ -2,4 +2,3 @@ $(PYTHON) six wcwidth | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ptyprocess/dependencies b/build/pkgs/ptyprocess/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/ptyprocess/dependencies +++ b/build/pkgs/ptyprocess/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycosat/dependencies b/build/pkgs/pycosat/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pycosat/dependencies +++ b/build/pkgs/pycosat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycparser/dependencies b/build/pkgs/pycparser/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pycparser/dependencies +++ b/build/pkgs/pycparser/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycryptosat/dependencies b/build/pkgs/pycryptosat/dependencies index 8b5414a59d4..b897ff72eae 100644 --- a/build/pkgs/pycryptosat/dependencies +++ b/build/pkgs/pycryptosat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) m4ri zlib libpng cryptominisat | cmake boost_cropped $(PYTHON_TOOLCHAI ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycygwin/dependencies b/build/pkgs/pycygwin/dependencies index d3dac75e5f2..296a2bebad3 100644 --- a/build/pkgs/pycygwin/dependencies +++ b/build/pkgs/pycygwin/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pygments/dependencies b/build/pkgs/pygments/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pygments/dependencies +++ b/build/pkgs/pygments/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pynormaliz/dependencies b/build/pkgs/pynormaliz/dependencies index 40184a0cf5d..76200c19d23 100644 --- a/build/pkgs/pynormaliz/dependencies +++ b/build/pkgs/pynormaliz/dependencies @@ -2,4 +2,3 @@ $(PYTHON) normaliz | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pyparsing/dependencies b/build/pkgs/pyparsing/dependencies index 3614951f5cb..d6e348e95b9 100644 --- a/build/pkgs/pyparsing/dependencies +++ b/build/pkgs/pyparsing/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | setuptools pip wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pyrsistent/dependencies b/build/pkgs/pyrsistent/dependencies index 8b3637a0a0e..4361e46ddaf 100644 --- a/build/pkgs/pyrsistent/dependencies +++ b/build/pkgs/pyrsistent/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/python3/dependencies b/build/pkgs/python3/dependencies index 0b9e91a711c..9bdcf05edc4 100644 --- a/build/pkgs/python3/dependencies +++ b/build/pkgs/python3/dependencies @@ -2,4 +2,3 @@ zlib readline sqlite libpng bzip2 liblzma xz libffi openssl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/python_igraph/dependencies b/build/pkgs/python_igraph/dependencies index d76acadd7e6..67ed15160f4 100644 --- a/build/pkgs/python_igraph/dependencies +++ b/build/pkgs/python_igraph/dependencies @@ -2,4 +2,3 @@ igraph texttable $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pytz/dependencies b/build/pkgs/pytz/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pytz/dependencies +++ b/build/pkgs/pytz/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pyzmq/dependencies b/build/pkgs/pyzmq/dependencies index ab148841d34..c72b3d23340 100644 --- a/build/pkgs/pyzmq/dependencies +++ b/build/pkgs/pyzmq/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython zeromq | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/qepcad/dependencies b/build/pkgs/qepcad/dependencies index c12d9eb11b8..8e67112f53d 100644 --- a/build/pkgs/qepcad/dependencies +++ b/build/pkgs/qepcad/dependencies @@ -2,4 +2,3 @@ readline saclib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/install into SAGE_ROOT/build/Makefile. diff --git a/build/pkgs/qhull/dependencies b/build/pkgs/qhull/dependencies index 66d6773d907..c225c495cc6 100644 --- a/build/pkgs/qhull/dependencies +++ b/build/pkgs/qhull/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/r/dependencies b/build/pkgs/r/dependencies index 281dc007225..c34daf966bd 100644 --- a/build/pkgs/r/dependencies +++ b/build/pkgs/r/dependencies @@ -2,4 +2,3 @@ $(BLAS) gfortran iconv readline bzip2 liblzma pcre curl | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/readline/dependencies b/build/pkgs/readline/dependencies index c3aa1a2cd99..7d1ee88ab32 100644 --- a/build/pkgs/readline/dependencies +++ b/build/pkgs/readline/dependencies @@ -2,4 +2,3 @@ ncurses ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/requests/dependencies b/build/pkgs/requests/dependencies index b1bee0c4176..b896dbc3cac 100644 --- a/build/pkgs/requests/dependencies +++ b/build/pkgs/requests/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) idna urllib3 certifi charset_normalizer ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rst2ipynb/dependencies b/build/pkgs/rst2ipynb/dependencies index 4cf206f037d..7fcda2181e1 100644 --- a/build/pkgs/rst2ipynb/dependencies +++ b/build/pkgs/rst2ipynb/dependencies @@ -2,4 +2,3 @@ $(PYTHON) pandoc | $(PYTHON_TOOLCHAIN) notedown ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rubiks/dependencies b/build/pkgs/rubiks/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/rubiks/dependencies +++ b/build/pkgs/rubiks/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rw/dependencies b/build/pkgs/rw/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/rw/dependencies +++ b/build/pkgs/rw/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/saclib/dependencies b/build/pkgs/saclib/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/saclib/dependencies +++ b/build/pkgs/saclib/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_numerical_backends_coin/dependencies b/build/pkgs/sage_numerical_backends_coin/dependencies index 2717db3a34f..4cbde1164f2 100644 --- a/build/pkgs/sage_numerical_backends_coin/dependencies +++ b/build/pkgs/sage_numerical_backends_coin/dependencies @@ -2,4 +2,3 @@ cbc cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_numerical_backends_cplex/dependencies b/build/pkgs/sage_numerical_backends_cplex/dependencies index bb56aad17be..0b35afa3540 100644 --- a/build/pkgs/sage_numerical_backends_cplex/dependencies +++ b/build/pkgs/sage_numerical_backends_cplex/dependencies @@ -2,4 +2,3 @@ cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sa ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_numerical_backends_gurobi/dependencies b/build/pkgs/sage_numerical_backends_gurobi/dependencies index bb56aad17be..0b35afa3540 100644 --- a/build/pkgs/sage_numerical_backends_gurobi/dependencies +++ b/build/pkgs/sage_numerical_backends_gurobi/dependencies @@ -2,4 +2,3 @@ cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sa ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_setup/dependencies b/build/pkgs/sage_setup/dependencies index d99d4aed55e..126a1206427 100644 --- a/build/pkgs/sage_setup/dependencies +++ b/build/pkgs/sage_setup/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython pkgconfig $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/inter ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies index c7b1154bf20..810713712ed 100644 --- a/build/pkgs/sagelib/dependencies +++ b/build/pkgs/sagelib/dependencies @@ -2,7 +2,6 @@ FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. The above are the *build-time* dependencies of the Sage library. These are, on the one hand, programs needed for the build/install process of the diff --git a/build/pkgs/sagenb_export/dependencies b/build/pkgs/sagenb_export/dependencies index bad566f78a7..26033350f88 100644 --- a/build/pkgs/sagenb_export/dependencies +++ b/build/pkgs/sagenb_export/dependencies @@ -2,4 +2,3 @@ $(PYTHON) notebook nbconvert ipython six | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/scipoptsuite/dependencies b/build/pkgs/scipoptsuite/dependencies index 46cb93de623..dfc5ec2e844 100644 --- a/build/pkgs/scipoptsuite/dependencies +++ b/build/pkgs/scipoptsuite/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) bliss readline | cmake ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/scipy/dependencies b/build/pkgs/scipy/dependencies index 25ae8854c01..5cd74c1c23a 100644 --- a/build/pkgs/scipy/dependencies +++ b/build/pkgs/scipy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(BLAS) gfortran numpy pybind11 pythran | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/setuptools/dependencies b/build/pkgs/setuptools/dependencies index 304d0c987a2..1700e743d59 100644 --- a/build/pkgs/setuptools/dependencies +++ b/build/pkgs/setuptools/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/setuptools_scm/dependencies b/build/pkgs/setuptools_scm/dependencies index 22810d06619..1e7026365f0 100644 --- a/build/pkgs/setuptools_scm/dependencies +++ b/build/pkgs/setuptools_scm/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | setuptools pip wheel tomli packaging ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/setuptools_wheel/dependencies b/build/pkgs/setuptools_wheel/dependencies index 6f2aa240c02..618d627629a 100644 --- a/build/pkgs/setuptools_wheel/dependencies +++ b/build/pkgs/setuptools_wheel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) setuptools wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/simplegeneric/dependencies b/build/pkgs/simplegeneric/dependencies index 7b38836acd6..703d0ec7ba3 100644 --- a/build/pkgs/simplegeneric/dependencies +++ b/build/pkgs/simplegeneric/dependencies @@ -7,4 +7,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/singular/dependencies b/build/pkgs/singular/dependencies index 01af3373fa6..41222544be2 100644 --- a/build/pkgs/singular/dependencies +++ b/build/pkgs/singular/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ntl flint readline mpfr cddlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sip/dependencies b/build/pkgs/sip/dependencies index 304d0c987a2..1700e743d59 100644 --- a/build/pkgs/sip/dependencies +++ b/build/pkgs/sip/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/six/dependencies b/build/pkgs/six/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/six/dependencies +++ b/build/pkgs/six/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/snowballstemmer/dependencies b/build/pkgs/snowballstemmer/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/snowballstemmer/dependencies +++ b/build/pkgs/snowballstemmer/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinx/dependencies b/build/pkgs/sphinx/dependencies index af979e75c97..af580c77d88 100644 --- a/build/pkgs/sphinx/dependencies +++ b/build/pkgs/sphinx/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments six snowballstemmer ima ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_applehelp/dependencies b/build/pkgs/sphinxcontrib_applehelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_applehelp/dependencies +++ b/build/pkgs/sphinxcontrib_applehelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_devhelp/dependencies b/build/pkgs/sphinxcontrib_devhelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_devhelp/dependencies +++ b/build/pkgs/sphinxcontrib_devhelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_htmlhelp/dependencies b/build/pkgs/sphinxcontrib_htmlhelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_htmlhelp/dependencies +++ b/build/pkgs/sphinxcontrib_htmlhelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_jsmath/dependencies b/build/pkgs/sphinxcontrib_jsmath/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_jsmath/dependencies +++ b/build/pkgs/sphinxcontrib_jsmath/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_qthelp/dependencies b/build/pkgs/sphinxcontrib_qthelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_qthelp/dependencies +++ b/build/pkgs/sphinxcontrib_qthelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_serializinghtml/dependencies b/build/pkgs/sphinxcontrib_serializinghtml/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_serializinghtml/dependencies +++ b/build/pkgs/sphinxcontrib_serializinghtml/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_websupport/dependencies b/build/pkgs/sphinxcontrib_websupport/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_websupport/dependencies +++ b/build/pkgs/sphinxcontrib_websupport/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sqlite/dependencies b/build/pkgs/sqlite/dependencies index 6a04d4dc1ff..7d283a67703 100644 --- a/build/pkgs/sqlite/dependencies +++ b/build/pkgs/sqlite/dependencies @@ -2,4 +2,3 @@ readline ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/surf/dependencies b/build/pkgs/surf/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/surf/dependencies +++ b/build/pkgs/surf/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/symengine/dependencies b/build/pkgs/symengine/dependencies index 77248f3a86e..1fc34963eda 100644 --- a/build/pkgs/symengine/dependencies +++ b/build/pkgs/symengine/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) arb ecm flint mpc mpfr | cmake ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/symengine_py/dependencies b/build/pkgs/symengine_py/dependencies index b041a3d5d3a..0b94df79ab9 100644 --- a/build/pkgs/symengine_py/dependencies +++ b/build/pkgs/symengine_py/dependencies @@ -2,4 +2,3 @@ symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/symmetrica/dependencies b/build/pkgs/symmetrica/dependencies index 0fef19aa992..606ceeaec80 100644 --- a/build/pkgs/symmetrica/dependencies +++ b/build/pkgs/symmetrica/dependencies @@ -4,4 +4,3 @@ xz is needed for unpacking the tarball when sage-bootstrap-python is ancient ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sympow/dependencies b/build/pkgs/sympow/dependencies index e78bf13b4a2..948967f0256 100644 --- a/build/pkgs/sympow/dependencies +++ b/build/pkgs/sympow/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sympy/dependencies b/build/pkgs/sympy/dependencies index c12b8329ca4..24e1585f16e 100644 --- a/build/pkgs/sympy/dependencies +++ b/build/pkgs/sympy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) mpmath | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tachyon/dependencies b/build/pkgs/tachyon/dependencies index a32404ffb8e..a6ce9ea4411 100644 --- a/build/pkgs/tachyon/dependencies +++ b/build/pkgs/tachyon/dependencies @@ -2,4 +2,3 @@ libpng ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/terminado/dependencies b/build/pkgs/terminado/dependencies index c61d11251e3..e44a0d91033 100644 --- a/build/pkgs/terminado/dependencies +++ b/build/pkgs/terminado/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ptyprocess tornado ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/testpath/dependencies b/build/pkgs/testpath/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/testpath/dependencies +++ b/build/pkgs/testpath/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/texttable/dependencies b/build/pkgs/texttable/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/texttable/dependencies +++ b/build/pkgs/texttable/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tides/dependencies b/build/pkgs/tides/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/tides/dependencies +++ b/build/pkgs/tides/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/topcom/dependencies b/build/pkgs/topcom/dependencies index 7f13f8aa14a..562554f4643 100644 --- a/build/pkgs/topcom/dependencies +++ b/build/pkgs/topcom/dependencies @@ -2,4 +2,3 @@ cddlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tornado/dependencies b/build/pkgs/tornado/dependencies index 7a3a585116d..212c6234efb 100644 --- a/build/pkgs/tornado/dependencies +++ b/build/pkgs/tornado/dependencies @@ -2,4 +2,3 @@ $(PYTHON) certifi | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tox/dependencies b/build/pkgs/tox/dependencies index a8747364ef2..5a00a282b7d 100644 --- a/build/pkgs/tox/dependencies +++ b/build/pkgs/tox/dependencies @@ -2,4 +2,3 @@ $(PYTHON) packaging six filelock pluggy py toml virtualenv importlib_metadata | ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/traitlets/dependencies b/build/pkgs/traitlets/dependencies index 242140707df..6598a788ccf 100644 --- a/build/pkgs/traitlets/dependencies +++ b/build/pkgs/traitlets/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tzlocal/dependencies b/build/pkgs/tzlocal/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/tzlocal/dependencies +++ b/build/pkgs/tzlocal/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/valgrind/dependencies b/build/pkgs/valgrind/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/valgrind/dependencies +++ b/build/pkgs/valgrind/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/vcversioner/dependencies b/build/pkgs/vcversioner/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/vcversioner/dependencies +++ b/build/pkgs/vcversioner/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/wcwidth/dependencies b/build/pkgs/wcwidth/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/wcwidth/dependencies +++ b/build/pkgs/wcwidth/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/webencodings/dependencies b/build/pkgs/webencodings/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/webencodings/dependencies +++ b/build/pkgs/webencodings/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/wheel/dependencies b/build/pkgs/wheel/dependencies index dbe5d796c45..98d3e59447b 100644 --- a/build/pkgs/wheel/dependencies +++ b/build/pkgs/wheel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) setuptools ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/widgetsnbextension/dependencies b/build/pkgs/widgetsnbextension/dependencies index 816ef654fc7..dd63a9f4ef1 100644 --- a/build/pkgs/widgetsnbextension/dependencies +++ b/build/pkgs/widgetsnbextension/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) jupyter_core ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/xz/dependencies b/build/pkgs/xz/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/xz/dependencies +++ b/build/pkgs/xz/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zeromq/dependencies b/build/pkgs/zeromq/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/zeromq/dependencies +++ b/build/pkgs/zeromq/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zipp/dependencies b/build/pkgs/zipp/dependencies index 8b3637a0a0e..4361e46ddaf 100644 --- a/build/pkgs/zipp/dependencies +++ b/build/pkgs/zipp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zlib/dependencies b/build/pkgs/zlib/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/zlib/dependencies +++ b/build/pkgs/zlib/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zn_poly/dependencies b/build/pkgs/zn_poly/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/zn_poly/dependencies +++ b/build/pkgs/zn_poly/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. From 643fa512abaed8ddbb64d061150f1f9e2eebc3b4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 21:51:36 -0700 Subject: [PATCH 159/338] src/doc/en/developer/packaging.rst: Update --- src/doc/en/developer/packaging.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/doc/en/developer/packaging.rst b/src/doc/en/developer/packaging.rst index 501a54c1027..de2552383f5 100644 --- a/src/doc/en/developer/packaging.rst +++ b/src/doc/en/developer/packaging.rst @@ -678,7 +678,6 @@ for ``eclib``: ---------- All lines of this file are ignored except the first. - It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. For Python packages, common dependencies include ``pip``, ``setuptools``, and ``future``. If your package depends on any of @@ -699,7 +698,6 @@ If there are no dependencies, you can use ---------- All lines of this file are ignored except the first. - It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. There are actually two kinds of dependencies: there are normal dependencies and order-only dependencies, which are weaker. The syntax @@ -718,12 +716,22 @@ If there is no ``|``, then all dependencies are normal. dependency (for example, a dependency on pip simply because the ``spkg-install`` file uses pip). + Alternatively, you can put the order-only dependencies in a separate + file ``dependencies_order_only``. + - If A has a **normal dependency** on B, it means additionally that A should be rebuilt every time that B gets updated. This is the most common kind of dependency. A normal dependency is what you need for libraries: if we upgrade NTL, we should rebuild everything which uses NTL. +Some packages are only needed for self-tests of a package (``spkg-check``). +These dependencies should be declared in a separate file ``dependencies_check``. + +Some dependencies are optional in the sense that they are only +a dependency if they are configured to be installed. These dependencies +should be declared in a separate file ``dependencies_optional``. + In order to check that the dependencies of your package are likely correct, the following command should work without errors:: From 36f0affaca91eb15e8ade8e3899a664d69223ef5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 23:19:06 -0700 Subject: [PATCH 160/338] build/pkgs/[g-z]*/SPKG.rst: Remove redundant Dependencies sections --- build/pkgs/cysignals/SPKG.rst | 6 ------ build/pkgs/defusedxml/SPKG.rst | 6 ------ build/pkgs/elliptic_curves/SPKG.rst | 5 ----- build/pkgs/frobby/SPKG.rst | 6 ------ build/pkgs/gap/SPKG.rst | 7 ------- build/pkgs/gap3/SPKG.rst | 4 ---- build/pkgs/gc/SPKG.rst | 6 ------ build/pkgs/gf2x/SPKG.rst | 6 ------ build/pkgs/gfortran/SPKG.rst | 9 --------- build/pkgs/glucose/SPKG.rst | 6 ------ build/pkgs/graphs/SPKG.rst | 4 ---- build/pkgs/gsl/SPKG.rst | 14 -------------- build/pkgs/html5lib/SPKG.rst | 4 ---- build/pkgs/iconv/SPKG.rst | 6 ------ build/pkgs/iml/SPKG.rst | 7 ------- build/pkgs/importlib_metadata/SPKG.rst | 4 ---- build/pkgs/jinja2/SPKG.rst | 9 --------- build/pkgs/jsonschema/SPKG.rst | 8 -------- build/pkgs/jupymake/SPKG.rst | 7 ------- build/pkgs/jupyterlab/SPKG.rst | 7 ------- build/pkgs/jupyterlab_widgets/SPKG.rst | 5 ----- build/pkgs/kenzo/SPKG.rst | 4 ---- build/pkgs/libatomic_ops/SPKG.rst | 6 ------ build/pkgs/libgd/SPKG.rst | 8 -------- build/pkgs/libhomfly/SPKG.rst | 4 ---- build/pkgs/liblzma/SPKG.rst | 2 -- build/pkgs/libogg/SPKG.rst | 8 -------- build/pkgs/libpng/SPKG.rst | 8 -------- build/pkgs/libtheora/SPKG.rst | 13 ------------- build/pkgs/lidia/SPKG.rst | 4 ---- build/pkgs/m4ri/SPKG.rst | 6 ------ build/pkgs/markupsafe/SPKG.rst | 4 ---- build/pkgs/mathjax/SPKG.rst | 6 ------ build/pkgs/maxima/SPKG.rst | 6 ------ build/pkgs/mcqd/SPKG.rst | 4 ---- build/pkgs/memory_allocator/SPKG.rst | 4 ---- build/pkgs/mistune/SPKG.rst | 4 ---- build/pkgs/modular_decomposition/SPKG.rst | 9 --------- build/pkgs/mpc/SPKG.rst | 7 ------- build/pkgs/mpfi/SPKG.rst | 5 ----- build/pkgs/mpfr/SPKG.rst | 7 ------- build/pkgs/mpmath/SPKG.rst | 4 ---- build/pkgs/ncurses/SPKG.rst | 6 ------ build/pkgs/ninja_build/SPKG.rst | 4 ---- build/pkgs/nodeenv/SPKG.rst | 4 ---- build/pkgs/nodejs/SPKG.rst | 4 ---- build/pkgs/normaliz/SPKG.rst | 7 ------- build/pkgs/notedown/SPKG.rst | 9 --------- build/pkgs/ntl/SPKG.rst | 7 ------- build/pkgs/numpy/SPKG.rst | 11 ----------- build/pkgs/ore_algebra/SPKG.rst | 5 ----- build/pkgs/pandoc_attributes/SPKG.rst | 8 -------- build/pkgs/pandocfilters/SPKG.rst | 6 ------ build/pkgs/pari_galdata/SPKG.rst | 4 ---- build/pkgs/pari_seadata_small/SPKG.rst | 4 ---- build/pkgs/patch/SPKG.rst | 6 ------ build/pkgs/pcre/SPKG.rst | 6 ------ build/pkgs/perl_term_readline_gnu/SPKG.rst | 4 ---- build/pkgs/pexpect/SPKG.rst | 5 ----- build/pkgs/pillow/SPKG.rst | 4 ---- build/pkgs/pip/SPKG.rst | 5 ----- build/pkgs/pkgconf/SPKG.rst | 6 ------ build/pkgs/planarity/SPKG.rst | 6 ------ build/pkgs/plantri/SPKG.rst | 4 ---- build/pkgs/polylib/SPKG.rst | 4 ---- build/pkgs/polytopes_db/SPKG.rst | 4 ---- build/pkgs/polytopes_db_4d/SPKG.rst | 4 ---- build/pkgs/ptyprocess/SPKG.rst | 4 ---- build/pkgs/pycosat/SPKG.rst | 6 ------ build/pkgs/pygments/SPKG.rst | 6 ------ build/pkgs/pynormaliz/SPKG.rst | 7 ------- build/pkgs/pyparsing/SPKG.rst | 4 ---- build/pkgs/python_igraph/SPKG.rst | 7 ------- build/pkgs/pyzmq/SPKG.rst | 8 -------- build/pkgs/qepcad/SPKG.rst | 7 ------- build/pkgs/readline/SPKG.rst | 6 ------ build/pkgs/rpy2/SPKG.rst | 4 ---- build/pkgs/rst2ipynb/SPKG.rst | 7 ------- build/pkgs/saclib/SPKG.rst | 4 ---- build/pkgs/zlib/SPKG.rst | 6 ------ 80 files changed, 472 deletions(-) diff --git a/build/pkgs/cysignals/SPKG.rst b/build/pkgs/cysignals/SPKG.rst index e866501cb1d..0329da8193b 100644 --- a/build/pkgs/cysignals/SPKG.rst +++ b/build/pkgs/cysignals/SPKG.rst @@ -17,9 +17,3 @@ Upstream Contact https://github.com/sagemath/cysignals -Dependencies ------------- - -- Python -- Cython -- PARI (optional) diff --git a/build/pkgs/defusedxml/SPKG.rst b/build/pkgs/defusedxml/SPKG.rst index 921e3061af6..44d6549a764 100644 --- a/build/pkgs/defusedxml/SPKG.rst +++ b/build/pkgs/defusedxml/SPKG.rst @@ -19,12 +19,6 @@ Upstream Contact https://pypi.org/project/defusedxml/ -Dependencies ------------- - -- pip - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/elliptic_curves/SPKG.rst b/build/pkgs/elliptic_curves/SPKG.rst index e167a6feef1..09c86a5a9e7 100644 --- a/build/pkgs/elliptic_curves/SPKG.rst +++ b/build/pkgs/elliptic_curves/SPKG.rst @@ -28,8 +28,3 @@ ellcurves - Author: William Stein - Email: wstein@gmail.com -Dependencies ------------- - -- sqlite -- python diff --git a/build/pkgs/frobby/SPKG.rst b/build/pkgs/frobby/SPKG.rst index 2586bb06902..eea712a3a9d 100644 --- a/build/pkgs/frobby/SPKG.rst +++ b/build/pkgs/frobby/SPKG.rst @@ -26,12 +26,6 @@ Upstream Contact - https://github.com/Macaulay2/frobby -Dependencies ------------- - -- GMP built with support for C++ - - Special Update/Build instructions --------------------------------- diff --git a/build/pkgs/gap/SPKG.rst b/build/pkgs/gap/SPKG.rst index c28f1881847..2f59f140a01 100644 --- a/build/pkgs/gap/SPKG.rst +++ b/build/pkgs/gap/SPKG.rst @@ -26,13 +26,6 @@ https://www.gap-system.org Mailing list at https://mail.gap-system.org/mailman/listinfo/gap -Dependencies ------------- - -- Readline -- GMP - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gap3/SPKG.rst b/build/pkgs/gap3/SPKG.rst index bf44d2cd8e5..1152b121bfd 100644 --- a/build/pkgs/gap3/SPKG.rst +++ b/build/pkgs/gap3/SPKG.rst @@ -79,7 +79,3 @@ Patches None -Dependencies ------------- - -None diff --git a/build/pkgs/gc/SPKG.rst b/build/pkgs/gc/SPKG.rst index 3dc62b8f11e..ece6b70d3e6 100644 --- a/build/pkgs/gc/SPKG.rst +++ b/build/pkgs/gc/SPKG.rst @@ -19,12 +19,6 @@ Webpage: http://www.hboehm.info/gc/ Email List: bdwgc@lists.opendylan.org -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gf2x/SPKG.rst b/build/pkgs/gf2x/SPKG.rst index 29e4d5680fe..7f4b11e994f 100644 --- a/build/pkgs/gf2x/SPKG.rst +++ b/build/pkgs/gf2x/SPKG.rst @@ -24,12 +24,6 @@ Upstream Contact - Emmanuel Thomé - Paul Zimmermann -Dependencies ------------- - -- None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gfortran/SPKG.rst b/build/pkgs/gfortran/SPKG.rst index d66a7b0f173..1bea5fae5fe 100644 --- a/build/pkgs/gfortran/SPKG.rst +++ b/build/pkgs/gfortran/SPKG.rst @@ -18,15 +18,6 @@ Upstream Contact http://gcc.gnu.org/ -Dependencies ------------- - -- zlib -- GMP -- MPFR -- MPC - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/glucose/SPKG.rst b/build/pkgs/glucose/SPKG.rst index f6f9beb9ca0..1a7ed45fc87 100644 --- a/build/pkgs/glucose/SPKG.rst +++ b/build/pkgs/glucose/SPKG.rst @@ -35,12 +35,6 @@ Upstream Contact Website: http://www.labri.fr/perso/lsimon/glucose/ -Dependencies ------------- - -zlib - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/graphs/SPKG.rst b/build/pkgs/graphs/SPKG.rst index 4a5f9d35ec8..fee55463698 100644 --- a/build/pkgs/graphs/SPKG.rst +++ b/build/pkgs/graphs/SPKG.rst @@ -28,7 +28,3 @@ Upstream Contact available at https://github.com/nathanncohen/strongly_regular_graphs_database. -Dependencies ------------- - -N/A diff --git a/build/pkgs/gsl/SPKG.rst b/build/pkgs/gsl/SPKG.rst index 79d0151784d..fb66a085b10 100644 --- a/build/pkgs/gsl/SPKG.rst +++ b/build/pkgs/gsl/SPKG.rst @@ -42,19 +42,5 @@ GSL mailing lists: releases are made there. -Dependencies ------------- - -- None - GSL does not depend on any other Sage package to compile, link - and pass all of GSL's self-tests. Despite that fact, BLAS is listed - as - a dependency. (It comes with its own CBLAS implementation that is - e.g. - used when running the GSL test suite during installation; however, - the - Sage library only uses it as a fall-back, if e.g. BLAS library is not - present.) - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/html5lib/SPKG.rst b/build/pkgs/html5lib/SPKG.rst index b62607c15d7..c0abaca59f3 100644 --- a/build/pkgs/html5lib/SPKG.rst +++ b/build/pkgs/html5lib/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact Home Page: https://github.com/html5lib/html5lib-python/issues -Dependencies ------------- - -Python, webencodings, six diff --git a/build/pkgs/iconv/SPKG.rst b/build/pkgs/iconv/SPKG.rst index 2604fddf232..48e0ffe761f 100644 --- a/build/pkgs/iconv/SPKG.rst +++ b/build/pkgs/iconv/SPKG.rst @@ -19,12 +19,6 @@ Upstream Contact - http://www.gnu.org/software/libiconv/ - Bug reports to bug-gnu-libiconv@gnu.org -Dependencies ------------- - -- None for the purposes of Sage, but in general gettext. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/iml/SPKG.rst b/build/pkgs/iml/SPKG.rst index ffb045c9113..635fe9da032 100644 --- a/build/pkgs/iml/SPKG.rst +++ b/build/pkgs/iml/SPKG.rst @@ -26,13 +26,6 @@ Upstream Contact - Zhuliang Chen z4chen@uwaterloo.ca - Arne Storjohann astorjoh@uwaterloo.ca -Dependencies ------------- - -- GMP -- a BLAS implementation such as openblas - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/importlib_metadata/SPKG.rst b/build/pkgs/importlib_metadata/SPKG.rst index f77ad32a048..d1b490d0082 100644 --- a/build/pkgs/importlib_metadata/SPKG.rst +++ b/build/pkgs/importlib_metadata/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact Home page: http://importlib-metadata.readthedocs.io/ -Dependencies ------------- - -Python, Setuptools, zipp diff --git a/build/pkgs/jinja2/SPKG.rst b/build/pkgs/jinja2/SPKG.rst index dab1c25cafa..7f962f0343e 100644 --- a/build/pkgs/jinja2/SPKG.rst +++ b/build/pkgs/jinja2/SPKG.rst @@ -25,15 +25,6 @@ Author: Pocoo Team Homepage: http://jinja.pocoo.org/ -Dependencies ------------- - -- Python (>= 2.4) -- setuptools (or distribute) -- Pygments (according to 'spkg/standard/deps') -- docutils (dito, as a note only) - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/jsonschema/SPKG.rst b/build/pkgs/jsonschema/SPKG.rst index c9f40de8258..bf655277b78 100644 --- a/build/pkgs/jsonschema/SPKG.rst +++ b/build/pkgs/jsonschema/SPKG.rst @@ -17,11 +17,3 @@ Upstream Contact Home page: http://github.com/Julian/jsonschema -Dependencies ------------- - -- Python -- Setuptools -- attrs -- importlib_metadata -- pyrsistent diff --git a/build/pkgs/jupymake/SPKG.rst b/build/pkgs/jupymake/SPKG.rst index a6db0f64ab2..d2ee2c8b564 100644 --- a/build/pkgs/jupymake/SPKG.rst +++ b/build/pkgs/jupymake/SPKG.rst @@ -17,12 +17,5 @@ Upstream Contact https://github.com/polymake/JuPyMake -Dependencies ------------- - -- pip -- polymake - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/jupyterlab/SPKG.rst b/build/pkgs/jupyterlab/SPKG.rst index 3be24988c86..f728314ffae 100644 --- a/build/pkgs/jupyterlab/SPKG.rst +++ b/build/pkgs/jupyterlab/SPKG.rst @@ -17,10 +17,3 @@ Upstream Contact Home page: https://jupyter.org/ -Dependencies ------------- - -- Python -- Setuptools -- jupyter_core -- jupyter_client diff --git a/build/pkgs/jupyterlab_widgets/SPKG.rst b/build/pkgs/jupyterlab_widgets/SPKG.rst index 34913ab51b6..f17f3c08eda 100644 --- a/build/pkgs/jupyterlab_widgets/SPKG.rst +++ b/build/pkgs/jupyterlab_widgets/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact Home page: https://github.com/jupyter-widgets/ipywidgets -Dependencies ------------- - -- jupyterlab -- nodejs diff --git a/build/pkgs/kenzo/SPKG.rst b/build/pkgs/kenzo/SPKG.rst index 5d139df545e..9bca611ef82 100644 --- a/build/pkgs/kenzo/SPKG.rst +++ b/build/pkgs/kenzo/SPKG.rst @@ -21,7 +21,3 @@ Upstream Contact - https://github.com/miguelmarco/kenzo/ -Dependencies ------------- - -- ECL (Embedded Common Lisp) diff --git a/build/pkgs/libatomic_ops/SPKG.rst b/build/pkgs/libatomic_ops/SPKG.rst index a4f1c0ce805..5d376f67e91 100644 --- a/build/pkgs/libatomic_ops/SPKG.rst +++ b/build/pkgs/libatomic_ops/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact - Webpage: http://www.hboehm.info/gc/ - Email List: bdwgc@lists.opendylan.org -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libgd/SPKG.rst b/build/pkgs/libgd/SPKG.rst index 33149d189fc..cade8ea66c7 100644 --- a/build/pkgs/libgd/SPKG.rst +++ b/build/pkgs/libgd/SPKG.rst @@ -25,14 +25,6 @@ Upstream Contact - Pierre Joye (http://blog.thepimp.net) - http://libgd.bitbucket.org/ -Dependencies ------------- - -- libpng -- freetype -- iconv - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libhomfly/SPKG.rst b/build/pkgs/libhomfly/SPKG.rst index f5c61344a3b..2d349b554ad 100644 --- a/build/pkgs/libhomfly/SPKG.rst +++ b/build/pkgs/libhomfly/SPKG.rst @@ -24,7 +24,3 @@ Upstream Contact Miguel Marco (mmarco@unizar.es) -Dependencies ------------- - -- gc diff --git a/build/pkgs/liblzma/SPKG.rst b/build/pkgs/liblzma/SPKG.rst index 925da031898..373af0a91a2 100644 --- a/build/pkgs/liblzma/SPKG.rst +++ b/build/pkgs/liblzma/SPKG.rst @@ -19,5 +19,3 @@ Upstream Contact http://tukaani.org/xz/ -Dependencies ------------- diff --git a/build/pkgs/libogg/SPKG.rst b/build/pkgs/libogg/SPKG.rst index bf80b9680c6..2db78fcfcf2 100644 --- a/build/pkgs/libogg/SPKG.rst +++ b/build/pkgs/libogg/SPKG.rst @@ -49,14 +49,6 @@ Upstream Contact The Xiph.org mailing lists - see http://lists.xiph.org/mailman/listinfo -Dependencies ------------- - -This spkg provides dependencies for - -- the Sage library - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libpng/SPKG.rst b/build/pkgs/libpng/SPKG.rst index b4ca40d71a6..414854d2ef1 100644 --- a/build/pkgs/libpng/SPKG.rst +++ b/build/pkgs/libpng/SPKG.rst @@ -28,14 +28,6 @@ https://libpng.sourceforge.io The png mailing lists - see http://www.libpng.org/pub/png/pngmisc.html#lists -Dependencies ------------- - -This spkg depends on: - -- libz - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libtheora/SPKG.rst b/build/pkgs/libtheora/SPKG.rst index 3a75d68e7fb..0c2c9e1c642 100644 --- a/build/pkgs/libtheora/SPKG.rst +++ b/build/pkgs/libtheora/SPKG.rst @@ -48,19 +48,6 @@ Upstream Contact The Xiph.org mailing lists - see http://lists.xiph.org/mailman/listinfo -Dependencies ------------- - -This spkg depends on - -- libogg -- libpng - -This spkg provides dependencies for - -- the Sage library - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/lidia/SPKG.rst b/build/pkgs/lidia/SPKG.rst index 085cacf4e1f..7be393335db 100644 --- a/build/pkgs/lidia/SPKG.rst +++ b/build/pkgs/lidia/SPKG.rst @@ -26,7 +26,3 @@ Upstream Contact Matthias Köppe, UC Davis, CA, USA -Dependencies ------------- - -GMP. diff --git a/build/pkgs/m4ri/SPKG.rst b/build/pkgs/m4ri/SPKG.rst index 6ecd2218831..d5eb3478af3 100644 --- a/build/pkgs/m4ri/SPKG.rst +++ b/build/pkgs/m4ri/SPKG.rst @@ -20,12 +20,6 @@ Upstream Contact - Email: - Website: https://bitbucket.org/malb/m4ri -Dependencies ------------- - -- libPNG - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/markupsafe/SPKG.rst b/build/pkgs/markupsafe/SPKG.rst index 483b2aca876..907793aab6e 100644 --- a/build/pkgs/markupsafe/SPKG.rst +++ b/build/pkgs/markupsafe/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact Home page: http://github.com/mitsuhiko/markupsafe -Dependencies ------------- - -Python, setuptools diff --git a/build/pkgs/mathjax/SPKG.rst b/build/pkgs/mathjax/SPKG.rst index e7c0a7edb27..1c8e0ebc8fc 100644 --- a/build/pkgs/mathjax/SPKG.rst +++ b/build/pkgs/mathjax/SPKG.rst @@ -19,12 +19,6 @@ Upstream Contact Home page: https://www.mathjax.org/ -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/maxima/SPKG.rst b/build/pkgs/maxima/SPKG.rst index aac4e574185..a96fbf42354 100644 --- a/build/pkgs/maxima/SPKG.rst +++ b/build/pkgs/maxima/SPKG.rst @@ -30,12 +30,6 @@ Upstream Contact - The Maxima mailing list - see http://maxima.sourceforge.net/maximalist.html -Dependencies ------------- - -- ECL (Embedded Common Lisp) - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/mcqd/SPKG.rst b/build/pkgs/mcqd/SPKG.rst index 7e7a2b83b97..17bf4d17fd6 100644 --- a/build/pkgs/mcqd/SPKG.rst +++ b/build/pkgs/mcqd/SPKG.rst @@ -19,7 +19,3 @@ Upstream Contact MCQD is currently being maintained by Janez Konc. https://gitlab.com/janezkonc/mcqd -Dependencies ------------- - -None diff --git a/build/pkgs/memory_allocator/SPKG.rst b/build/pkgs/memory_allocator/SPKG.rst index 2c36e5f1105..e85eaa2eb0e 100644 --- a/build/pkgs/memory_allocator/SPKG.rst +++ b/build/pkgs/memory_allocator/SPKG.rst @@ -20,7 +20,3 @@ Upstream Contact https://github.com/sagemath/memory_allocator -Dependencies ------------- - -- Cython diff --git a/build/pkgs/mistune/SPKG.rst b/build/pkgs/mistune/SPKG.rst index 73c67f71a37..7d08e818625 100644 --- a/build/pkgs/mistune/SPKG.rst +++ b/build/pkgs/mistune/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact Home Page: https://github.com/lepture/mistune -Dependencies ------------- - -Python, Cython, Pip diff --git a/build/pkgs/modular_decomposition/SPKG.rst b/build/pkgs/modular_decomposition/SPKG.rst index 31c617357c1..543b8ce1b6b 100644 --- a/build/pkgs/modular_decomposition/SPKG.rst +++ b/build/pkgs/modular_decomposition/SPKG.rst @@ -21,12 +21,3 @@ Fabien de Montgolfier http://www.liafa.jussieu.fr/~fm/ -Dependencies ------------- - -None - -Patches -------- - -None diff --git a/build/pkgs/mpc/SPKG.rst b/build/pkgs/mpc/SPKG.rst index f51f4ce4ddb..821daf9f1db 100644 --- a/build/pkgs/mpc/SPKG.rst +++ b/build/pkgs/mpc/SPKG.rst @@ -28,13 +28,6 @@ The MPC team can be contacted via the MPC mailing list: mpc-discuss@lists.gforge.inria.fr -Dependencies ------------- - -- MPIR -- MPFR - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/mpfi/SPKG.rst b/build/pkgs/mpfi/SPKG.rst index 5aa81fc9db9..cb145ca0e2a 100644 --- a/build/pkgs/mpfi/SPKG.rst +++ b/build/pkgs/mpfi/SPKG.rst @@ -38,8 +38,3 @@ The MPFI website is located at http://mpfi.gforge.inria.fr/ The MPFI team can be contacted via the MPFI mailing list: mpfi-users@lists.gforge.inria.fr -Dependencies ------------- - -- GMP -- MPFR diff --git a/build/pkgs/mpfr/SPKG.rst b/build/pkgs/mpfr/SPKG.rst index b5b38b3603d..23b9d9110d1 100644 --- a/build/pkgs/mpfr/SPKG.rst +++ b/build/pkgs/mpfr/SPKG.rst @@ -39,13 +39,6 @@ The MPFR website is located at http://mpfr.org/ The MPFR team can be contacted via the MPFR mailing list: mpfr@loria.fr -Dependencies ------------- - -- GMP/MPIR -- GNU patch - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/mpmath/SPKG.rst b/build/pkgs/mpmath/SPKG.rst index 7ed4d8abe01..279d47a0318 100644 --- a/build/pkgs/mpmath/SPKG.rst +++ b/build/pkgs/mpmath/SPKG.rst @@ -23,7 +23,3 @@ Upstream Contact - http://mpmath.org - Website: https://github.com/fredrik-johansson/mpmath/ -Dependencies ------------- - -- Python diff --git a/build/pkgs/ncurses/SPKG.rst b/build/pkgs/ncurses/SPKG.rst index 208fad87814..7c50871739e 100644 --- a/build/pkgs/ncurses/SPKG.rst +++ b/build/pkgs/ncurses/SPKG.rst @@ -37,12 +37,6 @@ Upstream Contact - bug-ncurses@gnu.org -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/ninja_build/SPKG.rst b/build/pkgs/ninja_build/SPKG.rst index 90195aa30eb..5eef3722b85 100644 --- a/build/pkgs/ninja_build/SPKG.rst +++ b/build/pkgs/ninja_build/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact https://ninja-build.org/ -Dependencies ------------- - -None diff --git a/build/pkgs/nodeenv/SPKG.rst b/build/pkgs/nodeenv/SPKG.rst index 43c94e9abf6..397d909f16d 100644 --- a/build/pkgs/nodeenv/SPKG.rst +++ b/build/pkgs/nodeenv/SPKG.rst @@ -19,7 +19,3 @@ Upstream Contact Home page: https://github.com/ekalinin/nodeenv -Dependencies ------------- - -- Python diff --git a/build/pkgs/nodejs/SPKG.rst b/build/pkgs/nodejs/SPKG.rst index 8686b7bf566..1176f4fea3b 100644 --- a/build/pkgs/nodejs/SPKG.rst +++ b/build/pkgs/nodejs/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact Home page: https://nodejs.org/ -Dependencies ------------- - -- nodeenv diff --git a/build/pkgs/normaliz/SPKG.rst b/build/pkgs/normaliz/SPKG.rst index f43f767e3d0..c2f964bc0f2 100644 --- a/build/pkgs/normaliz/SPKG.rst +++ b/build/pkgs/normaliz/SPKG.rst @@ -25,13 +25,6 @@ Upstream Contact and https://github.com/Normaliz -Dependencies ------------- - -- GMP/MPIR -- boost - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/notedown/SPKG.rst b/build/pkgs/notedown/SPKG.rst index ca460eb925a..54cc022f4d0 100644 --- a/build/pkgs/notedown/SPKG.rst +++ b/build/pkgs/notedown/SPKG.rst @@ -17,12 +17,3 @@ Upstream Contact Author: Aaron O'Leary Home page: https://github.com/aaren/notedown -Dependencies ------------- - -- Python -- setuptools -- nbformat -- nbconvert -- six -- pandoc_attributes diff --git a/build/pkgs/ntl/SPKG.rst b/build/pkgs/ntl/SPKG.rst index 0641f7317fb..31c1844d655 100644 --- a/build/pkgs/ntl/SPKG.rst +++ b/build/pkgs/ntl/SPKG.rst @@ -22,13 +22,6 @@ Upstream Contact - Victor Shoup - for contact info see http://www.shoup.net/ -Dependencies ------------- - -- gmp -- gf2x - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/numpy/SPKG.rst b/build/pkgs/numpy/SPKG.rst index 776121ca731..80279977bed 100644 --- a/build/pkgs/numpy/SPKG.rst +++ b/build/pkgs/numpy/SPKG.rst @@ -16,17 +16,6 @@ Upstream Contact - Fernando Perez - Brian Granger -Dependencies ------------- - -- GNU patch -- Python -- Lapack -- Blas -- Atlas -- Fortran - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/ore_algebra/SPKG.rst b/build/pkgs/ore_algebra/SPKG.rst index 94044a54a65..5bb799bfe5b 100644 --- a/build/pkgs/ore_algebra/SPKG.rst +++ b/build/pkgs/ore_algebra/SPKG.rst @@ -26,8 +26,3 @@ Upstream Contact - Website: https://github.com/mkauers/ore_algebra/ - Sage accounts: mkauers, mmezzarobba -Dependencies ------------- - -- None - diff --git a/build/pkgs/pandoc_attributes/SPKG.rst b/build/pkgs/pandoc_attributes/SPKG.rst index c563b04365b..91b60e01b9d 100644 --- a/build/pkgs/pandoc_attributes/SPKG.rst +++ b/build/pkgs/pandoc_attributes/SPKG.rst @@ -19,14 +19,6 @@ Upstream Contact - Author: Aaron O'Leary - Home page: https://github.com/aaren/pandoc-attributes -Dependencies ------------- - -- Python -- setuptools -- pandocfilters - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pandocfilters/SPKG.rst b/build/pkgs/pandocfilters/SPKG.rst index a4b73da9f99..50132ed9be5 100644 --- a/build/pkgs/pandocfilters/SPKG.rst +++ b/build/pkgs/pandocfilters/SPKG.rst @@ -17,12 +17,6 @@ Upstream Contact Author: John MacFarlane Home page: https://github.com/jgm/pandocfilters -Dependencies ------------- - -- Python - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pari_galdata/SPKG.rst b/build/pkgs/pari_galdata/SPKG.rst index 16a0c583200..099d9f87153 100644 --- a/build/pkgs/pari_galdata/SPKG.rst +++ b/build/pkgs/pari_galdata/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact http://pari.math.u-bordeaux.fr/ -Dependencies ------------- - -None (package contains data files only) diff --git a/build/pkgs/pari_seadata_small/SPKG.rst b/build/pkgs/pari_seadata_small/SPKG.rst index 6be2f5d5fd8..3aaa0917ab8 100644 --- a/build/pkgs/pari_seadata_small/SPKG.rst +++ b/build/pkgs/pari_seadata_small/SPKG.rst @@ -20,7 +20,3 @@ Upstream Contact http://pari.math.u-bordeaux.fr/ -Dependencies ------------- - -None (package contains data files only) diff --git a/build/pkgs/patch/SPKG.rst b/build/pkgs/patch/SPKG.rst index e7719fd6255..495c817cd28 100644 --- a/build/pkgs/patch/SPKG.rst +++ b/build/pkgs/patch/SPKG.rst @@ -32,12 +32,6 @@ Submit bugs: http://savannah.gnu.org/bugs/?func=additem&group=patch Mailing lists: bug-patch@gnu.org -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pcre/SPKG.rst b/build/pkgs/pcre/SPKG.rst index 55cbfbdbbfa..d1839c2c1df 100644 --- a/build/pkgs/pcre/SPKG.rst +++ b/build/pkgs/pcre/SPKG.rst @@ -17,12 +17,6 @@ Upstream Contact Mailing list at https://lists.exim.org/mailman/listinfo/pcre-dev -Dependencies ------------- - -None listed. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/perl_term_readline_gnu/SPKG.rst b/build/pkgs/perl_term_readline_gnu/SPKG.rst index 402397926b1..aa2a0791d79 100644 --- a/build/pkgs/perl_term_readline_gnu/SPKG.rst +++ b/build/pkgs/perl_term_readline_gnu/SPKG.rst @@ -19,7 +19,3 @@ Upstream Contact Hiroo HAYASHI -Dependencies ------------- - -readline diff --git a/build/pkgs/pexpect/SPKG.rst b/build/pkgs/pexpect/SPKG.rst index 0c087e38265..b972eecef2f 100644 --- a/build/pkgs/pexpect/SPKG.rst +++ b/build/pkgs/pexpect/SPKG.rst @@ -20,8 +20,3 @@ Upstream Contact - http://pexpect.readthedocs.org/en/stable/ - https://github.com/pexpect/pexpect -Dependencies ------------- - -- GNU patch -- Python diff --git a/build/pkgs/pillow/SPKG.rst b/build/pkgs/pillow/SPKG.rst index 6b64325474e..6a4bd0d09c5 100644 --- a/build/pkgs/pillow/SPKG.rst +++ b/build/pkgs/pillow/SPKG.rst @@ -22,7 +22,3 @@ Upstream Contact - https://python-pillow.org/ - Homepage: http://python-imaging.github.io/ -Dependencies ------------- - -- Python diff --git a/build/pkgs/pip/SPKG.rst b/build/pkgs/pip/SPKG.rst index 55a897a9307..837967428b7 100644 --- a/build/pkgs/pip/SPKG.rst +++ b/build/pkgs/pip/SPKG.rst @@ -24,8 +24,3 @@ Upstream Contact - Mailing list: http://groups.google.com/group/python-virtualenv - Docs: https://pip.pypa.io/ -Dependencies ------------- - -- python -- setuptools diff --git a/build/pkgs/pkgconf/SPKG.rst b/build/pkgs/pkgconf/SPKG.rst index ddf6c227948..64cf2bb4ebf 100644 --- a/build/pkgs/pkgconf/SPKG.rst +++ b/build/pkgs/pkgconf/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact https://github.com/pkgconf/pkgconf -Dependencies ------------- - -- C compiler + toolchain - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/planarity/SPKG.rst b/build/pkgs/planarity/SPKG.rst index 095ac96e05b..75001aaaf32 100644 --- a/build/pkgs/planarity/SPKG.rst +++ b/build/pkgs/planarity/SPKG.rst @@ -26,12 +26,6 @@ Upstream Contact - John Boyer -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/plantri/SPKG.rst b/build/pkgs/plantri/SPKG.rst index df6ef00e50c..df3210cec50 100644 --- a/build/pkgs/plantri/SPKG.rst +++ b/build/pkgs/plantri/SPKG.rst @@ -36,7 +36,3 @@ Brendan McKay See http://cs.anu.edu.au/~bdm/plantri -Dependencies ------------- - -- None diff --git a/build/pkgs/polylib/SPKG.rst b/build/pkgs/polylib/SPKG.rst index 89e4508cca6..23e7f1315ba 100644 --- a/build/pkgs/polylib/SPKG.rst +++ b/build/pkgs/polylib/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact - https://groups.google.com/forum/#!forum/isl-development -Dependencies ------------- - -- GMP diff --git a/build/pkgs/polytopes_db/SPKG.rst b/build/pkgs/polytopes_db/SPKG.rst index 0e43231b7db..b1a26e6e73d 100644 --- a/build/pkgs/polytopes_db/SPKG.rst +++ b/build/pkgs/polytopes_db/SPKG.rst @@ -26,7 +26,3 @@ Upstream Contact http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html -Dependencies ------------- - -None diff --git a/build/pkgs/polytopes_db_4d/SPKG.rst b/build/pkgs/polytopes_db_4d/SPKG.rst index 2e5ddcce995..589406d92d1 100644 --- a/build/pkgs/polytopes_db_4d/SPKG.rst +++ b/build/pkgs/polytopes_db_4d/SPKG.rst @@ -20,7 +20,3 @@ SPKG Maintainers Volker Braun -Dependencies ------------- - -None diff --git a/build/pkgs/ptyprocess/SPKG.rst b/build/pkgs/ptyprocess/SPKG.rst index 6cb6d2a5bd7..f72812b852d 100644 --- a/build/pkgs/ptyprocess/SPKG.rst +++ b/build/pkgs/ptyprocess/SPKG.rst @@ -26,7 +26,3 @@ Upstream Contact https://github.com/pexpect/ptyprocess -Dependencies ------------- - -- Python diff --git a/build/pkgs/pycosat/SPKG.rst b/build/pkgs/pycosat/SPKG.rst index dc146802fc4..9853e76a211 100644 --- a/build/pkgs/pycosat/SPKG.rst +++ b/build/pkgs/pycosat/SPKG.rst @@ -23,12 +23,6 @@ Upstream Contact - PicoSAT: http://fmv.jku.at/picosat/ - pycosat: https://github.com/ContinuumIO/pycosat -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pygments/SPKG.rst b/build/pkgs/pygments/SPKG.rst index 7d799b5d090..4a5126cb858 100644 --- a/build/pkgs/pygments/SPKG.rst +++ b/build/pkgs/pygments/SPKG.rst @@ -35,12 +35,6 @@ Upstream Contact - Author: Georg Brandl - Home Page: https://pygments.org -Dependencies ------------- - -Python - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pynormaliz/SPKG.rst b/build/pkgs/pynormaliz/SPKG.rst index c2dd1c97c3d..0875b81af19 100644 --- a/build/pkgs/pynormaliz/SPKG.rst +++ b/build/pkgs/pynormaliz/SPKG.rst @@ -17,12 +17,5 @@ Upstream Contact https://github.com/sebasguts/PyNormaliz -Dependencies ------------- - -- pip -- normaliz - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pyparsing/SPKG.rst b/build/pkgs/pyparsing/SPKG.rst index 28bb37a10c6..0b765140901 100644 --- a/build/pkgs/pyparsing/SPKG.rst +++ b/build/pkgs/pyparsing/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact - Author: Paul McGuire - Home page: http://pyparsing.wikispaces.com -Dependencies ------------- - -Python diff --git a/build/pkgs/python_igraph/SPKG.rst b/build/pkgs/python_igraph/SPKG.rst index b8725f11451..6c3a52a3082 100644 --- a/build/pkgs/python_igraph/SPKG.rst +++ b/build/pkgs/python_igraph/SPKG.rst @@ -19,12 +19,5 @@ Upstream Contact http://igraph.org/python/ -Dependencies ------------- - -- python -- igraph - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pyzmq/SPKG.rst b/build/pkgs/pyzmq/SPKG.rst index 356af355484..6896f7d256b 100644 --- a/build/pkgs/pyzmq/SPKG.rst +++ b/build/pkgs/pyzmq/SPKG.rst @@ -17,14 +17,6 @@ Upstream Contact http://www.zeromq.org -Dependencies ------------- - -- Python -- Cython -- zeromq - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/qepcad/SPKG.rst b/build/pkgs/qepcad/SPKG.rst index 1ac2993338e..fa8ef06fb7c 100644 --- a/build/pkgs/qepcad/SPKG.rst +++ b/build/pkgs/qepcad/SPKG.rst @@ -35,13 +35,6 @@ Upstream Contact https://www.usna.edu/Users/cs/wcbrown/qepcad/B/QEPCAD.html -Dependencies ------------- - -- readline -- saclib - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/readline/SPKG.rst b/build/pkgs/readline/SPKG.rst index ddf2fe5eb16..80ff0d3ef8f 100644 --- a/build/pkgs/readline/SPKG.rst +++ b/build/pkgs/readline/SPKG.rst @@ -24,12 +24,6 @@ Upstream Contact - Chet Ramey at http://cnswww.cns.cwru.edu/~chet -Dependencies ------------- - -- ncurses - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/rpy2/SPKG.rst b/build/pkgs/rpy2/SPKG.rst index 0eb0b98bda5..a4d119802f1 100644 --- a/build/pkgs/rpy2/SPKG.rst +++ b/build/pkgs/rpy2/SPKG.rst @@ -22,10 +22,6 @@ Upstream Contact - https://rpy2.bitbucket.io -Dependencies ------------- - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/rst2ipynb/SPKG.rst b/build/pkgs/rst2ipynb/SPKG.rst index ac19a2c8557..a514ae5a4c5 100644 --- a/build/pkgs/rst2ipynb/SPKG.rst +++ b/build/pkgs/rst2ipynb/SPKG.rst @@ -23,13 +23,6 @@ Upstream Contact Authors: Scott Sievert and Nicolas M. Thiéry Home page: https://github.com/nthiery/rst-to-ipynb -Dependencies ------------- - -- notedown -- pandoc - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/saclib/SPKG.rst b/build/pkgs/saclib/SPKG.rst index b55460978dd..06a733a7f20 100644 --- a/build/pkgs/saclib/SPKG.rst +++ b/build/pkgs/saclib/SPKG.rst @@ -35,7 +35,3 @@ Upstream Contact https://www.usna.edu/Users/cs/wcbrown/qepcad/B/QEPCAD.html -Dependencies ------------- - -None. diff --git a/build/pkgs/zlib/SPKG.rst b/build/pkgs/zlib/SPKG.rst index d7de9c4038a..5a3496935cf 100644 --- a/build/pkgs/zlib/SPKG.rst +++ b/build/pkgs/zlib/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact - http://www.zlib.net/ -Dependencies ------------- - -- None - - Special Update/Build Instructions --------------------------------- From 3d170c96c918007ed6216ae7810e3341e1b4402f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 15 May 2022 08:46:34 +0200 Subject: [PATCH 161/338] adding more doctests --- src/sage/combinat/nu_dyck_word.py | 98 +++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index 71b459c4b10..e8fdb669416 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -47,12 +47,20 @@ def update_ndw_symbols(os, cs): r""" - A way to alter the open and close symbols from sage + A way to alter the open and close symbols from sage. INPUT: - - ``os`` -- The open symbol - - ``cs`` -- The close symbol + - ``os`` -- the open symbol + - ``cs`` -- the close symbol + + EXAMPLES:: + + sage: from sage.combinat.nu_dyck_word import update_ndw_symbols + sage: update_ndw_symbols(0,1) + sage: dw = NuDyckWord('0101001','0110010'); dw + [0, 1, 0, 1, 0, 0, 1] + sage: update_ndw_symbols(1,0) """ global ndw_open_symbol global ndw_close_symbol @@ -234,6 +242,9 @@ def __classcall_private__(cls, dw=None, nu=None, **kwargs): raise ValueError("invalid nu-Dyck word") def __init__(self, parent, dw, latex_options=None): + """ + Initialize a nu-Dyck word. + """ Element.__init__(self, parent) self._path = to_word_path(dw) @@ -486,7 +497,7 @@ def _repr_list(self) -> str: TESTS:: - sage: NuDyckWord([1,1,0],[1,0,1]) + sage: NuDyckWord([1,1,0],[1,0,1]) # indirect doctest [1, 1, 0] sage: NuDyckWord('NNEE','NENE') [1, 1, 0, 0] @@ -965,7 +976,7 @@ def horizontal_distance(self): points = list(self._path.points()) return [nu_easts[j] - i for i, j in points] - def can_mutate(self, i) -> bool: + def can_mutate(self, i) -> bool | int: """ Return True/False based off if mutable at height `i`. @@ -974,7 +985,23 @@ def can_mutate(self, i) -> bool: OUTPUT: - - Whether we can mutate at height of `i`. + Whether we can mutate at height of `i`. + + EXAMPLES:: + + sage: NDW = NuDyckWord('10010100','00000111') + sage: NDW.can_mutate(1) + False + sage: NDW.can_mutate(3) + 5 + + TESTS:: + + sage: NDW = NuDyckWord('10010100','00000111') + sage: NDW.can_mutate(33) + Traceback (most recent call last): + ... + ValueError: cannot mutate above or below path """ if i > self.height() or i <= 0: raise ValueError('cannot mutate above or below path') @@ -991,7 +1018,7 @@ def can_mutate(self, i) -> bool: return j return False - def mutate(self, i): + def mutate(self, i) -> None | NuDyckWord: r""" Return a new `\nu`-Dyck Word if possible. @@ -1007,6 +1034,13 @@ def mutate(self, i): - g is everything after f .. SEEALSO:: :meth:`can_mutate` + + EXAMPLES:: + + sage: NDW = NuDyckWord('10010100','00000111') + sage: NDW.mutate(1) + sage: NDW.mutate(3) + [1, 0, 0, 1, 1, 0, 0, 0] """ mutation_index = self.can_mutate(i) if not mutation_index: @@ -1184,6 +1218,16 @@ def __contains__(self, x) -> bool: def __eq__(self, other): """ Return equality. + + TESTS:: + + sage: A = NuDyckWords([1,0,1,1]) + sage: B = NuDyckWords([1,0,1,1]) + sage: C = NuDyckWords([1,0,1,1,1]) + sage: A == B + True + sage: A == C + False """ if not isinstance(other, NuDyckWords): return False @@ -1192,21 +1236,36 @@ def __eq__(self, other): def __neq__(self, other): """ Return inequality. + + TESTS:: + + sage: A = NuDyckWords([1,0,1,1]) + sage: B = NuDyckWords([1,0,1,1]) + sage: C = NuDyckWords([1,0,1,1,1]) + sage: A != B + False + sage: A != C + True """ return not self.__eq__(other) - def _repr_(self): + def _repr_(self) -> str: r""" TESTS:: sage: NuDyckWords([1,0,1,1]) [1, 0, 1, 1] Dyck words """ - return "{nu} Dyck words".format(nu=list(self._nu)) + return f"{list(self._nu)} Dyck words" - def _cache_key(self): + def _cache_key(self) -> str: """ Return a cache key + + TESTS:: + + sage: NuDyckWords([1,0,1,1])._cache_key() + '1011' """ return str(self._nu) @@ -1223,6 +1282,8 @@ def __iter__(self): """ Iterate over ``self``. + .. TODO:: make a better iterator. + EXAMPLES:: sage: it = NuDyckWords('101010').__iter__() @@ -1255,8 +1316,9 @@ def cardinality(self): def to_word_path(word): r""" - Helper function which converts input into a word path over an appropriate - alphabet. + Convert input into a word path over an appropriate alphabet. + + Helper function. INPUT: @@ -1339,15 +1401,3 @@ def path_weakly_above_other(path, other) -> bool: p_height = path.height_vector() o_height = other.height_vector() return all(p_h >= o_h for p_h, o_h in zip(p_height, o_height)) - - -def is_nu_path(path, nu) -> bool: - r""" - Test if ``path`` is a `\nu`-Dyck word. - - A ``path`` is a `\nu`-Dyck word if ``path`` is weakly above the path of - `\nu`. - - .. SEEALSO:: :meth:`path_weakly_above_other` - """ - return path_weakly_above_other(path, nu) From d385f0db7500bdc8168e6f7f18d76741efa3742b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 14 May 2022 23:59:05 -0700 Subject: [PATCH 162/338] m4/sage_spkg_collect.m4: Fix for autoconf on ubuntu-focal --- m4/sage_spkg_collect.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index c1d33f1073c..c35a21a7efe 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -333,11 +333,11 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl AS_VAR_APPEND([DEPS], ['$(findstring '$a',$(OPTIONAL_INSTALLED_PACKAGES)) ']) done ]) - AS_CASE([$DEPS], [*\|*], [], [AS_VAR_APPEND([DEPS], [" |"])]) + AS_CASE(["$DEPS"], [*\|*], [], [AS_VAR_APPEND([DEPS], [" |"])]) AS_IF([test -f "$DIR/dependencies_order_only"], [dnl AS_VAR_APPEND([DEPS], [' '$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_order_only))]) ], [dnl - m4_case(SPKG_SOURCE, [pip], [AS_VAR_APPEND([DEPS], [' pip'])])dnl + m4_case(SPKG_SOURCE, [pip], [AS_VAR_APPEND([DEPS], [' pip'])], [:])dnl ]) AS_IF([test -f "$DIR/dependencies_check"], [dnl AS_VAR_APPEND([DEPS], [' $(and $(filter-out no,$(SAGE_CHECK_]SPKG_NAME[)), ']) From 3ca0c957536113513db3a8a03049e42821af68a9 Mon Sep 17 00:00:00 2001 From: "Trevor K. Karn" Date: Wed, 11 May 2022 14:30:01 -0500 Subject: [PATCH 163/338] Initial commit --- src/sage/matroids/matroid.pyx | 50 ++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index ef9096fa1d9..3941e6682c9 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -133,6 +133,7 @@ additional functionality (e.g. linear extensions). - Construction - :meth:`union() ` + - :math:`direct_sum() ` - Misc - :meth:`broken_circuit_complex() ` @@ -8011,7 +8012,7 @@ cdef class Matroid(SageObject): OUTPUT: - An instance of MatroidUnion. + An instance of :class:`MatroidUnion `. EXAMPLES:: @@ -8035,3 +8036,50 @@ cdef class Matroid(SageObject): # place this matroid at the beginning of the list matroids.insert(0, self) return union_matroid.MatroidUnion(iter(matroids)) + + def direct_sum(self, matroids): + r""" + Return the matroid direct sum with another matroid or list of + matroids. + + Let `(M_1, M_2, \ldots, M_k)` be a list of matroids where each `M_i` + has ground set `E_i`. The matroid sum `(E_1,I_1),\ldots,(E_n,I_n)` + is a matroid `(E,I)` where `E= \bigsqcup_{i=1}^n E_i` and + `I= \bigsqcup_{i=1}^n I_i`. + + INPUT: + + - ``matroids`` - a matroid or list of matroids + + OUTPUT: + + An instance of :class:`MatroidSum ` + + EXAMPLES:: + + sage: M = matroids.named_matroids.Pappus() + sage: N = matroids.named_matroids.Fano().direct_sum(M); N + Matroid of rank 6 on 16 elements as matroid sum of + Binary matroid of rank 3 on 7 elements, type (3, 0) + Matroid of rank 3 on 9 elements with circuit-closures + {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'}, {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}} + sage: len(N.independent_sets()) + 6897 + sage: len(N.bases()) + 2100 + """ + + from . import union_matroid + if isinstance(matroids, Matroid): + matroids = [matroids] + else: + for M in matroids: + if not isinstance(M, Matroid): + raise TypeError("can only take the sum with a " + "matroid or list of matroids") + matroids = [M for M in matroids if M] + if not matroids: + return self + # place this matroid at the beginning of the list + matroids.insert(0, self) + return union_matroid.MatroidSum(iter(matroids)) From 6b079e412911fd77ce9b636b55ee31d213c7c8c0 Mon Sep 17 00:00:00 2001 From: "Trevor K. Karn" Date: Sun, 15 May 2022 08:45:55 -0500 Subject: [PATCH 164/338] Fix reviewer comments + whitespace issue --- src/sage/matroids/matroid.pyx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index 3941e6682c9..10aa0fc0b74 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -3108,7 +3108,7 @@ cdef class Matroid(SageObject): def matroid_polytope(self): r""" - Return the matroid polytope of ``self``. + src/sage/matroids/matroid.pyx Return the matroid polytope of ``self``. This is defined as the convex hull of the vertices @@ -8044,7 +8044,7 @@ cdef class Matroid(SageObject): Let `(M_1, M_2, \ldots, M_k)` be a list of matroids where each `M_i` has ground set `E_i`. The matroid sum `(E_1,I_1),\ldots,(E_n,I_n)` - is a matroid `(E,I)` where `E= \bigsqcup_{i=1}^n E_i` and + is a matroid `(E,I)` where `E= \bigsqcup_{i=1}^n E_i` and `I= \bigsqcup_{i=1}^n I_i`. INPUT: @@ -8053,13 +8053,14 @@ cdef class Matroid(SageObject): OUTPUT: - An instance of :class:`MatroidSum ` + An instance of + :class:`MatroidSum ` EXAMPLES:: sage: M = matroids.named_matroids.Pappus() sage: N = matroids.named_matroids.Fano().direct_sum(M); N - Matroid of rank 6 on 16 elements as matroid sum of + Matroid of rank 6 on 16 elements as matroid sum of Binary matroid of rank 3 on 7 elements, type (3, 0) Matroid of rank 3 on 9 elements with circuit-closures {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'}, {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}} @@ -8068,7 +8069,6 @@ cdef class Matroid(SageObject): sage: len(N.bases()) 2100 """ - from . import union_matroid if isinstance(matroids, Matroid): matroids = [matroids] From 68acfacafadf5021ebef2417925361ddca624c31 Mon Sep 17 00:00:00 2001 From: "Trevor K. Karn" Date: Sun, 15 May 2022 08:53:15 -0500 Subject: [PATCH 165/338] A reviewer change I missed --- src/sage/matroids/matroid.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index 10aa0fc0b74..fcd626b7378 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -8012,7 +8012,8 @@ cdef class Matroid(SageObject): OUTPUT: - An instance of :class:`MatroidUnion `. + An instance of + :class:`MatroidUnion `. EXAMPLES:: From 8f594f4dcc4b97f947d713f1a23ee5f55d2920e0 Mon Sep 17 00:00:00 2001 From: Marc Mezzarobba Date: Mon, 16 May 2022 07:28:42 +0200 Subject: [PATCH 166/338] #33804: fix NumberFieldElement._symbolic_()... ...for "complicated enough" number fields with an embedding into AA --- .../rings/number_field/number_field_element.pyx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 21e19618896..7c503abb7e2 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -2927,6 +2927,17 @@ cdef class NumberFieldElement(FieldElement): sage: SR(b) 1/8*(sqrt(4*(1/9*sqrt(109)*sqrt(3) + 2)^(1/3) - 4/3/(1/9*sqrt(109)*sqrt(3) + 2)^(1/3) + 17) + 5)^3 + 1/2*sqrt(4*(1/9*sqrt(109)*sqrt(3) + 2)^(1/3) - 4/3/(1/9*sqrt(109)*sqrt(3) + 2)^(1/3) + 17) + 5/2 + TESTS: + + :trac:`33804`:: + + sage: Pol. = QQ[] + sage: p = x^8 + x^7 - 9*x^6 - 3*x^5 - 6*x^4 + x^3 - 14*x^2 + 2*x + 2 + sage: rt = sorted(p.roots(AA, multiplicities=False))[1] + sage: K. = NumberField(p, embedding=rt) + sage: SR(a) + -0.3056815681115094? + """ K = self._parent.fraction_field() @@ -2952,7 +2963,7 @@ cdef class NumberFieldElement(FieldElement): return a # Once #17516 gets fixed, the next three lines can be dropped # and the remaining lines be simplified to undo df03633. - b = embedding.im_gens()[0].radical_expression() + b = embedding(K.gen()).radical_expression() if b.parent() == SR: return self.polynomial()(b) return SR(a) From b6c2839696f4bd78d7ce647e1b8c799f91fa1aff Mon Sep 17 00:00:00 2001 From: Aram Dermenjian Date: Tue, 17 May 2022 09:38:02 +0100 Subject: [PATCH 167/338] Add more doctests and make iterator more efficient --- src/sage/combinat/nu_dyck_word.py | 201 ++++++++++++++++++++++++------ 1 file changed, 162 insertions(+), 39 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index e8fdb669416..baf5f9b830e 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -35,8 +35,8 @@ from sage.structure.global_options import GlobalOptions from sage.structure.parent import Parent from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets -from sage.combinat.permutation import Permutations from sage.misc.latex import latex +from copy import copy from sage.combinat.words.paths import WordPaths_north_east from sage.combinat.words.paths import FiniteWordPath_north_east @@ -60,6 +60,11 @@ def update_ndw_symbols(os, cs): sage: update_ndw_symbols(0,1) sage: dw = NuDyckWord('0101001','0110010'); dw [0, 1, 0, 1, 0, 0, 1] + + sage: dw = NuDyckWord('1010110','1001101'); dw + Traceback (most recent call last): + ... + ValueError: invalid nu-Dyck word sage: update_ndw_symbols(1,0) """ global ndw_open_symbol @@ -71,9 +76,9 @@ def update_ndw_symbols(os, cs): def replace_dyck_char(x): r""" A map sending an opening character (``'1'``, ``'N'``, and ``'('``) to - ``ndw_open_symbol`` and a closing character (``'0'``, ``'E'``, and ``')'``) to - ``ndw_close_symbol``, and raising an error on any input other than one of the - opening or closing characters. + ``ndw_open_symbol``, a closing character (``'0'``, ``'E'``, and ``')'``) to + ``ndw_close_symbol``, and raising an error on any input other than one of + the opening or closing characters. This is the inverse map of :func:`replace_dyck_symbol`. @@ -115,8 +120,8 @@ def replace_dyck_char(x): def replace_dyck_symbol(x, open_char='N', close_char='E') -> str: r""" - A map sending ``ndw_open_symbol`` to ``open_char`` and ``ndw_close_symbol`` to - ``close_char``, and raising an error on any input other than + A map sending ``ndw_open_symbol`` to ``open_char`` and ``ndw_close_symbol`` + to ``close_char``, and raising an error on any input other than ``ndw_open_symbol`` and ``ndw_close_symbol``. The values of the constants ``ndw_open_symbol`` and ``ndw_close_symbol`` are subject to change. @@ -244,6 +249,13 @@ def __classcall_private__(cls, dw=None, nu=None, **kwargs): def __init__(self, parent, dw, latex_options=None): """ Initialize a nu-Dyck word. + + EXAMPLES:: + + sage: NuDyckWord('010', '010') + [0, 1, 0] + sage: NuDyckWord('110100','101010') + [1, 1, 0, 1, 0, 0] """ Element.__init__(self, parent) self._path = to_word_path(dw) @@ -308,6 +320,23 @@ def __neq__(self, other): def __le__(self, other): """ Return if one path is included in another. + + EXAMPLES:: + + sage: ND1 = NuDyckWord('101', '011') + sage: ND2 = NuDyckWord('110', '011') + sage: ND3 = NuDyckWord('011', '011') + sage: ND1 <= ND1 + True + sage: ND1 <= ND2 + True + sage: ND2 <= ND1 + False + sage: ND3 <= ND2 + True + sage: ND3 <= ND1 + True + """ if self._nu == other._nu: return path_weakly_above_other(other._path, self._path) @@ -316,12 +345,44 @@ def __le__(self, other): def __lt__(self, other): """ Return if one path is strictly included in another + + EXAMPLES:: + + sage: ND1 = NuDyckWord('101', '011') + sage: ND2 = NuDyckWord('110', '011') + sage: ND3 = NuDyckWord('011', '011') + sage: ND1 < ND1 + False + sage: ND1 < ND2 + True + sage: ND2 < ND1 + False + sage: ND3 < ND2 + True + sage: ND3 < ND1 + True """ return self.__le__(other) and not self.__eq__(other) def __ge__(self, other): """ Return if one path is included in another + + EXAMPLES:: + + sage: ND1 = NuDyckWord('101', '011') + sage: ND2 = NuDyckWord('110', '011') + sage: ND3 = NuDyckWord('011', '011') + sage: ND1 >= ND1 + True + sage: ND1 >= ND2 + False + sage: ND2 >= ND1 + True + sage: ND1 >= ND3 + True + sage: ND2 >= ND3 + True """ if self._nu == other._nu: return path_weakly_above_other(self._path, other._path) @@ -330,6 +391,22 @@ def __ge__(self, other): def __gt__(self, other): """ Return if one path is strictly included in another + + EXAMPLES:: + + sage: ND1 = NuDyckWord('101', '011') + sage: ND2 = NuDyckWord('110', '011') + sage: ND3 = NuDyckWord('011', '011') + sage: ND1 > ND1 + False + sage: ND1 > ND2 + False + sage: ND2 > ND1 + True + sage: ND1 > ND3 + True + sage: ND2 > ND3 + True """ return self.__ge__(other) and not self.__eq__(other) @@ -365,8 +442,8 @@ def set_latex_options(self, D): - ``color`` -- (default: black) the line color. - - ``line width`` -- (default: `2 \times` ``tikz_scale``) value representing the - line width. + - ``line width`` -- (default: `2 \times` ``tikz_scale``) value + representing the line width. - ``nu_options`` -- (default: ``'rounded corners=1, color=red, line width=1'``) str to indicate what the tikz options should be for path @@ -510,7 +587,8 @@ def _repr_lattice(self, style=None, labelling=None): TESTS:: - sage: print(NuDyckWord('00011001000100','00011001000100')._repr_lattice(style='N-E', labelling=[1,2,3,4])) + sage: n = NuDyckWord('00011001000100','00011001000100') + sage: print(n._repr_lattice(style='N-E', labelling=[1,2,3,4])) ____ _____| . . 4 ___| . . . . . 3 @@ -650,30 +728,31 @@ def pretty_print(self, style=None, labelling=None): EXAMPLES:: sage: for ND in NuDyckWords('101010'): ND.pretty_print() - ______ - |x x . - |x . . + __ + _| . + _| . . | . . . ____ - _|x . - |x . . + |x . + _| . . | . . . __ ___| . |x . . | . . . ____ - |x . - _| . . + _|x . + |x . . | . . . - __ - _| . - _| . . + ______ + |x x . + |x . . | . . . :: - sage: ND = NuDyckWord([1,1,1,0,1,0,0,1,1,0,0,0],[1,0,1,0,1,0,1,0,1,0,1,0]) + sage: nu = [1,0,1,0,1,0,1,0,1,0,1,0] + sage: ND = NuDyckWord([1,1,1,0,1,0,0,1,1,0,0,0],nu) sage: ND.pretty_print() ______ |x x . @@ -1201,6 +1280,8 @@ def _element_constructor_(self, word): def __contains__(self, x) -> bool: r""" + Checks for containment. + TESTS:: sage: NDW = NuDyckWords([1,0,1,1]) @@ -1271,6 +1352,8 @@ def _cache_key(self) -> str: def _an_element_(self): r""" + Returns an element. + TESTS:: sage: NuDyckWords('101').an_element() @@ -1278,25 +1361,65 @@ def _an_element_(self): """ return self.element_class(self, self._nu) - def __iter__(self): + def __iter__(self, N=[], D=[], i=None, X=None): """ Iterate over ``self``. - .. TODO:: make a better iterator. + The iterator procedes by letting `N` be the locations of all the north + steps in `\nu`. Then we proceed by decreasing the locations as much as + we can from right to left. EXAMPLES:: sage: it = NuDyckWords('101010').__iter__() sage: [i for i in it] - [[1, 1, 1, 0, 0, 0], - [1, 1, 0, 1, 0, 0], - [1, 1, 0, 0, 1, 0], + [[1, 0, 1, 0, 1, 0], [1, 0, 1, 1, 0, 0], - [1, 0, 1, 0, 1, 0]] + [1, 1, 0, 0, 1, 0], + [1, 1, 0, 1, 0, 0], + [1, 1, 1, 0, 0, 0]] """ - for p in Permutations(list(self._nu)): - if path_weakly_above_other(to_word_path(p), self._nu): - yield self.element_class(self, list(p)) + # Location of all the ones + N = [k for k, v in enumerate(list(self._nu)) if v == 1] + + # Our first return element + D = copy(N) + + # Lambda function for adding a one in the appropriate spot + def X(i, N): return 1 if i in N else 0 + + # i is the final entry + i = len(N) - 1 + + # j is our iterator + j = i + + # return nu first + nu = [X(i, D) for i in range(self._nu.length())] + yield self.element_class(self, nu) + + # While we haven't reached the start of our list + while j >= 0: + # If the final number is more than 1 away from second to last + if D[i] > D[i-1] + 1: + D[i] -= 1 + DW = [X(i, D) for i in range(self._nu.length())] + yield self.element_class(self, DW) + else: + # reset j just in case + j = i + # find the last index where two numbers are more than 1 away. + while j > 0 and D[j] == D[j - 1] + 1: + j -= 1 + if j > 0 or (j == 0 and D[j] > 0): + D[j] -= 1 + # reset all the entries above j + for k in range(j + 1, len(N)): + D[k] = N[k] + DW = [X(i, D) for i in range(self._nu.length())] + yield self.element_class(self, DW) + else: + j = -1 def cardinality(self): r""" @@ -1330,16 +1453,16 @@ def to_word_path(word): EXAMPLES:: - sage: from sage.combinat.nu_dyck_word import to_word_path - sage: wp = to_word_path('NEENENEN'); wp - Path: 10010101 - sage: from sage.combinat.words.paths import FiniteWordPath_north_east - sage: isinstance(wp,FiniteWordPath_north_east) - True - sage: to_word_path('1001') - Path: 1001 - sage: to_word_path([0,1,0,0,1,0]) - Path: 010010 + sage: from sage.combinat.nu_dyck_word import to_word_path + sage: wp = to_word_path('NEENENEN'); wp + Path: 10010101 + sage: from sage.combinat.words.paths import FiniteWordPath_north_east + sage: isinstance(wp,FiniteWordPath_north_east) + True + sage: to_word_path('1001') + Path: 1001 + sage: to_word_path([0,1,0,0,1,0]) + Path: 010010 """ # If we already have the object, don't worry if isinstance(word, FiniteWordPath_north_east): From ec793fc9533278b310eeecb8fee4b5946b594be4 Mon Sep 17 00:00:00 2001 From: Aram Dermenjian Date: Tue, 17 May 2022 11:36:58 +0100 Subject: [PATCH 168/338] Fix doc to use imperative --- src/sage/combinat/nu_dyck_word.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index baf5f9b830e..38521334568 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -1280,7 +1280,7 @@ def _element_constructor_(self, word): def __contains__(self, x) -> bool: r""" - Checks for containment. + Check for containment. TESTS:: @@ -1352,7 +1352,7 @@ def _cache_key(self) -> str: def _an_element_(self): r""" - Returns an element. + Return an element. TESTS:: From e3925245f576144eff5a546f36592ee1c83a6687 Mon Sep 17 00:00:00 2001 From: Aram Dermenjian Date: Tue, 17 May 2022 14:41:39 +0100 Subject: [PATCH 169/338] Make iterator a recursively enumerated set --- src/sage/combinat/nu_dyck_word.py | 91 +++++++++---------------------- 1 file changed, 26 insertions(+), 65 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index 38521334568..503b1e00fe5 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -32,11 +32,11 @@ from sage.structure.element import Element from sage.rings.integer import Integer from sage.combinat.combinat import CombinatorialElement +from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet from sage.structure.global_options import GlobalOptions from sage.structure.parent import Parent from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.misc.latex import latex -from copy import copy from sage.combinat.words.paths import WordPaths_north_east from sage.combinat.words.paths import FiniteWordPath_north_east @@ -259,6 +259,7 @@ def __init__(self, parent, dw, latex_options=None): """ Element.__init__(self, parent) self._path = to_word_path(dw) + self._list = list(self._path) if parent is None: raise ValueError("need parent object") @@ -269,18 +270,6 @@ def __init__(self, parent, dw, latex_options=None): latex_options = {} self._latex_options = dict(latex_options) - def _list(self): - """ - Return list of ``self``. - - EXAMPLES:: - - sage: w = NuDyckWord('110100','101010') - sage: w._list() - [1, 1, 0, 1, 0, 0] - """ - return list(self._path) - def __eq__(self, other): """ Return if two paths are equal. @@ -432,7 +421,7 @@ def __hash__(self) -> int: sage: hash(u) # random -4577085166836515071 """ - return hash(''.join(str(i) for i in self._list())) + return hash(''.join(str(i) for i in self._list)) def set_latex_options(self, D): r""" @@ -731,14 +720,14 @@ def pretty_print(self, style=None, labelling=None): __ _| . _| . . - | . . . - ____ - |x . - _| . . | . . . __ ___| . |x . . + | . . . + ____ + |x . + _| . . | . . . ____ _|x . @@ -1087,7 +1076,7 @@ def can_mutate(self, i) -> bool | int: # Find the ith north step level = 0 - ndw = self._list() + ndw = self._list for j, k in enumerate(ndw): if k == ndw_open_symbol: level += 1 @@ -1133,7 +1122,7 @@ def mutate(self, i) -> None | NuDyckWord: if horiz[i] == horiz_num: other_index = i break - ndw = self._list() + ndw = self._list d = ndw[0:mutation_index - 1] e = ndw[mutation_index:other_index] f = ndw[other_index:] @@ -1365,61 +1354,33 @@ def __iter__(self, N=[], D=[], i=None, X=None): """ Iterate over ``self``. - The iterator procedes by letting `N` be the locations of all the north - steps in `\nu`. Then we proceed by decreasing the locations as much as - we can from right to left. + The iterator interchanges a 0,1 pair whenever the 0 comes before a 1 EXAMPLES:: sage: it = NuDyckWords('101010').__iter__() sage: [i for i in it] [[1, 0, 1, 0, 1, 0], - [1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0], + [1, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0]] """ - # Location of all the ones - N = [k for k, v in enumerate(list(self._nu)) if v == 1] - - # Our first return element - D = copy(N) - - # Lambda function for adding a one in the appropriate spot - def X(i, N): return 1 if i in N else 0 - - # i is the final entry - i = len(N) - 1 - - # j is our iterator - j = i - - # return nu first - nu = [X(i, D) for i in range(self._nu.length())] - yield self.element_class(self, nu) - - # While we haven't reached the start of our list - while j >= 0: - # If the final number is more than 1 away from second to last - if D[i] > D[i-1] + 1: - D[i] -= 1 - DW = [X(i, D) for i in range(self._nu.length())] - yield self.element_class(self, DW) - else: - # reset j just in case - j = i - # find the last index where two numbers are more than 1 away. - while j > 0 and D[j] == D[j - 1] + 1: - j -= 1 - if j > 0 or (j == 0 and D[j] > 0): - D[j] -= 1 - # reset all the entries above j - for k in range(j + 1, len(N)): - D[k] = N[k] - DW = [X(i, D) for i in range(self._nu.length())] - yield self.element_class(self, DW) - else: - j = -1 + # Define successor function for recursion + def transpose_close_open(N): + return [self.element_class(self, + N._list[0:k-1] + + list(reversed(N._list[k-1:k+1])) + + N._list[k+1:]) + for k, v in enumerate(N._list) + if k > 0 + and v == ndw_open_symbol + and N._list[k-1] == ndw_close_symbol + ] + + RES = RecursivelyEnumeratedSet([self.element_class(self, self._nu)], + transpose_close_open) + return RES.breadth_first_search_iterator() def cardinality(self): r""" From 2c86c693760db6423bcfabb2f9241a7d98b9e4b6 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 18 May 2022 00:36:14 +0800 Subject: [PATCH 170/338] add ._scaling_factor() for .formal()[1] --- .../elliptic_curves/ell_curve_isogeny.py | 26 +++++++++++++++++++ .../schemes/elliptic_curves/hom_composite.py | 19 ++++++++++++++ .../elliptic_curves/weierstrass_morphism.py | 13 ++++++++++ 3 files changed, 58 insertions(+) diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 77768439227..3dacb0ba27c 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2768,6 +2768,32 @@ def x_rational_map(self): self.__initialize_rational_maps() return self.__X_coord_rational_map + def _scaling_factor(self): + r""" + Return ``self.formal()[1]``, but faster. + + EXAMPLES:: + + sage: E = EllipticCurve(GF(257^2), [0,1]) + sage: phi = E.isogeny(E.lift_x(240)) + sage: phi.degree() + 43 + sage: phi._scaling_factor() + 1 + sage: phi.dual()._scaling_factor() + 43 + + ALGORITHM: The "inner" isogeny is normalized by construction, + so we only need to account for the scaling factors of a pre- + and post-isomorphism. + """ + sc = Integer(1) + if self.__pre_isomorphism is not None: + sc *= self.__pre_isomorphism._scaling_factor() + if self.__post_isomorphism is not None: + sc *= self.__post_isomorphism._scaling_factor() + return sc + def kernel_polynomial(self): r""" Return the kernel polynomial of this isogeny. diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 2098c7d8ee1..beb86bffaf9 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -765,6 +765,25 @@ def formal(self, prec=20): res = res(phi.formal(prec=prec)) return res + def _scaling_factor(self): + r""" + Return ``self.formal()[1]``, but faster. + + EXAMPLES:: + + sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite + sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) + sage: P = E.lift_x(7321) + sage: phi = EllipticCurveHom_composite(E, P) + sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi + sage: phi.formal() + 7*t + 65474*t^2 + 511*t^3 + 61316*t^4 + 20548*t^5 + 45511*t^6 + 37285*t^7 + 48414*t^8 + 9022*t^9 + 24025*t^10 + 35986*t^11 + 55397*t^12 + 25199*t^13 + 18744*t^14 + 46142*t^15 + 9078*t^16 + 18030*t^17 + 47599*t^18 + 12158*t^19 + 50630*t^20 + 56449*t^21 + 43320*t^22 + O(t^23) + sage: phi._scaling_factor() + 7 + """ + return prod(phi._scaling_factor() for phi in self._phis) + def is_injective(self): """ Determine whether this composite morphism has trivial kernel. diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 1927ab10c55..1d4f5f9d419 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -898,3 +898,16 @@ def __neg__(self): w = baseWI(-1, 0, -a1, -a3) urst = baseWI.__mul__(self, w).tuple() return WeierstrassIsomorphism(self._domain, urst, self._codomain) + + def _scaling_factor(self): + r""" + Return ``self.formal()[1]``, but faster. + + EXAMPLES:: + + sage: E = EllipticCurve(QQbar, [0,1]) + sage: all(f._scaling_factor() == f.formal()[1] for f in E.automorphisms()) + True + """ + return self.u + From 2e88ff0891576391c7c3769da363db5addbf4ca3 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 18 May 2022 12:15:47 +0800 Subject: [PATCH 171/338] use ._scaling_factor() instead of .formal()[1] --- src/sage/schemes/elliptic_curves/ell_curve_isogeny.py | 4 ++-- src/sage/schemes/elliptic_curves/hom.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 3dacb0ba27c..ad8f68a6900 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -3346,7 +3346,7 @@ def dual(self): # trac 7096 # this should take care of the case when the isogeny is not normalized. - u = self.formal(prec=2)[1] + u = self._scaling_factor() isom = WeierstrassIsomorphism(E2pr, (u/F(d), 0, 0, 0)) E2 = isom.codomain() @@ -3369,7 +3369,7 @@ def dual(self): # the composition has the degree as a leading coefficient in # the formal expansion. - phihat_sc = phi_hat.formal(prec=2)[1] + phihat_sc = phi_hat._scaling_factor() sc = u * phihat_sc/F(d) diff --git a/src/sage/schemes/elliptic_curves/hom.py b/src/sage/schemes/elliptic_curves/hom.py index 8133410e365..9ffa4077d2a 100644 --- a/src/sage/schemes/elliptic_curves/hom.py +++ b/src/sage/schemes/elliptic_curves/hom.py @@ -394,8 +394,7 @@ def is_normalized(self): sage: phi.is_normalized() True """ - phi_formal = self.formal(prec=5) - return phi_formal[1] == 1 + return self._scaling_factor() == 1 def is_separable(self): From fb571d33bcf0d6631fb3617d425a3ef3696e3321 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 18 May 2022 22:20:36 +0800 Subject: [PATCH 172/338] turn .scaling_factor() into a public function --- .../elliptic_curves/ell_curve_isogeny.py | 23 +++++++---- src/sage/schemes/elliptic_curves/hom.py | 39 ++++++++++++++++--- .../schemes/elliptic_curves/hom_composite.py | 19 +++++++-- .../elliptic_curves/weierstrass_morphism.py | 16 ++++++-- 4 files changed, 76 insertions(+), 21 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index ad8f68a6900..8b74de31935 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2768,9 +2768,16 @@ def x_rational_map(self): self.__initialize_rational_maps() return self.__X_coord_rational_map - def _scaling_factor(self): + def scaling_factor(self): r""" - Return ``self.formal()[1]``, but faster. + Return the Weierstrass scaling factor associated to this + elliptic-curve isogeny. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this isogeny and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. EXAMPLES:: @@ -2778,9 +2785,9 @@ def _scaling_factor(self): sage: phi = E.isogeny(E.lift_x(240)) sage: phi.degree() 43 - sage: phi._scaling_factor() + sage: phi.scaling_factor() 1 - sage: phi.dual()._scaling_factor() + sage: phi.dual().scaling_factor() 43 ALGORITHM: The "inner" isogeny is normalized by construction, @@ -2789,9 +2796,9 @@ def _scaling_factor(self): """ sc = Integer(1) if self.__pre_isomorphism is not None: - sc *= self.__pre_isomorphism._scaling_factor() + sc *= self.__pre_isomorphism.scaling_factor() if self.__post_isomorphism is not None: - sc *= self.__post_isomorphism._scaling_factor() + sc *= self.__post_isomorphism.scaling_factor() return sc def kernel_polynomial(self): @@ -3346,7 +3353,7 @@ def dual(self): # trac 7096 # this should take care of the case when the isogeny is not normalized. - u = self._scaling_factor() + u = self.scaling_factor() isom = WeierstrassIsomorphism(E2pr, (u/F(d), 0, 0, 0)) E2 = isom.codomain() @@ -3369,7 +3376,7 @@ def dual(self): # the composition has the degree as a leading coefficient in # the formal expansion. - phihat_sc = phi_hat._scaling_factor() + phihat_sc = phi_hat.scaling_factor() sc = u * phihat_sc/F(d) diff --git a/src/sage/schemes/elliptic_curves/hom.py b/src/sage/schemes/elliptic_curves/hom.py index 9ffa4077d2a..4ab0210fc61 100644 --- a/src/sage/schemes/elliptic_curves/hom.py +++ b/src/sage/schemes/elliptic_curves/hom.py @@ -266,6 +266,36 @@ def x_rational_map(self): raise NotImplementedError('children must implement') + def scaling_factor(self): + r""" + Return the Weierstrass scaling factor associated to this + elliptic-curve morphism. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this morphism and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. + + Implemented by child classes. For examples, see: + + - :meth:`EllipticCurveIsogeny.scaling_factor` + - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.scaling_factor` + - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.scaling_factor` + + TESTS:: + + sage: from sage.schemes.elliptic_curves.hom import EllipticCurveHom + sage: EllipticCurveHom.scaling_factor(None) + Traceback (most recent call last): + ... + NotImplementedError: ... + """ + #TODO: could have a default implementation that simply + # returns .formal()[1], but it seems safer to fail + # visibly to make sure we would notice regressions + raise NotImplementedError('children must implement') + def formal(self, prec=20): r""" Return the formal isogeny associated to this elliptic-curve @@ -326,11 +356,6 @@ def is_normalized(self): `\omega_2` are the invariant differentials on `E_1` and `E_2` corresponding to the given equation. - ALGORITHM: - - The method checks if the leading term of the formal series - associated to this isogeny equals `1`. - EXAMPLES:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism @@ -393,8 +418,10 @@ def is_normalized(self): sage: phi = isom * phi sage: phi.is_normalized() True + + ALGORITHM: We check if :meth:`scaling_factor` returns `1`. """ - return self._scaling_factor() == 1 + return self.scaling_factor() == 1 def is_separable(self): diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index beb86bffaf9..147d1b3eb5c 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -765,9 +765,16 @@ def formal(self, prec=20): res = res(phi.formal(prec=prec)) return res - def _scaling_factor(self): + def scaling_factor(self): r""" - Return ``self.formal()[1]``, but faster. + Return the Weierstrass scaling factor associated to this + composite morphism. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this morphism and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. EXAMPLES:: @@ -779,10 +786,14 @@ def _scaling_factor(self): sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi sage: phi.formal() 7*t + 65474*t^2 + 511*t^3 + 61316*t^4 + 20548*t^5 + 45511*t^6 + 37285*t^7 + 48414*t^8 + 9022*t^9 + 24025*t^10 + 35986*t^11 + 55397*t^12 + 25199*t^13 + 18744*t^14 + 46142*t^15 + 9078*t^16 + 18030*t^17 + 47599*t^18 + 12158*t^19 + 50630*t^20 + 56449*t^21 + 43320*t^22 + O(t^23) - sage: phi._scaling_factor() + sage: phi.scaling_factor() 7 + + ALGORITHM: The scaling factor is multiplicative under + composition, so we return the product of the individual + scaling factors associated to each factor. """ - return prod(phi._scaling_factor() for phi in self._phis) + return prod(phi.scaling_factor() for phi in self._phis) def is_injective(self): """ diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 1d4f5f9d419..47b6255450d 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -899,15 +899,25 @@ def __neg__(self): urst = baseWI.__mul__(self, w).tuple() return WeierstrassIsomorphism(self._domain, urst, self._codomain) - def _scaling_factor(self): + def scaling_factor(self): r""" - Return ``self.formal()[1]``, but faster. + Return the Weierstrass scaling factor associated to this + Weierstrass isomorphism. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this isomorphism and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. EXAMPLES:: sage: E = EllipticCurve(QQbar, [0,1]) - sage: all(f._scaling_factor() == f.formal()[1] for f in E.automorphisms()) + sage: all(f.scaling_factor() == f.formal()[1] for f in E.automorphisms()) True + + ALGORITHM: The scaling factor equals the `u` component of + the tuple `(u,r,s,t)` defining the isomorphism. """ return self.u From 86f7da0b9635c69345578bec90e33c9d31b3d961 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 21 May 2022 13:42:27 +0000 Subject: [PATCH 173/338] Add pytest step --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8e901d82af..5e4ace07d46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,13 @@ jobs: MAKE: make -j2 SAGE_NUM_THREADS: 2 + - name: Pytest + if: contains(github.ref, 'pytest') + run: | + ../sage -python -m pip install coverage pytest-xdist + ../sage -python -m coverage run -m pytest -c tox.ini --doctest-modules || true + working-directory: ./src + - name: Test run: | ../sage -python -m pip install coverage From 956d3d2075ad7fa63c30f787139b2914dba9cb69 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Sat, 21 May 2022 14:03:00 -0400 Subject: [PATCH 174/338] src/sage/modular/modform/ring.py: main changes --- src/sage/modular/modform/ring.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index 821f9861add..52b6185b37a 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -765,13 +765,11 @@ def generators(self, maxweight=8, prec=10, start_gens=[], start_weight=2): def gen_forms(self, maxweight=8, start_gens=[], start_weight=2): r""" - This function calculates a list of modular forms generating this ring - (as an algebra over the appropriate base ring). It differs from - :meth:`generators` only in that it returns Sage modular form objects, - rather than bare `q`-expansions; and if the base ring is a finite - field, the modular forms returned will be forms in characteristic 0 - with integral `q`-expansions whose reductions modulo `p` generate the - ring of modular forms mod `p`. + Returns a list of modular forms generating this ring (as an algebra over + the appropriate base ring). + + This method differs from :meth:`generators` only in that it returns + graded modular form objects, rather than bare `q`-expansions. INPUT: @@ -796,13 +794,17 @@ def gen_forms(self, maxweight=8, start_gens=[], start_weight=2): EXAMPLES:: sage: A = ModularFormsRing(Gamma0(11), Zmod(5)).gen_forms(); A - [1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + O(q^6), q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6), q - 9*q^4 - 10*q^5 + O(q^6)] + [1 + 2*q^2 + 2*q^3 + 2*q^4 + 2*q^5 + O(q^6), + q + 3*q^2 + 4*q^3 + 2*q^4 + q^5 + O(q^6), + q + q^4 + O(q^6)] sage: A[0].parent() - Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field + Ring of Modular Forms for Congruence Subgroup Gamma0(11) over Ring of integers modulo 5 """ sgs = tuple( (F.weight(), None, F) for F in start_gens ) G = self._find_generators(maxweight, sgs, start_weight) - return [F for k,f,F in G] + return [self(F.parent().change_ring(self.base_ring())(F)) for k,f,F in G] + + gens = gen_forms def _find_generators(self, maxweight, start_gens, start_weight): r""" From 4ed5382215b14eff132106177fb098f54c40a4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 12 Apr 2022 13:40:35 +0200 Subject: [PATCH 175/338] some care for pep8 in pyx files in modular/ --- .../modular/arithgroup/arithgroup_element.pyx | 2 +- src/sage/modular/arithgroup/congroup.pyx | 26 +++--- src/sage/modular/arithgroup/farey_symbol.pyx | 4 +- src/sage/modular/modsym/heilbronn.pyx | 35 ++++--- src/sage/modular/modsym/manin_symbol.pyx | 4 +- src/sage/modular/modsym/p1list.pyx | 91 ++++++++++++------- 6 files changed, 101 insertions(+), 61 deletions(-) diff --git a/src/sage/modular/arithgroup/arithgroup_element.pyx b/src/sage/modular/arithgroup/arithgroup_element.pyx index 847252780d5..86ef0e933aa 100644 --- a/src/sage/modular/arithgroup/arithgroup_element.pyx +++ b/src/sage/modular/arithgroup/arithgroup_element.pyx @@ -194,7 +194,7 @@ cdef class ArithmeticSubgroupElement(MultiplicativeGroupElement): return richcmp(self.__x, right.__x, op) def __bool__(self): - """ + r""" Return ``True``, since the ``self`` lives in SL(2,\Z), which does not contain the zero matrix. diff --git a/src/sage/modular/arithgroup/congroup.pyx b/src/sage/modular/arithgroup/congroup.pyx index 3cb2a84b334..9554ebbc11d 100644 --- a/src/sage/modular/arithgroup/congroup.pyx +++ b/src/sage/modular/arithgroup/congroup.pyx @@ -1,4 +1,4 @@ -""" +r""" Cython helper functions for congruence subgroups This file contains optimized Cython implementations of a few functions related @@ -6,13 +6,13 @@ to the standard congruence subgroups `\Gamma_0, \Gamma_1, \Gamma_H`. These functions are for internal use by routines elsewhere in the Sage library. """ -#***************************************************************************** +# **************************************************************************** # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from cysignals.memory cimport check_allocarray, sig_free @@ -28,7 +28,7 @@ from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense from sage.modular.modsym.p1list import lift_to_sl2z from sage.matrix.matrix_space import MatrixSpace from sage.rings.integer_ring import ZZ -Mat2Z = MatrixSpace(ZZ,2) +Mat2Z = MatrixSpace(ZZ, 2) cdef Matrix_integer_dense genS, genT, genI genS = Matrix_integer_dense(Mat2Z, [0,-1, 1, 0], True, True) @@ -124,9 +124,11 @@ def degeneracy_coset_representatives_gamma0(int N, int M, int t): cc = M*random.randrange(-halfmax, halfmax+1) dd = random.randrange(-halfmax, halfmax+1) g = arith_int.c_xgcd_int(-cc,dd,&bb,&aa) - if g == 0: continue + if g == 0: + continue cc = cc / g - if cc % M != 0: continue + if cc % M != 0: + continue dd = dd / g # Test if we've found a new coset representative. is_new = 1 @@ -212,7 +214,6 @@ def degeneracy_coset_representatives_gamma1(int N, int M, int t): cdef int d, g, i, j, k, n, aa, bb, cc, dd, Ndivt, halfmax, is_new cdef int* R - # total number of coset representatives that we'll find n = Gamma1(N).index() / Gamma1(M).index() d = arith_int.c_gcd_int(t, N/t) @@ -226,11 +227,14 @@ def degeneracy_coset_representatives_gamma1(int N, int M, int t): cc = M*random.randrange(-halfmax, halfmax+1) dd = 1 + M*random.randrange(-halfmax, halfmax+1) g = arith_int.c_xgcd_int(-cc,dd,&bb,&aa) - if g == 0: continue + if g == 0: + continue cc = cc / g - if cc % M != 0: continue + if cc % M != 0: + continue dd = dd / g - if M != 1 and dd % M != 1: continue + if M != 1 and dd % M != 1: + continue # Test if we've found a new coset representative. is_new = 1 for i from 0 <= i < k: diff --git a/src/sage/modular/arithgroup/farey_symbol.pyx b/src/sage/modular/arithgroup/farey_symbol.pyx index 18ba31ae5dc..01b3db0b019 100644 --- a/src/sage/modular/arithgroup/farey_symbol.pyx +++ b/src/sage/modular/arithgroup/farey_symbol.pyx @@ -610,7 +610,7 @@ cdef class Farey: if forced_format == 'plain': # output not using xymatrix s = r'\left( -\infty' - a = [x._latex_() for x in self.fractions()] + ['\infty'] + a = [x._latex_() for x in self.fractions()] + [r'\infty'] b = self.pairings() for i in xrange(len(a)): u = b[i] @@ -623,7 +623,7 @@ cdef class Farey: else: # output using xymatrix s = r'\begin{xy}\xymatrix{& -\infty ' - f = [x._latex_() for x in self.fractions()]+[r'\infty'] + f = [x._latex_() for x in self.fractions()] + [r'\infty'] f.reverse() for p in self.pairings(): if p >= 0: diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index 3bfd5ffafe1..2ba337dddc4 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -211,7 +211,7 @@ cdef class Heilbronn: sig_off() cdef apply_to_polypart(self, fmpz_poly_t* ans, int i, int k): - """ + r""" INPUT: - ``ans`` - fmpz_poly_t\*; pre-allocated an @@ -402,7 +402,11 @@ cdef class HeilbronnCremona(Heilbronn): a = -b b = c x3 = q*x2 - x1 - x1 = x2; x2 = x3; y3 = q*y2 - y1; y1 = y2; y2 = y3 + x1 = x2 + x2 = x3 + y3 = q*y2 - y1 + y1 = y2 + y2 = y3 list_append4(L, x1,x2, y1,y2) self.length = L.i/4 sig_off() @@ -573,9 +577,11 @@ def hecke_images_gamma0_weight2(int u, int v, int N, indices, R): # Allocate memory to hold images of (u,v) under all Heilbronn matrices a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError # Compute images of (u,v) under all Heilbronn matrices H.apply_only(u, v, N, a, b) @@ -708,9 +714,11 @@ def hecke_images_nonquad_character_weight2(int u, int v, int N, indices, chi, R) # Allocate memory to hold images of (u,v) under all Heilbronn matrices a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError # Compute images of (u,v) under all Heilbronn matrices H.apply_only(u, v, N, a, b) @@ -798,16 +806,19 @@ def hecke_images_quad_character_weight2(int u, int v, int N, indices, chi, R): # are the values of the character chi. _chivals = chi.values() cdef int *chi_vals = sig_malloc(sizeof(int)*len(_chivals)) - if not chi_vals: raise MemoryError + if not chi_vals: + raise MemoryError for i in range(len(_chivals)): chi_vals[i] = _chivals[i] for i, n in enumerate(indices): H = HeilbronnCremona(n) if is_prime(n) else HeilbronnMerel(n) a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError H.apply_only(u, v, N, a, b) for j in range(H.length): @@ -893,9 +904,11 @@ def hecke_images_gamma0_weight_k(int u, int v, int i, int N, int k, indices, R): # Allocate memory to hold images of (u,v) under all Heilbronn matrices a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError # Compute images of (u,v) under all Heilbronn matrices H.apply_only(u, v, N, a, b) diff --git a/src/sage/modular/modsym/manin_symbol.pyx b/src/sage/modular/modsym/manin_symbol.pyx index 0a4944b4ad8..86927b91959 100644 --- a/src/sage/modular/modsym/manin_symbol.pyx +++ b/src/sage/modular/modsym/manin_symbol.pyx @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" +r""" Manin symbols This module defines the class ManinSymbol. A Manin symbol of @@ -19,9 +19,7 @@ monomial Manin symbols to monomial Manin symbols, up to a scalar factor. For general matrices (such as `T=[0,1,-1,-1]` and `T^2=[-1,-1;0,1]`) the image of a monomial Manin symbol is expressed as a formal sum of monomial Manin symbols, with integer coefficients. - """ - from sage.modular.cusps import Cusp from sage.rings.all import Infinity, ZZ from sage.rings.integer cimport Integer diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index fbe461c269d..aaa8aa609d7 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -68,8 +68,10 @@ cdef int c_p1_normalize_int(int N, int u, int v, u = u % N v = v % N - if u<0: u = u + N - if v<0: v = v + N + if u < 0: + u = u + N + if v < 0: + v = v + N if u == 0: uu[0] = 0 if arith_int.c_gcd_int(v,N) == 1: @@ -81,7 +83,8 @@ cdef int c_p1_normalize_int(int N, int u, int v, g = arith_int.c_xgcd_int(u, N, &s, &t) s = s % N - if s<0: s = s + N + if s < 0: + s = s + N if arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -99,7 +102,8 @@ cdef int c_p1_normalize_int(int N, int u, int v, u = g v = (s*v) % N - min_v = v; min_t = 1 + min_v = v + min_t = 1 if g!=1: Ng = N/g vNg = (v*Ng) % N @@ -108,10 +112,13 @@ cdef int c_p1_normalize_int(int N, int u, int v, v = (v + vNg) % N t = (t + Ng) % N if v(ll_s % ll_N) t = (ll_t % ll_N) s = s % N - if s<0: s = s + N + if s < 0: + s = s + N if arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -355,7 +366,8 @@ cdef int c_p1_normalize_llong(int N, int u, int v, # v = (s*v) % N v = ( ((s) * (v)) % ll_N ) - min_v = v; min_t = 1 + min_v = v + min_t = 1 if g!=1: Ng = N/g vNg = ((v * Ng) % ll_N) @@ -364,16 +376,20 @@ cdef int c_p1_normalize_llong(int N, int u, int v, v = (v + vNg) % N t = (t + Ng) % N if v (arith_llong.c_inverse_mod_longlong(( s)*( min_t), N) % ll_N) return 0 + def p1_normalize_llong(N, u, v): r""" Computes the canonical representative of @@ -449,7 +465,8 @@ def p1list_llong(int N): [(0, 1), (34603, 1), (34603, 2), (34603, 3)] """ cdef int g, u, v, s, c, d, h, d1, cmax - if N==1: return [(0,0)] + if N == 1: + return [(0, 0)] lst = [(0,1)] c = 1 @@ -478,8 +495,9 @@ def p1list_llong(int N): lst.sort() return lst + def p1list(N): - """ + r""" Return the elements of the projective line modulo `N`, `\mathbb{P}^1(\ZZ/N\ZZ)`, as a plain list of 2-tuples. @@ -600,8 +618,10 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, u = u % N v = v % N - if u<0: u = u + N - if v<0: v = v + N + if u < 0: + u = u + N + if v < 0: + v = v + N if u == 0: uu[0] = 0 if t_g[v] == 1: # "if arith_int.c_gcd_int(v,N) == 1" @@ -616,7 +636,8 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, s = t_a[u] t = t_b[u] s = s % N - if s<0: s = s + N + if s < 0: + s = s + N if g != 1 and arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -634,7 +655,8 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, u = g v = (s*v) % N - min_v = v; min_t = 1 + min_v = v + min_t = 1 if g!=1: Ng = N/g vNg = (v*Ng) % N @@ -643,10 +665,13 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, v = (v + vNg) % N t = (t + Ng) % N if vcheck_allocarray(N, sizeof(int)) self.s = check_allocarray(N, sizeof(int)) self.t = check_allocarray(N, sizeof(int)) @@ -822,10 +847,10 @@ cdef class P1List(object): 'The projective line over the integers modulo 8' """ - return "The projective line over the integers modulo %s"%self.__N + return "The projective line over the integers modulo %s" % self.__N def lift_to_sl2z(self, int i): - """ + r""" Lift the `i`'th element of this P1list to an element of `SL(2,\ZZ)`. @@ -836,7 +861,6 @@ cdef class P1List(object): INPUT: - - ``i`` - integer (the index of the element to lift). EXAMPLES:: @@ -1187,8 +1211,9 @@ cdef class export: int compute_s) except -1: return c_p1_normalize_llong(N, u, v, uu, vv, ss, compute_s) + def lift_to_sl2z_int(int c, int d, int N): - """ + r""" Lift a pair `(c, d)` to an element of `SL(2, \ZZ)`. `(c,d)` is assumed to be an element of From 5bfe5e127f0f3371d146c363f64da045f1d5438f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Apr 2022 08:38:55 +0200 Subject: [PATCH 176/338] using += where possible in p1list --- src/sage/modular/modsym/p1list.pyx | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index aaa8aa609d7..df75484734e 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -69,9 +69,9 @@ cdef int c_p1_normalize_int(int N, int u, int v, u = u % N v = v % N if u < 0: - u = u + N + u += N if v < 0: - v = v + N + v += N if u == 0: uu[0] = 0 if arith_int.c_gcd_int(v,N) == 1: @@ -84,7 +84,7 @@ cdef int c_p1_normalize_int(int N, int u, int v, g = arith_int.c_xgcd_int(u, N, &s, &t) s = s % N if s < 0: - s = s + N + s += N if arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -116,9 +116,9 @@ cdef int c_p1_normalize_int(int N, int u, int v, min_t = t v = min_v if u < 0: - u = u+N + u += N if v < 0: - v = v+N + v += N uu[0] = u vv[0] = v if compute_s: @@ -329,9 +329,9 @@ cdef int c_p1_normalize_llong(int N, int u, int v, u = u % N v = v % N if u < 0: - u = u + N + u += N if v < 0: - v = v + N + v += N if u == 0: uu[0] = 0 if arith_int.c_gcd_int(v,N) == 1: @@ -347,7 +347,7 @@ cdef int c_p1_normalize_llong(int N, int u, int v, t = (ll_t % ll_N) s = s % N if s < 0: - s = s + N + s += N if arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -380,9 +380,9 @@ cdef int c_p1_normalize_llong(int N, int u, int v, min_t = t v = min_v if u < 0: - u = u+N + u += N if v < 0: - v = v+N + v += N uu[0] = u vv[0] = v if compute_s: @@ -619,9 +619,9 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, u = u % N v = v % N if u < 0: - u = u + N + u += N if v < 0: - v = v + N + v += N if u == 0: uu[0] = 0 if t_g[v] == 1: # "if arith_int.c_gcd_int(v,N) == 1" @@ -637,7 +637,7 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, t = t_b[u] s = s % N if s < 0: - s = s + N + s += N if g != 1 and arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -669,9 +669,9 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, min_t = t v = min_v if u < 0: - u = u+N + u += N if v < 0: - v = v+N + v += N uu[0] = u vv[0] = v if compute_s: @@ -1274,7 +1274,7 @@ def lift_to_sl2z_int(int c, int d, int N): if g == 1: break m = m / g - d = d + N*m + d += N * m g = arith_int.c_xgcd_int(c, d, &z1, &z2) if g != 1: @@ -1344,7 +1344,7 @@ def lift_to_sl2z_llong(llong c, llong d, int N): if g == 1: break m = m / g - d = d + N*m + d += N * m g = arith_llong.c_xgcd_longlong(c, d, &z1, &z2) if g != 1: From 3b8828413771b6b922c3018daf52052354c35ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 24 May 2022 10:43:54 +0200 Subject: [PATCH 177/338] get rid of some range(O,*) --- src/sage/coding/binary_code.pyx | 2 +- src/sage/geometry/integral_points.pyx | 24 +++++++++---------- src/sage/libs/mpmath/ext_impl.pyx | 2 +- src/sage/matroids/matroid.pyx | 2 +- .../polynomial/multi_polynomial_ring_base.pyx | 8 +++---- src/sage/rings/polynomial/real_roots.pyx | 15 ++++++------ src/sage/sets/recursively_enumerated_set.pyx | 2 +- src/sage/structure/element.pyx | 4 ++-- 8 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/sage/coding/binary_code.pyx b/src/sage/coding/binary_code.pyx index 11af1f7aadf..709a3e8fe76 100644 --- a/src/sage/coding/binary_code.pyx +++ b/src/sage/coding/binary_code.pyx @@ -3927,7 +3927,7 @@ cdef class BinaryCodeClassifier: sage: soc_iter = codes.databases.self_orthogonal_binary_codes(12, 6, 4) sage: L = list(soc_iter) - sage: for n in range(0, 13): + sage: for n in range(13): ....: s = 'n=%2d : '%n ....: for k in range(1,7): ....: s += '%3d '%len([C for C in L if C.length() == n and C.dimension() == k]) diff --git a/src/sage/geometry/integral_points.pyx b/src/sage/geometry/integral_points.pyx index dbacf395c9c..f8325eea1ed 100644 --- a/src/sage/geometry/integral_points.pyx +++ b/src/sage/geometry/integral_points.pyx @@ -49,12 +49,12 @@ from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense ## # R*Rinv == diagonal_matrix([d]*D.ncols() + [0]*(D.nrows()-D.ncols())) ## # If R is full rank, this is Rinv = matrix(ZZ, R.inverse() * d) ## Dinv = D.transpose() -## for i in range(0,D.ncols()): +## for i in range(D.ncols()): ## Dinv[i,i] = d/D[i,i] ## Rinv = V * Dinv * U ## ## gens = [] -## for b in CartesianProduct(*[ range(0,i) for i in e ]): +## for b in CartesianProduct(*[ range(i) for i in e ]): ## # this is our generator modulo the lattice spanned by the rays ## gen_mod_rays = sum( b_i*u_i for b_i, u_i in zip(b,u) ) ## q_times_d = Rinv * gen_mod_rays @@ -175,7 +175,7 @@ cpdef tuple ray_matrix_normal_form(R): if d == ZZ.zero(): raise ValueError('The spanning points are not linearly independent!') cdef int i - Dinv = diagonal_matrix(ZZ, [ d // e[i] for i in range(0,D.ncols()) ]) + Dinv = diagonal_matrix(ZZ, [ d // e[i] for i in range(D.ncols()) ]) VDinv = V * Dinv return (e, d, VDinv) @@ -224,20 +224,20 @@ cpdef tuple loop_over_parallelotope_points(e, d, Matrix_integer_dense VDinv, cdef list gens = [] gen = lattice(ZZ.zero()) cdef Vector_integer_dense q_times_d = vector(ZZ, dim) - for base in itertools.product(*[ range(0,i) for i in e ]): - for i in range(0, dim): + for base in itertools.product(*[ range(i) for i in e ]): + for i in range(dim): s = ZZ.zero() - for j in range(0, dim): + for j in range(dim): s += VDinv.get_unsafe(i,j) * base[j] q_times_d.set_unsafe(i, s % d) - for i in range(0, ambient_dim): + for i in range(ambient_dim): s = ZZ.zero() - for j in range(0, dim): + for j in range(dim): s += R.get_unsafe(i,j) * q_times_d.get_unsafe(j) gen[i] = s / d if A is not None: s = ZZ.zero() - for i in range(0, ambient_dim): + for i in range(ambient_dim): s += A[i] * gen[i] if s > b: continue @@ -341,7 +341,7 @@ cdef translate_points(v_list, Vector_integer_dense delta): cdef int dim = delta.degree() cdef int i for v in v_list: - for i in range(0,dim): + for i in range(dim): v[i] -= delta.get_unsafe(i) @@ -549,7 +549,7 @@ cpdef rectangular_box_points(list box_min, list box_max, assert not (count_only and return_saturated) cdef int d = len(box_min) cdef int i, j - cdef list diameter = sorted([ (box_max[i]-box_min[i], i) for i in range(0,d) ], + cdef list diameter = sorted([ (box_max[i]-box_min[i], i) for i in range(d) ], reverse=True) cdef list diameter_value = [x[0] for x in diameter] cdef list diameter_index = [x[1] for x in diameter] @@ -790,7 +790,7 @@ cdef class Inequality_generic: 'generic: (2, 3, 7) x + -5 >= 0' """ s = 'generic: (' - s += ', '.join([str(self.A[i]) for i in range(0,len(self.A))]) + s += ', '.join(str(self.A[i]) for i in range(len(self.A))) s += ') x + ' + str(self.b) + ' >= 0' return s diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index 7a8c8ae73ed..f9b0ff2d42c 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -2036,7 +2036,7 @@ cdef MPF_hypsum(MPF *a, MPF *b, int p, int q, param_types, str ztype, coeffs, z, mpz_set_complex_tuple_fixed(ZRE, ZIM, z, wp) else: mpz_set_tuple_fixed(ZRE, z, wp) - for i in range(0,p): + for i in range(p): sig_check() if param_types[i] == 'Z': mpz_init(AINT[aint]) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index ef9096fa1d9..7c21e640942 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -2351,7 +2351,7 @@ cdef class Matroid(SageObject): False """ E = list(self.groundset()) - for i in xrange(0, len(E) + 1): + for i in range(len(E) + 1): for X in combinations(E, i): XX = frozenset(X) rX = self._rank(XX) diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index 8847a6a2764..a560dc8b59c 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -1238,7 +1238,7 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): sage: R._macaulay_resultant_is_reduced([1,3,2],[2,3,3]) # the monomial x*y^3*z^2 is not reduced w.r.t. degrees vector [2,3,3] True """ - diff = [mon_degs[i] - dlist[i] for i in xrange(0,len(dlist))] + diff = [mon_degs[i] - dlist[i] for i in range(len(dlist))] return len([1 for d in diff if d >= 0]) == 1 def _macaulay_resultant_universal_polynomials(self, dlist): @@ -1276,11 +1276,11 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): for d in dlist: xlist = R.gens() degs = IntegerVectors(d, n+1) - mon_d = [prod([xlist[i]**(deg[i]) for i in xrange(0,len(deg))]) + mon_d = [prod([xlist[i]**(deg[i]) for i in range(len(deg))]) for deg in degs] - f = sum([mon_d[i]*ulist[i] for i in xrange(0,len(mon_d))]) - flist.append (f) + f = sum([mon_d[i]*ulist[i] for i in range(len(mon_d))]) + flist.append(f) ulist = ulist[len(mon_d):] return flist, R diff --git a/src/sage/rings/polynomial/real_roots.pyx b/src/sage/rings/polynomial/real_roots.pyx index 72cd160f5b3..e5edf97ed06 100644 --- a/src/sage/rings/polynomial/real_roots.pyx +++ b/src/sage/rings/polynomial/real_roots.pyx @@ -2109,14 +2109,14 @@ def bernstein_up(d1, d2, s=None): MS = MatrixSpace(QQ, s, d1+1, sparse=False) m = MS() scale = factorial(d2)/factorial(d2-d1) - for b in range(0, d1+1): + for b in range(d1 + 1): scale2 = scale / binomial(d1, b) if (d1 - b) & 1 == 1: scale2 = -scale2 scale2 = ~scale2 - for a in range(0, s): + for a in range(s): ra = ZZ(subsample_vec(a, s, d2 + 1)) - m[a, b] = prod([ra-i for i in range(0, b)]) * prod([ra-i for i in range(d2-d1+b+1, d2+1)]) * scale2 + m[a, b] = prod([ra-i for i in range(b)]) * prod([ra-i for i in range(d2-d1+b+1, d2+1)]) * scale2 return m @@ -4369,7 +4369,7 @@ def to_bernstein(p, low=0, high=1, degree=None): raise ValueError('Bernstein degree must be at least polynomial degree') vs = ZZ ** (degree + 1) c = vs(0) - for i in range(0, p.degree() + 1): + for i in range(p.degree() + 1): c[i] = p[i] scale = ZZ(1) if low == 0: @@ -4385,7 +4385,8 @@ def to_bernstein(p, low=0, high=1, degree=None): reverse_intvec(c) taylor_shift1_intvec(c) reverse_intvec(c) - return ([c[k] / binomial(degree, k) for k in range(0, degree+1)], scale) + return ([c[k] / binomial(degree, k) for k in range(degree + 1)], scale) + def to_bernstein_warp(p): """ @@ -4399,14 +4400,12 @@ def to_bernstein_warp(p): sage: to_bernstein_warp(1 + x + x^2 + x^3 + x^4 + x^5) [1, 1/5, 1/10, 1/10, 1/5, 1] """ - c = p.list() - for i in range(len(c)): c[i] = c[i] / binomial(len(c) - 1, i) - return c + def bernstein_expand(Vector_integer_dense c, int d2): """ Given an integer vector representing a Bernstein polynomial p, and diff --git a/src/sage/sets/recursively_enumerated_set.pyx b/src/sage/sets/recursively_enumerated_set.pyx index d2193c4ada7..073e7c6e95e 100644 --- a/src/sage/sets/recursively_enumerated_set.pyx +++ b/src/sage/sets/recursively_enumerated_set.pyx @@ -273,7 +273,7 @@ convention is that the generated elements are the ``s := f(n)``, except when ....: st = set(st) # make a copy ....: if st: ....: el = st.pop() - ....: for i in range(0, len(lst)+1): + ....: for i in range(len(lst)+1): ....: yield (lst[0:i]+[el]+lst[i:], st) sage: list(children(([1,2], {3,7,9}))) [([9, 1, 2], {3, 7}), ([1, 9, 2], {3, 7}), ([1, 2, 9], {3, 7})] diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index dfd6583b149..e302e6661b8 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -823,8 +823,8 @@ cdef class Element(SageObject): variables=[] # use "gen" instead of "gens" as a ParentWithGens is not # required to have the latter - for i in xrange(0,ngens): - gen=parent.gen(i) + for i in range(ngens): + gen = parent.gen(i) if str(gen) in kwds: variables.append(kwds[str(gen)]) elif in_dict and gen in in_dict: From a9b34633fb2894270afc68201a6ff2af53765b4a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 24 May 2022 09:55:37 -0700 Subject: [PATCH 178/338] m4/sage_spkg_collect.m4: Fix up quoting --- m4/sage_spkg_collect.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index c35a21a7efe..e778e55abcf 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -335,14 +335,14 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl ]) AS_CASE(["$DEPS"], [*\|*], [], [AS_VAR_APPEND([DEPS], [" |"])]) AS_IF([test -f "$DIR/dependencies_order_only"], [dnl - AS_VAR_APPEND([DEPS], [' '$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_order_only))]) + ADD_DEPS=$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_order_only)) + AS_VAR_APPEND([DEPS], [" $ADD_DEPS"]) ], [dnl m4_case(SPKG_SOURCE, [pip], [AS_VAR_APPEND([DEPS], [' pip'])], [:])dnl ]) AS_IF([test -f "$DIR/dependencies_check"], [dnl - AS_VAR_APPEND([DEPS], [' $(and $(filter-out no,$(SAGE_CHECK_]SPKG_NAME[)), ']) - AS_VAR_APPEND([DEPS], [$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_check))]) - AS_VAR_APPEND([DEPS], [')'])dnl + ADD_DEPS=$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_check)) + AS_VAR_APPEND([DEPS], [' $(and $(filter-out no,$(SAGE_CHECK_]SPKG_NAME[)), '"$ADD_DEPS"')'])dnl ]) dnl SAGE_PACKAGE_DEPENDENCIES="${SAGE_PACKAGE_DEPENDENCIES}$(printf '\ndeps_')SPKG_NAME = ${DEPS}" From 2ee71b5be9548734e247466f98c97df51ace5237 Mon Sep 17 00:00:00 2001 From: Louis Ng Date: Fri, 20 May 2022 11:42:10 -0700 Subject: [PATCH 179/338] added check for class and dimension when the input is a list or tuple --- .../polyhedron/modules/formal_polyhedra_module.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py index e3b55989563..af79c6fe830 100644 --- a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py +++ b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py @@ -1,6 +1,7 @@ r""" Formal modules generated by polyhedra """ +from cmath import isfinite from sage.combinat.free_module import CombinatorialFreeModule from sage.categories.graded_modules_with_basis import GradedModulesWithBasis @@ -83,6 +84,13 @@ def __classcall__(cls, base_ring, dimension, basis, category=None): """ if isinstance(basis, list): basis = tuple(basis) + if isinstance(basis, tuple): #To make sure it only check for finite input + from sage.geometry.polyhedron.base import Polyhedron_base + for P in basis: + if not isinstance(P, Polyhedron_base): + raise TypeError(f"{P} is not a polyhedron") + if P.ambient_space().dimension() != dimension: + raise TypeError(f"{P} does not belong to the ambient space") if category is None: category = GradedModulesWithBasis(base_ring) return super(FormalPolyhedraModule, cls).__classcall__(cls, From 350e87a068902f6097de93b02c5517d2547f5338 Mon Sep 17 00:00:00 2001 From: Louis Ng Date: Fri, 20 May 2022 17:03:17 -0700 Subject: [PATCH 180/338] removed unnecessary import --- src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py index af79c6fe830..cd97821a951 100644 --- a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py +++ b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py @@ -1,7 +1,6 @@ r""" Formal modules generated by polyhedra """ -from cmath import isfinite from sage.combinat.free_module import CombinatorialFreeModule from sage.categories.graded_modules_with_basis import GradedModulesWithBasis From d04f2b593d55c8ecb1c3a0d85867a8340398f4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 24 May 2022 20:39:05 +0200 Subject: [PATCH 181/338] some fixes in arxiv links --- src/doc/en/reference/references/index.rst | 17 ++++++++--------- .../non_symmetric_macdonald_polynomials.py | 2 +- src/sage/rings/number_field/S_unit_solver.py | 9 ++++----- src/sage/rings/polynomial/pbori/__init__.py | 8 ++++---- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 30a792e8214..f5edfa301e4 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -968,7 +968,7 @@ REFERENCES: .. [BDGRTW2019] Bonderson, Delaney, Galindo, Rowell, Tran, and Wang, On invariants of modular categories beyond modular data. J. Pure Appl. Algebra 223 (2019), no. 9, 4065–4088. - :arXiv:`1805.05736`. + :arxiv:`1805.05736`. .. [BM2004] John M. Boyer and Wendy J. Myrvold, *On the Cutting Edge: *Simplified `O(n)` Planarity by Edge Addition*. Journal of Graph @@ -2060,7 +2060,7 @@ REFERENCES: .. [Dragan2018] Feodor Dragan, Michel Habib, Laurent Viennot. *Revisiting Radius, Diameter, and all Eccentricity Computation in Graphs through Certificates*. - http://arxiv.org/abs/1803.04660 + :arxiv:`1803.04660` .. [Dro1987] Carl Droms. *Isomorphisms of graph groups*. Proc. of the Amer. Math. Soc. **100** @@ -3592,7 +3592,7 @@ REFERENCES: Springer-Verlag, 2011. .. [KP2020] Lars Kastner and Marta Panizzut, *Hyperplane arrangements - in polymake*, arxiv:`2003.13548`. + in polymake*, :arxiv:`2003.13548`. .. [KPRWZ2010] \M. H. Klin, C. Pech, S. Reichard, A. Woldar, M. Zvi-Av, *Examples of computer experimentation in algebraic @@ -4486,7 +4486,7 @@ REFERENCES: .. [NaiRow2011] Naidu and Rowell, A finiteness property for braided fusion categories. Algebr. Represent. Theory 14 (2011), no. 5, 837–855. - :arXiv:`0903.4157`. + :arxiv:`0903.4157`. .. [NAR2018] Jamie R. Nunez, Christopher R. Anderson, Ryan S. Renslow *Optimizing colormaps with consideration for color vision @@ -5002,7 +5002,7 @@ REFERENCES: .. [Row2006] Eric Rowell, *From quantum groups to unitary modular tensor categories*. In Representations of algebraic groups, quantum groups, and Lie algebras, Contemp. Math., **413**, Amer. Math. Soc., Providence, RI, 2006. - :arXiv:`math/0503226`. + :arxiv:`math/0503226`. .. [RoStWa2009] Eric Rowell, Richard Stong and Zhenghan Wang, *On classification of modular tensor categories*, Comm. Math. Phys. 292, 343--389, 2009. @@ -5087,7 +5087,7 @@ REFERENCES: .. [Sag2011] Bruce E. Sagan, *The cyclic sieving phenomenon: a survey*, - :arXiv:`1008.0790v3` + :arxiv:`1008.0790v3` .. [Sah2000] Sartaj Sahni. *Data Structures, Algorithms, and Applications in Java*. McGraw-Hill, 2000. @@ -5100,12 +5100,11 @@ REFERENCES: York, 1958. .. [Sal1965] \G. Salmon: "A Treatise on the Analytic Geometry of Three - Dimensions", Vol II, Chelsea Publishing Co., New - York, 1965. + Dimensions", Vol II, Chelsea Publishing Co., New York, 1965. .. [Sal2014] \B. Salisbury. The flush statistic on semistandard Young tableaux. - :arXiv:`1401.1185` + :arxiv:`1401.1185` .. [Sam2012] \P. Samanta: *Antipodal Graphs* :doi:`10.13140/RG.2.2.28238.46409` diff --git a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py index cbece412f13..b8eb4af9ab0 100644 --- a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +++ b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py @@ -355,7 +355,7 @@ class NonSymmetricMacdonaldPolynomials(CherednikOperatorsEigenvectors): .. [LNSSS12] \C. Lenart, S. Naito, D. Sagaki, A. Schilling, M. Shimozono, A uniform model for Kirillov-Reshetikhin crystals I: Lifting - the parabolic quantum Bruhat graph, preprint :arXiv:`1211.2042` + the parabolic quantum Bruhat graph, preprint :arxiv:`1211.2042` [math.QA] .. RUBRIC:: More examples diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py index 4e440c36ea0..fd1a5fe824c 100644 --- a/src/sage/rings/number_field/S_unit_solver.py +++ b/src/sage/rings/number_field/S_unit_solver.py @@ -142,7 +142,7 @@ def c3_func(SUK, prec=106): REFERENCES: - - [AKMRVW]_ arXiv:1903.00977 + - [AKMRVW]_ :arxiv:`1903.00977` """ @@ -541,7 +541,7 @@ def Omega_prime(dK, v, mu_list, prec=106): REFERENCES: - - [AKMRVW]_ arXiv:1903:.00977 + - [AKMRVW]_ :arxiv:`1903.00977` """ R = RealField(prec) @@ -645,8 +645,7 @@ def Yu_bound(SUK, v, prec=106): - [Sma1995]_ p. 825 - [Yu2007]_ p. 189--193 esp. Theorem 1 - - [AKMRVW]_ arXiv:1903.00977 - + - [AKMRVW]_ :arxiv:`1903.00977` """ # We are using Theorem 1 of "p-adic logarithmic forms and group varieties III" by Kunrui Yu. @@ -727,7 +726,7 @@ def K0_func(SUK, A, prec=106): REFERENCES: - [Sma1995]_ p. 824 - - [AKMRVW]_ arXiv:1903.00977 + - [AKMRVW]_ :arxiv:`1903.00977` """ R = RealField(prec) diff --git a/src/sage/rings/polynomial/pbori/__init__.py b/src/sage/rings/polynomial/pbori/__init__.py index f168ecd4617..69919bcc916 100644 --- a/src/sage/rings/polynomial/pbori/__init__.py +++ b/src/sage/rings/polynomial/pbori/__init__.py @@ -15,16 +15,16 @@ REFERENCES: M. Brickenstein, A. Dreyer, G. Greuel, M. Wedler, O. Wienand, -New developments in the theory of Groebner bases and applications -to formal Verification, Preprint at http://arxiv.org/abs/0801.1177 +*New developments in the theory of Groebner bases and applications* +to formal Verification, Preprint at :arxiv:`0801.1177` M. Brickenstein, A. Dreyer, PolyBoRi: -A Groebner Basis Framework for Boolean Polynomials, +*A Groebner Basis Framework for Boolean Polynomials*, Reports of Fraunhofer ITWM, No. 122, Kaiserslautern, Germany, 2007. http://www.itwm.fraunhofer.de/zentral/download/berichte/bericht122.pdf M. Brickenstein, A. Dreyer, PolyBoRi: -A framework for Groebner basis computations with Boolean polynomials, +*A framework for Groebner basis computations with Boolean polynomials*, Electronic Proceedings of the MEGA 2007 - Effective Methods in Algebraic Geometry, Strobl, Austria, June 2007. http://www.ricam.oeaw.ac.at/mega2007/electronic/electronic.html """ From 1e1972c367176b657dc811582b6d0f70ef3729df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 24 May 2022 20:41:45 +0200 Subject: [PATCH 182/338] detail --- src/sage/rings/polynomial/pbori/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/polynomial/pbori/__init__.py b/src/sage/rings/polynomial/pbori/__init__.py index 69919bcc916..8fe962e2275 100644 --- a/src/sage/rings/polynomial/pbori/__init__.py +++ b/src/sage/rings/polynomial/pbori/__init__.py @@ -14,9 +14,10 @@ The PolyBoRi Team, 2007-2011 REFERENCES: + M. Brickenstein, A. Dreyer, G. Greuel, M. Wedler, O. Wienand, -*New developments in the theory of Groebner bases and applications* -to formal Verification, Preprint at :arxiv:`0801.1177` +*New developments in the theory of Groebner bases and applications +to formal Verification*, Preprint at :arxiv:`0801.1177` M. Brickenstein, A. Dreyer, PolyBoRi: *A Groebner Basis Framework for Boolean Polynomials*, From ab156dd97eb921688d7f13082718086e1e409828 Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 00:15:13 -0600 Subject: [PATCH 183/338] Small fix to sage-bootstrap-python The sage-bootstrap-python script doesn't work with pyenv. For some reason the command "python" is treated differently from python, leading to issues. My fix was to try removing pyenv from the PATH before testing for python. --- build/bin/sage-bootstrap-python | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 38ceeca0f29..1bd52559acb 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -11,7 +11,15 @@ if [ -z "$SAGE_ORIG_PATH" ]; then # If not we're running from within sage-env just set the existing path SAGE_ORIG_PATH="$PATH" fi - +paths=$(echo $SAGE_ORIG_PATH | tr ":" "\n") +NEW_PATH="" +for path in $paths +do + if [[ $path != *"pyenv"* ]]; then + NEW_PATH+="$path:" + fi +done +SAGE_ORIG_PATH=${NEW_PATH::-1} # In particular, it is invoked by "bootstrap -d" for sage-download-file, # i.e., before a configure run, and by "sage-spkg", also for sage-download-file. # So it needs to find a python that has the urllib module. From 4421ac2f879bec4c6508cb85fe616fd92004410a Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 11:41:49 -0600 Subject: [PATCH 184/338] removed bash-only syntax --- build/bin/sage-bootstrap-python | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 1bd52559acb..513783b1c21 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -15,9 +15,10 @@ paths=$(echo $SAGE_ORIG_PATH | tr ":" "\n") NEW_PATH="" for path in $paths do - if [[ $path != *"pyenv"* ]]; then - NEW_PATH+="$path:" - fi + case "$path" in + *"pyenv"*);; + * ) NEW_PATH+="$path:";; + esac done SAGE_ORIG_PATH=${NEW_PATH::-1} # In particular, it is invoked by "bootstrap -d" for sage-download-file, From 50d92726ed8087fe252c1ef20e81f76e77dea4b2 Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 11:52:24 -0600 Subject: [PATCH 185/338] += gave strange not found errors --- build/bin/sage-bootstrap-python | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 513783b1c21..ab5e6e70ac4 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -17,7 +17,7 @@ for path in $paths do case "$path" in *"pyenv"*);; - * ) NEW_PATH+="$path:";; + * ) NEW_PATH="$NEW_PATH$path:";; esac done SAGE_ORIG_PATH=${NEW_PATH::-1} From cd208701e75de1ff3fc10b069e16f538b16d0488 Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 12:07:28 -0600 Subject: [PATCH 186/338] now works in dash shell The extra : at the end of PATH is irrelevant, the code to remove it had bash-only syntax. Additionally the script now checks if the tr command exists before using it. --- build/bin/sage-bootstrap-python | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index ab5e6e70ac4..7afad3ed7bf 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -11,16 +11,19 @@ if [ -z "$SAGE_ORIG_PATH" ]; then # If not we're running from within sage-env just set the existing path SAGE_ORIG_PATH="$PATH" fi -paths=$(echo $SAGE_ORIG_PATH | tr ":" "\n") -NEW_PATH="" -for path in $paths -do - case "$path" in - *"pyenv"*);; - * ) NEW_PATH="$NEW_PATH$path:";; - esac -done -SAGE_ORIG_PATH=${NEW_PATH::-1} +if command -v tr &> /dev/null +then + paths=$(echo $SAGE_ORIG_PATH | tr ":" "\n") + NEW_PATH="" + for path in $paths + do + case "$path" in + *"pyenv"*);; + * ) NEW_PATH="$NEW_PATH$path:";; + esac + done + SAGE_ORIG_PATH=$NEW_PATH +fi # In particular, it is invoked by "bootstrap -d" for sage-download-file, # i.e., before a configure run, and by "sage-spkg", also for sage-download-file. # So it needs to find a python that has the urllib module. From 15cd6fec54a83db8b59373c66873d8bcd4c3ae51 Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 12:27:37 -0600 Subject: [PATCH 187/338] loop is pure sh with IFS instead of using tr --- build/bin/sage-bootstrap-python | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 7afad3ed7bf..6c3e20010e0 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -11,19 +11,17 @@ if [ -z "$SAGE_ORIG_PATH" ]; then # If not we're running from within sage-env just set the existing path SAGE_ORIG_PATH="$PATH" fi -if command -v tr &> /dev/null -then - paths=$(echo $SAGE_ORIG_PATH | tr ":" "\n") - NEW_PATH="" - for path in $paths - do - case "$path" in - *"pyenv"*);; - * ) NEW_PATH="$NEW_PATH$path:";; - esac - done - SAGE_ORIG_PATH=$NEW_PATH -fi +IFS=':' +NEW_PATH="" +for path in $SAGE_ORIG_PATH +do + case "$path" in + *"pyenv"*);; + * ) NEW_PATH="$NEW_PATH$path:";; + esac +done +IFS=' ' +SAGE_ORIG_PATH=$NEW_PATH # In particular, it is invoked by "bootstrap -d" for sage-download-file, # i.e., before a configure run, and by "sage-spkg", also for sage-download-file. # So it needs to find a python that has the urllib module. From b8ad9f044dc8fec23a6821cbdf892ec51254b321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 25 May 2022 20:36:51 +0200 Subject: [PATCH 188/338] remove deprecation in nonexact.py --- src/sage/structure/nonexact.py | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/sage/structure/nonexact.py b/src/sage/structure/nonexact.py index 913f42c9b19..4157295be90 100644 --- a/src/sage/structure/nonexact.py +++ b/src/sage/structure/nonexact.py @@ -1,8 +1,8 @@ r""" Precision management for non-exact objects -Manage the default precision for non-exact objects such as power series rings or -laurent series rings. +Manage the default precision for non-exact objects such as power series rings +or Laurent series rings. EXAMPLES:: @@ -25,12 +25,11 @@ .. NOTE:: Subclasses of :class:`Nonexact` which require to change the default - precision should implement a method `set_default_prec`. - + precision should implement a method ``set_default_prec``. """ - from sage.rings.integer import Integer + class Nonexact: r""" A non-exact object with default precision. @@ -39,7 +38,6 @@ class Nonexact: - ``prec`` -- a non-negative integer representing the default precision of ``self`` (default: ``20``) - """ def __init__(self, prec=20): if prec < 0: @@ -61,30 +59,9 @@ def default_prec(self): sage: R. = PowerSeriesRing(QQ, default_prec=10) sage: R.default_prec() 10 - """ try: return self._default_prec except AttributeError: self._default_prec = 20 return self._default_prec - - def set_default_prec(self, prec): - r""" - Set the default precision for ``self`` - - .. WARNING:: - - This method is outdated. If a subclass of class:`Nonexact` requires - this method, please overload it instead. - - """ - # TODO: remove in Sage 9.4 - from sage.misc.superseded import deprecation - msg = "The method set_default_prec() is deprecated and will be removed " - msg += "in a future version of Sage. The default precision is set " - msg += "during construction." - deprecation(18416, msg) - self._default_prec = Integer(prec) - - From c7a6dfa795c6b8e68cf4fcc5449bcf964ddc34a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 25 May 2022 21:22:10 +0200 Subject: [PATCH 189/338] some pep cleanup in dynamics --- .../arithmetic_dynamics/berkovich_ds.py | 4 +- .../endPN_automorphism_group.py | 20 +++---- .../endPN_minimal_model.py | 9 ++- .../product_projective_ds.py | 8 +-- .../arithmetic_dynamics/projective_ds.py | 7 +-- .../dynamics/arithmetic_dynamics/wehlerK3.py | 58 ++++++++++--------- src/sage/dynamics/cellular_automata/all.py | 1 - .../dynamics/cellular_automata/elementary.py | 1 + src/sage/dynamics/cellular_automata/glca.py | 1 - .../dynamics/complex_dynamics/mandel_julia.py | 5 +- src/sage/dynamics/finite_dynamical_system.py | 3 +- .../finite_dynamical_system_catalog.py | 15 +++-- 12 files changed, 70 insertions(+), 62 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index ce540d77f73..0301d68b8c9 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -858,8 +858,8 @@ def __call__(self, x, type_3_pole_check=True): num = fraction[0].quo_rem(gcd)[0] dem = fraction[1].quo_rem(gcd)[0] if dem.is_zero(): - f = DynamicalSystem_affine(F[0]/F[1]).homogenize(1) - f = f.conjugate(Matrix([[0, 1], [1 , 0]])) + f = DynamicalSystem_affine(F[0] / F[1]).homogenize(1) + f = f.conjugate(Matrix([[0, 1], [1, 0]])) g = DynamicalSystem_Berkovich(f) return g(self.domain()(QQ(0), QQ(1))).involution_map() # if the reduction is not constant, the image is the Gauss point diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py index 93948cf6014..2b6edd2d2c8 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py @@ -197,8 +197,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, [(alpha - zeta*beta), - (alpha*beta)*(1 - zeta), (1 - zeta), (alpha*zeta - beta)])) - - #now consider 2-periodic points + # now consider 2-periodic points psi = phi(phi(z)) f2 = psi.numerator() g2 = psi.denominator() @@ -252,7 +251,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, a = F(a) d = F(d) b = F(-alpha*beta) - s = ( a*z + b)/(z + d) + s = (a * z + b) / (z + d) if s(phi(z)) == phi(s(z)): if return_functions: elements.append(K(s)) @@ -268,7 +267,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, a = F(a) d = F(d) b = F(-alpha*beta) - s = ( a*z + b)/(z + d) + s = (a * z + b) / (z + d) if s(phi(z)) == phi(s(z)): if return_functions: elements.append(K(s)) @@ -534,7 +533,7 @@ def valid_automorphisms(automorphisms_CRT, rational_function, ht_bound, M, for x in init_lift] g = gcd(new_lift) new_lift = [x // g for x in new_lift] - if all(abs(x) <= ht_bound for x in new_lift): + if all(abs(x) <= ht_bound for x in new_lift): a, b, c, d = new_lift f = (a*z + b) / (c*z + d) if rational_function(f(z)) == f(rational_function(z)): @@ -1004,9 +1003,10 @@ def rational_function_coefficient_descent(rational_function, sigma, poly_ring): return z = poly_ring.gen(0) - numer = sum( poly_ring(ff[i])*z**fe[i] for i in range(len(ff)) ) - denom = sum( poly_ring(gg[i])*z**ge[i] for i in range(len(gg)) ) - return numer / denom + numer = sum(poly_ring(ff[i]) * z**fe[i] for i in range(len(ff))) + denom = sum(poly_ring(gg[i]) * z**ge[i] for i in range(len(gg))) + return numer / denom + def rational_function_coerce(rational_function, sigma, S_polys): r""" @@ -1626,7 +1626,7 @@ def automorphism_group_FF_alg3(rational_function): if n%p == 1: automorphisms = automorphisms + order_p_automorphisms(phi, pre_images) - ## nontrivial elements with order prime to p ## + # nontrivial elements with order prime to p # # case of 2 F-rational fixed points for pt_pair in combinations(linear_fix_pts, 2): x = pt_pair[0] @@ -1756,7 +1756,7 @@ def which_group(list_of_elements): for i in range(n-1): h = g(H[-1]) H.append(h) - H = list(set(H)) + H = list(set(H)) if len(H) == n: return 'Cyclic of order {0}'.format(n) if len(H) > max_reg_cyclic[0] and gcd(len(H), p) != p: diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py b/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py index 06890a8eb02..9c6d5a2dd52 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py @@ -548,7 +548,7 @@ def BM_all_minimal(vp, return_transformation=False, D=None): z = aff_map.domain().gen(0) Res = mp.resultant() - ##### because of how the bound is compute in lemma 3.3 + # because of how the bound is compute in lemma 3.3 from sage.dynamics.arithmetic_dynamics.affine_ds import DynamicalSystem_affine h = f - z*g A = AffineSpace(BR, 1, h.parent().variable_name()) @@ -1121,14 +1121,14 @@ def coshdelta(z): G, g, v, rep, M, D, label = pts.pop() # apply ST and keep z, Sz if D > R: - break #all remaining pts are too far away + break # all remaining pts are too far away # check if it is smaller. If so, we can improve the bound count += 1 new_size = e**g.global_height(prec=prec) if new_size < current_size: - current_min = [G ,g, v, rep, M, coshdelta(v)] + current_min = [G, g, v, rep, M, coshdelta(v)] current_size = new_size - if new_size == 1: # early exit + if new_size == 1: # early exit return [current_min[1], current_min[4]] new_R = get_bound_dynamical(G, g, m=n, dynatomic=dynatomic, prec=prec, emb=emb) if new_R < R: @@ -1156,4 +1156,3 @@ def coshdelta(z): pts = insert_item(pts, new_pt, 5) return [current_min[1], current_min[4]] - diff --git a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py index 825fdf9187a..cc9cbf8dd47 100644 --- a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py @@ -278,18 +278,18 @@ def nth_iterate_map(self, n): PHI = list(Coord_ring.gens()) while D: - if D&1: + if D & 1: PHI = [poly(*F) for poly in PHI] - if D > 1: #avoid extra iterate - F = [poly(*F) for poly in F] #'square' + if D > 1: # avoid extra iterate + F = [poly(*F) for poly in F] # 'square' D >>= 1 return DynamicalSystem_projective(PHI, domain=self.domain()) class DynamicalSystem_product_projective_field(DynamicalSystem_product_projective): - pass + class DynamicalSystem_product_projective_finite_field(DynamicalSystem_product_projective_field): def cyclegraph(self): diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index c78a7e83472..5c5c373907f 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -973,7 +973,7 @@ def nth_iterate_map(self, n, normalize=False): else: PHI = H([Coord_ring.gen(i) for i in range(N)]) while D: - if D&1: + if D & 1: PHI = PHI*F if normalize: PHI.normalize_coordinates() @@ -2029,7 +2029,7 @@ def canonical_height(self, P, **kwds): # this looks different than Wells' Algorithm because of the difference # between what Wells' calls H_infty, # and what Green's Function returns for the infinite place - h = f.green_function(Q, 0 , **kwds) - H + R(t).log() + h = f.green_function(Q, 0, **kwds) - H + R(t).log() # The value returned by Well's algorithm may be negative. As the canonical height # is always nonnegative, so if this value is within -err of 0, return 0. if h < 0: @@ -3359,7 +3359,7 @@ def automorphism_group(self, **kwds): num_cpus = kwds.get('num_cpus', 2) if self.domain().dimension_relative() != 1: return self.conjugating_set(self, num_cpus) - if self.base_ring() != QQ and self.base_ring() != ZZ: + if self.base_ring() != QQ and self.base_ring() != ZZ: return self.conjugating_set(self, num_cpus) self.normalize_coordinates() if (self.degree() == 1) or (self.degree() == 0): @@ -3748,7 +3748,6 @@ def is_dynamical_belyi_map(self): return False return True - def critical_point_portrait(self, check=True, use_algebraic_closure=True): r""" If this dynamical system is post-critically finite, return its diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index 7e4ae461348..8f5f1f6a690 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -747,15 +747,12 @@ def is_degenerate(self): self.Hpoly(0, 0, 2), self.Hpoly(0, 1, 2)) phi = R.hom([0, 0, 0] + vars, R0) I = phi(I) - if I.dimension() != 0: - return True - return False - + return I.dimension() != 0 def degenerate_fibers(self): r""" - Function will return the (rational) degenerate fibers of the surface - defined over the base ring, or the fraction field of the base ring if it is not a field. + Return the (rational) degenerate fibers of the surface defined over + the base ring, or the fraction field of the base ring if it is not a field. ALGORITHM: @@ -828,7 +825,7 @@ def degenerate_fibers(self): J = phi1(I) if (J.dimension() == 0): Var = J.variety() - if Var != [{}]: + if Var != [{}]: for d in Var: #iterate through dictionaries P = [] #new point for z in mapvars: #assign coordinate values @@ -859,7 +856,7 @@ def degenerate_fibers(self): J = phi1(I) if (J.dimension() == 0): Var = J.variety() - if Var != [{}]: + if Var != [{}]: for d in Var: #iterate through dictionaries P = [] #new point for z in mapvars: #assign coordinate values @@ -1170,7 +1167,7 @@ def sigmaX(self, P, **kwds): e += 1 maxexp.append(e) - e = min(maxexp) + e = min(maxexp) #Fix L and Q for i in range(0,2): @@ -1423,10 +1420,10 @@ def sigmaY(self,P, **kwds): T[i] = T[i]/t**e T[i] = T[i].subs({w1:t1}) - #Defines the ideal whose solution gives `(s0,s1)` and the two points - #on the fiber - RR = PolynomialRing(BR ,5, 's0, s1, z0, z1, z2', order = 'lex') - s0,s1,z0,z1,z2 = RR.gens() + # Defines the ideal whose solution gives `(s0,s1)` and the two points + # on the fiber + RR = PolynomialRing(BR, 5, 's0, s1, z0, z1, z2', order='lex') + s0, s1, z0, z1, z2 = RR.gens() I = RR.ideal([RR(T[0]), \ RR(T[1]), \ RR(T[2]) - P[0][0]*z0, \ @@ -1448,11 +1445,11 @@ def sigmaY(self,P, **kwds): #the corresponding point on the surface if len(V) > 2: raise ValueError("cannot distinguish points in the degenerate fiber") - #We always expect to have the trivial solution (0, 0, 0) - if len(V) == 2: + # We always expect to have the trivial solution (0, 0, 0) + if len(V) == 2: for D in V: if D[s] != 0: - [a, b, c] = [D[z0], D[z1], D[z2]] + a, b, c = [D[z0], D[z1], D[z2]] else: newT = [phi(tee) for tee in T] for i in range(2): @@ -1478,10 +1475,10 @@ def sigmaY(self,P, **kwds): SS(newT[5]) - (P[0][0]*z1 + P[0][1]*z0), \ SS(newT[6]) - (P[0][0]*z2 + P[0][2]*z0), \ SS(newT[7]) - (P[0][1]*z2 + P[0][2]*z1)]) - #Find the points - SSS = PolynomialRing(BR, 3, 'z0, z1, z2',order = 'lex') - z0,z1,z2 = SSS.gens() - phi = SS.hom([0, z0, z1 ,z2], SSS) + # Find the points + SSS = PolynomialRing(BR, 3, 'z0, z1, z2', order='lex') + z0, z1, z2 = SSS.gens() + phi = SS.hom([0, z0, z1, z2], SSS) J2 = phi(II) if J2.dimension() > 0: raise ValueError("cannot distinguish points in the degenerate fiber") @@ -2101,21 +2098,27 @@ def fiber(self, p, component): elif self.Hpoly(component, 0, 1)(P0) != 0: if component == 1: Points.append(P+[Zero, One, Zero]) - Points.append(P+[-self.Hpoly(component, 0, 1)(P0),Zero,-self.Hpoly(component, 1, 2)(P0)]) + Points.append(P+[-self.Hpoly(component, 0, 1)(P0),Zero, + -self.Hpoly(component, 1, 2)(P0)]) Points.append(P+[One,Zero,Zero]) - Points.append(P+[Zero,-self.Hpoly(component, 0, 1)(P0),-self.Hpoly(component, 0, 2)(P0)]) + Points.append(P+[Zero,-self.Hpoly(component, 0, 1)(P0), + -self.Hpoly(component, 0, 2)(P0)]) else: Points.append([Zero,One,Zero]+P) - Points.append([-self.Hpoly(component, 0, 1)(P0),Zero,-self.Hpoly(component, 1, 2)(P0)] + P) + Points.append([-self.Hpoly(component, 0, 1)(P0),Zero, + -self.Hpoly(component, 1, 2)(P0)] + P) Points.append([One,Zero,Zero]+P) - Points.append([Zero,-self.Hpoly(component, 0, 1)(P0),-self.Hpoly(component, 0, 2)(P0)] + P) + Points.append([Zero,-self.Hpoly(component, 0, 1)(P0), + -self.Hpoly(component, 0, 2)(P0)] + P) elif self.Hpoly(component, 0, 2)(P0) != 0: if component == 1: Points.append(P+[Zero, Zero, One]) - Points.append(P+[-self.Hpoly(component, 0, 2)(P0),-self.Hpoly(component, 1, 2)(P0), Zero]) + Points.append(P+[-self.Hpoly(component, 0, 2)(P0), + -self.Hpoly(component, 1, 2)(P0), Zero]) else: Points.append([Zero, Zero, One]+P) - Points.append([-self.Hpoly(component, 0, 2)(P0),-self.Hpoly(component, 1, 2)(P0), Zero]+ P) + Points.append([-self.Hpoly(component, 0, 2)(P0), + -self.Hpoly(component, 1, 2)(P0), Zero] + P) elif self.Hpoly(component, 1, 2)(P0) != 0: if component == 1: Points.append(P + [Zero, Zero, One]) @@ -2487,12 +2490,13 @@ def cardinality( self): """ def getPx1(): return ([x, y, 1] for x in self.base_ring() for y in self.base_ring()) + def getPx2(): return ([x, 1, 0] for x in self.base_ring()) Count = 0 Xpoint = [1, 0, 0] Ypoint = [1, 0, 0] - #Create all possible Px1 Values + # Create all possible Px1 Values for i in getPx1(): for j in getPx1(): A = i + j diff --git a/src/sage/dynamics/cellular_automata/all.py b/src/sage/dynamics/cellular_automata/all.py index 792411f5b75..9f13ad1c13a 100644 --- a/src/sage/dynamics/cellular_automata/all.py +++ b/src/sage/dynamics/cellular_automata/all.py @@ -3,4 +3,3 @@ from sage.misc.lazy_import import lazy_import lazy_import("sage.dynamics.cellular_automata.solitons", ["SolitonCellularAutomata", "PeriodicSolitonCellularAutomata"]) - diff --git a/src/sage/dynamics/cellular_automata/elementary.py b/src/sage/dynamics/cellular_automata/elementary.py index c51b7d3377e..edd6d77aaa9 100644 --- a/src/sage/dynamics/cellular_automata/elementary.py +++ b/src/sage/dynamics/cellular_automata/elementary.py @@ -394,6 +394,7 @@ def evolve(self, number=None): prev_state = self._states[-1] next_state = [None] * self._width + def to_int(triple): return ZZ(list(reversed(triple)), base=2) if self._bdry is None: diff --git a/src/sage/dynamics/cellular_automata/glca.py b/src/sage/dynamics/cellular_automata/glca.py index af47f66d360..aa94be0cb5c 100644 --- a/src/sage/dynamics/cellular_automata/glca.py +++ b/src/sage/dynamics/cellular_automata/glca.py @@ -475,4 +475,3 @@ def _latex_(self): x -= 1 ret += "\\end{tikzpicture}" return ret - diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia.py b/src/sage/dynamics/complex_dynamics/mandel_julia.py index 0dcee498874..32a15ba19c5 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia.py +++ b/src/sage/dynamics/complex_dynamics/mandel_julia.py @@ -757,13 +757,12 @@ def julia_plot(f=None, **kwds): return interact(**widgets).widget(julia_helper) else: return interact(**widgets).widget(fast_julia_plot) - elif mandelbrot: # non-interactive with mandelbrot + elif mandelbrot: # non-interactive with mandelbrot return julia_helper(c_real, c_imag, x_center, y_center, image_width, max_iteration, pixel_count, level_sep, number_of_colors, base_color, point_color) - else: # non-interactive without mandelbrot + else: # non-interactive without mandelbrot return fast_julia_plot(c_real, c_imag, x_center, y_center, image_width, max_iteration, pixel_count, level_sep, number_of_colors, base_color) - diff --git a/src/sage/dynamics/finite_dynamical_system.py b/src/sage/dynamics/finite_dynamical_system.py index b7710f0e8ae..e5fbf568b7e 100644 --- a/src/sage/dynamics/finite_dynamical_system.py +++ b/src/sage/dynamics/finite_dynamical_system.py @@ -459,6 +459,7 @@ def evolution_power(self, n): if n not in NN: raise ValueError("the n-th power of evolution is only defined for nonnegative integers n") ev = self.evolution() + def evn(x): y = x for _ in range(n): @@ -820,6 +821,7 @@ def evolution_power(self, n): else: ev = self.inverse_evolution() n = -n + def evn(x): y = x for _ in range(n): @@ -1249,4 +1251,3 @@ def orbit_lengths(self): [2, 2, 2] """ return [len(orb) for orb in self.orbits()] - diff --git a/src/sage/dynamics/finite_dynamical_system_catalog.py b/src/sage/dynamics/finite_dynamical_system_catalog.py index fc925c2d5cf..3ba09eb9948 100755 --- a/src/sage/dynamics/finite_dynamical_system_catalog.py +++ b/src/sage/dynamics/finite_dynamical_system_catalog.py @@ -83,12 +83,14 @@ def one_line(xs): [2] """ n = len(xs) - X = range(1, n+1) + X = range(1, n + 1) xs2 = tuple(xs) + def pi(i): return xs2[i - 1] return FiniteDynamicalSystem(X, pi, create_tuple=True) + def bitstring_rotation(n, ones=None): r""" Return the invertible finite discrete dynamical system @@ -231,12 +233,14 @@ def striker_sweep(E, predicate, elements, lazy=False): from sage.combinat.subset import Subsets from sage.sets.set import Set X = [F for F in Subsets(E) if predicate(F)] + def phi(F): for e in elements: G = F.symmetric_difference(Set([e])) if predicate(G): F = G return F + def psi(F): for e in reversed(elements): G = F.symmetric_difference(Set([e])) @@ -245,6 +249,7 @@ def psi(F): return F return InvertibleFiniteDynamicalSystem(X, phi, inverse=psi) + def syt_promotion(lam): r""" Return the invertible finite discrete dynamical system @@ -266,10 +271,12 @@ def syt_promotion(lam): True """ from sage.combinat.partition import Partition - lam = Partition(lam) from sage.combinat.tableau import StandardTableaux + lam = Partition(lam) X = StandardTableaux(lam) - return InvertibleFiniteDynamicalSystem(X, lambda T : T.promotion(), inverse=lambda T : T.promotion_inverse()) + return InvertibleFiniteDynamicalSystem(X, lambda T: T.promotion(), + inverse=lambda T: T.promotion_inverse()) + def order_ideal_rowmotion(P): r""" @@ -361,9 +368,9 @@ def bulgarian_solitaire(n): """ from sage.combinat.partition import Partition, Partitions X = Partitions(n) + def phi(lam): mu = [p - 1 for p in lam if p > 0] nu = sorted(mu + [len(lam)], reverse=True) return Partition(nu) return FiniteDynamicalSystem(X, phi) - From ba6d42ebe8567ad038e058ca647606194e7d923d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 25 May 2022 21:34:46 +0200 Subject: [PATCH 190/338] pep and other details in dynamics --- .../dynamics/arithmetic_dynamics/affine_ds.py | 8 +++--- .../endPN_automorphism_group.py | 2 +- .../arithmetic_dynamics/generic_ds.py | 2 +- .../product_projective_ds.py | 2 +- .../arithmetic_dynamics/projective_ds.py | 26 +++++++++---------- .../dynamics/cellular_automata/elementary.py | 4 +-- src/sage/dynamics/cellular_automata/glca.py | 4 +-- .../dynamics/cellular_automata/solitons.py | 4 +-- .../dynamics/complex_dynamics/mandel_julia.py | 10 +++---- .../complex_dynamics/mandel_julia_helper.pyx | 2 +- 10 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py index a4f03f439bf..9db7b91f8db 100644 --- a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py @@ -276,7 +276,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None): polys = [PR(poly) for poly in polys] if domain is None: if isinstance(PR, sage.rings.abc.SymbolicRing): - raise TypeError("Symbolic Ring cannot be the base ring") + raise TypeError("symbolic ring cannot be the base ring") if fraction_field: PR = PR.ring() domain = AffineSpace(PR) @@ -290,17 +290,17 @@ def __classcall_private__(cls, morphism_or_polys, domain=None): except TypeError: raise TypeError('coefficients of polynomial not in {}'.format(domain.base_ring())) if len(polys) != domain.ambient_space().coordinate_ring().ngens(): - raise ValueError('Number of polys does not match dimension of {}'.format(domain)) + raise ValueError(f'number of polys does not match dimension of {domain}') R = domain.base_ring() if isinstance(R, sage.rings.abc.SymbolicRing): - raise TypeError("Symbolic Ring cannot be the base ring") + raise TypeError("symbolic ring cannot be the base ring") if not is_AffineSpace(domain) and not isinstance(domain, AlgebraicScheme_subscheme_affine): raise ValueError('"domain" must be an affine scheme') if R not in Fields(): return typecall(cls, polys, domain) if is_FiniteField(R): - return DynamicalSystem_affine_finite_field(polys, domain) + return DynamicalSystem_affine_finite_field(polys, domain) return DynamicalSystem_affine_field(polys, domain) def __init__(self, polys_or_rat_fncts, domain): diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py index 2b6edd2d2c8..91af87e49dd 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py @@ -2017,7 +2017,7 @@ def conjugating_set_initializer(f, g): # in which all subsets of size n+1 are linearly independent, # then we fail as we cannot specify conjugations if more: - raise ValueError('no more rational preimages. try extending the base field and trying again.') + raise ValueError('no more rational preimages; try extending the base field and trying again') # if we need to add more preimages, we update loop dictionaries if more: diff --git a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py index b3b66856b5c..3e227942256 100644 --- a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py @@ -401,7 +401,7 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals space = ds.domain().ambient_space() K = ds.base_ring() if space.dimension() != 1: - raise ValueError('Ambient space of dynamical system must be either the affine line or projective line') + raise ValueError('ambient space of dynamical system must be either the affine line or projective line') if isinstance(K, (AlgebraicClosureFiniteField_generic, AlgebraicField_common)): if return_embedding: return (K, K.hom(K)) diff --git a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py index cc9cbf8dd47..867d571db0d 100644 --- a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py @@ -331,6 +331,6 @@ def cyclegraph(self): Q = self(P) E.append([str(Q)]) else: - raise NotImplementedError("Cyclegraph for product projective spaces not implemented for subschemes") + raise NotImplementedError("cyclegraph for product projective spaces not implemented for subschemes") from sage.graphs.digraph import DiGraph return DiGraph(dict(zip(V, E)), loops=True) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 5c5c373907f..dc8344b672d 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -419,7 +419,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None, names=None): except TypeError: raise TypeError('coefficients of polynomial not in {}'.format(domain.base_ring())) if len(polys) != domain.ambient_space().coordinate_ring().ngens(): - raise ValueError('Number of polys does not match dimension of {}'.format(domain)) + raise ValueError(f'number of polys does not match dimension of {domain}') R = domain.base_ring() if isinstance(R, sage.rings.abc.SymbolicRing): raise TypeError("the base ring cannot be the Symbolic Ring or a symbolic subring") @@ -3150,10 +3150,10 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): """ n = ZZ(n) if n < 1: - raise ValueError('Period must be positive') + raise ValueError('period must be positive') m = ZZ(m) if m < 0: - raise ValueError('Preperiod must be non-negative') + raise ValueError('preperiod must be non-negative') f = self CR = f.coordinate_ring() dom = f.domain() @@ -3363,7 +3363,7 @@ def automorphism_group(self, **kwds): return self.conjugating_set(self, num_cpus) self.normalize_coordinates() if (self.degree() == 1) or (self.degree() == 0): - raise NotImplementedError("Rational function of degree 1 not implemented.") + raise NotImplementedError("rational function of degree 1 not implemented") f = self.dehomogenize(1) R = PolynomialRing(f.base_ring(),'x') if is_FractionFieldElement(f[0]): @@ -4186,8 +4186,8 @@ def preperiodic_points(self, m, n, **kwds): f_sub = self.change_ring(R) R = f_sub.base_ring() #in the case when R is an embedding if isinstance(R, FractionField_1poly_field) or is_FunctionField(R): - raise NotImplementedError('Periodic points not implemented for function fields.' - + 'Clear denominators and use the polynomial ring instead.') + raise NotImplementedError('Periodic points not implemented for function fields; ' + 'clear denominators and use the polynomial ring instead') CR = f_sub.coordinate_ring() dom = f_sub.domain() PS = f_sub.codomain().ambient_space() @@ -4517,12 +4517,12 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari f_sub = self.change_ring(R) R = f_sub.base_ring() #in the case when R is an embedding if isinstance(R, FractionField_1poly_field) or is_FunctionField(R): - raise NotImplementedError('Periodic points not implemented for fraction function fields.' - + 'Clear denominators and use the polynomial ring instead.') + raise NotImplementedError('periodic points not implemented for fraction function fields; ' + 'clear denominators and use the polynomial ring instead') if is_FractionField(R): if is_MPolynomialRing(R.ring()): - raise NotImplementedError('Periodic points not implemented for fraction function fields.' - + 'Clear denominators and use the polynomial ring instead.') + raise NotImplementedError('periodic points not implemented for fraction function fields; ' + 'clear denominators and use the polynomial ring instead') CR = f_sub.coordinate_ring() dom = f_sub.domain() PS = f_sub.codomain().ambient_space() @@ -5309,8 +5309,8 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', else: expected_degree = sum(d**(n*i) for i in range(N+1)) if degree_w != expected_degree: - raise ValueError('sigma polynomial dropped degree, as multiplicities were not accounted for correctly.'+ - ' try setting chow=True and/or deform=True') + raise ValueError('sigma polynomial dropped degree, as multiplicities were not accounted for correctly; ' + 'try setting chow=True and/or deform=True') if return_polynomial: return sigma_polynomial # if we are returing a numerical list, read off the coefficients @@ -8327,7 +8327,7 @@ def automorphism_group(self, **kwds): z = f[0].parent().gen() self.normalize_coordinates() if (self.degree() == 1) or (self.degree() == 0): - raise NotImplementedError("Rational function of degree 1 not implemented.") + raise NotImplementedError("rational function of degree 1 not implemented") if f[0].denominator() != 1: F = f[0].numerator().polynomial(z) / f[0].denominator().polynomial(z) else: diff --git a/src/sage/dynamics/cellular_automata/elementary.py b/src/sage/dynamics/cellular_automata/elementary.py index edd6d77aaa9..cd0915cdde7 100644 --- a/src/sage/dynamics/cellular_automata/elementary.py +++ b/src/sage/dynamics/cellular_automata/elementary.py @@ -388,7 +388,7 @@ def evolve(self, number=None): X X XX """ if number is not None: - for k in range(number): + for _ in range(number): self.evolve() return @@ -583,7 +583,7 @@ def _unicode_art_(self): █ █ █ █ █ █ █ █ ███ ███ ███ ███ ███ ███ ███ ██ """ - return UnicodeArt([u''.join(u'█' if x else u' ' for x in state) + return UnicodeArt([''.join('█' if x else ' ' for x in state) for state in self._states]) def plot(self, number=None): diff --git a/src/sage/dynamics/cellular_automata/glca.py b/src/sage/dynamics/cellular_automata/glca.py index aa94be0cb5c..46b24619ac2 100644 --- a/src/sage/dynamics/cellular_automata/glca.py +++ b/src/sage/dynamics/cellular_automata/glca.py @@ -196,14 +196,14 @@ def evolve(self, number=None): o o o o o o o """ if number is not None: - for k in range(number): + for _ in range(number): self.evolve() return prev_state = self._states[-1] next_state = [0] * (len(prev_state) + 2) - for i,val in enumerate(prev_state): + for i, val in enumerate(prev_state): next_state[i] += self._rule[val] & 0x1 next_state[i+1] += self._rule[val] & 0x2 next_state[i+2] += self._rule[val] & 0x4 diff --git a/src/sage/dynamics/cellular_automata/solitons.py b/src/sage/dynamics/cellular_automata/solitons.py index 5113084f8d6..7ae254ed69f 100644 --- a/src/sage/dynamics/cellular_automata/solitons.py +++ b/src/sage/dynamics/cellular_automata/solitons.py @@ -515,7 +515,7 @@ def evolve(self, carrier_capacity=None, carrier_index=None, number=None): carrier_index = self._vacuum if number is not None: - for k in range(number): + for _ in range(number): self.evolve(carrier_capacity, carrier_index) return @@ -1398,7 +1398,7 @@ def evolve(self, carrier_capacity=None, carrier_index=None, number=None): carrier_index = self._vacuum if number is not None: - for k in range(number): + for _ in range(number): self.evolve(carrier_capacity, carrier_index) return if carrier_capacity is None: diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia.py b/src/sage/dynamics/complex_dynamics/mandel_julia.py index 32a15ba19c5..d1ce772fcbc 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia.py +++ b/src/sage/dynamics/complex_dynamics/mandel_julia.py @@ -275,7 +275,7 @@ def mandelbrot_plot(f=None, **kwds): base_color) else: if interacts: - raise NotImplementedError("Interact only implemented for z^2 + c") + raise NotImplementedError("interact only implemented for z^2 + c") else: # Set default of max_iteration to 50 for general polynomial maps # This prevents the function from being very slow by default @@ -694,11 +694,9 @@ def julia_plot(f=None, **kwds): R = f.parent() if not (R.is_integral_domain() and (CC.is_subring(R) or CDF.is_subring(R))): - raise ValueError('Given `f` must be a complex polynomial.') - else: - raise NotImplementedError( - 'Julia sets not implemented for rational functions.' - ) + raise ValueError('given `f` must be a complex polynomial') + raise NotImplementedError( + 'Julia sets not implemented for rational functions') if (f_poly - z*z) in CC: # f is specified and of the form z^2 + c. f_is_default_after_all = True diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx index 882cc6ada08..1189b55fec9 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +++ b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx @@ -746,7 +746,7 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, # Split function into real and imaginary parts R = PolynomialRing(CC, [variable,parameter]) if len(R.gens()) > 2: - raise NotImplementedError("Base ring must have only 2 variables") + raise NotImplementedError("base ring must have only 2 variables") z, c = R.gens() f = R(str(f)) S = PolynomialRing(f.base_ring(), 'x,y,J,cr,ci') From 5447ee5ef8b7b2dd3702bf93d71e79e57dbf89a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 25 May 2022 21:53:46 +0200 Subject: [PATCH 191/338] fix doctests --- src/sage/dynamics/arithmetic_dynamics/affine_ds.py | 4 ++-- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 8 ++++---- src/sage/dynamics/complex_dynamics/mandel_julia.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py index 9db7b91f8db..421f04be9a7 100644 --- a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py @@ -193,7 +193,7 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space, sage: DynamicalSystem_affine(x^2+1) Traceback (most recent call last): ... - TypeError: Symbolic Ring cannot be the base ring + TypeError: symbolic ring cannot be the base ring """ @staticmethod @@ -230,7 +230,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None): sage: f = DynamicalSystem_affine([x+y+z, y*z]) Traceback (most recent call last): ... - ValueError: Number of polys does not match dimension of Affine Space of dimension 3 over Rational Field + ValueError: number of polys does not match dimension of Affine Space of dimension 3 over Rational Field :: diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index dc8344b672d..07575dc2754 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -334,7 +334,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None, names=None): sage: DynamicalSystem_projective([y, x, y], domain=P1) Traceback (most recent call last): ... - ValueError: Number of polys does not match dimension of Projective Space of dimension 1 over Rational Field + ValueError: number of polys does not match dimension of Projective Space of dimension 1 over Rational Field :: @@ -5164,7 +5164,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', Traceback (most recent call last): .. ValueError: sigma polynomial dropped degree, as multiplicities were not accounted - for correctly. try setting chow=True and/or deform=True + for correctly; try setting chow=True and/or deform=True :: @@ -5174,7 +5174,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', Traceback (most recent call last): .. ValueError: sigma polynomial dropped degree, as multiplicities were not accounted - for correctly. try setting chow=True and/or deform=True + for correctly; try setting chow=True and/or deform=True """ n = ZZ(n) @@ -6931,7 +6931,7 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: D8.conjugating_set(D8) Traceback (most recent call last): ... - ValueError: no more rational preimages. try extending the base field and trying again. + ValueError: no more rational preimages; try extending the base field and trying again :: diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia.py b/src/sage/dynamics/complex_dynamics/mandel_julia.py index d1ce772fcbc..224a484c7bb 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia.py +++ b/src/sage/dynamics/complex_dynamics/mandel_julia.py @@ -185,7 +185,7 @@ def mandelbrot_plot(f=None, **kwds): sage: mandelbrot_plot(f, interact=True) Traceback (most recent call last): ... - NotImplementedError: Interact only implemented for z^2 + c + NotImplementedError: interact only implemented for z^2 + c """ parameter = kwds.pop("parameter", None) x_center = kwds.pop("x_center", 0.0) From c7e8063960107be1133b9a718203b8c5fe054159 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Thu, 26 May 2022 00:28:26 +0100 Subject: [PATCH 192/338] remove buggy 'tedder' modular decomposition --- src/sage/graphs/graph.py | 89 +- .../modular_decomposition.py | 2141 +---------------- 2 files changed, 97 insertions(+), 2133 deletions(-) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 4c3b54fd64d..089240f15e8 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -7574,7 +7574,7 @@ def cores(self, k=None, with_labels=False): return list(core.values()) @doc_index("Leftovers") - def modular_decomposition(self, algorithm='habib', style='tuple'): + def modular_decomposition(self, style='tuple'): r""" Return the modular decomposition of the current graph. @@ -7583,18 +7583,10 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): module or to none of them. Every graph that has a nontrivial module can be partitioned into modules, and the increasingly fine partitions into modules form a tree. The ``modular_decomposition`` function returns - that tree. + that tree, using an `O(n^3)` algorithm of [HM1979]_. INPUT: - - ``algorithm`` -- string (default: ``'habib'``); specifies the - algorithm to use among: - - - ``'tedder'`` -- linear time algorithm of [TCHP2008]_ - - - ``'habib'`` -- `O(n^3)` algorithm of [HM1979]_. This algorithm is - much simpler and so possibly less prone to errors. - - ``style`` -- string (default: ``'tuple'``); specifies the output format: @@ -7674,14 +7666,9 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): sage: g = graphs.CompleteGraph(5) sage: g.add_edge(0,5) sage: g.add_edge(0,6) - sage: g.modular_decomposition(algorithm='habib') + sage: g.modular_decomposition() (SERIES, [(PARALLEL, [(SERIES, [1, 2, 3, 4]), 5, 6]), 0]) - We get an equivalent tree when we use the algorithm of [TCHP2008]_:: - - sage: g.modular_decomposition(algorithm='tedder') - (SERIES, [(PARALLEL, [(SERIES, [4, 3, 2, 1]), 5, 6]), 0]) - We can choose output to be a :class:`~sage.combinat.rooted_tree.LabelledRootedTree`:: @@ -7698,10 +7685,7 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): ALGORITHM: - When ``algorithm='tedder'`` this function uses python implementation of - algorithm published by Marc Tedder, Derek Corneil, Michel Habib and - Christophe Paul [TCHP2008]_. When ``algorithm='habib'`` this function - uses the algorithm of M. Habib and M. Maurer [HM1979]_. + This function uses the algorithm of M. Habib and M. Maurer [HM1979]_. .. SEEALSO:: @@ -7709,28 +7693,25 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): - :class:`~sage.combinat.rooted_tree.LabelledRootedTree`. + .. NOTE:: + + A buggy implementation of linear time algorithm from [TCHP2008]_ was + removed in Sage 9.7. + TESTS: Empty graph:: - sage: graphs.EmptyGraph().modular_decomposition(algorithm='habib') - () - sage: graphs.EmptyGraph().modular_decomposition(algorithm='tedder') + sage: graphs.EmptyGraph().modular_decomposition() () - sage: graphs.EmptyGraph().modular_decomposition(algorithm='habib', style='tree') - None[] - sage: graphs.EmptyGraph().modular_decomposition(algorithm='tedder', style='tree') + sage: graphs.EmptyGraph().modular_decomposition(style='tree') None[] Singleton Vertex:: - sage: Graph(1).modular_decomposition(algorithm='habib') + sage: Graph(1).modular_decomposition() (PRIME, [0]) - sage: Graph(1).modular_decomposition(algorithm='tedder') - (PRIME, [0]) - sage: Graph(1).modular_decomposition(algorithm='habib', style='tree') - PRIME[0[]] - sage: Graph(1).modular_decomposition(algorithm='tedder', style='tree') + sage: Graph(1).modular_decomposition(style='tree') PRIME[0[]] Vertices may be arbitrary --- check that :trac:`24898` is fixed:: @@ -7741,22 +7722,25 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): sage: sorted(md[1]) [(1, 2), (2, 3)] - Unknown algorithm:: - - sage: graphs.PathGraph(2).modular_decomposition(algorithm='abc') - Traceback (most recent call last): - ... - ValueError: algorithm must be 'habib' or 'tedder' - Unknown style:: sage: graphs.PathGraph(2).modular_decomposition(style='xyz') Traceback (most recent call last): ... ValueError: style must be 'tuple' or 'tree' + + Check that :trac:`25872` is fixed:: + + sage: G1 = Graph('FwA]w') + sage: G2 = Graph('F@Nfg') + sage: G1.is_isomorphic(G2) + True + sage: G1.modular_decomposition() + (PRIME, [1, 2, 5, 6, 0, (PARALLEL, [3, 4])]) + sage: G2.modular_decomposition() + (PRIME, [5, 6, 3, 4, 2, (PARALLEL, [0, 1])]) """ - from sage.graphs.graph_decompositions.modular_decomposition import (modular_decomposition, - NodeType, + from sage.graphs.graph_decompositions.modular_decomposition import (NodeType, habib_maurer_algorithm, create_prime_node, create_normal_node) @@ -7769,12 +7753,7 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): D = create_prime_node() D.children.append(create_normal_node(self.vertices()[0])) else: - if algorithm == 'habib': - D = habib_maurer_algorithm(self) - elif algorithm == 'tedder': - D = modular_decomposition(self) - else: - raise ValueError("algorithm must be 'habib' or 'tedder'") + D = habib_maurer_algorithm(self) if style == 'tuple': if D is None: @@ -8035,23 +8014,13 @@ def is_inscribable(self, solver="ppl", verbose=0): return self.planar_dual().is_circumscribable(solver=solver, verbose=verbose) @doc_index("Graph properties") - def is_prime(self, algorithm='habib'): + def is_prime(self): r""" Test whether the current graph is prime. - INPUT: - - - ``algorithm`` -- (default: ``'tedder'``) specifies the algorithm to - use among: - - - ``'tedder'`` -- Use the linear algorithm of [TCHP2008]_. - - - ``'habib'`` -- Use the $O(n^3)$ algorithm of [HM1979]_. This is - probably slower, but is much simpler and so possibly less error - prone. - A graph is prime if all its modules are trivial (i.e. empty, all of the graph or singletons) -- see :meth:`modular_decomposition`. + Use the `O(n^3)` algorithm of [HM1979]_. EXAMPLES: @@ -8077,7 +8046,7 @@ def is_prime(self, algorithm='habib'): if self.order() <= 1: return True - D = self.modular_decomposition(algorithm=algorithm) + D = self.modular_decomposition() return D[0] == NodeType.PRIME and len(D[1]) == self.order() diff --git a/src/sage/graphs/graph_decompositions/modular_decomposition.py b/src/sage/graphs/graph_decompositions/modular_decomposition.py index 941aaa26b29..2b96578c95b 100644 --- a/src/sage/graphs/graph_decompositions/modular_decomposition.py +++ b/src/sage/graphs/graph_decompositions/modular_decomposition.py @@ -277,2055 +277,6 @@ def __eq__(self, other): self.children == other.children) -def modular_decomposition(graph): - """ - Compute the modular decomposition tree of ``graph``. - - The tree structure is represented in form of nested lists. A tree node is - an object of type Node. The Node object further contains a list of its - children - - INPUT: - - - ``graph`` -- the graph for which modular decomposition tree needs to be - computed - - OUTPUT: - - A nested list representing the modular decomposition tree computed for the - graph - - EXAMPLES: - - The Icosahedral graph is Prime:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: print_md_tree(modular_decomposition(graphs.IcosahedralGraph())) - PRIME - 5 - 7 - 11 - 1 - 8 - 0 - 9 - 4 - 10 - 6 - 2 - 3 - - The Octahedral graph is not Prime:: - - sage: print_md_tree(modular_decomposition(graphs.OctahedralGraph())) - SERIES - PARALLEL - 2 - 3 - PARALLEL - 1 - 4 - PARALLEL - 0 - 5 - - Tetrahedral Graph is Series:: - - sage: print_md_tree(modular_decomposition(graphs.TetrahedralGraph())) - SERIES - 3 - 2 - 1 - 0 - - Modular Decomposition tree containing both parallel and series modules:: - - sage: d = {2:[4,3,5], 1:[4,3,5], 5:[3,2,1,4], 3:[1,2,5], 4:[1,2,5]} - sage: g = Graph(d) - sage: print_md_tree(modular_decomposition(g)) - SERIES - 5 - PARALLEL - 3 - 4 - PARALLEL - 1 - 2 - - TESTS: - - Bad Input:: - - sage: g = DiGraph() - sage: modular_decomposition(g) - Traceback (most recent call last): - ... - ValueError: Graph must be undirected - - Empty Graph is Prime:: - - sage: g = Graph() - sage: modular_decomposition(g) - PRIME [] - - Graph from Marc Tedder implementation of modular decomposition:: - - sage: d = {1:[5,4,3,24,6,7,8,9,2,10,11,12,13,14,16,17], 2:[1], - ....: 3:[24,9,1], 4:[5,24,9,1], 5:[4,24,9,1], 6:[7,8,9,1], - ....: 7:[6,8,9,1], 8:[6,7,9,1], 9:[6,7,8,5,4,3,1], 10:[1], - ....: 11:[12,1], 12:[11,1], 13:[14,16,17,1], 14:[13,17,1], - ....: 16:[13,17,1], 17:[13,14,16,18,1], 18:[17], 24:[5,4,3,1]} - sage: g = Graph(d) - sage: test_modular_decomposition(modular_decomposition(g), g) - True - - Graph from the :wikipedia:`Modular_decomposition`:: - - sage: d2 = {1:[2,3,4], 2:[1,4,5,6,7], 3:[1,4,5,6,7], 4:[1,2,3,5,6,7], - ....: 5:[2,3,4,6,7], 6:[2,3,4,5,8,9,10,11], - ....: 7:[2,3,4,5,8,9,10,11], 8:[6,7,9,10,11], 9:[6,7,8,10,11], - ....: 10:[6,7,8,9], 11:[6,7,8,9]} - sage: g = Graph(d2) - sage: test_modular_decomposition(modular_decomposition(g), g) - True - """ - if graph.is_directed(): - raise ValueError("Graph must be undirected") - - if not graph.order(): # Empty Graph - return create_prime_node() - - if graph.order() == 1: # Single vertex graph - root = create_normal_node(next(graph.vertex_iterator())) - return root - - if not graph.is_connected(): - - # Parallel case: the tree contains the MD trees of its connected - # components as subtrees - components = graph.connected_components() - root = create_parallel_node() - for component in components: - root.children.append(modular_decomposition(graph.subgraph(component))) - return root - elif graph.complement().is_connected(): # Prime Graph - root = create_prime_node() - else: - root = create_series_node() # Series Graph - - bfs_generator = graph.breadth_first_search(next(graph.vertex_iterator()), - report_distance=True) - - prev_level_distance = -1 # used as a demarker for different levels in bfs - prev_level_list = [] # stores the vertices in previous level - - # dictionary stores the distance of vertices from the SOURCE - vertex_dist = {} - - # dictionary stores the position of vertices w.r.t SOURCE - vertex_status = {} - vertex_status[next(graph.vertex_iterator())] = VertexPosition.SOURCE - - # Different distances from the source vertex are considered - # as different levels in the algorithm - for (vertex, distance) in bfs_generator: - vertex_dist[vertex] = distance - - # Mark the neighbours of source as LEFT_OF_SOURCE as they appear to - # left of source in the forest, other vertices are marked as - # RIGHT_OF_SOURCE - if distance == 1: - vertex_status[vertex] = VertexPosition.LEFT_OF_SOURCE - elif distance != 0: - vertex_status[vertex] = VertexPosition.RIGHT_OF_SOURCE - - if distance != prev_level_distance: # On start of new level in BFS - if prev_level_list: - # MD Tree is computed for each level and added to the forest - root.children.append(modular_decomposition(graph.subgraph(prev_level_list))) - prev_level_list = [] - prev_level_distance = distance - prev_level_list.append(vertex) - - # The last level is left out in the above loop - root.children.append(modular_decomposition(graph.subgraph(prev_level_list))) - - # The MD tree for the neighbours of source marked as LEFT_OF_SOURCE - # are placed left of Source in the forest. root.children[1] is required to - # be source and root.children[0] is required to be the MD tree for the - # neighbours therefore, the first two elements in the list are replaced - root.children[0], root.children[1] = root.children[1], root.children[0] - - root.node_type = NodeType.FOREST - clear_node_split_info(root) - number_cocomponents(root, vertex_status) - number_components(root, vertex_status) - refine(graph, root, vertex_dist, vertex_status) - promote_left(root) - promote_right(root) - promote_child(root) - assembly(graph, root, vertex_status, vertex_dist) - - if root.node_type == NodeType.FOREST: - return root.children[0] - else: - return root - - -def number_components(root, vertex_status): - """ - Number the components to the right of SOURCE vertex in the forest input to - the assembly phase - - INPUT: - - - ``root`` -- the forest which contains the components and cocomponents - - - ``vertex_status`` -- dictionary which stores the position of vertex - w.r.t SOURCE - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.append(series_node) - sage: forest.children.append(parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.RIGHT_OF_SOURCE, - ....: 5: VertexPosition.RIGHT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: number_components(forest, vertex_status) - sage: forest.children[-1].children[0].comp_num - 2 - sage: forest.children[-1].children[1].comp_num - 3 - - TESTS:: - - sage: (forest.children[-1].children[0].comp_num == 2 and - ....: forest.children[-1].children[1].comp_num == 3) - True - sage: (forest.children[-2].children[0].comp_num == 1 and - ....: forest.children[-2].children[1].comp_num == 1) - True - """ - comp_num = 0 - flag = False - - if not root: # root is empty - return ValueError("Input forest {} is empty".format(root)) - - for node in root.children: - - # flag set to True after source vertex is encountered - if (node.node_type == NodeType.NORMAL and - vertex_status[node.children[0]] == VertexPosition.SOURCE): - flag = True - continue - - if not flag: # Cocomponents are skipped - continue - - comp_num += recursively_number_parts(node, comp_num, NodeType.PARALLEL) - - -def number_cocomponents(root, vertex_status): - """ - Number the cocomponents to the left of SOURCE vertex in the forest input to - the assembly phase - - INPUT: - - - ``root`` -- the forest which contains the cocomponents and components - - - ``vertex_status`` -- dictionary which stores the position of vertex - w.r.t SOURCE - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(2, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.LEFT_OF_SOURCE, - ....: 7: VertexPosition.LEFT_OF_SOURCE} - sage: number_cocomponents(forest, vertex_status) - sage: forest.children[1].children[0].comp_num - 1 - sage: forest.children[1].children[1].comp_num - 2 - - TESTS:: - - sage: (forest.children[1].children[0].comp_num and - ....: forest.children[1].children[1].comp_num == 2) - True - sage: (forest.children[2].children[0].comp_num == 3 and - ....: forest.children[2].children[1].comp_num == 3) - True - """ - cocomp_num = 0 - for node in root.children: - # Only cocomponents are numbered - if (node.node_type == NodeType.NORMAL and - vertex_status[node.children[0]] == VertexPosition.SOURCE): - break - cocomp_num += recursively_number_parts(node, cocomp_num, NodeType.SERIES) - - -def recursively_number_parts(part_root, part_num, by_type): - """ - Recursively number the nodes in the (co)components(parts). - - If the ``node_type`` of ``part_root`` is same as ``by_type`` then - ``part_num`` is incremented for subtree at each child of ``part_root`` else - part is numbered by ``part_num``. - - INPUT: - - - ``part_root`` -- root of the part to be numbered - - - ``part_num`` -- input number to be used as reference for numbering - the (co)components - - - ``by_type`` -- type which determines how numbering is done - - OUTPUT: - - The value incremented to ``part_num``. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: recursively_number_parts(series_node, 1, NodeType.SERIES) - 2 - sage: series_node.comp_num - 1 - sage: series_node.children[0].comp_num - 1 - sage: series_node.children[1].comp_num - 2 - - TESTS:: - - sage: (series_node.comp_num == 1 and - ....: series_node.children[0].comp_num == 1 and - ....: series_node.children[1].comp_num == 2) - True - """ - # inner function - def number_subtree(subtree_root, number): - """ - set the ``comp_num`` for all the nodes in the subtree to ``number`` - - INPUT: - - - ``subtree_root`` -- root of the subtree to be numbered - - - ``number`` -- number assigned to the subtree - """ - subtree_root.comp_num = number - if subtree_root.node_type != NodeType.NORMAL: - for child in subtree_root.children: - number_subtree(child, number) - - orig_part_num = part_num - - if part_root.node_type == by_type: - # if node_type is same as tree's node_type then cocomp_num is - # incremented before assigning to each subtree - part_root.comp_num = part_num - for child in part_root.children: - number_subtree(child, part_num) - part_num += 1 - else: - # entire tree is numbered by cocomp_num - number_subtree(part_root, part_num) - part_num += 1 - return part_num - orig_part_num - - -def assembly(graph, root, vertex_status, vertex_dist): - """ - Assemble the forest obtained after the promotion phase into a modular - decomposition tree. - - INPUT: - - - ``graph`` -- graph whose MD tree is to be computed - - - ``root`` -- Forest which would be assembled into a MD tree - - - ``vertex_status`` -- Dictionary which stores the position of vertex with - respect to the source - - - ``vertex_dist`` -- Dictionary which stores the distance of vertex from - source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: forest.children[0].comp_num = 1 - sage: forest.children[1].comp_num = 1 - sage: forest.children[1].children[0].comp_num = 1 - sage: forest.children[1].children[1].comp_num = 1 - sage: number_components(forest, vertex_status) - sage: assembly(g, forest, vertex_status, vertex_dist) - sage: forest.children - [PRIME [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]]] - - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: number_cocomponents(forest, vertex_status) - sage: assembly(g, forest, vertex_status, vertex_dist) - sage: forest.children - [PRIME [NORMAL [2], SERIES [NORMAL [4], NORMAL [5], NORMAL [3]], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]]] - """ - # Maps index to the mu computed for the (co)component at the index - mu = {} - - # Stores index in the forest containing the source vertex - source_index = -1 - - # Maps index to list of vertices in the (co)component at the index - vertices_in_component = {} - - # comp_num of parent should be equal to comp_num of its first child - update_comp_num(root) - - for index, component in enumerate(root.children): - - if (component.node_type == NodeType.NORMAL and - vertex_status[component.children[0]] == VertexPosition.SOURCE): - source_index = root.children.index(component) - - vertices_in_component[index] = get_vertices(component) - component.index_in_root = index - - # compute mu values for (co)components - for index, component in enumerate(root.children): - if index < source_index: - mu[index] = compute_mu_for_co_component(graph, index, - source_index, root, - vertices_in_component) - elif index > source_index: - mu[index] = compute_mu_for_component(graph, index, - source_index, root, - vertices_in_component) - - mu[source_index] = root.children[source_index] - - # stores the leftmost cocomponent included in the module containing - # source_index - left = root.children[source_index] - - # stores the rightmost component included in the module containing - # source_index - right = root.children[source_index] - - while len(root.children) != 1: - # source_index is changed every time a new module is formed therefore - # updated. left or right are also updated every time module is formed. - - # First series module is attempted - result, source_index = check_series(root, left, right, - source_index, mu) - if result: - left = root.children[source_index].children[0] - continue - - # If series module can't be formed, parallel is tried - result, source_index = check_parallel(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component) - if result: - right = root.children[source_index].children[-1] - continue - - # Finally a prime module is formed if both - # series and parallel can not be created - result, source_index = check_prime(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component) - if result: - if root.children[source_index].children[0].index_in_root != -1: - left = root.children[source_index].children[0] - if root.children[source_index].children[-1].index_in_root != -1: - right = root.children[source_index].children[-1] - - -def update_comp_num(node): - """ - Set the ``comp_num`` of ``node`` to the ``comp_num`` of its first child. - - INPUT: - - - ``node`` -- node whose comp_num needs to be updated - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.comp_num = 2 - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: series_node.children[0].comp_num = 3 - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(0, series_node) - sage: forest.children.insert(3, parallel_node) - sage: update_comp_num(forest) - sage: series_node.comp_num - 3 - sage: forest.comp_num - 2 - """ - if node.node_type != NodeType.NORMAL: - node.comp_num = node.children[0].comp_num - for child in node.children: - update_comp_num(child) - - -def check_prime(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component): - """ - Assemble the forest to create a prime module. - - INPUT: - - - ``root`` -- forest which needs to be assembled - - - ``left`` -- the leftmost fragment of the last module - - - ``right`` -- the rightmost fragment of the last module - - - ``source_index`` -- index of the tree containing the source vertex - - - ``mu`` -- dictionary which maps the (co)components with their mu values - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``[module_formed, source_index]`` where ``module_formed`` is ``True`` if - module is formed else ``False`` and ``source_index`` is the index of the - new module which contains the source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: source_index = 2 - sage: vertices_in_component = {} - sage: mu = {} - sage: left = right = forest.children[2] - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: for index, component in enumerate(forest.children): - ....: if index < source_index: - ....: mu[index] = compute_mu_for_co_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - ....: elif index > source_index: - ....: mu[index] = compute_mu_for_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - sage: forest.children[0].comp_num = 1 - sage: forest.children[1].comp_num = 1 - sage: forest.children[1].children[0].comp_num = 1 - sage: forest.children[1].children[1].comp_num = 1 - sage: number_components(forest, vertex_status) - sage: check_prime(g, forest, left, right, - ....: source_index, mu, vertex_dist, - ....: vertices_in_component) - [True, 0] - sage: forest.children - [PRIME [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]]] - """ - # stores the index of rightmost component included in the prime module - new_right_index = source_index - if source_index + 1 < len(root.children): - new_right_index += 1 - - # stores the index of leftmost component included in the prime module - new_left_index = source_index - if source_index >= 1: - new_left_index -= 1 - - # stores the indices of the cocomponents included in the prime module - # the cocomponents are extracted one by one from left_queue for adding - # more components - left_queue = deque() - - # stores the indices of the components included in the prime module - # the components are extracted one by one from right_queue for adding - # more cocomponents - right_queue = deque() - - if new_left_index != source_index: - left_queue.append(new_left_index) - if new_right_index != source_index: - right_queue.append(new_right_index) - - while left_queue or right_queue: - - if left_queue: - - # cocomponent indices extracted from the queue - left_index = left_queue.popleft() - - # more components added based on the below condition - while (new_right_index < len(root.children) - 1 and - root.children[new_right_index].index_in_root < mu[left_index].index_in_root): - new_right_index += 1 - right_queue.append(new_right_index) - - # cocomponent added while cocomponent at left_index - # has cocomponent to its left with same comp_num - while has_left_cocomponent_fragment(root, left_index): - if left_index >= 1: - left_index -= 1 - if new_left_index > left_index: - left_queue.append(left_index) - new_left_index = min(left_index, new_left_index) - - if right_queue: - - # component indices extracted from the queue - right_index = right_queue.popleft() - - # more cocomponents added based on the below condition - while (new_left_index > 0 and - root.children[new_left_index].index_in_root > mu[right_index].index_in_root): - new_left_index -= 1 - left_queue.append(new_left_index) - - # component is added while component at right_index - # has component to its right with same comp_num - # or has a connected component with vertices at different - # level from the source vertex - while (has_right_component_fragment(root, right_index) or - has_right_layer_neighbor(graph, root, - right_index, vertex_dist, - vertices_in_component)): - - if has_right_layer_neighbor(graph, root, - right_index, vertex_dist, - vertices_in_component): - new_left_index = 0 - new_right_index = len(root.children) - 1 - break - - if right_index + 1 < len(root.children): - right_index += 1 - if new_right_index < right_index: - right_queue.append(right_index) - new_right_index = max(right_index, new_right_index) - - node = create_prime_node() - - # vertices or modules are added in the prime_module - for temp in range(new_left_index, new_right_index + 1): - node.children.append(root.children[temp]) - - # list elements included in the prime module - # are removed from the forest - root.children[new_left_index:new_right_index + 1] = [] - - #insert the newly created prime module in the forest - root.children.insert(new_left_index, node) - - return [True, new_left_index] - - -def check_parallel(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component): - """ - Assemble the forest to create a parallel module. - - INPUT: - - - ``root`` -- forest which needs to be assembled - - - ``left`` -- the leftmost fragment of the last module - - - ``right`` -- the rightmost fragment of the last module - - - ``source_index`` -- index of the tree containing the source vertex - - - ``mu`` -- dictionary which maps the (co)components with their mu values - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``[module_formed, source_index]`` where ``module_formed`` is ``True`` if - module is formed else ``False`` and ``source_index`` is the index of the - new module which contains the source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(4, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7), create_normal_node(1)] - sage: forest.children.insert(1, series_node) - sage: forest.children.append(parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 2} - sage: source_index = 2 - sage: vertices_in_component = {} - sage: mu = {} - sage: left = right = forest.children[2] - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: for index, component in enumerate(forest.children): - ....: if index < source_index: - ....: mu[index] = compute_mu_for_co_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - ....: elif index > source_index: - ....: mu[index] = compute_mu_for_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - sage: number_components(forest, vertex_status) - sage: check_parallel(g, forest, left, right, - ....: source_index, mu, vertex_dist, - ....: vertices_in_component) - [True, 2] - sage: forest.children - [NORMAL [2], - SERIES [NORMAL [4], NORMAL [5]], - PARALLEL [NORMAL [3], NORMAL [6], NORMAL [7], NORMAL [1]]] - """ - # stores the index of rightmost component included in the parallel module - new_right_index = source_index - - while new_right_index + 1 < len(root.children): - - # component at new_right_index + 1 is added only if it doesn't have - # a component to its right with same comp_num - if has_right_component_fragment(root, new_right_index + 1): - break - - # component at new_right_index + 1 is added only if it doesn't have a - # connected component to its right with vertices at different level - # from its vertices - if has_right_layer_neighbor(graph, root, new_right_index + 1, - vertex_dist, vertices_in_component): - break - - # stores the index in root of new component to be added in the - # parallel module - i = root.children[new_right_index + 1].index_in_root - - # condition for adding more components in the parallel module - if mu[i].index_in_root >= left.index_in_root: - new_right_index += 1 - else: - break - - # if new_right_index > source_index then only parallel - # module can be formed - if source_index != new_right_index: - node = create_parallel_node() - for temp in range(source_index, new_right_index + 1): - - # if module X to be included in the new parallel module Y is also - # parallel then children of X and not X are included in Y - if root.children[temp].node_type == NodeType.PARALLEL: - for child in root.children[temp].children: - node.children.append(child) - child.index_in_root = root.children[temp].index_in_root - else: - node.children.append(root.children[temp]) - - # list elements included in the parallel module are removed from the - # forest - root.children[source_index:new_right_index + 1] = [] - - # insert the newly created parallel module into the forest - root.children.insert(source_index, node) - - return [True, source_index] - - # no parallel module was formed - return [False, source_index] - - -def check_series(root, left, right, source_index, mu): - """ - Assemble the forest to create a series module. - - INPUT: - - - ``root`` -- forest which needs to be assembled - - - ``left`` -- The leftmost fragment of the last module - - - ``right`` -- The rightmost fragment of the last module - - - ``source_index`` -- index of the tree containing the source vertex - - - ``mu`` -- dictionary which maps the (co)components with their mu values - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``[module_formed, source_index]`` where ``module_formed`` is ``True`` if - module is formed else ``False`` and ``source_index`` is the index of the - new module which contains the source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: source_index = 2 - sage: vertices_in_component = {} - sage: mu = {} - sage: left = right = forest.children[2] - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: for index, component in enumerate(forest.children): - ....: if index < source_index: - ....: mu[index] = compute_mu_for_co_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - ....: elif index > source_index: - ....: mu[index] = compute_mu_for_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - sage: number_cocomponents(forest, vertex_status) - sage: number_components(forest, vertex_status) - sage: check_series(forest, left, right, - ....: source_index, mu) - [True, 1] - sage: forest.children - [NORMAL [2], - SERIES [NORMAL [4], NORMAL [5], NORMAL [3]], - PARALLEL [NORMAL [6], NORMAL [7]], - NORMAL [1]] - """ - # stores the index of leftmost component included in the parallel module - new_left_index = source_index - - while new_left_index > 0: - - # cocomponent at new_left_index - 1 is added only if it doesn't have - # a cocomponent to its left with same comp_num - if has_left_cocomponent_fragment(root, new_left_index - 1): - break - - # stores the index in root of new cocomponent to be added in the - # series module - i = root.children[new_left_index - 1].index_in_root - - # condition for adding more cocomponents in the series module - if mu[i].index_in_root <= right.index_in_root: - new_left_index -= 1 - else: - break - - # if new_left_index < source_index then only series module can be formed - if source_index != new_left_index: - node = create_series_node() - for temp in range(new_left_index, source_index + 1): - - if root.children[temp].node_type == NodeType.SERIES: - # if module X to be included in the new series module Y is - # also series then children of X and not X are included in Y - for child in root.children[temp].children: - child.index_in_root = root.children[temp].index_in_root - node.children.append(child) - else: - node.children.append(root.children[temp]) - - # list elements included in the series module - # are removed from the forest - root.children[new_left_index:source_index + 1] = [] - - # insert the newly created series module into the forest - root.children.insert(new_left_index, node) - - return [True, new_left_index] - - # no series module could be formed - return [False, new_left_index] - - -def has_left_cocomponent_fragment(root, cocomp_index): - """ - Check whether cocomponent at ``cocomp_index`` has a cocomponent to its left - with same ``comp_num``. - - INPUT: - - - ``root`` -- the forest to which cocomponent belongs - - - ``cocomp_index`` -- index at which cocomponent is present in root - - OUTPUT: - - ``True`` if cocomponent at ``cocomp_index`` has a cocomponent to its left with - same ``comp_num``, and ``False`` otherwise. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: forest.children[0].comp_num = 1 - sage: forest.children[1].comp_num = 1 - sage: forest.children[1].children[0].comp_num = 1 - sage: forest.children[1].children[1].comp_num = 1 - sage: has_left_cocomponent_fragment(forest, 1) - True - sage: has_left_cocomponent_fragment(forest, 0) - False - """ - return any(root.children[index].comp_num == root.children[cocomp_index].comp_num - for index in range(cocomp_index)) - -def has_right_component_fragment(root, comp_index): - """ - Check whether component at ``comp_index`` has a component to its right with - same ``comp_num``. - - INPUT: - - - ``root`` -- the forest to which component belongs - - - ``comp_index`` -- index at which component is present in root - - OUTPUT: - - ``True`` if component at ``comp_index`` has a component to its right with - same ``comp_num``, and ``False`` otherwise. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: forest.children[3].comp_num = 1 - sage: forest.children[4].comp_num = 1 - sage: has_right_component_fragment(forest, 3) - True - sage: has_right_component_fragment(forest, 4) - False - """ - return any(root.children[index].comp_num == root.children[comp_index].comp_num - for index in range(comp_index + 1, len(root.children))) - -def has_right_layer_neighbor(graph, root, comp_index, - vertex_dist, vertices_in_component): - """ - Check whether component at ``comp_index`` has a connected component to its - right with vertices at different level from the source vertex. - - INPUT: - - - ``root`` -- the forest to which component belongs - - - ``comp_index`` -- index at which component is present in root - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``True`` if component at ``comp_index`` has a right layer neighbor, and - ``False`` otherwise. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: has_right_layer_neighbor(g, forest, 3, vertex_dist, - ....: vertices_in_component) - True - - """ - for index in range(comp_index + 1, len(root.children)): - - # check vertex in component at index has different level from vertex - # in component at comp_index and are connected to each other - if ((vertex_dist[get_vertex_in(root.children[index])] > - vertex_dist[get_vertex_in(root.children[comp_index])] - ) and - (is_component_connected(graph, root.children[index].index_in_root, - root.children[comp_index].index_in_root, - vertices_in_component) - )): - return True - - return False - - -def get_vertex_in(node): - """ - Return the first vertex encountered in the depth-first traversal of the - tree rooted at node - - INPUT: - - - ``tree`` -- input modular decomposition tree - - OUTPUT: - - Return the first vertex encountered in recursion - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: forest.children.insert(1, series_node) - sage: get_vertex_in(forest) - 2 - """ - while node.node_type != NodeType.NORMAL: - node = node.children[0] - return node.children[0] - -def compute_mu_for_co_component(graph, component_index, source_index, - root, vertices_in_component): - """ - Compute the mu value for co-component - - INPUT: - - - ``graph`` -- Graph whose MD tree needs to be computed - - - ``component_index`` -- index of the co-component - - - ``source_index`` -- index of the source in the forest - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``vertices_in_component`` -- dictionary which maps index i to list of - vertices in the tree at index i in the forest - - OUTPUT: - - The mu value (component in the forest) for the co-component - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - sage: compute_mu_for_co_component(g, 0, 2, forest, - ....: vertices_in_component) - NORMAL [1] - sage: compute_mu_for_co_component(g, 1, 2, forest, - ....: vertices_in_component) - NORMAL [3] - """ - for index in range(len(root.children) - 1, source_index, -1): - if is_component_connected(graph, component_index, - index, vertices_in_component): - return root.children[index] - - # return the default value - return root.children[source_index] - -def compute_mu_for_component(graph, component_index, source_index, - root, vertices_in_component): - """ - Compute the mu value for component - - INPUT: - - - ``graph`` -- Graph whose MD tree needs to be computed - - - ``component_index`` -- index of the component - - - ``source_index`` -- index of the source in the forest - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``vertices_in_component`` -- dictionary which maps index i to list of - vertices in the tree at the index i in the forest - - OUTPUT: - - The mu value (co-component in the forest) for the component - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - sage: compute_mu_for_component(g, 3, 2, forest, - ....: vertices_in_component) - SERIES [NORMAL [4], NORMAL [5]] - sage: compute_mu_for_component(g, 4, 2, forest, - ....: vertices_in_component) - NORMAL [2] - """ - # default mu value for a component - mu_for_component = root.children[0] - - for index in range(source_index): - if (mu_for_component == root.children[index] and - is_component_connected(graph, component_index, - index, vertices_in_component)): - mu_for_component = root.children[index + 1] - - # return the default value - return mu_for_component - - -def is_component_connected(graph, index1, index2, vertices_in_component): - """ - Check whether the two specified (co)components are connected. - - INPUT: - - - ``graph`` -- Graph whose MD tree needs to be computed - - - ``index1`` -- index of the first (co)component - - - ``index2`` -- index of the second (co)component - - - ``vertices_in_component`` -- dictionary which maps index i to list of - vertices in the tree at the index i in the forest - - OUTPUT: - - ``True`` if the (co)components are connected else ``False`` - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - sage: is_component_connected(g, 0, 1, vertices_in_component) - False - sage: is_component_connected(g, 0, 3, vertices_in_component) - True - """ - V1 = vertices_in_component[index1] - V2 = frozenset(vertices_in_component[index2]) - - return any(u in V2 for v in V1 for u in graph.neighbor_iterator(v)) - -def get_vertices(component_root): - """ - Compute the list of vertices in the (co)component - - INPUT: - - - ``component_root`` -- root of the (co)component whose vertices need to be - returned as a list - - OUTPUT: - - list of vertices in the (co)component - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: get_vertices(forest) - [2, 4, 5, 3, 6, 7, 1] - """ - vertices = [] - - # inner recursive function to recurse over the elements in the - # ``component`` - def recurse_component(node, vertices): - if node.node_type == NodeType.NORMAL: - vertices.append(node.children[0]) - return - for child in node.children: - recurse_component(child, vertices) - - recurse_component(component_root, vertices) - return vertices - -def promote_left(root): - """ - Perform the promotion phase on the forest root. - - If child and parent both are marked by LEFT_SPLIT then child is removed - and placed just before the parent - - INPUT: - - - ``root`` -- The forest which needs to be promoted - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(4, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: x = {u for u in g.neighbor_iterator(2) - ....: if vertex_dist[u] != vertex_dist[2]} - sage: maximal_subtrees_with_leaves_in_x(forest, 2, x, vertex_status, - ....: False, 0) - sage: promote_left(forest) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6]], PARALLEL [NORMAL [7]], - PARALLEL [], NORMAL [1]] - """ - q = deque() - - # q has [parent, child] elements as parent needs to be modified - for child in root.children: - q.append([root, child]) - - while q: - - parent, child = q.popleft() - - if child.node_type == NodeType.NORMAL: - continue - - # stores the elements to be removed from the child - to_remove = [] - - # stores the index of child in parent list - index = parent.children.index(child) - - for grand_child in child.children: - - # if tree and child both have LEFT_SPLIT then tree from - # child is inserted just before child in the parent - if grand_child.has_left_split() and child.has_left_split(): - parent.children.insert(index, grand_child) - index += 1 - to_remove.append(grand_child) - q.append([parent, grand_child]) - else: - q.append([child, grand_child]) - - for grand_child in to_remove: - child.children.remove(grand_child) - - -def promote_right(root): - """ - Perform the promotion phase on the forest root. - - If child and parent both are marked by RIGHT_SPLIT then child is removed - and placed just after the parent - - INPUT: - - - ``root`` -- the forest which needs to be promoted - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(4, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: refine(g, forest, vertex_dist, vertex_status) - sage: promote_right(forest) - sage: forest - FOREST [NORMAL [2], SERIES [SERIES [NORMAL [4]], SERIES [NORMAL [5]]], - NORMAL [3], PARALLEL [], PARALLEL [NORMAL [7]], - PARALLEL [NORMAL [6]], NORMAL [1]] - """ - q = deque() - - # q has [parent, child] elements as parent needs to be modified - for child in root.children: - q.append([root, child]) - - while q: - - parent, child = q.popleft() - - if child.node_type == NodeType.NORMAL: - continue - - # stores the elements to be removed from the child - to_remove = [] - - # stores the index of child in parent list - index = parent.children.index(child) - - for grand_child in child.children: - - # if tree and child both have RIGHT_SPLIT then tree from - # child is inserted just after child in the parent - if grand_child.has_right_split() and child.has_right_split(): - parent.children.insert(index + 1, grand_child) - to_remove.append(grand_child) - q.append([parent, grand_child]) - else: - q.append([child, grand_child]) - - for grand_child in to_remove: - child.children.remove(grand_child) - - -def promote_child(root): - """ - Perform the promotion phase on the forest `root`. - - If marked parent has no children it is removed, if it has one child then - it is replaced by its child - - INPUT: - - - ``root`` -- the forest which needs to be promoted - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(4, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: refine(g, forest, vertex_dist, vertex_status) - sage: promote_right(forest) - sage: promote_child(forest) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - NORMAL [7], NORMAL [6], NORMAL [1]] - """ - q = deque() - - # q has [parent, child] elements as parent needs to be modified - for child in root.children: - q.append([root, child]) - - while q: - - parent, child = q.popleft() - - if child.node_type == NodeType.NORMAL: - continue - - # if child node itself has only one child - if (len(child.children) == 1 and - (child.node_split != NodeSplit.NO_SPLIT or - child.node_type == NodeType.FOREST)): - # replace child node by its own child - - grand_child = child.children[0] - index = parent.children.index(child) - parent.children.insert(index, grand_child) - parent.children.remove(child) - q.append([parent, grand_child]) - # if child node has no children - elif ((not child.children) and child.node_split != NodeSplit.NO_SPLIT): - # remove the child node - parent.children.remove(child) - else: - for grand_child in child.children: - q.append([child, grand_child]) - - -def clear_node_split_info(root): - """ - Set the node_split of nodes to NO_SPLIT - - INPUT: - - - ``root`` -- the forest which needs to be cleared of split information - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: series_node.children[0].node_split = NodeSplit.LEFT_SPLIT - sage: series_node.node_split = NodeSplit.RIGHT_SPLIT - sage: forest.children.insert(1, series_node) - sage: clear_node_split_info(forest) - sage: series_node.node_split == NodeSplit.NO_SPLIT - True - sage: series_node.children[0].node_split == NodeSplit.NO_SPLIT - True - """ - root.node_split = NodeSplit.NO_SPLIT - - if root.node_type != NodeType.NORMAL: - for node in root.children: - clear_node_split_info(node) - - -def refine(graph, root, vertex_dist, vertex_status): - """ - Refine the forest based on the active edges - - INPUT: - - - ``graph`` -- graph whose MD tree needs to be computed - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``vertex_dist`` -- dictionary mapping the vertex with distance from the - source - - - ``vertex_status`` -- dictionary mapping the vertex to the position w.r.t. - source - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: refine(g, forest, vertex_dist, vertex_status) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [PARALLEL [NORMAL [6]], PARALLEL [NORMAL [7]]], - NORMAL [1]] - """ - x_used = [] - - # active edges of each vertex in the graph is used to refine the forest - for v in graph.vertices(): - if v in vertex_status and vertex_status[v] == VertexPosition.SOURCE: - continue - - # set of vertices connected through active edges to v - x = {u for u in graph.neighbor_iterator(v) - if vertex_dist[u] != vertex_dist[v]} - - if x not in x_used: - x_used.append(x) - maximal_subtrees_with_leaves_in_x(root, v, x, - vertex_status, False, 0) - - get_child_splits(root) - - -def get_child_splits(root): - """ - Add the node_split of children to the parent node - - INPUT: - - - ``root`` -- input modular decomposition tree - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: series_node.children[0].node_split = NodeSplit.LEFT_SPLIT - sage: series_node.node_split = NodeSplit.RIGHT_SPLIT - sage: forest.children.insert(1, series_node) - sage: get_child_splits(forest) - sage: series_node.node_split == NodeSplit.BOTH_SPLIT - True - sage: forest.node_split == NodeSplit.BOTH_SPLIT - True - """ - if root.node_type != NodeType.NORMAL: - for node in root.children: - get_child_splits(node) - root.set_node_split(node.node_split) - - -def maximal_subtrees_with_leaves_in_x(root, v, x, vertex_status, - tree_left_of_source, level): - """ - Refine the forest based on the active edges(x) of vertex v - - INPUT: - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``v`` -- the vertex used to refine - - - ``x`` -- set of vertices connected to v and at different distance - from source compared to v - - - ``vertex_status`` -- dictionary mapping the vertex to the position - w.r.t source - - - ``tree_left_of_source`` -- flag indicating whether tree is - - - ``level`` -- indicates the recursion level, 0 for root - - OUTPUT: - - ``[contained_in_x, split]`` where ``contained_in_x`` is ``True`` if all - vertices in root are subset of x else ``False`` and ``split`` is the - split which occurred at any node in root - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: x = {u for u in g.neighbor_iterator(2) - ....: if vertex_dist[u] != vertex_dist[2]} - sage: maximal_subtrees_with_leaves_in_x(forest, 2, x, vertex_status, - ....: False, 0) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]] - sage: x = {u for u in g.neighbor_iterator(1) - ....: if vertex_dist[u] != vertex_dist[1]} - sage: maximal_subtrees_with_leaves_in_x(forest, 1, x, vertex_status, - ....: False, 0) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [PARALLEL [NORMAL [6]], PARALLEL [NORMAL [7]]], - NORMAL [1]] - """ - def update_node_info(node, node_type, node_split, comp_num, subtree_list): - """ - Set the various fields for a tree node and update its subtrees - - - ``node`` -- node whose fields need to be updated - - ``node_type`` -- node_type to be set - - ``node_split`` -- node_split to be set - - ``comp_num`` -- comp_num to be set - - ``subtree_list`` -- list containing the subtrees - - """ - node.node_type = node_type - node.node_split = node_split - node.comp_num = comp_num - node.children = subtree_list - - return_split = NodeSplit.NO_SPLIT # initialize split to NO_SPLIT - - # all trees in a forest are refined using x - if root.node_type == NodeType.FOREST: - - # indicates whether tree is left of source, True if left of source - left_flag = True - - for node in root.children: - if (node.node_type == NodeType.NORMAL and - node.children[0] in vertex_status and - vertex_status[node.children[0]] == VertexPosition.SOURCE): - left_flag = False - subtree_result = maximal_subtrees_with_leaves_in_x(node, v, x, - vertex_status, - left_flag, - level) - if subtree_result: - # Mark the ancestors - root.set_node_split(subtree_result[1]) - - # handles the prime, series and parallel cases - elif root.node_type != NodeType.NORMAL: - - flag = True # indicates the entire root is contained in x - split_flag = False # indicates a split is required - Ta = [] # contains subtrees with leaves in x - Tb = [] # contains subtrees with leaves not in x - - for node in root.children: - - # refines the children of root - subtree_result = maximal_subtrees_with_leaves_in_x(node, v, x, - vertex_status, - tree_left_of_source, - level + 1) - - if subtree_result: - flag = flag and subtree_result[0] - - # add the node split of children to root - root.set_node_split(subtree_result[1]) - - if subtree_result[0]: - Ta.append(node) - split_flag = True - else: - Tb.append(node) - - if root.node_type == NodeType.PRIME: - # mark all the children of prime nodes - for node in root.children: - node.set_node_split(root.node_split) - - if flag: - # return if all subtrees are in x, no split required - return [True, root.node_split] - elif split_flag: # split required` - - split = NodeSplit.LEFT_SPLIT - - # if v is right of source and tree is also right of source then - # RIGHT_SPLIT - if (vertex_status[v] == VertexPosition.RIGHT_OF_SOURCE and - not tree_left_of_source): - split = NodeSplit.RIGHT_SPLIT - - # add the split to root node_split - root.set_node_split(split) - - if root.node_type == NodeType.PRIME: - # mark all the children of prime nodes - for node in root.children: - node.set_node_split(split) - return [False, split] - - if root.is_separated: - # if root has already been split then further split not - # required - return [flag, root.node_split] - - node_type = root.node_type - root.is_separated = True - - # root[1] would now contain Ta and Tb - root.children = [] - - # add two nodes for Ta and Tb - a = create_parallel_node() - update_node_info(a, node_type, root.node_split, - Ta[0].comp_num, Ta) - b = create_parallel_node() - update_node_info(b, node_type, root.node_split, - Tb[0].comp_num, Tb) - root.children.append(a) - root.children.append(b) - - return_split = root.node_split - return [flag, return_split] - # root is a vertex and is contained in x - elif root.children[0] in x: - return [True, root.node_split] - # root is a vertex and is not contained in x - else: - return [False, root.node_split] - def create_prime_node(): """ @@ -2417,18 +368,18 @@ def print_md_tree(root): sage: from sage.graphs.graph_decompositions.modular_decomposition import * sage: print_md_tree(modular_decomposition(graphs.IcosahedralGraph())) PRIME + 1 5 7 - 11 - 1 8 + 11 0 + 2 + 6 + 3 9 4 10 - 6 - 2 - 3 """ def recursive_print_md_tree(root, level): @@ -2699,6 +650,7 @@ def habib_maurer_algorithm(graph, g_classes=None): for sg in g_comp.connected_components()] return root +modular_decomposition = habib_maurer_algorithm #============================================================================= # Below functions are implemented to test the modular decomposition tree @@ -2797,6 +749,49 @@ def test_maximal_modules(tree_root, graph): return False return True +def get_vertices(component_root): + """ + Compute the list of vertices in the (co)component + + INPUT: + + - ``component_root`` -- root of the (co)component whose vertices need to be + returned as a list + + OUTPUT: + + list of vertices in the (co)component + + EXAMPLES:: + + sage: from sage.graphs.graph_decompositions.modular_decomposition import * + sage: forest = Node(NodeType.FOREST) + sage: forest.children = [create_normal_node(2), + ....: create_normal_node(3), create_normal_node(1)] + sage: series_node = Node(NodeType.SERIES) + sage: series_node.children = [create_normal_node(4), + ....: create_normal_node(5)] + sage: parallel_node = Node(NodeType.PARALLEL) + sage: parallel_node.children = [create_normal_node(6), + ....: create_normal_node(7)] + sage: forest.children.insert(1, series_node) + sage: forest.children.insert(3, parallel_node) + sage: get_vertices(forest) + [2, 4, 5, 3, 6, 7, 1] + """ + vertices = [] + + # inner recursive function to recurse over the elements in the + # ``component`` + def recurse_component(node, vertices): + if node.node_type == NodeType.NORMAL: + vertices.append(node.children[0]) + return + for child in node.children: + recurse_component(child, vertices) + + recurse_component(component_root, vertices) + return vertices # Function implemented for testing def get_module_type(graph): @@ -2977,15 +972,15 @@ def children_node_type(module, node_type): sage: tree_root = modular_decomposition(g) sage: print_md_tree(modular_decomposition(g)) SERIES - PARALLEL - 2 - 3 - PARALLEL - 1 - 4 - PARALLEL - 0 - 5 + PARALLEL + 0 + 5 + PARALLEL + 1 + 4 + PARALLEL + 2 + 3 sage: children_node_type(tree_root, NodeType.SERIES) False sage: children_node_type(tree_root, NodeType.PARALLEL) @@ -3014,15 +1009,15 @@ def either_connected_or_not_connected(v, vertices_in_module, graph): sage: g = graphs.OctahedralGraph() sage: print_md_tree(modular_decomposition(g)) SERIES - PARALLEL - 2 - 3 - PARALLEL - 1 - 4 - PARALLEL - 0 - 5 + PARALLEL + 0 + 5 + PARALLEL + 1 + 4 + PARALLEL + 2 + 3 sage: either_connected_or_not_connected(2, [1, 4], g) True sage: either_connected_or_not_connected(2, [3, 4], g) @@ -3054,7 +1049,7 @@ def tree_to_nested_tuple(root): sage: from sage.graphs.graph_decompositions.modular_decomposition import * sage: g = graphs.OctahedralGraph() sage: tree_to_nested_tuple(modular_decomposition(g)) - (SERIES, [(PARALLEL, [2, 3]), (PARALLEL, [1, 4]), (PARALLEL, [0, 5])]) + (SERIES, [(PARALLEL, [0, 5]), (PARALLEL, [1, 4]), (PARALLEL, [2, 3])]) """ if root.node_type == NodeType.NORMAL: return root.children[0] From 60a30a6c9db46b8836a5a2c1c2980a3d90e8922e Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 17:42:27 -0600 Subject: [PATCH 193/338] changes to $PATH construction more specific substring to test for pyenv, trailing `:` is now removed. --- build/bin/sage-bootstrap-python | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 6c3e20010e0..ddd5a19866f 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -16,12 +16,12 @@ NEW_PATH="" for path in $SAGE_ORIG_PATH do case "$path" in - *"pyenv"*);; - * ) NEW_PATH="$NEW_PATH$path:";; + '/home/'*'/.pyenv/shims'*);; + *) NEW_PATH="$NEW_PATH$path:";; esac done IFS=' ' -SAGE_ORIG_PATH=$NEW_PATH +SAGE_ORIG_PATH=${NEW_PATH%%':'} # In particular, it is invoked by "bootstrap -d" for sage-download-file, # i.e., before a configure run, and by "sage-spkg", also for sage-download-file. # So it needs to find a python that has the urllib module. From ec49dd290ac63bfeea13a81d8a09ed102f269331 Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Wed, 25 May 2022 18:52:28 -0600 Subject: [PATCH 194/338] less specific pyenv pattern --- build/bin/sage-bootstrap-python | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index ddd5a19866f..448efa5bcc0 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -16,7 +16,7 @@ NEW_PATH="" for path in $SAGE_ORIG_PATH do case "$path" in - '/home/'*'/.pyenv/shims'*);; + */.pyenv/shims*);; *) NEW_PATH="$NEW_PATH$path:";; esac done From 22f15f5d1a2935afebdabb130797e6370be464fd Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Thu, 26 May 2022 10:45:28 +0100 Subject: [PATCH 195/338] mention trac ticket number --- src/sage/graphs/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 089240f15e8..edb40ddc10d 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -7696,7 +7696,7 @@ def modular_decomposition(self, style='tuple'): .. NOTE:: A buggy implementation of linear time algorithm from [TCHP2008]_ was - removed in Sage 9.7. + removed in Sage 9.7, see :trac:`25872`. TESTS: From 790dde82614119bb7b4c5e7e22f21dd825b74dec Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 16:59:02 -0700 Subject: [PATCH 196/338] Drop Python 3.7 support --- build/pkgs/python3/spkg-configure.m4 | 4 ++-- pkgs/sage-docbuild/setup.cfg | 3 +-- pkgs/sage-setup/setup.cfg | 4 ++-- pkgs/sagemath-categories/setup.cfg.m4 | 4 ++-- pkgs/sagemath-objects/setup.cfg.m4 | 4 ++-- pyrightconfig.json | 2 +- src/doc/de/tutorial/interactive_shell.rst | 6 +++--- src/doc/en/developer/coding_in_python.rst | 8 ++++---- src/doc/en/developer/portability_testing.rst | 2 +- src/doc/en/installation/source.rst | 2 +- src/doc/en/tutorial/interactive_shell.rst | 6 +++--- src/doc/fr/tutorial/interactive_shell.rst | 6 +++--- src/doc/ja/tutorial/interactive_shell.rst | 6 +++--- src/doc/pt/tutorial/interactive_shell.rst | 6 +++--- src/doc/ru/tutorial/interactive_shell.rst | 6 +++--- src/setup.cfg.m4 | 4 ++-- tox.ini | 11 ++++------- 17 files changed, 40 insertions(+), 44 deletions(-) diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4 index 27af5be576d..4575cd0743f 100644 --- a/build/pkgs/python3/spkg-configure.m4 +++ b/build/pkgs/python3/spkg-configure.m4 @@ -1,6 +1,6 @@ SAGE_SPKG_CONFIGURE([python3], [ - m4_pushdef([MIN_VERSION], [3.7.0]) - m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.7.0]) + m4_pushdef([MIN_VERSION], [3.8.0]) + m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.8.0]) m4_pushdef([LT_STABLE_VERSION], [3.11.0]) m4_pushdef([LT_VERSION], [3.11.0]) AC_ARG_WITH([python], diff --git a/pkgs/sage-docbuild/setup.cfg b/pkgs/sage-docbuild/setup.cfg index 0952f72a1d3..abc71ffcd00 100644 --- a/pkgs/sage-docbuild/setup.cfg +++ b/pkgs/sage-docbuild/setup.cfg @@ -17,10 +17,9 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics diff --git a/pkgs/sage-setup/setup.cfg b/pkgs/sage-setup/setup.cfg index 197fc6791dc..79fd069f7c0 100644 --- a/pkgs/sage-setup/setup.cfg +++ b/pkgs/sage-setup/setup.cfg @@ -17,9 +17,9 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics @@ -31,7 +31,7 @@ packages = sage_setup.autogen.interpreters.specs sage_setup.command -python_requires = >=3.7, <3.11 +python_requires = >=3.8, <3.11 install_requires = pkgconfig diff --git a/pkgs/sagemath-categories/setup.cfg.m4 b/pkgs/sagemath-categories/setup.cfg.m4 index bad7e5ffd19..6bf81129de3 100644 --- a/pkgs/sagemath-categories/setup.cfg.m4 +++ b/pkgs/sagemath-categories/setup.cfg.m4 @@ -18,14 +18,14 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.10 +python_requires = >=3.8, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ diff --git a/pkgs/sagemath-objects/setup.cfg.m4 b/pkgs/sagemath-objects/setup.cfg.m4 index d4dc4402264..34a4ffd2bc6 100644 --- a/pkgs/sagemath-objects/setup.cfg.m4 +++ b/pkgs/sagemath-objects/setup.cfg.m4 @@ -18,14 +18,14 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.10 +python_requires = >=3.8, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ diff --git a/pyrightconfig.json b/pyrightconfig.json index ac8865ed58b..2bcc9ea2a10 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ "root": "src" } ], - "pythonVersion": "3.7", + "pythonVersion": "3.8", "exclude": ["venv"], "venvPath": "./venv/", "venv": "./", diff --git a/src/doc/de/tutorial/interactive_shell.rst b/src/doc/de/tutorial/interactive_shell.rst index 869029fa70e..822fef4ec67 100644 --- a/src/doc/de/tutorial/interactive_shell.rst +++ b/src/doc/de/tutorial/interactive_shell.rst @@ -16,7 +16,7 @@ vornehmen. Nach dem Start von Sage sehen Sie etwa folgendes: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -176,7 +176,7 @@ in einer zukünftigen Sitzung (indem Sie einfach die Log-Datei laden). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -195,7 +195,7 @@ in einer zukünftigen Sitzung (indem Sie einfach die Log-Datei laden). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/en/developer/coding_in_python.rst b/src/doc/en/developer/coding_in_python.rst index 6214eb51e4d..da8d7de2d08 100644 --- a/src/doc/en/developer/coding_in_python.rst +++ b/src/doc/en/developer/coding_in_python.rst @@ -16,14 +16,14 @@ that Sage supports. The information regarding the supported versions can be found in the files ``build/pkgs/python3/spkg-configure.m4`` and ``src/setup.cfg.m4``. -As of Sage 9.4, Python 3.7 is the oldest supported version. Hence, -all language and library features that are available in Python 3.7 can -be used; but features introduced in Python 3.8 cannot be used. If a +As of Sage 9.7, Python 3.8 is the oldest supported version. Hence, +all language and library features that are available in Python 3.8 can +be used; but features introduced in Python 3.9 cannot be used. If a feature is deprecated in a newer supported version, it must be ensured that deprecation warnings issued by Python do not lead to failures in doctests. -Some key language and library features have been backported to Python 3.7 +Some key language and library features have been backported to Python 3.8 using one of two mechanisms: - ``from __future__ import annotations`` (see diff --git a/src/doc/en/developer/portability_testing.rst b/src/doc/en/developer/portability_testing.rst index ad4b5521ffa..a0a7cbf40b8 100644 --- a/src/doc/en/developer/portability_testing.rst +++ b/src/doc/en/developer/portability_testing.rst @@ -897,7 +897,7 @@ The ``local-homebrew-macos-standard-python3_xcode`` environment installs the same packages, but uses XCode's ``/usr/bin/python3``. The ``local-homebrew-macos-standard-python3_pythonorg`` expects an -installation of Python 3.7 in +installation of Python 3.10 in ``/Library/Frameworks/Python.framework``; this is where the binary packages provided by python.org install themselves. diff --git a/src/doc/en/installation/source.rst b/src/doc/en/installation/source.rst index c235b45b5f8..4bddcc1e7b4 100644 --- a/src/doc/en/installation/source.rst +++ b/src/doc/en/installation/source.rst @@ -599,7 +599,7 @@ General procedure $ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 8.8, Release Date: 2019-06-26 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: diff --git a/src/doc/en/tutorial/interactive_shell.rst b/src/doc/en/tutorial/interactive_shell.rst index 3029ad8b6b5..8c7d340f5ac 100644 --- a/src/doc/en/tutorial/interactive_shell.rst +++ b/src/doc/en/tutorial/interactive_shell.rst @@ -14,7 +14,7 @@ Sage, you get output similar to the following: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -174,7 +174,7 @@ file). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -193,7 +193,7 @@ file). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/fr/tutorial/interactive_shell.rst b/src/doc/fr/tutorial/interactive_shell.rst index c38140f781b..99e215391db 100644 --- a/src/doc/fr/tutorial/interactive_shell.rst +++ b/src/doc/fr/tutorial/interactive_shell.rst @@ -18,7 +18,7 @@ le shell Sage affiche un message de ce genre : ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -183,7 +183,7 @@ session future (en rechargeant le fichier journal). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -202,7 +202,7 @@ session future (en rechargeant le fichier journal). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/ja/tutorial/interactive_shell.rst b/src/doc/ja/tutorial/interactive_shell.rst index 452914bd12a..4847d9b0775 100644 --- a/src/doc/ja/tutorial/interactive_shell.rst +++ b/src/doc/ja/tutorial/interactive_shell.rst @@ -15,7 +15,7 @@ Sageを起動すると,すぐに次のような画面が現れる: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -164,7 +164,7 @@ Sageセッションのロギングと,セッションの保存(:ref:`section-s was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -183,7 +183,7 @@ Sageセッションのロギングと,セッションの保存(:ref:`section-s was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/pt/tutorial/interactive_shell.rst b/src/doc/pt/tutorial/interactive_shell.rst index 1b3ec525c89..1737498abaa 100644 --- a/src/doc/pt/tutorial/interactive_shell.rst +++ b/src/doc/pt/tutorial/interactive_shell.rst @@ -17,7 +17,7 @@ obtém o seguinte: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: @@ -175,7 +175,7 @@ arquivo log). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -194,7 +194,7 @@ arquivo log). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load "setup" diff --git a/src/doc/ru/tutorial/interactive_shell.rst b/src/doc/ru/tutorial/interactive_shell.rst index 9129eeee005..621426eda9b 100644 --- a/src/doc/ru/tutorial/interactive_shell.rst +++ b/src/doc/ru/tutorial/interactive_shell.rst @@ -17,7 +17,7 @@ Sage вы увидите вывод, похожий на следующий: ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: @@ -167,7 +167,7 @@ Notebook), то вы можете ввести ``%hist``, чтобы вывес was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -186,7 +186,7 @@ Notebook), то вы можете ввести ``%hist``, чтобы вывес was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 index aff2e5d7cf8..8f4cdd8ab0d 100644 --- a/src/setup.cfg.m4 +++ b/src/setup.cfg.m4 @@ -19,14 +19,14 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.11 +python_requires = >=3.8, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ sage_conf \ diff --git a/tox.ini b/tox.ini index 47c10c364ef..11bb5853b81 100644 --- a/tox.ini +++ b/tox.ini @@ -286,7 +286,6 @@ setenv = # gentoo: SYSTEM=gentoo gentoo: BASE_IMAGE=sheerluck/sage-on-gentoo-stage4 - gentoo-python3.7: BASE_TAG=latest-py37 gentoo-python3.9: BASE_TAG=latest-py39 gentoo-python3.10: BASE_TAG=latest-py10 gentoo: IGNORE_MISSING_SYSTEM_PACKAGES=no @@ -506,8 +505,7 @@ setenv = # Setting "--with-system-python3=yes" explicitly in case we change the configure default # to "--with-system-python3=force" as originally proposed in #32060 PYTHON_MAJOR=3 - PYTHON_MINOR=9 - python3.7: PYTHON_MINOR=7 + PYTHON_MINOR=10 python3.8: PYTHON_MINOR=8 python3.9: PYTHON_MINOR=9 python3.10: PYTHON_MINOR=10 @@ -515,15 +513,14 @@ setenv = CONFIG_CONFIGURE_ARGS_1=--with-system-python3=yes python3_spkg: CONFIG_CONFIGURE_ARGS_1=--without-system-python3 macos-python3_xcode: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/usr/bin/python3 - macos-{python3_xcode,nohomebrew}-{python3.7,python3.8}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 + macos-{python3_xcode,nohomebrew}-{python3.8}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # Homebrew keg installs - homebrew-{python3.7,python3.8,python3.9,python3.10,python3.11}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 + homebrew-{python3.8,python3.9,python3.10,python3.11}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # Installers from https://www.python.org/downloads/macos/ (must manually download and install) macos-python3_pythonorg: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Frameworks/Python.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # https://github.com/pypa/manylinux manylinux-standard: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}-cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}/bin/python3 - manylinux-python3.7: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp37-cp37m/bin/python3 - manylinux-{python3.7,python3.8,python3.9,python3.10,python3.11}: EXTRA_SAGE_PACKAGES=_bootstrap xz bzip2 libffi libpng + manylinux-{python3.8,python3.9,python3.10,python3.11}: EXTRA_SAGE_PACKAGES=_bootstrap xz bzip2 libffi libpng conda: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python3 # # - toolchain From 4b121f76a23a80f8e474c2985223c9acbea5cf41 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Thu, 12 May 2022 14:57:23 +0100 Subject: [PATCH 197/338] Python 3.7->3.8. in few places; bump Sage version to 9.7 in tutorial --- README.md | 2 +- src/doc/de/tutorial/interactive_shell.rst | 6 +++--- src/doc/en/installation/source.rst | 2 +- src/doc/en/tutorial/interactive_shell.rst | 6 +++--- src/doc/fr/tutorial/interactive_shell.rst | 6 +++--- src/doc/ja/tutorial/interactive_shell.rst | 6 +++--- src/doc/pt/tutorial/interactive_shell.rst | 6 +++--- src/doc/ru/tutorial/interactive_shell.rst | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 93b1d566829..734b0ecec6e 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ in the Installation Guide. ``ExtUtils::MakeMaker``), `ranlib`, `git`, `tar`, `bc`. - Python 3.4 or later, or Python 2.7, a full installation including - `urllib`; but ideally version 3.7.x, 3.8.x, 3.9.x, or 3.10.x, which + `urllib`; but ideally version 3.8.x, 3.9.x, or 3.10.x, which will avoid having to build Sage's own copy of Python 3. We have collected lists of system packages that provide these build diff --git a/src/doc/de/tutorial/interactive_shell.rst b/src/doc/de/tutorial/interactive_shell.rst index 822fef4ec67..b356ea21f45 100644 --- a/src/doc/de/tutorial/interactive_shell.rst +++ b/src/doc/de/tutorial/interactive_shell.rst @@ -15,7 +15,7 @@ vornehmen. Nach dem Start von Sage sehen Sie etwa folgendes: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -175,7 +175,7 @@ in einer zukünftigen Sitzung (indem Sie einfach die Log-Datei laden). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -194,7 +194,7 @@ in einer zukünftigen Sitzung (indem Sie einfach die Log-Datei laden). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ diff --git a/src/doc/en/installation/source.rst b/src/doc/en/installation/source.rst index 4bddcc1e7b4..1c5a86230c7 100644 --- a/src/doc/en/installation/source.rst +++ b/src/doc/en/installation/source.rst @@ -134,7 +134,7 @@ rather than building a Python 3 installation from scratch. Use the ``configure`` option ``--without-system-python3`` in case you want Python 3 built from scratch. -Sage will accept versions 3.7.x to 3.10.x. +Sage will accept versions 3.8.x to 3.10.x. You can also use ``--with-python=/path/to/python3_binary`` to tell Sage to use ``/path/to/python3_binary`` to set up the venv. Note that setting up venv requires diff --git a/src/doc/en/tutorial/interactive_shell.rst b/src/doc/en/tutorial/interactive_shell.rst index 8c7d340f5ac..7ae821e416d 100644 --- a/src/doc/en/tutorial/interactive_shell.rst +++ b/src/doc/en/tutorial/interactive_shell.rst @@ -13,7 +13,7 @@ Sage, you get output similar to the following: .. CODE-BLOCK:: text ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -173,7 +173,7 @@ file). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -192,7 +192,7 @@ file). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ diff --git a/src/doc/fr/tutorial/interactive_shell.rst b/src/doc/fr/tutorial/interactive_shell.rst index 99e215391db..81235ccaab9 100644 --- a/src/doc/fr/tutorial/interactive_shell.rst +++ b/src/doc/fr/tutorial/interactive_shell.rst @@ -17,7 +17,7 @@ le shell Sage affiche un message de ce genre : :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -182,7 +182,7 @@ session future (en rechargeant le fichier journal). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -201,7 +201,7 @@ session future (en rechargeant le fichier journal). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ diff --git a/src/doc/ja/tutorial/interactive_shell.rst b/src/doc/ja/tutorial/interactive_shell.rst index 4847d9b0775..38a5c2c4d3f 100644 --- a/src/doc/ja/tutorial/interactive_shell.rst +++ b/src/doc/ja/tutorial/interactive_shell.rst @@ -14,7 +14,7 @@ Sageを起動すると,すぐに次のような画面が現れる: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -163,7 +163,7 @@ Sageセッションのロギングと,セッションの保存(:ref:`section-s was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -182,7 +182,7 @@ Sageセッションのロギングと,セッションの保存(:ref:`section-s Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ diff --git a/src/doc/pt/tutorial/interactive_shell.rst b/src/doc/pt/tutorial/interactive_shell.rst index 1737498abaa..67d27269a1e 100644 --- a/src/doc/pt/tutorial/interactive_shell.rst +++ b/src/doc/pt/tutorial/interactive_shell.rst @@ -16,7 +16,7 @@ obtém o seguinte: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: @@ -174,7 +174,7 @@ arquivo log). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -193,7 +193,7 @@ arquivo log). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ diff --git a/src/doc/ru/tutorial/interactive_shell.rst b/src/doc/ru/tutorial/interactive_shell.rst index 621426eda9b..e2d8a68cde6 100644 --- a/src/doc/ru/tutorial/interactive_shell.rst +++ b/src/doc/ru/tutorial/interactive_shell.rst @@ -16,7 +16,7 @@ Sage вы увидите вывод, похожий на следующий: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -166,7 +166,7 @@ Notebook), то вы можете ввести ``%hist``, чтобы вывес was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -185,7 +185,7 @@ Notebook), то вы можете ввести ``%hist``, чтобы вывес Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ From 037fc2f4ebab0dc602980d39dfada3395d2ab414 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 09:47:55 -0700 Subject: [PATCH 198/338] build/pkgs/jinja2: Update to 3.1.2 --- build/pkgs/jinja2/checksums.ini | 6 +++--- build/pkgs/jinja2/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jinja2/checksums.ini b/build/pkgs/jinja2/checksums.ini index 1e2005c59d9..f7070dfa137 100644 --- a/build/pkgs/jinja2/checksums.ini +++ b/build/pkgs/jinja2/checksums.ini @@ -1,5 +1,5 @@ tarball=Jinja2-VERSION.tar.gz -sha1=40278c4dfbbd6d21dc570bee0c63e32504e5442e -md5=964afcd0853f67f20f7b2e34e5935564 -cksum=380272436 +sha1=560f248ccb0b98256c5b50c86a002c2c1e57edb6 +md5=d31148abd89c1df1cdb077a55db27d02 +cksum=394934978 upstream_url=https://pypi.io/packages/source/j/jinja2/Jinja2-VERSION.tar.gz diff --git a/build/pkgs/jinja2/package-version.txt b/build/pkgs/jinja2/package-version.txt index 94ff29cc4de..ef538c28109 100644 --- a/build/pkgs/jinja2/package-version.txt +++ b/build/pkgs/jinja2/package-version.txt @@ -1 +1 @@ -3.1.1 +3.1.2 From dedc9c20d79d408b5e02ac4b89de5a38a5e6c48c Mon Sep 17 00:00:00 2001 From: Julien Grijalva Date: Thu, 26 May 2022 12:45:09 -0600 Subject: [PATCH 199/338] restore default IFS behavior --- build/bin/sage-bootstrap-python | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 448efa5bcc0..f78e5e62a1d 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -20,7 +20,7 @@ do *) NEW_PATH="$NEW_PATH$path:";; esac done -IFS=' ' +unset IFS SAGE_ORIG_PATH=${NEW_PATH%%':'} # In particular, it is invoked by "bootstrap -d" for sage-download-file, # i.e., before a configure run, and by "sage-spkg", also for sage-download-file. From 18593eccdf417e07094384c32f455c08540415a6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 12:02:56 -0700 Subject: [PATCH 200/338] m4/sage_spkg_collect.m4: One more space --- m4/sage_spkg_collect.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index e778e55abcf..05680ea9c5d 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -330,7 +330,7 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl ]) AS_IF([test -f "$DIR/dependencies_optional"], [dnl for a in $(sed 's/^ *//; s/ *#.*//; q' "$DIR/dependencies_optional"); do - AS_VAR_APPEND([DEPS], ['$(findstring '$a',$(OPTIONAL_INSTALLED_PACKAGES)) ']) + AS_VAR_APPEND([DEPS], [' $(findstring '$a',$(OPTIONAL_INSTALLED_PACKAGES)) ']) done ]) AS_CASE(["$DEPS"], [*\|*], [], [AS_VAR_APPEND([DEPS], [" |"])]) From f610e5a8648308b5f3d87b4ea803a63ee72f08cf Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Thu, 26 May 2022 22:18:21 +0100 Subject: [PATCH 201/338] retained 'algorithm=' with deprecation --- src/sage/graphs/graph.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index edb40ddc10d..2d617edffd3 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -7574,7 +7574,7 @@ def cores(self, k=None, with_labels=False): return list(core.values()) @doc_index("Leftovers") - def modular_decomposition(self, style='tuple'): + def modular_decomposition(self, algorithm=None, style='tuple'): r""" Return the modular decomposition of the current graph. @@ -7745,6 +7745,9 @@ def modular_decomposition(self, style='tuple'): create_prime_node, create_normal_node) + if algorithm is not None: + from sage.misc.superseded import deprecation + deprecation(25872, "algorithm=... parameter is obsolete and has no effect.") self._scream_if_not_simple() if not self.order(): @@ -8014,7 +8017,7 @@ def is_inscribable(self, solver="ppl", verbose=0): return self.planar_dual().is_circumscribable(solver=solver, verbose=verbose) @doc_index("Graph properties") - def is_prime(self): + def is_prime(self, algorithm=None): r""" Test whether the current graph is prime. @@ -8041,6 +8044,9 @@ def is_prime(self): sage: graphs.EmptyGraph().is_prime() True """ + if algorithm is not None: + from sage.misc.superseded import deprecation + deprecation(25872, "algorithm=... parameter is obsolete and has no effect.") from sage.graphs.graph_decompositions.modular_decomposition import NodeType if self.order() <= 1: From 8e8045e3097f88279bbf24f1648300d4ba3ade58 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 18:25:28 -0700 Subject: [PATCH 202/338] build/pkgs/jupyter_packaging/requirements.txt: Set upper version bound to avoid triggering setuptools upgrade --- build/pkgs/jupyter_packaging/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/jupyter_packaging/requirements.txt b/build/pkgs/jupyter_packaging/requirements.txt index b5ec61b7d14..c99565a4ced 100644 --- a/build/pkgs/jupyter_packaging/requirements.txt +++ b/build/pkgs/jupyter_packaging/requirements.txt @@ -1 +1 @@ -jupyter-packaging +jupyter-packaging < 0.12 From 1b8b25522629249a8063f431b962b89ee9863238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 14:59:36 +0200 Subject: [PATCH 203/338] remove inheritance from object in classes inside misc/ and repl/ --- src/sage/misc/abstract_method.py | 6 ++-- src/sage/misc/c3.pyx | 8 ++--- src/sage/misc/c3_controlled.pyx | 8 ++--- src/sage/misc/cachefunc.pxd | 4 +-- src/sage/misc/cachefunc.pyx | 38 ++++++++++---------- src/sage/misc/call.py | 2 +- src/sage/misc/classcall_metaclass.pyx | 6 ++-- src/sage/misc/decorators.py | 10 +++--- src/sage/misc/element_with_label.py | 2 +- src/sage/misc/explain_pickle.py | 20 +++++------ src/sage/misc/inherit_comparison.pyx | 2 +- src/sage/misc/instancedoc.pyx | 14 ++++---- src/sage/misc/lazy_attribute.pyx | 18 +++++----- src/sage/misc/lazy_format.py | 2 +- src/sage/misc/lazy_import.pyx | 8 ++--- src/sage/misc/lazy_list.pxd | 2 +- src/sage/misc/lazy_list.pyx | 2 +- src/sage/misc/lazy_string.pxd | 2 +- src/sage/misc/lazy_string.pyx | 2 +- src/sage/misc/misc.py | 2 +- src/sage/misc/nested_class.pyx | 18 +++++----- src/sage/misc/object_multiplexer.py | 4 +-- src/sage/misc/persist.pyx | 8 ++--- src/sage/misc/sage_input.py | 2 +- src/sage/misc/sage_timeit.py | 2 +- src/sage/misc/sage_unittest.py | 4 +-- src/sage/misc/sageinspect.py | 8 ++--- src/sage/misc/superseded.py | 14 ++++---- src/sage/misc/temporary_file.py | 4 +-- src/sage/misc/test_nested_class.py | 18 +++++----- src/sage/misc/weak_dict.pyx | 24 ++++++------- src/sage/repl/configuration.py | 2 +- src/sage/repl/display/fancy_repr.py | 6 ++-- src/sage/repl/display/formatter.py | 2 +- src/sage/repl/display/util.py | 2 +- src/sage/repl/interface_magic.py | 2 +- src/sage/repl/interpreter.py | 6 ++-- src/sage/repl/ipython_extension.py | 2 +- src/sage/repl/ipython_kernel/install.py | 2 +- src/sage/repl/ipython_kernel/widgets.py | 2 +- src/sage/repl/rich_output/display_manager.py | 2 +- 41 files changed, 146 insertions(+), 146 deletions(-) diff --git a/src/sage/misc/abstract_method.py b/src/sage/misc/abstract_method.py index 49dc59ba9fa..c9a0c76f7fb 100644 --- a/src/sage/misc/abstract_method.py +++ b/src/sage/misc/abstract_method.py @@ -33,7 +33,7 @@ def abstract_method(f=None, optional=False): We create a class with an abstract method:: - sage: class A(object): + sage: class A(): ....: ....: @abstract_method ....: def my_method(self): @@ -60,7 +60,7 @@ def abstract_method(f=None, optional=False): It is also possible to mark abstract methods as optional:: - sage: class A(object): + sage: class A(): ....: ....: @abstract_method(optional = True) ....: def my_method(self): @@ -138,7 +138,7 @@ def abstract_method(f=None, optional=False): return AbstractMethod(f, optional) -class AbstractMethod(object): +class AbstractMethod(): def __init__(self, f, optional=False): """ Constructor for abstract methods diff --git a/src/sage/misc/c3.pyx b/src/sage/misc/c3.pyx index 77eb223c250..d777a0e25ca 100644 --- a/src/sage/misc/c3.pyx +++ b/src/sage/misc/c3.pyx @@ -123,9 +123,9 @@ cpdef list C3_algorithm(object start, str bases, str attribute, bint proper): Regression test for bug #1 of :trac:`13501`:: - sage: class C(object): pass - sage: class F(object): pass - sage: class G(object): pass + sage: class C(): pass + sage: class F(): pass + sage: class G(): pass sage: class B(C,F): pass sage: class D(F,G): pass sage: class E(F): pass @@ -147,7 +147,7 @@ cpdef list C3_algorithm(object start, str bases, str attribute, bint proper): fail since ``A`` asks for ``B`` to come before ``C``, where as ``B`` is a super class of ``C``:: - sage: class B(object): pass + sage: class B(): pass sage: class C(B): pass sage: class A(B, C): pass Traceback (most recent call last): diff --git a/src/sage/misc/c3_controlled.pyx b/src/sage/misc/c3_controlled.pyx index 1b16dd62b8e..030a512f36a 100644 --- a/src/sage/misc/c3_controlled.pyx +++ b/src/sage/misc/c3_controlled.pyx @@ -31,11 +31,11 @@ The problem Consider the following hierarchy of classes:: - sage: class A1(object): pass - sage: class A2(object): + sage: class A1(): pass + sage: class A2(): ....: def foo(self): return 2 - sage: class A3(object): pass - sage: class A4(object): + sage: class A3(): pass + sage: class A4(): ....: def foo(self): return 4 sage: class A5(A2, A1): ....: def foo(self): return 5 diff --git a/src/sage/misc/cachefunc.pxd b/src/sage/misc/cachefunc.pxd index e77d6e305fd..d3cc677dece 100644 --- a/src/sage/misc/cachefunc.pxd +++ b/src/sage/misc/cachefunc.pxd @@ -3,7 +3,7 @@ from .function_mangling cimport ArgumentFixer cpdef dict_key(o) cpdef cache_key(o) -cdef class CachedFunction(object): +cdef class CachedFunction(): cdef public str __name__ cdef public str __module__ cdef ArgumentFixer _argument_fixer @@ -17,7 +17,7 @@ cdef class CachedFunction(object): cdef key cdef bint do_pickle -cdef class CachedMethod(object): +cdef class CachedMethod(): cdef str _cache_name cdef public str __name__ cdef public str __module__ diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx index c74d9d83fd0..d76126c3472 100644 --- a/src/sage/misc/cachefunc.pyx +++ b/src/sage/misc/cachefunc.pyx @@ -599,7 +599,7 @@ cdef cache_key_unhashable(o): return cache_key(k) -cdef class CachedFunction(object): +cdef class CachedFunction(): """ Create a cached version of a function, which only recomputes values it hasn't already computed. Synonyme: ``cached_function`` @@ -1435,7 +1435,7 @@ cdef class WeakCachedFunction(CachedFunction): weak_cached_function = decorator_keywords(WeakCachedFunction) -class CachedMethodPickle(object): +class CachedMethodPickle(): """ This class helps to unpickle cached methods. @@ -1798,7 +1798,7 @@ cdef class CachedMethodCaller(CachedFunction): :: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, x): ....: self._x = x ....: @cached_method @@ -1829,7 +1829,7 @@ cdef class CachedMethodCaller(CachedFunction): TESTS:: - sage: class A(object): + sage: class A(): ....: def _f_normalize(self, x, algorithm): return x ....: @cached_method(key=_f_normalize) ....: def f(self, x, algorithm='default'): return x @@ -1913,7 +1913,7 @@ cdef class CachedMethodCaller(CachedFunction): :meth:`sage.structure.sage_object.SageObject._cache_key`:: sage: K. = Qq(4) # optional - sage.rings.padics - sage: class A(object): + sage: class A(): ....: @cached_method ....: def f(self, x): return x+x sage: a = A() @@ -1956,7 +1956,7 @@ cdef class CachedMethodCaller(CachedFunction): EXAMPLES:: - sage: class CachedMethodTest(object): + sage: class CachedMethodTest(): ....: @cached_method ....: def f(self, x): ....: return x @@ -2110,7 +2110,7 @@ cdef class CachedMethodCaller(CachedFunction): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: @cached_method ....: def f(self, i): ....: return i^2 @@ -2495,7 +2495,7 @@ cdef class GloballyCachedMethodCaller(CachedMethodCaller): sage: class MyParent(Parent): ....: pass - sage: class MyElement(object): + sage: class MyElement(): ....: def __init__(self, x): ....: self.x = x ....: def parent(self): @@ -2513,7 +2513,7 @@ cdef class GloballyCachedMethodCaller(CachedMethodCaller): return (self._instance, k) -cdef class CachedMethod(object): +cdef class CachedMethod(): """ A decorator that creates a cached version of an instance method of a class. @@ -2527,7 +2527,7 @@ cdef class CachedMethod(object): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: @cached_method ....: def f(self, t, x=2): ....: print('computing') @@ -2561,7 +2561,7 @@ cdef class CachedMethod(object): custom cache key for inputs. In the following example, this parameter is used to ignore the ``algorithm`` keyword for caching:: - sage: class A(object): + sage: class A(): ....: def _f_normalize(self, x, algorithm): return x ....: @cached_method(key=_f_normalize) ....: def f(self, x, algorithm='default'): return x @@ -2572,7 +2572,7 @@ cdef class CachedMethod(object): The parameter ``do_pickle`` can be used to enable pickling of the cache. Usually the cache is not stored when pickling:: - sage: class A(object): + sage: class A(): ....: @cached_method ....: def f(self, x): return None sage: import __main__ @@ -2587,7 +2587,7 @@ cdef class CachedMethod(object): When ``do_pickle`` is set, the pickle contains the contents of the cache:: - sage: class A(object): + sage: class A(): ....: @cached_method(do_pickle=True) ....: def f(self, x): return None sage: __main__.A = A @@ -2624,7 +2624,7 @@ cdef class CachedMethod(object): """ EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, x): ....: self._x = x ....: @cached_method @@ -2699,7 +2699,7 @@ cdef class CachedMethod(object): sage: from sage.misc.superseded import deprecated_function_alias - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, x): ....: self._x = x ....: @cached_method @@ -3163,7 +3163,7 @@ cdef class CachedInParentMethod(CachedMethod): Test that ``key`` works:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self._parent = MyParent() ....: def parent(self): return self._parent @@ -3177,7 +3177,7 @@ cdef class CachedInParentMethod(CachedMethod): Test that ``do_pickle`` works. Usually the contents of the cache are not pickled:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self._parent = MyParent() ....: def parent(self): return self._parent @@ -3197,7 +3197,7 @@ cdef class CachedInParentMethod(CachedMethod): Pickling can be enabled with ``do_pickle``:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self._parent = MyParent() ....: def parent(self): return self._parent @@ -3308,7 +3308,7 @@ cdef class CachedInParentMethod(CachedMethod): cached_in_parent_method = decorator_keywords(CachedInParentMethod) -class FileCache(object): +class FileCache(): """ :class:`FileCache` is a dictionary-like class which stores keys and values on disk. The keys take the form of a tuple ``(A,K)`` diff --git a/src/sage/misc/call.py b/src/sage/misc/call.py index 7b579f45a4d..71368bbadd5 100644 --- a/src/sage/misc/call.py +++ b/src/sage/misc/call.py @@ -18,7 +18,7 @@ ############################################# # Operators ############################################# -class AttrCallObject(object): +class AttrCallObject(): def __init__(self, name, args, kwds): """ TESTS:: diff --git a/src/sage/misc/classcall_metaclass.pyx b/src/sage/misc/classcall_metaclass.pyx index 2f7038e9a9f..191534f76ee 100644 --- a/src/sage/misc/classcall_metaclass.pyx +++ b/src/sage/misc/classcall_metaclass.pyx @@ -460,7 +460,7 @@ def typecall(pytype cls, *args, **kwds): EXAMPLES:: sage: from sage.misc.classcall_metaclass import typecall - sage: class Foo(object): pass + sage: class Foo(): pass sage: typecall(Foo) <__main__.Foo object at 0x...> sage: typecall(list) @@ -473,7 +473,7 @@ def typecall(pytype cls, *args, **kwds): # Class for timing:: -class CRef(object): +class CRef(): def __init__(self, i): """ TESTS:: @@ -538,7 +538,7 @@ def timeCall(T, int n, *args): 625 loops, best of 3: 41.4 µs per loop sage: i1 = int(1); i3 = int(3) # don't use Sage's Integer - sage: class PRef(object): + sage: class PRef(): ....: def __init__(self, i): ....: self.i = i+i1 diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py index a41c8413bb8..28c52448813 100644 --- a/src/sage/misc/decorators.py +++ b/src/sage/misc/decorators.py @@ -175,7 +175,7 @@ def f(wrapper, assigned=assigned, updated=updated): # Infix operator decorator -class infix_operator(object): +class infix_operator(): """ A decorator for functions which allows for a hack that makes the function behave like an infix operator. @@ -256,7 +256,7 @@ def __call__(self, func): return wrapper_inst -class _infix_wrapper(object): +class _infix_wrapper(): function = None def __init__(self, left=None, right=None): @@ -345,7 +345,7 @@ def my_wrap(*args, **kwds): return my_wrap -class suboptions(object): +class suboptions(): def __init__(self, name, **options): """ A decorator for functions which collects all keywords @@ -428,7 +428,7 @@ def listForNone(l): return wrapper -class options(object): +class options(): def __init__(self, **options): """ A decorator for functions which allows for default options to be @@ -566,7 +566,7 @@ def reset(): return wrapper -class rename_keyword(object): +class rename_keyword(): def __init__(self, deprecated=None, deprecation=None, **renames): """ A decorator which renames keyword arguments and optionally diff --git a/src/sage/misc/element_with_label.py b/src/sage/misc/element_with_label.py index c2f513bdab8..2410851c7de 100644 --- a/src/sage/misc/element_with_label.py +++ b/src/sage/misc/element_with_label.py @@ -15,7 +15,7 @@ from sage.misc.latex import latex -class ElementWithLabel(object): +class ElementWithLabel(): """ Auxiliary class for showing/viewing :class:`Poset`s with non-injective labelings. diff --git a/src/sage/misc/explain_pickle.py b/src/sage/misc/explain_pickle.py index 946dd8057c0..b8fe3e93fe4 100644 --- a/src/sage/misc/explain_pickle.py +++ b/src/sage/misc/explain_pickle.py @@ -320,7 +320,7 @@ def name_is_valid(name): # This string is used as the representation of a mark. the_mark = 'mark' -class PickleObject(object): +class PickleObject(): r""" Pickles have a stack-based virtual machine. The explain_pickle pickle interpreter mostly uses SageInputExpressions, from sage_input, @@ -374,7 +374,7 @@ def _sage_input_(self, sib, coerced): self.immutable = True return self.expression -class PickleDict(object): +class PickleDict(): r""" An object which can be used as the value of a PickleObject. The items is a list of key-value pairs, where the keys and values are @@ -394,7 +394,7 @@ def __init__(self, items): """ self.items = items -class PickleInstance(object): +class PickleInstance(): r""" An object which can be used as the value of a PickleObject. Unlike other possible values of a PickleObject, a PickleInstance doesn't represent @@ -412,7 +412,7 @@ def __init__(self, klass): """ self.klass = klass -class PickleExplainer(object): +class PickleExplainer(): r""" An interpreter for the pickle virtual machine, that executes symbolically and constructs SageInputExpressions instead of @@ -2697,7 +2697,7 @@ def __hash__(self): return 0 -class EmptyNewstyleClass(object): +class EmptyNewstyleClass(): r""" A featureless new-style class (inherits from object); used for testing explain_pickle. @@ -2858,7 +2858,7 @@ def extend(self): raise NotImplementedError -class TestAppendNonlist(object): +class TestAppendNonlist(): r""" A list-like class, carefully designed to test exact unpickling behavior. Used for testing explain_pickle. @@ -2942,7 +2942,7 @@ def __repr__(self): return repr(self.list) -class TestBuild(object): +class TestBuild(): r""" A simple class with a __getstate__ but no __setstate__. Used for testing explain_pickle. @@ -3001,7 +3001,7 @@ def __setstate__(self, state): self.x = state[1]['y'] self.y = state[0]['x'] -class TestGlobalOldName(object): +class TestGlobalOldName(): r""" A featureless new-style class. When you try to unpickle an instance of this class, it is redirected to create a TestGlobalNewName instead. @@ -3016,7 +3016,7 @@ class TestGlobalOldName(object): pass -class TestGlobalNewName(object): +class TestGlobalNewName(): r""" A featureless new-style class. When you try to unpickle an instance of TestGlobalOldName, it is redirected to create an instance of this @@ -3048,7 +3048,7 @@ def __repr__(self): register_unpickle_override('sage.misc.explain_pickle', 'TestGlobalOldName', TestGlobalNewName, call_name=('sage.misc.explain_pickle', 'TestGlobalNewName')) -class TestGlobalFunnyName(object): +class TestGlobalFunnyName(): r""" A featureless new-style class which has a name that's not a legal Python identifier. diff --git a/src/sage/misc/inherit_comparison.pyx b/src/sage/misc/inherit_comparison.pyx index fc360533cad..a8306e83453 100644 --- a/src/sage/misc/inherit_comparison.pyx +++ b/src/sage/misc/inherit_comparison.pyx @@ -54,7 +54,7 @@ cdef class InheritComparisonMetaclass(type): sage: cython(''' ....: from sage.misc.inherit_comparison cimport InheritComparisonMetaclass ....: - ....: cdef class Base(object): + ....: cdef class Base(): ....: def __richcmp__(left, right, int op): ....: print("Calling Base.__richcmp__") ....: return left is right diff --git a/src/sage/misc/instancedoc.pyx b/src/sage/misc/instancedoc.pyx index a58fde0e081..91923bd905f 100644 --- a/src/sage/misc/instancedoc.pyx +++ b/src/sage/misc/instancedoc.pyx @@ -24,7 +24,7 @@ EXAMPLES:: sage: from sage.misc.instancedoc import instancedoc sage: @instancedoc - ....: class X(object): + ....: class X(): ....: "Class docstring" ....: def _instancedoc_(self): ....: return "Instance docstring" @@ -89,7 +89,7 @@ Check that inheritance works (after passing the subclass to :func:`instancedoc`):: sage: @instancedoc - ....: class A(object): + ....: class A(): ....: "Class A docstring" ....: def _instancedoc_(self): ....: return "Instance docstring" @@ -148,7 +148,7 @@ cdef class InstanceDocDescriptor: sage: def instancedoc(self): ....: return "Instance doc" sage: docattr = InstanceDocDescriptor("Class doc", instancedoc) - sage: class Z(object): + sage: class Z(): ....: __doc__ = InstanceDocDescriptor("Class doc", instancedoc) sage: Z.__doc__ 'Class doc' @@ -218,7 +218,7 @@ cdef class InstanceDocDescriptor: sage: def instancedoc(self): ....: return "Doc for {!r}".format(self) sage: descr = InstanceDocDescriptor("Class doc", instancedoc) - sage: class X(object): pass + sage: class X(): pass sage: obj = X() sage: descr.__set__(obj, "Custom doc") sage: obj.__doc__ @@ -246,7 +246,7 @@ cdef class InstanceDocDescriptor: sage: def instancedoc(self): ....: return "Doc for {!r}".format(self) sage: descr = InstanceDocDescriptor("Class doc", instancedoc) - sage: class X(object): pass + sage: class X(): pass sage: obj = X() sage: obj.__doc__ = "Custom doc" sage: descr.__delete__(obj) @@ -261,7 +261,7 @@ cdef class InstanceDocDescriptor: Traceback (most recent call last): ... AttributeError: attribute '__doc__' of 'list' objects is not writable - sage: descr.__delete__(object) + sage: descr.__delete__() Traceback (most recent call last): ... AttributeError: attribute '__doc__' of 'type' objects is not writable @@ -297,7 +297,7 @@ def instancedoc(cls): We get a useful error message if ``_instancedoc_`` is not defined:: sage: from sage.misc.instancedoc import instancedoc - sage: class X(object): pass + sage: class X(): pass sage: instancedoc(X) Traceback (most recent call last): ... diff --git a/src/sage/misc/lazy_attribute.pyx b/src/sage/misc/lazy_attribute.pyx index c6e7b5110bb..5d2f3fcee88 100644 --- a/src/sage/misc/lazy_attribute.pyx +++ b/src/sage/misc/lazy_attribute.pyx @@ -22,7 +22,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -cdef class _lazy_attribute(object): +cdef class _lazy_attribute(): """ Cython base class for lazy attributes. @@ -163,7 +163,7 @@ class lazy_attribute(_lazy_attribute): We create a class whose instances have a lazy attribute ``x``:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self.a=2 # just to have some data to calculate from ....: @@ -262,7 +262,7 @@ class lazy_attribute(_lazy_attribute): all possible without a special implementation of hasattr, so as to allow for something like:: - sage: class A (object): + sage: class A (): ....: @lazy_attribute ....: def x(self, existence_only=False): ....: if existence_only: @@ -366,11 +366,11 @@ class lazy_attribute(_lazy_attribute): w.r.t. inheritance, and maybe even ill-implemented. We illustrate this on a simple class hierarchy, with an instrumented descriptor:: - sage: class descriptor(object): + sage: class descriptor(): ....: def __get__(self, obj, cls): ....: print(cls) ....: return 1 - sage: class A(object): + sage: class A(): ....: x = descriptor() sage: class B(A): ....: pass @@ -402,7 +402,7 @@ class lazy_attribute(_lazy_attribute): Due to this, the natural implementation runs into an infinite loop in the following example:: - sage: class A(object): + sage: class A(): ....: @lazy_attribute ....: def unimplemented_A(self): ....: return NotImplemented @@ -518,7 +518,7 @@ class lazy_class_attribute(lazy_attribute): attribute is stored in the class rather than in the object. The lazy class attribute is only computed once for all the objects:: - sage: class Cl(object): + sage: class Cl(): ....: @lazy_class_attribute ....: def x(cls): ....: print("computing x") @@ -538,7 +538,7 @@ class lazy_class_attribute(lazy_attribute): First access from an object also properly triggers the computation:: - sage: class Cl1(object): + sage: class Cl1(): ....: @lazy_class_attribute ....: def x(cls): ....: print("computing x") @@ -554,7 +554,7 @@ class lazy_class_attribute(lazy_attribute): The behavior of lazy class attributes with respect to inheritance is not specified. It currently depends on the evaluation order:: - sage: class A(object): + sage: class A(): ....: @lazy_class_attribute ....: def x(cls): ....: print("computing x") diff --git a/src/sage/misc/lazy_format.py b/src/sage/misc/lazy_format.py index 88eb8798841..4a529aa1bc6 100644 --- a/src/sage/misc/lazy_format.py +++ b/src/sage/misc/lazy_format.py @@ -29,7 +29,7 @@ class LazyFormat(str): To demonstrate the lazyness, let us build an object with a broken ``__repr__`` method:: - sage: class IDontLikeBeingPrinted(object): + sage: class IDontLikeBeingPrinted(): ....: def __repr__(self): ....: raise ValueError("Don't ever try to print me !") diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx index bc6078d24f2..ffb53ac3d59 100644 --- a/src/sage/misc/lazy_import.pyx +++ b/src/sage/misc/lazy_import.pyx @@ -161,7 +161,7 @@ cpdef test_fake_startup(): @cython.final -cdef class LazyImport(object): +cdef class LazyImport(): """ EXAMPLES:: @@ -477,7 +477,7 @@ cdef class LazyImport(object): Now we lazy import it as a method of a new class ``Foo``:: sage: from sage.misc.lazy_import import LazyImport - sage: class Foo(object): + sage: class Foo(): ....: my_method = LazyImport('sage.all', 'my_method') Now we can use it as a usual method:: @@ -503,7 +503,7 @@ cdef class LazyImport(object): definition is not the one that actually gets used. Thus, ``__get__`` needs to manually modify the class dict:: - sage: class Foo(object): + sage: class Foo(): ....: lazy_import('sage.all', 'plot') sage: class Bar(Foo): ....: pass @@ -1013,7 +1013,7 @@ def lazy_import(module, names, as_=None, *, We check that :func:`lazy_import` also works for methods:: - sage: class Foo(object): + sage: class Foo(): ....: lazy_import('sage.all', 'plot') sage: class Bar(Foo): ....: pass diff --git a/src/sage/misc/lazy_list.pxd b/src/sage/misc/lazy_list.pxd index 944edbf9684..f8b51b47835 100644 --- a/src/sage/misc/lazy_list.pxd +++ b/src/sage/misc/lazy_list.pxd @@ -1,4 +1,4 @@ -cdef class lazy_list_generic(object): +cdef class lazy_list_generic(): cdef list cache # the cache cdef lazy_list_generic master # a reference if self is a slice cdef Py_ssize_t start, stop, step diff --git a/src/sage/misc/lazy_list.pyx b/src/sage/misc/lazy_list.pyx index b1698ddd4bc..4e25ee39299 100644 --- a/src/sage/misc/lazy_list.pyx +++ b/src/sage/misc/lazy_list.pyx @@ -348,7 +348,7 @@ def lazy_list_formatter(L, name='lazy list', return s -cdef class lazy_list_generic(object): +cdef class lazy_list_generic(): r""" A lazy list diff --git a/src/sage/misc/lazy_string.pxd b/src/sage/misc/lazy_string.pxd index cde0aa1e73d..7f7354e03ca 100644 --- a/src/sage/misc/lazy_string.pxd +++ b/src/sage/misc/lazy_string.pxd @@ -1,4 +1,4 @@ -cdef class _LazyString(object): +cdef class _LazyString(): cdef func cdef args cdef kwargs diff --git a/src/sage/misc/lazy_string.pyx b/src/sage/misc/lazy_string.pyx index bfb5b29501b..9eaa0c8c8e5 100644 --- a/src/sage/misc/lazy_string.pyx +++ b/src/sage/misc/lazy_string.pyx @@ -136,7 +136,7 @@ def _make_lazy_string(ftype, fpickle, args, kwargs): f = fpickle return _LazyString(f, args, kwargs) -cdef class _LazyString(object): +cdef class _LazyString(): """ Lazy class for strings created by a function call or a format string. diff --git a/src/sage/misc/misc.py b/src/sage/misc/misc.py index 93f2bebdb55..da354511413 100644 --- a/src/sage/misc/misc.py +++ b/src/sage/misc/misc.py @@ -176,7 +176,7 @@ def try_read(obj, splitlines=False): Custom readable:: - sage: class MyFile(object): + sage: class MyFile(): ....: def read(self): return 'Hello world!' sage: try_read(MyFile()) 'Hello world!' diff --git a/src/sage/misc/nested_class.pyx b/src/sage/misc/nested_class.pyx index d27ec59923b..f30eec835ee 100644 --- a/src/sage/misc/nested_class.pyx +++ b/src/sage/misc/nested_class.pyx @@ -118,8 +118,8 @@ cpdef modify_for_nested_pickle(cls, str name_prefix, module, first_run=True): EXAMPLES:: sage: from sage.misc.nested_class import * - sage: class A(object): - ....: class B(object): + sage: class A(): + ....: class B(): ....: pass sage: module = sys.modules['__main__'] sage: A.B.__name__ @@ -220,7 +220,7 @@ def nested_pickle(cls): sage: from sage.misc.nested_class import nested_pickle sage: module = sys.modules['__main__'] - sage: class A(object): + sage: class A(): ....: class B: ....: pass sage: nested_pickle(A) @@ -238,7 +238,7 @@ def nested_pickle(cls): should work as a decorator:: sage: @nested_pickle # todo: not implemented - ....: class A2(object): + ....: class A2(): ....: class B: ....: pass sage: A2.B.__name__ # todo: not implemented @@ -267,7 +267,7 @@ cdef class NestedClassMetaclass(type): sage: class ASuperClass(object, metaclass=NestedClassMetaclass): ....: pass sage: class A3(ASuperClass): - ....: class B(object): + ....: class B(): ....: pass sage: A3.B.__name__ 'A3.B' @@ -282,7 +282,7 @@ cdef class NestedClassMetaclass(type): sage: from sage.misc.nested_class import NestedClassMetaclass sage: class A(object, metaclass=NestedClassMetaclass): - ....: class B(object): + ....: class B(): ....: pass sage: A.B @@ -303,7 +303,7 @@ class MainClass(object, metaclass=NestedClassMetaclass): """ - class NestedClass(object): + class NestedClass(): r""" EXAMPLES:: @@ -312,7 +312,7 @@ class MainClass(object, metaclass=NestedClassMetaclass): """ - class NestedSubClass(object): + class NestedSubClass(): r""" EXAMPLES:: @@ -362,7 +362,7 @@ nested_pickle(SubClass) def _provide_SubClass(): return SubClass -class CopiedClass(object): +class CopiedClass(): r""" A simple class to test nested_pickle. diff --git a/src/sage/misc/object_multiplexer.py b/src/sage/misc/object_multiplexer.py index dcb482b8df2..d4e811ef16e 100644 --- a/src/sage/misc/object_multiplexer.py +++ b/src/sage/misc/object_multiplexer.py @@ -21,7 +21,7 @@ # **************************************************************************** -class MultiplexFunction(object): +class MultiplexFunction(): """ A simple wrapper object for functions that are called on a list of objects. @@ -57,7 +57,7 @@ def __call__(self, *args, **kwds): return tuple(l) -class Multiplex(object): +class Multiplex(): """ Object for a list of children such that function calls on this new object implies that the same function is called on all diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx index b71d7a32fc5..3ac5f1cc2b0 100644 --- a/src/sage/misc/persist.pyx +++ b/src/sage/misc/persist.pyx @@ -449,12 +449,12 @@ def register_unpickle_override(module, name, callable, call_name=None): :: - sage: class A(object): + sage: class A(): ....: def __init__(self,value): ....: self.original_attribute = value ....: def __repr__(self): ....: return 'A(%s)' % self.original_attribute - sage: class B(object): + sage: class B(): ....: def __init__(self,value): ....: self.new_attribute = value ....: def __setstate__(self,state): @@ -759,7 +759,7 @@ class SagePickler(_BasePickler): The following is an indirect doctest. :: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, s): ....: self.bar = s ....: def __reduce__(self): @@ -949,7 +949,7 @@ def loads(s, compress=True, **kwargs): in a pickle. See :trac:`28444` for details. :: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, s): ....: self.bar = s ....: def __reduce__(self): diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py index 56286232257..57cfbe78751 100644 --- a/src/sage/misc/sage_input.py +++ b/src/sage/misc/sage_input.py @@ -1200,7 +1200,7 @@ def result(self, e): _prec_funcall = 40 _prec_atomic = 42 -class SageInputExpression(object): +class SageInputExpression(): r""" Subclasses of this class represent expressions for :func:`sage_input`. \sage classes should define a \method{_sage_input_} method, which diff --git a/src/sage/misc/sage_timeit.py b/src/sage/misc/sage_timeit.py index f2542ad5144..8250b461dd4 100644 --- a/src/sage/misc/sage_timeit.py +++ b/src/sage/misc/sage_timeit.py @@ -18,7 +18,7 @@ """ -class SageTimeitResult(object): +class SageTimeitResult(): r""" Represent the statistics of a timeit() command. diff --git a/src/sage/misc/sage_unittest.py b/src/sage/misc/sage_unittest.py index c6c6d2741dc..da99c3ea92d 100644 --- a/src/sage/misc/sage_unittest.py +++ b/src/sage/misc/sage_unittest.py @@ -17,7 +17,7 @@ import traceback -class TestSuite(object): +class TestSuite(): """ Test suites for Sage objects. @@ -576,7 +576,7 @@ def some_elements(self, S=None, repeat=None): return list(some_tuples(S, repeat, self._max_runs, self._max_samples)) -class PythonObjectWithTests(object): +class PythonObjectWithTests(): """ Utility class for running basis tests on a plain Python object (that is not in SageObject). More test methods can be added here. diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 87df80ef514..67fc9165af8 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -1885,7 +1885,7 @@ def _sage_getdoc_unformatted(obj): ``__doc__`` attribute. This should not give an error in ``_sage_getdoc_unformatted``, see :trac:`19671`:: - sage: class NoSageDoc(object): + sage: class NoSageDoc(): ....: @property ....: def __doc__(self): ....: raise Exception("no doc here") @@ -2270,7 +2270,7 @@ def sage_getsourcelines(obj): sage: sage_getsourcelines(cachedfib)[0][0] 'def fibonacci(n, algorithm="pari") -> Integer:\n' sage: sage_getsourcelines(type(cachedfib))[0][0] - 'cdef class CachedFunction(object):\n' + 'cdef class CachedFunction():\n' TESTS:: @@ -2323,13 +2323,13 @@ def sage_getsourcelines(obj): (, ) sage: print(sage_getsource(E)) - class Element(object): + class Element(): "This is a dummy element class" pass sage: print(sage_getsource(P)) class TestNestedParent(UniqueRepresentation, Parent): ... - class Element(object): + class Element(): "This is a dummy element class" pass diff --git a/src/sage/misc/superseded.py b/src/sage/misc/superseded.py index 0d20e025a23..f3599b00fd9 100644 --- a/src/sage/misc/superseded.py +++ b/src/sage/misc/superseded.py @@ -215,7 +215,7 @@ def experimental_warning(trac_number, message, stacklevel=4): warning(trac_number, message, FutureWarning, stacklevel) -class experimental(object): +class experimental(): def __init__(self, trac_number, stacklevel=4): """ A decorator which warns about the experimental/unstable status of @@ -320,7 +320,7 @@ def wrapper(*args, **kwds): return wrapper -class __experimental_self_test(object): +class __experimental_self_test(): r""" This is a class only to demonstrate with a doc-test that the @experimental decorator only issues a warning message once (see :trac:`20601`). @@ -341,7 +341,7 @@ def __init__(self, x): print("I'm " + x) -class DeprecatedFunctionAlias(object): +class DeprecatedFunctionAlias(): """ A wrapper around methods or functions which automatically prints a deprecation message. See :func:`deprecated_function_alias`. @@ -391,7 +391,7 @@ def __name__(self): 'g' sage: from sage.misc.superseded import deprecated_function_alias - sage: class cls(object): + sage: class cls(): ....: def new_meth(self): return 42 ....: old_meth = deprecated_function_alias(13109, new_meth) sage: cls.old_meth.__name__ @@ -401,7 +401,7 @@ def __name__(self): sage: cython('\n'.join([ ....: r"from sage.misc.superseded import deprecated_function_alias", - ....: r"cdef class cython_cls(object):", + ....: r"cdef class cython_cls():", ....: r" def new_cython_meth(self):", ....: r" return 1", ....: r" old_cython_meth = deprecated_function_alias(13109, new_cython_meth)" @@ -464,7 +464,7 @@ def __get__(self, inst, cls=None): TESTS:: sage: from sage.misc.superseded import deprecated_function_alias - sage: class cls(object): + sage: class cls(): ....: def new_meth(self): return 42 ....: old_meth = deprecated_function_alias(13109, new_meth) sage: obj = cls() @@ -526,7 +526,7 @@ def deprecated_function_alias(trac_number, func): This also works for methods:: - sage: class cls(object): + sage: class cls(): ....: def new_meth(self): return 42 ....: old_meth = deprecated_function_alias(13109, new_meth) sage: cls().old_meth() diff --git a/src/sage/misc/temporary_file.py b/src/sage/misc/temporary_file.py index 461776e82f4..506bc925784 100644 --- a/src/sage/misc/temporary_file.py +++ b/src/sage/misc/temporary_file.py @@ -166,7 +166,7 @@ def tmp_filename(name="tmp_", ext=""): ################################################################# # write to a temporary file and move it in place ################################################################# -class atomic_write(object): +class atomic_write(): """ Write to a given file using a temporary file and then rename it to the target file. This renaming should be atomic on modern @@ -445,7 +445,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): ################################################################# # write to a temporary directory and move it in place ################################################################# -class atomic_dir(object): +class atomic_dir(): """ Write to a given directory using a temporary directory and then rename it to the target directory. This is for creating a directory whose contents diff --git a/src/sage/misc/test_nested_class.py b/src/sage/misc/test_nested_class.py index 8e0c1ddf0c1..55973bd05b3 100644 --- a/src/sage/misc/test_nested_class.py +++ b/src/sage/misc/test_nested_class.py @@ -150,15 +150,15 @@ class Element(ElementWrapper): # Class for tests: -class B(object): +class B(): """ A normal external class. """ pass -class ABB(object): - class B(object): +class ABB(): + class B(): """ This class is broken and can't be pickled. A warning is emmited during compilation. @@ -166,18 +166,18 @@ class B(object): pass -class ABL(object): +class ABL(): """ There is no problem here. """ B = B -class ALB(object): +class ALB(): """ There is a nested class just below. Which can't be properly sphinxed. """ - class C(object): + class C(): """ Internal C class. @@ -190,7 +190,7 @@ class C(object): class ABBMeta(metaclass=NestedClassMetaclass): - class B(object): + class B(): """ B interne """ @@ -205,7 +205,7 @@ class ALBMeta(metaclass=NestedClassMetaclass): """ There is a nested class just below which is properly sphinxed. """ - class CMeta(object): + class CMeta(): """ B interne """ @@ -222,6 +222,6 @@ class TestNestedParent(UniqueRepresentation, Parent): See the test in ``sage.misc.sageinspect.sage_getsourcelines``. """ - class Element(object): + class Element(): "This is a dummy element class" pass diff --git a/src/sage/misc/weak_dict.pyx b/src/sage/misc/weak_dict.pyx index 77a3c626bbe..ac7bf3bbbd2 100644 --- a/src/sage/misc/weak_dict.pyx +++ b/src/sage/misc/weak_dict.pyx @@ -18,7 +18,7 @@ However, a problem arises if hash and comparison of the key depend on the value that is being garbage collected:: sage: import weakref - sage: class Vals(object): pass + sage: class Vals(): pass sage: class Keys: ....: def __init__(self, val): ....: self.val = weakref.ref(val) @@ -239,7 +239,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: sage: import weakref - sage: class Vals(object): pass + sage: class Vals(): pass sage: class Keys: ....: def __init__(self, val): ....: self.val = weakref.ref(val) @@ -289,7 +289,7 @@ cdef class WeakValueDictionary(dict): The following is a stress test for weak value dictionaries:: - sage: class C(object): + sage: class C(): ....: def __init__(self, n): ....: self.n = n ....: def __lt__(self, other): @@ -383,7 +383,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: - sage: class C(object): pass + sage: class C(): pass sage: V = [C(),C()] sage: D = sage.misc.weak_dict.WeakValueDictionary() sage: D[C()] = V[0] @@ -714,7 +714,7 @@ cdef class WeakValueDictionary(dict): TESTS:: sage: import sage.misc.weak_dict - sage: class Vals(object): pass + sage: class Vals(): pass sage: L = [Vals() for _ in range(10)] sage: D = sage.misc.weak_dict.WeakValueDictionary(enumerate(L)) sage: 3 in D # indirect doctest @@ -762,7 +762,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: sage: import sage.misc.weak_dict - sage: class Vals(object): pass + sage: class Vals(): pass sage: L = [Vals() for _ in range(10)] sage: D = sage.misc.weak_dict.WeakValueDictionary(enumerate(L)) sage: del L[4] @@ -795,7 +795,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: sage: import sage.misc.weak_dict - sage: class Vals(object): pass + sage: class Vals(): pass sage: L = [Vals() for _ in range(10)] sage: D = sage.misc.weak_dict.WeakValueDictionary(enumerate(L)) sage: del L[4] @@ -922,7 +922,7 @@ cdef class WeakValueDictionary(dict): ....: return self.n == other.n ....: def __ne__(self, other): ....: return self.val() != other.val() - sage: class Keys(object): + sage: class Keys(): ....: def __init__(self, n): ....: self.n = n ....: def __hash__(self): @@ -988,7 +988,7 @@ cdef class WeakValueDictionary(dict): ....: return self.n == other.n ....: def __ne__(self, other): ....: return self.val() != other.val() - sage: class Keys(object): + sage: class Keys(): ....: def __init__(self, n): ....: self.n = n ....: def __hash__(self): @@ -1098,7 +1098,7 @@ cdef class CachedWeakValueDictionary(WeakValueDictionary): sage: from sage.misc.weak_dict import WeakValueDictionary sage: D = WeakValueDictionary() - sage: class Test(object): pass + sage: class Test(): pass sage: tmp = Test() sage: D[0] = tmp sage: 0 in D @@ -1116,7 +1116,7 @@ cdef class CachedWeakValueDictionary(WeakValueDictionary): sage: from sage.misc.weak_dict import CachedWeakValueDictionary sage: D = CachedWeakValueDictionary(cache=4) - sage: class Test(object): pass + sage: class Test(): pass sage: tmp = Test() sage: D[0] = tmp sage: 0 in D @@ -1172,7 +1172,7 @@ cdef class CachedWeakValueDictionary(WeakValueDictionary): :class:`WeakValueDictionary`:: sage: D = CachedWeakValueDictionary(cache=0) - sage: class Test(object): pass + sage: class Test(): pass sage: tmp = Test() sage: D[0] = tmp sage: del tmp diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py index 94f882ee933..1f2aeb27692 100644 --- a/src/sage/repl/configuration.py +++ b/src/sage/repl/configuration.py @@ -36,7 +36,7 @@ SAGE_EXTENSION = 'sage' -class SageIpythonConfiguration(object): +class SageIpythonConfiguration(): def _doctest_mode(self): """ diff --git a/src/sage/repl/display/fancy_repr.py b/src/sage/repl/display/fancy_repr.py index a606b5ef277..5c1191dc4f1 100644 --- a/src/sage/repl/display/fancy_repr.py +++ b/src/sage/repl/display/fancy_repr.py @@ -24,7 +24,7 @@ _baseclass_reprs = (object.__repr__,) -class ObjectReprABC(object): +class ObjectReprABC(): """ The abstract base class of an object representer. @@ -248,7 +248,7 @@ def __call__(self, obj, p, cycle): trailing newline, and if we don't display it you can't fix it:: - sage: class Newline(object): + sage: class Newline(): ....: def __repr__(self): ....: return 'newline\n' sage: n = Newline() @@ -317,7 +317,7 @@ def __call__(self, obj, p, cycle): Check that :trac:`18743` is fixed:: - sage: class Foo(object): + sage: class Foo(): ....: def __repr__(self): ....: return '''BBB AA RRR ....: B B A A R R diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py index 9cb0bd661ea..adde08d27d2 100644 --- a/src/sage/repl/display/formatter.py +++ b/src/sage/repl/display/formatter.py @@ -177,7 +177,7 @@ def format(self, obj, include=None, exclude=None): Test that ``__repr__`` is only called once when generating text output:: - sage: class Repper(object): + sage: class Repper(): ....: def __repr__(self): ....: print('__repr__ called') ....: return 'I am repper' diff --git a/src/sage/repl/display/util.py b/src/sage/repl/display/util.py index 7f6997211fd..ee99782b6fa 100644 --- a/src/sage/repl/display/util.py +++ b/src/sage/repl/display/util.py @@ -16,7 +16,7 @@ #***************************************************************************** -class TallListFormatter(object): +class TallListFormatter(): """ Special representation for lists with tall entries (e.g. matrices) diff --git a/src/sage/repl/interface_magic.py b/src/sage/repl/interface_magic.py index a93e1c9e04c..df4b1020a2a 100644 --- a/src/sage/repl/interface_magic.py +++ b/src/sage/repl/interface_magic.py @@ -79,7 +79,7 @@ """ -class InterfaceMagic(object): +class InterfaceMagic(): @classmethod def all_iter(cls): diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py index 84f90fca75d..2d48b2b4802 100644 --- a/src/sage/repl/interpreter.py +++ b/src/sage/repl/interpreter.py @@ -185,7 +185,7 @@ def preparser(on=True): ############################## # Sage[Terminal]InteractiveShell ############################## -class SageShellOverride(object): +class SageShellOverride(): """ Mixin to override methods in IPython's [Terminal]InteractiveShell classes. @@ -487,11 +487,11 @@ def __init__(self, *args, **kwds): def preparse_imports_from_sage(self, line): """ - Finds occurrences of strings such as ``sage(object)`` in + Finds occurrences of strings such as ``sage()`` in *line*, converts ``object`` to :attr:`shell.interface`, and replaces those strings with their identifier in the new system. This also works with strings such as - ``maxima(object)`` if :attr:`shell.interface` is + ``maxima()`` if :attr:`shell.interface` is ``maxima``. :param line: the line to transform diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py index eb508b067f5..fc39f079cc0 100644 --- a/src/sage/repl/ipython_extension.py +++ b/src/sage/repl/ipython_extension.py @@ -416,7 +416,7 @@ def fortran(self, line, cell): return fortran(cell) -class SageCustomizations(object): +class SageCustomizations(): def __init__(self, shell=None): """ diff --git a/src/sage/repl/ipython_kernel/install.py b/src/sage/repl/ipython_kernel/install.py index 684139afb66..cfb11b51bcf 100644 --- a/src/sage/repl/ipython_kernel/install.py +++ b/src/sage/repl/ipython_kernel/install.py @@ -25,7 +25,7 @@ ) -class SageKernelSpec(object): +class SageKernelSpec(): def __init__(self, prefix=None): """ diff --git a/src/sage/repl/ipython_kernel/widgets.py b/src/sage/repl/ipython_kernel/widgets.py index d28594cd24d..dfe126a2760 100644 --- a/src/sage/repl/ipython_kernel/widgets.py +++ b/src/sage/repl/ipython_kernel/widgets.py @@ -83,7 +83,7 @@ def description(self, value): pass -class TransformWidget(object): +class TransformWidget(): """ A mixin class for a widget to transform the bare widget value for use in interactive functions. diff --git a/src/sage/repl/rich_output/display_manager.py b/src/sage/repl/rich_output/display_manager.py index 62a3adf05c4..f022335f8e6 100644 --- a/src/sage/repl/rich_output/display_manager.py +++ b/src/sage/repl/rich_output/display_manager.py @@ -118,7 +118,7 @@ class RichReprWarning(UserWarning): pass -class restricted_output(object): +class restricted_output(): def __init__(self, display_manager, output_classes): """ From c27f1f50853e4be95e2249df9f1c3b712766b68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 15:07:07 +0200 Subject: [PATCH 204/338] also no class(object) in libs/ --- src/sage/libs/coxeter3/coxeter.pyx | 2 +- src/sage/libs/gap/element.pxd | 2 +- src/sage/libs/gap/element.pyx | 2 +- src/sage/libs/gap/util.pxd | 2 +- src/sage/libs/gap/util.pyx | 2 +- src/sage/libs/ntl/ntl_GF2.pxd | 2 +- src/sage/libs/ntl/ntl_GF2.pyx | 2 +- src/sage/libs/ntl/ntl_GF2E.pxd | 2 +- src/sage/libs/ntl/ntl_GF2E.pyx | 2 +- src/sage/libs/ntl/ntl_GF2EContext.pxd | 2 +- src/sage/libs/ntl/ntl_GF2EContext.pyx | 2 +- src/sage/libs/ntl/ntl_GF2EX.pxd | 2 +- src/sage/libs/ntl/ntl_GF2EX.pyx | 2 +- src/sage/libs/ntl/ntl_GF2X.pxd | 2 +- src/sage/libs/ntl/ntl_GF2X.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ.pxd | 2 +- src/sage/libs/ntl/ntl_ZZ.pyx | 2 +- src/sage/libs/ntl/ntl_ZZX.pxd | 2 +- src/sage/libs/ntl/ntl_ZZX.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_p.pxd | 2 +- src/sage/libs/ntl/ntl_ZZ_p.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pContext.pxd | 4 ++-- src/sage/libs/ntl/ntl_ZZ_pContext.pyx | 4 ++-- src/sage/libs/ntl/ntl_ZZ_pE.pxd | 2 +- src/sage/libs/ntl/ntl_ZZ_pE.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pEContext.pxd | 2 +- src/sage/libs/ntl/ntl_ZZ_pEContext.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pEX.pxd | 2 +- src/sage/libs/ntl/ntl_ZZ_pEX.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pX.pxd | 4 ++-- src/sage/libs/ntl/ntl_ZZ_pX.pyx | 4 ++-- src/sage/libs/ntl/ntl_lzz_p.pxd | 2 +- src/sage/libs/ntl/ntl_lzz_p.pyx | 2 +- src/sage/libs/ntl/ntl_lzz_pContext.pxd | 2 +- src/sage/libs/ntl/ntl_lzz_pContext.pyx | 2 +- src/sage/libs/ntl/ntl_lzz_pX.pxd | 2 +- src/sage/libs/ntl/ntl_lzz_pX.pyx | 2 +- src/sage/libs/ntl/ntl_mat_GF2.pxd | 2 +- src/sage/libs/ntl/ntl_mat_GF2.pyx | 2 +- src/sage/libs/ntl/ntl_mat_GF2E.pxd | 2 +- src/sage/libs/ntl/ntl_mat_GF2E.pyx | 2 +- src/sage/libs/ntl/ntl_mat_ZZ.pxd | 2 +- src/sage/libs/ntl/ntl_mat_ZZ.pyx | 2 +- src/sage/libs/singular/function_factory.py | 2 +- src/sage/libs/singular/ring.pyx | 2 +- 45 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/sage/libs/coxeter3/coxeter.pyx b/src/sage/libs/coxeter3/coxeter.pyx index 603261f7661..533c35b6a40 100644 --- a/src/sage/libs/coxeter3/coxeter.pyx +++ b/src/sage/libs/coxeter3/coxeter.pyx @@ -1144,7 +1144,7 @@ cdef LFlags_to_list(CoxGroup parent, LFlags f): f1 = f1 & (f1-1) return l -class CoxGroupIterator(object): +class CoxGroupIterator(): def __init__(self, group): """ A class used to iterate over all of the elements of a Coxeter group. diff --git a/src/sage/libs/gap/element.pxd b/src/sage/libs/gap/element.pxd index 84dc49d8110..a1bf8118d4f 100644 --- a/src/sage/libs/gap/element.pxd +++ b/src/sage/libs/gap/element.pxd @@ -89,7 +89,7 @@ cdef class GapElement_MethodProxy(GapElement_Function): cdef class GapElement_Record(GapElement): cpdef UInt record_name_to_index(self, name) -cdef class GapElement_RecordIterator(object): +cdef class GapElement_RecordIterator(): cdef GapElement_Record rec cdef UInt i diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index 0c12bc4d9e7..be43c4c3ee0 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -3246,7 +3246,7 @@ cdef class GapElement_Record(GapElement): return result -cdef class GapElement_RecordIterator(object): +cdef class GapElement_RecordIterator(): r""" Iterator for :class:`GapElement_Record` diff --git a/src/sage/libs/gap/util.pxd b/src/sage/libs/gap/util.pxd index 986a2db45c2..118146133f4 100644 --- a/src/sage/libs/gap/util.pxd +++ b/src/sage/libs/gap/util.pxd @@ -14,7 +14,7 @@ from .gap_includes cimport Obj ### Hooking into the GAP memory management ################################# ############################################################################ -cdef class ObjWrapper(object): +cdef class ObjWrapper(): cdef Obj value cdef ObjWrapper wrap_obj(Obj obj) diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx index 08c4c40cc01..9d5d793a57f 100644 --- a/src/sage/libs/gap/util.pyx +++ b/src/sage/libs/gap/util.pyx @@ -36,7 +36,7 @@ from sage.interfaces.gap_workspace import prepare_workspace_dir ############################################################################ -cdef class ObjWrapper(object): +cdef class ObjWrapper(): """ Wrapper for GAP master pointers diff --git a/src/sage/libs/ntl/ntl_GF2.pxd b/src/sage/libs/ntl/ntl_GF2.pxd index 16fb73e8f10..0eff25dd32c 100644 --- a/src/sage/libs/ntl/ntl_GF2.pxd +++ b/src/sage/libs/ntl/ntl_GF2.pxd @@ -1,4 +1,4 @@ from .types cimport GF2_c -cdef class ntl_GF2(object): +cdef class ntl_GF2(): cdef GF2_c x diff --git a/src/sage/libs/ntl/ntl_GF2.pyx b/src/sage/libs/ntl/ntl_GF2.pyx index 605bd3ad936..c88034ff5c4 100644 --- a/src/sage/libs/ntl/ntl_GF2.pyx +++ b/src/sage/libs/ntl/ntl_GF2.pyx @@ -34,7 +34,7 @@ from sage.rings.integer_ring cimport IntegerRing_class # GF2: Bits ############################################################################## -cdef class ntl_GF2(object): +cdef class ntl_GF2(): r""" The \class{GF2} represents the field GF(2). Computationally speaking, it is not a particularly useful class. Its main use is diff --git a/src/sage/libs/ntl/ntl_GF2E.pxd b/src/sage/libs/ntl/ntl_GF2E.pxd index 267330c813d..8977f711078 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pxd +++ b/src/sage/libs/ntl/ntl_GF2E.pxd @@ -1,7 +1,7 @@ from .types cimport GF2E_c from .ntl_GF2EContext cimport ntl_GF2EContext_class -cdef class ntl_GF2E(object): +cdef class ntl_GF2E(): cdef GF2E_c x cdef ntl_GF2EContext_class c cdef ntl_GF2E _new(self) diff --git a/src/sage/libs/ntl/ntl_GF2E.pyx b/src/sage/libs/ntl/ntl_GF2E.pyx index 252851d40ed..bc6a32ce0d3 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_GF2E.pyx @@ -71,7 +71,7 @@ def ntl_GF2E_random(ntl_GF2EContext_class ctx): r.x = GF2E_random() return r -cdef class ntl_GF2E(object): +cdef class ntl_GF2E(): r""" The \\class{GF2E} represents a finite extension field over GF(2) using NTL. Elements are represented as polynomials over GF(2) diff --git a/src/sage/libs/ntl/ntl_GF2EContext.pxd b/src/sage/libs/ntl/ntl_GF2EContext.pxd index 73beae27eb5..44ab9891713 100644 --- a/src/sage/libs/ntl/ntl_GF2EContext.pxd +++ b/src/sage/libs/ntl/ntl_GF2EContext.pxd @@ -1,7 +1,7 @@ from .types cimport GF2EContext_c from .ntl_GF2X cimport ntl_GF2X -cdef class ntl_GF2EContext_class(object): +cdef class ntl_GF2EContext_class(): cdef GF2EContext_c x cdef ntl_GF2X m cdef void restore_c(self) diff --git a/src/sage/libs/ntl/ntl_GF2EContext.pyx b/src/sage/libs/ntl/ntl_GF2EContext.pyx index d31f8fc6e10..11d06893505 100644 --- a/src/sage/libs/ntl/ntl_GF2EContext.pyx +++ b/src/sage/libs/ntl/ntl_GF2EContext.pyx @@ -27,7 +27,7 @@ import weakref GF2EContextDict = {} -cdef class ntl_GF2EContext_class(object): +cdef class ntl_GF2EContext_class(): def __init__(self, ntl_GF2X v): """ EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_GF2EX.pxd b/src/sage/libs/ntl/ntl_GF2EX.pxd index 11e8cc2193d..70e06122753 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pxd +++ b/src/sage/libs/ntl/ntl_GF2EX.pxd @@ -2,7 +2,7 @@ from .types cimport GF2EX_c from .ntl_GF2EContext cimport ntl_GF2EContext_class from .ntl_GF2E cimport ntl_GF2E -cdef class ntl_GF2EX(object): +cdef class ntl_GF2EX(): cdef GF2EX_c x cdef ntl_GF2EContext_class c cdef ntl_GF2E _new_element(self) diff --git a/src/sage/libs/ntl/ntl_GF2EX.pyx b/src/sage/libs/ntl/ntl_GF2EX.pyx index be37ec0313a..e9dfbab4668 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pyx +++ b/src/sage/libs/ntl/ntl_GF2EX.pyx @@ -41,7 +41,7 @@ from .ntl_GF2E cimport ntl_GF2E # ############################################################################## -cdef class ntl_GF2EX(object): +cdef class ntl_GF2EX(): r""" Minimal wrapper of NTL's GF2EX class. """ diff --git a/src/sage/libs/ntl/ntl_GF2X.pxd b/src/sage/libs/ntl/ntl_GF2X.pxd index 4015771577d..5af874d0b9e 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pxd +++ b/src/sage/libs/ntl/ntl_GF2X.pxd @@ -1,4 +1,4 @@ from .types cimport GF2X_c -cdef class ntl_GF2X(object): +cdef class ntl_GF2X(): cdef GF2X_c x diff --git a/src/sage/libs/ntl/ntl_GF2X.pyx b/src/sage/libs/ntl/ntl_GF2X.pyx index 8aa4c43d348..58f536a9c8b 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pyx +++ b/src/sage/libs/ntl/ntl_GF2X.pyx @@ -87,7 +87,7 @@ def GF2XHexOutput(have_hex=None): GF2XHexOutput_c[0] = 0 -cdef class ntl_GF2X(object): +cdef class ntl_GF2X(): """ Univariate Polynomials over GF(2) via NTL. """ diff --git a/src/sage/libs/ntl/ntl_ZZ.pxd b/src/sage/libs/ntl/ntl_ZZ.pxd index 2ecf42c100d..31a23b29d46 100644 --- a/src/sage/libs/ntl/ntl_ZZ.pxd +++ b/src/sage/libs/ntl/ntl_ZZ.pxd @@ -1,6 +1,6 @@ from sage.libs.ntl.types cimport ZZ_c -cdef class ntl_ZZ(object): +cdef class ntl_ZZ(): cdef ZZ_c x cdef int get_as_int(ntl_ZZ self) cdef void set_from_int(ntl_ZZ self, int value) diff --git a/src/sage/libs/ntl/ntl_ZZ.pyx b/src/sage/libs/ntl/ntl_ZZ.pyx index 5a124ef47cf..39a98da2101 100644 --- a/src/sage/libs/ntl/ntl_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_ZZ.pyx @@ -46,7 +46,7 @@ cdef make_ZZ(ZZ_c* x): # ZZ: Arbitrary precision integers ############################################################################## -cdef class ntl_ZZ(object): +cdef class ntl_ZZ(): r""" The \class{ZZ} class is used to represent signed, arbitrary length integers. diff --git a/src/sage/libs/ntl/ntl_ZZX.pxd b/src/sage/libs/ntl/ntl_ZZX.pxd index 8fae49f585b..c15a3f2d1e4 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pxd +++ b/src/sage/libs/ntl/ntl_ZZX.pxd @@ -1,6 +1,6 @@ from .types cimport ZZX_c -cdef class ntl_ZZX(object): +cdef class ntl_ZZX(): cdef ZZX_c x cdef void setitem_from_int(ntl_ZZX self, long i, int value) cdef int getitem_as_int(ntl_ZZX self, long i) diff --git a/src/sage/libs/ntl/ntl_ZZX.pyx b/src/sage/libs/ntl/ntl_ZZX.pyx index 8c596bd23a6..c431864a853 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pyx +++ b/src/sage/libs/ntl/ntl_ZZX.pyx @@ -79,7 +79,7 @@ cdef proof_flag(t): ############################################################################## -cdef class ntl_ZZX(object): +cdef class ntl_ZZX(): r""" The class \class{ZZX} implements polynomials in $\Z[X]$, i.e., univariate polynomials with integer coefficients. diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pxd b/src/sage/libs/ntl/ntl_ZZ_p.pxd index 472587744db..4863afeb2c2 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_p.pxd @@ -1,7 +1,7 @@ from .types cimport ZZ_p_c from .ntl_ZZ_pContext cimport ntl_ZZ_pContext_class -cdef class ntl_ZZ_p(object): +cdef class ntl_ZZ_p(): cdef ZZ_p_c x cdef ntl_ZZ_pContext_class c cdef int get_as_int(ntl_ZZ_p self) diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pyx b/src/sage/libs/ntl/ntl_ZZ_p.pyx index 114963b1882..7c4b024b82a 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_p.pyx @@ -74,7 +74,7 @@ def ntl_ZZ_p_random_element(v): # ZZ_p_c: integers modulo p # ############################################################################## -cdef class ntl_ZZ_p(object): +cdef class ntl_ZZ_p(): r""" The \class{ZZ_p} class is used to represent integers modulo $p$. The modulus $p$ may be any positive integer, not necessarily prime. diff --git a/src/sage/libs/ntl/ntl_ZZ_pContext.pxd b/src/sage/libs/ntl/ntl_ZZ_pContext.pxd index 124ba102ac8..171776d85d7 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pContext.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pContext.pxd @@ -3,7 +3,7 @@ from .ntl_ZZ cimport ntl_ZZ from .types cimport ZZ_c -cdef class ntl_ZZ_pContext_class(object): +cdef class ntl_ZZ_pContext_class(): cdef ZZ_pContext_c x cdef void restore_c(self) cdef ntl_ZZ p @@ -12,7 +12,7 @@ cdef class ntl_ZZ_pContext_class(object): cpdef void _assert_is_current_modulus(self) except * -cdef class ntl_ZZ_pContext_factory(object): +cdef class ntl_ZZ_pContext_factory(): cdef object context_dict cdef ntl_ZZ_pContext_class make_c(self, ntl_ZZ v) diff --git a/src/sage/libs/ntl/ntl_ZZ_pContext.pyx b/src/sage/libs/ntl/ntl_ZZ_pContext.pyx index 008e6abd8eb..dbcc8af1441 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pContext.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pContext.pyx @@ -28,7 +28,7 @@ from sage.ext.cplusplus cimport ccrepr from sage.rings.integer cimport Integer -cdef class ntl_ZZ_pContext_class(object): +cdef class ntl_ZZ_pContext_class(): def __init__(self, ntl_ZZ v): """ EXAMPLES:: @@ -157,7 +157,7 @@ cdef class ntl_ZZ_pContext_class(object): ccrepr(ntl_ZZ_p_current_modulus()))) -cdef class ntl_ZZ_pContext_factory(object): +cdef class ntl_ZZ_pContext_factory(): def __init__(self): self.context_dict = {} diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pxd b/src/sage/libs/ntl/ntl_ZZ_pE.pxd index d7d265b437d..267608a016d 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pxd @@ -2,7 +2,7 @@ from .types cimport ZZ_pE_c from .ntl_ZZ_pEContext cimport ntl_ZZ_pEContext_class from .ntl_ZZ_pX cimport ntl_ZZ_pX -cdef class ntl_ZZ_pE(object): +cdef class ntl_ZZ_pE(): cdef ZZ_pE_c x cdef ntl_ZZ_pEContext_class c cdef ntl_ZZ_pX get_as_ZZ_pX(ntl_ZZ_pE self) diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pyx b/src/sage/libs/ntl/ntl_ZZ_pE.pyx index 6e3684521de..82fbb086127 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pyx @@ -54,7 +54,7 @@ ZZ_sage = IntegerRing() # ZZ_pE_c: An extension of the integers modulo p # ############################################################################## -cdef class ntl_ZZ_pE(object): +cdef class ntl_ZZ_pE(): r""" The \class{ZZ_pE} class is used to model $\Z / p\Z [x] / (f(x))$. The modulus $p$ may be any positive integer, not necessarily prime, diff --git a/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd b/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd index 0e4f679218e..72c9ec42eab 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd @@ -9,7 +9,7 @@ cdef struct ZZ_pEContext_ptrs: ZZ_pContext_c *zzpc -cdef class ntl_ZZ_pEContext_class(object): +cdef class ntl_ZZ_pEContext_class(): cdef ZZ_pEContext_ptrs ptrs cdef ZZ_pEContext_c x cdef ntl_ZZ_pContext_class pc diff --git a/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx b/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx index 69dcbff7469..bef581722bd 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx @@ -32,7 +32,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ ZZ_pEContextDict = {} -cdef class ntl_ZZ_pEContext_class(object): +cdef class ntl_ZZ_pEContext_class(): def __init__(self, ntl_ZZ_pX f): """ EXAMPLES: diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pxd b/src/sage/libs/ntl/ntl_ZZ_pEX.pxd index a07403c1842..b00e87bbcec 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pxd @@ -1,7 +1,7 @@ from .types cimport ZZ_pEX_c from .ntl_ZZ_pEContext cimport ntl_ZZ_pEContext_class -cdef class ntl_ZZ_pEX(object): +cdef class ntl_ZZ_pEX(): cdef ZZ_pEX_c x cdef ntl_ZZ_pEContext_class c #cdef void setitem_from_int(ntl_ZZ_pX self, long i, int value) diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx index a23d84bd4ad..6b874b6d41e 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx @@ -51,7 +51,7 @@ from sage.arith.power cimport generic_power_pos # ############################################################################## -cdef class ntl_ZZ_pEX(object): +cdef class ntl_ZZ_pEX(): r""" The class \class{ZZ_pEX} implements polynomials over finite ring extensions of $\Z / p\Z$. diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pxd b/src/sage/libs/ntl/ntl_ZZ_pX.pxd index 907285b2bdd..6dfed011120 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pxd @@ -1,13 +1,13 @@ from .ZZ_pX cimport * from sage.libs.ntl.ntl_ZZ_pContext cimport ntl_ZZ_pContext_class -cdef class ntl_ZZ_pX(object): +cdef class ntl_ZZ_pX(): cdef ZZ_pX_c x cdef ntl_ZZ_pContext_class c cdef void setitem_from_int(ntl_ZZ_pX self, long i, int value) cdef int getitem_as_int(ntl_ZZ_pX self, long i) cdef ntl_ZZ_pX _new(self) -cdef class ntl_ZZ_pX_Modulus(object): +cdef class ntl_ZZ_pX_Modulus(): cdef ZZ_pX_Modulus_c x cdef ntl_ZZ_pX poly diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pyx b/src/sage/libs/ntl/ntl_ZZ_pX.pyx index fd70c0bbce5..2d03c23a88f 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pyx @@ -63,7 +63,7 @@ cdef make_ZZ_pX(ZZ_pX_c* x, ntl_ZZ_pContext_class ctx): # ############################################################################## -cdef class ntl_ZZ_pX(object): +cdef class ntl_ZZ_pX(): r""" The class \class{ZZ_pX} implements polynomial arithmetic modulo `p`. @@ -1415,7 +1415,7 @@ cdef class ntl_ZZ_pX(object): #ZZ_pX_preallocate_space(&self.x, n) sig_off() -cdef class ntl_ZZ_pX_Modulus(object): +cdef class ntl_ZZ_pX_Modulus(): """ Thin holder for ZZ_pX_Moduli. """ diff --git a/src/sage/libs/ntl/ntl_lzz_p.pxd b/src/sage/libs/ntl/ntl_lzz_p.pxd index 567345427e0..ec74b46d447 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pxd +++ b/src/sage/libs/ntl/ntl_lzz_p.pxd @@ -1,7 +1,7 @@ from .lzz_p cimport * from .ntl_lzz_pContext cimport ntl_zz_pContext_class -cdef class ntl_zz_p(object): +cdef class ntl_zz_p(): cdef zz_p_c x cdef ntl_zz_pContext_class c cdef ntl_zz_p _new(ntl_zz_p self) diff --git a/src/sage/libs/ntl/ntl_lzz_p.pyx b/src/sage/libs/ntl/ntl_lzz_p.pyx index 2152f299967..bd25c536ec3 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pyx +++ b/src/sage/libs/ntl/ntl_lzz_p.pyx @@ -59,7 +59,7 @@ ZZ_sage = IntegerRing() # ############################################################################## -cdef class ntl_zz_p(object): +cdef class ntl_zz_p(): r""" The class \class{zz_p} implements arithmetic modulo $p$, for p smaller than a machine word. diff --git a/src/sage/libs/ntl/ntl_lzz_pContext.pxd b/src/sage/libs/ntl/ntl_lzz_pContext.pxd index b5b436672c9..058d2842ecc 100644 --- a/src/sage/libs/ntl/ntl_lzz_pContext.pxd +++ b/src/sage/libs/ntl/ntl_lzz_pContext.pxd @@ -1,6 +1,6 @@ from .types cimport zz_pContext_c -cdef class ntl_zz_pContext_class(object): +cdef class ntl_zz_pContext_class(): cdef zz_pContext_c x cdef void restore_c(self) cdef long p diff --git a/src/sage/libs/ntl/ntl_lzz_pContext.pyx b/src/sage/libs/ntl/ntl_lzz_pContext.pyx index 9f69dce88b0..64301157702 100644 --- a/src/sage/libs/ntl/ntl_lzz_pContext.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pContext.pyx @@ -23,7 +23,7 @@ from sage.rings.integer cimport Integer zz_pContextDict = {} -cdef class ntl_zz_pContext_class(object): +cdef class ntl_zz_pContext_class(): def __init__(self, long v): """ EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pxd b/src/sage/libs/ntl/ntl_lzz_pX.pxd index e96c44c6ae0..3ab79084299 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pxd +++ b/src/sage/libs/ntl/ntl_lzz_pX.pxd @@ -3,7 +3,7 @@ from sage.libs.ntl.lzz_pX cimport * from sage.libs.ntl.ntl_lzz_pContext cimport ntl_zz_pContext_class -cdef class ntl_zz_pX(object): +cdef class ntl_zz_pX(): cdef zz_pX_c x cdef ntl_zz_pContext_class c cdef ntl_zz_pX _new(self) diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pyx b/src/sage/libs/ntl/ntl_lzz_pX.pyx index d7a88da82fd..c181a7eae59 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pX.pyx @@ -52,7 +52,7 @@ ZZ_sage = IntegerRing() # ############################################################################## -cdef class ntl_zz_pX(object): +cdef class ntl_zz_pX(): r""" The class \class{zz_pX} implements polynomial arithmetic modulo $p$, for p smaller than a machine word. diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pxd b/src/sage/libs/ntl/ntl_mat_GF2.pxd index cae49b8313e..b900d2f9e3f 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pxd +++ b/src/sage/libs/ntl/ntl_mat_GF2.pxd @@ -1,7 +1,7 @@ from .types cimport mat_GF2_c from .ntl_GF2 cimport ntl_GF2 -cdef class ntl_mat_GF2(object): +cdef class ntl_mat_GF2(): cdef mat_GF2_c x cdef ntl_GF2 _new_element(self) cdef ntl_mat_GF2 _new(self) diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pyx b/src/sage/libs/ntl/ntl_mat_GF2.pyx index 6967d469cef..acdf12dc4dd 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2.pyx @@ -45,7 +45,7 @@ from sage.rings.integer cimport Integer from sage.libs.ntl.ntl_ZZ import unpickle_class_args -cdef class ntl_mat_GF2(object): +cdef class ntl_mat_GF2(): r""" The \class{mat_GF2} class implements arithmetic with matrices over $F_2$. """ diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pxd b/src/sage/libs/ntl/ntl_mat_GF2E.pxd index 3a30fca6dd6..5c8aacd5cef 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pxd +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pxd @@ -2,7 +2,7 @@ from .types cimport mat_GF2E_c from .ntl_GF2EContext cimport ntl_GF2EContext_class from .ntl_GF2E cimport ntl_GF2E -cdef class ntl_mat_GF2E(object): +cdef class ntl_mat_GF2E(): cdef mat_GF2E_c x cdef ntl_GF2EContext_class c cdef ntl_GF2E _new_element(self) diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pyx b/src/sage/libs/ntl/ntl_mat_GF2E.pyx index 85fd9d6d46f..6cc41e9318a 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pyx @@ -45,7 +45,7 @@ from sage.misc.randstate cimport randstate, current_randstate from sage.libs.ntl.ntl_ZZ import unpickle_class_args -cdef class ntl_mat_GF2E(object): +cdef class ntl_mat_GF2E(): r""" The \class{mat_GF2E} class implements arithmetic with matrices over $GF(2**x)$. """ diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pxd b/src/sage/libs/ntl/ntl_mat_ZZ.pxd index af3ada9e97a..f766e82c187 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pxd +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pxd @@ -1,5 +1,5 @@ from .types cimport mat_ZZ_c -cdef class ntl_mat_ZZ(object): +cdef class ntl_mat_ZZ(): cdef mat_ZZ_c x cdef long __nrows, __ncols diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pyx b/src/sage/libs/ntl/ntl_mat_ZZ.pyx index c9f054602e8..6f7cc3da0b9 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pyx @@ -67,7 +67,7 @@ cdef inline ntl_mat_ZZ make_mat_ZZ_sig_off(mat_ZZ_c* x): # ############################################################################## -cdef class ntl_mat_ZZ(object): +cdef class ntl_mat_ZZ(): # see ntl_mat_ZZ.pxd for data members r""" The \class{mat_ZZ} class implements arithmetic with matrices over $\Z$. diff --git a/src/sage/libs/singular/function_factory.py b/src/sage/libs/singular/function_factory.py index c3ba54dd371..c4b0b52372f 100644 --- a/src/sage/libs/singular/function_factory.py +++ b/src/sage/libs/singular/function_factory.py @@ -15,7 +15,7 @@ from sage.libs.singular.function import singular_function, lib, list_of_functions -class SingularFunctionFactory(object): +class SingularFunctionFactory(): """ A convenient interface to libsingular functions. """ diff --git a/src/sage/libs/singular/ring.pyx b/src/sage/libs/singular/ring.pyx index d49cf529073..04bd16e8784 100644 --- a/src/sage/libs/singular/ring.pyx +++ b/src/sage/libs/singular/ring.pyx @@ -505,7 +505,7 @@ cdef ring *singular_ring_new(base_ring, n, names, term_order) except NULL: ring_refcount_dict = defaultdict(int) -cdef class ring_wrapper_Py(object): +cdef class ring_wrapper_Py(): r""" Python object wrapping the ring pointer. From 158a42cbe5ae9bc80b481d257d4d36f4a6d346bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 15:11:38 +0200 Subject: [PATCH 205/338] fix-up wrong replacement --- src/sage/repl/interpreter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py index 2d48b2b4802..d7ba014361d 100644 --- a/src/sage/repl/interpreter.py +++ b/src/sage/repl/interpreter.py @@ -487,11 +487,11 @@ def __init__(self, *args, **kwds): def preparse_imports_from_sage(self, line): """ - Finds occurrences of strings such as ``sage()`` in + Finds occurrences of strings such as ``sage(object)`` in *line*, converts ``object`` to :attr:`shell.interface`, and replaces those strings with their identifier in the new system. This also works with strings such as - ``maxima()`` if :attr:`shell.interface` is + ``maxima(object)`` if :attr:`shell.interface` is ``maxima``. :param line: the line to transform From 4d9a20785295fcf1730a99ea81a39e50ce2d4b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 15:22:43 +0200 Subject: [PATCH 206/338] fix W391 in combinat --- src/sage/combinat/affine_permutation.py | 1 - src/sage/combinat/chas/__init__.py | 1 - src/sage/combinat/chas/all.py | 1 - src/sage/combinat/cluster_algebra_quiver/all.py | 1 - src/sage/combinat/composition_tableau.py | 1 - src/sage/combinat/crystals/affine_factorization.py | 1 - src/sage/combinat/crystals/affinization.py | 1 - src/sage/combinat/crystals/all.py | 1 - src/sage/combinat/crystals/bkk_crystals.py | 1 - src/sage/combinat/crystals/crystals.py | 1 - src/sage/combinat/crystals/direct_sum.py | 1 - src/sage/combinat/crystals/induced_structure.py | 1 - src/sage/combinat/crystals/infinity_crystals.py | 1 - src/sage/combinat/crystals/kyoto_path_model.py | 1 - src/sage/combinat/crystals/littelmann_path.py | 1 - src/sage/combinat/crystals/monomial_crystals.py | 1 - src/sage/combinat/crystals/multisegments.py | 1 - src/sage/combinat/crystals/mv_polytopes.py | 1 - src/sage/combinat/crystals/pbw_crystal.py | 1 - src/sage/combinat/crystals/polyhedral_realization.py | 1 - src/sage/combinat/crystals/star_crystal.py | 1 - src/sage/combinat/crystals/subcrystal.py | 1 - src/sage/combinat/crystals/virtual_crystal.py | 1 - src/sage/combinat/designs/__init__.py | 1 - src/sage/combinat/free_dendriform_algebra.py | 1 - src/sage/combinat/hall_polynomial.py | 1 - src/sage/combinat/integer_matrices.py | 1 - src/sage/combinat/lr_tableau.py | 1 - src/sage/combinat/matrices/all.py | 1 - src/sage/combinat/matrices/dlxcpp.py | 2 -- src/sage/combinat/misc.py | 1 - src/sage/combinat/multiset_partition_into_sets_ordered.py | 1 - src/sage/combinat/ncsf_qsym/__init__.py | 1 - src/sage/combinat/ncsf_qsym/all.py | 1 - src/sage/combinat/ncsf_qsym/combinatorics.py | 1 - src/sage/combinat/ncsf_qsym/generic_basis_code.py | 1 - src/sage/combinat/ncsym/ncsym.py | 1 - src/sage/combinat/output.py | 1 - src/sage/combinat/path_tableaux/__init__.py | 1 - src/sage/combinat/path_tableaux/dyck_path.py | 1 - src/sage/combinat/path_tableaux/path_tableau.py | 1 - src/sage/combinat/ribbon.py | 1 - src/sage/combinat/rigged_configurations/bij_abstract_class.py | 1 - src/sage/combinat/rigged_configurations/bij_infinity.py | 1 - src/sage/combinat/rigged_configurations/bij_type_A.py | 1 - src/sage/combinat/rigged_configurations/bij_type_A2_dual.py | 1 - src/sage/combinat/rigged_configurations/bij_type_A2_odd.py | 1 - src/sage/combinat/rigged_configurations/bij_type_B.py | 1 - src/sage/combinat/rigged_configurations/bij_type_D.py | 1 - src/sage/combinat/rigged_configurations/bij_type_D_tri.py | 1 - src/sage/combinat/rigged_configurations/bij_type_D_twisted.py | 1 - src/sage/combinat/rigged_configurations/bij_type_E67.py | 1 - src/sage/combinat/rigged_configurations/bijection.py | 1 - src/sage/combinat/rigged_configurations/kleber_tree.py | 1 - src/sage/combinat/rigged_configurations/kr_tableaux.py | 1 - .../rigged_configurations/rigged_configuration_element.py | 1 - .../rigged_configurations/tensor_product_kr_tableaux_element.py | 1 - src/sage/combinat/root_system/all.py | 1 - src/sage/combinat/root_system/ambient_space.py | 1 - src/sage/combinat/root_system/cartan_matrix.py | 1 - src/sage/combinat/root_system/coxeter_type.py | 1 - src/sage/combinat/root_system/integrable_representations.py | 1 - .../combinat/root_system/non_symmetric_macdonald_polynomials.py | 1 - src/sage/combinat/root_system/root_lattice_realizations.py | 1 - src/sage/combinat/root_system/type_B.py | 1 - src/sage/combinat/root_system/type_BC_affine.py | 1 - src/sage/combinat/root_system/type_B_affine.py | 1 - src/sage/combinat/root_system/type_C_affine.py | 1 - src/sage/combinat/root_system/type_D_affine.py | 1 - src/sage/combinat/root_system/type_F_affine.py | 1 - src/sage/combinat/root_system/type_G_affine.py | 1 - src/sage/combinat/root_system/type_H.py | 1 - src/sage/combinat/root_system/type_I.py | 1 - src/sage/combinat/root_system/type_dual.py | 1 - src/sage/combinat/root_system/type_folded.py | 1 - src/sage/combinat/sf/__init__.py | 1 - src/sage/combinat/sf/character.py | 1 - src/sage/combinat/sf/dual.py | 1 - src/sage/combinat/sf/k_dual.py | 1 - src/sage/combinat/sf/kfpoly.py | 1 - src/sage/combinat/sf/orthogonal.py | 1 - src/sage/combinat/sf/sf.py | 1 - src/sage/combinat/sf/symplectic.py | 1 - src/sage/combinat/sf/witt.py | 2 -- src/sage/combinat/shifted_primed_tableau.py | 1 - src/sage/combinat/six_vertex_model.py | 1 - src/sage/combinat/species/__init__.py | 1 - src/sage/combinat/species/generating_series.py | 1 - src/sage/combinat/symmetric_group_representations.py | 1 - src/sage/combinat/words/infinite_word.py | 1 - src/sage/combinat/words/morphic.py | 2 -- src/sage/combinat/words/word_infinite_datatypes.py | 1 - 92 files changed, 95 deletions(-) diff --git a/src/sage/combinat/affine_permutation.py b/src/sage/combinat/affine_permutation.py index 11b8a5feacb..b87167bb487 100644 --- a/src/sage/combinat/affine_permutation.py +++ b/src/sage/combinat/affine_permutation.py @@ -2403,4 +2403,3 @@ def one(self): return self([1,2,3,4,5,6]) Element = AffinePermutationTypeG - diff --git a/src/sage/combinat/chas/__init__.py b/src/sage/combinat/chas/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/chas/__init__.py +++ b/src/sage/combinat/chas/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/chas/all.py b/src/sage/combinat/chas/all.py index 899155c0385..5833abbe49c 100644 --- a/src/sage/combinat/chas/all.py +++ b/src/sage/combinat/chas/all.py @@ -18,4 +18,3 @@ lazy_import('sage.combinat.chas.fsym', ['FreeSymmetricFunctions']) lazy_import('sage.combinat.chas.wqsym', ['WordQuasiSymmetricFunctions']) - diff --git a/src/sage/combinat/cluster_algebra_quiver/all.py b/src/sage/combinat/cluster_algebra_quiver/all.py index 61fec4fde04..40b86813ba0 100644 --- a/src/sage/combinat/cluster_algebra_quiver/all.py +++ b/src/sage/combinat/cluster_algebra_quiver/all.py @@ -15,4 +15,3 @@ lazy_import("sage.combinat.cluster_algebra_quiver.quiver_mutation_type", "QuiverMutationType") lazy_import("sage.combinat.cluster_algebra_quiver.quiver", "ClusterQuiver") lazy_import("sage.combinat.cluster_algebra_quiver.cluster_seed", "ClusterSeed") - diff --git a/src/sage/combinat/composition_tableau.py b/src/sage/combinat/composition_tableau.py index 53d22a50346..64c98d81bf5 100644 --- a/src/sage/combinat/composition_tableau.py +++ b/src/sage/combinat/composition_tableau.py @@ -859,4 +859,3 @@ def get_next_pos(self, ii, jj): return ii, j return ii+1, 0 - diff --git a/src/sage/combinat/crystals/affine_factorization.py b/src/sage/combinat/crystals/affine_factorization.py index 9dfda1c5b77..b88f1e3adb1 100644 --- a/src/sage/combinat/crystals/affine_factorization.py +++ b/src/sage/combinat/crystals/affine_factorization.py @@ -506,4 +506,3 @@ def is_isomorphism(self): is_embedding = is_isomorphism is_surjective = is_isomorphism - diff --git a/src/sage/combinat/crystals/affinization.py b/src/sage/combinat/crystals/affinization.py index fc79e6c3912..49ee74d1df5 100644 --- a/src/sage/combinat/crystals/affinization.py +++ b/src/sage/combinat/crystals/affinization.py @@ -324,4 +324,3 @@ def weight(self): WLR = self.parent().weight_lattice_realization() La = WLR.fundamental_weights() return WLR.sum(c*La[i] for i,c in self._b.weight()) + self._m * WLR.null_root() - diff --git a/src/sage/combinat/crystals/all.py b/src/sage/combinat/crystals/all.py index 23955e34465..397639405c9 100644 --- a/src/sage/combinat/crystals/all.py +++ b/src/sage/combinat/crystals/all.py @@ -28,4 +28,3 @@ from sage.misc.lazy_import import lazy_import lazy_import('sage.combinat.crystals', 'catalog', 'crystals') - diff --git a/src/sage/combinat/crystals/bkk_crystals.py b/src/sage/combinat/crystals/bkk_crystals.py index bf3c3eb369b..622fbb9e350 100644 --- a/src/sage/combinat/crystals/bkk_crystals.py +++ b/src/sage/combinat/crystals/bkk_crystals.py @@ -139,4 +139,3 @@ def genuine_highest_weight_vectors(self, index_set=None): class Element(CrystalOfBKKTableauxElement): pass - diff --git a/src/sage/combinat/crystals/crystals.py b/src/sage/combinat/crystals/crystals.py index 0b3fa3998df..8b965b79c09 100644 --- a/src/sage/combinat/crystals/crystals.py +++ b/src/sage/combinat/crystals/crystals.py @@ -253,4 +253,3 @@ def _rec(self, x, state): # yield y and all elements further below yield y, "n/a", True - diff --git a/src/sage/combinat/crystals/direct_sum.py b/src/sage/combinat/crystals/direct_sum.py index 90b02717ef4..84676264822 100644 --- a/src/sage/combinat/crystals/direct_sum.py +++ b/src/sage/combinat/crystals/direct_sum.py @@ -253,4 +253,3 @@ def epsilon(self, i): 0 """ return self.value[1].epsilon(i) - diff --git a/src/sage/combinat/crystals/induced_structure.py b/src/sage/combinat/crystals/induced_structure.py index 0cf36648bba..1e89220f3ea 100644 --- a/src/sage/combinat/crystals/induced_structure.py +++ b/src/sage/combinat/crystals/induced_structure.py @@ -686,4 +686,3 @@ def weight(self): (1, 0, 1, 0) """ return self.parent()._inverse(self.value).weight() - diff --git a/src/sage/combinat/crystals/infinity_crystals.py b/src/sage/combinat/crystals/infinity_crystals.py index 919242aa1b8..0edf826c73e 100644 --- a/src/sage/combinat/crystals/infinity_crystals.py +++ b/src/sage/combinat/crystals/infinity_crystals.py @@ -725,4 +725,3 @@ def _element_constructor_(self, *args, **options): class Element(InfinityQueerCrystalOfTableauxElement): pass - diff --git a/src/sage/combinat/crystals/kyoto_path_model.py b/src/sage/combinat/crystals/kyoto_path_model.py index 0b5ad79a32f..12d3af264a6 100644 --- a/src/sage/combinat/crystals/kyoto_path_model.py +++ b/src/sage/combinat/crystals/kyoto_path_model.py @@ -492,4 +492,3 @@ def truncate(self, k=None): i = len(l) % N l.append(self.parent()._phi_dicts[i][ l[-1].Epsilon() ]) return P(*l) - diff --git a/src/sage/combinat/crystals/littelmann_path.py b/src/sage/combinat/crystals/littelmann_path.py index 6f45611e85c..4cbce3cb920 100644 --- a/src/sage/combinat/crystals/littelmann_path.py +++ b/src/sage/combinat/crystals/littelmann_path.py @@ -1489,4 +1489,3 @@ def positively_parallel_weights(v, w): if v[i]*w[i] > 0 and v[i]*w == w[i]*v: return True return False - diff --git a/src/sage/combinat/crystals/monomial_crystals.py b/src/sage/combinat/crystals/monomial_crystals.py index 73c810bd594..43d71f16747 100644 --- a/src/sage/combinat/crystals/monomial_crystals.py +++ b/src/sage/combinat/crystals/monomial_crystals.py @@ -1255,4 +1255,3 @@ def cardinality(self): return super(InfinityCrystalOfNakajimaMonomials, self).cardinality() Element = CrystalOfNakajimaMonomialsElement - diff --git a/src/sage/combinat/crystals/multisegments.py b/src/sage/combinat/crystals/multisegments.py index 7db77030117..81b01f17fcc 100644 --- a/src/sage/combinat/crystals/multisegments.py +++ b/src/sage/combinat/crystals/multisegments.py @@ -451,4 +451,3 @@ def weight(self): n = self.parent()._cartan_type.rank() return WLR.sum(-1*alpha[j % n] for k,i in self.value for j in range(ZZ(i),ZZ(i)+k)) - diff --git a/src/sage/combinat/crystals/mv_polytopes.py b/src/sage/combinat/crystals/mv_polytopes.py index 25fdd16c3f3..4ff902a7b6b 100644 --- a/src/sage/combinat/crystals/mv_polytopes.py +++ b/src/sage/combinat/crystals/mv_polytopes.py @@ -461,4 +461,3 @@ def latex_options(self): return copy(self._latex_options) Element = MVPolytope - diff --git a/src/sage/combinat/crystals/pbw_crystal.py b/src/sage/combinat/crystals/pbw_crystal.py index 3143aa32a9d..1803b501f9e 100644 --- a/src/sage/combinat/crystals/pbw_crystal.py +++ b/src/sage/combinat/crystals/pbw_crystal.py @@ -506,4 +506,3 @@ def set_default_long_word(self, word): self._default_word = tuple(word) Element = PBWCrystalElement - diff --git a/src/sage/combinat/crystals/polyhedral_realization.py b/src/sage/combinat/crystals/polyhedral_realization.py index 4440dd2ac0a..2860eec417c 100644 --- a/src/sage/combinat/crystals/polyhedral_realization.py +++ b/src/sage/combinat/crystals/polyhedral_realization.py @@ -366,4 +366,3 @@ def truncate(self, k=None): i = len(l) % N l.append(self.parent()._tp[i]) return P(*l) - diff --git a/src/sage/combinat/crystals/star_crystal.py b/src/sage/combinat/crystals/star_crystal.py index 2ed01c49422..1434eac09eb 100644 --- a/src/sage/combinat/crystals/star_crystal.py +++ b/src/sage/combinat/crystals/star_crystal.py @@ -286,4 +286,3 @@ def jump(self, i): P = self.parent().weight_lattice_realization() ac = P.simple_coroot(i) return P(self.value.weight()).scalar(ac) + self.epsilon(i) + self.value.epsilon(i) - diff --git a/src/sage/combinat/crystals/subcrystal.py b/src/sage/combinat/crystals/subcrystal.py index 81af397e59e..9881a021e27 100644 --- a/src/sage/combinat/crystals/subcrystal.py +++ b/src/sage/combinat/crystals/subcrystal.py @@ -457,4 +457,3 @@ def weight(self): (0, 1, 0, 1, 1) """ return self.value.weight() - diff --git a/src/sage/combinat/crystals/virtual_crystal.py b/src/sage/combinat/crystals/virtual_crystal.py index 81088735b4f..8cdcf92f57d 100644 --- a/src/sage/combinat/crystals/virtual_crystal.py +++ b/src/sage/combinat/crystals/virtual_crystal.py @@ -415,4 +415,3 @@ def weight(self): for i in self.index_set()) # TODO: implement a devirtualization map - diff --git a/src/sage/combinat/designs/__init__.py b/src/sage/combinat/designs/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/designs/__init__.py +++ b/src/sage/combinat/designs/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/free_dendriform_algebra.py b/src/sage/combinat/free_dendriform_algebra.py index 32709cfaf7c..ffac8fd2452 100644 --- a/src/sage/combinat/free_dendriform_algebra.py +++ b/src/sage/combinat/free_dendriform_algebra.py @@ -936,4 +936,3 @@ def _repr_(self): Dendriform[x,y,z,t] """ return "Dendriform[%s]" % ','.join(self.vars) - diff --git a/src/sage/combinat/hall_polynomial.py b/src/sage/combinat/hall_polynomial.py index cd540de429c..19d65bc2263 100644 --- a/src/sage/combinat/hall_polynomial.py +++ b/src/sage/combinat/hall_polynomial.py @@ -184,4 +184,3 @@ def hall_polynomial(nu, mu, la, q=None): from sage.algebras.hall_algebra import HallAlgebra H = HallAlgebra(R, q) return (H[mu]*H[la]).coefficient(nu) - diff --git a/src/sage/combinat/integer_matrices.py b/src/sage/combinat/integer_matrices.py index 6b48ca6c336..44d42ce39b1 100644 --- a/src/sage/combinat/integer_matrices.py +++ b/src/sage/combinat/integer_matrices.py @@ -333,4 +333,3 @@ def integer_matrices_generator(row_sums, column_sums): t = [column_sums[i]-ci for (i, ci) in enumerate(comp)] for mat in integer_matrices_generator(row_sums[1:], t): yield [list(comp)] + mat - diff --git a/src/sage/combinat/lr_tableau.py b/src/sage/combinat/lr_tableau.py index 3348c97e7d1..3a24b1007d3 100644 --- a/src/sage/combinat/lr_tableau.py +++ b/src/sage/combinat/lr_tableau.py @@ -304,4 +304,3 @@ def _tableau_join(t1, t2, shift=0): """ return [[e1 for e1 in row1] + [e2+shift for e2 in row2 if e2 is not None] for (row1, row2) in zip_longest(t1, t2, fillvalue=[])] - diff --git a/src/sage/combinat/matrices/all.py b/src/sage/combinat/matrices/all.py index baa34da139a..0f6adbb5355 100644 --- a/src/sage/combinat/matrices/all.py +++ b/src/sage/combinat/matrices/all.py @@ -17,4 +17,3 @@ lazy_import('sage.combinat.matrices.dlxcpp', 'DLXCPP') lazy_import('sage.combinat.matrices.hadamard_matrix', ['hadamard_matrix', 'hadamard_matrix_www']) - diff --git a/src/sage/combinat/matrices/dlxcpp.py b/src/sage/combinat/matrices/dlxcpp.py index 7a5b153b759..4e12b98e325 100644 --- a/src/sage/combinat/matrices/dlxcpp.py +++ b/src/sage/combinat/matrices/dlxcpp.py @@ -129,5 +129,3 @@ def OneExactCover(M): for s in AllExactCovers(M): return s - - diff --git a/src/sage/combinat/misc.py b/src/sage/combinat/misc.py index abcd7871932..d29b31a101f 100644 --- a/src/sage/combinat/misc.py +++ b/src/sage/combinat/misc.py @@ -399,4 +399,3 @@ def check_integer_list_constraints(l, **kwargs): return None else: return result - diff --git a/src/sage/combinat/multiset_partition_into_sets_ordered.py b/src/sage/combinat/multiset_partition_into_sets_ordered.py index 77a06dc4134..8963ab00f0d 100755 --- a/src/sage/combinat/multiset_partition_into_sets_ordered.py +++ b/src/sage/combinat/multiset_partition_into_sets_ordered.py @@ -3508,4 +3508,3 @@ def f(self,i): return None w = w.f(i) return P.element_class(P, (w, breaks)) - diff --git a/src/sage/combinat/ncsf_qsym/__init__.py b/src/sage/combinat/ncsf_qsym/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/ncsf_qsym/__init__.py +++ b/src/sage/combinat/ncsf_qsym/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/ncsf_qsym/all.py b/src/sage/combinat/ncsf_qsym/all.py index 212da647869..db6cb1f065e 100644 --- a/src/sage/combinat/ncsf_qsym/all.py +++ b/src/sage/combinat/ncsf_qsym/all.py @@ -14,4 +14,3 @@ from .qsym import QuasiSymmetricFunctions from .ncsf import NonCommutativeSymmetricFunctions - diff --git a/src/sage/combinat/ncsf_qsym/combinatorics.py b/src/sage/combinat/ncsf_qsym/combinatorics.py index 6688b4640ff..a0f8825ae3e 100644 --- a/src/sage/combinat/ncsf_qsym/combinatorics.py +++ b/src/sage/combinat/ncsf_qsym/combinatorics.py @@ -323,4 +323,3 @@ def number_of_SSRCT(content_comp, shape_comp): if cond([shape_comp[0]]+list(x), shape_comp): s += number_of_SSRCT(Comps(content_comp[1:]), x) return s - diff --git a/src/sage/combinat/ncsf_qsym/generic_basis_code.py b/src/sage/combinat/ncsf_qsym/generic_basis_code.py index d10de45aebc..3457b4cdd03 100644 --- a/src/sage/combinat/ncsf_qsym/generic_basis_code.py +++ b/src/sage/combinat/ncsf_qsym/generic_basis_code.py @@ -1432,4 +1432,3 @@ def internal_product_by_coercion(self, left, right): """ R = self.realization_of().a_realization() return self(R.internal_product(R(left), R(right))) - diff --git a/src/sage/combinat/ncsym/ncsym.py b/src/sage/combinat/ncsym/ncsym.py index 4df1db47990..6acf7dbc1c0 100644 --- a/src/sage/combinat/ncsym/ncsym.py +++ b/src/sage/combinat/ncsym/ncsym.py @@ -2109,4 +2109,3 @@ def _m_to_chi_on_basis(self, A): return self._from_dict({B: m[j,i] for j,B in enumerate(lst)}) chi = supercharacter - diff --git a/src/sage/combinat/output.py b/src/sage/combinat/output.py index 95b5cd0c046..d153149c48b 100644 --- a/src/sage/combinat/output.py +++ b/src/sage/combinat/output.py @@ -506,4 +506,3 @@ def get_len(e): return output.translate(tr) else: return output - diff --git a/src/sage/combinat/path_tableaux/__init__.py b/src/sage/combinat/path_tableaux/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/path_tableaux/__init__.py +++ b/src/sage/combinat/path_tableaux/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/path_tableaux/dyck_path.py b/src/sage/combinat/path_tableaux/dyck_path.py index 50dbebe2839..26501ec6cc7 100644 --- a/src/sage/combinat/path_tableaux/dyck_path.py +++ b/src/sage/combinat/path_tableaux/dyck_path.py @@ -375,4 +375,3 @@ def _an_element_(self): return DyckPath([0,1,2,1,0]) Element = DyckPath - diff --git a/src/sage/combinat/path_tableaux/path_tableau.py b/src/sage/combinat/path_tableaux/path_tableau.py index 691882350c2..611f9d31310 100644 --- a/src/sage/combinat/path_tableaux/path_tableau.py +++ b/src/sage/combinat/path_tableaux/path_tableau.py @@ -722,4 +722,3 @@ def pp(self): max_width = max(max(len(x) for x in row) for row in data if row) print('\n'.join(' '.join(' '*(max_width-len(x)) + x for x in row) for row in data)) - diff --git a/src/sage/combinat/ribbon.py b/src/sage/combinat/ribbon.py index 64f06fc801d..6c662f505c7 100644 --- a/src/sage/combinat/ribbon.py +++ b/src/sage/combinat/ribbon.py @@ -17,4 +17,3 @@ #***************************************************************************** from .ribbon_shaped_tableau import RibbonShapedTableau, StandardRibbonShapedTableaux - diff --git a/src/sage/combinat/rigged_configurations/bij_abstract_class.py b/src/sage/combinat/rigged_configurations/bij_abstract_class.py index 89c82a8224b..8e6042a2663 100644 --- a/src/sage/combinat/rigged_configurations/bij_abstract_class.py +++ b/src/sage/combinat/rigged_configurations/bij_abstract_class.py @@ -542,4 +542,3 @@ def _next_index(self, r): 1 """ return r - 1 - diff --git a/src/sage/combinat/rigged_configurations/bij_infinity.py b/src/sage/combinat/rigged_configurations/bij_infinity.py index 7717c8691a2..4c675135019 100644 --- a/src/sage/combinat/rigged_configurations/bij_infinity.py +++ b/src/sage/combinat/rigged_configurations/bij_infinity.py @@ -359,4 +359,3 @@ def run(self): self.cur_dims.pop(0) # Pop off the leading column return ret_crystal_path - diff --git a/src/sage/combinat/rigged_configurations/bij_type_A.py b/src/sage/combinat/rigged_configurations/bij_type_A.py index 78de0dfa555..0a7070297db 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A.py @@ -157,4 +157,3 @@ def next_state(self, height): self.cur_partitions[n - 1].rigging[row_num] = self.cur_partitions[n - 1].vacancy_numbers[row_num] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py b/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py index 57a17f31e83..8f41efa6474 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py @@ -332,4 +332,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[row_num_bar_next] = self.cur_partitions[n-1].vacancy_numbers[row_num_bar_next] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py b/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py index 34707d7b424..753c2a99c74 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py @@ -193,4 +193,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[ret_row_next] = self.cur_partitions[n-1].vacancy_numbers[ret_row_next] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_B.py b/src/sage/combinat/rigged_configurations/bij_type_B.py index eef6dede629..05b6f56f6c9 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_B.py +++ b/src/sage/combinat/rigged_configurations/bij_type_B.py @@ -892,4 +892,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[j-1] = vac_num - 1 return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_D.py b/src/sage/combinat/rigged_configurations/bij_type_D.py index 8cdd0d33edb..48ad54873ab 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D.py @@ -766,4 +766,3 @@ def _correct_vacancy_nums(self): n = self.n for i in range(len(self.cur_partitions[n-1]._list)): self.cur_partitions[n-1].vacancy_numbers[i] += 1 - diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_tri.py b/src/sage/combinat/rigged_configurations/bij_type_D_tri.py index dda29c33373..55159ab4f48 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_tri.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_tri.py @@ -384,4 +384,3 @@ def next_state(self, height): P.rigging[j-1] = vac_num - 1 return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py index 96e32e0664e..78ba3d4a071 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py @@ -568,4 +568,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[row_num_bar_next] = self.cur_partitions[n-1].vacancy_numbers[row_num_bar_next] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_E67.py b/src/sage/combinat/rigged_configurations/bij_type_E67.py index d9d635540e6..c0ebd5735cb 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_E67.py +++ b/src/sage/combinat/rigged_configurations/bij_type_E67.py @@ -392,4 +392,3 @@ def endpoint7(r): return C((-7, 6)) elif r == 7: return C.module_generators[0] # C((7,)) - diff --git a/src/sage/combinat/rigged_configurations/bijection.py b/src/sage/combinat/rigged_configurations/bijection.py index 3815407c980..56fcbb98394 100644 --- a/src/sage/combinat/rigged_configurations/bijection.py +++ b/src/sage/combinat/rigged_configurations/bijection.py @@ -137,4 +137,3 @@ def RCToKRTBijection(rigged_configuration_elt): if typ == 'G': # D_4^{(3)} return RCToKRTBijectionTypeDTri(rigged_configuration_elt) raise NotImplementedError - diff --git a/src/sage/combinat/rigged_configurations/kleber_tree.py b/src/sage/combinat/rigged_configurations/kleber_tree.py index 4d9c040c834..df5db0f5fe8 100644 --- a/src/sage/combinat/rigged_configurations/kleber_tree.py +++ b/src/sage/combinat/rigged_configurations/kleber_tree.py @@ -1470,4 +1470,3 @@ def depth_first_iter(self, all_nodes=False): Kleber tree node with weight [0, 0, 0] and upwards edge root [1, 2, 1] """ return KleberTree.depth_first_iter(self) - diff --git a/src/sage/combinat/rigged_configurations/kr_tableaux.py b/src/sage/combinat/rigged_configurations/kr_tableaux.py index 821389b7d83..5c79e0807ef 100644 --- a/src/sage/combinat/rigged_configurations/kr_tableaux.py +++ b/src/sage/combinat/rigged_configurations/kr_tableaux.py @@ -1876,4 +1876,3 @@ def _tableau_height(self): return len(self.module_generators[0]) // self._s Element = KRTableauxTypeFromRCElement - diff --git a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py index 6c3c897a1b4..4ef6be9811c 100644 --- a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py +++ b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py @@ -2406,4 +2406,3 @@ def cocharge(self): return cc / ZZ(2) + rigging_sum cc = cocharge - diff --git a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py index 7658ddd0d28..87e8d0c97d0 100644 --- a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +++ b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py @@ -424,4 +424,3 @@ def to_tensor_product_of_kirillov_reshetikhin_crystals(self): """ TP = self.parent().tensor_product_of_kirillov_reshetikhin_crystals() return TP(*[x.to_kirillov_reshetikhin_crystal() for x in self]) - diff --git a/src/sage/combinat/root_system/all.py b/src/sage/combinat/root_system/all.py index 622eb87b309..e49d72ea222 100644 --- a/src/sage/combinat/root_system/all.py +++ b/src/sage/combinat/root_system/all.py @@ -141,4 +141,3 @@ lazy_import('sage.combinat.root_system.non_symmetric_macdonald_polynomials', 'NonSymmetricMacdonaldPolynomials') lazy_import('sage.combinat.root_system.integrable_representations', 'IntegrableRepresentation') - diff --git a/src/sage/combinat/root_system/ambient_space.py b/src/sage/combinat/root_system/ambient_space.py index c55646e94ce..b1499f4eb4d 100644 --- a/src/sage/combinat/root_system/ambient_space.py +++ b/src/sage/combinat/root_system/ambient_space.py @@ -507,4 +507,3 @@ def to_ambient(self): return self AmbientSpace.Element = AmbientSpaceElement - diff --git a/src/sage/combinat/root_system/cartan_matrix.py b/src/sage/combinat/root_system/cartan_matrix.py index ed56efa197c..8030a093066 100644 --- a/src/sage/combinat/root_system/cartan_matrix.py +++ b/src/sage/combinat/root_system/cartan_matrix.py @@ -1164,4 +1164,3 @@ def find_cartan_type_from_matrix(CM): return None return CartanType(types) - diff --git a/src/sage/combinat/root_system/coxeter_type.py b/src/sage/combinat/root_system/coxeter_type.py index 5130d33ad8f..a8062d15c2f 100644 --- a/src/sage/combinat/root_system/coxeter_type.py +++ b/src/sage/combinat/root_system/coxeter_type.py @@ -669,4 +669,3 @@ def relabel(self, relabelling): Coxeter type of ['A', 2] relabelled by {1: -1, 2: -2} """ return CoxeterType(self._cartan_type.relabel(relabelling)) - diff --git a/src/sage/combinat/root_system/integrable_representations.py b/src/sage/combinat/root_system/integrable_representations.py index 691718b46da..edb6565ab09 100644 --- a/src/sage/combinat/root_system/integrable_representations.py +++ b/src/sage/combinat/root_system/integrable_representations.py @@ -1219,4 +1219,3 @@ def next_level(x): ldict[contr] = x[1] ret.append(weyl_character_ring.char_from_weights(ldict)) return ret - diff --git a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py index cbece412f13..de8091654a3 100644 --- a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +++ b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py @@ -1817,4 +1817,3 @@ def symmetric_macdonald_polynomial(self, mu): Torbit[c] = v * self._T.Tw([i])(Torbit[c.simple_reflection(i)]) s = s + Torbit[c] return s - diff --git a/src/sage/combinat/root_system/root_lattice_realizations.py b/src/sage/combinat/root_system/root_lattice_realizations.py index 1cd87355792..766b7932cdb 100644 --- a/src/sage/combinat/root_system/root_lattice_realizations.py +++ b/src/sage/combinat/root_system/root_lattice_realizations.py @@ -4514,4 +4514,3 @@ def is_real_root(self): False """ return self.norm_squared() > 0 - diff --git a/src/sage/combinat/root_system/type_B.py b/src/sage/combinat/root_system/type_B.py index 23a6f993665..036d9778b2f 100644 --- a/src/sage/combinat/root_system/type_B.py +++ b/src/sage/combinat/root_system/type_B.py @@ -341,4 +341,3 @@ def _default_folded_cartan_type(self): # For unpickling backward compatibility (Sage <= 4.1) from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.combinat.root_system.type_B', 'ambient_space', AmbientSpace) - diff --git a/src/sage/combinat/root_system/type_BC_affine.py b/src/sage/combinat/root_system/type_BC_affine.py index 8665d908c6e..c3e0640617b 100644 --- a/src/sage/combinat/root_system/type_BC_affine.py +++ b/src/sage/combinat/root_system/type_BC_affine.py @@ -282,4 +282,3 @@ def _default_folded_cartan_type(self): n = self.n return CartanTypeFolded(self, ['A', 2*n - 1, 1], [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) - diff --git a/src/sage/combinat/root_system/type_B_affine.py b/src/sage/combinat/root_system/type_B_affine.py index f818660ec4e..3e356e8cfe8 100644 --- a/src/sage/combinat/root_system/type_B_affine.py +++ b/src/sage/combinat/root_system/type_B_affine.py @@ -210,4 +210,3 @@ def _default_folded_cartan_type(self): return CartanTypeFolded(self, ['A', 1, 1], [[0], [1]]) return CartanTypeFolded(self, ['D', n + 1, 1], [[i] for i in range(n)] + [[n, n+1]]) - diff --git a/src/sage/combinat/root_system/type_C_affine.py b/src/sage/combinat/root_system/type_C_affine.py index 58d90c5961e..087a73029e5 100644 --- a/src/sage/combinat/root_system/type_C_affine.py +++ b/src/sage/combinat/root_system/type_C_affine.py @@ -181,4 +181,3 @@ def _default_folded_cartan_type(self): return CartanTypeFolded(self, ['A', 1, 1], [[0], [1]]) return CartanTypeFolded(self, ['A', 2*n-1, 1], [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) - diff --git a/src/sage/combinat/root_system/type_D_affine.py b/src/sage/combinat/root_system/type_D_affine.py index 03f45ab1fda..76d086f0a91 100644 --- a/src/sage/combinat/root_system/type_D_affine.py +++ b/src/sage/combinat/root_system/type_D_affine.py @@ -202,4 +202,3 @@ def ascii_art(self, label=lambda i: i, node=None): ret += "---".join(node(label(i)) for i in range(1, n)) ret += '\n' + "".join("{!s:4}".format(label(i)) for i in range(1,n)) return ret - diff --git a/src/sage/combinat/root_system/type_F_affine.py b/src/sage/combinat/root_system/type_F_affine.py index edb6a4ac3ad..5a4aeb7d5f7 100644 --- a/src/sage/combinat/root_system/type_F_affine.py +++ b/src/sage/combinat/root_system/type_F_affine.py @@ -129,4 +129,3 @@ def _default_folded_cartan_type(self): """ from sage.combinat.root_system.type_folded import CartanTypeFolded return CartanTypeFolded(self, ['E', 6, 1], [[0], [2], [4], [3, 5], [1, 6]]) - diff --git a/src/sage/combinat/root_system/type_G_affine.py b/src/sage/combinat/root_system/type_G_affine.py index b503edd34a7..b0043e7370d 100644 --- a/src/sage/combinat/root_system/type_G_affine.py +++ b/src/sage/combinat/root_system/type_G_affine.py @@ -124,4 +124,3 @@ def _default_folded_cartan_type(self): """ from sage.combinat.root_system.type_folded import CartanTypeFolded return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) - diff --git a/src/sage/combinat/root_system/type_H.py b/src/sage/combinat/root_system/type_H.py index 776a92c7ebb..f6989013971 100644 --- a/src/sage/combinat/root_system/type_H.py +++ b/src/sage/combinat/root_system/type_H.py @@ -100,4 +100,3 @@ def coxeter_number(self): if self.n == 3: return 10 return 30 - diff --git a/src/sage/combinat/root_system/type_I.py b/src/sage/combinat/root_system/type_I.py index 617782f06cb..8bb3f1f6895 100644 --- a/src/sage/combinat/root_system/type_I.py +++ b/src/sage/combinat/root_system/type_I.py @@ -105,4 +105,3 @@ def coxeter_number(self): 12 """ return self.n - diff --git a/src/sage/combinat/root_system/type_dual.py b/src/sage/combinat/root_system/type_dual.py index 2d472435dd8..2fc8de77a1e 100644 --- a/src/sage/combinat/root_system/type_dual.py +++ b/src/sage/combinat/root_system/type_dual.py @@ -692,4 +692,3 @@ def _default_folded_cartan_type(self): if letter == 'G': # D_4^{(3)} return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) return super(CartanType, self)._default_folded_cartan_type() - diff --git a/src/sage/combinat/root_system/type_folded.py b/src/sage/combinat/root_system/type_folded.py index 93891fc941a..9482ec494c4 100644 --- a/src/sage/combinat/root_system/type_folded.py +++ b/src/sage/combinat/root_system/type_folded.py @@ -296,4 +296,3 @@ def f(i): cmax = max(c) return Family(dict( (i, int(cmax / c[i])) for i in self._cartan_type.index_set() )) - diff --git a/src/sage/combinat/sf/__init__.py b/src/sage/combinat/sf/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/sf/__init__.py +++ b/src/sage/combinat/sf/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/sf/character.py b/src/sage/combinat/sf/character.py index ef899203813..e55f356f5d1 100644 --- a/src/sage/combinat/sf/character.py +++ b/src/sage/combinat/sf/character.py @@ -594,4 +594,3 @@ def _self_to_other_on_basis(self, lam): 3*s[1] - 2*s[1, 1] - 2*s[2] + s[2, 1] """ return self._other(self._self_to_power_on_basis(lam)) - diff --git a/src/sage/combinat/sf/dual.py b/src/sage/combinat/sf/dual.py index d801ccd3a18..677a8dcfd3f 100644 --- a/src/sage/combinat/sf/dual.py +++ b/src/sage/combinat/sf/dual.py @@ -893,4 +893,3 @@ def expand(self, n, alphabet='x'): # Backward compatibility for unpickling from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.combinat.sf.dual', 'SymmetricFunctionAlgebraElement_dual', SymmetricFunctionAlgebra_dual.Element) - diff --git a/src/sage/combinat/sf/k_dual.py b/src/sage/combinat/sf/k_dual.py index 8f910a796fb..7b557b25104 100644 --- a/src/sage/combinat/sf/k_dual.py +++ b/src/sage/combinat/sf/k_dual.py @@ -1467,4 +1467,3 @@ def _m_to_F_on_basis(self, la): h = kB.khomogeneous() ks = kB.kschur() return sum( h(ks(x)).coefficient(la) * self(x) for x in PartitionsGreatestLE(sum(la), self.k)) - diff --git a/src/sage/combinat/sf/kfpoly.py b/src/sage/combinat/sf/kfpoly.py index e4a92ad2663..cf465b3e8c4 100644 --- a/src/sage/combinat/sf/kfpoly.py +++ b/src/sage/combinat/sf/kfpoly.py @@ -393,4 +393,3 @@ def weight(rg, t=None): mu = nu[k-1][i] - mid[i] res *= t**int(mu * (mu-1) // 2) return res - diff --git a/src/sage/combinat/sf/orthogonal.py b/src/sage/combinat/sf/orthogonal.py index 336ddb7c198..b0ed060ee85 100644 --- a/src/sage/combinat/sf/orthogonal.py +++ b/src/sage/combinat/sf/orthogonal.py @@ -242,4 +242,3 @@ def _s_to_o_on_basis(self, lam): for nu in Partitions(j) ) for j in range(n//2+1) # // 2 for horizontal dominoes for mu in Partitions(n-2*j) }) - diff --git a/src/sage/combinat/sf/sf.py b/src/sage/combinat/sf/sf.py index eff9d392605..b4418a40606 100644 --- a/src/sage/combinat/sf/sf.py +++ b/src/sage/combinat/sf/sf.py @@ -1613,4 +1613,3 @@ def __call__(self, partition): # will have an optional optimization for the case when there # is no repetition in the support return self._codomain._from_dict(dict(self._t(self.fake_sym.monomial(partition))), coerce = True) - diff --git a/src/sage/combinat/sf/symplectic.py b/src/sage/combinat/sf/symplectic.py index be615f2ddcb..bd5a44bd615 100644 --- a/src/sage/combinat/sf/symplectic.py +++ b/src/sage/combinat/sf/symplectic.py @@ -249,4 +249,3 @@ def _s_to_sp_on_basis(self, lam): for nu in Partitions(j) ) for j in range(n//2+1) # // 2 for vertical dominoes for mu in Partitions(n-2*j) }) - diff --git a/src/sage/combinat/sf/witt.py b/src/sage/combinat/sf/witt.py index fbc7979936b..58da090aec1 100644 --- a/src/sage/combinat/sf/witt.py +++ b/src/sage/combinat/sf/witt.py @@ -1334,5 +1334,3 @@ def verschiebung(self, n): if all( i % n == 0 for i in lam )} result_in_w_basis = parent._from_dict(dct) return parent(result_in_w_basis) - - diff --git a/src/sage/combinat/shifted_primed_tableau.py b/src/sage/combinat/shifted_primed_tableau.py index 5b8eb900ece..fbd5ab6c173 100644 --- a/src/sage/combinat/shifted_primed_tableau.py +++ b/src/sage/combinat/shifted_primed_tableau.py @@ -2727,4 +2727,3 @@ def _add_strip(sub_tab, full_tab, length): k=len(plat_list), outer=plat_list): yield list(primed_strip) + list(non_primed_strip) - diff --git a/src/sage/combinat/six_vertex_model.py b/src/sage/combinat/six_vertex_model.py index a310a84cb4b..936a7e95b52 100644 --- a/src/sage/combinat/six_vertex_model.py +++ b/src/sage/combinat/six_vertex_model.py @@ -776,4 +776,3 @@ def to_alternating_sign_matrix(self): #ASM = AlternatingSignMatrices(self.parent()._nrows) #return ASM(self.to_signed_matrix()) return AlternatingSignMatrix(self.to_signed_matrix()) - diff --git a/src/sage/combinat/species/__init__.py b/src/sage/combinat/species/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/species/__init__.py +++ b/src/sage/combinat/species/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index 298bcd8ca94..02e1bb52332 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -1364,4 +1364,3 @@ def LogarithmCycleIndexSeries(R = RationalField()): """ CIS = CycleIndexSeriesRing(R) return CIS(_cl_gen(R)) - diff --git a/src/sage/combinat/symmetric_group_representations.py b/src/sage/combinat/symmetric_group_representations.py index b7f93ba5733..a27cd240733 100644 --- a/src/sage/combinat/symmetric_group_representations.py +++ b/src/sage/combinat/symmetric_group_representations.py @@ -1011,4 +1011,3 @@ def partition_to_vector_of_contents(partition, reverse=False): if reverse: return tuple(v)[::-1] return tuple(v) - diff --git a/src/sage/combinat/words/infinite_word.py b/src/sage/combinat/words/infinite_word.py index db8f15d577e..8baae7c1c3c 100644 --- a/src/sage/combinat/words/infinite_word.py +++ b/src/sage/combinat/words/infinite_word.py @@ -110,4 +110,3 @@ def length(self): +Infinity """ return Infinity - diff --git a/src/sage/combinat/words/morphic.py b/src/sage/combinat/words/morphic.py index 1e1c8d7847c..f84a90f6bb5 100644 --- a/src/sage/combinat/words/morphic.py +++ b/src/sage/combinat/words/morphic.py @@ -360,5 +360,3 @@ def __iter__(self): w = chain([next_w], w, self._morphism.image(next_w)) except StopIteration: return - - diff --git a/src/sage/combinat/words/word_infinite_datatypes.py b/src/sage/combinat/words/word_infinite_datatypes.py index 95664b687af..07ad69bebf0 100644 --- a/src/sage/combinat/words/word_infinite_datatypes.py +++ b/src/sage/combinat/words/word_infinite_datatypes.py @@ -1214,4 +1214,3 @@ def flush(self): self._gen = iter(self) self._list = [] self._last_index = -1 - From 4cb1b7efa9e04b4cfdfc8d02632e74bcf6914088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 15:26:28 +0200 Subject: [PATCH 207/338] fix W2 (trailing whitespaces) in combinat --- src/sage/combinat/crystals/virtual_crystal.py | 2 +- src/sage/combinat/finite_state_machine.py | 6 ++-- src/sage/combinat/recognizable_series.py | 2 +- .../bij_abstract_class.py | 2 +- .../rigged_configurations/bij_type_A2_even.py | 2 +- .../rigged_configurations/bij_type_B.py | 4 +-- .../rigged_configurations/bij_type_D.py | 2 +- src/sage/combinat/root_system/fusion_ring.py | 20 +++++------ .../root_system/integrable_representations.py | 36 +++++++++---------- src/sage/combinat/root_system/type_dual.py | 4 +-- src/sage/combinat/sf/macdonald.py | 4 +-- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/sage/combinat/crystals/virtual_crystal.py b/src/sage/combinat/crystals/virtual_crystal.py index 8cdcf92f57d..a537a64bfb8 100644 --- a/src/sage/combinat/crystals/virtual_crystal.py +++ b/src/sage/combinat/crystals/virtual_crystal.py @@ -198,7 +198,7 @@ def __classcall_private__(cls, ambient, virtualization, scaling_factors, return super(Subcrystal, cls).__classcall__(cls, ambient, virtualization, scaling_factors, contained, tuple(generators), cartan_type, tuple(index_set), category) - + def __init__(self, ambient, virtualization, scaling_factors, contained, generators, cartan_type, index_set, category): """ diff --git a/src/sage/combinat/finite_state_machine.py b/src/sage/combinat/finite_state_machine.py index f52a0f129d6..3538146f22e 100644 --- a/src/sage/combinat/finite_state_machine.py +++ b/src/sage/combinat/finite_state_machine.py @@ -2012,7 +2012,7 @@ def __bool__(self): """ return True # A state cannot be zero (see __init__) - + def _epsilon_successors_(self, fsm=None): """ @@ -2491,7 +2491,7 @@ def __bool__(self): """ return True # A transition cannot be zero (see __init__) - + # **************************************************************************** @@ -3932,7 +3932,7 @@ def __bool__(self): """ return bool(self._states_) - + def __eq__(self, other): """ diff --git a/src/sage/combinat/recognizable_series.py b/src/sage/combinat/recognizable_series.py index 504fce7d808..808f5436e6e 100644 --- a/src/sage/combinat/recognizable_series.py +++ b/src/sage/combinat/recognizable_series.py @@ -901,7 +901,7 @@ def __bool__(self): return False return True - + def __hash__(self): r""" diff --git a/src/sage/combinat/rigged_configurations/bij_abstract_class.py b/src/sage/combinat/rigged_configurations/bij_abstract_class.py index 8e6042a2663..bbc3a4e5d04 100644 --- a/src/sage/combinat/rigged_configurations/bij_abstract_class.py +++ b/src/sage/combinat/rigged_configurations/bij_abstract_class.py @@ -214,7 +214,7 @@ def _update_vacancy_nums(self, a): sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[2,1]]) sage: from sage.combinat.rigged_configurations.bij_abstract_class import KRTToRCBijectionAbstract - sage: bijection = KRTToRCBijectionAbstract(KRT(pathlist=[[3,2]])) + sage: bijection = KRTToRCBijectionAbstract(KRT(pathlist=[[3,2]])) sage: bijection._update_vacancy_nums(2) """ # Check to make sure we have a valid index (currently removed) diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_even.py b/src/sage/combinat/rigged_configurations/bij_type_A2_even.py index be1cd2c4cd3..7253b9b6579 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_even.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_even.py @@ -90,7 +90,7 @@ def next_state(self, val): for a in range(pos_val - 1, n): max_width = self.ret_rig_con[a].insert_cell(max_width) case_S[a] = max_width - + # Special case for n self._insert_cell_case_S(self.ret_rig_con[n-1]) diff --git a/src/sage/combinat/rigged_configurations/bij_type_B.py b/src/sage/combinat/rigged_configurations/bij_type_B.py index 05b6f56f6c9..c73d2a41483 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_B.py +++ b/src/sage/combinat/rigged_configurations/bij_type_B.py @@ -590,7 +590,7 @@ def run(self, verbose=False, build_graph=False): from sage.combinat.rigged_configurations.bij_type_A2_odd import RCToKRTBijectionTypeA2Odd from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations from sage.combinat.rigged_configurations.rigged_partition import RiggedPartition, RiggedPartitionTypeB - + # Convert to a type A_{2n-1}^{(2)} RC RC = RiggedConfigurations(['A', 2*self.n-1, 2], self.cur_dims) if verbose: @@ -868,7 +868,7 @@ def next_state(self, height): else: row_num_next = None row_num_bar_next = None - + self._update_vacancy_numbers(n - 2) if row_num is not None: self.cur_partitions[n-2].rigging[row_num] = self.cur_partitions[n-2].vacancy_numbers[row_num] diff --git a/src/sage/combinat/rigged_configurations/bij_type_D.py b/src/sage/combinat/rigged_configurations/bij_type_D.py index 48ad54873ab..b45ec097ed0 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D.py @@ -508,7 +508,7 @@ def run(self, verbose=False, build_graph=False): self.cur_dims[0][0] -= 1 # This takes care of the indexing b = self.next_state(self.cur_dims[0][0]) - + # Corrections for spinor if dim[0] == self.n and b == -self.n \ and self.cur_dims[0][0] == self.n - 1: diff --git a/src/sage/combinat/root_system/fusion_ring.py b/src/sage/combinat/root_system/fusion_ring.py index 315fc98e8c5..b261550db21 100644 --- a/src/sage/combinat/root_system/fusion_ring.py +++ b/src/sage/combinat/root_system/fusion_ring.py @@ -117,7 +117,7 @@ class FusionRing(WeylCharacterRing): The fusion ring has a number of methods that reflect its role as the Grothendieck ring of a *modular tensor category* (MTC). These include twist methods :meth:`Element.twist` and :meth:`Element.ribbon` - for its elements related to the ribbon structure, and the + for its elements related to the ribbon structure, and the S-matrix :meth:`s_ij`. There are two natural normalizations of the S-matrix. Both @@ -129,7 +129,7 @@ class FusionRing(WeylCharacterRing): The unitary S-matrix is `s=D^{-1/2}\tilde{s}` where .. MATH:: - + D = \sum_V d_i(V)^2. The sum is over all simple objects `V` with @@ -547,7 +547,7 @@ def virasoro_central_charge(self): field theory associated with the Fusion Ring. If `\mathfrak{g}` is the corresponding semisimple Lie algebra, this is - + .. MATH:: \frac{k\dim\mathfrak{g}}{k+h^\vee}, @@ -562,7 +562,7 @@ def virasoro_central_charge(self): is computed in :meth:`D_plus` and `D = \sum d_i^2 > 0` is computed by :meth:`global_q_dimension`. Squaring this identity and remembering that `D_+ D_- = D` gives - + .. MATH:: D_+ / D_- = e^{i\pi c/2}. @@ -707,7 +707,7 @@ def s_matrix(self, unitary=False): - ``unitary`` -- (default: ``False``) set to ``True`` to obtain the unitary S-matrix - Without the ``unitary`` parameter, this is the matrix denoted + Without the ``unitary`` parameter, this is the matrix denoted `\widetilde{s}` in [BaKi2001]_. EXAMPLES:: @@ -735,14 +735,14 @@ def s_matrix(self, unitary=False): return S / self.total_q_order() else: return S - + @cached_method def r_matrix(self, i, j, k): r""" Return the R-matrix entry corresponding to the subobject ``k`` in the tensor product of ``i`` with ``j``. - .. WARNING:: + .. WARNING:: This method only gives complete information when `N_{ij}^k = 1` (an important special case). Tables of MTC including R-matrices @@ -757,7 +757,7 @@ def r_matrix(self, i, j, k): R-matrix. This method computes that scalar. It is possible to adjust the set of embeddings `k \rightarrow i \otimes j` (called a *gauge*) so that this scalar equals - + .. MATH:: \pm \sqrt{\frac{ \theta_k }{ \theta_i \theta_j }}. @@ -906,7 +906,7 @@ def weight(self): def twist(self, reduced=True): r""" - Return a rational number `h` such that `\theta = e^{i \pi h}` + Return a rational number `h` such that `\theta = e^{i \pi h}` is the twist of ``self``. The quantity `e^{i \pi h}` is also available using :meth:`ribbon`. @@ -915,7 +915,7 @@ def twist(self, reduced=True): `h = \langle \lambda, \lambda+2\rho \rangle`, where `\rho` is half the sum of the positive roots. As in [Row2006]_, this requires normalizing - the invariant bilinear form so that + the invariant bilinear form so that `\langle \alpha, \alpha \rangle = 2` for short roots. INPUT: diff --git a/src/sage/combinat/root_system/integrable_representations.py b/src/sage/combinat/root_system/integrable_representations.py index edb6565ab09..e17e6b3c7fe 100644 --- a/src/sage/combinat/root_system/integrable_representations.py +++ b/src/sage/combinat/root_system/integrable_representations.py @@ -42,8 +42,8 @@ class IntegrableRepresentation(UniqueRepresentation, CategoryObject): .. [KacPeterson] Kac and Peterson. *Infinite-dimensional Lie algebras, theta functions and modular forms*. Adv. in Math. 53 (1984), no. 2, 125-264. - - .. [Carter] Carter, *Lie algebras of finite and affine type*. Cambridge + + .. [Carter] Carter, *Lie algebras of finite and affine type*. Cambridge University Press, 2005 If `\Lambda` is a dominant integral weight for an affine root system, @@ -61,7 +61,7 @@ class IntegrableRepresentation(UniqueRepresentation, CategoryObject): lattice and `\rho` is the Weyl vector. Moreover if `m(\mu)>0` then `\mu\in\operatorname{supp}(V)` differs from `\Lambda` by an element of the root lattice ([Ka1990]_, Propositions 11.3 and 11.4). - + Let `\delta` be the nullroot, which is the lowest positive imaginary root. Then by [Ka1990]_, Proposition 11.3 or Corollary 11.9, for fixed `\mu` the function `m(\mu - k\delta)` is a monotone increasing function of @@ -150,9 +150,9 @@ class IntegrableRepresentation(UniqueRepresentation, CategoryObject): Lambda[0] + Lambda[2] - delta: 1 5 18 55 149 372 872 1941 4141 8523 17005 33019 2*Lambda[1] - delta: 1 4 15 44 122 304 721 1612 3469 7176 14414 28124 2*Lambda[2] - 2*delta: 2 7 26 72 194 467 1084 2367 5010 10191 20198 38907 - + Examples for twisted affine types:: - + sage: Lambda = RootSystem(["A",2,2]).weight_lattice(extended=True).fundamental_weights() sage: IntegrableRepresentation(Lambda[0]).strings() {Lambda[0]: [1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56]} @@ -421,7 +421,7 @@ def _inner_pq(self, pelt, qelt): mcp = pelt.monomial_coefficients() mcq = qelt.monomial_coefficients() zero = ZZ.zero() - return sum(mcp.get(i, zero) * mcq[i] / self._eps[i] for i in mcq) + return sum(mcp.get(i, zero) * mcq[i] / self._eps[i] for i in mcq) def _inner_pp(self, pelt1, pelt2): """ @@ -616,7 +616,7 @@ def _freudenthal_roots_imaginary(self, nu): EXAMPLES:: sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights() - sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3]) + sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3]) sage: [list(V._freudenthal_roots_imaginary(V.highest_weight() - mw)) ....: for mw in V.dominant_maximal_weights()] [[], [], [], [], []] @@ -631,10 +631,10 @@ def _freudenthal_roots_real(self, nu): r""" Iterate over the set of real positive roots `\alpha \in \Delta^+` in ``self`` such that `\nu - \alpha \in Q^+`. - + See [Ka1990]_ Proposition 6.3 for the way to compute the set of real roots for twisted affine case. - + INPUT: - ``nu`` -- an element in `Q` @@ -686,7 +686,7 @@ def _freudenthal_roots_real(self, nu): if rt not in ret: ret.add(rt) yield rt - + elif self._cartan_type.dual().type() == 'G': # case D^3_4 in the Kac notation for al in self._classical_roots: @@ -746,11 +746,11 @@ def _m_freudenthal(self, n): Compute the weight multiplicity using the Freudenthal multiplicity formula in ``self``. - The multiplicities of the imaginary roots for the twisted + The multiplicities of the imaginary roots for the twisted affine case are different than those for the untwisted case. See [Carter]_ Corollary 18.10 for general type and Corollary 18.15 for `A^2_{2l}` - + EXAMPLES:: sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights() @@ -798,7 +798,7 @@ def _m_freudenthal(self, n): # k-th element (starting from 1) is k*delta num += (4 - 2*val) * self._freudenthal_accum(mu, rt) val = 1 - val - + elif self._cartan_type.dual().type() == 'G': # D_4^{(3)} (or dual of G_2^{(1)}) for k,rt in enumerate(self._freudenthal_roots_imaginary(self._Lam - mu)): # k-th element (starting from 1) is k*delta @@ -819,7 +819,7 @@ def m(self, n): `\mu = \Lambda - \sum_i n_i \alpha_i`. INPUT: - + - ``n`` -- a tuple representing a weight `\mu`. EXAMPLES:: @@ -1115,7 +1115,7 @@ def branch(self, i=None, weyl_character_ring=None, sequence=None, depth=5): | | O---O=>=O - 1 2 3 + 1 2 3 B3~ In this example, we observe that removing the `i=2` node from the @@ -1142,14 +1142,14 @@ def branch(self, i=None, weyl_character_ring=None, sequence=None, depth=5): sage: V = IntegrableRepresentation(Lambda[0]) sage: V.cartan_type().dynkin_diagram() O---O---O=>=O---O - 0 1 2 3 4 + 0 1 2 3 4 F4~ sage: A1xC3=WeylCharacterRing("A1xC3",style="coroots") sage: A1xC3.dynkin_diagram() O - 1 + 1 O---O=<=O - 2 3 4 + 2 3 4 A1xC3 Observe that removing the `i=1` node from the ``F4~`` Dynkin diagram diff --git a/src/sage/combinat/root_system/type_dual.py b/src/sage/combinat/root_system/type_dual.py index 2fc8de77a1e..3c9e48397fe 100644 --- a/src/sage/combinat/root_system/type_dual.py +++ b/src/sage/combinat/root_system/type_dual.py @@ -272,7 +272,7 @@ def ascii_art(self, label=lambda i: i, node=None): def __eq__(self, other): """ Return whether ``self`` is equal to ``other``. - + EXAMPLES:: sage: B41 = CartanType(['B', 4, 1]) @@ -293,7 +293,7 @@ def __eq__(self, other): def __ne__(self, other): """ Return whether ``self`` is equal to ``other``. - + EXAMPLES:: sage: B41 = CartanType(['B', 4, 1]) diff --git a/src/sage/combinat/sf/macdonald.py b/src/sage/combinat/sf/macdonald.py index c797d7a0cd4..3bc4bdbfd5f 100644 --- a/src/sage/combinat/sf/macdonald.py +++ b/src/sage/combinat/sf/macdonald.py @@ -1180,7 +1180,7 @@ def _to_s(self, part): class Element(MacdonaldPolynomials_generic.Element): pass - + class MacdonaldPolynomials_h(MacdonaldPolynomials_generic): def __init__(self, macdonald): r""" @@ -1346,7 +1346,7 @@ def _m_to_self( self, f ): Convert an element ``f`` from the monomial basis to the ``H`` basis. This calculation is performed by using the fact that `H_\mu[X(1-t)]` - is `c_\mu m_\mu` plus terms which are smaller in dominance order. + is `c_\mu m_\mu` plus terms which are smaller in dominance order. The leading coefficient of the expansion of ``f`` in the `H_\mu` basis is equal to the leading coefficient of `c_\mu^{-1} f[X(1-t)]`. From 762e0b75bdb7cc939a9d7b8223872abb3e00398e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 21 Mar 2022 20:17:07 +0100 Subject: [PATCH 208/338] use language_level=3 for cython --- src/sage/arith/srange.pyx | 8 +- src/sage/combinat/words/word_datatypes.pyx | 7 +- src/sage/crypto/lwe.py | 10 +-- src/sage/matrix/matrix2.pyx | 5 +- src/sage/misc/cython.py | 2 +- src/sage/misc/parser.pyx | 80 +++++++++---------- src/sage/misc/sagedoc.py | 4 +- src/sage/rings/finite_rings/integer_mod.pyx | 3 +- src/sage/rings/integer.pyx | 2 +- src/sage/rings/real_mpfi.pyx | 6 +- src/sage/rings/real_mpfr.pyx | 4 +- .../discrete_gaussian_integer.pyx | 12 +-- src/sage/symbolic/expression.pyx | 4 +- src/sage_setup/cython_options.py | 4 +- 14 files changed, 76 insertions(+), 75 deletions(-) diff --git a/src/sage/arith/srange.pyx b/src/sage/arith/srange.pyx index 041d96996d8..c21a43c0ee1 100644 --- a/src/sage/arith/srange.pyx +++ b/src/sage/arith/srange.pyx @@ -1,4 +1,3 @@ -# cython: language_level=2 """ Ranges and the ``[1,2,..,n]`` notation @@ -16,7 +15,7 @@ AUTHORS: # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# http://www.gnu.org/licenses/ +# https://www.gnu.org/licenses/ # **************************************************************************** @@ -396,10 +395,9 @@ def ellipsis_iter(*args, step=None): if len(args) > step_magic+1: i = step_magic more = xsrange(args[i-2], args[i+1], step, coerce=False, include_endpoint=True) - a = None for a in more: + last_end = a yield a - last_end = a skip = True next_ = None step_magic += 1 @@ -428,8 +426,8 @@ def ellipsis_iter(*args, step=None): if last_end != first: yield first for a in more: + last_end = a yield a - last_end = a except StopIteration: last_end = None skip = True diff --git a/src/sage/combinat/words/word_datatypes.pyx b/src/sage/combinat/words/word_datatypes.pyx index 98d0df2616c..9c48e1af874 100644 --- a/src/sage/combinat/words/word_datatypes.pyx +++ b/src/sage/combinat/words/word_datatypes.pyx @@ -711,11 +711,10 @@ cdef class WordDatatype_str(WordDatatype): sep = sep._data else: raise ValueError("the separator must be a string") - if maxsplit is None: - return [self._parent(z) for z in self._data.split(sep)] - else: - return [self._parent(z) for z in self._data.split(sep, maxsplit)] + maxsplit = -1 + return [self._parent(z) for z in self._data.split(sep=sep, + maxsplit=maxsplit)] def partition(self, sep): r""" diff --git a/src/sage/crypto/lwe.py b/src/sage/crypto/lwe.py index 8224caf5da7..bc027e97362 100644 --- a/src/sage/crypto/lwe.py +++ b/src/sage/crypto/lwe.py @@ -274,7 +274,7 @@ def __init__(self, n, q, D, secret_dist='uniform', m=None): sage: from sage.crypto.lwe import LWE sage: lwe = LWE(n=20, q=next_prime(400), D=D); lwe - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0, 'uniform', None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000, 'uniform', None) and sample 1000 samples:: @@ -335,10 +335,10 @@ def _repr_(self): sage: from sage.crypto.lwe import LWE sage: D = DiscreteGaussianDistributionIntegerSampler(3.0) sage: lwe = LWE(n=20, q=next_prime(400), D=D); lwe - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0, 'uniform', None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000, 'uniform', None) sage: lwe = LWE(n=20, q=next_prime(400), D=D, secret_dist=(-3, 3)); lwe - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0, (-3, 3), None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000, (-3, 3), None) """ if isinstance(self.secret_dist, str): return "LWE(%d, %d, %s, '%s', %s)"%(self.n,self.K.order(),self.D,self.secret_dist, self.m) @@ -388,7 +388,7 @@ def __init__(self, n, secret_dist='uniform', m=None): sage: from sage.crypto.lwe import Regev sage: Regev(n=20) - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 1.915069 and c = 401, 'uniform', None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 1.915069 and c = 401.000000, 'uniform', None) """ q = ZZ(next_prime(n**2)) s = RR(1/(RR(n).sqrt() * log(n, 2)**2) * q) @@ -418,7 +418,7 @@ def __init__(self, n, delta=0.01, m=None): sage: from sage.crypto.lwe import LindnerPeikert sage: LindnerPeikert(n=20) - LWE(20, 2053, Discrete Gaussian sampler over the Integers with sigma = 3.600954 and c = 0, 'noise', 168) + LWE(20, 2053, Discrete Gaussian sampler over the Integers with sigma = 3.600954 and c = 0.000000, 'noise', 168) """ if m is None: m = 2*n + 128 diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 90d87b6e49d..070d92100ac 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -1639,7 +1639,7 @@ cdef class Matrix(Matrix1): Q = (At * A) * (B * Bt) return Bt * ~Q * At - def rook_vector(self, algorithm="ButeraPernici", complement=False, use_complement=None): + def rook_vector(self, algorithm=None, complement=False, use_complement=None): r""" Return the rook vector of this matrix. @@ -1794,6 +1794,9 @@ cdef class Matrix(Matrix1): zero = self.base_ring().zero() one = self.base_ring().one() + if algorithm is None: + algorithm = "ButeraPernici" + # we first run through the coefficients of the matrix to compute the # number of non-zero coefficients and to see whether or not it contains # only elements in {0,1}... but this is not always needed diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index 7eadbd39cc0..150e448fd46 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -341,7 +341,7 @@ def cython(filename, verbose=0, compile_message=False, libraries=standard_libs, library_dirs=standard_libdirs) - directives = dict(language_level=sys.version_info[0], cdivision=True) + directives = dict(language_level=3, cdivision=True) try: # Change directories to target_dir so that Cython produces the correct diff --git a/src/sage/misc/parser.pyx b/src/sage/misc/parser.pyx index 8a563c8af2d..a365c3c79ea 100644 --- a/src/sage/misc/parser.pyx +++ b/src/sage/misc/parser.pyx @@ -272,11 +272,11 @@ cdef class Tokenizer: return NOT_EQ elif s[pos] == '=': self.pos += 2 - return '=' + return ord('=') elif s[pos] == '*' and s[pos+1] == '*': self.pos += 2 - return '^' + return ord('^') # simple tokens if s[pos] in "+-*/^()=><,[]{}!": @@ -609,13 +609,13 @@ cdef class Parser: """ cdef int token all = [] - if tokens.next() == '(': - token = ',' - while token == ',': + if tokens.next() == c'(': + token = c',' + while token == c',': all.append(self.p_list(tokens)) token = tokens.next() - if token == ')': + if token == c')': from sage.matrix.constructor import matrix return matrix(all) else: @@ -637,8 +637,8 @@ cdef class Parser: [(1, 2, 3), [a + 1, b + 2, c + 3, (d + 4,)]] """ all = [] - cdef int token = ',' - while token == ',': + cdef int token = c',' + while token == c',': token = tokens.peek() if token == MATRIX: tokens.next() @@ -651,14 +651,14 @@ cdef class Parser: else: tokens.backtrack() obj = self.p_eqn(tokens) - elif token == '[': + elif token == c'[': obj = self.p_list(tokens) - elif token == '(': + elif token == c'(': obj = self.p_tuple(tokens) elif token == EOS: return all - elif token == ']' or token == ')': - tokens.token = ',' + elif token == c']' or token == c')': + tokens.token = c',' return all else: obj = self.p_eqn(tokens) @@ -682,11 +682,11 @@ cdef class Parser: [] """ cdef int token = tokens.next() - if token != '[': + if token != c'[': self.parse_error(tokens, "Malformed list") all = self.p_sequence(tokens) token = tokens.next() - if token != ']': + if token != c']': self.parse_error(tokens, "Malformed list") return all @@ -704,20 +704,20 @@ cdef class Parser: cdef int start = tokens.pos cdef int token = tokens.next() cdef bint real_tuple = True - if token != '(': + if token != c'(': self.parse_error(tokens, "Malformed tuple") all = self.p_sequence(tokens) if len(all) == 1: if tokens.last() != c',': real_tuple = False token = tokens.next() - if token != ')': + if token != c')': self.parse_error(tokens, "Malformed tuple") if real_tuple: return tuple(all) else: token = tokens.peek() - if token == ',' or token == EOS: + if token == c',' or token == EOS: return all[0] else: # we have to reparse the entire thing as an expression @@ -753,15 +753,15 @@ cdef class Parser: """ lhs = self.p_expr(tokens) cdef int op = tokens.next() - if op == '=': + if op == c'=': return lhs == self.p_expr(tokens) elif op == NOT_EQ: return lhs != self.p_expr(tokens) - elif op == '<': + elif op == c'<': return lhs < self.p_expr(tokens) elif op == LESS_EQ: return lhs <= self.p_expr(tokens) - elif op == '>': + elif op == c'>': return lhs > self.p_expr(tokens) elif op == GREATER_EQ: return lhs >= self.p_expr(tokens) @@ -793,9 +793,9 @@ cdef class Parser: cdef int op operand1 = self.p_term(tokens) op = tokens.next() - while op == '+' or op == '-': + while op == c'+' or op == c'-': operand2 = self.p_term(tokens) - if op == '+': + if op == c'+': operand1 = operand1 + operand2 else: operand1 = operand1 - operand2 @@ -828,17 +828,17 @@ cdef class Parser: operand1 = self.p_factor(tokens) op = tokens.next() if op == NAME and self.implicit_multiplication: - op = '*' + op = c'*' tokens.backtrack() - while op == '*' or op == '/': + while op == c'*' or op == c'/': operand2 = self.p_factor(tokens) - if op == '*': + if op == c'*': operand1 = operand1 * operand2 else: operand1 = operand1 / operand2 op = tokens.next() if op == NAME and self.implicit_multiplication: - op = '*' + op = c'*' tokens.backtrack() tokens.backtrack() return operand1 @@ -862,9 +862,9 @@ cdef class Parser: t^11 """ cdef int token = tokens.next() - if token == '+': + if token == c'+': return self.p_factor(tokens) - elif token == '-': + elif token == c'-': return -self.p_factor(tokens) else: tokens.backtrack() @@ -898,13 +898,13 @@ cdef class Parser: """ operand1 = self.p_atom(tokens) cdef int token = tokens.next() - if token == '^': + if token == c'^': operand2 = self.p_factor(tokens) return operand1 ** operand2 - elif token == "!": + elif token == c"!": from sage.functions.all import factorial operand1 = factorial(operand1) - if tokens.peek() == '^': + if tokens.peek() == c'^': tokens.next() operand2 = self.p_factor(tokens) return operand1 ** operand2 @@ -949,20 +949,20 @@ cdef class Parser: elif token == NAME: name = tokens.last_token_string() token = tokens.next() - if token == '(': + if token == c'(': func = self.callable_constructor(name) args, kwds = self.p_args(tokens) token = tokens.next() - if token != ')': + if token != c')': self.parse_error(tokens, "Bad function call") return func(*args, **kwds) else: tokens.backtrack() return self.variable_constructor(name) - elif token == '(': + elif token == c'(': expr = self.p_expr(tokens) token = tokens.next() - if token != ')': + if token != c')': self.parse_error(tokens, "Mismatched parentheses") return expr else: @@ -984,10 +984,10 @@ cdef class Parser: """ args = [] kwds = {} - if tokens.peek() == ')': + if tokens.peek() == c')': return args, kwds - cdef int token = ',' - while token == ',': + cdef int token = c',' + while token == c',': arg = self.p_arg(tokens) if isinstance(arg, tuple): name, value = arg @@ -1029,11 +1029,11 @@ cdef class Parser: """ cdef int token = tokens.next() - if token == NAME and tokens.peek() == '=': + if token == NAME and tokens.peek() == c'=': name = tokens.last_token_string() tokens.next() return name, self.p_expr(tokens) - if token == "[" : + if token == c"[": tokens.backtrack() return self.p_list(tokens) else: diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 37fd5d8b6e6..f49d375d1eb 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -609,10 +609,10 @@ def format(s, embedded=False): EXAMPLES:: sage: from sage.misc.sagedoc import format - sage: identity_matrix(2).rook_vector.__doc__[202:274] + sage: identity_matrix(2).rook_vector.__doc__[191:263] 'Let `A` be an `m` by `n` (0,1)-matrix. We identify `A` with a chessboard' - sage: format(identity_matrix(2).rook_vector.__doc__[202:274]) + sage: format(identity_matrix(2).rook_vector.__doc__[191:263]) 'Let A be an m by n (0,1)-matrix. We identify A with a chessboard\n' If the first line of the string is 'nodetex', remove 'nodetex' but diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 0489e50b1bc..714d796ec90 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -1,4 +1,3 @@ -# cython: language_level=2 r""" Elements of `\ZZ/n\ZZ` @@ -1559,7 +1558,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): if nval >= plog.valuation() + (-1 if p == 2 else 0): if self == 1: if all: - return [s*K(p*k+m.lift()) for k in range(p**(k-(2 if p==2 else 1))) for m in modp for s in sign] + return [s*K(p*a+m.lift()) for a in range(p**(k-(2 if p==2 else 1))) for m in modp for s in sign] else: return K(modp.lift()) else: diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 682fa8cba64..a4399439015 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -7099,7 +7099,7 @@ cdef int mpz_set_str_python(mpz_ptr z, char* s, int base) except -1: x += 1 # Strip spaces # Disallow a sign here - if x[0] == '-' or x[0] == '+': + if x[0] == c'-' or x[0] == c'+': x = "" # Force an error below assert base >= 2 diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 1f01ff8ac55..9eada6a2bc0 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1943,12 +1943,12 @@ cdef class RealIntervalFieldElement(RingElement): cdef long digits digits = strlen(lower_s) - if lower_s[0] == '-': + if lower_s[0] == b'-': digits -= 1 lower_expo -= digits digits = strlen(upper_s) - if upper_s[0] == '-': + if upper_s[0] == b'-': digits -= 1 upper_expo -= digits @@ -2117,7 +2117,7 @@ cdef class RealIntervalFieldElement(RingElement): raise MemoryError("Unable to allocate memory for the mantissa of an interval") mpz_get_str(tmp_cstr, base, lower_mpz) digits = strlen(tmp_cstr) - if tmp_cstr[0] == '-': + if tmp_cstr[0] == b'-': digits -= 1 mant_string = bytes_to_str(tmp_cstr+1) sign_string = bytes_to_str(b'-') diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index e9c94e4eba2..3ea8c1dee1f 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -2092,12 +2092,12 @@ cdef class RealNumber(sage.structure.element.RingElement): if s is NULL: raise RuntimeError("unable to convert an mpfr number to a string") # t contains just digits (no sign, decimal point or exponent) - if s[0] == '-': + t = char_to_str(s) + if t[0] == '-': sgn = "-" t = char_to_str(s + 1) else: sgn = "" - t = char_to_str(s) mpfr_free_str(s) if skip_zeroes: diff --git a/src/sage/stats/distributions/discrete_gaussian_integer.pyx b/src/sage/stats/distributions/discrete_gaussian_integer.pyx index 328c34756d8..87fbe6ca5cd 100644 --- a/src/sage/stats/distributions/discrete_gaussian_integer.pyx +++ b/src/sage/stats/distributions/discrete_gaussian_integer.pyx @@ -219,16 +219,16 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+online") - Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+table") - Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+logtable") - Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 Note that ``"sigma2+logtable"`` adjusts `σ`:: sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="sigma2+logtable") - Discrete Gaussian sampler over the Integers with sigma = 3.397287 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.397287 and c = 0.000000 TESTS: @@ -491,6 +491,6 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler sage: repr(DiscreteGaussianDistributionIntegerSampler(3.0, 2)) - 'Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 2' + 'Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 2.000000' """ - return "Discrete Gaussian sampler over the Integers with sigma = %f and c = %d"%(self.sigma, self.c) + return f"Discrete Gaussian sampler over the Integers with sigma = {self.sigma:.6f} and c = {self.c:.6f}" diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index eb50443ff29..5d4fba06ab2 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -14071,7 +14071,7 @@ cdef class hold_class: sage: SR(2)^5 32 """ - g_set_state('hold', True) + g_set_state(b'hold', True) def __exit__(self, *args): """ @@ -14084,7 +14084,7 @@ cdef class hold_class: sage: SR(2)^5 32 """ - g_set_state('hold', False) + g_set_state(b'hold', False) def start(self): """ diff --git a/src/sage_setup/cython_options.py b/src/sage_setup/cython_options.py index a02401c4d23..086aa070ca9 100644 --- a/src/sage_setup/cython_options.py +++ b/src/sage_setup/cython_options.py @@ -1,5 +1,6 @@ import sys + def compiler_directives(profile: bool): """ Return a list of Cython directives used for compilation. @@ -15,13 +16,14 @@ def compiler_directives(profile: bool): embedsignature=True, fast_getattr=True, # Use Python 3 (including source code semantics) for module compilation - language_level="3str", + language_level="3", # Enable support for late includes (make declarations in Cython code available to C include files) preliminary_late_includes_cy28=True, # Add hooks for Python profilers into the compiled C code profile=profile, ) + def compile_time_env_variables(): """ Return a list of environmental variables used for compilation. From 4f46253fd1ec0835321b35b027be6c4e1dad6a15 Mon Sep 17 00:00:00 2001 From: "Martin R. Albrecht" Date: Fri, 27 May 2022 16:38:34 +0100 Subject: [PATCH 209/338] FPLLL 5.4.2 and FPyLLL 0.5.7 --- build/pkgs/fplll/checksums.ini | 6 +++--- build/pkgs/fplll/package-version.txt | 2 +- build/pkgs/fpylll/checksums.ini | 6 +++--- build/pkgs/fpylll/package-version.txt | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/pkgs/fplll/checksums.ini b/build/pkgs/fplll/checksums.ini index c346ac9603d..2d6b70504f8 100644 --- a/build/pkgs/fplll/checksums.ini +++ b/build/pkgs/fplll/checksums.ini @@ -1,5 +1,5 @@ tarball=fplll-VERSION.tar.gz -sha1=fe1b225f2bff07b7b832ae8b20ffc85acfd231cd -md5=44db0a42c33e5aa60264b32ab0063351 -cksum=3420408626 +sha1=d84ae04deee3a29033c6e28e40c67ed14f8fff32 +md5=9e8ed4e5ff7f3231f9ccf397dca9a117 +cksum=855019078 upstream_url=https://github.com/fplll/fplll/releases/download/VERSION/fplll-VERSION.tar.gz diff --git a/build/pkgs/fplll/package-version.txt b/build/pkgs/fplll/package-version.txt index ade65226e0a..8ae03c11904 100644 --- a/build/pkgs/fplll/package-version.txt +++ b/build/pkgs/fplll/package-version.txt @@ -1 +1 @@ -5.4.1 +5.4.2 diff --git a/build/pkgs/fpylll/checksums.ini b/build/pkgs/fpylll/checksums.ini index 5255ba6aec8..5a3fc413fe2 100644 --- a/build/pkgs/fpylll/checksums.ini +++ b/build/pkgs/fpylll/checksums.ini @@ -1,5 +1,5 @@ tarball=fpylll-VERSION.tar.gz -sha1=e2a005b53fcc3a9ec1f1111f144eb75b6de7fb44 -md5=5ea3a5fe30646311ef28ca1f8e9bf2bc -cksum=690866680 +sha1=9c4951f4ec50f36805129df4b821e5ea18b7ad30 +md5=d802205f818a9ae5846f8eaa34db7b5c +cksum=3615125514 upstream_url=https://github.com/fplll/fpylll/releases/download/VERSION/fpylll-VERSION.tar.gz diff --git a/build/pkgs/fpylll/package-version.txt b/build/pkgs/fpylll/package-version.txt index b49b25336d4..d3532a107ee 100644 --- a/build/pkgs/fpylll/package-version.txt +++ b/build/pkgs/fpylll/package-version.txt @@ -1 +1 @@ -0.5.6 +0.5.7 From f7e5340e90b0505290377c7300aebb1086b94642 Mon Sep 17 00:00:00 2001 From: Utkarsh Sharma Date: Fri, 27 May 2022 21:32:06 +0530 Subject: [PATCH 210/338] Fix a typo in the docstring of the random_element method in polynomial_ring.py --- src/sage/rings/polynomial/polynomial_ring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/polynomial_ring.py b/src/sage/rings/polynomial/polynomial_ring.py index f88d12201da..34f25975963 100644 --- a/src/sage/rings/polynomial/polynomial_ring.py +++ b/src/sage/rings/polynomial/polynomial_ring.py @@ -1321,7 +1321,7 @@ def random_element(self, degree=(-1,2), *args, **kwds): INPUT: - - ``degree`` - optional integer for fixing the degree or + - ``degree`` - optional integer for fixing the degree or a tuple of minimum and maximum degrees. By default set to ``(-1,2)``. From e41b37f22f0f66453f997a60a757fa8ac11771ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 18:43:37 +0200 Subject: [PATCH 211/338] remove inheritance of object in src/doc, doctest/ numerical/ rings/ etc --- src/doc/en/developer/coding_basics.rst | 2 +- .../tutorial-objects-and-classes.rst | 8 ++++---- src/sage/doctest/control.py | 2 +- src/sage/doctest/external.py | 2 +- src/sage/doctest/fixtures.py | 20 +++++++++---------- src/sage/doctest/forker.py | 2 +- src/sage/doctest/parsing.py | 2 +- src/sage/doctest/sources.py | 6 +++--- src/sage/interfaces/expect.py | 2 +- src/sage/interfaces/four_ti_2.py | 2 +- src/sage/interfaces/gfan.py | 2 +- src/sage/interfaces/process.pxd | 2 +- src/sage/interfaces/process.pyx | 2 +- src/sage/interfaces/tab_completion.py | 2 +- .../numerical/backends/glpk_graph_backend.pxd | 2 +- .../numerical/backends/glpk_graph_backend.pyx | 2 +- src/sage/rings/continued_fraction_gosper.py | 2 +- src/sage/rings/infinity.py | 4 ++-- src/sage/rings/invariants/invariant_theory.py | 2 +- .../rings/multi_power_series_ring_element.py | 2 +- .../number_field/number_field_element.pyx | 2 +- src/sage/rings/padics/lattice_precision.py | 2 +- .../rings/padics/padic_template_element.pxi | 4 ++-- src/sage/rings/padics/relaxed_template.pxi | 2 +- .../rings/padics/relaxed_template_header.pxi | 2 +- src/sage/rings/valuation/valuation.py | 2 +- src/sage/structure/coerce.pyx | 6 +++--- src/sage/structure/dynamic_class.py | 2 +- src/sage/structure/factory.pyx | 4 ++-- src/sage/structure/global_options.py | 10 +++++----- src/sage/structure/graphics_file.py | 2 +- src/sage/structure/indexed_generators.py | 2 +- src/sage/structure/mutability.pyx | 4 ++-- src/sage/structure/proof/proof.py | 2 +- src/sage/structure/richcmp.pyx | 8 ++++---- src/sage/structure/test_factory.py | 2 +- src/sage/structure/unique_representation.py | 4 ++-- 37 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index 2b540852a61..2e35c533471 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -77,7 +77,7 @@ In particular, - Use CamelCase for class names:: - class SomeValue(object): + class SomeValue(): def __init__(self, x): self._x = 1 diff --git a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst index a295508e0ab..51aec989810 100644 --- a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst +++ b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst @@ -374,7 +374,7 @@ An example: glass of beverage in a restaurant Let's write a small class about glasses in a restaurant:: - sage: class Glass(object): + sage: class Glass(): ....: def __init__(self, size): ....: assert size > 0 ....: self._size = float(size) # an attribute @@ -474,7 +474,7 @@ the common behavior and then reuses the methods from this class. We first write a small class ''AbstractDish'' which implements the "clean-dirty-wash" behavior:: - sage: class AbstractDish(object): + sage: class AbstractDish(): ....: def __init__(self): ....: self._clean = True ....: def is_clean(self): @@ -604,7 +604,7 @@ Solutions to the exercises 1. Here is a solution to the first exercise:: - sage: class Glass(object): + sage: class Glass(): ....: def __init__(self, size): ....: assert size > 0 ....: self._size = float(size) @@ -686,7 +686,7 @@ Solutions to the exercises #. Here is the solution to the second exercice:: - sage: class AbstractDish(object): + sage: class AbstractDish(): ....: def __init__(self): ....: self._clean = True ....: def is_clean(self): diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index a9d11d0863e..2726a18c41f 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -284,7 +284,7 @@ def skipfile(filename, tested_optional_tags=False): return False -class Logger(object): +class Logger(): r""" File-like object which implements writing to multiple files at once. diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py index 546835698e2..f21f5917890 100644 --- a/src/sage/doctest/external.py +++ b/src/sage/doctest/external.py @@ -370,7 +370,7 @@ def external_software(): external_software = external_software() -class AvailableSoftware(object): +class AvailableSoftware(): """ This class keeps the set of available software whose availability is detected lazily from the list of external software. diff --git a/src/sage/doctest/fixtures.py b/src/sage/doctest/fixtures.py index 13b3fb40f19..815ee825f50 100644 --- a/src/sage/doctest/fixtures.py +++ b/src/sage/doctest/fixtures.py @@ -14,7 +14,7 @@ You can use :func:`trace_method` to see how a method communicates with its surroundings:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self): ....: self.y = self.g(self.x) ....: def g(self, arg): @@ -111,7 +111,7 @@ def sorted_pairs(iterable, pairs=False): return repr(val) -class AttributeAccessTracerHelper(object): +class AttributeAccessTracerHelper(): def __init__(self, delegate, prefix=" ", reads=True): r""" @@ -134,7 +134,7 @@ def __init__(self, delegate, prefix=" ", reads=True): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -166,7 +166,7 @@ def get(self, name): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -208,7 +208,7 @@ def set(self, name, val): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: pass ....: sage: foo = Foo() @@ -224,7 +224,7 @@ def set(self, name, val): setattr(self.delegate, name, val) -class AttributeAccessTracerProxy(object): +class AttributeAccessTracerProxy(): def __init__(self, delegate, **kwds): r""" @@ -247,7 +247,7 @@ def __init__(self, delegate, **kwds): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -281,7 +281,7 @@ def __getattribute__(self, name): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -307,7 +307,7 @@ def __setattr__(self, name, val): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: pass ....: sage: foo = Foo() @@ -344,7 +344,7 @@ def trace_method(obj, meth, **kwds): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, arg=None): ....: self.y = self.g(self.x) ....: if arg: return arg*arg diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index 39967cfbbe6..71ca8c1041b 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -2361,7 +2361,7 @@ def kill(self): return True -class DocTestTask(object): +class DocTestTask(): """ This class encapsulates the tests from a single source. diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py index 8c8f48bd827..064414befbc 100644 --- a/src/sage/doctest/parsing.py +++ b/src/sage/doctest/parsing.py @@ -388,7 +388,7 @@ def make_marked_output(s, D): return ans -class OriginalSource(object): +class OriginalSource(): r""" Context swapping out the pre-parsed source with the original for better reporting. diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py index f9470e14d2e..d0f2103c203 100644 --- a/src/sage/doctest/sources.py +++ b/src/sage/doctest/sources.py @@ -109,7 +109,7 @@ def get_basename(path): return fully_qualified_path.replace(os.path.sep, '.') -class DocTestSource(object): +class DocTestSource(): """ This class provides a common base class for different sources of doctests. @@ -1065,7 +1065,7 @@ def starting_docstring(self, line): sage: FDS.ending_docstring("'''") <...Match object...> sage: FDS.qualified_name = NestedName(FDS.basename) - sage: FDS.starting_docstring("class MyClass(object):") + sage: FDS.starting_docstring("class MyClass():") sage: FDS.starting_docstring(" def hello_world(self):") sage: FDS.starting_docstring(" '''") <...Match object...> @@ -1073,7 +1073,7 @@ def starting_docstring(self, line): sage.doctest.sources.MyClass.hello_world sage: FDS.ending_docstring(" '''") <...Match object...> - sage: FDS.starting_docstring("class NewClass(object):") + sage: FDS.starting_docstring("class NewClass():") sage: FDS.starting_docstring(" '''") <...Match object...> sage: FDS.ending_docstring(" '''") diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py index 17c56551fed..739431a5005 100644 --- a/src/sage/interfaces/expect.py +++ b/src/sage/interfaces/expect.py @@ -87,7 +87,7 @@ # "return", "break", or "continue", raising an exception, ...) -class gc_disabled(object): +class gc_disabled(): """ This is a "with" statement context manager. Garbage collection is disabled within its scope. Nested usage is properly handled. diff --git a/src/sage/interfaces/four_ti_2.py b/src/sage/interfaces/four_ti_2.py index 72afddd70f1..92de8d2d478 100644 --- a/src/sage/interfaces/four_ti_2.py +++ b/src/sage/interfaces/four_ti_2.py @@ -41,7 +41,7 @@ import os -class FourTi2(object): +class FourTi2(): r""" This object defines an interface to the program 4ti2. Each command 4ti2 has is exposed as one method. diff --git a/src/sage/interfaces/gfan.py b/src/sage/interfaces/gfan.py index 0e5b4046f4e..686564dbdc0 100644 --- a/src/sage/interfaces/gfan.py +++ b/src/sage/interfaces/gfan.py @@ -46,7 +46,7 @@ from sage.misc.decorators import rename_keyword -class Gfan(object): +class Gfan(): """ Interface to Anders Jensen's Groebner Fan program. """ diff --git a/src/sage/interfaces/process.pxd b/src/sage/interfaces/process.pxd index 03d9a55e533..3f1ae3f0dc8 100644 --- a/src/sage/interfaces/process.pxd +++ b/src/sage/interfaces/process.pxd @@ -1,4 +1,4 @@ -cdef class ContainChildren(object): +cdef class ContainChildren(): cdef int parentpid cdef int exitcode, exceptcode cdef bint silent diff --git a/src/sage/interfaces/process.pyx b/src/sage/interfaces/process.pyx index 3e51eb0c95c..ea90d5b0de4 100644 --- a/src/sage/interfaces/process.pyx +++ b/src/sage/interfaces/process.pyx @@ -24,7 +24,7 @@ from cysignals.pselect import PSelecter from cysignals.pysignals import changesignal -cdef class ContainChildren(object): +cdef class ContainChildren(): """ Context manager which will ensure that all forked child processes will be forced to exit if they try to exit the context. diff --git a/src/sage/interfaces/tab_completion.py b/src/sage/interfaces/tab_completion.py index 0182e4c1d6d..ca106a67273 100644 --- a/src/sage/interfaces/tab_completion.py +++ b/src/sage/interfaces/tab_completion.py @@ -27,7 +27,7 @@ import builtins -class ExtraTabCompletion(object): +class ExtraTabCompletion(): def __dir__(self): """ diff --git a/src/sage/numerical/backends/glpk_graph_backend.pxd b/src/sage/numerical/backends/glpk_graph_backend.pxd index 3eebb4dc08b..1b63765de7f 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pxd +++ b/src/sage/numerical/backends/glpk_graph_backend.pxd @@ -25,7 +25,7 @@ ctypedef struct c_a_data: double x -cdef class GLPKGraphBackend(object): +cdef class GLPKGraphBackend(): cdef glp_graph * graph cpdef add_vertex(self, name = ?) cpdef list add_vertices(self, vertices) diff --git a/src/sage/numerical/backends/glpk_graph_backend.pyx b/src/sage/numerical/backends/glpk_graph_backend.pyx index e3dd95841e8..564c108fdf4 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pyx +++ b/src/sage/numerical/backends/glpk_graph_backend.pyx @@ -76,7 +76,7 @@ from sage.libs.glpk.constants cimport * from sage.libs.glpk.graph cimport * from sage.numerical.mip import MIPSolverException -cdef class GLPKGraphBackend(object): +cdef class GLPKGraphBackend(): """ GLPK Backend for access to GLPK graph functions diff --git a/src/sage/rings/continued_fraction_gosper.py b/src/sage/rings/continued_fraction_gosper.py index 07b2dcc852b..08d5dd34658 100644 --- a/src/sage/rings/continued_fraction_gosper.py +++ b/src/sage/rings/continued_fraction_gosper.py @@ -35,7 +35,7 @@ from sage.rings.infinity import Infinity from sage.rings.integer import Integer -class gosper_iterator(object): +class gosper_iterator(): r""" Iterable for the partial quotients of `(a*x+b)/(c*x+d)`, where `a, b, c, d` are integers, and `x` is a continued fraction. diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 18adea7ca8b..c30004c8d5a 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -227,7 +227,7 @@ import sage.rings.integer_ring _obj = {} -class _uniq(object): +class _uniq(): def __new__(cls, *args): """ This ensures uniqueness of these objects. @@ -243,7 +243,7 @@ def __new__(cls, *args): return O -class AnInfinity(object): +class AnInfinity(): """ TESTS:: diff --git a/src/sage/rings/invariants/invariant_theory.py b/src/sage/rings/invariants/invariant_theory.py index 7478093452d..c37af37cc7c 100644 --- a/src/sage/rings/invariants/invariant_theory.py +++ b/src/sage/rings/invariants/invariant_theory.py @@ -4058,7 +4058,7 @@ def syzygy(self, Delta, Theta, Phi, Theta_prime, Delta_prime, U, V, T, T_prime, ###################################################################### -class InvariantTheoryFactory(object): +class InvariantTheoryFactory(): """ Factory object for invariants of multilinear forms. diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 9ce75c73c42..b1c1a3ffb67 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -2080,7 +2080,7 @@ def laurent_series(self): raise NotImplementedError("laurent_series not defined for multivariate power series.") -class MO(object): +class MO(): """ Object representing a zero element with given precision. diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 21e19618896..3585eee09f5 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -5451,7 +5451,7 @@ cdef class OrderElement_relative(NumberFieldElement_relative): -class CoordinateFunction(object): +class CoordinateFunction(): r""" This class provides a callable object which expresses elements in terms of powers of a fixed field generator `\alpha`. diff --git a/src/sage/rings/padics/lattice_precision.py b/src/sage/rings/padics/lattice_precision.py index 40c5bb04edd..a041394d635 100644 --- a/src/sage/rings/padics/lattice_precision.py +++ b/src/sage/rings/padics/lattice_precision.py @@ -2741,7 +2741,7 @@ def precision_lattice(self, elements=None): M *= self._p ** val return M -class pAdicLatticeElementWeakProxy(object): +class pAdicLatticeElementWeakProxy(): r""" The implementations of :class:`DifferentialPrecisionGeneric` hold weak references to :class:`pAdicLatticeElement`. They are stored in diff --git a/src/sage/rings/padics/padic_template_element.pxi b/src/sage/rings/padics/padic_template_element.pxi index b30d8cf0ae9..92fad2b1f9d 100644 --- a/src/sage/rings/padics/padic_template_element.pxi +++ b/src/sage/rings/padics/padic_template_element.pxi @@ -870,7 +870,7 @@ cdef _zero(expansion_mode mode, teich_ring): else: return _expansion_zero -cdef class ExpansionIter(object): +cdef class ExpansionIter(): """ An iterator over a `p`-adic expansion. @@ -999,7 +999,7 @@ cdef class ExpansionIter(object): else: return cexpansion_next(self.curvalue, self.mode, self.curpower, pp) -cdef class ExpansionIterable(object): +cdef class ExpansionIterable(): r""" An iterable storing a `p`-adic expansion of an element. diff --git a/src/sage/rings/padics/relaxed_template.pxi b/src/sage/rings/padics/relaxed_template.pxi index 7269da0f8f2..f87034e56e3 100644 --- a/src/sage/rings/padics/relaxed_template.pxi +++ b/src/sage/rings/padics/relaxed_template.pxi @@ -4030,7 +4030,7 @@ cdef class RelaxedElement_zeroone(RelaxedElementWithDigits): return ERROR_NOTDEFINED -cdef class ExpansionIter(object): +cdef class ExpansionIter(): """ An iterator over a `p`-adic expansion. diff --git a/src/sage/rings/padics/relaxed_template_header.pxi b/src/sage/rings/padics/relaxed_template_header.pxi index 4e3f7f825df..5425c11c45d 100644 --- a/src/sage/rings/padics/relaxed_template_header.pxi +++ b/src/sage/rings/padics/relaxed_template_header.pxi @@ -141,7 +141,7 @@ cdef class RelaxedElement_zeroone(RelaxedElementWithDigits): cdef void _setdigit_to_zero(self) cdef void _setdigit_to_one(self) -cdef class ExpansionIter(object): +cdef class ExpansionIter(): cdef RelaxedElement elt cdef expansion_mode mode cdef long start diff --git a/src/sage/rings/valuation/valuation.py b/src/sage/rings/valuation/valuation.py index 8256963d819..4cbe63fe2f9 100644 --- a/src/sage/rings/valuation/valuation.py +++ b/src/sage/rings/valuation/valuation.py @@ -1016,7 +1016,7 @@ def _ge_(self, other): return super(DiscreteValuation, self)._ge_(other) -class MacLaneApproximantNode(object): +class MacLaneApproximantNode(): r""" A node in the tree computed by :meth:`DiscreteValuation.mac_lane_approximants` diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 884e14b5ed7..2ee2548cf59 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -1142,7 +1142,7 @@ cdef class CoercionModel: TESTS:: - sage: class Foo(object): + sage: class Foo(): ....: def __rmul__(self, left): ....: return 'hello' sage: H = Foo() @@ -1155,7 +1155,7 @@ cdef class CoercionModel: ... TypeError: unsupported operand parent(s) for *: '' and 'Integer Ring' - sage: class Nonsense(object): + sage: class Nonsense(): ....: def __init__(self, s): ....: self.s = s ....: def __repr__(self): @@ -1945,7 +1945,7 @@ cdef class CoercionModel: We support non-Sage types with the usual Python convention:: - sage: class AlwaysEqual(object): + sage: class AlwaysEqual(): ....: def __eq__(self, other): ....: return True sage: x = AlwaysEqual() diff --git a/src/sage/structure/dynamic_class.py b/src/sage/structure/dynamic_class.py index 434c2968f8d..cf165745243 100644 --- a/src/sage/structure/dynamic_class.py +++ b/src/sage/structure/dynamic_class.py @@ -166,7 +166,7 @@ def dynamic_class(name, bases, cls=None, reduction=None, doccls=None, sage: from sage.misc.lazy_attribute import lazy_attribute sage: from sage.misc.cachefunc import cached_function sage: from sage.structure.dynamic_class import dynamic_class - sage: class Foo(object): + sage: class Foo(): ....: "The Foo class" ....: def __init__(self, x): ....: self._x = x diff --git a/src/sage/structure/factory.pyx b/src/sage/structure/factory.pyx index 9a7f762646b..76fcc698bf7 100644 --- a/src/sage/structure/factory.pyx +++ b/src/sage/structure/factory.pyx @@ -590,7 +590,7 @@ def register_factory_unpickle(name, callable): sage: from sage.structure.factory import UniqueFactory, register_factory_unpickle sage: import __main__ - sage: class OldStuff(object): + sage: class OldStuff(): ....: def __init__(self, n, **extras): ....: self.n = n ....: def __repr__(self): @@ -661,7 +661,7 @@ def generic_factory_unpickle(factory, *args): sage: from sage.structure.factory import UniqueFactory sage: import __main__ - sage: class OldStuff(object): + sage: class OldStuff(): ....: def __init__(self, n, **extras): ....: self.n = n ....: def __repr__(self): diff --git a/src/sage/structure/global_options.py b/src/sage/structure/global_options.py index e2ee4834050..6a47ba55b1d 100644 --- a/src/sage/structure/global_options.py +++ b/src/sage/structure/global_options.py @@ -105,7 +105,7 @@ illustrated by an example:: sage: from sage.structure.global_options import GlobalOptions - sage: class Menu(object): + sage: class Menu(): ....: class options(GlobalOptions): ....: ''' ....: Fancy documentation @@ -393,7 +393,7 @@ class options(GlobalOptions): Check that the old call syntax still works:: - sage: class Menu(object): + sage: class Menu(): ....: options = GlobalOptions('menu', ....: doc='Fancy documentation\n'+'-'*19, end_doc='The END!', ....: entree=dict(default='soup', @@ -514,7 +514,7 @@ class options(GlobalOptions): from sage.misc.instancedoc import instancedoc -class Option(object): +class Option(): r""" An option. @@ -884,7 +884,7 @@ class GlobalOptions(metaclass=GlobalOptionsMeta): EXAMPLES:: sage: from sage.structure.global_options import GlobalOptions - sage: class Menu(object): + sage: class Menu(): ....: class options(GlobalOptions): ....: ''' ....: Fancy documentation @@ -1707,7 +1707,7 @@ def _reset(self, option=None): EXAMPLES:: sage: from sage.structure.global_options import GlobalOptions - sage: class Meal(object): + sage: class Meal(): ....: class options(GlobalOptions): ....: NAME = 'daily meal' ....: food = dict(default='bread', values=dict(bread='rye bread', salmon='a fish')) diff --git a/src/sage/structure/graphics_file.py b/src/sage/structure/graphics_file.py index d4adefba9e9..50c200804fe 100644 --- a/src/sage/structure/graphics_file.py +++ b/src/sage/structure/graphics_file.py @@ -16,7 +16,7 @@ deprecation(32988, 'the module sage.structure.graphics_file is deprecated') -class Mime(object): +class Mime(): TEXT = 'text/plain' HTML = 'text/html' LATEX = 'text/latex' diff --git a/src/sage/structure/indexed_generators.py b/src/sage/structure/indexed_generators.py index 2abac83fcea..da04658324f 100644 --- a/src/sage/structure/indexed_generators.py +++ b/src/sage/structure/indexed_generators.py @@ -14,7 +14,7 @@ from sage.structure.category_object import normalize_names -class IndexedGenerators(object): +class IndexedGenerators(): r"""nodetex Abstract base class for parents whose elements consist of generators indexed by an arbitrary set. diff --git a/src/sage/structure/mutability.pyx b/src/sage/structure/mutability.pyx index 3d54c790263..b35d26a3ccb 100644 --- a/src/sage/structure/mutability.pyx +++ b/src/sage/structure/mutability.pyx @@ -257,7 +257,7 @@ def require_mutable(f): EXAMPLES:: sage: from sage.structure.mutability import require_mutable, require_immutable - sage: class A(object): + sage: class A(): ....: def __init__(self, val): ....: self._m = val ....: @require_mutable @@ -309,7 +309,7 @@ def require_immutable(f): EXAMPLES:: sage: from sage.structure.mutability import require_mutable, require_immutable - sage: class A(object): + sage: class A(): ....: def __init__(self, val): ....: self._m = val ....: @require_mutable diff --git a/src/sage/structure/proof/proof.py b/src/sage/structure/proof/proof.py index cef06ab460d..c667704db92 100644 --- a/src/sage/structure/proof/proof.py +++ b/src/sage/structure/proof/proof.py @@ -190,7 +190,7 @@ def get_flag(t = None, subsystem = None): return t -class WithProof(object): +class WithProof(): """ Use WithProof to temporarily set the value of one of the proof systems for a block of code, with a guarantee that it will be set diff --git a/src/sage/structure/richcmp.pyx b/src/sage/structure/richcmp.pyx index f4a52c3e87f..80dab931ba9 100644 --- a/src/sage/structure/richcmp.pyx +++ b/src/sage/structure/richcmp.pyx @@ -325,7 +325,7 @@ def richcmp_method(cls): sage: C("left") == C("right") # Calls __eq__ from class A left == right - sage: class Base(object): + sage: class Base(): ....: def __eq__(self, other): ....: return False sage: @richcmp_method @@ -343,7 +343,7 @@ def richcmp_method(cls): TypeError: None is not a class sage: @richcmp_method - ....: class X(object): + ....: class X(): ....: def __eq__(self, other): ....: pass ....: def __richcmp__(self, other, op): @@ -444,7 +444,7 @@ def richcmp_by_eq_and_lt(eq_attr, lt_attr): sage: from sage.structure.richcmp import richcmp_method, richcmp_by_eq_and_lt sage: @richcmp_method - ....: class C(object): + ....: class C(): ....: __richcmp__ = richcmp_by_eq_and_lt("_eq", "_lt") ....: def _eq(self, other): ....: return True @@ -455,7 +455,7 @@ def richcmp_by_eq_and_lt(eq_attr, lt_attr): True sage: a > b # Calls b._lt(a) True - sage: class X(object): pass + sage: class X(): pass sage: x = X() sage: a == x # Does not call a._eq(x) because x does not have _eq False diff --git a/src/sage/structure/test_factory.py b/src/sage/structure/test_factory.py index 77a2ac80641..b45996c5a80 100644 --- a/src/sage/structure/test_factory.py +++ b/src/sage/structure/test_factory.py @@ -20,7 +20,7 @@ from sage.structure.factory import UniqueFactory -class A(object): +class A(): # something we can weakref pass diff --git a/src/sage/structure/unique_representation.py b/src/sage/structure/unique_representation.py index 5d8d4ad758b..9c0cae8a877 100644 --- a/src/sage/structure/unique_representation.py +++ b/src/sage/structure/unique_representation.py @@ -326,7 +326,7 @@ class will by default also be used as keys for the cache:: An example:: - sage: class C(object): + sage: class C(): ....: def __init__(self, t): ....: self.t = t ....: def __repr__(self): @@ -883,7 +883,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): older pickles can still be reasonably unpickled. Let us create a (new style) class, and pickle one of its instances:: - sage: class MyClass4(object): + sage: class MyClass4(): ....: def __init__(self, value): ....: self.value = value sage: import __main__; __main__.MyClass4 = MyClass4 # Fake MyClass4 being defined in a python module From 344bdb4b9539d0229cfdf8fa48c64344227af979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 20:01:04 +0200 Subject: [PATCH 212/338] tweak tox.ini: activate more pycodestyle checks in cython files --- src/sage/graphs/base/boost_graph.pyx | 6 ++--- .../graphs/base/static_sparse_backend.pyx | 6 ++--- src/sage/graphs/base/static_sparse_graph.pyx | 4 +++- src/sage/graphs/connectivity.pyx | 10 ++++----- .../graphs/graph_decompositions/cutwidth.pyx | 4 ++-- src/sage/graphs/hyperbolicity.pyx | 12 +++++----- .../perm_gps/partn_ref/double_coset.pyx | 6 +++-- src/sage/libs/mpmath/ext_main.pyx | 9 +++++--- src/sage/matrix/matrix2.pyx | 22 +++++++++---------- src/sage/matrix/matrix_double_dense.pyx | 10 ++++----- src/sage/matrix/matrix_integer_dense.pyx | 2 +- src/sage/matrix/strassen.pyx | 8 ++++--- src/sage/matroids/lean_matrix.pyx | 2 +- src/sage/matroids/linear_matroid.pyx | 4 ++-- src/sage/matroids/matroid.pyx | 16 +++++++------- src/sage/modules/free_module_element.pyx | 3 ++- src/sage/modules/vector_integer_sparse.pyx | 3 ++- src/sage/modules/vector_modn_sparse.pyx | 3 ++- src/sage/modules/vector_rational_sparse.pyx | 3 ++- .../backends/interactivelp_backend.pyx | 6 +++-- src/sage/rings/bernoulli_mod_p.pyx | 5 ++--- src/sage/rings/complex_interval.pyx | 2 +- .../finite_rings/hom_finite_field_givaro.pyx | 8 +++++-- .../rings/padics/padic_generic_element.pyx | 6 +++-- .../rings/puiseux_series_ring_element.pyx | 6 +++-- src/sage/rings/sum_of_squares.pyx | 6 +++-- src/sage/sets/finite_set_map_cy.pyx | 3 ++- src/sage/stats/time_series.pyx | 3 ++- src/tox.ini | 2 +- 29 files changed, 103 insertions(+), 77 deletions(-) diff --git a/src/sage/graphs/base/boost_graph.pyx b/src/sage/graphs/base/boost_graph.pyx index 13fc6f4d83f..fe3c6b94d6f 100644 --- a/src/sage/graphs/base/boost_graph.pyx +++ b/src/sage/graphs/base/boost_graph.pyx @@ -580,7 +580,7 @@ cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee'): # Tests for errors and trivial cases if not isinstance(g, Graph): raise TypeError("the input must be a Sage Graph") - if not algorithm in ['cuthill_mckee', 'king']: + if algorithm not in ['cuthill_mckee', 'king']: raise ValueError(f"unknown algorithm {algorithm!r}") if not g.num_edges(): return (0, list(g)) @@ -690,7 +690,7 @@ cpdef min_spanning_tree(g, if not isinstance(g, Graph): raise TypeError("the input must be a Sage Graph") - if not algorithm in ['Kruskal', 'Prim']: + if algorithm not in ['Kruskal', 'Prim']: raise ValueError("algorithm '%s' not yet implemented, please contribute" %(algorithm)) if g.allows_loops() or g.allows_multiple_edges(): @@ -2567,7 +2567,7 @@ cpdef diameter(G, algorithm=None, source=None, if algorithm is None: # default algorithm for diameter computation algorithm = 'DiFUB' - if not algorithm in ['2Dsweep', 'DiFUB']: + if algorithm not in ['2Dsweep', 'DiFUB']: raise ValueError("unknown algorithm for computing the diameter of directed graph") if source is None: diff --git a/src/sage/graphs/base/static_sparse_backend.pyx b/src/sage/graphs/base/static_sparse_backend.pyx index e6da26ea5f7..2e85c2290fe 100644 --- a/src/sage/graphs/base/static_sparse_backend.pyx +++ b/src/sage/graphs/base/static_sparse_backend.pyx @@ -1376,7 +1376,7 @@ cdef class StaticSparseBackend(CGraphBackend): for i in range(out_degree(cg.g, v)): u = cg.g.neighbors[v][i] - if not u in seen: + if u not in seen: yield self._vertex_to_labels[u] seen.add(u) @@ -1412,13 +1412,13 @@ cdef class StaticSparseBackend(CGraphBackend): if cg._directed: for i in range(out_degree(cg.g_rev, v)): u = cg.g_rev.neighbors[v][i] - if not u in seen: + if u not in seen: yield self._vertex_to_labels[u] seen.add(u) else: for i in range(out_degree(cg.g, v)): u = cg.g.neighbors[v][i] - if not u in seen: + if u not in seen: yield self._vertex_to_labels[u] seen.add(u) diff --git a/src/sage/graphs/base/static_sparse_graph.pyx b/src/sage/graphs/base/static_sparse_graph.pyx index b5b07c1fa89..2ca7956654d 100644 --- a/src/sage/graphs/base/static_sparse_graph.pyx +++ b/src/sage/graphs/base/static_sparse_graph.pyx @@ -1215,7 +1215,9 @@ def spectral_radius(G, prec=1e-10): v2[i] += v1[p[0]] p += 1 s += v2[i] - v3 = v1; v1 = v2; v2 = v3 + v3 = v1 + v1 = v2 + v2 = v3 sig_off() finally: diff --git a/src/sage/graphs/connectivity.pyx b/src/sage/graphs/connectivity.pyx index df6af77ce0d..2a17674bf4e 100644 --- a/src/sage/graphs/connectivity.pyx +++ b/src/sage/graphs/connectivity.pyx @@ -481,7 +481,7 @@ def blocks_and_cut_vertices(G, algorithm="Tarjan_Boost", sort=False): seen.add(v) # The first time we meet v - if not v in number: + if v not in number: # We number the vertices in the order they are reached # during DFS number[v] = num @@ -495,7 +495,7 @@ def blocks_and_cut_vertices(G, algorithm="Tarjan_Boost", sort=False): # If we never met w before, we remember the direction of # edge vw, and add w to the stack. - if not w in number: + if w not in number: edge_stack.append((v,w)) stack.append(w) @@ -730,7 +730,7 @@ def is_cut_edge(G, u, v=None, label=None): if g.is_directed(): # (u,v) is a cut-edge if u is not in the connected # component containing v of self-(u,v) - sol = not u in connected_component_containing_vertex(g,v) + sol = u not in connected_component_containing_vertex(g, v) else: # (u,v) is a cut-edge if there is no path from u to v in # self-(u,v) @@ -809,7 +809,7 @@ def is_cut_vertex(G, u, weak=False): if not isinstance(G, GenericGraph): raise TypeError("the input must be a Sage graph") - if not u in G: + if u not in G: raise ValueError("vertex ({0}) is not a vertex of the graph".format(repr(u))) # Initialization @@ -2118,7 +2118,7 @@ def cleave(G, cut_vertices=None, virtual_edges=True, solver=None, verbose=0, else: cut_vertices = list(cut_vertices) for u in cut_vertices: - if not u in G: + if u not in G: raise ValueError("vertex {} is not a vertex of the input graph".format(u)) H = G.copy(immutable=False) diff --git a/src/sage/graphs/graph_decompositions/cutwidth.pyx b/src/sage/graphs/graph_decompositions/cutwidth.pyx index 9b1711107e9..3a329fbe3d3 100644 --- a/src/sage/graphs/graph_decompositions/cutwidth.pyx +++ b/src/sage/graphs/graph_decompositions/cutwidth.pyx @@ -388,7 +388,7 @@ def cutwidth(G, algorithm="exponential", cut_off=0, solver=None, verbose=False, if not isinstance(G, Graph): raise ValueError('the first parameter must be a Graph') - if not cut_off in ZZ: + if cut_off not in ZZ: raise ValueError("the specified cut off parameter must be an integer") elif G.size() <= cut_off: # We have a trivial solution @@ -502,7 +502,7 @@ def cutwidth_dyn(G, lower_bound=0): if G.order() >= 32: raise ValueError("the graph should have at most 31 vertices") - if not lower_bound in ZZ: + if lower_bound not in ZZ: raise ValueError("the specified lower bound must be an integer") cdef FastDigraph g = FastDigraph(G) diff --git a/src/sage/graphs/hyperbolicity.pyx b/src/sage/graphs/hyperbolicity.pyx index 06f2eb1ba58..40f934cfb08 100644 --- a/src/sage/graphs/hyperbolicity.pyx +++ b/src/sage/graphs/hyperbolicity.pyx @@ -351,8 +351,8 @@ def _greedy_dominating_set(H, verbose=False): reverse=True, key=lambda x: x[0]) cdef list DOM = [] cdef set seen = set() - for _,u in V: - if not u in seen: + for _, u in V: + if u not in seen: seen.add(u) DOM.append(u) seen.update(H.neighbor_iterator(u)) @@ -1277,14 +1277,14 @@ def hyperbolicity(G, from sage.graphs.graph import Graph if not isinstance(G, Graph): raise ValueError("the input parameter must be a Graph") - if not algorithm in ['basic', 'CCL', 'CCL+FA', 'BCCM', 'dom']: + if algorithm not in ['basic', 'CCL', 'CCL+FA', 'BCCM', 'dom']: raise ValueError("algorithm '%s' not yet implemented, please contribute" %(algorithm)) if approximation_factor is None: approximation_factor = 1.0 elif approximation_factor == 1.0: pass elif algorithm in ['CCL', 'CCL+FA', 'BCCM']: - if not approximation_factor in RR or approximation_factor < 1.0: + if approximation_factor not in RR or approximation_factor < 1.0: raise ValueError("the approximation factor must be >= 1.0") else: raise ValueError("the approximation_factor is ignored when using" @@ -1294,7 +1294,7 @@ def hyperbolicity(G, elif additive_gap == 0.0: pass elif algorithm in ['CCL', 'CCL+FA', 'BCCM']: - if not additive_gap in RR or additive_gap < 0.0: + if additive_gap not in RR or additive_gap < 0.0: raise ValueError("the additive gap must be a real positive number") else: raise ValueError("the additive_gap is ignored when using the '%s' algorithm." %(algorithm)) @@ -1431,7 +1431,7 @@ def hyperbolicity(G, # We set null distances to vertices outside DOM. This way these # vertices will not be considered anymore. for i in range(N): - if not i in DOM_int: + if i not in DOM_int: for j in range(N): distances[i][j] = 0 distances[j][i] = 0 diff --git a/src/sage/groups/perm_gps/partn_ref/double_coset.pyx b/src/sage/groups/perm_gps/partn_ref/double_coset.pyx index b197321e084..6daef964ebc 100644 --- a/src/sage/groups/perm_gps/partn_ref/double_coset.pyx +++ b/src/sage/groups/perm_gps/partn_ref/double_coset.pyx @@ -436,9 +436,11 @@ cdef int double_coset(void *S1, void *S2, PartitionStack *partition1, int *order j = refine_also_by_orbits(current_ps, S2, refine_and_return_invariant, cells_to_refine_by, j, group, perm_stack) if k != j: - possible = 0; unknown = 0 + possible = 0 + unknown = 0 elif not stacks_are_equivalent(left_ps, current_ps): - possible = 0; unknown = 0 + possible = 0 + unknown = 0 else: PS_move_all_mins_to_front(current_ps) diff --git a/src/sage/libs/mpmath/ext_main.pyx b/src/sage/libs/mpmath/ext_main.pyx index 7ba4fb1c17b..81abdf0cd4b 100644 --- a/src/sage/libs/mpmath/ext_main.pyx +++ b/src/sage/libs/mpmath/ext_main.pyx @@ -76,9 +76,12 @@ cdef MPF MPF_C_0 cdef MPF MPF_C_1 cdef MPF MPF_C_2 -MPF_init(&MPF_C_0); MPF_set_zero(&MPF_C_0) -MPF_init(&MPF_C_1); MPF_set_si(&MPF_C_1, 1) -MPF_init(&MPF_C_2); MPF_set_si(&MPF_C_2, 2) +MPF_init(&MPF_C_0) +MPF_set_zero(&MPF_C_0) +MPF_init(&MPF_C_1) +MPF_set_si(&MPF_C_1, 1) +MPF_init(&MPF_C_2) +MPF_set_si(&MPF_C_2, 2) # Temporaries used for operands in binary operations cdef mpz_t tmp_mpz diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 90d87b6e49d..73c53348927 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -4407,7 +4407,7 @@ cdef class Matrix(Matrix1): algorithm = kwds.pop('algorithm', None) if algorithm is None: algorithm = 'default' - elif not algorithm in ['default', 'generic', 'flint', 'pari', 'padic', 'pluq']: + elif algorithm not in ['default', 'generic', 'flint', 'pari', 'padic', 'pluq']: raise ValueError("matrix kernel algorithm '%s' not recognized" % algorithm ) elif algorithm == 'padic' and not (is_IntegerRing(R) or is_RationalField(R)): raise ValueError("'padic' matrix kernel algorithm only available over the rationals and the integers, not over %s" % R) @@ -4424,7 +4424,7 @@ cdef class Matrix(Matrix1): basis = kwds.pop('basis', None) if basis is None: basis = 'echelon' - elif not basis in ['computed', 'echelon', 'pivot', 'LLL']: + elif basis not in ['computed', 'echelon', 'pivot', 'LLL']: raise ValueError("matrix kernel basis format '%s' not recognized" % basis ) elif basis == 'pivot' and R not in _Fields: raise ValueError('pivot basis only available over a field, not over %s' % R) @@ -5956,7 +5956,7 @@ cdef class Matrix(Matrix1): sage: A._eigenspace_format(None) == 'all' True """ - if not format in [None, 'all', 'galois']: + if format not in [None, 'all', 'galois']: msg = "format keyword must be None, 'all' or 'galois', not {0}" raise ValueError(msg.format(format)) @@ -6244,7 +6244,7 @@ cdef class Matrix(Matrix1): ... ValueError: algebraic_multiplicity keyword must be True or False """ - if not algebraic_multiplicity in [True, False]: + if algebraic_multiplicity not in [True, False]: msg = 'algebraic_multiplicity keyword must be True or False' raise ValueError(msg.format(algebraic_multiplicity)) if not self.is_square(): @@ -6486,7 +6486,7 @@ cdef class Matrix(Matrix1): ... ValueError: algebraic_multiplicity keyword must be True or False """ - if not algebraic_multiplicity in [True, False]: + if algebraic_multiplicity not in [True, False]: msg = 'algebraic_multiplicity keyword must be True or False' raise ValueError(msg.format(algebraic_multiplicity)) if not self.is_square(): @@ -8163,7 +8163,7 @@ cdef class Matrix(Matrix1): ... TypeError: subdivide must be True or False, not junk """ - if not subdivide in [True, False]: + if subdivide not in [True, False]: raise TypeError("subdivide must be True or False, not %s" % subdivide) R = self.base_ring() ident = self.matrix_space(self.nrows(), self.nrows()).one() @@ -12357,7 +12357,7 @@ cdef class Matrix(Matrix1): raise TypeError('polynomial variable must be a string or polynomial ring generator, not {0}'.format(var)) elif var.base_ring() != R: raise TypeError('polynomial generator must be over the same ring as the matrix entries') - if not basis in ['echelon', 'iterates']: + if basis not in ['echelon', 'iterates']: raise ValueError("basis format must be 'echelon' or 'iterates', not {0}".format(basis)) if not self.is_square(): raise TypeError('matrix must be square, not {0} x {1}'.format(self.nrows(), self.ncols())) @@ -13249,10 +13249,10 @@ cdef class Matrix(Matrix1): sage: P.base_ring() Finite Field of size 11 """ - if not pivot in [None, 'partial', 'nonzero']: + if pivot not in [None, 'partial', 'nonzero']: msg = "pivot strategy must be None, 'partial' or 'nonzero', not {0}" raise ValueError(msg.format(pivot)) - if not format in ['compact', 'plu']: + if format not in ['compact', 'plu']: msg = "format must be 'plu' or 'compact', not {0}" raise ValueError(msg.format(format)) @@ -13541,7 +13541,7 @@ cdef class Matrix(Matrix1): cdef Py_ssize_t m, i, j, k cdef Matrix L - if not algorithm in ['symmetric', 'hermitian']: + if algorithm not in ['symmetric', 'hermitian']: msg = "'algorithm' must be 'symmetric' or 'hermitian', not {0}" raise ValueError(msg.format(algorithm)) cache_string = 'indefinite_factorization_' + algorithm @@ -13551,7 +13551,7 @@ cdef class Matrix(Matrix1): if not self.is_square(): msg = "matrix must be square, not {0} x {1}" raise ValueError(msg.format(self.nrows(), self.ncols())) - if not algorithm in ['symmetric', 'hermitian']: + if algorithm not in ['symmetric', 'hermitian']: msg = "'algorithm' must be 'symmetric' or 'hermitian', not {0}" raise ValueError(msg.format(algorithm)) if not R.is_exact(): diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index d62c2f2c14b..d21e6713cc4 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -689,7 +689,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): p = sage.rings.integer.Integer(p) except TypeError: raise ValueError("matrix norm 'p' must be +/- infinity, 'frob' or an integer, not %s" % p) - if not p in [-2,-1,1,2]: + if p not in [-2, -1, 1, 2]: raise ValueError("matrix norm integer values of 'p' must be -2, -1, 1 or 2, not %s" % p) return sage.rings.real_double.RDF(numpy.linalg.norm(self._matrix_numpy, ord=p)) @@ -1301,7 +1301,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): tol = algorithm algorithm = other other = None - if not algorithm in ['default', 'symmetric', 'hermitian']: + if algorithm not in ['default', 'symmetric', 'hermitian']: msg = "algorithm must be 'default', 'symmetric', or 'hermitian', not {0}" raise ValueError(msg.format(algorithm)) if not self.is_square(): @@ -2347,7 +2347,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): raise TypeError('tolerance must be a real number, not {0}'.format(tol)) if tol <= 0: raise ValueError('tolerance must be positive, not {0}'.format(tol)) - if not algorithm in ['naive', 'orthonormal']: + if algorithm not in ['naive', 'orthonormal']: raise ValueError("algorithm must be 'naive' or 'orthonormal', not {0}".format(algorithm)) key = 'unitary_{0}_{1}'.format(algorithm, tol) b = self.fetch(key) @@ -2905,7 +2905,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): tol = float(tol) if tol <= 0: raise ValueError('tolerance must be positive, not {0}'.format(tol)) - if not algorithm in ['naive', 'orthonormal']: + if algorithm not in ['naive', 'orthonormal']: raise ValueError("algorithm must be 'naive' or 'orthonormal', not {0}".format(algorithm)) key = 'normal_{0}_{1}'.format(algorithm, tol) @@ -3200,7 +3200,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): raise ValueError('Schur decomposition requires a square matrix, not a {0} x {1} matrix'.format(self.nrows(), self.ncols())) if base_ring is None: base_ring = self.base_ring() - if not base_ring in [RDF, CDF]: + if base_ring not in [RDF, CDF]: raise ValueError('base ring of Schur decomposition matrices must be RDF or CDF, not {0}'.format(base_ring)) if self.base_ring() != base_ring: diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 9e35ce8395c..734f1b01964 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -4740,7 +4740,7 @@ cdef class Matrix_integer_dense(Matrix_dense): # Step 5: Apply p-adic solver C = B.matrix_from_columns(pivots) pivots_ = set(pivots) - non_pivots = [i for i in range(B.ncols()) if not i in pivots_] + non_pivots = [i for i in range(B.ncols()) if i not in pivots_] D = B.matrix_from_columns(non_pivots) t = verbose('calling %s solver'%solver, level=2, caller_name='p-adic echelon') if solver == 'iml': diff --git a/src/sage/matrix/strassen.pyx b/src/sage/matrix/strassen.pyx index cd7fe1fc684..cd343bd92e8 100644 --- a/src/sage/matrix/strassen.pyx +++ b/src/sage/matrix/strassen.pyx @@ -802,9 +802,11 @@ def test(n, m, R, c=2): 4 True """ from sage.matrix.constructor import matrix - A = matrix(R,n,m,range(n*m)) - B = A.__copy__(); B._echelon_in_place_classical() - C = A.__copy__(); C._echelon_strassen(c) + A = matrix(R, n, m, range(n * m)) + B = A.__copy__() + B._echelon_in_place_classical() + C = A.__copy__() + C._echelon_strassen(c) return B == C diff --git a/src/sage/matroids/lean_matrix.pyx b/src/sage/matroids/lean_matrix.pyx index 8ea413b9dd8..01aaefc2f27 100644 --- a/src/sage/matroids/lean_matrix.pyx +++ b/src/sage/matroids/lean_matrix.pyx @@ -397,7 +397,7 @@ cdef class LeanMatrix: return (left)._matrix_times_matrix_(right) else: return NotImplemented - if not left in (right).base_ring(): + if left not in (right).base_ring(): try: left = (right).base_ring()(left) except (TypeError, NotImplemented, ValueError): diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index bdc88768dde..917017f6afe 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -321,7 +321,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): if keep_initial_representation: self._representation = A.copy() # Deprecated Sage matrix operation P = gauss_jordan_reduce(A, xrange(A.ncols())) - self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if not c in P]) + self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if c not in P]) else: reduced = True if not isinstance(reduced_matrix, LeanMatrix): @@ -5785,7 +5785,7 @@ cdef class RegularMatroid(LinearMatroid): if keep_initial_representation: self._representation = A.copy() # Deprecated Sage matrix operation P = gauss_jordan_reduce(A, xrange(A.ncols())) - self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if not c in P]) + self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if c not in P]) else: reduced = True if not isinstance(reduced_matrix, PlusMinusOneMatrix): diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index da767ea18f5..cef2804c2d0 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -1527,7 +1527,7 @@ cdef class Matroid(SageObject): B = frozenset(B) if not self.is_basis(B): raise ValueError("input B is not a basis of the matroid.") - if not e in self.groundset(): + if e not in self.groundset(): raise ValueError("input e is not an element of the groundset.") return self._fundamental_circuit(B, e) @@ -1897,7 +1897,7 @@ cdef class Matroid(SageObject): B = frozenset(B) if not self.is_basis(B): raise ValueError("input B is not a basis of the matroid.") - if not e in B: + if e not in B: raise ValueError("input e is not an element of B.") return self._fundamental_cocircuit(B, e) @@ -4390,13 +4390,13 @@ cdef class Matroid(SageObject): rH = self._rank(H) if rH < r: if rH + self._rank(FF.union(F)) == self._rank(FF) + r: - if not H in final_list: + if H not in final_list: temp_list.add(H) # Check upper closure (going just one level up) if r < self.full_rank() - 1: for e in self.groundset().difference(F): FF = self.closure(F.union([e])) - if self._rank(FF) > r and not FF in final_list: + if self._rank(FF) > r and FF not in final_list: temp_list.add(FF) final_list.add(F) return final_list @@ -7091,7 +7091,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = other._circuit(Y.union([u])) - set([u]) # if u in X2 then out_neighbors[u] was set to empty for y in out_neighbors[u]: m2 = m + weights[y] - if not y in w or w[y] > m2: + if y not in w or w[y] > m2: predecessor[y] = u w[y] = m2 next_layer.add(y) @@ -7104,7 +7104,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = X - self._closure(Y - set([u])) for x in out_neighbors[u]: m2 = m - weights[x] - if not x in w or w[x] > m2: + if x not in w or w[x] > m2: predecessor[x] = u w[x] = m2 next_layer.add(x) @@ -7256,7 +7256,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = other._circuit(Y.union([u])) - set([u]) # if u in X2 then out_neighbors[u] was set to empty for y in out_neighbors[u]: m2 = m + 1 - if not y in w or w[y] > m2: + if y not in w or w[y] > m2: w[y] = m2 next_layer.add(y) todo = next_layer @@ -7275,7 +7275,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = X - self._closure(Y - set([u])) for x in out_neighbors[u]: m2 = m - 1 - if not x in w or w[x] > m2: + if x not in w or w[x] > m2: w[x] = m2 next_layer.add(x) todo = next_layer diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 9bc5a5c25e2..de627d5939a 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -2103,7 +2103,8 @@ cdef class FreeModuleElement(Vector): # abstract base class '(theta^3 + sqrt(2) + 1/2, 1/2)' """ cdef Py_ssize_t d = self._degree - if d == 0: return "()" + if d == 0: + return "()" # compute column widths S = [repr(x) for x in self.list(copy=False)] #width = max([len(x) for x in S]) diff --git a/src/sage/modules/vector_integer_sparse.pyx b/src/sage/modules/vector_integer_sparse.pyx index 7f94092a286..01c45059880 100644 --- a/src/sage/modules/vector_integer_sparse.pyx +++ b/src/sage/modules/vector_integer_sparse.pyx @@ -287,7 +287,8 @@ cdef int add_mpz_vector_init(mpz_vector* sum, # 1. Allocate memory: nz = v.num_nonzero + w.num_nonzero - if nz > v.degree: nz = v.degree + if nz > v.degree: + nz = v.degree mpz_vector_init(z, v.degree, nz) # 2. Merge entries i = 0 # index into entries of v diff --git a/src/sage/modules/vector_modn_sparse.pyx b/src/sage/modules/vector_modn_sparse.pyx index 5258c9a141a..746f9897db2 100644 --- a/src/sage/modules/vector_modn_sparse.pyx +++ b/src/sage/modules/vector_modn_sparse.pyx @@ -244,7 +244,8 @@ cdef int add_c_vector_modint_init(c_vector_modint* sum, c_vector_modint* v, # 1. Allocate memory: nz = v.num_nonzero + w.num_nonzero - if nz > v.degree: nz = v.degree + if nz > v.degree: + nz = v.degree init_c_vector_modint(z, v.p, v.degree, nz) # 2. Merge entries i = 0 # index into entries of v diff --git a/src/sage/modules/vector_rational_sparse.pyx b/src/sage/modules/vector_rational_sparse.pyx index 8b204b40e4f..78002a1a75f 100644 --- a/src/sage/modules/vector_rational_sparse.pyx +++ b/src/sage/modules/vector_rational_sparse.pyx @@ -294,7 +294,8 @@ cdef int add_mpq_vector_init(mpq_vector* sum, # 1. Allocate memory: nz = v.num_nonzero + w.num_nonzero - if nz > v.degree: nz = v.degree + if nz > v.degree: + nz = v.degree mpq_vector_init(z, v.degree, nz) # 2. Merge entries i = 0 # index into entries of v diff --git a/src/sage/numerical/backends/interactivelp_backend.pyx b/src/sage/numerical/backends/interactivelp_backend.pyx index f48853e7115..e431c604b0c 100644 --- a/src/sage/numerical/backends/interactivelp_backend.pyx +++ b/src/sage/numerical/backends/interactivelp_backend.pyx @@ -487,8 +487,10 @@ cdef class InteractiveLPBackend: """ A, b, c, x, constraint_types, variable_types, problem_type, ring, d = self._AbcxCVPRd() A = A.delete_rows((i,)) - b = list(b); del b[i] - constraint_types=list(constraint_types); del constraint_types[i] + b = list(b) + del b[i] + constraint_types = list(constraint_types) + del constraint_types[i] self.lp = InteractiveLPProblem(A, b, c, x, constraint_types, variable_types, problem_type, ring, objective_constant_term=d) diff --git a/src/sage/rings/bernoulli_mod_p.pyx b/src/sage/rings/bernoulli_mod_p.pyx index 514d32d6ec9..b46c6b41da1 100644 --- a/src/sage/rings/bernoulli_mod_p.pyx +++ b/src/sage/rings/bernoulli_mod_p.pyx @@ -39,10 +39,9 @@ from sage.rings.finite_rings.integer_mod_ring import Integers from sage.rings.bernmm import bernmm_bern_modp - def verify_bernoulli_mod_p(data): - """ - Computes checksum for Bernoulli numbers. + r""" + Compute checksum for Bernoulli numbers. It checks the identity diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index 38fcafd313c..c993ac687b2 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -732,7 +732,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): return x def norm(self): - """ + r""" Return the norm of this complex number. If `c = a + bi` is a complex number, then the norm of `c` is defined as diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx index 698c54e71b5..d79ea68fc25 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx @@ -82,8 +82,12 @@ cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_ cdef long sb, sy while b != 0: q = a // b - sb = b; b = a-q*b; a = sb - sy = y; y = x-q*y; x = sy + sb = b + b = a - q * b + a = sb + sy = y + y = x - q * y + x = sy self._gcd = a if x < 0: diff --git a/src/sage/rings/padics/padic_generic_element.pyx b/src/sage/rings/padics/padic_generic_element.pyx index 9bacb7ce43a..5cf7d8a04f3 100644 --- a/src/sage/rings/padics/padic_generic_element.pyx +++ b/src/sage/rings/padics/padic_generic_element.pyx @@ -814,7 +814,8 @@ cdef class pAdicGenericElement(LocalGenericElement): p = R.prime() pow = self.add_bigoh(prec) arg = pow - denom = 1; trunc = prec + denom = 1 + trunc = prec if R.absolute_degree() == 1: # Special code for Zp and Qp while pow != 0: @@ -946,7 +947,8 @@ cdef class pAdicGenericElement(LocalGenericElement): # We compute b = 1 + x + x^p/p + x^(p^2)/p^2 + ... pow = self.add_bigoh(prec) b = 1 + pow - denom = 1; trunc = prec + denom = 1 + trunc = prec while pow != 0: trunc += e pow = (pow**p).add_bigoh(trunc) diff --git a/src/sage/rings/puiseux_series_ring_element.pyx b/src/sage/rings/puiseux_series_ring_element.pyx index d5a23016e53..aff90ee1f89 100644 --- a/src/sage/rings/puiseux_series_ring_element.pyx +++ b/src/sage/rings/puiseux_series_ring_element.pyx @@ -272,8 +272,10 @@ cdef class PuiseuxSeries(AlgebraElement): exponents = [ZZ(exp) for exp in set(laurent.exponents() + [laurent.prec()])] # sort exponents such that the largest will be replaced first - exp_pos = [exp for exp in exponents if exp >= 0]; exp_pos.sort(reverse=True) - exp_neg = [exp for exp in exponents if exp < 0]; exp_neg.sort() + exp_pos = [exp for exp in exponents if exp >= 0] + exp_pos.sort(reverse=True) + exp_neg = [exp for exp in exponents if exp < 0] + exp_neg.sort() exponents = exp_neg + exp_pos # replacing exponents diff --git a/src/sage/rings/sum_of_squares.pyx b/src/sage/rings/sum_of_squares.pyx index ccf8657df79..a1d3edcedef 100644 --- a/src/sage/rings/sum_of_squares.pyx +++ b/src/sage/rings/sum_of_squares.pyx @@ -66,7 +66,8 @@ cdef int two_squares_c(uint_fast32_t n, uint_fast32_t res[2]): # j = (j+nn/j)/2 jj = j*j if jj == nn: - res[0] = i<= mn and x <= mx: diff --git a/src/tox.ini b/src/tox.ini index 7e78ad2abee..15cc6d181e0 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -107,7 +107,7 @@ description = # See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes deps = pycodestyle commands = pycodestyle --select E111,E401,E701,E702,E703,W605,E711,E712,E713,E721,E722 {posargs:{toxinidir}/sage/} - pycodestyle --select E703 --filename *.pyx {posargs:{toxinidir}/sage/} + pycodestyle --select E111,E401,E703,E712,E713,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/} [pycodestyle] max-line-length = 160 From a297e3c63420fd7c269e10d8265a86bb814154c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 27 May 2022 21:54:08 +0200 Subject: [PATCH 213/338] some details inside one p-adic file --- .../polynomial_padic_capped_relative_dense.py | 154 +++++++++--------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py index 6eac70126dc..b58c485ec50 100644 --- a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +++ b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py @@ -2,12 +2,12 @@ p-adic Capped Relative Dense Polynomials """ -#***************************************************************************** +# **************************************************************************** # Distributed under the terms of the GNU General Public License (GPL) # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** import sage.rings.polynomial.polynomial_element_generic from sage.rings.polynomial.polynomial_element import Polynomial @@ -17,7 +17,7 @@ import sage.rings.integer_ring import sage.rings.padics.misc as misc import sage.rings.padics.precision_error as precision_error -import sage.rings.fraction_field_element as fraction_field_element +from sage.rings.fraction_field_element import FractionFieldElement import copy from sage.libs.pari.all import pari, pari_gen @@ -33,7 +33,7 @@ class Polynomial_padic_capped_relative_dense(Polynomial_generic_cdv, Polynomial_padic): - def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, absprec = infinity, relprec = infinity): + def __init__(self, parent, x=None, check=True, is_gen=False, construct=False, absprec=infinity, relprec=infinity): """ TESTS:: @@ -65,7 +65,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, parentbr = parent.base_ring() from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if construct: - (self._poly, self._valbase, self._relprecs, self._normalized, self._valaddeds, self._list) = x #the last two of these may be None + (self._poly, self._valbase, self._relprecs, self._normalized, self._valaddeds, self._list) = x # the last two of these may be None return elif is_gen: self._poly = PolynomialRing(ZZ, parent.variable_name()).gen() @@ -76,15 +76,14 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, self._list = None return - #First we list the types that are turned into Polynomials + # First we list the types that are turned into Polynomials if isinstance(x, ZZX): - x = Polynomial_integer_dense(PolynomialRing(ZZ, parent.variable_name()), x, construct = True) - elif isinstance(x, fraction_field_element.FractionFieldElement) and \ - x.denominator() == 1: - #Currently we ignore precision information in the denominator. This should be changed eventually + x = Polynomial_integer_dense(PolynomialRing(ZZ, parent.variable_name()), x, construct=True) + elif isinstance(x, FractionFieldElement) and x.denominator() == 1: + # Currently we ignore precision information in the denominator. This should be changed eventually x = x.numerator() - #We now coerce various types into lists of coefficients. There are fast pathways for some types of polynomials + # We now coerce various types into lists of coefficients. There are fast pathways for some types of polynomials if isinstance(x, Polynomial): if x.parent() is self.parent(): if absprec is not infinity or relprec is not infinity: @@ -104,7 +103,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, p = parentbr.prime() self._relprecs = [c.valuation(p) + parentbr.precision_cap() for c in x.list()] self._comp_valaddeds() - self._normalized = len(self._valaddeds) == 0 or (min(self._valaddeds) == 0) + self._normalized = not self._valaddeds or min(self._valaddeds) == 0 self._list = None if absprec is not infinity or relprec is not infinity: self._adjust_prec_info(absprec, relprec) @@ -114,7 +113,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, check = False elif isinstance(x, dict): zero = parentbr.zero() - n = max(x.keys()) if x else 0 + n = max(x) if x else 0 v = [zero] * (n + 1) for i, z in x.items(): v[i] = z @@ -126,7 +125,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, # the type is, is to assume it coerces into the base_ring as a # constant polynomial elif not isinstance(x, list): - x = [x] # constant polynomial + x = [x] # constant polynomial # In contrast to other polynomials, the zero element is not distinguished # by having its list empty. Instead, it has list [0] @@ -136,8 +135,8 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, x = [parentbr(z) for z in x] # Remove this -- for p-adics this is terrible, since it kills any non exact zero. - #if len(x) == 1 and not x[0]: - # x = [] + # if len(x) == 1 and not x[0]: + # x = [] self._list = x self._valaddeds = [a.valuation() for a in x] @@ -185,13 +184,13 @@ def _normalize(self): if val is infinity: pass elif val != 0: - self._relprecs = [max(prec - val,0) for prec in self._relprecs] - v = [Integer(0) if (e is infinity) else ((c // prime_pow(val)) % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)] + self._relprecs = [max(prec - val, 0) for prec in self._relprecs] + v = [Integer(0) if (e is infinity) else ((c // prime_pow(val)) % prime_pow(e)) for c, e in zip(selflist, self._relprecs)] self._poly = self._poly.parent()(v, check=False) self._valbase += val self._valaddeds = [c - val for c in self._valaddeds] else: - self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)], check=False) + self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for c, e in zip(selflist, self._relprecs)], check=False) self._normalized = True def _reduce_poly(self): @@ -223,14 +222,15 @@ def _comp_list(self): polylist = self._poly.list() polylen = len(polylist) self._list = [self.base_ring()(polylist[i], absprec=self._relprecs[i]) << self._valbase for i in range(polylen)] \ - + [self.base_ring()(0, absprec=self._relprecs[i] + self._valbase) for i in range(polylen, len(self._relprecs))] + + [self.base_ring()(0, absprec=self._relprecs[i] + self._valbase) for i in range(polylen, len(self._relprecs))] while self._list and self._list[-1]._is_exact_zero(): self._list.pop() def _comp_valaddeds(self): self._valaddeds = [] - for i in range(self._poly.degree() + 1): - tmp = self._poly.list()[i].valuation(self.parent().base_ring().prime()) + prime = self.parent().base_ring().prime() + for i, pli in enumerate(self._poly.list()): + tmp = pli.valuation(prime) if tmp is infinity or tmp > self._relprecs[i]: self._valaddeds.append(self._relprecs[i]) else: @@ -287,7 +287,7 @@ def _adjust_prec_info(self, absprec=infinity, relprec=infinity): # else: # relprec = relprec + [parent.base_ring().precision_cap()] * (preclen - len(relprec)) # self._relprec = [min(a, v + r) - self._val for (a, r, v) in zip(absprec, relprec, vallist)] -#Remember to normalize at the end if self._normalized is true because you need to reduce mod p^n +# Remember to normalize at the end if self._normalized is true because you need to reduce mod p^n def _getprecpoly(self, n): one = Integer(1) @@ -297,7 +297,7 @@ def _getvalpoly(self, n): one = Integer(1) if self._valaddeds is None: self._comp_valaddeds() - return self._poly.parent()([(0 if (c is infinity) else (one << (n * c))) for c in self._valaddeds] + \ + return self._poly.parent()([(0 if (c is infinity) else (one << (n * c))) for c in self._valaddeds] + [(0 if (c is infinity) else (one << (n * c))) for c in self._relprecs[len(self._valaddeds):]]) def list(self, copy=True): @@ -413,7 +413,7 @@ def __getitem__(self, n): if self._list is not None: return self._list[n] return self.base_ring()(self.base_ring().prime_pow(self._valbase) - * self._poly[n], absprec = self._valbase + self._relprecs[n]) + * self._poly[n], absprec=self._valbase + self._relprecs[n]) def _add_(self, right): """ @@ -441,13 +441,13 @@ def _add_(self, right): else: baseval = self._valbase # Currently we don't reduce the coefficients of the answer modulo the appropriate power of p or normalize - return Polynomial_padic_capped_relative_dense(self.parent(), \ - (selfpoly + rightpoly, \ - baseval, \ - [min(a + self._valbase - baseval, b + right._valbase - baseval) for (a, b) in - zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), \ - _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], \ - False, None, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), + (selfpoly + rightpoly, + baseval, + [min(a + self._valbase - baseval, b + right._valbase - baseval) + for (a, b) in zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), + _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], + False, None, None), construct=True) def _sub_(self, right): """ @@ -475,13 +475,13 @@ def _sub_(self, right): else: baseval = self._valbase # Currently we don't reduce the coefficients of the answer modulo the appropriate power of p or normalize - return Polynomial_padic_capped_relative_dense(self.parent(), \ - (selfpoly - rightpoly, \ - baseval, \ - [min(a + self._valbase - baseval, b + right._valbase - baseval) for (a, b) in - zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), \ - _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], \ - False, None, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), + (selfpoly - rightpoly, + baseval, + [min(a + self._valbase - baseval, b + right._valbase - baseval) + for (a, b) in zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), + _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], + False, None, None), construct=True) def _mul_(self, right): r""" @@ -549,7 +549,7 @@ def _mul_(self, right): self._normalize() right._normalize() zzpoly = self._poly * right._poly - if len(self._relprecs) == 0 or len(right._relprecs) == 0: + if not self._relprecs or len(right._relprecs) == 0: return self.parent()(0) n = Integer(len(self._relprecs) + len(right._relprecs) - 1).exact_log(2) + 1 precpoly1 = self._getprecpoly(n) * right._getvalpoly(n) @@ -557,7 +557,7 @@ def _mul_(self, right): # These two will be the same length tn = Integer(1) << n preclist = [min(a.valuation(tn), b.valuation(tn)) for (a, b) in zip(precpoly1.list(), precpoly2.list())] - answer = Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase + right._valbase, preclist, False, None, None), construct = True) + answer = Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase + right._valbase, preclist, False, None, None), construct=True) answer._reduce_poly() return answer @@ -588,8 +588,8 @@ def _rmul_(self, left): elif left._is_exact_zero(): return Polynomial_padic_capped_relative_dense(self.parent(), []) else: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(0), self._valbase + left.valuation(), self._valaddeds, False, self._valaddeds, None), construct = True) - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly._rmul_(unit), self._valbase + val, relprecs, False, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(0), self._valbase + left.valuation(), self._valaddeds, False, self._valaddeds, None), construct=True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly._rmul_(unit), self._valbase + val, relprecs, False, self._valaddeds, None), construct=True) def _neg_(self): """ @@ -603,9 +603,9 @@ def _neg_(self): sage: -a (12 + 12*13 + O(13^2))*t^4 + (12*13 + 12*13^2 + O(13^3))*t^2 + 9 + 12*13 + O(13^2) """ - return Polynomial_padic_capped_relative_dense(self.parent(), (-self._poly, self._valbase, self._relprecs, False, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (-self._poly, self._valbase, self._relprecs, False, self._valaddeds, None), construct=True) - def lshift_coeffs(self, shift, no_list = False): + def lshift_coeffs(self, shift, no_list=False): """ Return a new polynomials whose coefficients are multiplied by p^shift. @@ -620,9 +620,9 @@ def lshift_coeffs(self, shift, no_list = False): if shift < 0: return self.rshift_coeffs(-shift, no_list) if no_list or self._list is None: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, None), construct=True) else: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, [c.__lshift__(shift) for c in self._list]), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, [c.__lshift__(shift) for c in self._list]), construct=True) def rshift_coeffs(self, shift, no_list=False): """ @@ -649,25 +649,25 @@ def rshift_coeffs(self, shift, no_list=False): [1 + O(13^4), O(13), O(13^2)] """ if shift < 0: - return self.lshift_coeffs(-shift, no_list) # We can't just absorb this into the next if statement because we allow rshift to preserve _normalized + return self.lshift_coeffs(-shift, no_list) # We can't just absorb this into the next if statement because we allow rshift to preserve _normalized if self.base_ring().is_field() or shift <= self._valbase: if no_list or self._list is None: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, None), construct=True) else: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, [c.__rshift__(shift) for c in self._list]), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, [c.__rshift__(shift) for c in self._list]), construct=True) else: shift = shift - self._valbase fdiv = self.base_ring().prime_pow(shift) - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly // fdiv, 0, [0 if a <= shift else a - shift for a in self._relprecs], False, None, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly // fdiv, 0, [0 if a <= shift else a - shift for a in self._relprecs], False, None, None), construct=True) - #def __floordiv__(self, right): - # if is_Polynomial(right) and right.is_constant() and right[0] in self.base_ring(): - # d = self.base_ring()(right[0]) - # elif (right in self.base_ring()): - # d = self.base_ring()(right) - # else: - # raise NotImplementedError - # return self._rmul_(self.base_ring()(~d.unit_part())).rshift_coeffs(d.valuation()) + # def __floordiv__(self, right): + # if is_Polynomial(right) and right.is_constant() and right[0] in self.base_ring(): + # d = self.base_ring()(right[0]) + # elif (right in self.base_ring()): + # d = self.base_ring()(right) + # else: + # raise NotImplementedError + # return self._rmul_(self.base_ring()(~d.unit_part())).rshift_coeffs(d.valuation()) def _unsafe_mutate(self, n, value): """ @@ -747,7 +747,7 @@ def __copy__(self): """ Return a copy of ``self``. """ - return Polynomial_padic_capped_relative_dense(self.parent(), (copy.copy(self._poly), self._valbase, copy.copy(self._relprecs), self._normalized, copy.copy(self._valaddeds), copy.copy(self._list)), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (copy.copy(self._poly), self._valbase, copy.copy(self._relprecs), self._normalized, copy.copy(self._valaddeds), copy.copy(self._list)), construct=True) def degree(self, secure=False): """ @@ -817,7 +817,7 @@ def prec_degree(self): """ return len(self._relprecs) - 1 - def precision_absolute(self, n = None): + def precision_absolute(self, n=None): """ Return absolute precision information about ``self``. @@ -846,7 +846,7 @@ def precision_absolute(self, n = None): return [c + self._valbase for c in self._relprecs] return self._relprecs[n] + self._valbase - def precision_relative(self, n = None): + def precision_relative(self, n=None): """ Return relative precision information about ``self``. @@ -910,7 +910,7 @@ def valuation_of_coefficient(self, n=None): self._comp_valaddeds() if n is None: self._normalize() - return [ c + self._valbase for c in self._valaddeds ] + return [c + self._valbase for c in self._valaddeds] n = int(n) if n < 0 or n >= len(self._relprecs): return infinity @@ -999,7 +999,7 @@ def reverse(self, degree=None): else: L = self._list[:(n + 1)] + [self.base_ring()(0)] * (n - self.prec_degree()) L.reverse() - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(zzlist), self._valbase, relprec, self._normalized, valadded, L), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(zzlist), self._valbase, relprec, self._normalized, valadded, L), construct=True) def rescale(self, a): r""" @@ -1041,7 +1041,7 @@ def rescale(self, a): zzpoly = self._poly.parent()(0) else: zzpoly = self._poly.rescale(Integer(a)) - return Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase, relprec, False, valadded, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase, relprec, False, valadded, None), construct=True) def quo_rem(self, right, secure=False): """ @@ -1070,7 +1070,7 @@ def quo_rem(self, right, secure=False): def _quo_rem_naive(self, right): """ - An implementation of quo_rem that doesn't have good run-time + An implementation of quo_rem that does not have good run-time or precision characteristics. A better one is :meth:`_quo_rem_list`. @@ -1107,7 +1107,7 @@ def _quo_rem_list(self, right, secure): b = right.list() db = right.degree(secure=secure) inv = ~b[db] - q = [ ] + q = [] for i in range(da, db - 1, -1): c = inv * a[i] q.append(c) @@ -1119,20 +1119,20 @@ def _quo_rem_list(self, right, secure): parent = PolynomialRing(K, name=self.parent().variable_name()) return parent(q), parent(a[:db]) - #def gcd(self, right): - # raise NotImplementedError + # def gcd(self, right): + # raise NotImplementedError - #def lcm(self, right): - # raise NotImplementedError + # def lcm(self, right): + # raise NotImplementedError - #def discriminant(self): - # raise NotImplementedError + # def discriminant(self): + # raise NotImplementedError def disc(self): return self.discriminant() - #def resultant(self): - # raise NotImplementedError + # def resultant(self): + # raise NotImplementedError def newton_polygon(self): r""" @@ -1325,6 +1325,6 @@ def _extend_by_infinity(L, n): def make_padic_poly(parent, x, version): if version == 0: - return parent(x, construct = True) + return parent(x, construct=True) else: raise ValueError("unknown pickling version") From c6fc3f38e7ae4b2b01bca6ba0c762a7a2bbefdd2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 27 May 2022 17:38:41 -0700 Subject: [PATCH 214/338] src/sage/doctest/forker.py: Rewrite doctest without python 3.10 parenthesized context manager --- src/sage/doctest/forker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index 39967cfbbe6..c0e2ba9c4b5 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -1705,8 +1705,8 @@ def parallel_dispatch(self): canceled:: sage: from tempfile import NamedTemporaryFile as NTF - sage: with ( NTF(suffix=".py", mode="w+t") as f1, - ....: NTF(suffix=".py", mode="w+t") as f2 ): + sage: with NTF(suffix=".py", mode="w+t") as f1, \ + ....: NTF(suffix=".py", mode="w+t") as f2: ....: _ = f1.write("'''\nsage: import time; time.sleep(60)\n'''") ....: f1.flush() ....: _ = f2.write("'''\nsage: True\nFalse\n'''") From fd21f2d1fa466dea5020110fae2d61f89446e67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 28 May 2022 07:59:57 +0200 Subject: [PATCH 215/338] fix another mistake --- src/sage/misc/instancedoc.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/misc/instancedoc.pyx b/src/sage/misc/instancedoc.pyx index 91923bd905f..574287fefe9 100644 --- a/src/sage/misc/instancedoc.pyx +++ b/src/sage/misc/instancedoc.pyx @@ -261,7 +261,7 @@ cdef class InstanceDocDescriptor: Traceback (most recent call last): ... AttributeError: attribute '__doc__' of 'list' objects is not writable - sage: descr.__delete__() + sage: descr.__delete__(object) Traceback (most recent call last): ... AttributeError: attribute '__doc__' of 'type' objects is not writable From 4351efdb27bf702a4f55f9233c35b21bff6c4ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 28 May 2022 12:54:29 +0200 Subject: [PATCH 216/338] pep cleanup for giac and gp pexpect interfaces --- src/sage/interfaces/giac.py | 142 ++++++++++++++++++------------------ src/sage/interfaces/gp.py | 80 +++++++++----------- 2 files changed, 105 insertions(+), 117 deletions(-) diff --git a/src/sage/interfaces/giac.py b/src/sage/interfaces/giac.py index 73601ca7ff2..59fb8f54158 100644 --- a/src/sage/interfaces/giac.py +++ b/src/sage/interfaces/giac.py @@ -1,5 +1,6 @@ r""" Pexpect Interface to Giac + (You should prefer the cython interface: giacpy_sage and its libgiac command) (adapted by F. Han from William Stein and Gregg Musiker maple's interface) @@ -247,7 +248,8 @@ from sage.structure.richcmp import rich_to_bool -COMMANDS_CACHE = '%s/giac_commandlist_cache.sobj'%DOT_SAGE +COMMANDS_CACHE = '%s/giac_commandlist_cache.sobj' % DOT_SAGE + class Giac(Expect): r""" @@ -328,16 +330,17 @@ def __init__(self, maxread=None, script_subdirectory=None, server=None, server_t True """ Expect.__init__(self, - name = 'giac', - prompt = '[0-9]*>> ', - command = "giac --sage", - env = {"LANG": "C"}, - init_code= ['maple_mode(0);I:=i;'], # coercion could be broken in maple_mode - script_subdirectory = script_subdirectory, - restart_on_ctrlc = False, server = server, - server_tmpdir = server_tmpdir, - verbose_start = False, - logfile = logfile, + name='giac', + prompt='[0-9]*>> ', + command="giac --sage", + env={"LANG": "C"}, + init_code=['maple_mode(0);I:=i;'], # coercion could be broken in maple_mode + script_subdirectory=script_subdirectory, + restart_on_ctrlc=False, + server=server, + server_tmpdir=server_tmpdir, + verbose_start=False, + logfile=logfile, eval_using_file_cutoff=1000) def _function_class(self): @@ -362,7 +365,7 @@ def _keyboard_interrupt(self): self._expect.sendline(chr(3)) # send ctrl-c self._expect.expect(self._prompt) # self._expect.expect(self._prompt) - raise RuntimeError("Ctrl-c pressed while running %s"%self) + raise RuntimeError("Ctrl-c pressed while running %s" % self) def __reduce__(self): """ @@ -378,7 +381,7 @@ def __reduce__(self): def _read_in_file_command(self, filename): r""" - Returns the string used to read filename into Giac. + Return the string used to read filename into Giac. EXAMPLES:: @@ -450,7 +453,7 @@ def _install_hints(self): def expect(self): """ - Returns the pexpect object for this Giac session. + Return the pexpect object for this Giac session. EXAMPLES:: @@ -483,7 +486,6 @@ def console(self): """ giac_console() - def completions(self, s): """ Return all commands that complete the command starting with the @@ -500,7 +502,7 @@ def completions(self, s): E = self._expect E.sendline('%s%s%s' % (s, chr(63), chr(13))) t = E.timeout - E.timeout=0.3 # since some things have no completion + E.timeout = 0.3 # since some things have no completion try: E.expect('----') except pexpect.TIMEOUT: @@ -525,8 +527,8 @@ def _commands(self): True """ try: - v = sum([self.completions(chr(65+n)) for n in range(26)], []) + \ - sum([self.completions(chr(97+n)) for n in range(26)], []) + v = sum([self.completions(chr(65 + n)) for n in range(26)], []) + \ + sum([self.completions(chr(97 + n)) for n in range(26)], []) except RuntimeError: print("\n" * 3) print("*" * 70) @@ -538,7 +540,7 @@ def _commands(self): def _tab_completion(self, verbose=True, use_disk_cache=True): """ - Returns a list of all the commands defined in Giac and optionally + Return a list of all the commands defined in Giac and optionally (per default) store them to disk. EXAMPLES:: @@ -570,11 +572,11 @@ def _tab_completion(self, verbose=True, use_disk_cache=True): sage.misc.persist.save(v, COMMANDS_CACHE) return v - def cputime(self, t=None): r""" - Returns the amount of CPU time that the Giac session has used. If - ``t`` is not None, then it returns the difference + Return the amount of CPU time that the Giac session has used. + + If ``t`` is not None, then it returns the difference between the current CPU time and ``t``. EXAMPLES:: @@ -590,8 +592,7 @@ def cputime(self, t=None): """ if t is None: return float(self('time()')) - else: - return float(self('time() - %s'%float(t))) + return float(self('time() - %s' % float(t))) def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if_needed=False): """ @@ -614,9 +615,9 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if """ with gc_disabled(): z = Expect._eval_line(self, line, allow_use_file=allow_use_file, - wait_for_prompt=wait_for_prompt) + wait_for_prompt=wait_for_prompt) if z.lower().find("error") != -1: - raise RuntimeError("An error occurred running a Giac command:\nINPUT:\n%s\nOUTPUT:\n%s"%(line, z)) + raise RuntimeError("an error occurred running a Giac command:\nINPUT:\n%s\nOUTPUT:\n%s" % (line, z)) lines = (line for line in z.splitlines() if not line.startswith('Evaluation time:')) return "\n".join(lines) @@ -660,10 +661,10 @@ def set(self, var, value): sage: giac.get('xx') '2' """ - cmd = '%s:=%s:;' % (var, value) #if giac is not in maple mode ( maple_mode(0)) + cmd = '%s:=%s:;' % (var, value) # if giac is not in maple mode ( maple_mode(0)) out = self.eval(cmd) if out.find("error") != -1: - raise TypeError("Error executing code in Giac\nCODE:\n\t%s\nGiac ERROR:\n\t%s"%(cmd, out)) + raise TypeError("error executing code in Giac\nCODE:\n\t%s\nGiac ERROR:\n\t%s" % (cmd, out)) def get(self, var): """ @@ -679,7 +680,7 @@ def get(self, var): def _object_class(self): """ - Returns the class of GiacElements. + Return the class of GiacElements. EXAMPLES:: @@ -696,7 +697,7 @@ def _object_class(self): def _function_element_class(self): """ - Returns the GiacFunctionElement class. + Return the GiacFunctionElement class. EXAMPLES:: @@ -713,7 +714,7 @@ def _function_element_class(self): def _equality_symbol(self): """ - Returns the symbol used for equality testing in Giac. + Return the symbol used for equality testing in Giac. EXAMPLES:: @@ -727,7 +728,7 @@ def _equality_symbol(self): def _true_symbol(self): """ - Returns the symbol used for truth in Giac. + Return the symbol used for truth in Giac. EXAMPLES:: @@ -743,7 +744,7 @@ def _true_symbol(self): def _assign_symbol(self): """ - Returns the symbol used for assignment in Giac. + Return the symbol used for assignment in Giac. EXAMPLES:: @@ -794,7 +795,7 @@ def clear(self, var): sage: giac.get('xx') 'xx' """ - self.eval('purge(%s)'%var) + self.eval('purge(%s)' % var) def version(self): """ @@ -813,7 +814,7 @@ def version(self): class GiacFunction(ExpectFunction): def _instancedoc_(self): """ - Returns the Giac help for this function. This gets called when + Return the Giac help for this function. This gets called when doing "?" on self. EXAMPLES:: @@ -829,7 +830,7 @@ def _instancedoc_(self): class GiacFunctionElement(FunctionElement): def _instancedoc_(self): """ - Returns the Giac help for this function. This gets called when + Return the Giac help for this function. This gets called when doing "?" on self. EXAMPLES:: @@ -845,7 +846,7 @@ def _instancedoc_(self): class GiacElement(ExpectElement): def __float__(self): """ - Returns a floating point version of self. + Return a floating point version of self. EXAMPLES:: @@ -869,15 +870,14 @@ def unapply(self, var): sage: g(1,2) 4 """ - return giac('unapply(%s,%s)'%(self,var)) - + return giac('unapply(%s,%s)' % (self, var)) def __hash__(self): """ - Returns a integer representing the hash of self. + Return an integer representing the hash of ``self``. These examples are optional, and require Giac to be installed. You - don't need to install any Sage packages for this. + do not need to install any Sage packages for this. EXAMPLES:: @@ -885,7 +885,7 @@ def __hash__(self): sage: hash(m) # random 4614285348919569149 """ - return hash(giac.eval('string(%s);'%self.name())) + return hash(giac.eval('string(%s);' % self.name())) def _richcmp_(self, other, op): """ @@ -926,14 +926,15 @@ def _richcmp_(self, other, op): False """ P = self.parent() - if P.eval("evalb(%s %s %s)"%(self.name(), P._equality_symbol(), - other.name())) == P._true_symbol(): + if P.eval("evalb(%s %s %s)" % (self.name(), P._equality_symbol(), + other.name())) == P._true_symbol(): return rich_to_bool(op, 0) - # (to be tested with giac). Maple does not allow comparing objects of different types and - # it raises an error in this case. + # (to be tested with giac). Maple does not allow comparing objects + # of different types and it raises an error in this case. # We catch the error, and return True for < try: - if P.eval("evalb(%s %s %s)"%(self.name(), P._lessthan_symbol(), other.name())) == P._true_symbol(): + if P.eval("evalb(%s %s %s)" % (self.name(), P._lessthan_symbol(), + other.name())) == P._true_symbol(): return rich_to_bool(op, -1) except RuntimeError as e: msg = str(e) @@ -944,7 +945,7 @@ def _richcmp_(self, other, op): return rich_to_bool(op, 1) else: raise RuntimeError(e) - if P.eval("evalb(%s %s %s)"%(self.name(), P._greaterthan_symbol(), other.name())) == P._true_symbol(): + if P.eval("evalb(%s %s %s)" % (self.name(), P._greaterthan_symbol(), other.name())) == P._true_symbol(): return rich_to_bool(op, 1) return NotImplemented @@ -1018,18 +1019,17 @@ def _latex_(self): \frac{...x^{4}...-...y...}{...y^{2}-3...x...} """ - s = self.parent().eval('latex(%s)'%self.name()) + s = self.parent().eval('latex(%s)' % self.name()) if s.startswith('"'): s = s[1:] if s.endswith('"'): s = s[:-1] - s = s.strip() - return s + return s.strip() def _matrix_(self, R): r""" Return matrix over the (Sage) ring R determined by self, where self - should be a Giac matrix. + should be a Giac matrix. .. WARNING:: It is slow, do not convert big matrices. @@ -1057,7 +1057,7 @@ def _matrix_(self, R): entries = [[R(self[r, c]) for c in range(m)] for r in range(n)] return M(entries) - def _sage_(self, locals={}): + def _sage_(self, locals=None): r""" Convert a giac expression back to a Sage expression, if possible. @@ -1126,7 +1126,10 @@ def _sage_(self, locals={}): from sage.symbolic.expression import symbol_table from sage.calculus.calculus import symbolic_expression_from_string, SR_parser_giac - result = repr(self) # string representation + if locals is None: + locals = {} + + result = repr(self) # string representation if str(self.type()) not in ['DOM_LIST', 'vector', 'vecteur']: @@ -1137,10 +1140,10 @@ def _sage_(self, locals={}): try: return symbolic_expression_from_string(result, lsymbols, - accept_sequence=True, parser=SR_parser_giac) - + accept_sequence=True, + parser=SR_parser_giac) except Exception: - raise NotImplementedError("Unable to parse Giac output: %s" % result) + raise NotImplementedError("unable to parse Giac output: %s" % result) else: return [entry.sage() for entry in self] @@ -1158,8 +1161,8 @@ def integral(self, var='x', min=None, max=None): - ``max`` - default: None - Returns the definite integral if xmin is not None, otherwise - returns an indefinite integral. + This returns the definite integral if xmin is not None, otherwise + an indefinite integral. EXAMPLES:: @@ -1177,9 +1180,8 @@ def integral(self, var='x', min=None, max=None): """ if min is None: return giac('int(%s,%s)' % (self.name(), var)) - else: - if max is None: - raise ValueError("neither or both of min/max must be specified.") + if max is None: + raise ValueError("neither or both of min/max must be specified") return giac('int(%s,%s,%s,%s)' % (self.name(), var, giac(min), giac(max))) @@ -1197,8 +1199,8 @@ def sum(self, var, min=None, max=None): - ``max`` - default: None - Returns the definite integral if xmin is not None, otherwise - returns an indefinite integral. + This returns the definite integral if xmin is not None, otherwise + an indefinite integral. EXAMPLES:: @@ -1207,19 +1209,19 @@ def sum(self, var, min=None, max=None): """ if min is None: return giac('sum(%s,%s)' % (self.name(), var)) - else: - if max is None: - raise ValueError("neither or both of min/max must be specified.") - return giac('sum(%s,%s,%s,%s)' % (self.name(), var, - giac(min), giac(max))) + if max is None: + raise ValueError("neither or both of min/max must be specified") + return giac('sum(%s,%s,%s,%s)' % (self.name(), var, + giac(min), giac(max))) # An instance giac = Giac() + def reduce_load_Giac(): """ - Returns the giac object created in sage.interfaces.giac. + Return the giac object created in sage.interfaces.giac. EXAMPLES:: diff --git a/src/sage/interfaces/gp.py b/src/sage/interfaces/gp.py index 6d95499640e..ff925b0ac8e 100644 --- a/src/sage/interfaces/gp.py +++ b/src/sage/interfaces/gp.py @@ -138,7 +138,9 @@ # http://www.gnu.org/licenses/ # ########################################################################## +import os +from sage.env import DOT_SAGE from .expect import Expect, ExpectElement, ExpectFunction, FunctionElement from sage.misc.verbose import verbose from sage.interfaces.tab_completion import ExtraTabCompletion @@ -200,16 +202,16 @@ def __init__(self, stacksize=10000000, # 10MB True """ Expect.__init__(self, - name = 'pari', - prompt = '\\? ', + name='pari', + prompt='\\? ', # --fast so the system gprc isn't read (we configure below) - command = "gp --fast --emacs --quiet --stacksize %s"%stacksize, - maxread = maxread, + command=f"gp --fast --emacs --quiet --stacksize {stacksize}", + maxread=maxread, server=server, server_tmpdir=server_tmpdir, - script_subdirectory = script_subdirectory, - restart_on_ctrlc = False, - verbose_start = False, + script_subdirectory=script_subdirectory, + restart_on_ctrlc=False, + verbose_start=False, logfile=logfile, eval_using_file_cutoff=1024) self.__seq = 0 @@ -332,7 +334,7 @@ def _read_in_file_command(self, filename): sage: gp.get('x').strip() '22' """ - return 'read("%s")'%filename + return 'read("%s")' % filename def _tab_completion(self): """ @@ -508,7 +510,7 @@ def set_default(self, var, value): 38 # 64-bit """ old = self.get_default(var) - self._eval_line('default(%s,%s)'%(var,value)) + self._eval_line('default(%s,%s)' % (var, value)) return old def get_default(self, var): @@ -536,7 +538,7 @@ def get_default(self, var): 28 # 32-bit 38 # 64-bit """ - return eval(self._eval_line('default(%s)'%var)) + return eval(self._eval_line('default(%s)' % var)) def set(self, var, value): """ @@ -553,11 +555,10 @@ def set(self, var, value): sage: gp.get('x') '2' """ - cmd = '%s=%s;'%(var,value) + cmd = '%s=%s;' % (var, value) out = self.eval(cmd) if out.find('***') != -1: - raise TypeError("Error executing code in GP:\nCODE:\n\t%s\nPARI/GP ERROR:\n%s"%(cmd, out)) - + raise TypeError("Error executing code in GP:\nCODE:\n\t%s\nPARI/GP ERROR:\n%s" % (cmd, out)) def get(self, var): """ @@ -573,7 +574,7 @@ def get(self, var): sage: gp.get('x') '2' """ - return self.eval('print(%s)'%var) + return self.eval('print(%s)' % var) def kill(self, var): """ @@ -592,20 +593,7 @@ def kill(self, var): sage: gp.get('xx') 'xx' """ - self.eval('kill(%s)'%var) - - #def xclear(self, var): - #""" - #Clear the variable named var. - #""" - #for varname based memory -- only 65000 variables and then dead. - #self.eval('kill(%s)'%var) - # for array-based memory this is best: - #self.eval('%s=0'%var) - # However, I've commented it out, since PARI doesn't seem - # to ever free any memory on its stack anyways. - # Killing variables as above takes a lot of time in some - # cases, also. + self.eval('kill(%s)' % var) def _next_var_name(self): """ @@ -631,20 +619,19 @@ def _next_var_name(self): ....: a = g(n) # long time sage: g('length(sage)') # long time 24000 - """ self.__seq += 1 if self.__seq >= self.__var_store_len: if self.__var_store_len == 0: - self.eval('sage=vector(%s,k,0);'%self.__init_list_length) + self.eval('sage=vector(%s,k,0);' % self.__init_list_length) self.__var_store_len = self.__init_list_length else: - self.eval('sage0=concat(sage, vector(%s,k,0));'%self.__var_store_len) + self.eval('sage0=concat(sage, vector(%s,k,0));' % self.__var_store_len) self.eval('sage=sage0;') self.eval('kill(sage0);') self.__var_store_len *= 2 - verbose("doubling PARI/sage object vector: %s"%self.__var_store_len) - return 'sage[%s]'%self.__seq + verbose("doubling PARI/sage object vector: %s" % self.__var_store_len) + return 'sage[%s]' % self.__seq def _reset_expect(self): """ @@ -788,9 +775,9 @@ def help(self, command): sage: gp.help('gcd') 'gcd(x,{y}): greatest common divisor of x and y.' """ - return self.eval('?%s'%command).strip() + return self.eval('?%s' % command).strip() - def new_with_bits_prec(self, s, precision = 0): + def new_with_bits_prec(self, s, precision=0): r""" Creates a GP object from s with ``precision`` bits of precision. GP actually automatically increases this precision to @@ -824,7 +811,7 @@ def new_with_bits_prec(self, s, precision = 0): """ if precision: old_prec = self.get_real_precision() - prec = int(precision/3.321928095) + prec = int(precision / 3.321928095) self.set_real_precision(prec) x = self(s) self.set_real_precision(old_prec) @@ -955,9 +942,7 @@ def __bool__(self): False """ P = self._check_valid() - return P.eval('%s != 0'%(self.name())) == '1' - - + return P.eval('%s != 0' % (self.name())) == '1' def _complex_mpfr_field_(self, CC): """ @@ -983,7 +968,7 @@ def _complex_mpfr_field_(self, CC): # Multiplying by CC(1) is necessary here since # sage: pari(gp(1+I)).sage().parent() # Maximal Order in Number Field in i with defining polynomial x^2 + 1 - return CC((CC(1)*pari(self)).sage()) + return CC((CC.one() * pari(self)).sage()) def _complex_double_(self, CDF): """ @@ -1031,9 +1016,9 @@ def __del__(self): # out of date, e.g., for matrices it uses \pmatrix (which # causes an error if amsmath is loaded) and for rationals # it does nothing, etc. - #def _latex_(self): - # P = self._check_valid() - # return P.eval('printtex(%s)'%self.name()) + # def _latex_(self): + # P = self._check_valid() + # return P.eval('printtex(%s)'%self.name()) def _tab_completion(self): """ @@ -1063,11 +1048,11 @@ def is_GpElement(x): """ return isinstance(x, GpElement) -from sage.env import DOT_SAGE -import os # An instance -gp = Gp(logfile=os.path.join(DOT_SAGE,'gp-expect.log')) # useful for debugging! +gp = Gp(logfile=os.path.join(DOT_SAGE, 'gp-expect.log')) +# useful for debugging! + def reduce_load_GP(): """ @@ -1081,6 +1066,7 @@ def reduce_load_GP(): """ return gp + def gp_console(): """ Spawn a new GP command-line session. @@ -1108,7 +1094,7 @@ def gp_version(): """ v = gp.eval(r'\v') i = v.find("Version ") - w = v[i+len("Version "):] + w = v[i + len("Version "):] i = w.find(' ') w = w[:i] t = tuple([int(n) for n in w.split('.')]) From da1b912dde67ce48c0dff125f670bcf94ab2e6f9 Mon Sep 17 00:00:00 2001 From: "Martin R. Albrecht" Date: Sat, 28 May 2022 16:09:48 +0100 Subject: [PATCH 217/338] change more version numbers for FP(y)LLL --- build/pkgs/fplll/spkg-configure.m4 | 2 +- build/pkgs/fpylll/install-requires.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/fplll/spkg-configure.m4 b/build/pkgs/fplll/spkg-configure.m4 index d7cc77fe6c7..c220aecc60c 100644 --- a/build/pkgs/fplll/spkg-configure.m4 +++ b/build/pkgs/fplll/spkg-configure.m4 @@ -8,7 +8,7 @@ SAGE_SPKG_CONFIGURE([fplll], [ dnl Trac #31025: FPLLL/FPyLLL make no guarantee regarding compatibility dnl other than "whatever versions were released at the same time should work together" PKG_CHECK_MODULES([FPLLL], - [fplll >= 5.4.0 fplll <= 5.4.1], + [fplll >= 5.4.0 fplll <= 5.4.2], [ AC_MSG_CHECKING([whether BKZ default strategy JSON is installed]) AC_LANG_PUSH([C++]) diff --git a/build/pkgs/fpylll/install-requires.txt b/build/pkgs/fpylll/install-requires.txt index 0461a00816f..c1a9bf38bbb 100644 --- a/build/pkgs/fpylll/install-requires.txt +++ b/build/pkgs/fpylll/install-requires.txt @@ -1 +1 @@ -fpylll >=0.5.5, <=0.5.6 +fpylll >=0.5.6, <=0.5.7 From 11a0e571365129c66e2edc52dac3a0bca4adeccf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 28 May 2022 10:23:44 -0700 Subject: [PATCH 218/338] build/bin/write-dockerfile.sh: Add bootstrap-conda --- build/bin/write-dockerfile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 4e2f891d506..752a9c26f58 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -207,7 +207,7 @@ FROM with-system-packages as bootstrapped #:bootstrapping: RUN mkdir -p sage WORKDIR sage -$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./ +$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./ $ADD src/doc/bootstrap src/doc/bootstrap $ADD src/bin src/bin $ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/setup.cfg.m4 src/ From a5da84a2ce4dd5cb4fb1c97046a95fddc9b3281d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 28 May 2022 10:35:21 -0700 Subject: [PATCH 219/338] src/sage/misc/{abstract_method.py,lazy_attribute.pyx}: Update doctest output --- src/sage/misc/abstract_method.py | 2 +- src/sage/misc/lazy_attribute.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/misc/abstract_method.py b/src/sage/misc/abstract_method.py index 49dc59ba9fa..cd7d0a7ca39 100644 --- a/src/sage/misc/abstract_method.py +++ b/src/sage/misc/abstract_method.py @@ -193,7 +193,7 @@ def _sage_src_lines_(self): sage: src[0] 'def banner():\n' sage: lines - 81 + 89 """ from sage.misc.sageinspect import sage_getsourcelines return sage_getsourcelines(self._f) diff --git a/src/sage/misc/lazy_attribute.pyx b/src/sage/misc/lazy_attribute.pyx index c6e7b5110bb..5584c620587 100644 --- a/src/sage/misc/lazy_attribute.pyx +++ b/src/sage/misc/lazy_attribute.pyx @@ -87,7 +87,7 @@ cdef class _lazy_attribute(object): sage: src[0] 'def banner():\n' sage: lines - 81 + 89 """ from sage.misc.sageinspect import sage_getsourcelines return sage_getsourcelines(self.f) From 3884373088e5cd92df05dff406a037a14abe7353 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 28 May 2022 10:37:16 -0700 Subject: [PATCH 220/338] src/sage/tests/cmdline.py: Update doctest for changed help message --- src/sage/tests/cmdline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index fccba3f12fb..1570b9c9b6a 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -165,7 +165,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False Test help:: sage: (out, err, ret) = test_executable(["sage", "-h"]) - sage: out.find("Optional arguments:") >= 0 + sage: out.find("evaluate cmd as sage") >= 0 True sage: err '' @@ -173,7 +173,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False 0 sage: (out, err, ret) = test_executable(["sage", "--help"]) - sage: out.find("Optional arguments:") >= 0 + sage: out.find("evaluate cmd as sage") >= 0 True sage: err '' From 1720e6009203fcc23e22ccfbf9ab657615d5c822 Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Sun, 29 May 2022 00:27:41 +0200 Subject: [PATCH 221/338] #33930 : fix doctest for polyhedra_tutorial.rst --- src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst b/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst index c0c36091367..e4e0b1eeb8b 100644 --- a/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst +++ b/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst @@ -658,7 +658,8 @@ An example with quadratic field: sage: V = polytopes.dodecahedron().vertices_list() # optional - sage.rings.number_field sage: Polyhedron(vertices=V, backend='polymake') # optional - polymake # optional - sage.rings.number_field A 3-dimensional polyhedron - in (Number Field in sqrt5 with defining polynomial x^2 - 5)^3 + in (Number Field in sqrt5 with defining polynomial x^2 - 5 + with sqrt5 = 2.236067977499790?)^3 defined as the convex hull of 20 vertices .. end of output From fd8362477c57dd1722350f095e4d1cb4d58d9a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 29 May 2022 13:31:14 +0200 Subject: [PATCH 222/338] simplify many super calls to super() in combinat --- src/sage/combinat/binary_tree.py | 12 ++-- src/sage/combinat/crystals/littelmann_path.py | 11 ++-- src/sage/combinat/diagram_algebras.py | 38 ++++++------- src/sage/combinat/finite_state_machine.py | 20 +++---- src/sage/combinat/k_tableau.py | 10 ++-- src/sage/combinat/partition_kleshchev.py | 12 ++-- src/sage/combinat/partition_tuple.py | 16 +++--- src/sage/combinat/permutation.py | 50 ++++++++--------- .../combinat/root_system/associahedron.py | 12 ++-- .../root_system/extended_affine_weyl_group.py | 12 ++-- src/sage/combinat/shifted_primed_tableau.py | 10 ++-- src/sage/combinat/tableau.py | 55 +++++++++---------- src/sage/combinat/tableau_tuple.py | 23 ++++---- src/sage/combinat/words/paths.py | 17 +++--- src/sage/combinat/words/word_datatypes.pyx | 18 +++--- .../combinat/words/word_infinite_datatypes.py | 12 ++-- 16 files changed, 161 insertions(+), 167 deletions(-) diff --git a/src/sage/combinat/binary_tree.py b/src/sage/combinat/binary_tree.py index 5fda457d72e..d8e0a46938b 100644 --- a/src/sage/combinat/binary_tree.py +++ b/src/sage/combinat/binary_tree.py @@ -234,7 +234,7 @@ def _repr_(self): if not self: return "." else: - return super(BinaryTree, self)._repr_() + return super()._repr_() def _ascii_art_(self): r""" @@ -4124,7 +4124,7 @@ def __call__(self, x=None, *args, **keywords): sage: B() . """ - return super(BinaryTrees, self).__call__(x, *args, **keywords) + return super().__call__(x, *args, **keywords) def unlabelled_trees(self): """ @@ -4190,8 +4190,8 @@ def __init__(self, size): sage: S is BinaryTrees(3) True """ - super(BinaryTrees_size, self).__init__(facade=BinaryTrees_all(), - category=FiniteEnumeratedSets()) + super().__init__(facade=BinaryTrees_all(), + category=FiniteEnumeratedSets()) self._size = size def _repr_(self): @@ -4423,8 +4423,8 @@ def __init__(self, size): sage: for i in range(1,6): ....: TestSuite(BinaryTrees(2*i-1, full=True)).run() """ - super(FullBinaryTrees_size, self).__init__(facade=BinaryTrees_all(), - category=FiniteEnumeratedSets()) + super().__init__(facade=BinaryTrees_all(), + category=FiniteEnumeratedSets()) self._size = size def _repr_(self): diff --git a/src/sage/combinat/crystals/littelmann_path.py b/src/sage/combinat/crystals/littelmann_path.py index 6f45611e85c..fd32c317943 100644 --- a/src/sage/combinat/crystals/littelmann_path.py +++ b/src/sage/combinat/crystals/littelmann_path.py @@ -165,7 +165,7 @@ def __classcall_private__(cls, starting_weight, cartan_type = None, starting_wei if starting_weight.parent() != starting_weight_parent: raise ValueError("The passed parent is not equal to parent of the inputted weight!") - return super(CrystalOfLSPaths, cls).__classcall__(cls, starting_weight, starting_weight_parent = starting_weight_parent) + return super().__classcall__(cls, starting_weight, starting_weight_parent = starting_weight_parent) def __init__(self, starting_weight, starting_weight_parent): """ @@ -702,7 +702,7 @@ def __classcall_private__(cls, weight): raise ValueError("The weight should be in the non-extended weight lattice!") La = weight.parent().basis() weight = weight - weight.level() * La[0] / La[0].level() - return super(CrystalOfLSPaths, cls).__classcall__(cls, weight, starting_weight_parent = weight.parent()) + return super().__classcall__(cls, weight, starting_weight_parent = weight.parent()) @cached_method def maximal_vector(self): @@ -1206,7 +1206,7 @@ def __classcall_private__(cls, cartan_type): True """ cartan_type = CartanType(cartan_type) - return super(InfinityCrystalOfLSPaths, cls).__classcall__(cls, cartan_type) + return super().__classcall__(cls, cartan_type) def __init__(self, cartan_type): """ @@ -1320,8 +1320,7 @@ def e(self, i, power=1, length_only=False): sage: len(B.subcrystal(max_depth=7)) 116 """ - ret = super(InfinityCrystalOfLSPaths.Element, self).e(i, power=power, - length_only=length_only) + ret = super().e(i, power=power, length_only=length_only) if ret is None: return None if length_only: @@ -1375,7 +1374,7 @@ def f(self, i, power=1, length_only=False): 2*Lambda[0] + 2*Lambda[1] + 2*Lambda[2]) """ dual_path = self.dualize() - dual_path = super(InfinityCrystalOfLSPaths.Element, dual_path).e(i, power, length_only=length_only) + dual_path = super().e(i, power, length_only=length_only) if length_only: return dual_path if dual_path is None: diff --git a/src/sage/combinat/diagram_algebras.py b/src/sage/combinat/diagram_algebras.py index de6813f7a23..eee9052ed76 100644 --- a/src/sage/combinat/diagram_algebras.py +++ b/src/sage/combinat/diagram_algebras.py @@ -257,7 +257,7 @@ def __init__(self, parent, d, check=True): sage: pd1 = da.AbstractPartitionDiagram(pd, ((-2,-1),(1,2)) ) """ self._base_diagram = tuple(sorted(tuple(sorted(i)) for i in d)) - super(AbstractPartitionDiagram, self).__init__(parent, self._base_diagram, check=check) + super().__init__(parent, self._base_diagram, check=check) def check(self): r""" @@ -588,7 +588,7 @@ def check(self): ValueError: {{-3, -1, 1, 2}} does not represent two rows of vertices of order 2 sage: pd4 = IdealDiagram([[1,-2,-1],[2]]) # indirect doctest """ - super(IdealDiagram, self).check() + super().check() if self.propagating_number() >= self.order(): raise ValueError("the diagram %s must have a propagating number smaller than the order" % self) @@ -659,7 +659,7 @@ def check(self): ValueError: {{-3, -1, 1, 2}} does not represent two rows of vertices of order 2 sage: pd4 = PlanarDiagram([[1,-2,-1],[2]]) # indirect doctest """ - super(PlanarDiagram, self).check() + super().check() if not self.is_planar(): raise ValueError("the diagram %s must be planar" % self) @@ -721,7 +721,7 @@ def check(self): ... ValueError: all blocks of {{-2, -1, 1}, {2}} must be of size 2 """ - super(TemperleyLiebDiagram, self).check() + super().check() if any(len(block) != 2 for block in self): raise ValueError("all blocks of %s must be of size 2" % self ) if not self.is_planar(): @@ -824,7 +824,7 @@ def check(self): ... ValueError: all blocks of {{-2, -1, 1, 2}} must be of size 2 """ - super(BrauerDiagram, self).check() + super().check() if any(len(i) != 2 for i in self): raise ValueError("all blocks of %s must be of size 2" % self) @@ -903,7 +903,7 @@ def _repr_normal(self): sage: bd([[1,2],[-1,-2]])._repr_normal() '{{-2, -1}, {1, 2}}' """ - return super(BrauerDiagram, self)._repr_() + return super()._repr_() def _repr_compact(self): """ @@ -1425,7 +1425,7 @@ def __contains__(self, obj): r = ZZ(self.order) else: r = ZZ(self.order + ZZ(1)/ZZ(2)) - return super(BrauerDiagrams, self).__contains__(obj) and [len(i) for i in obj] == [2]*r + return super().__contains__(obj) and [len(i) for i in obj] == [2]*r def cardinality(self): r""" @@ -1714,7 +1714,7 @@ def __contains__(self, obj): obj = self._element_constructor_(obj) except (ValueError, TypeError): return False - return super(PlanarDiagrams, self).__contains__(obj) + return super().__contains__(obj) class IdealDiagrams(AbstractPartitionDiagrams): r""" @@ -1761,7 +1761,7 @@ def __contains__(self, obj): obj = self._element_constructor_(obj) except (ValueError, TypeError): return False - return super(IdealDiagrams, self).__contains__(obj) and obj.propagating_number() < self.order + return super().__contains__(obj) and obj.propagating_number() < self.order class DiagramAlgebra(CombinatorialFreeModule): r""" @@ -2436,7 +2436,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="P"): """ if base_ring is None: base_ring = q.parent() - return super(PartitionAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) # The following is the basic constructor method for the class. # The purpose of the "prefix" is to label the basis elements @@ -2509,7 +2509,7 @@ def _element_constructor_(self, x): and self.has_coerce_map_from(x.parent().base_ring())): return sum(a * self._diag_to_Blst(d) for (d,a) in x) - return super(PartitionAlgebra, self)._element_constructor_(x) + return super()._element_constructor_(x) def _repr_(self): """ @@ -2598,7 +2598,7 @@ def _coerce_map_from_(self, R): if R.n <= self._k and self.base_ring().has_coerce_map_from(R.base_ring()): return R.module_morphism(self._perm_to_Blst, codomain=self) return None - return super(PartitionAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def orbit_basis(self): r""" @@ -3173,7 +3173,7 @@ def __classcall_private__(cls, *args): k, q, R = args q = R(q) alg = PartitionAlgebra(k, q, R) - return super(OrbitBasis, cls).__classcall__(cls, alg) + return super().__classcall__(cls, alg) def __init__(self, alg): """ @@ -3246,7 +3246,7 @@ def _coerce_map_from_(self, R): return self._alg.module_morphism(self._diagram_to_orbit_on_basis, codomain=self) if self._alg.coerce_map_from(R): return self._coerce_map_via([self._alg], R) - return super(OrbitBasis, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) @cached_method def one(self): @@ -3645,7 +3645,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="B"): """ if base_ring is None: base_ring = q.parent() - return super(BrauerAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" @@ -3704,7 +3704,7 @@ def _coerce_map_from_(self, R): if R.n <= self._k and self.base_ring().has_coerce_map_from(R.base_ring()): return R.module_morphism(self._perm_to_Blst, codomain=self) return None - return super(BrauerAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def _element_constructor_(self, set_partition): r""" @@ -3836,7 +3836,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="T"): """ if base_ring is None: base_ring = q.parent() - return super(TemperleyLiebAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" @@ -4003,7 +4003,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="Pl"): """ if base_ring is None: base_ring = q.parent() - return super(PlanarAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" @@ -4092,7 +4092,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="I"): """ if base_ring is None: base_ring = q.parent() - return super(PropagatingIdeal, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" diff --git a/src/sage/combinat/finite_state_machine.py b/src/sage/combinat/finite_state_machine.py index f52a0f129d6..8615e791b6b 100644 --- a/src/sage/combinat/finite_state_machine.py +++ b/src/sage/combinat/finite_state_machine.py @@ -11018,12 +11018,10 @@ def __init__(self, *args, **kwargs): True sage: Automaton()._allow_composition_ False - """ - super(Automaton, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._allow_composition_ = False - def _repr_(self): """ Represents the finite state machine as "Automaton with n @@ -11825,7 +11823,7 @@ class is created and is used during the processing. options['list_of_outputs'] = True options['only_accepted'] = True - result = super(Automaton, self).process(*args, **options) + result = super().process(*args, **options) if condensed_output: return any(result) @@ -11870,7 +11868,7 @@ def _process_convert_output_(self, output_data, **kwargs): (True, 'a', [1, 0, 1]) """ if kwargs['always_include_output']: - return super(Automaton, self)._process_convert_output_( + return super()._process_convert_output_( output_data, **kwargs) accept_input, current_state, output = output_data if kwargs['full_output']: @@ -12994,7 +12992,7 @@ class is created and is used during the processing. options['list_of_outputs'] = True options['only_accepted'] = True - result = super(Transducer, self).process(*args, **options) + result = super().process(*args, **options) if (condensed_output and not result or not options['full_output'] and result is None): @@ -13734,7 +13732,7 @@ def __init__(self, *args, **kwargs): ....: [False], ((0, 0),), False) tape at 0 """ - super(_FSMTapeCacheDetectEpsilon_, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._visited_states_ = set() @@ -13752,7 +13750,7 @@ def __deepcopy__(self, memo): sage: TC3._visited_states_ {1} """ - new = super(_FSMTapeCacheDetectEpsilon_, self).__deepcopy__(memo) + new = super().__deepcopy__(memo) new._visited_states_ = copy(self._visited_states_) return new @@ -15099,7 +15097,7 @@ def __init__(self, *args, **kwargs): self.TapeCache = _FSMTapeCacheDetectEpsilon_ self.visited_states = {} kwargs['check_epsilon_transitions'] = False - return super(_FSMProcessIteratorEpsilon_, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) def _push_branch_(self, state, tape_cache, outputs): @@ -15145,7 +15143,7 @@ def _push_branch_(self, state, tape_cache, outputs): if found: return - super(_FSMProcessIteratorEpsilon_, self)._push_branch_( + super()._push_branch_( state, tape_cache, outputs) # As tape_cache may have been discarded because current already @@ -15226,7 +15224,7 @@ def __init__(self, *args, **kwargs): self.TapeCache = _FSMTapeCacheDetectAll_ self.visited_states = {} kwargs['check_epsilon_transitions'] = False - return super(_FSMProcessIteratorAll_, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) # **************************************************************************** diff --git a/src/sage/combinat/k_tableau.py b/src/sage/combinat/k_tableau.py index 0c1df07ba61..65b925d9ce0 100644 --- a/src/sage/combinat/k_tableau.py +++ b/src/sage/combinat/k_tableau.py @@ -438,7 +438,7 @@ def __hash__(self): if self.parent()._representation in ['core', 'bounded']: return hash(tuple(tuple(x) for x in self)) + hash(self.parent().k) else: - return super(WeakTableau_abstract, self).__hash__() + return super().__hash__() def _latex_(self): r""" @@ -1250,7 +1250,7 @@ def __classcall_private__(cls, k, shape, weight): shape = (Core(shape, k+1), Core([],k+1)) else: shape = tuple([Core(r,k+1) for r in shape]) - return super(WeakTableaux_core, cls).__classcall__(cls, k, shape, tuple(weight)) + return super().__classcall__(cls, k, shape, tuple(weight)) def __init__(self, k, shape, weight): r""" @@ -1718,7 +1718,7 @@ def __classcall_private__(cls, k, shape, weight): shape = (Partition(shape), Partition([])) else: shape = tuple([Partition(r) for r in shape]) - return super(WeakTableaux_bounded, cls).__classcall__(cls, k, shape, tuple(weight)) + return super().__classcall__(cls, k, shape, tuple(weight)) def __init__(self, k, shape, weight): r""" @@ -2139,7 +2139,7 @@ def __classcall_private__(cls, k, shape, weight): shape = (Core(shape, k+1), Core([],k+1)) else: shape = tuple([Core(r,k+1) for r in shape]) - return super(WeakTableaux_factorized_permutation, cls).__classcall__(cls, k, shape, tuple(weight)) + return super().__classcall__(cls, k, shape, tuple(weight)) def __init__(self, k, shape, weight): r""" @@ -3956,7 +3956,7 @@ def __classcall_private__(cls, k, shape, weight=None): inner_shape = Core(shape[1],k+1) if weight is not None: weight = tuple(weight) - return super(StrongTableaux, cls).__classcall__(cls, k, (outer_shape, inner_shape), weight) + return super().__classcall__(cls, k, (outer_shape, inner_shape), weight) def _repr_( self ): r""" diff --git a/src/sage/combinat/partition_kleshchev.py b/src/sage/combinat/partition_kleshchev.py index c379de07876..8fd46bc76fe 100644 --- a/src/sage/combinat/partition_kleshchev.py +++ b/src/sage/combinat/partition_kleshchev.py @@ -449,7 +449,7 @@ def is_regular(self): if self.size() == 0 or self.parent()._e == 0: return True KP = self.parent() - return super(KleshchevPartition, self).is_regular(KP._e, KP._multicharge) + return super().is_regular(KP._e, KP._multicharge) def is_restricted(self): r""" @@ -475,7 +475,8 @@ def is_restricted(self): if self.size() == 0 or self.parent()._e == 0: return True KP = self.parent() - return super(KleshchevPartition, self).is_restricted(KP._e, KP._multicharge) + return super().is_restricted(KP._e, KP._multicharge) + class KleshchevPartitionTuple(PartitionTuple): r""" @@ -1284,7 +1285,8 @@ def _element_constructor_(self, mu): if self._level>1 and KPmu._convention[0] == self._convention[0]: mu = mu[::-1] - return super(KleshchevPartitions, self)._element_constructor_(mu) + return super()._element_constructor_(mu) + class KleshchevPartitions_all(KleshchevPartitions): r""" @@ -1446,7 +1448,7 @@ def __init__(self, e, multicharge, convention): else: self.Element = KleshchevPartitionTupleCrystal - super(KleshchevPartitions_all, self).__init__(category=cat) + super().__init__(category=cat) self._e = e # for printing self._index_set = IntegerModRing(e) self._multicharge = multicharge @@ -1673,7 +1675,7 @@ def __init__(self, e, multicharge=(0,), size=0, convention='RS'): self._element_constructor_ = getattr_from_other_class(self, Partitions, '_element_constructor_') else: self.Element = KleshchevPartitionTuple - super(KleshchevPartitions_size, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self._size = size # As lists do not take negative indices the case e=0 needs to be handled # differently. Rather than doing this we set e equal to a "really big" diff --git a/src/sage/combinat/partition_tuple.py b/src/sage/combinat/partition_tuple.py index b4f54624d2f..90fbb6e6866 100644 --- a/src/sage/combinat/partition_tuple.py +++ b/src/sage/combinat/partition_tuple.py @@ -2076,7 +2076,7 @@ def __init__(self): sage: TestSuite( PartitionTuples() ).run() """ - super(PartitionTuples_all, self).__init__(category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) def _repr_(self): r""" @@ -2156,7 +2156,7 @@ def __init__(self, level, category=None): raise ValueError('level must be a non-negative integer') if category is None: category = InfiniteEnumeratedSets() - super(PartitionTuples_level, self).__init__(category=category) + super().__init__(category=category) self._level = level def _repr_(self): @@ -2259,8 +2259,8 @@ def __init__(self, size): """ if size not in NN: raise ValueError('size must be a non-negative integer') - super(PartitionTuples_size, self).__init__(category=InfiniteEnumeratedSets()) - self._size=size + super().__init__(category=InfiniteEnumeratedSets()) + self._size = size def _repr_(self): """ @@ -2361,9 +2361,9 @@ def __init__(self, level, size): """ if not (level in NN and size in NN): raise ValueError('n and level must be non-negative integers') - super(PartitionTuples_level_size, self).__init__(category=FiniteEnumeratedSets()) - self._level=level - self._size=size + super().__init__(category=FiniteEnumeratedSets()) + self._level = level + self._size = size def _repr_(self): """ @@ -2503,7 +2503,7 @@ def __setstate__(self, state): self.__class__=parts.__class__ self.__dict__=parts.__dict__ else: - super(PartitionTuples, self).__setstate__(state) + super().__setstate__(state) ############################################################################### # Regular partition tuples diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 8eae4b7c84c..7fbcbff6f94 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -5611,7 +5611,7 @@ def __classcall_private__(cls, mset): sage: S1 is S2 True """ - return super(Permutations_mset, cls).__classcall__(cls, tuple(mset)) + return super().__classcall__(cls, tuple(mset)) def __init__(self, mset): """ @@ -5971,7 +5971,7 @@ def __classcall_private__(cls, s): sage: S1 is S2 True """ - return super(Permutations_set, cls).__classcall__(cls, tuple(s)) + return super().__classcall__(cls, tuple(s)) def __init__(self, s): """ @@ -6097,7 +6097,7 @@ def __classcall__(cls, mset, k): sage: S1 is S2 True """ - return super(Permutations_msetk, cls).__classcall__(cls, tuple(mset), k) + return super().__classcall__(cls, tuple(mset), k) def __init__(self, mset, k): """ @@ -6188,7 +6188,7 @@ def __classcall_private__(cls, s, k): sage: S1 is S2 True """ - return super(Permutations_setk, cls).__classcall__(cls, tuple(s), k) + return super().__classcall__(cls, tuple(s), k) def __init__(self, s, k): """ @@ -6604,7 +6604,7 @@ def _coerce_map_from_(self, G): return self._from_permutation_group_element if isinstance(G, StandardPermutations_n) and G.n <= self.n: return True - return super(StandardPermutations_n, self)._coerce_map_from_(G) + return super()._coerce_map_from_(G) def _from_permutation_group_element(self, x): """ @@ -7619,7 +7619,7 @@ def __classcall_private__(cls, d, n): sage: P1 is P2 True """ - return super(StandardPermutations_descents, cls).__classcall__(cls, tuple(sorted(d)), n) + return super().__classcall__(cls, tuple(sorted(d)), n) def __init__(self, d, n): r""" @@ -7845,7 +7845,7 @@ def __classcall_private__(cls, recoils): sage: S1 is S2 True """ - return super(StandardPermutations_recoilsfiner, cls).__classcall__(cls, Composition(recoils)) + return super().__classcall__(cls, Composition(recoils)) def __init__(self, recoils): """ @@ -7912,7 +7912,7 @@ def __classcall_private__(cls, recoils): sage: S1 is S2 True """ - return super(StandardPermutations_recoilsfatter, cls).__classcall__(cls, Composition(recoils)) + return super().__classcall__(cls, Composition(recoils)) def __init__(self, recoils): """ @@ -7986,7 +7986,7 @@ def __classcall_private__(cls, recoils): sage: S1 is S2 True """ - return super(StandardPermutations_recoils, cls).__classcall__(cls, Composition(recoils)) + return super().__classcall__(cls, Composition(recoils)) def __init__(self, recoils): """ @@ -8137,7 +8137,7 @@ def __classcall_private__(cls, p): sage: S1 is S2 True """ - return super(StandardPermutations_bruhat_smaller, cls).__classcall__(cls, Permutation(p)) + return super().__classcall__(cls, Permutation(p)) def __init__(self, p): """ @@ -8195,7 +8195,7 @@ def __classcall_private__(cls, p): sage: S1 is S2 True """ - return super(StandardPermutations_bruhat_greater, cls).__classcall__(cls, Permutation(p)) + return super().__classcall__(cls, Permutation(p)) def __init__(self, p): """ @@ -8412,7 +8412,7 @@ def __classcall_private__(cls, mset): Cyclic permutations of [1, 2, 3, 3] sage: TestSuite(CP).run() # not tested -- broken """ - return super(CyclicPermutations, cls).__classcall__(cls, tuple(mset)) + return super().__classcall__(cls, tuple(mset)) def _repr_(self): """ @@ -8527,7 +8527,7 @@ def __classcall_private__(cls, partition): True """ partition = tuple(map(tuple, partition)) - return super(CyclicPermutationsOfPartition, cls).__classcall__(cls, partition) + return super().__classcall__(cls, partition) def __init__(self, partition): """ @@ -8658,7 +8658,7 @@ def __classcall_private__(cls, a): True """ a = tuple(map(Permutation, a)) - return super(StandardPermutations_all_avoiding, cls).__classcall__(cls, a) + return super().__classcall__(cls, a) def __init__(self, a): """ @@ -8704,7 +8704,7 @@ def __contains__(self, x): sage: [2,1,3] in Permutations(avoiding=[]) True """ - if not super(StandardPermutations_all_avoiding, self).__contains__(x): + if not super().__contains__(x): return False x = Permutations()(x) return all(x.avoids(p) for p in self._a) @@ -8753,7 +8753,7 @@ def __classcall_private__(cls, n, a): True """ a = tuple(map(Permutation, a)) - return super(StandardPermutations_avoiding_generic, cls).__classcall__(cls, n, a) + return super().__classcall__(cls, n, a) def __init__(self, n, a): """ @@ -8810,7 +8810,7 @@ def __contains__(self, x): sage: [2,1,3] in Permutations(3, avoiding=[]) True """ - if not super(StandardPermutations_avoiding_generic, self).__contains__(x): + if not super().__contains__(x): return False x = Permutations()(x) return all(x.avoids(p) for p in self._a) @@ -8858,7 +8858,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[1, 2]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_12, self).__init__(n, (Permutations()([1, 2]),)) + super().__init__(n, (Permutations()([1, 2]),)) def __iter__(self): """ @@ -8889,7 +8889,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 1]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_21, self).__init__(n, (Permutations()([2, 1]),)) + super().__init__(n, (Permutations()([2, 1]),)) def __iter__(self): """ @@ -8920,7 +8920,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[1, 3, 2]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_132, self).__init__(n, (Permutations()([1, 3, 2]),)) + super().__init__(n, (Permutations()([1, 3, 2]),)) def cardinality(self): """ @@ -8992,7 +8992,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 1, 3]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_123, self).__init__(n, (Permutations()([1, 2, 3]),)) + super().__init__(n, (Permutations()([1, 2, 3]),)) def cardinality(self) -> Integer: """ @@ -9063,7 +9063,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[3, 2, 1]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_321, self).__init__(n, (Permutations()([3, 2, 1]),)) + super().__init__(n, (Permutations()([3, 2, 1]),)) def cardinality(self): """ @@ -9094,7 +9094,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 3, 1]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_231, self).__init__(n, (Permutations()([2, 3, 1]),)) + super().__init__(n, (Permutations()([2, 3, 1]),)) def cardinality(self): """ @@ -9126,7 +9126,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[3, 1, 2]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_312, self).__init__(n, (Permutations()([3, 1, 2]),)) + super().__init__(n, (Permutations()([3, 1, 2]),)) def cardinality(self): """ @@ -9158,7 +9158,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 1, 3]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_213, self).__init__(n, (Permutations()([2, 1, 3]),)) + super().__init__(n, (Permutations()([2, 1, 3]),)) def cardinality(self): """ diff --git a/src/sage/combinat/root_system/associahedron.py b/src/sage/combinat/root_system/associahedron.py index 565b5d8581a..66b134a35e7 100644 --- a/src/sage/combinat/root_system/associahedron.py +++ b/src/sage/combinat/root_system/associahedron.py @@ -189,7 +189,7 @@ def __new__(typ, parent=None, Vrep=None, Hrep=None, cartan_type=None, **kwds): if cartan_type or (parent is None and Vrep is None and Hrep is None): # Called from element constructor in ``Associahedron_base``. # Alternatively called from ``loads`` in ``loads(dumps(...))``. - return super(Associahedron_class_base, typ).__new__(typ, parent, Vrep, Hrep, **kwds) + return super().__new__(typ, parent, Vrep, Hrep, **kwds) else: # Not called from element constructor in ``Associahedron_base``. # Return a polyhedron with proper backend (not an associahedron). @@ -214,7 +214,7 @@ def __init__(self, parent, Vrep, Hrep, cartan_type=None, **kwds): """ if cartan_type: self._cartan_type = cartan_type - super(Associahedron_class_base, self).__init__(parent, Vrep, Hrep, **kwds) + super().__init__(parent, Vrep, Hrep, **kwds) else: raise ValueError("associahedron must be initialized with cartan type") @@ -375,7 +375,7 @@ def _element_constructor_(self, cartan_type, **kwds): c = rhocheck.coefficient(orbit[0].leading_support()) for beta in orbit: inequalities.append([c] + [beta.coefficient(i) for i in I]) - associahedron = super(Associahedra_base, self)._element_constructor_(None, [inequalities, []], cartan_type=cartan_type) + associahedron = super()._element_constructor_(None, [inequalities, []], cartan_type=cartan_type) return associahedron def _coerce_map_from_(self, X): @@ -416,7 +416,7 @@ def _coerce_map_from_(self, X): """ if not isinstance(X, Associahedra_base): return False - return super(Associahedra_base, self)._coerce_map_from_(X) + return super()._coerce_map_from_(X) def _pushout_(self, other): r""" @@ -441,8 +441,8 @@ def _pushout_(self, other): return Polyhedra(QQ, self.ambient_dim(), self.backend()) # Call the overwritten pushout in case it exists. - if hasattr(super(Associahedra_base, self), '_pushout_'): - return super(Associahedra_base, self)._pushout_(other) + if hasattr(super(), '_pushout_'): + return super()._pushout_(other) class Associahedra_ppl(Associahedra_base, Polyhedra_QQ_ppl): Element = Associahedron_class_ppl diff --git a/src/sage/combinat/root_system/extended_affine_weyl_group.py b/src/sage/combinat/root_system/extended_affine_weyl_group.py index a2866253194..bd02024afc6 100644 --- a/src/sage/combinat/root_system/extended_affine_weyl_group.py +++ b/src/sage/combinat/root_system/extended_affine_weyl_group.py @@ -1984,7 +1984,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).PW0()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Multiplicative form of Weight lattice of the Root system of type ['C', 2] acted upon by Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice)" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupPW0, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_translation(self, la): r""" @@ -2163,7 +2163,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).W0P()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice) acting on Multiplicative form of Weight lattice of the Root system of type ['C', 2]" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupW0P, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def S0(self): r""" @@ -2356,7 +2356,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).WF()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Weyl Group of type ['BC', 2, 2] (as a matrix group acting on the root lattice) acted upon by Fundamental group of type ['BC', 2, 2]" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupWF, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_affine_weyl(self, w): r""" @@ -2512,7 +2512,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).FW()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Fundamental group of type ['BC', 2, 2] acting on Weyl Group of type ['BC', 2, 2] (as a matrix group acting on the root lattice)" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupFW, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() @cached_method def simple_reflections(self): @@ -2682,7 +2682,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).PvW0()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Multiplicative form of Weight lattice of the Root system of type ['C', 2] acted upon by Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice)" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupPvW0, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_dual_translation(self, la): r""" @@ -2847,7 +2847,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).W0Pv()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice) acting on Multiplicative form of Weight lattice of the Root system of type ['C', 2]" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupW0Pv, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_dual_translation(self, la): r""" diff --git a/src/sage/combinat/shifted_primed_tableau.py b/src/sage/combinat/shifted_primed_tableau.py index 5b8eb900ece..bb22854bdfb 100644 --- a/src/sage/combinat/shifted_primed_tableau.py +++ b/src/sage/combinat/shifted_primed_tableau.py @@ -2163,7 +2163,7 @@ def __classcall_private__(cls, shape, max_entry=None, skew=None, primed_diagonal True """ shape = _Partitions(shape) - return super(ShiftedPrimedTableaux_shape, cls).__classcall__(cls, + return super().__classcall__(cls, shape=shape, max_entry=max_entry, skew=skew, primed_diagonal=primed_diagonal) def __init__(self, shape, max_entry=None, skew=None, primed_diagonal=False): @@ -2253,7 +2253,7 @@ def _contains_tableau(self, T): ....: primed_diagonal=True)._contains_tableau(t) True """ - if not super(ShiftedPrimedTableaux_shape, self)._contains_tableau(T): + if not super()._contains_tableau(T): return False shape = [len(row) for row in T] @@ -2300,7 +2300,7 @@ def __iter__(self): 1504 """ if not self._primed_diagonal: - for T in super(ShiftedPrimedTableaux_shape, self).__iter__(): + for T in super().__iter__(): yield T return @@ -2433,7 +2433,7 @@ def _contains_tableau(self, T): sage: ShiftedPrimedTableaux(weight=(1,2))._contains_tableau(u) False """ - if not super(ShiftedPrimedTableaux_weight, self)._contains_tableau(T): + if not super()._contains_tableau(T): return False flat = [item.integer() for sublist in T for item in sublist] @@ -2566,7 +2566,7 @@ def _contains_tableau(self, T): sage: ShiftedPrimedTableaux([], weight=())._contains_tableau(u) True """ - if not super(ShiftedPrimedTableaux_weight_shape, self)._contains_tableau(T): + if not super()._contains_tableau(T): return False flat = [item.integer() for sublist in T for item in sublist] diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 9d7e3cc2b41..834cfabe51d 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -4362,7 +4362,7 @@ def check(self): ... ValueError: expected entry to be a positive integer at (row=0, col=0). Found (0) """ - super(SemistandardTableau, self).check() + super().check() # Tableau() has checked that t is tableau, so it remains to check that # the entries of t are positive integers which are weakly increasing @@ -4487,7 +4487,7 @@ def check(self): ValueError: the entries in a row standard tableau must increase along rows and contain the numbers 1,2,...,n """ - super(RowStandardTableau, self).check() + super().check() # We have checked that t is tableau, so it remains to check that # the entries of t are positive integers that increase along rows. flatx = sorted(sum((list(row) for row in self), [])) @@ -4590,7 +4590,7 @@ def check(self): ... ValueError: the entries in each row of a semistandard tableau must be weakly increasing """ - super(StandardTableau, self).check() + super().check() # t is semistandard so we only need to check # that its entries are in bijection with {1, 2, ..., n} flattened_list = [i for row in self for i in row] @@ -5045,7 +5045,7 @@ def check(self): # Empty tableau, so trivially an increasing tableau return - super(IncreasingTableau, self).check() + super().check() # Tableau() has checked that t is tableau, so it remains to check that # the entries of t are positive integers which are weakly increasing @@ -5558,9 +5558,8 @@ def __init__(self): sage: T = sage.combinat.tableau.Tableaux_all() sage: TestSuite(T).run() - """ - super(Tableaux_all, self).__init__(category=Sets()) + super().__init__(category=Sets()) def _repr_(self): """ @@ -5601,7 +5600,7 @@ def __init__(self, n): sage: T = sage.combinat.tableau.Tableaux_size(0) sage: TestSuite(T).run() """ - super(Tableaux_size, self).__init__(category=Sets()) + super().__init__(category=Sets()) self.size = n def __contains__(self,x): @@ -6172,8 +6171,7 @@ def __init__(self, n): sage: T = sage.combinat.tableau.SemistandardTableaux_size_inf(3) sage: TestSuite(T).run() """ - super(SemistandardTableaux_size_inf, self).__init__( - category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -6275,8 +6273,7 @@ def __init__(self, p): sage: TestSuite(SST).run() """ - super(SemistandardTableaux_shape_inf, self).__init__( - category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -6371,8 +6368,8 @@ def __init__(self, n, max_entry=None): if max_entry is None: max_entry = n - super(SemistandardTableaux_size, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -6569,8 +6566,8 @@ def __init__(self, p, max_entry=None): """ if max_entry is None: max_entry = sum(p) - super(SemistandardTableaux_shape, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.shape = p def __iter__(self): @@ -6775,7 +6772,7 @@ def __init__(self, p, mu): sage: SST = SemistandardTableaux([2,1], [2,1]) sage: TestSuite(SST).run() """ - super(SemistandardTableaux_shape_weight, self).__init__(p, len(mu)) + super().__init__(p, len(mu)) self.weight = mu def _repr_(self): @@ -6889,8 +6886,8 @@ def __init__(self, n, mu): sage: SST = SemistandardTableaux(3, [2,1]) sage: TestSuite(SST).run() """ - super(SemistandardTableaux_size_weight, self).__init__(max_entry=len(mu), - category=FiniteEnumeratedSets()) + super().__init__(max_entry=len(mu), + category=FiniteEnumeratedSets()) self.size = n self.weight = mu @@ -7268,7 +7265,7 @@ def __init__(self, p): sage: TestSuite( RowStandardTableaux([2,1,1]) ).run() """ - super(RowStandardTableaux_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -7772,7 +7769,7 @@ def __init__(self, p): sage: TestSuite( StandardTableaux([2,1,1]) ).run() """ - super(StandardTableaux_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -8726,7 +8723,7 @@ def __init__(self, n): sage: T = IncreasingTableaux_size_inf(3) sage: TestSuite(T).run() """ - super(IncreasingTableaux_size_inf, self).__init__(category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -8807,7 +8804,7 @@ def __init__(self, p): sage: TestSuite(IT).run() """ - super(IncreasingTableaux_shape_inf, self).__init__(category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -8895,8 +8892,8 @@ def __init__(self, n, max_entry=None): """ if max_entry is None: max_entry = n - super(IncreasingTableaux_size, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -9010,8 +9007,8 @@ def __init__(self, p, max_entry=None): """ if max_entry is None: max_entry = sum(p) - super(IncreasingTableaux_shape, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.shape = p def __iter__(self): @@ -9123,7 +9120,7 @@ def __init__(self, p, wt): sage: IT = IncreasingTableaux([2,1], (1,0,1)) sage: TestSuite(IT).run() """ - super(IncreasingTableaux_shape_weight, self).__init__(p, len(wt)) + super().__init__(p, len(wt)) self.weight = wt def _repr_(self): @@ -9267,8 +9264,8 @@ def __init__(self, n, wt): sage: IT = IncreasingTableaux(3, (1,0,1)) sage: TestSuite(IT).run() """ - super(IncreasingTableaux_size_weight, self).__init__(max_entry=len(wt), - category=FiniteEnumeratedSets()) + super().__init__(max_entry=len(wt), + category=FiniteEnumeratedSets()) self.size = n self.weight = wt diff --git a/src/sage/combinat/tableau_tuple.py b/src/sage/combinat/tableau_tuple.py index f911ca60535..4425dcb4f27 100644 --- a/src/sage/combinat/tableau_tuple.py +++ b/src/sage/combinat/tableau_tuple.py @@ -1567,7 +1567,7 @@ def __init__(self, parent, t, check=True): except ValueError: raise ValueError('not a valid row standard tableau tuple') - super(RowStandardTableauTuple, self).__init__(parent, t) + super().__init__(parent, t) if check: # We still have to check that t is row standard. @@ -1940,7 +1940,7 @@ def __init__(self, parent, t, check=True): False """ # The check that ``t`` is valid tableau tuple is done by RowStandardTableauTuple - super(StandardTableauTuple, self).__init__(parent, t, check=check) + super().__init__(parent, t, check=check) # As StandardTableauTuple inherits from RowStandardTableauTuple t must # be row strict and contain 1,2,...,n once each, so we only need to @@ -2385,9 +2385,8 @@ def __init__(self): sage: TableauTuples() Tableau tuples - """ - super(TableauTuples_all, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._level = None self._size = None @@ -2430,7 +2429,7 @@ def __init__(self, level): sage: TableauTuples(level=4)( [[[1,2],[4]],[],[],[[4,5,6],[7,8]]] ) ([[1, 2], [4]], [], [], [[4, 5, 6], [7, 8]]) """ - super(TableauTuples_level, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._level = level def __contains__(self, t): @@ -2511,7 +2510,7 @@ def __init__(self, size): sage: TableauTuples(size=6) Tableau tuples of size 6 """ - super(TableauTuples_size, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._size = size def __contains__(self, t): @@ -2598,7 +2597,7 @@ def __init__(self, level, size): sage: TableauTuples(4,3) Tableau tuples of level 4 and size 3 """ - super(TableauTuples_level_size, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._level = level self._size = size @@ -3357,7 +3356,7 @@ def __init__(self, shape): sage: STT.cardinality() 1260 """ - super(RowStandardTableauTuples_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) from sage.combinat.partition_tuple import PartitionTuple self._shape = PartitionTuple(shape) self._level = len(shape) @@ -3579,7 +3578,7 @@ def __init__(self, residue): sage: tabs = RowStandardTableauTuple([[[6],[7]],[[3,4,5],[1,2]]]).residue_sequence(2,(0,0)).row_standard_tableaux() sage: TestSuite(tabs).run() # long time """ - super(RowStandardTableauTuples_residue, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self._residue = residue self._quantum_characteristic = residue.quantum_characteristic() self._multicharge = residue.multicharge() @@ -3822,7 +3821,7 @@ def __init__(self, residue, shape): if residue.size() != shape.size(): raise ValueError('the size of the shape and the length of the residue defence must coincide!') - super(RowStandardTableauTuples_residue_shape, self).__init__(residue) + super().__init__(residue) self._shape = shape # The _standard_tableaux attribute below is used to generate the @@ -4736,7 +4735,7 @@ def __init__(self, shape): sage: STT.cardinality() 210 """ - super(StandardTableauTuples_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) from sage.combinat.partition_tuple import PartitionTuple self._shape = PartitionTuple(shape) self._level = len(shape) @@ -5087,7 +5086,7 @@ def __init__(self, residue): sage: T = StandardTableauTuple([[[6],[7]],[[1,2,3],[4,5]]]).residue_sequence(2,(0,0)).standard_tableaux() sage: TestSuite(T).run() """ - super(StandardTableaux_residue, self).__init__(residue, category=FiniteEnumeratedSets()) + super().__init__(residue, category=FiniteEnumeratedSets()) self._level = residue.level() self._multicharge = residue.multicharge() self._quantum_characteristic = residue.quantum_characteristic() diff --git a/src/sage/combinat/words/paths.py b/src/sage/combinat/words/paths.py index 2a847391252..8e73c2331a7 100644 --- a/src/sage/combinat/words/paths.py +++ b/src/sage/combinat/words/paths.py @@ -634,7 +634,7 @@ def __init__(self, alphabet): d = [(1 ,0), (0,1), (-1,0), (0,-1)] #Construction of the class - super(WordPaths_square_grid, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) @lazy_attribute def _element_classes(self): @@ -710,7 +710,7 @@ def __init__(self, alphabet): vector(K, (ZZ(1)/ZZ(2), -sqrt3/2 ))) #Construction of the class - super(WordPaths_triangle_grid, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_triangle_grid @@ -778,7 +778,7 @@ def __init__(self, alphabet): """ #Construction of the class - super(WordPaths_hexagonal_grid, self).__init__(alphabet) + super().__init__(alphabet) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_hexagonal_grid @@ -847,7 +847,7 @@ def __init__(self, alphabet): """ #Construction of the class d = [(1,0,0), (0,1,0), (0,0,1), (-1,0,0), (0,-1,0), (0,0,-1)] - super(WordPaths_cube_grid, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_cube_grid @@ -913,7 +913,7 @@ def __init__(self, alphabet): """ #Construction of the class d = [(1,1), (1,-1)] - super(WordPaths_dyck, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_dyck @@ -981,7 +981,7 @@ def __init__(self, alphabet): """ #Construction of the class d = [(0,1), (1,0)] - super(WordPaths_north_east, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_north_east @@ -2144,7 +2144,7 @@ def is_simple(self): pavages*, Thèse de doctorat en Mathématiques, Montréal, UQAM, septembre 2008, 115 pages. """ - return super(FiniteWordPath_square_grid,self).is_simple() + return super().is_simple() def tikz_trajectory(self): r""" @@ -2255,9 +2255,8 @@ def __init__(self, parent, *args, **kwds): sage: f == loads(dumps(f)) True - """ - super(FiniteWordPath_hexagonal_grid, self).__init__(parent, *args, **kwds) + super().__init__(parent, *args, **kwds) class FiniteWordPath_cube_grid(FiniteWordPath_3d): pass diff --git a/src/sage/combinat/words/word_datatypes.pyx b/src/sage/combinat/words/word_datatypes.pyx index 98d0df2616c..0492a276832 100644 --- a/src/sage/combinat/words/word_datatypes.pyx +++ b/src/sage/combinat/words/word_datatypes.pyx @@ -269,7 +269,7 @@ cdef class WordDatatype_list(WordDatatype): if isinstance(other, WordDatatype_list): return self._parent(self._data + other._data) else: - return super(WordDatatype_list, self).__mul__(other) + return super().__mul__(other) __add__ = __mul__ @@ -486,7 +486,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(sub, str): return self._data.find(sub, start, end) else: - return super(WordDatatype_str, self).find(sub, start, end) + return super().find(sub, start, end) def rfind(self, sub, start=0, end=None): r""" @@ -524,7 +524,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(sub, str): return self._data.rfind(sub, start, end) else: - return super(WordDatatype_str, self).rfind(sub, start, end) + return super().rfind(sub, start, end) def __len__(self): r""" @@ -606,7 +606,7 @@ cdef class WordDatatype_str(WordDatatype): if isinstance(other, WordDatatype_str): return self._parent(self._data + other._data) else: - return super(WordDatatype_str, self).__mul__(other) + return super().__mul__(other) __add__ = __mul__ @@ -802,7 +802,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(other, str): return other.endswith(self._data) else: - return super(WordDatatype_str, self).is_suffix(other) + return super().is_suffix(other) def has_suffix(self, other): """ @@ -834,7 +834,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(other, str): return self._data.endswith(other) else: - return super(WordDatatype_str, self).has_suffix(other) + return super().has_suffix(other) def is_prefix(self, other): r""" @@ -875,7 +875,7 @@ cdef class WordDatatype_str(WordDatatype): if isinstance(other ,str): return other.startswith(self._data) else: - return super(WordDatatype_str, self).is_prefix(other) + return super().is_prefix(other) def has_prefix(self, other): r""" @@ -916,7 +916,7 @@ cdef class WordDatatype_str(WordDatatype): if isinstance(other, str): return self._data.startswith(other) else: - return super(WordDatatype_str, self).has_prefix(other) + return super().has_prefix(other) cdef class WordDatatype_tuple(WordDatatype): r""" @@ -1120,6 +1120,6 @@ cdef class WordDatatype_tuple(WordDatatype): if isinstance(other, WordDatatype_tuple): return self._parent(self._data + other._data) else: - return super(WordDatatype_tuple, self).__mul__(other) + return super().__mul__(other) __add__ = __mul__ diff --git a/src/sage/combinat/words/word_infinite_datatypes.py b/src/sage/combinat/words/word_infinite_datatypes.py index 95664b687af..45816bf0ae3 100644 --- a/src/sage/combinat/words/word_infinite_datatypes.py +++ b/src/sage/combinat/words/word_infinite_datatypes.py @@ -346,7 +346,7 @@ def __init__(self, parent, callable, length=None): sage: w.length() +Infinity """ - super(WordDatatype_callable_with_caching,self).__init__(parent,callable,length) + super().__init__(parent, callable, length) # for caching self._letter_cache = {} @@ -515,11 +515,11 @@ def __getitem__(self, key): ValueError: for infinite words, start and stop values cannot be negative """ if isinstance(key, slice): - return super(WordDatatype_callable_with_caching, self).__getitem__(key) + return super().__getitem__(key) else: if key not in self._letter_cache: self._letter_cache[key] = \ - super(WordDatatype_callable_with_caching, self).__getitem__(key) + super().__getitem__(key) return self._letter_cache[key] def __reduce__(self): @@ -945,7 +945,7 @@ def __init__(self, parent, iter, length=None): sage: w._len 8 """ - super(WordDatatype_iter_with_caching,self).__init__(parent,iter,length) + super().__init__(parent, iter, length) # we use self._data for returning an iterator through __iter__; # we use self._gen for caching self._data, self._gen = itertools.tee(self._data) @@ -1158,10 +1158,10 @@ def __getitem__(self, key): ValueError: Step for islice() must be a positive integer or None. """ if isinstance(key, slice): - return super(WordDatatype_iter_with_caching,self).__getitem__(key) + return super().__getitem__(key) else: if key < 0: - return super(WordDatatype_iter_with_caching,self).__getitem__(key) + return super().__getitem__(key) else: while self._last_index < key: try: From 89a642cd0fc0acfd364dff4d66b4af217725f7fc Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 29 May 2022 19:52:03 +0900 Subject: [PATCH 223/338] Do not import quickref and tutorial from sage.combinat --- src/sage/combinat/all.py | 5 ++++- src/sage/misc/namespace_package.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 953c6b29761..daef30fab6e 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -44,11 +44,14 @@ - :ref:`sage.graphs` """ +from sage.misc.namespace_package import install_doc, install_dict # install the docstring of this module to the containing package -from sage.misc.namespace_package import install_doc install_doc(__package__, __doc__) +# install modules quickref and tutorial to the containing package from . import quickref, tutorial +install_dict(__package__, {'quickref': quickref, 'tutorial': tutorial}) +del quickref, tutorial from sage.misc.lazy_import import lazy_import diff --git a/src/sage/misc/namespace_package.py b/src/sage/misc/namespace_package.py index 75d9f1d8dcc..eaa05bdfd71 100644 --- a/src/sage/misc/namespace_package.py +++ b/src/sage/misc/namespace_package.py @@ -18,3 +18,17 @@ def install_doc(package, doc): pkg = import_module(package) pkg.__doc__ = doc # enable sage.package? pkg.getdoc = lambda: doc # enable help(sage.package) + +def install_dict(package, dic): + """ + Install ``dic`` to the ``__dict__`` of the package. + + TESTS: + + sage: from sage.misc.namespace_package import install_dict + sage: install_dict('sage', {'greeting': 'hello'}) + sage: sage.greeting + 'hello' + """ + pkg = import_module(package) + pkg.__dict__.update(dic) From 7787d86268157ce19f9e0208361c69e85b988e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 29 May 2022 14:11:17 +0200 Subject: [PATCH 224/338] use super() outside of combinat --- src/sage/algebras/lie_algebras/subalgebra.py | 24 ++++-------- src/sage/coding/abstract_code.py | 20 +++++----- src/sage/coding/grs_code.py | 22 +++++------ src/sage/geometry/toric_lattice.py | 22 +++++------ src/sage/groups/misc_gps/argument_groups.py | 17 ++++----- src/sage/misc/converting_dict.py | 16 ++++---- src/sage/misc/sage_input.py | 29 +++++++------- .../modform_hecketriangle/graded_ring.py | 24 ++++-------- .../modular/modform_hecketriangle/space.py | 21 +++++----- src/sage/rings/asymptotic/growth_group.py | 23 ++++------- src/sage/rings/asymptotic/term_monoid.py | 15 ++++---- .../function_field_valuation.py | 21 +++++----- src/sage/structure/unique_representation.py | 20 +++++----- .../topology/simplicial_set_constructions.py | 38 +++++++++---------- 14 files changed, 139 insertions(+), 173 deletions(-) diff --git a/src/sage/algebras/lie_algebras/subalgebra.py b/src/sage/algebras/lie_algebras/subalgebra.py index c9e9748a7d6..6bd13a8aaf5 100644 --- a/src/sage/algebras/lie_algebras/subalgebra.py +++ b/src/sage/algebras/lie_algebras/subalgebra.py @@ -208,8 +208,8 @@ def __classcall_private__(cls, ambient, gens, ideal=False, if ambient in LieAlgebras(ambient.base_ring()).Nilpotent(): category = category.Nilpotent() - sup = super(LieSubalgebra_finite_dimensional_with_basis, cls) - return sup.__classcall__(cls, ambient, gens, ideal, order, category) + return super().__classcall__(cls, ambient, gens, ideal, + order, category) def __init__(self, ambient, gens, ideal, order=None, category=None): r""" @@ -240,8 +240,7 @@ def __init__(self, ambient, gens, ideal, order=None, category=None): self._reorganized_indices = [self._reversed_indices.index(i) for i in ambient.indices()] - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - sup.__init__(ambient.base_ring(), category=category) + super().__init__(ambient.base_ring(), category=category) # register a coercion to the ambient Lie algebra H = Hom(self, ambient) @@ -278,8 +277,7 @@ def __contains__(self, x): if x in self.ambient(): x = self.ambient()(x) return x.to_vector() in self.module() - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.__contains__(x) + return super().__contains__(x) def __getitem__(self, x): r""" @@ -300,8 +298,7 @@ def __getitem__(self, x): """ if isinstance(x, tuple) and len(x) == 2: return self(x[0])._bracket_(self(x[1])) - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.__getitem__(x) + return super().__getitem__(x) def _repr_(self): r""" @@ -405,8 +402,7 @@ def _element_constructor_(self, x): if isinstance(x, list) and len(x) == 2: return self(x[0])._bracket_(self(x[1])) - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup._element_constructor_(x) + return super()._element_constructor_(x) def _to_m(self, X): r""" @@ -766,9 +762,7 @@ def from_vector(self, v, order=None, coerce=False): """ if len(v) == self.ambient().dimension(): return self.retract(self.ambient().from_vector(v)) - - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.from_vector(v) + return super().from_vector(v) def basis_matrix(self): r""" @@ -854,9 +848,7 @@ def is_ideal(self, A): """ if A == self.ambient() and self._is_ideal: return True - - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.is_ideal(A) + return super().is_ideal(A) def reduce(self, X): r""" diff --git a/src/sage/coding/abstract_code.py b/src/sage/coding/abstract_code.py index 525bb6e63ec..ba2ec68a038 100644 --- a/src/sage/coding/abstract_code.py +++ b/src/sage/coding/abstract_code.py @@ -154,7 +154,7 @@ class AbstractCode(Parent): - inherit from AbstractCode - call AbstractCode ``__init__`` method in the subclass constructor. - Example: ``super(SubclassName, self).__init__(length, "EncoderName", + Example: ``super().__init__(length, "EncoderName", "DecoderName", "metric")``. "EncoderName" and "DecoderName" are set to ``None`` by default, a generic code class such as AbstractCode does not necessarily have to have general encoders/decoders. However, if you @@ -232,7 +232,7 @@ def __init__(self, length, default_encoder_name=None, sage: from sage.coding.abstract_code import AbstractCode sage: class MyCodeFamily(AbstractCode): ....: def __init__(self, length): - ....: super(MyCodeFamily, self).__init__(length) + ....: super().__init__(length) ....: def __iter__(self): ....: for i in range(self.length() + 1): ....: yield vector([1 for j in range(i)] + [0 for k in range(i, self.length())]) @@ -314,7 +314,7 @@ def __getstate__(self): sage: '_registered_encoders' in C.__getstate__() True """ - d = super(AbstractCode, self).__getstate__() + d = super().__getstate__() d['_registered_encoders'] = self._registered_encoders d['_registered_decoders'] = self._registered_decoders return d @@ -334,7 +334,7 @@ def __iter__(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self): - ....: super(MyCode, self).__init__(10) + ....: super().__init__(10) We check we get a sensible error message while asking for an iterator over the elements of our new class: @@ -362,7 +362,7 @@ def __contains__(self, c): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self, length): - ....: super(MyCode, self).__init__(length) + ....: super().__init__(length) We check we get a sensible error message while asking if an element is in our new class: @@ -386,7 +386,7 @@ def ambient_space(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self, length): - ....: super(MyCode, self).__init__(length) + ....: super().__init__(length) sage: C = MyCode(3) sage: C.ambient_space() Traceback (most recent call last): @@ -458,7 +458,7 @@ def _repr_(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self): - ....: super(MyCode, self).__init__(10) + ....: super().__init__(10) We check we get a sensible error message while asking for a string representation of an instance of our new class: @@ -486,7 +486,7 @@ def _latex_(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self): - ....: super(MyCode, self).__init__(10) + ....: super().__init__(10) We check we get a sensible error message while asking for a string representation of an instance of our new class: @@ -561,7 +561,7 @@ def add_decoder(self, name, decoder): sage: class MyDecoder(sage.coding.decoder.Decoder): ....: def __init__(self, code): - ....: super(MyDecoder, self).__init__(code) + ....: super().__init__(code) ....: def _repr_(self): ....: return "MyDecoder decoder with associated code %s" % self.code() @@ -623,7 +623,7 @@ def add_encoder(self, name, encoder): sage: class MyEncoder(sage.coding.encoder.Encoder): ....: def __init__(self, code): - ....: super(MyEncoder, self).__init__(code) + ....: super().__init__(code) ....: def _repr_(self): ....: return "MyEncoder encoder with associated code %s" % self.code() diff --git a/src/sage/coding/grs_code.py b/src/sage/coding/grs_code.py index 1bdbc70727f..840152f75f9 100644 --- a/src/sage/coding/grs_code.py +++ b/src/sage/coding/grs_code.py @@ -234,7 +234,7 @@ def __init__(self, evaluation_points, dimension, column_multipliers=None): if not F.is_finite() or not F.is_field(): raise ValueError("Evaluation points must be in a finite field (and %s is not one)" % F) - super(GeneralizedReedSolomonCode, self).__init__(F, + super().__init__(F, len(self._evaluation_points), "EvaluationVector", "Gao") if dimension not in ZZ or dimension > self._length or dimension < 1: @@ -703,7 +703,7 @@ def __init__(self, code): sage: E Evaluation vector-style encoder for [40, 12, 29] Reed-Solomon Code over GF(59) """ - super(GRSEvaluationVectorEncoder, self).__init__(code) + super().__init__(code) def __eq__(self, other): r""" @@ -874,7 +874,7 @@ def __init__(self, code, polynomial_ring=None): """ from sage.rings.polynomial.polynomial_ring import PolynomialRing_commutative - super(GRSEvaluationPolynomialEncoder, self).__init__(code) + super().__init__(code) if polynomial_ring is None: self._polynomial_ring = code.base_field()['x'] else: @@ -1129,8 +1129,8 @@ def __init__(self, code): """ if not isinstance(code, GeneralizedReedSolomonCode): raise ValueError("code has to be a generalized Reed-Solomon code") - super(GRSBerlekampWelchDecoder, self).__init__(code, code.ambient_space(), - "EvaluationPolynomial") + super().__init__(code, code.ambient_space(), + "EvaluationPolynomial") def __eq__(self, other): r""" @@ -1434,8 +1434,8 @@ def __init__(self, code): """ if not isinstance(code, GeneralizedReedSolomonCode): raise ValueError("code has to be a generalized Reed-Solomon code") - super(GRSGaoDecoder, self).__init__(code, code.ambient_space(), - "EvaluationPolynomial") + super().__init__(code, code.ambient_space(), + "EvaluationPolynomial") def __eq__(self, other): r""" @@ -1833,7 +1833,7 @@ def __init__(self, code): raise ValueError("code has to be a generalized Reed-Solomon code") input_space = cartesian_product([code.ambient_space(), VectorSpace(GF(2), code.ambient_space().dimension())]) - super(GRSErrorErasureDecoder, self).__init__(code, input_space, "EvaluationVector") + super().__init__(code, input_space, "EvaluationVector") def __eq__(self, other): r""" @@ -2074,8 +2074,8 @@ def __init__(self, code): raise ValueError("code has to be a generalized Reed-Solomon code") if code.base_field().zero() in code.evaluation_points(): raise ValueError("Impossible to use this decoder over a GRS code which contains 0 amongst its evaluation points") - super(GRSKeyEquationSyndromeDecoder, self).__init__(code, code.ambient_space(), - "EvaluationVector") + super().__init__(code, code.ambient_space(), + "EvaluationVector") def __eq__(self, other): r""" @@ -2354,7 +2354,7 @@ def decode_to_message(self, r): C = self.code() if C.length() == C.dimension(): return self.connected_encoder().unencode_nocheck(r) - return super(GRSKeyEquationSyndromeDecoder, self).decode_to_message(r) + return super().decode_to_message(r) def decoding_radius(self): r""" diff --git a/src/sage/geometry/toric_lattice.py b/src/sage/geometry/toric_lattice.py index de6880174aa..203f7f63223 100644 --- a/src/sage/geometry/toric_lattice.py +++ b/src/sage/geometry/toric_lattice.py @@ -431,7 +431,7 @@ def __call__(self, *args, **kwds): sage: N2( Q.an_element() ) N2(1, 0) """ - supercall = super(ToricLattice_generic, self).__call__ + supercall = super().__call__ if args == (0, ): # Special treatment for N(0) to return (0,...,0) return supercall(*args, **kwds) @@ -474,7 +474,7 @@ def _coerce_map_from_(self, other): if (is_ToricLattice(other) and other.ambient_module() is not self.ambient_module()): return None - return super(ToricLattice_generic, self)._convert_map_from_(other) + return super()._convert_map_from_(other) def __contains__(self, point): r""" @@ -578,7 +578,7 @@ def direct_sum(self, other): [0 0 0 0 1] """ if not isinstance(other, ToricLattice_generic): - return super(ToricLattice_generic, self).direct_sum(other) + return super().direct_sum(other) def make_name(N1, N2, use_latex=False): if use_latex: @@ -630,7 +630,7 @@ def intersection(self, other): raise ValueError("%s and %s have different ambient lattices!" % (self, other)) # Construct a generic intersection, but make sure to return a lattice. - I = super(ToricLattice_generic, self).intersection(other) + I = super().intersection(other) if not is_ToricLattice(I): I = self.ambient_module().submodule(I.basis()) return I @@ -755,7 +755,7 @@ def saturation(self): sage: Ns_sat is Ns_sat.saturation() True """ - S = super(ToricLattice_generic, self).saturation() + S = super().saturation() return S if is_ToricLattice(S) else self.ambient_module().submodule(S) def span(self, gens, base_ring=ZZ, *args, **kwds): @@ -803,8 +803,7 @@ def span(self, gens, base_ring=ZZ, *args, **kwds): if is_ToricLatticeElement(g) and g not in A: raise ValueError("%s cannot generate a sublattice of %s" % (g, A)) - return super(ToricLattice_generic, self).span(gens, base_ring, - *args, **kwds) + return super().span(gens, base_ring, *args, **kwds) def span_of_basis(self, basis, base_ring=ZZ, *args, **kwds): r""" @@ -858,8 +857,7 @@ def span_of_basis(self, basis, base_ring=ZZ, *args, **kwds): if is_ToricLatticeElement(g) and g not in A: raise ValueError("%s cannot generate a sublattice of %s" % (g, A)) - return super(ToricLattice_generic, self).span_of_basis( - basis, base_ring, *args, **kwds) + return super().span_of_basis(basis, base_ring, *args, **kwds) @richcmp_method @@ -895,7 +893,7 @@ def __init__(self, rank, name, dual_name, latex_name, latex_dual_name): sage: ToricLattice(3, "N", "M", "N", "M") 3-d lattice N """ - super(ToricLattice_ambient, self).__init__(ZZ, rank) + super().__init__(ZZ, rank) self._name = name self._dual_name = dual_name self._latex_name = latex_name @@ -1490,7 +1488,7 @@ def __init__(self, V, W, check=True, positive_point=None, positive_dual_point=No W = V.submodule(W) except (TypeError, ArithmeticError): raise ArithmeticError("W must be a sublattice of V") - super(ToricLattice_quotient, self).__init__(V, W, check, **kwds) + super().__init__(V, W, check, **kwds) if (positive_point, positive_dual_point) == (None, None): self._flip_sign_of_generator = False return @@ -1799,7 +1797,7 @@ def coordinate_vector(self, x, reduce=False): sage: Q.coordinate_vector(q) (1) """ - coordinates = super(ToricLattice_quotient, self).coordinate_vector(x,reduce) + coordinates = super().coordinate_vector(x, reduce) if self._flip_sign_of_generator: assert len(coordinates) == 1, "Sign flipped for a multi-dimensional quotient!" return -coordinates diff --git a/src/sage/groups/misc_gps/argument_groups.py b/src/sage/groups/misc_gps/argument_groups.py index 708d06c6998..c2e2de81e77 100644 --- a/src/sage/groups/misc_gps/argument_groups.py +++ b/src/sage/groups/misc_gps/argument_groups.py @@ -86,7 +86,7 @@ def __init__(self, parent, element, normalize=True): """ if parent is None: raise ValueError('parent must be provided') - super(AbstractArgument, self).__init__(parent=parent) + super().__init__(parent=parent) try: element = parent.base()(element) @@ -324,8 +324,7 @@ def __classcall__(cls, base, category=None): Category of commutative groups """ category = cls._determine_category_(category) - return super(AbstractArgumentGroup, cls).__classcall__( - cls, base, category) + return super().__classcall__(cls, base, category) @staticmethod def _determine_category_(category): @@ -364,8 +363,7 @@ def __init__(self, base, category): sage: UnitCircleGroup(RR).base() # indirect doctest Real Field with 53 bits of precision """ - super(AbstractArgumentGroup, self).__init__(category=category, - base=base) + super().__init__(category=category, base=base) def __hash__(self): r""" @@ -1024,7 +1022,7 @@ def __init__(self, category): Rational Field """ from sage.rings.rational_field import QQ - return super(RootsOfUnityGroup, self).__init__(base=QQ, + return super().__init__(base=QQ, category=category) def _repr_(self): r""" @@ -1075,7 +1073,7 @@ def __init__(self, parent, element, normalize=True): sage: C(1+2*I) # indirect doctest e^(I*arg(1.00000000000000 + 2.00000000000000*I)) """ - super(ArgumentByElement, self).__init__(parent, element, normalize=normalize) + super().__init__(parent, element, normalize=normalize) if self._element_ == 0: raise ValueError('{} is not allowed'.format(element)) @@ -1422,7 +1420,7 @@ def __init__(self, parent, element, normalize=True): sage: S.an_element() # indirect doctest -1 """ - super(Sign, self).__init__(parent, int(element), normalize=normalize) + super().__init__(parent, int(element), normalize=normalize) if self._element_ not in (-1, 1): raise ValueError('{} is not allowed ' '(only -1 or 1 is)'.format(element)) @@ -1643,8 +1641,7 @@ def __init__(self, category): sage: S.base() # indirect doctest """ - return super(SignGroup, self).__init__(base=int, - category=category) + return super().__init__(base=int, category=category) def _repr_(self): r""" diff --git a/src/sage/misc/converting_dict.py b/src/sage/misc/converting_dict.py index 48f3f5de3a5..7476555e210 100644 --- a/src/sage/misc/converting_dict.py +++ b/src/sage/misc/converting_dict.py @@ -93,7 +93,7 @@ def __init__(self, key_conversion_function, data=None): sage: list(KeyConvertingDict(int, [("9", 99)]).items()) [(9, 99)] """ - super(KeyConvertingDict, self).__init__() + super().__init__() self.key_conversion_function = key_conversion_function if data: self.update(data) @@ -115,7 +115,7 @@ def __getitem__(self, key): 42 """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__getitem__(key) + return super().__getitem__(key) def __setitem__(self, key, value): r""" @@ -135,7 +135,7 @@ def __setitem__(self, key, value): [(3, 42)] """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__setitem__(key, value) + return super().__setitem__(key, value) def __delitem__(self, key): r""" @@ -155,7 +155,7 @@ def __delitem__(self, key): 0 """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__delitem__(key) + return super().__delitem__(key) def __contains__(self, key): r""" @@ -176,7 +176,7 @@ def __contains__(self, key): False """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__contains__(key) + return super().__contains__(key) def pop(self, key, *args): r""" @@ -202,7 +202,7 @@ def pop(self, key, *args): KeyError: ... """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).pop(key, *args) + return super().pop(key, *args) def setdefault(self, key, default=None): r""" @@ -223,7 +223,7 @@ def setdefault(self, key, default=None): [(3, None)] """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).setdefault(key, default) + return super().setdefault(key, default) def update(self, *args, **kwds): r""" @@ -253,7 +253,7 @@ def update(self, *args, **kwds): {x: 42} """ f = self.key_conversion_function - u = super(KeyConvertingDict, self).update + u = super().update if args: if len(args) != 1: raise TypeError("update expected at most 1 argument") diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py index 56286232257..006578b8460 100644 --- a/src/sage/misc/sage_input.py +++ b/src/sage/misc/sage_input.py @@ -1774,7 +1774,7 @@ def __init__(self, sib, n): sage: sib(3)._sie_value '3' """ - super(SIE_literal_stringrep, self).__init__(sib) + super().__init__(sib) self._sie_value = str(n) self._sie_share = False @@ -1851,7 +1851,7 @@ def __init__(self, sib, func, args, kwargs): sage: sib = SageInputBuilder() sage: sie = sib('RealField')(53, rnd='RNDZ') """ - super(SIE_call, self).__init__(sib) + super().__init__(sib) self._sie_func = func self._sie_args = args self._sie_kwargs = kwargs @@ -1959,7 +1959,7 @@ def __init__(self, sib, coll, key): sage: sib.empty_subscript(sib.name('QQ')) {subscr: {atomic:QQ}[]} """ - super(SIE_subscript, self).__init__(sib) + super().__init__(sib) self._sie_coll = coll self._sie_key = key @@ -2058,7 +2058,7 @@ def __init__(self, sib, obj, attr): sage: sib.name('QQbar').zeta(5) {call: {getattr: {atomic:QQbar}.zeta}({atomic:5})} """ - super(SIE_getattr, self).__init__(sib) + super().__init__(sib) self._sie_obj = obj self._sie_attr = attr @@ -2153,7 +2153,7 @@ def __init__(self, sib, values, is_list): sage: sib(["Hello", "world"]) {list: ({atomic:'Hello'}, {atomic:'world'})} """ - super(SIE_tuple, self).__init__(sib) + super().__init__(sib) self._sie_values = values self._sie_is_list = is_list @@ -2259,7 +2259,7 @@ def __init__(self, sib, entries): sage: sib.dict([(10, 'PS2'), (12, 'PS2'), (13, 'PS3')]) {dict: {{atomic:10}:{atomic:'PS2'}, {atomic:12}:{atomic:'PS2'}, {atomic:13}:{atomic:'PS3'}}} """ - super(SIE_dict, self).__init__(sib) + super().__init__(sib) self._sie_entries = entries def __repr__(self): @@ -2349,9 +2349,8 @@ def __init__(self, sib, op, lhs, rhs): sage: sib = SageInputBuilder() sage: sib(3)*5 {binop:* {atomic:3} {atomic:5}} - """ - super(SIE_binary, self).__init__(sib) + super().__init__(sib) self._sie_op = op self._sie_operands = (lhs, rhs) @@ -2498,7 +2497,7 @@ def __init__(self, sib, op, operand): sage: -sib(3) {unop:- {atomic:3}} """ - super(SIE_unary, self).__init__(sib) + super().__init__(sib) self._sie_op = op self._sie_operand = operand @@ -2691,7 +2690,7 @@ def __init__(self, sib, constr, gen_names, gens_syntax=None): ....: gens_syntax=sib.empty_subscript(qq)) {constr_parent: {subscr: {atomic:QQ}[{atomic:'x'}]} with gens: ('x',)} """ - super(SIE_gens_constructor, self).__init__(sib) + super().__init__(sib) self._sie_constr = constr self._sie_gen_names = gen_names self._sie_gens = None # will be overwritten from .parent_with_gens() @@ -2909,7 +2908,7 @@ def __init__(self, sib, parent, name): sage: sib.gen(ZZ['x']) # indirect doctest {gen:x {constr_parent: {subscr: {atomic:ZZ}[{atomic:'x'}]} with gens: ('x',)}} """ - super(SIE_gen, self).__init__(sib) + super().__init__(sib) self._sie_parent = parent self._sie_preferred_varname = name @@ -2960,7 +2959,7 @@ def _sie_prepare(self, sif): sage: sie._sie_parent._sie_assign_gens True """ - super(SIE_gen, self)._sie_prepare(sif) + super()._sie_prepare(sif) self._sie_parent._sie_gens_referenced(sif) def _sie_format(self, sif): @@ -3065,7 +3064,7 @@ def __init__(self, sib, module, name, alt_name=None): sage: sib.import_name('sage.foo', 'happy', 'sad') {import:sage.foo/happy as sad} """ - super(SIE_import_name, self).__init__(sib) + super().__init__(sib) self._sie_formatted = False self._sie_module_name = module self._sie_object_name = name @@ -3123,7 +3122,7 @@ def _sie_prepare(self, sif): sage: sie._sie_requested_varname True """ - super(SIE_import_name, self)._sie_prepare(sif) + super()._sie_prepare(sif) self._sie_require_varname(sif) def _sie_format(self, sif): @@ -3193,7 +3192,7 @@ def __init__(self, sib, lhs, rhs): sage: sib.assign(sib.name('foo').x, sib.name('pi')) {assign: {getattr: {atomic:foo}.x} {atomic:pi}} """ - super(SIE_assign, self).__init__(sib) + super().__init__(sib) self._sie_lhs = lhs self._sie_rhs = rhs diff --git a/src/sage/modular/modform_hecketriangle/graded_ring.py b/src/sage/modular/modform_hecketriangle/graded_ring.py index 42325e3423e..13d00dbbef6 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring.py @@ -75,9 +75,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiMeromorphicModularFormsRing(4, ZZ, 1) == QuasiMeromorphicModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -138,9 +137,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiWeakModularFormsRing(5, CC, 0) == QuasiWeakModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -198,9 +196,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiModularFormsRing(6, ZZ, True) == QuasiModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -258,9 +255,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiCuspFormsRing(7, ZZ, 1) == QuasiCuspFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -318,9 +314,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: MeromorphicModularFormsRing(4, ZZ, 1) == MeromorphicModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -378,9 +373,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: WeakModularFormsRing(5, ZZ, 0) == WeakModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -437,9 +431,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: ModularFormsRing(3, ZZ, 0) == ModularFormsRing() True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -497,9 +490,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: CuspFormsRing(5, CC, True) == CuspFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" diff --git a/src/sage/modular/modform_hecketriangle/space.py b/src/sage/modular/modform_hecketriangle/space.py index 84323cf0ab9..beae939854d 100644 --- a/src/sage/modular/modform_hecketriangle/space.py +++ b/src/sage/modular/modform_hecketriangle/space.py @@ -96,9 +96,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e sage: QuasiMeromorphicModularForms(5, ZZ, 20/3, int(1)) == QuasiMeromorphicModularForms(group, base_ring, k, ep, n) True """ - (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -145,7 +144,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -192,7 +191,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -354,7 +353,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -526,7 +525,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -573,7 +572,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -618,7 +617,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -769,9 +768,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e sage: CuspForms(6, ZZ, 6, 1) == CuspForms(group, base_ring, k, ep, n) True """ - (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -922,9 +920,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e sage: ZeroForm(6, CC, 3, -1) == ZeroForm(group, base_ring, k, ep, n) True """ - (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py index a91ec314486..98f40457f07 100644 --- a/src/sage/rings/asymptotic/growth_group.py +++ b/src/sage/rings/asymptotic/growth_group.py @@ -665,7 +665,7 @@ def __init__(self, element, *args, **kwds): ... PartialConversionValueError: wrong value """ - super(PartialConversionValueError, self).__init__(*args, **kwds) + super().__init__(*args, **kwds) self.element = element @@ -1172,7 +1172,7 @@ def __init__(self, parent, raw_element): """ if parent is None: raise ValueError('The parent must be provided') - super(GenericGrowthElement, self).__init__(parent=parent) + super().__init__(parent=parent) try: self._raw_element_ = parent.base()(raw_element) @@ -1777,8 +1777,7 @@ def __classcall__(cls, base, var=None, category=None, ignore_variables=None): cls._determine_category_axiom_mapping_, initial_category=cls._initial_category_(base)) - return super(GenericGrowthGroup, cls).__classcall__( - cls, base, var, category) + return super().__classcall__(cls, base, var, category) @staticmethod def _initial_category_(base): @@ -1888,8 +1887,7 @@ def __init__(self, base, var, category): """ self._var_ = var - super(GenericGrowthGroup, self).__init__(category=category, - base=base) + super().__init__(category=category, base=base) def _repr_short_(self): r""" @@ -2714,8 +2712,7 @@ def __init__(self, var, domain): elif not isinstance(var, Variable): var = Variable(var) self.var = var - super(ConstructionFunctor, self).__init__( - domain, Monoids() & Posets()) + super().__init__(domain, Monoids() & Posets()) def _repr_(self): r""" @@ -3896,9 +3893,7 @@ def __init__(self, var): MonomialGrowthGroup[x] """ from sage.categories.commutative_additive_monoids import CommutativeAdditiveMonoids - - super(MonomialGrowthGroupFunctor, self).__init__(var, - CommutativeAdditiveMonoids()) + super().__init__(var, CommutativeAdditiveMonoids()) def _apply_functor(self, base): r""" @@ -4420,7 +4415,7 @@ def __init__(self, base, *args, **kwds): """ from warnings import warn - super(ExponentialGrowthGroup, self).__init__(base, *args, **kwds) + super().__init__(base, *args, **kwds) if isinstance(base, sage.rings.abc.SymbolicRing) and not self._an_element_base_() > 0: warn("When using the Exponential {}, make " "assumptions on the used symbolic elements.\n" @@ -4947,9 +4942,7 @@ def __init__(self, var): ExponentialGrowthGroup[x] """ from sage.categories.monoids import Monoids - - super(ExponentialGrowthGroupFunctor, self).__init__(var, - Monoids()) + super().__init__(var, Monoids()) def _apply_functor(self, base): r""" diff --git a/src/sage/rings/asymptotic/term_monoid.py b/src/sage/rings/asymptotic/term_monoid.py index 35064d10b18..53dfbc621a1 100644 --- a/src/sage/rings/asymptotic/term_monoid.py +++ b/src/sage/rings/asymptotic/term_monoid.py @@ -389,7 +389,7 @@ def __init__(self, parent, growth): raise ValueError('The parent must be provided') self.growth = parent.growth_group(growth) - super(GenericTerm, self).__init__(parent=parent) + super().__init__(parent=parent) def construction(self): r""" @@ -1469,7 +1469,7 @@ def __classcall__(cls, term_monoid_factory, from sage.categories.posets import Posets category = Monoids() & Posets() - return super(GenericTermMonoid, cls).__classcall__( + return super().__classcall__( cls, term_monoid_factory, growth_group, coefficient_ring, category) def __init__(self, term_monoid_factory, growth_group, coefficient_ring, category): @@ -1513,7 +1513,7 @@ def __init__(self, term_monoid_factory, growth_group, coefficient_ring, category self._term_monoid_factory_ = term_monoid_factory self._growth_group_ = growth_group self._coefficient_ring_ = coefficient_ring - super(GenericTermMonoid, self).__init__(category=category) + super().__init__(category=category) @property def term_monoid_factory(self): @@ -3092,7 +3092,7 @@ def _coerce_map_from_(self, S): self.coefficient_ring.has_coerce_map_from(S.coefficient_ring): return True else: - return super(OTermMonoid, self)._coerce_map_from_(S) + return super()._coerce_map_from_(S) def _repr_(self): r""" @@ -3191,7 +3191,7 @@ def __init__(self, parent, growth, coefficient): sage: CT_ZZ(x^42, coefficient=42) Term with coefficient 42 and growth x^42 """ - super(TermWithCoefficient, self).__init__(parent=parent, growth=growth) + super().__init__(parent=parent, growth=growth) try: coefficient = parent.coefficient_ring(coefficient) except (ValueError, TypeError): @@ -3416,7 +3416,7 @@ def _calculate_pow_(self, exponent): ArithmeticError('Cannot take %s to the exponent %s in %s since its ' 'coefficient %s cannot be taken to this exponent.' % (self, exponent, self.parent(), self.coefficient)), e) - return super(TermWithCoefficient, self)._calculate_pow_(exponent, new_coefficient=c) + return super()._calculate_pow_(exponent, new_coefficient=c) def _log_coefficient_(self, base=None, locals=None): r""" @@ -3507,8 +3507,7 @@ def _eq_(self, other): sage: t == T(x^2, coefficient=1) False """ - return super(TermWithCoefficient, self)._eq_(other) and \ - self.coefficient == other.coefficient + return super()._eq_(other) and self.coefficient == other.coefficient class TermWithCoefficientMonoid(GenericTermMonoid): diff --git a/src/sage/rings/function_field/function_field_valuation.py b/src/sage/rings/function_field/function_field_valuation.py index 3747cdb6668..2573df22267 100644 --- a/src/sage/rings/function_field/function_field_valuation.py +++ b/src/sage/rings/function_field/function_field_valuation.py @@ -615,7 +615,7 @@ def element_with_valuation(self, s): """ constant_valuation = self.restriction(self.domain().constant_base_field()) if constant_valuation.is_trivial(): - return super(RationalFunctionFieldValuation_base, self).element_with_valuation(s) + return super().element_with_valuation(s) a, b = self.value_group()._element_with_valuation(constant_valuation.value_group(), s) ret = self.uniformizer()**a * constant_valuation.element_with_valuation(constant_valuation.value_group().gen()*b) @@ -672,7 +672,7 @@ def _ge_(self, other): return other.is_discrete_valuation() if isinstance(other, ClassicalFunctionFieldValuation_base): return self == other - super(ClassicalFunctionFieldValuation_base, self)._ge_(other) + super()._ge_(other) class InducedRationalFunctionFieldValuation_base(FunctionFieldValuation_base): @@ -845,7 +845,7 @@ def extensions(self, L): W = self._base_valuation.extensions(L._ring) return [L.valuation(w) for w in W] - return super(InducedRationalFunctionFieldValuation_base, self).extensions(L) + return super().extensions(L) def _call_(self, f): r""" @@ -887,7 +887,7 @@ def restriction(self, ring): """ if ring.is_subring(self._base_valuation.domain()): return self._base_valuation.restriction(ring) - return super(InducedRationalFunctionFieldValuation_base, self).restriction(ring) + return super().restriction(ring) def simplify(self, f, error=None, force=False): r""" @@ -1096,7 +1096,7 @@ def residue_ring(self): """ if not self.is_discrete_valuation(): # A pseudo valuation attaining negative infinity does typically not have a function field as its residue ring - return super(NonClassicalRationalFunctionFieldValuation, self).residue_ring() + return super().residue_ring() return self._base_valuation.residue_ring().fraction_field().function_field() @@ -1166,7 +1166,7 @@ def scale(self, scalar): """ if scalar in QQ and scalar > 0 and scalar != 1: return self.domain().valuation(self._base_valuation._initial_approximation.scale(scalar)) - return super(FunctionFieldFromLimitValuation, self).scale(scalar) + return super().scale(scalar) class FunctionFieldMappedValuation_base(FunctionFieldValuation_base, MappedValuation_base): @@ -1250,7 +1250,7 @@ def scale(self, scalar): from sage.rings.rational_field import QQ if scalar in QQ and scalar > 0 and scalar != 1: return self.domain().valuation((self._base_valuation.scale(scalar), self._to_base, self._from_base)) - return super(FunctionFieldMappedValuation_base, self).scale(scalar) + return super().scale(scalar) def _repr_(self): r""" @@ -1330,7 +1330,7 @@ def restriction(self, ring): """ if ring.is_subring(self.domain().constant_base_field()): return self._base_valuation.restriction(ring) - return super(FunctionFieldMappedValuation_base, self).restriction(ring) + return super().restriction(ring) class RationalFunctionFieldMappedValuation(FunctionFieldMappedValuationRelative_base, RationalFunctionFieldValuation_base): @@ -1461,7 +1461,7 @@ def _repr_(self): assert(self.domain().base() is not self.domain()) if repr(self._base_valuation) == repr(self.restriction(self.domain().base())): return repr(self._base_valuation) - return super(FunctionFieldExtensionMappedValuation, self)._repr_() + return super()._repr_() def restriction(self, ring): r""" @@ -1476,8 +1476,7 @@ def restriction(self, ring): sage: w = v.extension(L) sage: w.restriction(K) is v True - """ if ring.is_subring(self.domain().base()): return self._base_valuation.restriction(ring) - return super(FunctionFieldExtensionMappedValuation, self).restriction(ring) + return super().restriction(ring) diff --git a/src/sage/structure/unique_representation.py b/src/sage/structure/unique_representation.py index 5d8d4ad758b..c641550abe2 100644 --- a/src/sage/structure/unique_representation.py +++ b/src/sage/structure/unique_representation.py @@ -179,7 +179,7 @@ class will by default also be used as keys for the cache:: sage: class WrongUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(WrongUsage,cls).__classcall__(cls, n^2) + ....: return super().__classcall__(cls, n^2) ....: def __init__(self, n): ....: self.n = n ....: def __repr__(self): @@ -205,7 +205,7 @@ class will by default also be used as keys for the cache:: sage: class BetterUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(BetterUsage, cls).__classcall__(cls, abs(n)) + ....: return super().__classcall__(cls, abs(n)) ....: def __init__(self, n): ....: self.n = n^2 ....: def __repr__(self): @@ -249,8 +249,8 @@ class will by default also be used as keys for the cache:: ....: @staticmethod ....: def __classcall__(cls, n, implementation=0): ....: if implementation: - ....: return super(C2, cls).__classcall__(cls, (n,)*implementation) - ....: return super(C2, cls).__classcall__(cls, n) + ....: return super().__classcall__(cls, (n,)*implementation) + ....: return super().__classcall__(cls, n) ....: def __init__(self, t): ....: self.t = t ....: def __repr__(self): @@ -640,7 +640,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): ....: @staticmethod ....: def __classcall__(cls, iterable): ....: t = tuple(iterable) - ....: return super(MyClass2, cls).__classcall__(cls, t) + ....: return super().__classcall__(cls, t) ....: ....: def __init__(self, value): ....: self.value = value @@ -667,7 +667,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): sage: class MyClass3(UniqueRepresentation): ....: @staticmethod ....: def __classcall__(cls, value = 3): - ....: return super(MyClass3, cls).__classcall__(cls, value) + ....: return super().__classcall__(cls, value) ....: ....: def __init__(self, value): ....: self.value = value @@ -716,7 +716,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): sage: class WrongUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(WrongUsage,cls).__classcall__(cls, n^2) + ....: return super().__classcall__(cls, n^2) ....: def __init__(self, n): ....: self.n = n ....: def __repr__(self): @@ -742,7 +742,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): sage: class BetterUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(BetterUsage, cls).__classcall__(cls, abs(n)) + ....: return super().__classcall__(cls, abs(n)) ....: def __init__(self, n): ....: self.n = n^2 ....: def __repr__(self): @@ -1028,7 +1028,7 @@ def _clear_cache_(cls): sage: class B(A): ....: @staticmethod ....: def __classcall__(cls, *args, **kwds): - ....: return super(B,cls).__classcall__(cls,*args,**kwds) + ....: return super().__classcall__(cls,*args,**kwds) sage: class C(B): pass sage: a = A(1) sage: b = B(2) @@ -1061,7 +1061,7 @@ def _clear_cache_(cls): ....: @staticmethod ....: def __classcall_private__(cls, *args, **kwds): ....: print("Private B") - ....: return super(B,cls).__classcall__(cls,*args,**kwds) + ....: return super().__classcall__(cls,*args,**kwds) sage: class C(B): pass sage: a = A(1) sage: b = B(2) diff --git a/src/sage/topology/simplicial_set_constructions.py b/src/sage/topology/simplicial_set_constructions.py index 5b192d019bc..5a737558c9c 100644 --- a/src/sage/topology/simplicial_set_constructions.py +++ b/src/sage/topology/simplicial_set_constructions.py @@ -120,7 +120,7 @@ def __classcall__(self, data, ambient=None): L.append((x, None)) else: L.append((x, tuple(data[x]))) - return super(SubSimplicialSet, self).__classcall__(self, tuple(L), ambient) + return super().__classcall__(self, tuple(L), ambient) def __init__(self, data, ambient=None): r""" @@ -239,8 +239,8 @@ def __classcall_private__(self, maps=None): True """ if maps: - return super(PullbackOfSimplicialSets, self).__classcall__(self, tuple(maps)) - return super(PullbackOfSimplicialSets, self).__classcall__(self) + return super().__classcall__(self, tuple(maps)) + return super().__classcall__(self) def __init__(self, maps=None): r""" @@ -423,8 +423,8 @@ def __classcall_private__(self, maps=None): True """ if maps: - return super(PullbackOfSimplicialSets_finite, self).__classcall__(self, tuple(maps)) - return super(PullbackOfSimplicialSets_finite, self).__classcall__(self) + return super().__classcall__(self, tuple(maps)) + return super().__classcall__(self) def __init__(self, maps=None): r""" @@ -763,8 +763,8 @@ def __classcall__(cls, factors=None): True """ if factors: - return super(ProductOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) - return super(ProductOfSimplicialSets, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" @@ -1129,9 +1129,9 @@ def __classcall_private__(cls, maps=None, vertex_name=None): True """ if maps: - return super(PushoutOfSimplicialSets, cls).__classcall__(cls, maps=tuple(maps), - vertex_name=vertex_name) - return super(PushoutOfSimplicialSets, cls).__classcall__(cls, vertex_name=vertex_name) + return super().__classcall__(cls, maps=tuple(maps), + vertex_name=vertex_name) + return super().__classcall__(cls, vertex_name=vertex_name) def __init__(self, maps=None, vertex_name=None): r""" @@ -1392,9 +1392,9 @@ def __classcall_private__(cls, maps=None, vertex_name=None): True """ if maps: - return super(PushoutOfSimplicialSets_finite, cls).__classcall__(cls, maps=tuple(maps), - vertex_name=vertex_name) - return super(PushoutOfSimplicialSets_finite, cls).__classcall__(cls, vertex_name=vertex_name) + return super().__classcall__(cls, maps=tuple(maps), + vertex_name=vertex_name) + return super().__classcall__(cls, vertex_name=vertex_name) def __init__(self, maps=None, vertex_name=None): r""" @@ -1888,8 +1888,8 @@ def __classcall__(cls, factors=None): True """ if factors: - return super(SmashProductOfSimplicialSets_finite, cls).__classcall__(cls, factors=tuple(factors)) - return super(SmashProductOfSimplicialSets_finite, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" @@ -1964,8 +1964,8 @@ def __classcall__(cls, factors=None): True """ if factors: - return super(WedgeOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) - return super(WedgeOfSimplicialSets, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" @@ -2159,8 +2159,8 @@ def __classcall__(cls, factors=None): # Discard any empty factors. factors = [F for F in factors if F != Empty()] if factors: - return super(DisjointUnionOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) - return super(DisjointUnionOfSimplicialSets, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" From 380bdf63777f882eb5c6dd037e5caf6021051fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 29 May 2022 17:06:00 +0200 Subject: [PATCH 225/338] fix doctests --- src/sage/combinat/crystals/littelmann_path.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/crystals/littelmann_path.py b/src/sage/combinat/crystals/littelmann_path.py index fd32c317943..47a421c2b54 100644 --- a/src/sage/combinat/crystals/littelmann_path.py +++ b/src/sage/combinat/crystals/littelmann_path.py @@ -702,7 +702,7 @@ def __classcall_private__(cls, weight): raise ValueError("The weight should be in the non-extended weight lattice!") La = weight.parent().basis() weight = weight - weight.level() * La[0] / La[0].level() - return super().__classcall__(cls, weight, starting_weight_parent = weight.parent()) + return super(CrystalOfLSPaths, cls).__classcall__(cls, weight, starting_weight_parent = weight.parent()) @cached_method def maximal_vector(self): @@ -1206,7 +1206,7 @@ def __classcall_private__(cls, cartan_type): True """ cartan_type = CartanType(cartan_type) - return super().__classcall__(cls, cartan_type) + return super(InfinityCrystalOfLSPaths, cls).__classcall__(cls, cartan_type) def __init__(self, cartan_type): """ @@ -1320,7 +1320,8 @@ def e(self, i, power=1, length_only=False): sage: len(B.subcrystal(max_depth=7)) 116 """ - ret = super().e(i, power=power, length_only=length_only) + ret = super().e(i, power=power, + length_only=length_only) if ret is None: return None if length_only: @@ -1374,7 +1375,7 @@ def f(self, i, power=1, length_only=False): 2*Lambda[0] + 2*Lambda[1] + 2*Lambda[2]) """ dual_path = self.dualize() - dual_path = super().e(i, power, length_only=length_only) + dual_path = super(InfinityCrystalOfLSPaths.Element, dual_path).e(i, power, length_only=length_only) if length_only: return dual_path if dual_path is None: From bcd1e5b1246425eeceff40259d00b3a74b9e7ad9 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 29 May 2022 19:05:43 +0000 Subject: [PATCH 226/338] Improve display of short summary --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e4ace07d46..837e40d4fb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,9 @@ jobs: ../sage -python -m pip install coverage pytest-xdist ../sage -python -m coverage run -m pytest -c tox.ini --doctest-modules || true working-directory: ./src + env: + # Increase the length of the lines in the "short summary" + COLUMNS: 120 - name: Test run: | From 9a050a3e85bdd1e3eca7fcaba3e77139381ae0db Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sun, 29 May 2022 16:07:44 -0700 Subject: [PATCH 227/338] Assume singular installation works when cross compiling --- build/pkgs/singular/spkg-configure.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4 index 7cf26728368..af2eb854143 100644 --- a/build/pkgs/singular/spkg-configure.m4 +++ b/build/pkgs/singular/spkg-configure.m4 @@ -48,8 +48,8 @@ SAGE_SPKG_CONFIGURE([singular], [ ], [ AC_MSG_RESULT(no) sage_spkg_install_singular=yes - ]) - ]) + ], [AC_MSG_RESULT(yes)]) + ], [AC_MSG_RESULT(yes)]) AC_LANG_POP() LIBS="${ORIG_LIBS}" From 609a56c9258e1e80d0b790496432ceb62c5e9131 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Mon, 30 May 2022 09:29:16 +0900 Subject: [PATCH 228/338] Replace sage.combinat with sage.combinat.all --- src/doc/en/reference/combinat/index.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doc/en/reference/combinat/index.rst b/src/doc/en/reference/combinat/index.rst index 4470e97836d..1e2a6da8665 100644 --- a/src/doc/en/reference/combinat/index.rst +++ b/src/doc/en/reference/combinat/index.rst @@ -1,7 +1,10 @@ +.. _sage.combinat: + Combinatorics ============= -.. automodule:: sage.combinat +.. automodule:: sage.combinat.all + :noindex: Comprehensive Module List ------------------------- From 1b039276b5b3c0783d6035d9f90c264d13dfb398 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 30 May 2022 15:39:26 -0700 Subject: [PATCH 229/338] build/pkgs/ncurses: Update to 6.3 --- build/pkgs/ncurses/checksums.ini | 7 ++++--- build/pkgs/ncurses/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/pkgs/ncurses/checksums.ini b/build/pkgs/ncurses/checksums.ini index 27620e7d25a..f67d0e23402 100644 --- a/build/pkgs/ncurses/checksums.ini +++ b/build/pkgs/ncurses/checksums.ini @@ -1,4 +1,5 @@ tarball=ncurses-VERSION.tar.gz -sha1=acd606135a5124905da770803c05f1f20dd3b21c -md5=ee13d052e1ead260d7c28071f46eefb1 -cksum=1470804880 +sha1=38fb1462d13b04bb900adf07918725c4b7ed0682 +md5=a2736befde5fee7d2b7eb45eb281cdbe +cksum=981463359 +upstream_url=https://ftp.gnu.org/pub/gnu/ncurses/ncurses-VERSION.tar.gz diff --git a/build/pkgs/ncurses/package-version.txt b/build/pkgs/ncurses/package-version.txt index d5bfaf7a67f..0faee7d968e 100644 --- a/build/pkgs/ncurses/package-version.txt +++ b/build/pkgs/ncurses/package-version.txt @@ -1 +1 @@ -6.0.p0 +6.3 From 38f188aaa5b91ea6b117c14a1490b3ca02ef1480 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 30 May 2022 15:42:56 -0700 Subject: [PATCH 230/338] build/pkgs/readline: Update to 8.1.2 --- build/pkgs/readline/checksums.ini | 6 +++--- build/pkgs/readline/package-version.txt | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build/pkgs/readline/checksums.ini b/build/pkgs/readline/checksums.ini index 5e4e180686f..05d4f89539f 100644 --- a/build/pkgs/readline/checksums.ini +++ b/build/pkgs/readline/checksums.ini @@ -1,5 +1,5 @@ tarball=readline-VERSION.tar.gz -sha1=d58041c2143595dc001d2777ae9a200be30198b0 -md5=7e6c1f16aee3244a69aba6e438295ca3 -cksum=3826776229 +sha1=8a05ad0d0ad67e18c383f1b2cf6a23bcbd46f87a +md5=12819fa739a78a6172400f399ab34f81 +cksum=829245750 upstream_url=https://ftp.gnu.org/gnu/readline/readline-VERSION.tar.gz diff --git a/build/pkgs/readline/package-version.txt b/build/pkgs/readline/package-version.txt index 657c5dea53b..6b409d977b8 100644 --- a/build/pkgs/readline/package-version.txt +++ b/build/pkgs/readline/package-version.txt @@ -1,2 +1 @@ -8.0 - +8.1.2 From 2ca97e9233210fe8945a07a24307ce672fcaf60d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 30 May 2022 15:43:45 -0700 Subject: [PATCH 231/338] build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch: Remove --- ...around_changed_output_of_GNU_cpp_5.x.patch | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch diff --git a/build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch b/build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch deleted file mode 100644 index 751ff5c3290..00000000000 --- a/build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch +++ /dev/null @@ -1,24 +0,0 @@ -Building ncurses with GCC 5 (or more precisely, with its 'cpp') fails with a -syntax error, caused by earlier preprocessing. - -(I'm not entirely sure whether it's a GCC bug or rather caused by a new -feature which breaks further processing with 'awk' and 'sed'; I *think* -at least the 'awk' inline script "AW2" simply isn't prepared for the changed -output of 'cpp' w.r.t. line directives [1]. Anyway, the patch fixes the issue.) - -[1] https://gcc.gnu.org/gcc-5/porting_to.html - - ---- ncurses-5.9.20131221/ncurses/base/MKlib_gen.sh 2011-06-04 21:14:08.000000000 +0200 -+++ ncurses-5.9.20131221/ncurses/base/MKlib_gen.sh 2015-04-26 00:47:06.911680782 +0200 -@@ -62,7 +62,9 @@ - if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - if test "${LC_COLLATE+set}" = set; then LC_COLLATE=C; export LC_COLLATE; fi - --preprocessor="$1 -DNCURSES_INTERNALS -I../include" -+# Work around "unexpected" output of GCC 5.x's cpp w.r.t. #line directives -+# by simply suppressing them: -+preprocessor="$1 -P -DNCURSES_INTERNALS -I../include" - AWK="$2" - USE="$3" - From 7cf3cf3d93cee3ae4df3b09ad0fcd051f9b3d06c Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Tue, 31 May 2022 13:26:56 +0800 Subject: [PATCH 232/338] fix computation of finite-field coercion (Conway into non-Conway) --- src/sage/rings/finite_rings/finite_field_base.pyx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 582f59971f6..731bffa1e16 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1497,9 +1497,18 @@ cdef class FiniteField(Field): sage: F.extension(int(3), 'a') Finite Field in a of size 2^3 - sage: F = GF(2 ** 4, 'a') + sage: F = GF(2^4, 'a') sage: F.extension(int(3), 'aa') Finite Field in aa of size 2^12 + + Randomized test for :trac:`33937`:: + + sage: p = random_prime(100) + sage: a,b = (randrange(1,10) for _ in 'ab') + sage: K. = GF(p^a) + sage: L. = K.extension(b) + sage: L(u).minpoly() == u.minpoly() + True """ from .finite_field_constructor import GF from sage.rings.polynomial.polynomial_element import is_Polynomial @@ -1525,7 +1534,7 @@ cdef class FiniteField(Field): elif hasattr(E, '_prefix') and hasattr(self, '_prefix'): pass # coercion map is automatically found else: - if self.is_conway(): # and E is Conway + if self.is_conway() and E.is_conway(): alpha = E.gen()**((E.order()-1)//(self.order()-1)) else: alpha = self.modulus().any_root(E) From 3b6be5f8156d79861f25081d3aca33ea88be21f2 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Tue, 31 May 2022 17:11:48 +0800 Subject: [PATCH 233/338] use tuple syntax for finite-field constructor --- src/sage/rings/finite_rings/finite_field_base.pyx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 731bffa1e16..1384ec51d4c 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1497,7 +1497,7 @@ cdef class FiniteField(Field): sage: F.extension(int(3), 'a') Finite Field in a of size 2^3 - sage: F = GF(2^4, 'a') + sage: F = GF((2,4), 'a') sage: F.extension(int(3), 'aa') Finite Field in aa of size 2^12 @@ -1505,7 +1505,7 @@ cdef class FiniteField(Field): sage: p = random_prime(100) sage: a,b = (randrange(1,10) for _ in 'ab') - sage: K. = GF(p^a) + sage: K. = GF((p,a)) sage: L. = K.extension(b) sage: L(u).minpoly() == u.minpoly() True @@ -1519,16 +1519,16 @@ cdef class FiniteField(Field): latex_name = latex_names if self.degree() == 1: if isinstance(modulus, (int, Integer)): - E = GF(self.characteristic()**modulus, name=name, **kwds) + E = GF((self.characteristic(), modulus), name=name, **kwds) elif isinstance(modulus, (list, tuple)): - E = GF(self.characteristic()**(len(modulus) - 1), name=name, modulus=modulus, **kwds) + E = GF((self.characteristic(), len(modulus) - 1), name=name, modulus=modulus, **kwds) elif is_Polynomial(modulus): if modulus.change_ring(self).is_irreducible(): - E = GF(self.characteristic()**(modulus.degree()), name=name, modulus=modulus, **kwds) + E = GF((self.characteristic(), modulus.degree()), name=name, modulus=modulus, **kwds) else: E = Field.extension(self, modulus, name=name, embedding=embedding, **kwds) elif isinstance(modulus, (int, Integer)): - E = GF(self.order()**modulus, name=name, **kwds) + E = GF((self.characteristic(), self.degree() * modulus), name=name, **kwds) if E is self: pass # coercion map (identity map) is automatically found elif hasattr(E, '_prefix') and hasattr(self, '_prefix'): From 4789d590b621bb641be24edcd7118d6d3f37475b Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Mon, 30 May 2022 12:39:57 +0800 Subject: [PATCH 234/338] move .division_field() up to EllipticCurve_field --- src/sage/schemes/elliptic_curves/ell_field.py | 191 ++++++++++++++++++ .../elliptic_curves/ell_number_field.py | 191 ------------------ 2 files changed, 191 insertions(+), 191 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index c0f3ab5216a..25ddf2c81fd 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -764,6 +764,197 @@ def descend_to(self, K, f=None): Elist = [E.minimal_model() for E in Elist] return Elist + def division_field(self, p, names, map=False, **kwds): + r""" + Given an elliptic curve over a number field `F` and a prime number `p`, + construct the field `F(E[p])`. + + INPUT: + + - ``p`` -- a prime number (an element of `\ZZ`) + + - ``names`` -- a variable name for the number field + + - ``map`` -- (default: ``False``) also return an embedding of + the :meth:`base_field` into the resulting field. + + - ``kwds`` -- additional keywords passed to + :func:`sage.rings.number_field.splitting_field.splitting_field`. + + OUTPUT: + + If ``map`` is ``False``, the division field as an absolute number + field. If ``map`` is ``True``, a tuple ``(K, phi)`` where ``phi`` + is an embedding of the base field in the division field ``K``. + + .. WARNING:: + + This takes a very long time when the degree of the division + field is large (e.g. when `p` is large or when the Galois + representation is surjective). The ``simplify`` flag also + has a big influence on the running time: sometimes + ``simplify=False`` is faster, sometimes ``simplify=True`` + (the default) is faster. + + EXAMPLES: + + The 2-division field is the same as the splitting field of + the 2-division polynomial (therefore, it has degree 1, 2, 3 or 6):: + + sage: E = EllipticCurve('15a1') + sage: K. = E.division_field(2); K + Number Field in b with defining polynomial x + sage: E = EllipticCurve('14a1') + sage: K. = E.division_field(2); K + Number Field in b with defining polynomial x^2 + 5*x + 92 + sage: E = EllipticCurve('196b1') + sage: K. = E.division_field(2); K + Number Field in b with defining polynomial x^3 + x^2 - 114*x - 127 + sage: E = EllipticCurve('19a1') + sage: K. = E.division_field(2); K + Number Field in b with defining polynomial x^6 + 10*x^5 + 24*x^4 - 212*x^3 + 1364*x^2 + 24072*x + 104292 + + For odd primes `p`, the division field is either the splitting + field of the `p`-division polynomial, or a quadratic extension + of it. :: + + sage: E = EllipticCurve('50a1') + sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F + Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 + sage: K. = E.division_field(3, simplify_all=True); K + Number Field in b with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 + + If we take any quadratic twist, the splitting field of the + 3-division polynomial remains the same, but the 3-division field + becomes a quadratic extension:: + + sage: E = E.quadratic_twist(5) # 50b3 + sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F + Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 + sage: K. = E.division_field(3, simplify_all=True); K + Number Field in b with defining polynomial x^12 - 3*x^11 + 8*x^10 - 15*x^9 + 30*x^8 - 63*x^7 + 109*x^6 - 144*x^5 + 150*x^4 - 120*x^3 + 68*x^2 - 24*x + 4 + + Try another quadratic twist, this time over a subfield of `F`:: + + sage: G.,_,_ = F.subfields(3)[0] + sage: E = E.base_extend(G).quadratic_twist(c); E + Elliptic Curve defined by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000) over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9 + sage: K. = E.division_field(3, simplify_all=True); K + Number Field in b with defining polynomial x^12 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025 + + Some higher-degree examples:: + + sage: E = EllipticCurve('11a1') + sage: K. = E.division_field(2); K + Number Field in b with defining polynomial x^6 + 2*x^5 - 48*x^4 - 436*x^3 + 1668*x^2 + 28792*x + 73844 + sage: K. = E.division_field(3); K # long time (3s on sage.math, 2014) + Number Field in b with defining polynomial x^48 ... + sage: K. = E.division_field(5); K + Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 + sage: E.division_field(5, 'b', simplify=False) + Number Field in b with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 + sage: E.base_extend(K).torsion_subgroup() # long time (2s on sage.math, 2014) + Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 + + sage: E = EllipticCurve('27a1') + sage: K. = E.division_field(3); K + Number Field in b with defining polynomial x^2 + 3*x + 9 + sage: K. = E.division_field(2); K + Number Field in b with defining polynomial x^6 + 6*x^5 + 24*x^4 - 52*x^3 - 228*x^2 + 744*x + 3844 + sage: K. = E.division_field(2, simplify_all=True); K + Number Field in b with defining polynomial x^6 - 3*x^5 + 5*x^3 - 3*x + 1 + sage: K. = E.division_field(5); K # long time (4s on sage.math, 2014) + Number Field in b with defining polynomial x^48 ... + sage: K. = E.division_field(7); K # long time (8s on sage.math, 2014) + Number Field in b with defining polynomial x^72 ... + + Over a number field:: + + sage: R. = PolynomialRing(QQ) + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([0,0,0,0,i]) + sage: L. = E.division_field(2); L + Number Field in b with defining polynomial x^4 - x^2 + 1 + sage: L., phi = E.division_field(2, map=True); phi + Ring morphism: + From: Number Field in i with defining polynomial x^2 + 1 + To: Number Field in b with defining polynomial x^4 - x^2 + 1 + Defn: i |--> -b^3 + sage: L., phi = E.division_field(3, map=True) + sage: L + Number Field in b with defining polynomial x^24 - 6*x^22 - 12*x^21 - 21*x^20 + 216*x^19 + 48*x^18 + 804*x^17 + 1194*x^16 - 13488*x^15 + 21222*x^14 + 44196*x^13 - 47977*x^12 - 102888*x^11 + 173424*x^10 - 172308*x^9 + 302046*x^8 + 252864*x^7 - 931182*x^6 + 180300*x^5 + 879567*x^4 - 415896*x^3 + 1941012*x^2 + 650220*x + 443089 + sage: phi + Ring morphism: + From: Number Field in i with defining polynomial x^2 + 1 + To: Number Field in b with defining polynomial x^24 ... + Defn: i |--> -215621657062634529/183360797284413355040732*b^23 ... + + AUTHORS: + + - Jeroen Demeyer (2014-01-06): :trac:`11905`, use + ``splitting_field`` method, moved from ``gal_reps.py``, make + it work over number fields. + """ + from sage.misc.verbose import verbose + p = rings.Integer(p) + if not p.is_prime(): + raise ValueError("p must be a prime number") + + verbose("Adjoining X-coordinates of %s-torsion points" % p) + F = self.base_ring() + f = self.division_polynomial(p) + if p == 2: + # For p = 2, the division field is the splitting field of + # the division polynomial. + return f.splitting_field(names, map=map, **kwds) + + # Compute splitting field of X-coordinates. + # The Galois group of the division field is a subgroup of GL(2,p). + # The Galois group of the X-coordinates is a subgroup of GL(2,p)/{-1,+1}. + # We need the map to change the elliptic curve invariants to K. + deg_mult = F.degree() * p * (p+1) * (p-1) * (p-1) // 2 + K, F_to_K = f.splitting_field(names, degree_multiple=deg_mult, map=True, **kwds) + + verbose("Adjoining Y-coordinates of %s-torsion points" % p) + + # THEOREM (Cremona, http://trac.sagemath.org/ticket/11905#comment:21). + # Let K be a field, E an elliptic curve over K and p an odd + # prime number. Assume that K contains all roots of the + # p-division polynomial of E. Then either K contains all + # p-torsion points on E, or it does not contain any p-torsion + # point. + # + # PROOF. Let G be the absolute Galois group of K (every element + # in it fixes all elements of K). For any p-torsion point P + # over the algebraic closure and any sigma in G, we must have + # either sigma(P) = P or sigma(P) = -P (since K contains the + # X-coordinate of P). Now assume that K does not contain all + # p-torsion points. Then there exists a point P1 and a sigma in + # G such that sigma(P1) = -P1. Now take a different p-torsion + # point P2. Since sigma(P2) must be P2 or -P2 and + # sigma(P1+P2) = sigma(P1)+sigma(P2) = sigma(P1)-P2 must + # be P1+P2 or -(P1+P2), it follows that sigma(P2) = -sigma(P2). + # Therefore, K cannot contain any p-torsion point. + # + # This implies that it suffices to adjoin the Y-coordinate + # of just one point. + + # First factor f over F and then compute a root X of f over K. + g = f.factor()[0][0] + X = g.map_coefficients(F_to_K).roots(multiplicities=False)[0] + + # Polynomial defining the corresponding Y-coordinate + a1,a2,a3,a4,a6 = (F_to_K(ai) for ai in self.a_invariants()) + rhs = X*(X*(X + a2) + a4) + a6 + RK = rings.PolynomialRing(K, 'x') + ypol = RK([-rhs, a1*X + a3, 1]) + L = ypol.splitting_field(names, map=map, **kwds) + if map: + L, K_to_L = L + return L, F_to_K.post_compose(K_to_L) + else: + return L + def _fetch_cached_order(self, other): r""" This method copies the ``_order`` member from ``other`` diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index c2ca6bec5c4..a4d53f52890 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -306,197 +306,6 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, if P not in self._known_points]) return t - def division_field(self, p, names, map=False, **kwds): - r""" - Given an elliptic curve over a number field `F` and a prime number `p`, - construct the field `F(E[p])`. - - INPUT: - - - ``p`` -- a prime number (an element of `\ZZ`) - - - ``names`` -- a variable name for the number field - - - ``map`` -- (default: ``False``) also return an embedding of - the :meth:`base_field` into the resulting field. - - - ``kwds`` -- additional keywords passed to - :func:`sage.rings.number_field.splitting_field.splitting_field`. - - OUTPUT: - - If ``map`` is ``False``, the division field as an absolute number - field. If ``map`` is ``True``, a tuple ``(K, phi)`` where ``phi`` - is an embedding of the base field in the division field ``K``. - - .. WARNING:: - - This takes a very long time when the degree of the division - field is large (e.g. when `p` is large or when the Galois - representation is surjective). The ``simplify`` flag also - has a big influence on the running time: sometimes - ``simplify=False`` is faster, sometimes ``simplify=True`` - (the default) is faster. - - EXAMPLES: - - The 2-division field is the same as the splitting field of - the 2-division polynomial (therefore, it has degree 1, 2, 3 or 6):: - - sage: E = EllipticCurve('15a1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x - sage: E = EllipticCurve('14a1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^2 + 5*x + 92 - sage: E = EllipticCurve('196b1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^3 + x^2 - 114*x - 127 - sage: E = EllipticCurve('19a1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^6 + 10*x^5 + 24*x^4 - 212*x^3 + 1364*x^2 + 24072*x + 104292 - - For odd primes `p`, the division field is either the splitting - field of the `p`-division polynomial, or a quadratic extension - of it. :: - - sage: E = EllipticCurve('50a1') - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F - Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 - sage: K. = E.division_field(3, simplify_all=True); K - Number Field in b with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 - - If we take any quadratic twist, the splitting field of the - 3-division polynomial remains the same, but the 3-division field - becomes a quadratic extension:: - - sage: E = E.quadratic_twist(5) # 50b3 - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F - Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 - sage: K. = E.division_field(3, simplify_all=True); K - Number Field in b with defining polynomial x^12 - 3*x^11 + 8*x^10 - 15*x^9 + 30*x^8 - 63*x^7 + 109*x^6 - 144*x^5 + 150*x^4 - 120*x^3 + 68*x^2 - 24*x + 4 - - Try another quadratic twist, this time over a subfield of `F`:: - - sage: G.,_,_ = F.subfields(3)[0] - sage: E = E.base_extend(G).quadratic_twist(c); E - Elliptic Curve defined by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000) over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9 - sage: K. = E.division_field(3, simplify_all=True); K - Number Field in b with defining polynomial x^12 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025 - - Some higher-degree examples:: - - sage: E = EllipticCurve('11a1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^6 + 2*x^5 - 48*x^4 - 436*x^3 + 1668*x^2 + 28792*x + 73844 - sage: K. = E.division_field(3); K # long time (3s on sage.math, 2014) - Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(5); K - Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 - sage: E.division_field(5, 'b', simplify=False) - Number Field in b with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 - sage: E.base_extend(K).torsion_subgroup() # long time (2s on sage.math, 2014) - Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 - - sage: E = EllipticCurve('27a1') - sage: K. = E.division_field(3); K - Number Field in b with defining polynomial x^2 + 3*x + 9 - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^6 + 6*x^5 + 24*x^4 - 52*x^3 - 228*x^2 + 744*x + 3844 - sage: K. = E.division_field(2, simplify_all=True); K - Number Field in b with defining polynomial x^6 - 3*x^5 + 5*x^3 - 3*x + 1 - sage: K. = E.division_field(5); K # long time (4s on sage.math, 2014) - Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(7); K # long time (8s on sage.math, 2014) - Number Field in b with defining polynomial x^72 ... - - Over a number field:: - - sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve([0,0,0,0,i]) - sage: L. = E.division_field(2); L - Number Field in b with defining polynomial x^4 - x^2 + 1 - sage: L., phi = E.division_field(2, map=True); phi - Ring morphism: - From: Number Field in i with defining polynomial x^2 + 1 - To: Number Field in b with defining polynomial x^4 - x^2 + 1 - Defn: i |--> -b^3 - sage: L., phi = E.division_field(3, map=True) - sage: L - Number Field in b with defining polynomial x^24 - 6*x^22 - 12*x^21 - 21*x^20 + 216*x^19 + 48*x^18 + 804*x^17 + 1194*x^16 - 13488*x^15 + 21222*x^14 + 44196*x^13 - 47977*x^12 - 102888*x^11 + 173424*x^10 - 172308*x^9 + 302046*x^8 + 252864*x^7 - 931182*x^6 + 180300*x^5 + 879567*x^4 - 415896*x^3 + 1941012*x^2 + 650220*x + 443089 - sage: phi - Ring morphism: - From: Number Field in i with defining polynomial x^2 + 1 - To: Number Field in b with defining polynomial x^24 ... - Defn: i |--> -215621657062634529/183360797284413355040732*b^23 ... - - AUTHORS: - - - Jeroen Demeyer (2014-01-06): :trac:`11905`, use - ``splitting_field`` method, moved from ``gal_reps.py``, make - it work over number fields. - """ - from sage.misc.verbose import verbose - p = Integer(p) - if not p.is_prime(): - raise ValueError("p must be a prime number") - - verbose("Adjoining X-coordinates of %s-torsion points" % p) - F = self.base_ring() - f = self.division_polynomial(p) - if p == 2: - # For p = 2, the division field is the splitting field of - # the division polynomial. - return f.splitting_field(names, map=map, **kwds) - - # Compute splitting field of X-coordinates. - # The Galois group of the division field is a subgroup of GL(2,p). - # The Galois group of the X-coordinates is a subgroup of GL(2,p)/{-1,+1}. - # We need the map to change the elliptic curve invariants to K. - deg_mult = F.degree() * p * (p+1) * (p-1) * (p-1) // 2 - K, F_to_K = f.splitting_field(names, degree_multiple=deg_mult, map=True, **kwds) - - verbose("Adjoining Y-coordinates of %s-torsion points" % p) - - # THEOREM (Cremona, http://trac.sagemath.org/ticket/11905#comment:21). - # Let K be a field, E an elliptic curve over K and p an odd - # prime number. Assume that K contains all roots of the - # p-division polynomial of E. Then either K contains all - # p-torsion points on E, or it does not contain any p-torsion - # point. - # - # PROOF. Let G be the absolute Galois group of K (every element - # in it fixes all elements of K). For any p-torsion point P - # over the algebraic closure and any sigma in G, we must have - # either sigma(P) = P or sigma(P) = -P (since K contains the - # X-coordinate of P). Now assume that K does not contain all - # p-torsion points. Then there exists a point P1 and a sigma in - # G such that sigma(P1) = -P1. Now take a different p-torsion - # point P2. Since sigma(P2) must be P2 or -P2 and - # sigma(P1+P2) = sigma(P1)+sigma(P2) = sigma(P1)-P2 must - # be P1+P2 or -(P1+P2), it follows that sigma(P2) = -sigma(P2). - # Therefore, K cannot contain any p-torsion point. - # - # This implies that it suffices to adjoin the Y-coordinate - # of just one point. - - # First factor f over F and then compute a root X of f over K. - g = f.factor()[0][0] - X = g.map_coefficients(F_to_K).roots(multiplicities=False)[0] - - # Polynomial defining the corresponding Y-coordinate - a1,a2,a3,a4,a6 = (F_to_K(ai) for ai in self.a_invariants()) - rhs = X*(X*(X + a2) + a4) + a6 - RK = PolynomialRing(K, 'x') - ypol = RK([-rhs, a1*X + a3, 1]) - L = ypol.splitting_field(names, map=map, **kwds) - if map: - L, K_to_L = L - return L, F_to_K.post_compose(K_to_L) - else: - return L - def height_pairing_matrix(self, points=None, precision=None, normalised=True): r"""Return the height pairing matrix of the given points. From 731011c1599e5bc3fd7e27438d9bd3e6d63bdda7 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Tue, 31 May 2022 13:35:39 +0800 Subject: [PATCH 235/338] support finite fields in .division_field() --- src/sage/schemes/elliptic_curves/ell_field.py | 113 ++++++++++++++---- 1 file changed, 92 insertions(+), 21 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 25ddf2c81fd..c1d8e7a8471 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -14,6 +14,9 @@ import sage.rings.all as rings import sage.rings.abc +from sage.categories.number_fields import NumberFields +from sage.categories.finite_fields import FiniteFields + from sage.schemes.elliptic_curves.ell_point import EllipticCurvePoint_field from sage.schemes.curves.projective_curve import ProjectivePlaneCurve_field @@ -764,37 +767,38 @@ def descend_to(self, K, f=None): Elist = [E.minimal_model() for E in Elist] return Elist - def division_field(self, p, names, map=False, **kwds): + def division_field(self, p, names=None, map=False, **kwds): r""" - Given an elliptic curve over a number field `F` and a prime number `p`, - construct the field `F(E[p])`. + Given an elliptic curve over a number field or finite field `F` + and a prime number `p`, construct the field `F(E[p])`. INPUT: - - ``p`` -- a prime number (an element of `\ZZ`) + - ``p`` -- a prime number (an element of `\ZZ`). - - ``names`` -- a variable name for the number field + - ``names`` -- (default: ``t``) a variable name for the division field. - ``map`` -- (default: ``False``) also return an embedding of the :meth:`base_field` into the resulting field. - ``kwds`` -- additional keywords passed to - :func:`sage.rings.number_field.splitting_field.splitting_field`. + :func:`~sage.rings.polynomial.polynomial_element.Polynomial.splitting_field`. OUTPUT: If ``map`` is ``False``, the division field as an absolute number - field. If ``map`` is ``True``, a tuple ``(K, phi)`` where ``phi`` - is an embedding of the base field in the division field ``K``. + field or a finite field. + If ``map`` is ``True``, a tuple `(K, \phi)` where `\phi` is an + embedding of the base field in the division field `K`. .. WARNING:: - This takes a very long time when the degree of the division + This can take a very long time when the degree of the division field is large (e.g. when `p` is large or when the Galois representation is surjective). The ``simplify`` flag also - has a big influence on the running time: sometimes - ``simplify=False`` is faster, sometimes ``simplify=True`` - (the default) is faster. + has a big influence on the running time over number fields: + sometimes ``simplify=False`` is faster, sometimes + ``simplify=True`` (the default) is faster. EXAMPLES: @@ -889,31 +893,100 @@ def division_field(self, p, names, map=False, **kwds): To: Number Field in b with defining polynomial x^24 ... Defn: i |--> -215621657062634529/183360797284413355040732*b^23 ... + Over a finite field:: + + sage: E = EllipticCurve(GF(431^2), [1,0]) + sage: E.division_field(5, map=True) + (Finite Field in t of size 431^4, + Ring morphism: + From: Finite Field in z2 of size 431^2 + To: Finite Field in t of size 431^4 + Defn: z2 |--> 52*t^3 + 222*t^2 + 78*t + 105) + + :: + + sage: E = EllipticCurve(GF(433^2), [1,0]) + sage: K. = E.division_field(7); K + Finite Field in v of size 433^16 + + TESTS: + + Some random testing:: + + sage: def check(E, l, K): + ....: EE = E.change_ring(K) + ....: cof = EE.order().prime_to_m_part(l) + ....: pts = (cof * EE.random_point() for _ in iter(int, 1)) + ....: mul = lambda P: P if not l*P else mul(l*P) + ....: pts = map(mul, filter(bool, pts)) + ....: if l == EE.base_field().characteristic(): + ....: if EE.is_supersingular(): + ....: Ps = () + ....: else: + ....: assert l.divides(EE.order()) + ....: Ps = (next(pts),) + ....: else: + ....: assert l.divides(EE.order()) + ....: for _ in range(9999): + ....: P,Q = next(pts), next(pts) + ....: if P.weil_pairing(Q,l) != 1: + ....: Ps = (P,Q) + ....: break + ....: else: + ....: assert False + ....: deg = lcm(el.minpoly().degree() for el in sum(map(list,Ps),[])) + ....: assert max(deg, E.base_field().degree()) == K.degree() + sage: q = next_prime_power(randrange(1, 10^9)) + sage: F. = GF(q) + sage: while True: + ....: try: + ....: E = EllipticCurve([F.random_element() for _ in range(5)]) + ....: except ArithmeticError: + ....: continue + ....: break + sage: l = random_prime(8) + sage: K = E.division_field(l) + sage: n = E.cardinality(extension_degree=K.degree()//F.degree()) + sage: (l^2 if q%l else 0 + E.is_ordinary()).divides(n) + True + sage: check(E, l, K) # long time + AUTHORS: - Jeroen Demeyer (2014-01-06): :trac:`11905`, use ``splitting_field`` method, moved from ``gal_reps.py``, make it work over number fields. + - Lorenz Panny (2022): extend to finite fields """ from sage.misc.verbose import verbose p = rings.Integer(p) if not p.is_prime(): raise ValueError("p must be a prime number") + if names is None: + names = 't' + verbose("Adjoining X-coordinates of %s-torsion points" % p) F = self.base_ring() - f = self.division_polynomial(p) - if p == 2: - # For p = 2, the division field is the splitting field of + f = self.division_polynomial(l) + if l == 2 or f.is_constant(): + # For l = 2, the division field is the splitting field of # the division polynomial. + # If f is a non-zero constant, the l-torsion is trivial: + # This means the curve must be supersingular and l == p. return f.splitting_field(names, map=map, **kwds) # Compute splitting field of X-coordinates. # The Galois group of the division field is a subgroup of GL(2,p). # The Galois group of the X-coordinates is a subgroup of GL(2,p)/{-1,+1}. # We need the map to change the elliptic curve invariants to K. - deg_mult = F.degree() * p * (p+1) * (p-1) * (p-1) // 2 - K, F_to_K = f.splitting_field(names, degree_multiple=deg_mult, map=True, **kwds) + if F in NumberFields(): + deg_mult = F.degree() * p * (p+1) * (p-1)**2 // 2 + K, F_to_K = f.splitting_field(names, degree_multiple=deg_mult, map=True, **kwds) + elif F in FiniteFields(): + K, F_to_K = f.splitting_field('u', map=True, **kwds) + else: + raise NotImplementedError('only number fields and finite fields are currently supported') verbose("Adjoining Y-coordinates of %s-torsion points" % p) @@ -944,10 +1017,8 @@ def division_field(self, p, names, map=False, **kwds): X = g.map_coefficients(F_to_K).roots(multiplicities=False)[0] # Polynomial defining the corresponding Y-coordinate - a1,a2,a3,a4,a6 = (F_to_K(ai) for ai in self.a_invariants()) - rhs = X*(X*(X + a2) + a4) + a6 - RK = rings.PolynomialRing(K, 'x') - ypol = RK([-rhs, a1*X + a3, 1]) + curve = self.defining_polynomial().map_coefficients(F_to_K) + ypol = curve(X, rings.polygen(K), 1) L = ypol.splitting_field(names, map=map, **kwds) if map: L, K_to_L = L From 6b7dbcddfe0938a3d476470b59d0b69c35888b61 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Tue, 31 May 2022 13:42:27 +0800 Subject: [PATCH 236/338] rename p->l to avoid confusion with characteristic --- src/sage/schemes/elliptic_curves/ell_field.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index c1d8e7a8471..c2d26a80ab4 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -767,14 +767,14 @@ def descend_to(self, K, f=None): Elist = [E.minimal_model() for E in Elist] return Elist - def division_field(self, p, names=None, map=False, **kwds): + def division_field(self, l, names=None, map=False, **kwds): r""" Given an elliptic curve over a number field or finite field `F` - and a prime number `p`, construct the field `F(E[p])`. + and a prime number `\ell`, construct the field `F(E[\ell])`. INPUT: - - ``p`` -- a prime number (an element of `\ZZ`). + - ``\ell`` -- a prime number (an element of `\ZZ`). - ``names`` -- (default: ``t``) a variable name for the division field. @@ -794,7 +794,7 @@ def division_field(self, p, names=None, map=False, **kwds): .. WARNING:: This can take a very long time when the degree of the division - field is large (e.g. when `p` is large or when the Galois + field is large (e.g. when `\ell` is large or when the Galois representation is surjective). The ``simplify`` flag also has a big influence on the running time over number fields: sometimes ``simplify=False`` is faster, sometimes @@ -818,8 +818,8 @@ def division_field(self, p, names=None, map=False, **kwds): sage: K. = E.division_field(2); K Number Field in b with defining polynomial x^6 + 10*x^5 + 24*x^4 - 212*x^3 + 1364*x^2 + 24072*x + 104292 - For odd primes `p`, the division field is either the splitting - field of the `p`-division polynomial, or a quadratic extension + For odd primes `\ell`, the division field is either the splitting + field of the `\ell`-division polynomial, or a quadratic extension of it. :: sage: E = EllipticCurve('50a1') @@ -959,14 +959,14 @@ def division_field(self, p, names=None, map=False, **kwds): - Lorenz Panny (2022): extend to finite fields """ from sage.misc.verbose import verbose - p = rings.Integer(p) - if not p.is_prime(): - raise ValueError("p must be a prime number") + l = rings.Integer(l) + if not l.is_prime(): + raise ValueError("l must be a prime number") if names is None: names = 't' - verbose("Adjoining X-coordinates of %s-torsion points" % p) + verbose("Adjoining X-coordinates of %s-torsion points" % l) F = self.base_ring() f = self.division_polynomial(l) if l == 2 or f.is_constant(): @@ -977,18 +977,18 @@ def division_field(self, p, names=None, map=False, **kwds): return f.splitting_field(names, map=map, **kwds) # Compute splitting field of X-coordinates. - # The Galois group of the division field is a subgroup of GL(2,p). - # The Galois group of the X-coordinates is a subgroup of GL(2,p)/{-1,+1}. + # The Galois group of the division field is a subgroup of GL(2,l). + # The Galois group of the X-coordinates is a subgroup of GL(2,l)/{-1,+1}. # We need the map to change the elliptic curve invariants to K. if F in NumberFields(): - deg_mult = F.degree() * p * (p+1) * (p-1)**2 // 2 + deg_mult = F.degree() * l * (l+1) * (l-1)**2 // 2 K, F_to_K = f.splitting_field(names, degree_multiple=deg_mult, map=True, **kwds) elif F in FiniteFields(): K, F_to_K = f.splitting_field('u', map=True, **kwds) else: raise NotImplementedError('only number fields and finite fields are currently supported') - verbose("Adjoining Y-coordinates of %s-torsion points" % p) + verbose("Adjoining Y-coordinates of %s-torsion points" % l) # THEOREM (Cremona, http://trac.sagemath.org/ticket/11905#comment:21). # Let K be a field, E an elliptic curve over K and p an odd From e740b2279bbbf43a0c3aa313b5e9912659e5143c Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Tue, 31 May 2022 22:00:23 +0800 Subject: [PATCH 237/338] remove unused import --- src/sage/schemes/elliptic_curves/ell_number_field.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index a4d53f52890..4df3c054d4a 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -90,7 +90,6 @@ from .ell_generic import is_EllipticCurve from .ell_point import EllipticCurvePoint_number_field from .constructor import EllipticCurve -from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.real_mpfr import RealField From 2940e700888d1b305c8fa6061e8faed421e34ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 31 May 2022 16:24:58 +0200 Subject: [PATCH 238/338] conversion of maple functions --- src/sage/functions/transcendental.py | 13 ++++--- src/sage/interfaces/maple.py | 51 ++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/src/sage/functions/transcendental.py b/src/sage/functions/transcendental.py index fbbb1995c56..8579819c1aa 100644 --- a/src/sage/functions/transcendental.py +++ b/src/sage/functions/transcendental.py @@ -18,7 +18,6 @@ # **************************************************************************** import sys -import sage.rings.complex_mpfr as complex_field from sage.rings.integer_ring import ZZ from sage.rings.real_mpfr import RR @@ -147,10 +146,14 @@ def __init__(self): sage: zeta(3)._maple_init_() 'Zeta(3)' + sage: zeta(3)._maple_().sage() # optional - maple + zeta(3) """ - GinacFunction.__init__(self, 'zeta', conversions={'giac': 'Zeta', - 'maple': 'Zeta', - 'mathematica': 'Zeta'}) + GinacFunction.__init__(self, 'zeta', + conversions={'giac': 'Zeta', + 'maple': 'Zeta', + 'mathematica': 'Zeta'}) + zeta = Function_zeta() @@ -222,7 +225,7 @@ def __init__(self): """ BuiltinFunction.__init__(self, 'hurwitz_zeta', nargs=2, conversions=dict(mathematica='HurwitzZeta', - maple='Zeta', + # maple='Zeta', conflict with zeta here sympy='zeta'), latex_name=r'\zeta') diff --git a/src/sage/interfaces/maple.py b/src/sage/interfaces/maple.py index 6916024eb92..edc19e3d82a 100644 --- a/src/sage/interfaces/maple.py +++ b/src/sage/interfaces/maple.py @@ -85,7 +85,7 @@ :: sage: maple('(x^12-1)/(x-1)').simplify() # optional - maple - x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1 + (x+1)*(x^2+1)*(x^2+x+1)*(x^2-x+1)*(x^4-x^2+1) The normal command will always reduce a rational function to the @@ -1082,13 +1082,13 @@ def _latex_(self): """ return self.parent().eval('latex(%s)' % self.name()) - def op(self, i): + def op(self, i=None): """ Return the i-th operand of this expression. INPUT: - - i -- an integer + - i -- an integer or ``None`` EXAMPLES:: @@ -1098,6 +1098,8 @@ def op(self, i): sage: V.op(2) # optional - maple {1 = 4, 2 = 5, 3 = 6} """ + if i is None: + return self.parent().op(self) return self.parent().op(i, self) def _sage_(self): @@ -1170,16 +1172,34 @@ def _sage_(self): sage: sq5.parent() # optional - maple Real Field with 332 bits of precision - Functions are not yet converted back correctly:: + Functions are now sometimes converted back correctly:: sage: maple(hypergeometric([3,4],[5],x)) # optional - maple hypergeom([3, 4],[5],x) - sage: _.sage() # known bug # optional - maple + sage: _.sage() # optional - maple hypergeometric((3, 4), (5,), x) + + sage: maple(zeta(5)) # optional - maple + Zeta(5) + sage: _.sage() # optional - maple + zeta(5) + + sage: maple(psi(2,x)) # optional - maple + Psi(2,x) + sage: _.sage() # optional - maple + psi(2, x) + + sage: maple("4+6*Zeta(3)").sage() # optional - maple + 6*zeta(3) + 4 + + sage: maple("Beta(x,y)^Zeta(9)+1").sage() # optional - maple + beta(x, y)^zeta(9) + 1 """ from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector from sage.rings.integer_ring import ZZ + from sage.symbolic.expression import symbol_table + symbol_maple = symbol_table["maple"] # The next few lines are a very crude excuse for a maple "parser" maple_type = repr(self.whattype()) result = repr(self) @@ -1212,15 +1232,32 @@ def _sage_(self): elif maple_type == 'fraction': return self.op(1)._sage_() / self.op(2)._sage_() elif maple_type == "function": - pass # TODO : here one should translate back function names + # TODO : better back translation of function names + fun = str(self.op(0)) + try: + sage_fun = symbol_maple[fun] + if self.nops() == 1: + args = [self.op()._sage_()] + else: + args = [arg._sage_() for arg in self.op()] + return sage_fun(*args) + except (KeyError, TypeError): + pass elif maple_type == "float": from sage.rings.real_mpfr import RealField mantissa = len(repr(self.op(1))) prec = max(53, (mantissa * 13301) // 4004) R = RealField(prec) return R(result) + elif maple_type == '`+`': + return sum(term._sage_() for term in self.op()) + elif maple_type == '`*`': + from sage.misc.misc_c import prod + return prod(term._sage_() for term in self.op()) + elif maple_type == '`^`': + return self.op(1)._sage_()**self.op(2)._sage_() elif maple_type == '`=`': # (1, 1) = 2 - return (self.op(1)._sage_() == self.op(2)._sage()) + return (self.op(1)._sage_() == self.op(2)._sage_()) try: from sage.symbolic.ring import SR return SR(result) From 9d33c1deb887d3224a4b86ad990b855db8674624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 1 Jun 2022 07:42:55 +0200 Subject: [PATCH 239/338] one more doctest --- src/sage/interfaces/maple.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sage/interfaces/maple.py b/src/sage/interfaces/maple.py index edc19e3d82a..9b0d79ac2ed 100644 --- a/src/sage/interfaces/maple.py +++ b/src/sage/interfaces/maple.py @@ -1172,6 +1172,13 @@ def _sage_(self): sage: sq5.parent() # optional - maple Real Field with 332 bits of precision + Equations:: + + sage: maple("x=4") # optional - maple + x = 4 + sage: _.sage() # optional - maple + x == 4 + Functions are now sometimes converted back correctly:: sage: maple(hypergeometric([3,4],[5],x)) # optional - maple @@ -1192,7 +1199,7 @@ def _sage_(self): sage: maple("4+6*Zeta(3)").sage() # optional - maple 6*zeta(3) + 4 - sage: maple("Beta(x,y)^Zeta(9)+1").sage() # optional - maple + sage: maple("Beta(x,y)^Zeta(9)+1").sage() # optional - maple beta(x, y)^zeta(9) + 1 """ from sage.matrix.constructor import matrix From f307ea75caba505fbeb164faa3a991ca10c27d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 1 Jun 2022 08:51:47 +0200 Subject: [PATCH 240/338] also convert Sum and Product --- src/sage/interfaces/maple.py | 47 ++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/sage/interfaces/maple.py b/src/sage/interfaces/maple.py index 9b0d79ac2ed..16e928b6cae 100644 --- a/src/sage/interfaces/maple.py +++ b/src/sage/interfaces/maple.py @@ -433,7 +433,7 @@ def expect(self): True sage: m._start() # optional - maple sage: m.expect() # optional - maple - + Maple with PID ... sage: m.quit() # optional - maple """ return self._expect @@ -1106,8 +1106,9 @@ def _sage_(self): r""" Convert a maple expression back to a Sage expression. - This currently does not implement a parser for the Maple output language, - therefore only very simple expressions will convert successfully. + This currently does not implement a serious parser + for the Maple output language. + Therefore only very simple expressions will convert successfully. REFERENCE: @@ -1199,8 +1200,15 @@ def _sage_(self): sage: maple("4+6*Zeta(3)").sage() # optional - maple 6*zeta(3) + 4 - sage: maple("Beta(x,y)^Zeta(9)+1").sage() # optional - maple + sage: maple("Beta(x,y)^Zeta(9)+1").sage() # optional - maple beta(x, y)^zeta(9) + 1 + + Sums and products:: + + sage: maple('Sum(x-k,k=1..n)').sage() # optional - maple + sum(-k + x, k, 1, n) + sage: maple('Product(x-k,k=1..n)').sage() # optional - maple + product(-k + x, k, 1, n) """ from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector @@ -1241,15 +1249,28 @@ def _sage_(self): elif maple_type == "function": # TODO : better back translation of function names fun = str(self.op(0)) - try: - sage_fun = symbol_maple[fun] - if self.nops() == 1: - args = [self.op()._sage_()] - else: - args = [arg._sage_() for arg in self.op()] - return sage_fun(*args) - except (KeyError, TypeError): - pass + if fun == 'Sum': + from sage.misc.functional import symbolic_sum + term = self.op(1)._sage_() + variable = self.op(2).op(1)._sage_() + bounds = [b._sage_() for b in self.op(2).op(2).op()] + return symbolic_sum(term, variable, *bounds, hold=True) + if fun == 'Product': + from sage.misc.functional import symbolic_prod + term = self.op(1)._sage_() + variable = self.op(2).op(1)._sage_() + bounds = [b._sage_() for b in self.op(2).op(2).op()] + return symbolic_prod(term, variable, *bounds, hold=True) + else: + try: + sage_fun = symbol_maple[fun] + if self.nops() == 1: + args = [self.op()._sage_()] + else: + args = [arg._sage_() for arg in self.op()] + return sage_fun(*args) + except (KeyError, TypeError): + pass elif maple_type == "float": from sage.rings.real_mpfr import RealField mantissa = len(repr(self.op(1))) From 9ea07376cf5bf27d3bd63fd0189090c1ef56422a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 1 Jun 2022 09:51:41 +0200 Subject: [PATCH 241/338] now for integrals too --- src/sage/interfaces/maple.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sage/interfaces/maple.py b/src/sage/interfaces/maple.py index 16e928b6cae..224eb8bc552 100644 --- a/src/sage/interfaces/maple.py +++ b/src/sage/interfaces/maple.py @@ -1209,6 +1209,11 @@ def _sage_(self): sum(-k + x, k, 1, n) sage: maple('Product(x-k,k=1..n)').sage() # optional - maple product(-k + x, k, 1, n) + + Integrals:: + + sage: maple('Int(exp(x),x=0..y)').sage() # optional - maple + integrate(e^x, x, 0, y) """ from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector @@ -1255,6 +1260,12 @@ def _sage_(self): variable = self.op(2).op(1)._sage_() bounds = [b._sage_() for b in self.op(2).op(2).op()] return symbolic_sum(term, variable, *bounds, hold=True) + if fun == 'Int': + from sage.misc.functional import integral + term = self.op(1)._sage_() + variable = self.op(2).op(1)._sage_() + bounds = [b._sage_() for b in self.op(2).op(2).op()] + return integral(term, variable, *bounds, hold=True) if fun == 'Product': from sage.misc.functional import symbolic_prod term = self.op(1)._sage_() From b454e74bb0938b4c06862ae994f2b961bc4438ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 1 Jun 2022 09:54:03 +0200 Subject: [PATCH 242/338] tweak maple parser --- src/sage/interfaces/maple.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/interfaces/maple.py b/src/sage/interfaces/maple.py index 224eb8bc552..3effc4e8b80 100644 --- a/src/sage/interfaces/maple.py +++ b/src/sage/interfaces/maple.py @@ -1254,19 +1254,19 @@ def _sage_(self): elif maple_type == "function": # TODO : better back translation of function names fun = str(self.op(0)) - if fun == 'Sum': + if fun in ['Sum', 'sum']: from sage.misc.functional import symbolic_sum term = self.op(1)._sage_() variable = self.op(2).op(1)._sage_() bounds = [b._sage_() for b in self.op(2).op(2).op()] return symbolic_sum(term, variable, *bounds, hold=True) - if fun == 'Int': + if fun in ['Int', 'int']: from sage.misc.functional import integral term = self.op(1)._sage_() variable = self.op(2).op(1)._sage_() bounds = [b._sage_() for b in self.op(2).op(2).op()] return integral(term, variable, *bounds, hold=True) - if fun == 'Product': + if fun in ['Product', 'product']: from sage.misc.functional import symbolic_prod term = self.op(1)._sage_() variable = self.op(2).op(1)._sage_() From 2332517aa80712b6d4bdb86e48c6ab1137ea156b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 1 Jun 2022 21:38:56 +0200 Subject: [PATCH 243/338] fix details in oeis --- src/sage/databases/oeis.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/sage/databases/oeis.py b/src/sage/databases/oeis.py index be0138b6b76..45b73054eac 100644 --- a/src/sage/databases/oeis.py +++ b/src/sage/databases/oeis.py @@ -8,7 +8,6 @@ - identify a sequence from its first terms. - obtain more terms, formulae, references, etc. for a given sequence. - AUTHORS: - Thierry Monteil (2012-02-10 -- 2013-06-21): initial version. @@ -105,7 +104,6 @@ 10: A326943: Number of T_0 sets of subsets of {1..n} that cover all n vertices and are closed under intersection. ... - What does the Taylor expansion of the `e^{e^x-1}` function have to do with primes ? @@ -127,12 +125,11 @@ 'E.g.f.: exp(exp(x) - 1).' sage: [i for i in b.comments() if 'prime' in i][-1] # optional -- internet - 'Number n is prime if mod(a(n)-2,n) = 0...' + 'Number n is prime if ...' sage: [n for n in range(2, 20) if (b(n)-2) % n == 0] # optional -- internet [2, 3, 5, 7, 11, 13, 17, 19] - .. SEEALSO:: - If you plan to do a lot of automatic searches for subsequences, you @@ -161,6 +158,8 @@ from urllib.request import urlopen from urllib.parse import urlencode from ssl import create_default_context as default_context +from collections import defaultdict +import re from sage.structure.sage_object import SageObject from sage.structure.unique_representation import UniqueRepresentation @@ -174,8 +173,6 @@ from sage.misc.html import HtmlFragment from sage.repl.preparse import preparse -from collections import defaultdict -import re oeis_url = 'https://oeis.org/' @@ -205,7 +202,7 @@ def _fetch(url): f.close() return bytes_to_str(result) except IOError as msg: - raise IOError("%s\nError fetching %s." % (msg, url)) + raise IOError("%s\nerror fetching %s" % (msg, url)) def _urls(html_string): @@ -229,7 +226,6 @@ def _urls(html_string): sage: html = 'http://example.com is not a link, but sagemath is' sage: _urls(html) ['http://sagemath.org/'] - """ urls = [] from html.parser import HTMLParser @@ -611,7 +607,7 @@ def _imaginary_entry(self, ident='A999999', keywords=''): '%o ' + ident + ' def ' + ident + '(n):\n' '%o ' + ident + ' assert(isinstance(n, (int, Integer))), "n must be an integer."\n' '%o ' + ident + ' if n < 38:\n' - '%o ' + ident + ' raise ValueError("The value %s is not accepted." %str(n))\n' + '%o ' + ident + ' raise ValueError("the value %s is not accepted" % str(n))\n' '%o ' + ident + ' elif n == 42:\n' '%o ' + ident + ' return 2\n' '%o ' + ident + ' else:\n' @@ -1365,14 +1361,14 @@ def __call__(self, k): sage: s(2) Traceback (most recent call last): ... - ValueError: Sequence A999999 is not defined (or known) for index 2 + ValueError: sequence A999999 is not defined (or known) for index 2 """ offset = self.offsets()[0] if 'cons' in self.keywords(): offset = - offset n = k - offset if not 0 <= n < len(self.first_terms()): - raise ValueError("Sequence %s is not defined (or known) for index %s" % (self.id(), k)) + raise ValueError("sequence %s is not defined (or known) for index %s" % (self.id(), k)) return self.first_terms()[n] def __getitem__(self, i): @@ -1454,7 +1450,7 @@ def __iter__(self): sage: next(i) # optional -- internet Traceback (most recent call last): ... - LookupError: Future values not provided by OEIS. + LookupError: future values not provided by OEIS :: @@ -1465,7 +1461,7 @@ def __iter__(self): ....: print(i) Traceback (most recent call last): ... - LookupError: Future values not provided by OEIS. + LookupError: future values not provided by OEIS TESTS:: @@ -1474,7 +1470,7 @@ def __iter__(self): ....: pass Traceback (most recent call last): ... - LookupError: Future values not provided by OEIS. + LookupError: future values not provided by OEIS sage: for i in s: ....: if i == 2: @@ -1488,7 +1484,7 @@ def __iter__(self): for x in self.first_terms(): yield x if not self.is_full() is True: - raise LookupError("Future values not provided by OEIS.") + raise LookupError("future values not provided by OEIS") def references(self): r""" @@ -1892,7 +1888,7 @@ def programs(self, language='all', preparsing=True, keep_comments=False): 0: def A999999(n): 1: assert(isinstance(n, (int, Integer))), "n must be an integer." 2: if n < 38: - 3: raise ValueError("The value %s is not accepted." %str(n)) + 3: raise ValueError("the value %s is not accepted" % str(n)) 4: elif n == 42: 5: return 2 6: else: From c4e817835d1744af17b4348d15ed9dff1456784a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Wed, 1 Jun 2022 22:00:00 +0200 Subject: [PATCH 244/338] 33944: using shutil.move instead of os.rename --- src/sage/misc/latex_standalone.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index d4fcca9e5d0..8f698ffc2e6 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -728,7 +728,8 @@ def pdf(self, filename=None, view=True, program=None): # move the pdf into the good location if filename: filename = os.path.abspath(filename) - os.rename(temp_filename_pdf, filename) + import shutil + shutil.move(temp_filename_pdf, filename) return filename # open the tmp pdf @@ -816,7 +817,8 @@ def png(self, filename=None, density=150, view=True): # move the png into the good location if filename: filename = os.path.abspath(filename) - os.rename(temp_filename_png, filename) + import shutil + shutil.move(temp_filename_png, filename) return filename # open the tmp png @@ -915,7 +917,8 @@ def svg(self, filename=None, view=True, program='pdftocairo'): # move the svg into the good location if filename: filename = os.path.abspath(filename) - os.rename(temp_filename_svg, filename) + import shutil + shutil.move(temp_filename_svg, filename) return filename # open the tmp svg From aabb55adb3d7d1ddaae149245ec9c7b56b52805b Mon Sep 17 00:00:00 2001 From: "Trevor K. Karn" Date: Wed, 1 Jun 2022 13:09:04 -0700 Subject: [PATCH 245/338] Fix additional reviewer suggestions --- src/sage/matroids/matroid.pyx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index fcd626b7378..94a69a013e0 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -3108,7 +3108,7 @@ cdef class Matroid(SageObject): def matroid_polytope(self): r""" - src/sage/matroids/matroid.pyx Return the matroid polytope of ``self``. + Return the matroid polytope of ``self``. This is defined as the convex hull of the vertices @@ -8064,7 +8064,10 @@ cdef class Matroid(SageObject): Matroid of rank 6 on 16 elements as matroid sum of Binary matroid of rank 3 on 7 elements, type (3, 0) Matroid of rank 3 on 9 elements with circuit-closures - {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'}, {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}} + {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, + {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'}, + {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, + 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}} sage: len(N.independent_sets()) 6897 sage: len(N.bases()) From a642e3a6b1ef82dea1cc8463a1d2cd2a34ef6283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 2 Jun 2022 10:42:01 +0200 Subject: [PATCH 246/338] fix E306 outside of combinat,graphs,rings,categories,schemes,algebras --- src/sage/calculus/desolvers.py | 16 +++++++++------- src/sage/categories/finite_posets.py | 4 +++- src/sage/coding/guruswami_sudan/gs_decoder.py | 1 + src/sage/coding/guruswami_sudan/interpolation.py | 2 ++ src/sage/coding/information_set_decoder.py | 2 ++ .../combinat/cluster_algebra_quiver/quiver.py | 1 + src/sage/crypto/sboxes.py | 1 + src/sage/databases/findstat.py | 3 +++ src/sage/databases/sql_db.py | 1 + src/sage/doctest/control.py | 2 ++ src/sage/doctest/fixtures.py | 1 + src/sage/functions/orthogonal_polys.py | 1 + .../triangulation/point_configuration.py | 1 + src/sage/groups/braid.py | 1 + src/sage/groups/cubic_braid.py | 2 ++ src/sage/homology/chain_complex.py | 1 + src/sage/homology/hochschild_complex.py | 1 + src/sage/interfaces/frobby.py | 4 +++- src/sage/knots/link.py | 1 + src/sage/libs/singular/standard_options.py | 1 + src/sage/manifolds/differentiable/vectorfield.py | 1 - src/sage/manifolds/subset.py | 3 +++ src/sage/misc/explain_pickle.py | 1 + src/sage/misc/superseded.py | 1 + src/sage/modular/modform/numerical.py | 2 ++ src/sage/modular/modsym/ambient.py | 3 ++- src/sage/modules/filtered_vector_space.py | 1 + src/sage/modules/with_basis/morphism.py | 1 + src/sage/monoids/indexed_free_monoid.py | 1 + src/sage/parallel/decorate.py | 2 ++ src/sage/plot/hyperbolic_polygon.py | 1 + src/sage/plot/plot.py | 4 +++- src/sage/plot/plot3d/plot3d.py | 10 ++++++---- .../quadratic_forms/quadratic_form__theta.py | 1 + src/sage/repl/ipython_kernel/widgets_sagenb.py | 1 + src/sage/repl/rich_output/backend_ipython.py | 1 + src/sage/rings/padics/local_generic.py | 1 + src/sage/schemes/curves/zariski_vankampen.py | 9 +++++---- .../schemes/riemann_surfaces/riemann_surface.py | 5 +++-- src/sage/sets/image_set.py | 1 + src/sage/sets/real_set.py | 1 + src/sage/tensor/modules/free_module_tensor.py | 1 + src/sage_docbuild/ext/multidocs.py | 1 + 43 files changed, 78 insertions(+), 22 deletions(-) diff --git a/src/sage/calculus/desolvers.py b/src/sage/calculus/desolvers.py index 5bf704b95eb..02e4d0562d8 100644 --- a/src/sage/calculus/desolvers.py +++ b/src/sage/calculus/desolvers.py @@ -574,6 +574,7 @@ def desolve(de, dvar, ics=None, ivar=None, show_method=False, contrib_ode=False, dvar_str=P(dvar.operator()).str() ivar_str=P(ivar).str() de00 = de00.str() + def sanitize_var(exprs): return exprs.replace("'"+dvar_str+"("+ivar_str+")",dvar_str) de0 = sanitize_var(de00) @@ -811,6 +812,7 @@ def desolve_laplace(de, dvar, ics=None, ivar=None): ## verbatim copy from desolve - end dvar_str = str(dvar) + def sanitize_var(exprs): # 'y(x) -> y(x) return exprs.replace("'"+dvar_str,dvar_str) de0=de._maxima_() @@ -1680,25 +1682,25 @@ def Dfun(y, t): variabs = dvars[:] variabs.append(ivar) for de in des: - desc.append(fast_float(de,*variabs)) + desc.append(fast_float(de, *variabs)) - def func(y,t): + def func(y, t): v = list(y[:]) v.append(t) return [dec(*v) for dec in desc] if not compute_jac: - Dfun=None + Dfun = None else: - J = jacobian(des,dvars) + J = jacobian(des, dvars) J = [list(v) for v in J] - J = fast_float(J,*variabs) - def Dfun(y,t): + J = fast_float(J, *variabs) + + def Dfun(y, t): v = list(y[:]) v.append(t) return [[element(*v) for element in row] for row in J] - sol=odeint(func, ics, times, args=args, Dfun=Dfun, rtol=rtol, atol=atol, tcrit=tcrit, h0=h0, hmax=hmax, hmin=hmin, ixpr=ixpr, mxstep=mxstep, mxhnil=mxhnil, mxordn=mxordn, mxords=mxords, printmessg=printmessg) diff --git a/src/sage/categories/finite_posets.py b/src/sage/categories/finite_posets.py index 3a537733431..1f6b49d2e15 100644 --- a/src/sage/categories/finite_posets.py +++ b/src/sage/categories/finite_posets.py @@ -1901,14 +1901,16 @@ def order_ideals_lattice(self, as_ideals=True, facade=None): else: from sage.misc.cachefunc import cached_function antichains = [tuple(a) for a in self.antichains()] + @cached_function def is_above(a, xb): return any(self.is_lequal(xa, xb) for xa in a) + def compare(a, b): return all(is_above(a, xb) for xb in b) return LatticePoset((antichains, compare), facade=facade) - @abstract_method(optional = True) + @abstract_method(optional=True) def antichains(self): r""" Return all antichains of ``self``. diff --git a/src/sage/coding/guruswami_sudan/gs_decoder.py b/src/sage/coding/guruswami_sudan/gs_decoder.py index 0cd18df579b..a18a6bb710d 100644 --- a/src/sage/coding/guruswami_sudan/gs_decoder.py +++ b/src/sage/coding/guruswami_sudan/gs_decoder.py @@ -356,6 +356,7 @@ def guruswami_sudan_decoding_radius(C = None, n_k = None, l = None, s = None): (92, (2, 6)) """ n,k = n_k_params(C, n_k) + def get_tau(s,l): "Return the decoding radius given this s and l" if s<=0 or l<=0: diff --git a/src/sage/coding/guruswami_sudan/interpolation.py b/src/sage/coding/guruswami_sudan/interpolation.py index 9c42fd0025f..1e75085fe44 100644 --- a/src/sage/coding/guruswami_sudan/interpolation.py +++ b/src/sage/coding/guruswami_sudan/interpolation.py @@ -337,11 +337,13 @@ def lee_osullivan_module(points, parameters, wy): y = PFy.gens()[0] ybasis = [(y-R)**i * G**(s-i) for i in range(0, s+1)] \ + [y**(i-s) * (y-R)**s for i in range(s+1, l+1)] + def pad(lst): return lst + [0]*(l+1-len(lst)) modbasis = [pad(yb.coefficients(sparse=False)) for yb in ybasis] return matrix(PF, modbasis) + def gs_interpolation_lee_osullivan(points, tau, parameters, wy): r""" Returns an interpolation polynomial Q(x,y) for the given input using the diff --git a/src/sage/coding/information_set_decoder.py b/src/sage/coding/information_set_decoder.py index 688966ef062..7e28e1a7aac 100644 --- a/src/sage/coding/information_set_decoder.py +++ b/src/sage/coding/information_set_decoder.py @@ -555,6 +555,7 @@ def calibrate(self): F = C.base_ring() q = F.cardinality() Fstar = F.list()[1:] + def time_information_set_steps(): before = process_time() while True: @@ -565,6 +566,7 @@ def time_information_set_steps(): except ZeroDivisionError: continue return process_time() - before + def time_search_loop(p): y = random_vector(F, n) g = random_matrix(F, p, n).rows() diff --git a/src/sage/combinat/cluster_algebra_quiver/quiver.py b/src/sage/combinat/cluster_algebra_quiver/quiver.py index 91c5a0c394e..bb46c6aa6a1 100644 --- a/src/sage/combinat/cluster_algebra_quiver/quiver.py +++ b/src/sage/combinat/cluster_algebra_quiver/quiver.py @@ -561,6 +561,7 @@ def plot(self, circular=True, center=(0, 0), directed=True, mark=None, from sage.all import e, pi, I graphs = GraphGenerators() # returns positions for graph vertices on two concentric cycles with radius 1 and 2 + def _graphs_concentric_circles(n, m): g1 = graphs.CycleGraph(n).get_pos() g2 = graphs.CycleGraph(m).get_pos() diff --git a/src/sage/crypto/sboxes.py b/src/sage/crypto/sboxes.py index c6b1933213b..056ce082b50 100644 --- a/src/sage/crypto/sboxes.py +++ b/src/sage/crypto/sboxes.py @@ -237,6 +237,7 @@ def bf(x): elif isinstance(bf, (BooleanFunction,)): bf_f2 = bf + def bf(x): xprime = map(int, x.polynomial().list()) xprime += [0]*(n-1 - len(xprime)) diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 4a84ef1edb3..99e5e6311bd 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -645,6 +645,7 @@ def _data_from_iterable(iterable, mapping=False, domain=None, codomain = FindStatCollection(vals) all_elements = set() + def sanitize_pair(elts, vals): if domain.is_element(elts): elts = [elts] @@ -1050,6 +1051,7 @@ def findstat(query=None, values=None, distribution=None, domain=None, raise ValueError("the maximal number of values for a FindStat query must be a non-negative integer less than or equal to %i" % FINDSTAT_MAX_VALUES) check_collection = True + def get_values(raw, domain=None): if callable(raw): known_terms = _data_from_function(raw, domain) @@ -1272,6 +1274,7 @@ def findmap(*args, **kwargs): raise ValueError("the maximal number of values for a FindStat query must be a non-negative integer less than or equal to %i" % FINDSTAT_MAX_VALUES) check_collection = True + def get_values(raw, domain=None, codomain=None): if callable(raw): known_terms = _data_from_function(raw, domain) diff --git a/src/sage/databases/sql_db.py b/src/sage/databases/sql_db.py index 19d579ae38c..d13d1e83940 100644 --- a/src/sage/databases/sql_db.py +++ b/src/sage/databases/sql_db.py @@ -349,6 +349,7 @@ def _create_print_table(cur, col_titles, **kwds): continue global p p = 0 + def row_str(row, html): f = 0 global p diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index a9d11d0863e..bc15e851cb8 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -950,6 +950,7 @@ def filter_sources(self): # Filter the sources to only include those with failing doctests if the --failed option is passed if self.options.failed: self.log("Only doctesting files that failed last test.") + def is_failure(source): basename = source.basename return basename not in self.stats or self.stats[basename].get('failed') @@ -989,6 +990,7 @@ def sort_sources(self): if self.options.nthreads > 1 and len(self.sources) > self.options.nthreads: self.log("Sorting sources by runtime so that slower doctests are run first....") default = dict(walltime=0) + def sort_key(source): basename = source.basename return -self.stats.get(basename, default).get('walltime'), basename diff --git a/src/sage/doctest/fixtures.py b/src/sage/doctest/fixtures.py index 13b3fb40f19..d524899cd26 100644 --- a/src/sage/doctest/fixtures.py +++ b/src/sage/doctest/fixtures.py @@ -372,6 +372,7 @@ def trace_method(obj, meth, **kwds): from sage.cpython.getattr import raw_getattr f = raw_getattr(obj, meth) t = AttributeAccessTracerProxy(obj, **kwds) + @wraps(f) def g(*args, **kwds): arglst = [reproducible_repr(arg) for arg in args] diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py index aace3cc767d..9e384b2bdf7 100644 --- a/src/sage/functions/orthogonal_polys.py +++ b/src/sage/functions/orthogonal_polys.py @@ -2793,6 +2793,7 @@ def eval_formula(self, n, x, b, c): + (3*b^2 + 6*b - 3*b^2/c - 3*b/c - 3*b/c^2 - 2/c^3 + 2)*x + 2*b """ from sage.misc.misc_c import prod + def P(val, k): return prod(val + j for j in range(k)) return sum((-1)**k * binomial(n, k) * binomial(x, k) * factorial(k) diff --git a/src/sage/geometry/triangulation/point_configuration.py b/src/sage/geometry/triangulation/point_configuration.py index 0a0b17cd27a..855d6dbf4be 100644 --- a/src/sage/geometry/triangulation/point_configuration.py +++ b/src/sage/geometry/triangulation/point_configuration.py @@ -1978,6 +1978,7 @@ def placing_triangulation(self, point_order=None): (<0,2,4>, <0,3,4>, <1,2,4>, <1,3,4>) """ facet_normals = dict() + def facets_of_simplex(simplex): """ Return the facets of the simplex and store the normals in facet_normals diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index c2ac473b8d7..9003eb8d375 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -2095,6 +2095,7 @@ def reduced_word(self): in parallel. """ M = self._algebra._indices + def tuple_to_word(q_tuple): return M.prod(self._gens[i] ** exp for i, exp in enumerate(q_tuple)) diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py index 846b8710604..7b235ea647c 100644 --- a/src/sage/groups/cubic_braid.py +++ b/src/sage/groups/cubic_braid.py @@ -1214,6 +1214,7 @@ def create_sympl_realization(self, m): # matrix. # ----------------------------------------------------------- from sage.matrix.constructor import matrix + def transvec2mat(v, bas=bas, bform=bform, fact=1): t = [x + fact*(x * bform * v) * v for x in bas] return matrix(bform.base_ring(), t) @@ -1295,6 +1296,7 @@ def create_unitary_realization(self, m): # matrix. # ----------------------------------------------------------- from sage.matrix.constructor import matrix + def transvec2mat(v, bas=bas, bform=bform, fact=a): # note x does not change under conjugation, since it belongs to standard basis t = [x + fact *(x * bform * v.conjugate()) * v for x in bas] diff --git a/src/sage/homology/chain_complex.py b/src/sage/homology/chain_complex.py index 0f8492d140f..87070944e6a 100644 --- a/src/sage/homology/chain_complex.py +++ b/src/sage/homology/chain_complex.py @@ -1337,6 +1337,7 @@ def _homology_in_degree(self, deg, base_ring, verbose, generators, algorithm): print('Computing homology of the chain complex in dimension %s...' % deg) fraction_field = base_ring.fraction_field() + def change_ring(X): if X.base_ring() is base_ring: return X diff --git a/src/sage/homology/hochschild_complex.py b/src/sage/homology/hochschild_complex.py index 478118b4274..ef68448c685 100644 --- a/src/sage/homology/hochschild_complex.py +++ b/src/sage/homology/hochschild_complex.py @@ -269,6 +269,7 @@ def boundary(self, d): Fd = self.module(d-1) Fd1 = self.module(d) mone = -one + def on_basis(k): p = self._M.monomial(k[0]) * self._A.monomial(k[1]) ret = Fd._from_dict({(m,) + k[2:]: c for m,c in p}, remove_zeros=False) diff --git a/src/sage/interfaces/frobby.py b/src/sage/interfaces/frobby.py index ed852f74efe..68be9c39d01 100644 --- a/src/sage/interfaces/frobby.py +++ b/src/sage/interfaces/frobby.py @@ -211,6 +211,7 @@ def associated_primes(self, monomial_ideal): if lines[-1]=='': lines.pop(-1) lists = [[int(_) for _ in a.split()] for a in lines] + def to_monomial(exps): return [v ** e for v, e in zip(monomial_ideal.ring().gens(), exps) if e != 0] return [monomial_ideal.ring().ideal(to_monomial(a)) for a in lists] @@ -338,8 +339,9 @@ def _parse_ideals(self, string, ring): for i in range(nrows): nmatrix+=lines.pop(0)+'\n' matrices.append(nmatrix) + def to_ideal(exps): - if len(exps)==0: + if len(exps) == 0: return ring.zero_ideal() gens = [prod([v ** e for v, e in zip(ring.gens(), expo) if e != 0]) for expo in exps] return ring.ideal(gens or ring(1)) diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index c6680df23c5..8cc24097d04 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -3918,6 +3918,7 @@ def get_knotinfo(self, mirror_version=True, unique=True): # over :class:`KnotInfo` should be returned non_unique_hint = '\nuse keyword argument `unique` to obtain more details' + def answer(L): r""" Return a single item of the KnotInfo database according to the keyword diff --git a/src/sage/libs/singular/standard_options.py b/src/sage/libs/singular/standard_options.py index 6d2d8044106..4756a6ec1db 100644 --- a/src/sage/libs/singular/standard_options.py +++ b/src/sage/libs/singular/standard_options.py @@ -132,6 +132,7 @@ def libsingular_gb_standard_options(func): does not need to use it manually. """ from sage.misc.decorators import sage_wraps + @sage_wraps(func) def wrapper(*args, **kwds): """ diff --git a/src/sage/manifolds/differentiable/vectorfield.py b/src/sage/manifolds/differentiable/vectorfield.py index 9fb6dfbef14..acf07f25aca 100644 --- a/src/sage/manifolds/differentiable/vectorfield.py +++ b/src/sage/manifolds/differentiable/vectorfield.py @@ -834,7 +834,6 @@ def plot(self, chart=None, ambient_coords=None, mapping=None, extra_options) for ind_part in local_list] - # definition of the parallel function @parallel(p_iter='multiprocessing', ncpus=nproc) def add_point_plot(vector, dom, xx_list, chart_domain, chart, diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py index 639567cd7e0..9e5c12d4cc7 100644 --- a/src/sage/manifolds/subset.py +++ b/src/sage/manifolds/subset.py @@ -971,6 +971,7 @@ def vertex_family(subset): def vertex_family(subset): return ManifoldSubsetFiniteFamily([subset]) subset_to_vertex = {} + def vertex(subset): try: return subset_to_vertex[subset] @@ -2307,6 +2308,7 @@ def _reduce_intersection_members(subsets): subsets = set(subsets) if not subsets: raise TypeError('input set must be nonempty') + def reduce(): # Greedily replace inclusion chains by their minimal element # and pairs with declared intersections by their intersection @@ -2531,6 +2533,7 @@ def _reduce_union_members(subsets): """ subsets = set(subsets) + def reduce(): # Greedily replace inclusion chains by their maximal element # and pairs with declared unions by their union diff --git a/src/sage/misc/explain_pickle.py b/src/sage/misc/explain_pickle.py index 946dd8057c0..cf048094575 100644 --- a/src/sage/misc/explain_pickle.py +++ b/src/sage/misc/explain_pickle.py @@ -2432,6 +2432,7 @@ def unpickle_newobj(klass, args): pickle = b"P0\nP1\n\x81." pers = [klass, args] + def pers_load(id): return pers[int(id)] diff --git a/src/sage/misc/superseded.py b/src/sage/misc/superseded.py index 0d20e025a23..d1e1601d52f 100644 --- a/src/sage/misc/superseded.py +++ b/src/sage/misc/superseded.py @@ -304,6 +304,7 @@ def __call__(self, func): (3,) {'what': 'Hello'} """ from sage.misc.decorators import sage_wraps + @sage_wraps(func) def wrapper(*args, **kwds): if not wrapper._already_issued: diff --git a/src/sage/modular/modform/numerical.py b/src/sage/modular/modform/numerical.py index 47dbdd6762b..2659fe28c14 100644 --- a/src/sage/modular/modform/numerical.py +++ b/src/sage/modular/modform/numerical.py @@ -334,6 +334,7 @@ def _eigendata(self): x = self._easy_vector() B = self._eigenvectors() + def phi(y): """ Take coefficients and a basis, and return that @@ -416,6 +417,7 @@ def eigenvalues(self, primes): raise ValueError('each element of primes must be prime.') phi_x, phi_x_inv, nzp, x_nzp = self._eigendata() B = self._eigenvectors() + def phi(y): """ Take coefficients and a basis, and return that diff --git a/src/sage/modular/modsym/ambient.py b/src/sage/modular/modsym/ambient.py index 3768e65b73f..b28de8d9d5e 100644 --- a/src/sage/modular/modsym/ambient.py +++ b/src/sage/modular/modsym/ambient.py @@ -2473,6 +2473,7 @@ def _pari_pairing(self): m = Integer(self.weight() - 2) R = PolynomialRing(QQ, 'x') x = R.gen() + def ev(s): # The Manin symbol s = X^i (c, d) corresponds to the # modular symbol (dX - bY)^i (-cX + aY)^(m - i) {b/d, a/c}. @@ -2481,7 +2482,7 @@ def ev(s): i = s.i a, b, c, d = s.lift_to_sl2z() e = [R(p) for p in P.mseval(I, matrix(2, 2, [b, a, d, c]))] - g = (d*x - b)**i * (-c*x + a)**(m - i) + g = (d * x - b)**i * (-c * x + a)**(m - i) return [sum(f[j] * g[m - j] / m.binomial(j) for j in range(m + 1)) for f in e] return matrix([ev(s) for s in self.manin_symbols_basis()]) diff --git a/src/sage/modules/filtered_vector_space.py b/src/sage/modules/filtered_vector_space.py index dd5784041eb..6caa2d2aac6 100644 --- a/src/sage/modules/filtered_vector_space.py +++ b/src/sage/modules/filtered_vector_space.py @@ -1003,6 +1003,7 @@ def direct_sum(self, other): generators = \ [ list(v) + [base_ring.zero()]*other.dimension() for v in self_gens ] + \ [ [base_ring.zero()]*self.dimension() + list(v) for v in other_gens ] + # construct the filtration dictionary def join_indices(self_indices, other_indices): self_indices = tuple(self_indices) diff --git a/src/sage/modules/with_basis/morphism.py b/src/sage/modules/with_basis/morphism.py index 7972927406d..37e541ccce7 100644 --- a/src/sage/modules/with_basis/morphism.py +++ b/src/sage/modules/with_basis/morphism.py @@ -849,6 +849,7 @@ def section(self): retract_dom = None else: on_basis = self.on_basis() + def retract_dom(i): self._dominant_item(on_basis(i))[0] diff --git a/src/sage/monoids/indexed_free_monoid.py b/src/sage/monoids/indexed_free_monoid.py index 69168f1e1bd..e6fb1c9e450 100644 --- a/src/sage/monoids/indexed_free_monoid.py +++ b/src/sage/monoids/indexed_free_monoid.py @@ -143,6 +143,7 @@ def _ascii_art_(self): ascii_art_gen = lambda m: P._ascii_art_generator(m[0]) else: pref = AsciiArt([P.prefix()]) + def ascii_art_gen(m): if m[1] != 1: r = (AsciiArt([" " * len(pref)]) + ascii_art(m[1])) diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py index 38e4a784103..74bac3fe12b 100644 --- a/src/sage/parallel/decorate.py +++ b/src/sage/parallel/decorate.py @@ -473,10 +473,12 @@ def __call__(self, f): P = Parallel(p_iter='fork', ncpus=1, timeout=self.timeout, verbose=self.verbose) g = P(f) + def h(*args, **kwds): return list(g([(args, kwds)]))[0][1] return h + def fork(f=None, timeout=0, verbose=False): """ Decorate a function so that when called it runs in a forked diff --git a/src/sage/plot/hyperbolic_polygon.py b/src/sage/plot/hyperbolic_polygon.py index dc43a5a712d..11a090a0fad 100644 --- a/src/sage/plot/hyperbolic_polygon.py +++ b/src/sage/plot/hyperbolic_polygon.py @@ -308,6 +308,7 @@ def hyperbolic_polygon(pts, model="UHP", resolution=200, **options): xlist = [p[0] for p in pts] ylist = [p[1] for p in pts] zlist = [p[2] for p in pts] + def region(x, y, z): return _winding_number(arc_points, (x, y, z)) != 0 g = g + implicit_plot3d(x**2 + y**2 - z**2 == -1, diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py index 89f308fa258..262948c10a9 100644 --- a/src/sage/plot/plot.py +++ b/src/sage/plot/plot.py @@ -690,7 +690,7 @@ def SelectiveFormatter(formatter, skip_values): from matplotlib.ticker import Formatter class _SelectiveFormatterClass(Formatter): - def __init__(self, formatter,skip_values): + def __init__(self, formatter, skip_values): """ Initialize a SelectiveFormatter object. @@ -717,6 +717,7 @@ def __init__(self, formatter,skip_values): """ self.formatter=formatter self.skip_values=skip_values + def set_locs(self, locs): """ Set the locations for the ticks that are not skipped. @@ -729,6 +730,7 @@ def set_locs(self, locs): sage: formatter.set_locs([i*100 for i in range(10)]) """ self.formatter.set_locs([l for l in locs if l not in self.skip_values]) + def __call__(self, x, *args, **kwds): """ Return the format for tick val *x* at position *pos* diff --git a/src/sage/plot/plot3d/plot3d.py b/src/sage/plot/plot3d/plot3d.py index 5fa37f21459..44620a0edcb 100644 --- a/src/sage/plot/plot3d/plot3d.py +++ b/src/sage/plot/plot3d/plot3d.py @@ -404,17 +404,19 @@ def to_cartesian(self, func, params=None): params = ['u', 'v'] else: raise ValueError("function is not callable") + def subs_func(t): # We use eval so that the lambda function has the same # variable names as the original function - ll="""lambda {x},{y}: t.subs({{ + ll = """lambda {x},{y}: t.subs({{ dep_var_dummy: float(func({x}, {y})), indep_var_dummies[0]: float({x}), indep_var_dummies[1]: float({y}) }})""".format(x=params[0], y=params[1]) - return eval(ll,dict(t=t, func=func, dep_var_dummy=dep_var_dummy, - indep_var_dummies=indep_var_dummies)) - return [subs_func(_) for _ in transformation] + return eval(ll, dict(t=t, func=func, + dep_var_dummy=dep_var_dummy, + indep_var_dummies=indep_var_dummies)) + return [subs_func(m) for m in transformation] def __repr__(self): """ diff --git a/src/sage/quadratic_forms/quadratic_form__theta.py b/src/sage/quadratic_forms/quadratic_form__theta.py index ba9bcebcd53..9fae946fae5 100644 --- a/src/sage/quadratic_forms/quadratic_form__theta.py +++ b/src/sage/quadratic_forms/quadratic_form__theta.py @@ -402,6 +402,7 @@ def theta_series_degree_2(Q, prec): for c in range(a, c_max + 1): for v1 in v_list[a]: v1_H = v1 * H + def B_v1(v): return v1_H * v2 for v2 in v_list[c]: diff --git a/src/sage/repl/ipython_kernel/widgets_sagenb.py b/src/sage/repl/ipython_kernel/widgets_sagenb.py index 8d49ec8c9de..2ce59d79a3b 100644 --- a/src/sage/repl/ipython_kernel/widgets_sagenb.py +++ b/src/sage/repl/ipython_kernel/widgets_sagenb.py @@ -264,6 +264,7 @@ def slider(vmin, vmax=None, step_size=None, default=None, label=None, display_va raise NotImplementedError("range_slider does not support a list of values") options = list(vmin) # Find default in options + def err(v): if v is default: return (-1, 0) diff --git a/src/sage/repl/rich_output/backend_ipython.py b/src/sage/repl/rich_output/backend_ipython.py index 2b816b96e6a..981ecdf2cb1 100644 --- a/src/sage/repl/rich_output/backend_ipython.py +++ b/src/sage/repl/rich_output/backend_ipython.py @@ -420,6 +420,7 @@ def threejs_offline_scripts(self): if sys.platform == 'cygwin': import cygwin + def normpath(p): return 'file:///' + cygwin.cygpath(p, 'w').replace('\\', '/') script = normpath(script) diff --git a/src/sage/rings/padics/local_generic.py b/src/sage/rings/padics/local_generic.py index a468efdbdec..bc2b6439f6f 100644 --- a/src/sage/rings/padics/local_generic.py +++ b/src/sage/rings/padics/local_generic.py @@ -380,6 +380,7 @@ def change(self, **kwds): for atr in ('print_mode', 'print_pos', 'print_sep', 'print_alphabet'): if atr in kwds: kwds[atr[6:]] = kwds.pop(atr) + def get_unramified_modulus(q, res_name): from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF return GF(q, res_name).modulus().change_ring(ZZ) diff --git a/src/sage/schemes/curves/zariski_vankampen.py b/src/sage/schemes/curves/zariski_vankampen.py index 46ebbbc708f..f2ab4c69307 100644 --- a/src/sage/schemes/curves/zariski_vankampen.py +++ b/src/sage/schemes/curves/zariski_vankampen.py @@ -1021,14 +1021,15 @@ def fundamental_group(f, simplified=True, projective=False): bm = braid_monodromy(f) n = bm[0].parent().strands() F = FreeGroup(n) + @parallel - def relation(x,b): - return x*b/x - relations = list(relation([(x,b) for x in F.gens() for b in bm])) + def relation(x, b): + return x * b / x + relations = list(relation([(x, b) for x in F.gens() for b in bm])) R = [r[1] for r in relations] if projective: R.append(prod(F.gens())) - G = F/R + G = F / R if simplified: return G.simplified() return G diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py index db5017470c8..7ed22dcdd61 100644 --- a/src/sage/schemes/riemann_surfaces/riemann_surface.py +++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py @@ -1808,10 +1808,11 @@ def local_N(ct, rt): ct_minus_rt = ct-rt two_rt = 2*rt + def integrand(t): - zt, wt = zwt(ct_minus_rt+t*two_rt) + zt, wt = zwt(ct_minus_rt + t * two_rt) dfdwt = self._fastcall_dfdw(zt, wt) - return V([h(zt,wt)/dfdwt for h in differentials]) + return V([h(zt, wt) / dfdwt for h in differentials]) output += two_rt*integrate_vector_N(integrand, self._prec, lN) diff --git a/src/sage/sets/image_set.py b/src/sage/sets/image_set.py index 587dd1a8014..8e9c48ce686 100644 --- a/src/sage/sets/image_set.py +++ b/src/sage/sets/image_set.py @@ -65,6 +65,7 @@ def __init__(self, map, domain_subset, *, category=None, is_injective=None): if len(map.arguments()) != 1: domain = FreeModule(domain, len(map.arguments())) function = map + def map(arg): return function(*arg) else: diff --git a/src/sage/sets/real_set.py b/src/sage/sets/real_set.py index 0cf6f27fc28..5e4c0d0cb97 100644 --- a/src/sage/sets/real_set.py +++ b/src/sage/sets/real_set.py @@ -1129,6 +1129,7 @@ def __classcall__(cls, *args, **kwds): intervals.extend(arg._intervals) elif isinstance(arg, Expression) and arg.is_relational(): from operator import eq, ne, lt, gt, le, ge + def rel_to_interval(op, val): """ Internal helper function. diff --git a/src/sage/tensor/modules/free_module_tensor.py b/src/sage/tensor/modules/free_module_tensor.py index b9bfb79eeef..bbcc1ecb2e0 100644 --- a/src/sage/tensor/modules/free_module_tensor.py +++ b/src/sage/tensor/modules/free_module_tensor.py @@ -1149,6 +1149,7 @@ class :class:`~sage.tensor.modules.comp.Components` local_list = lol(ind_list, ind_step) # list of input parameters listParalInput = [(old_comp, ppinv, pp, n_con, rank, ii) for ii in local_list] + @parallel(p_iter='multiprocessing', ncpus=nproc) def paral_newcomp(old_comp, ppinv, pp, n_con, rank, local_list_ind): partial = [] diff --git a/src/sage_docbuild/ext/multidocs.py b/src/sage_docbuild/ext/multidocs.py index f91c7753ca3..39121ef90ac 100644 --- a/src/sage_docbuild/ext/multidocs.py +++ b/src/sage_docbuild/ext/multidocs.py @@ -205,6 +205,7 @@ def fix_path_html(app, pagename, templatename, ctx, event_arg): # def pathto(otheruri, resource=False, # baseuri=self.get_target_uri(pagename)): old_pathto = ctx['pathto'] + def sage_pathto(otheruri, *args, **opts): if otheruri in mustbefixed: otheruri = os.path.join("..", otheruri) From 48c3e10e38aabee3c499f92f10518c8d0872713b Mon Sep 17 00:00:00 2001 From: Xavier Caruso Date: Thu, 2 Jun 2022 12:05:37 +0200 Subject: [PATCH 247/338] fix geometric Frobenius --- src/sage/libs/linkages/padics/unram_shared.pxi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sage/libs/linkages/padics/unram_shared.pxi b/src/sage/libs/linkages/padics/unram_shared.pxi index bcd76ad3123..10a2f5adde8 100644 --- a/src/sage/libs/linkages/padics/unram_shared.pxi +++ b/src/sage/libs/linkages/padics/unram_shared.pxi @@ -28,6 +28,10 @@ def frobenius_unram(self, arithmetic=True): sage: a a + O(5^3) + sage: R. = Zq(5^4,3) + sage: a.frobenius(arithmetic=False) + (3*a^3 + 3*a^2 + a) + (a^3 + 4*a^2 + a + 4)*5 + (3*a^2 + 2*a + 3)*5^2 + O(5^3) + sage: K. = Qq(7^3,4) sage: b = (a+1)/7 sage: c = b.frobenius(); c @@ -42,13 +46,22 @@ def frobenius_unram(self, arithmetic=True): Traceback (most recent call last): ... NotImplementedError: Frobenius automorphism only implemented for unramified extensions + + TESTS:: + + We check that :trac:`23575` is resolved: + + sage: x = R.random_element() + sage: x.frobenius(arithmetic=false).frobenius() == x + True + """ if self == 0: return self R = self.parent() p = R.prime() a = R.gen() - frob_a = R._frob_gen() + frob_a = R._frob_gen(arithmetic) ppow = self.valuation() unit = self.unit_part() coefs = unit.expansion() From 10bf02a1cbd35ca583a68923980f6c94a9136ab2 Mon Sep 17 00:00:00 2001 From: Xavier Caruso Date: Thu, 2 Jun 2022 14:00:34 +0200 Subject: [PATCH 248/338] add doctest --- src/sage/rings/padics/padic_ZZ_pX_element.pyx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/padics/padic_ZZ_pX_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_element.pyx index eed82ac8031..1a523e8a98d 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_element.pyx @@ -483,6 +483,17 @@ cdef class pAdicZZpXElement(pAdicExtElement): 4*5 + 5^2 + 5^3 + 2*5^4 sage: (a+b).trace() 4*5 + 5^2 + 5^3 + 2*5^4 + + TESTS:: + + We check that :trac:`32072` is resolved:: + + sage: F = Qp(2) + sage: S. = F[] + sage: L. = F.ext(x^2 - 2) + sage: L(0, 20).trace() + O(2^10) + """ if base is not None: if base is self.parent(): @@ -492,7 +503,7 @@ cdef class pAdicZZpXElement(pAdicExtElement): if self._is_exact_zero(): return self.parent().ground_ring()(0) elif self._is_inexact_zero(): - return self.ground_ring(0, (self.valuation() - 1) // self.parent().e() + 1) + return self.parent().ground_ring()(0, (self.valuation() - 1) // self.parent().e() + 1) if self.valuation() >= 0: return self.parent().ground_ring()(self.matrix_mod_pn().trace()) else: From 8091a7b01b59dbf50b3fa0563db58fed15e9464d Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Thu, 2 Jun 2022 17:03:19 +0200 Subject: [PATCH 249/338] update memory allocator to 0.1.3 --- build/pkgs/memory_allocator/checksums.ini | 6 +++--- build/pkgs/memory_allocator/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/memory_allocator/checksums.ini b/build/pkgs/memory_allocator/checksums.ini index fe48843d873..c907031eac5 100644 --- a/build/pkgs/memory_allocator/checksums.ini +++ b/build/pkgs/memory_allocator/checksums.ini @@ -1,5 +1,5 @@ tarball=memory_allocator-VERSION.tar.gz -sha1=7721219be84207f6112e118fc79af0c2729fca34 -md5=868753a09c44194cba303db89cca4396 -cksum=16627262 +sha1=1a874de2674a1948797de109adfd1f56193e153a +md5=c3a5d0f5acf896eec84266964a8aec0e +cksum=3431157422 upstream_url=https://pypi.io/packages/source/m/memory_allocator/memory_allocator-VERSION.tar.gz diff --git a/build/pkgs/memory_allocator/package-version.txt b/build/pkgs/memory_allocator/package-version.txt index 17e51c385ea..b1e80bb2480 100644 --- a/build/pkgs/memory_allocator/package-version.txt +++ b/build/pkgs/memory_allocator/package-version.txt @@ -1 +1 @@ -0.1.1 +0.1.3 From 5f5479b1f0cdfb5d2769783fe5e474dd475063bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 2 Jun 2022 19:09:27 +0200 Subject: [PATCH 250/338] fix E306 in rings/ and algebras/ --- src/sage/algebras/askey_wilson.py | 2 ++ src/sage/algebras/clifford_algebra.py | 1 + src/sage/algebras/free_algebra.py | 1 + src/sage/algebras/free_algebra_element.py | 3 ++- .../algebras/hecke_algebras/ariki_koike_algebra.py | 2 ++ src/sage/algebras/lie_algebras/heisenberg.py | 3 ++- .../algebras/lie_algebras/poincare_birkhoff_witt.py | 5 ++++- .../algebras/lie_algebras/symplectic_derivation.py | 3 +++ src/sage/algebras/lie_algebras/verma_module.py | 1 + src/sage/algebras/q_system.py | 2 ++ src/sage/algebras/quantum_groups/fock_space.py | 4 ++++ src/sage/algebras/rational_cherednik_algebra.py | 1 + src/sage/algebras/weyl_algebra.py | 4 ++++ src/sage/rings/asymptotic/asymptotic_ring.py | 5 ++++- src/sage/rings/asymptotic/misc.py | 1 + src/sage/rings/function_field/order.py | 5 +++-- src/sage/rings/function_field/place.py | 4 ++++ src/sage/rings/lazy_series.py | 12 +++++++++++- src/sage/rings/polynomial/laurent_polynomial_ring.py | 2 ++ 19 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/sage/algebras/askey_wilson.py b/src/sage/algebras/askey_wilson.py index 2ab7747322e..33014835bf0 100644 --- a/src/sage/algebras/askey_wilson.py +++ b/src/sage/algebras/askey_wilson.py @@ -300,6 +300,7 @@ def _latex_term(self, t): """ if sum(t) == 0: return '1' + def exp(l, e): if e == 0: return '' @@ -338,6 +339,7 @@ def algebra_generators(self): [A, B, C, a, b, g] """ A = self.variable_names() + def build_monomial(g): exp = [0] * 6 exp[A.index(g)] = 1 diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index ff0065c5fcd..4f4030c5d0e 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -1963,6 +1963,7 @@ def lifted_bilinear_form(self, M): back are implemented, check if this is faster. """ R = self.base_ring() + def lifted_form(x, y): result = R.zero() for mx, cx in x: diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 06cc97dc106..73ee20dd595 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -591,6 +591,7 @@ def _element_constructor_(self, x): if self.has_coerce_map_from(P): # letterplace versus generic ngens = P.ngens() M = self._indices + def exp_to_monomial(T): out = [] for i in range(len(T)): diff --git a/src/sage/algebras/free_algebra_element.py b/src/sage/algebras/free_algebra_element.py index 2748f4b5ed2..8b7c39873c6 100644 --- a/src/sage/algebras/free_algebra_element.py +++ b/src/sage/algebras/free_algebra_element.py @@ -150,7 +150,8 @@ def __call__(self, *x, **kwds): if kwds: p = self.parent() - def extract_from(kwds,g): + + def extract_from(kwds, g): for x in g: try: return kwds[x] diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index 7ca1bea8c2b..3cfb9c2c1d6 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -1688,6 +1688,7 @@ def _product_TT(self, kp, a, k, b): T[kp] = a + b return self._from_dict({(tuple(T), self._one_perm): one}, remove_zeros=False, coerce=False) + def key(exp): if exp > 0 or kp == 0: T = list(self._zero_tuple) @@ -1715,6 +1716,7 @@ def key(exp): T[kp] = a ret = {(tuple(T), s1): one} zero = self.base_ring().zero() + def T_index(exp, ind, i, indp): T = list(self._zero_tuple) T[ind] = exp diff --git a/src/sage/algebras/lie_algebras/heisenberg.py b/src/sage/algebras/lie_algebras/heisenberg.py index fa78659c35e..b2f81946a32 100644 --- a/src/sage/algebras/lie_algebras/heisenberg.py +++ b/src/sage/algebras/lie_algebras/heisenberg.py @@ -482,8 +482,9 @@ def basis(self): sage: L.basis()[(12, 'p')] p12 """ - S = cartesian_product([PositiveIntegers(), ['p','q']]) + S = cartesian_product([PositiveIntegers(), ['p', 'q']]) I = DisjointUnionEnumeratedSets([Set(['z']), S]) + def basis_elt(x): if isinstance(x, str): return self.monomial(x) diff --git a/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py b/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py index c8e313581c6..34df1d3281f 100644 --- a/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py +++ b/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py @@ -343,6 +343,7 @@ def inv_supp(m): if isinstance(R, PoincareBirkhoffWittBasis): if self._g == R._g: I = self._indices + def basis_function(x): return self.prod(self.monomial(I.gen(g)**e) for g,e in x._sorted_items()) # TODO: this diagonal, but with a smaller indexing set... @@ -351,8 +352,10 @@ def basis_function(x): if coerce_map: I = self._indices lift = self.coerce_map_from(self._g) + def basis_function(x): - return self.prod(lift(coerce_map(g))**e for g,e in x._sorted_items()) + return self.prod(lift(coerce_map(g))**e + for g, e in x._sorted_items()) # TODO: this diagonal, but with a smaller indexing set... return R.module_morphism(basis_function, codomain=self) diff --git a/src/sage/algebras/lie_algebras/symplectic_derivation.py b/src/sage/algebras/lie_algebras/symplectic_derivation.py index 12d79fbc04c..afaf5561b80 100644 --- a/src/sage/algebras/lie_algebras/symplectic_derivation.py +++ b/src/sage/algebras/lie_algebras/symplectic_derivation.py @@ -137,6 +137,7 @@ def _repr_term(self, m): 'a1*a2*a5*b2' """ g = self._g + def label(i): return "a{}".format(i) if i <= g else "b{}".format(i-g) return "*".join(label(i) for i in reversed(m)) @@ -152,6 +153,7 @@ def _latex_term(self, m): 'a_{1} a_{2} a_{5} b_{2}' """ g = self._g + def label(i): return "a_{{{}}}".format(i) if i <= g else "b_{{{}}}".format(i-g) return " ".join(label(i) for i in reversed(m)) @@ -168,6 +170,7 @@ def _unicode_art_term(self, m): """ from sage.typeset.unicode_art import unicode_art, unicode_subscript g = self._g + def label(i): return "a{}".format(unicode_subscript(i)) if i <= g else "b{}".format(unicode_subscript(i-g)) return unicode_art("·".join(label(i) for i in reversed(m))) diff --git a/src/sage/algebras/lie_algebras/verma_module.py b/src/sage/algebras/lie_algebras/verma_module.py index 148aeb6a59e..2ba5da72c2c 100644 --- a/src/sage/algebras/lie_algebras/verma_module.py +++ b/src/sage/algebras/lie_algebras/verma_module.py @@ -563,6 +563,7 @@ def _homogeneous_component_f(self, d): f = {i: self._pbw(g) for i,g in enumerate(self._g.f())} basis = d.parent().basis() # Standard basis vectors ret = set() + def degree(m): m = m.dict() if not m: diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index bbbf71e42cf..3aea736244b 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -213,6 +213,7 @@ def _repr_term(self, t): """ if len(t) == 0: return '1' + def repr_gen(x): ret = 'Q^({})[{}]'.format(*(x[0])) if x[1] > 1: @@ -234,6 +235,7 @@ def _latex_term(self, t): """ if len(t) == 0: return '1' + def repr_gen(x): ret = 'Q^{{({})}}_{{{}}}'.format(*(x[0])) if x[1] > 1: diff --git a/src/sage/algebras/quantum_groups/fock_space.py b/src/sage/algebras/quantum_groups/fock_space.py index 33e9eb0d686..978a996125d 100644 --- a/src/sage/algebras/quantum_groups/fock_space.py +++ b/src/sage/algebras/quantum_groups/fock_space.py @@ -744,6 +744,7 @@ def _e(self, i): |[2, 1], [1], [1]> """ P = self.parent() + def N_left(la, x, i): return (sum(1 for y in P._addable(la, i) if P._above(x, y)) - sum(1 for y in P._removable(la, i) if P._above(x, y))) @@ -839,6 +840,7 @@ def _f(self, i): + q^2*|[3, 1], [1, 1, 1], [5, 2, 2]> """ P = self.parent() + def N_right(la, x, i): return (sum(1 for y in P._addable(la, i) if P._above(y, x)) - sum(1 for y in P._removable(la, i) if P._above(y, x))) @@ -1798,6 +1800,7 @@ def _f(self, i): |5> + |3, 2> + 2*q*|3, 1, 1> + q^2*|2, 2, 1> """ P = self.parent() + def N_right(la, x, i): return (sum(1 for y in P._addable(la, i) if P._above(y, x)) - sum(1 for y in P._removable(la, i) if P._above(y, x))) @@ -2173,6 +2176,7 @@ def _G_to_fock_basis(self, la, algorithm='GW'): if len(la) == k: x = la[-1] mu = _Partitions([p - x for p in la]) + def add_cols(nu): return _Partitions([ v + x for v in list(nu) + [0]*(k - len(nu)) ]) return fock.sum_of_terms((add_cols(nu), c) for nu,c in self._G_to_fock_basis(mu)) diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index 93965c63878..204fcfc6020 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -240,6 +240,7 @@ def algebra_generators(self): keys = ['a'+str(i) for i in self._cartan_type.index_set()] keys += ['s'+str(i) for i in self._cartan_type.index_set()] keys += ['ac'+str(i) for i in self._cartan_type.index_set()] + def gen_map(k): if k[0] == 's': i = int(k[1:]) diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index 21cf81c0b84..c43cc7839dd 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -204,6 +204,7 @@ def repr_factored(w, latex_output=False): if latex_output: def exp(e): return '^{{{}}}'.format(e) if e > 1 else '' + def repr_dx(k): total = sum(k) if total == 0: @@ -215,6 +216,7 @@ def repr_dx(k): else: def exp(e): return '^{}'.format(e) if e > 1 else '' + def repr_dx(k): return ''.join('*d{}{}'.format(g, exp(e)) for e, g in zip(k, gens) if e != 0) repr_x = repr @@ -259,6 +261,7 @@ def _repr_(self): """ if self.parent().options.factor_representation: return repr_factored(self, False) + def term(m): ret = '' for i, power in enumerate(m[0] + m[1]): @@ -301,6 +304,7 @@ def exp(e): def term(m): R = self.parent()._poly_ring + def half_term(mon, polynomial): total = sum(mon) if total == 0: diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index 8233d1f7cc4..64a35142397 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -1453,6 +1453,7 @@ def truncate(self, precision=None): return self summands = self.summands.copy() + def convert_terms(element): if convert_terms.count < precision: convert_terms.count += 1 @@ -1463,7 +1464,6 @@ def convert_terms(element): summands.map(convert_terms, topological=True, reverse=True) return self.parent()(summands, simplify=True, convert=False) - def exact_part(self): r""" Return the expansion consisting of all exact terms of this @@ -1864,6 +1864,7 @@ def __pow_number__(self, exponent, precision=None, check_convergence=False): pmax = self.parent()(max_elem)**exponent import itertools + def binomials(a): P = a.parent() a = a + 1 @@ -2910,6 +2911,7 @@ def compare_with_values(self, variable, function, values, "variable".format(expr)) elif len(vars) == 1: v = vars[0] + def function(arg): return expr.subs({v: arg}) else: @@ -3707,6 +3709,7 @@ def __classcall__(cls, growth_group=None, coefficient_ring=None, raise ValueError('%s is not a ring. Cannot continue.' % (coefficient_ring,)) strgens = tuple(str(g) for g in growth_group.gens_monomial()) + def format_names(N): return ('s ' if len(N) != 1 else ' ') + ', '.join("'%s'" % n for n in N) if names and not strgens: diff --git a/src/sage/rings/asymptotic/misc.py b/src/sage/rings/asymptotic/misc.py index 32ca1e90c1e..f639cfbdeed 100644 --- a/src/sage/rings/asymptotic/misc.py +++ b/src/sage/rings/asymptotic/misc.py @@ -148,6 +148,7 @@ def parent_to_repr_short(P): from sage.rings.polynomial.polynomial_ring import is_PolynomialRing from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing from sage.rings.power_series_ring import is_PowerSeriesRing + def abbreviate(P): try: return P._repr_short_() diff --git a/src/sage/rings/function_field/order.py b/src/sage/rings/function_field/order.py index 7b0841e235f..745690401cd 100644 --- a/src/sage/rings/function_field/order.py +++ b/src/sage/rings/function_field/order.py @@ -1266,8 +1266,9 @@ def __init__(self, field, ideal_class=FunctionFieldIdeal_polymod): row.append(self._coordinate_vector(basis[i] * basis[j])) self._mtable.append(row) - zero = vector(R._ring,n*[0]) - def mul_vecs(f,g): + zero = vector(R._ring, n * [0]) + + def mul_vecs(f, g): s = zero for i in range(n): if f[i].is_zero(): diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index eff0c07469f..190d0329efc 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -1046,8 +1046,10 @@ def candidates(): if name is None: name='s' K = k.extension(min_poly, names=name) + def from_W(e): return K(list(e)) + def to_W(e): return vector(K(e)) else: @@ -1059,8 +1061,10 @@ def to_W(e): W, from_W, to_W = K.vector_space(k, basis=[prim**i for i in range(deg)], map=True) else: # deg == 1 K = k + def from_W(e): return K(e[0]) + def to_W(e): return vector([e]) diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 01b55b773f7..a07327a07da 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -1522,6 +1522,7 @@ def arcsin(self): """ from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 2: @@ -1583,6 +1584,7 @@ def arctan(self): """ from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 4 == 1: @@ -1704,6 +1706,7 @@ def tanh(self): from sage.arith.misc import bernoulli from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 2: @@ -1734,6 +1737,7 @@ def coth(self): from sage.arith.misc import bernoulli from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 2: @@ -1766,6 +1770,7 @@ def sech(self): from sage.combinat.combinat import euler_number from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 2: @@ -1797,6 +1802,7 @@ def csch(self): from sage.arith.misc import bernoulli from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 2: @@ -1831,6 +1837,7 @@ def arcsinh(self): """ from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def f(n): n = ZZ(n) if n % 2: @@ -1894,12 +1901,13 @@ def hypergeometric(self, a, b): from .lazy_series_ring import LazyLaurentSeriesRing from sage.arith.misc import rising_factorial P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) + def coeff(n, c): num = 1 for term in range(len(c)): num *= rising_factorial(c[term], n) return num - f = P(lambda n: coeff(n, a)/(coeff(n, b) * factorial(ZZ(n))), + f = P(lambda n: coeff(n, a) / (coeff(n, b) * factorial(ZZ(n))), valuation=0) return f(self) @@ -2823,6 +2831,7 @@ def __call__(self, g): raise ValueError("can only compose with a positive valuation series") g._coeff_stream._approximate_order = 2 # we assume that the valuation of self[i](g) is at least i + def coefficient(n): return sum(self[i] * (g**i)[n] for i in range(n+1)) coeff_stream = Stream_function(coefficient, P._coeff_ring, P._sparse, 1) @@ -3322,6 +3331,7 @@ def __call__(self, p): b, a = p if a < 0: raise ValueError("the leading coefficient must be positive") + def coefficient(m): m = ZZ(m) try: diff --git a/src/sage/rings/polynomial/laurent_polynomial_ring.py b/src/sage/rings/polynomial/laurent_polynomial_ring.py index 399fb2838b4..9f9948bb84b 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_ring.py +++ b/src/sage/rings/polynomial/laurent_polynomial_ring.py @@ -301,8 +301,10 @@ def _split_dict_(D, indices, group_by=None): class SplitDictError(ValueError): pass + def get(T, i): return T[i] if i is not None else 0 + def extract(T, indices): return tuple(get(T, i) for i in indices) From 088bdcd9456df899235b6738b91e99750c2a1459 Mon Sep 17 00:00:00 2001 From: Xavier Caruso Date: Thu, 2 Jun 2022 22:06:07 +0200 Subject: [PATCH 251/338] remove colon --- src/sage/rings/padics/padic_ZZ_pX_element.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/padics/padic_ZZ_pX_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_element.pyx index 1a523e8a98d..a450f28de65 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_element.pyx @@ -484,7 +484,7 @@ cdef class pAdicZZpXElement(pAdicExtElement): sage: (a+b).trace() 4*5 + 5^2 + 5^3 + 2*5^4 - TESTS:: + TESTS: We check that :trac:`32072` is resolved:: From 8238b49ecd1afd79a63ee8f5adf80ab6d9f16e9c Mon Sep 17 00:00:00 2001 From: Xavier Caruso Date: Thu, 2 Jun 2022 22:30:32 +0200 Subject: [PATCH 252/338] add normalize --- src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx index eca79a2d8aa..c4ecd6e8c19 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx @@ -2781,6 +2781,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): sage: list(A(0,4).expansion()) [] """ + self._normalize() if lift_mode == 'teichmuller': zero = self.parent()(0) elif self.prime_pow.e == 1: From daf528e683fa739c38abc64d8d5b3af1b4d2dbb7 Mon Sep 17 00:00:00 2001 From: Xavier Caruso Date: Thu, 2 Jun 2022 22:33:30 +0200 Subject: [PATCH 253/338] add doctest --- src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx index c4ecd6e8c19..6a47bf86a1d 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx @@ -2780,6 +2780,17 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): [] sage: list(A(0,4).expansion()) [] + + TESTS: + + We check that :trac:`24949` is fixed:: + + sage: R. = Zp(2).extension(x^10 + 2) + sage: x = a^4 + a^5 + sage: y = a^2 + a^3 + sage: z = x - y^2 + sage: z.expansion(4) + 0 """ self._normalize() if lift_mode == 'teichmuller': From 56d0e0eb4677bfe03524f0bfb5bf3d5eaba3a4a5 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Thu, 2 Jun 2022 22:45:11 -0400 Subject: [PATCH 254/338] src/sage/modular/overconvergent/hecke_series.py: fix failing doctests --- src/sage/modular/overconvergent/hecke_series.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sage/modular/overconvergent/hecke_series.py b/src/sage/modular/overconvergent/hecke_series.py index 36bf374095c..5b7f9de4419 100644 --- a/src/sage/modular/overconvergent/hecke_series.py +++ b/src/sage/modular/overconvergent/hecke_series.py @@ -234,9 +234,10 @@ def low_weight_generators(N,p,m,NN): sage: low_weight_generators(11, 5, 3, 10) ([[1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + 36*q^8 + 36*q^9 + O(q^10), q + 123*q^2 + 124*q^3 + 2*q^4 + q^5 + 2*q^6 + 123*q^7 + 123*q^9 + O(q^10)], - [q + 116*q^4 + 115*q^5 + 102*q^6 + 121*q^7 + 96*q^8 + 106*q^9 + O(q^10)]], 4) + [1 + O(q^10)]], + 4) """ - M = ModularFormsRing(N, base_ring=Zmod(p)) + M = ModularFormsRing(N) b = M.gen_forms(maxweight=8) From 257b7b5b92d6a289102ee68a6073953268d0cbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 3 Jun 2022 08:51:19 +0200 Subject: [PATCH 255/338] fix pycodestyle E306 in all pyx files --- src/sage/coding/ag_code_decoders.pyx | 1 + .../combinat/crystals/tensor_product_element.pyx | 1 + src/sage/combinat/matrices/dancing_links.pyx | 3 +++ src/sage/ext/fast_callable.pyx | 1 + .../polyhedron/combinatorial_polyhedron/base.pyx | 3 +++ src/sage/graphs/graph_coloring.pyx | 5 +++++ src/sage/graphs/strongly_regular_db.pyx | 15 ++++++++++----- src/sage/misc/c3_controlled.pyx | 1 + src/sage/misc/session.pyx | 1 + src/sage/misc/stopgap.pyx | 4 +++- src/sage/numerical/backends/generic_backend.pyx | 3 +++ src/sage/rings/finite_rings/finite_field_base.pyx | 1 + src/sage/rings/morphism.pyx | 1 + .../polynomial/skew_polynomial_finite_field.pyx | 8 ++++---- src/sage/rings/ring_extension.pyx | 1 + src/sage/rings/ring_extension_element.pyx | 1 + src/sage/rings/tate_algebra_element.pyx | 1 + 17 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/sage/coding/ag_code_decoders.pyx b/src/sage/coding/ag_code_decoders.pyx index cdf8cdcfe37..2c0390c5f67 100644 --- a/src/sage/coding/ag_code_decoders.pyx +++ b/src/sage/coding/ag_code_decoders.pyx @@ -1519,6 +1519,7 @@ cdef class Decoder_K(object): if verbose: width = 7 * (K.degree() + 2) + # auxiliary function for verbose printing def vprint_g(g, s): if verbose > 1: diff --git a/src/sage/combinat/crystals/tensor_product_element.pyx b/src/sage/combinat/crystals/tensor_product_element.pyx index 98083ecc9e4..b7f60016ecc 100644 --- a/src/sage/combinat/crystals/tensor_product_element.pyx +++ b/src/sage/combinat/crystals/tensor_product_element.pyx @@ -1857,6 +1857,7 @@ cdef class InfinityQueerCrystalOfTableauxElement(TensorProductOfQueerSuperCrysta n = self._parent._cartan_type.n + 1 zero = self._parent.weight_lattice_realization().zero() La = self._parent.weight_lattice_realization().fundamental_weights() + def fwt(i): return zero if i == n else La[i] ret -= sum((self._row_lengths[i] - 1 - self._row_lengths[i+1])*(fwt(n-i)-fwt(n-i-1)) diff --git a/src/sage/combinat/matrices/dancing_links.pyx b/src/sage/combinat/matrices/dancing_links.pyx index 93859dce9b9..953b5c4e680 100644 --- a/src/sage/combinat/matrices/dancing_links.pyx +++ b/src/sage/combinat/matrices/dancing_links.pyx @@ -666,6 +666,7 @@ cdef class dancing_linksWrapper: "where ncols={}".format(column, self.ncols())) from sage.parallel.decorate import parallel + @parallel(ncpus=ncpus) def first_solution(i): dlx = self.restrict([i]) @@ -782,6 +783,7 @@ cdef class dancing_linksWrapper: "where ncols={}".format(column, self.ncols())) from sage.parallel.decorate import parallel + @parallel(ncpus=ncpus) def all_solutions(i): dlx = self.restrict([i]) @@ -881,6 +883,7 @@ cdef class dancing_linksWrapper: "where ncols={}".format(column, self.ncols())) from sage.parallel.decorate import parallel + @parallel(ncpus=ncpus) def nb_sol(i): dlx = self.restrict([i]) diff --git a/src/sage/ext/fast_callable.pyx b/src/sage/ext/fast_callable.pyx index 888275e7a78..8582818697e 100644 --- a/src/sage/ext/fast_callable.pyx +++ b/src/sage/ext/fast_callable.pyx @@ -443,6 +443,7 @@ def fast_callable(x, domain=None, vars=None, vars = ['EXTRA_VAR0'] else: raise ValueError("list of variables must be specified for symbolic expressions") + def to_var(var): if isinstance(var, Expression_abc) and var.is_symbol(): return var diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 02ebcf1c79d..9811970ed29 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -1247,6 +1247,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Getting the indices of the `i`-th edge. def vertex_one(size_t i): return f(self._get_edge(self._edges, i, 0)) + def vertex_two(size_t i): return f(self._get_edge(self._edges, i, 1)) @@ -1472,6 +1473,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Getting the indices of the `i`-th ridge. def facet_one(size_t i): return f(self._get_edge(self._ridges, i, 0)) + def facet_two(size_t i): return f(self._get_edge(self._ridges, i, 1)) @@ -2916,6 +2918,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Getting the indices of the `i`-th incidence. def face_one(size_t i): return smallInteger(self._get_edge(incidences, i, 0)) + def face_two(size_t i): return smallInteger(self._get_edge(incidences, i, 1)) diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index 8d6416be3bd..1fba8c13e2c 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -1501,6 +1501,7 @@ def round_robin(n): """ if n <= 1: raise ValueError("there must be at least two vertices in the graph") + def my_mod(x, y): return x - y * (x // y) if not n % 2: @@ -1701,12 +1702,14 @@ def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False, if hex_colors: answer = [[] for i in range(k)] + def add(uv, i): return answer[i].append(uv) else: gg = copy(g) gg.delete_edges(g.edge_iterator()) answer = [copy(gg) for i in range(k)] + def add(uv, i): return answer[i].add_edge(uv) @@ -1952,12 +1955,14 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, if hex_colors: answer = [[] for i in range(k)] + def add(uv, i): return answer[i].append(uv) else: gg = copy(g) gg.delete_edges(g.edge_iterator()) answer = [copy(gg) for i in range(k)] + def add(uv, i): return answer[i].add_edge(uv) diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index d98a5f553c4..16b2506e545 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -956,9 +956,11 @@ def is_complete_multipartite(int v,int k,int l,int mu): r = v//(v-k) # number of parts (of size v-k each) if l==(v-k)*(r-2) and k==mu and v == r*(v-k): from sage.graphs.generators.basic import CompleteMultipartiteGraph + def CompleteMultipartiteSRG(nparts, partsize): - return CompleteMultipartiteGraph([partsize]*nparts) - return (CompleteMultipartiteSRG, r, v-k) + return CompleteMultipartiteGraph([partsize] * nparts) + return (CompleteMultipartiteSRG, r, v - k) + @cached_function def is_polhill(int v,int k,int l,int mu): @@ -1484,6 +1486,7 @@ def is_twograph_descendant_of_srg(int v, int k0, int l, int mu): strongly_regular_graph(v+1, k, l - 2*mu + k , k - mu, existence=True) is True: try: g = strongly_regular_graph_lazy(v+1, k, l - 2*mu + k) # Sage might not know how to build g + def la(*gr): from sage.combinat.designs.twographs import twograph_descendant gg = g[0](*gr) @@ -2075,10 +2078,12 @@ def SRG_210_99_48_45(): """ from sage.libs.gap.libgap import libgap from sage.combinat.permutation import Permutation - def ekg(g0): # return arcs of the Cayley digraph of on {g,g^4} + + def ekg(g0): + # return arcs of the Cayley digraph of on {g,g^4} g = Permutation(g0) - return libgap.Set([(x, g(x)) for x in range(1,8)] + - [(x, g(g(g(g(x))))) for x in range(1,8)]) + return libgap.Set([(x, g(x)) for x in range(1, 8)] + + [(x, g(g(g(g(x))))) for x in range(1, 8)]) kd = list(map(ekg, [(7, 1, 2, 3, 4, 5), (7, 1, 3, 4, 5, 6), diff --git a/src/sage/misc/c3_controlled.pyx b/src/sage/misc/c3_controlled.pyx index 1b16dd62b8e..955a8663457 100644 --- a/src/sage/misc/c3_controlled.pyx +++ b/src/sage/misc/c3_controlled.pyx @@ -1071,6 +1071,7 @@ class HierarchyElement(object, metaclass=ClasscallMetaclass): succ = succ.neighbors_out if key is None: key = identity + @cached_function def f(x): return typecall(cls, x, [f(y) for y in succ(x)], key, f) diff --git a/src/sage/misc/session.pyx b/src/sage/misc/session.pyx index c842369c4b3..63b7fd735a3 100644 --- a/src/sage/misc/session.pyx +++ b/src/sage/misc/session.pyx @@ -218,6 +218,7 @@ def show_identifiers(hidden=False): # Ignore extra variables injected into the global namespace by the doctest # runner _none = object() + def _in_extra_globals(name, val): return val == DocTestTask.extra_globals.get(name, _none) diff --git a/src/sage/misc/stopgap.pyx b/src/sage/misc/stopgap.pyx index 555d80915b6..9ed9c4ec4dc 100644 --- a/src/sage/misc/stopgap.pyx +++ b/src/sage/misc/stopgap.pyx @@ -77,8 +77,10 @@ def stopgap(message, int ticket_no): return # We reset show_warning so that the message is not printed twice. old_format = warnings.formatwarning + def my_format(message, category, filename, lineno, line=None): - return "%s:%s:\n%s\n%s\n%s\n" % (filename, lineno, "*"*80, message, "*"*80) + return "%s:%s:\n%s\n%s\n%s\n" % (filename, lineno, + "*" * 80, message, "*" * 80) warnings.formatwarning = my_format message = message + "\nThis issue is being tracked at https://trac.sagemath.org/sage_trac/ticket/%s." % ticket_no warnings.warn(StopgapWarning(message), stacklevel=2) diff --git a/src/sage/numerical/backends/generic_backend.pyx b/src/sage/numerical/backends/generic_backend.pyx index 94d0e0e9d9d..083492018fe 100644 --- a/src/sage/numerical/backends/generic_backend.pyx +++ b/src/sage/numerical/backends/generic_backend.pyx @@ -1241,11 +1241,13 @@ cdef class GenericBackend: """ tester.assertEqual(type(self), type(cp), "Classes do not match") + def assert_equal_problem_data(method): tester.assertEqual(getattr(self, method)(), getattr(cp, method)(), "{} does not match".format(method)) for method in ("ncols", "nrows", "objective_constant_term", "problem_name", "is_maximization"): assert_equal_problem_data(method) + def assert_equal_col_data(method): for i in range(self.ncols()): tester.assertEqual(getattr(self, method)(i), getattr(cp, method)(i), @@ -1256,6 +1258,7 @@ cdef class GenericBackend: # TODO: Add a test elsewhere to ensure that variable_lower_bound, variable_upper_bound # are consistent with col_bounds. assert_equal_col_data(method) + def assert_equal_row_data(method): for i in range(self.nrows()): tester.assertEqual(getattr(self, method)(i), getattr(cp, method)(i), diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 582f59971f6..edbeceaf0ab 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1577,6 +1577,7 @@ cdef class FiniteField(Field): d = self.degree() D = list(reversed(d.divisors()[:-1])) P = d.support() + def make_family(gen, poly): if poly.degree() != d: return False, {} diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 2cdd0ce4476..96a55bffd69 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -3132,6 +3132,7 @@ def _tensor_product_ring(B, A): else: names = (['y%d' % d for d in range(B.ngens())] + ['x%d' % d for d in range(A.ngens())]) + def term_order(A): # univariate rings do not have a term order if (is_PolynomialRing(A) or is_PolynomialQuotientRing(A) diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx index bb7fd4275cd..220c9b87c1d 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx @@ -1091,17 +1091,17 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): """ if self.is_zero(): raise ValueError("factorization of 0 not defined") + def factorizations_rec(P): if P.is_irreducible(): - yield [ (P,1) ] + yield [(P, 1)] else: for div in P._irreducible_divisors(True): Q = P // div # Here, we should update Q._norm, Q._norm_factor for factors in factorizations_rec(Q): - factors.append((div,1)) + factors.append((div, 1)) yield factors unit = self.leading_coefficient() - for factors in factorizations_rec(~unit*self): + for factors in factorizations_rec(~unit * self): yield Factorization(factors, sort=False, unit=unit) - diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 0edd33209d3..2b649359ad4 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -643,6 +643,7 @@ cdef class RingExtension_generic(CommutativeAlgebra): method = getattr(self._backend, name) if not callable(method): raise AttributeError(AttributeErrorMessage(self, name)) + def wrapper(*args, **kwargs): output = method(*to_backend(args), **to_backend(kwargs)) return from_backend(output, self) diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 9970e2b5ca3..04d0f1033a9 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -122,6 +122,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): method = getattr(self._backend, name) if not callable(method): raise AttributeError(AttributeErrorMessage(self, name)) + def wrapper(*args, **kwargs): output = method(*to_backend(args), **to_backend(kwargs)) return from_backend(output, self._parent) diff --git a/src/sage/rings/tate_algebra_element.pyx b/src/sage/rings/tate_algebra_element.pyx index 0e25c9dfe9d..3f09e3722d3 100644 --- a/src/sage/rings/tate_algebra_element.pyx +++ b/src/sage/rings/tate_algebra_element.pyx @@ -2416,6 +2416,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): cdef TateAlgebraElement ans = self._new_c() # Hmm, shouldn't we add a keyword argument to lift_to_precision() # to specify that we don't want it to raise an error + def lift_without_error(elt): try: return elt.lift_to_precision(prec) From c5088e601fbb9b9f995ad713979e3ce4066c23cd Mon Sep 17 00:00:00 2001 From: Xavier Caruso Date: Fri, 3 Jun 2022 16:15:25 +0200 Subject: [PATCH 256/338] be more strict with conversion between padics --- src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx | 13 ++++++++----- src/sage/rings/padics/padic_template_element.pxi | 10 ++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx index 6a47bf86a1d..463cc371031 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx @@ -2785,12 +2785,15 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): We check that :trac:`24949` is fixed:: - sage: R. = Zp(2).extension(x^10 + 2) - sage: x = a^4 + a^5 - sage: y = a^2 + a^3 - sage: z = x - y^2 - sage: z.expansion(4) + sage: R = Zp(2) + sage: S. = R[] + sage: A. = R.extension(x^10 + 2) + sage: u = a^4 + a^5 + sage: v = a^2 + a^3 + sage: w = u - v^2 + sage: w.expansion(4) 0 + """ self._normalize() if lift_mode == 'teichmuller': diff --git a/src/sage/rings/padics/padic_template_element.pxi b/src/sage/rings/padics/padic_template_element.pxi index b30d8cf0ae9..f2ab97737d0 100644 --- a/src/sage/rings/padics/padic_template_element.pxi +++ b/src/sage/rings/padics/padic_template_element.pxi @@ -73,6 +73,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): sage: Zp(17)(17^3, 8, 4) 17^3 + O(17^7) + """ def __init__(self, parent, x, absprec=infinity, relprec=infinity): """ @@ -107,6 +108,13 @@ cdef class pAdicTemplateElement(pAdicGenericElement): ... TypeError: p does not divide modulus 9 + :: + + sage: Zp(2)(Zp(5)(1)) + Traceback (most recent call last): + ... + TypeError: no conversion between padics when prime numbers differ + """ self.prime_pow = parent.prime_pow pAdicGenericElement.__init__(self, parent) @@ -122,6 +130,8 @@ cdef class pAdicTemplateElement(pAdicGenericElement): elif typ(pari_tmp) == t_FRAC: x = Rational(x) elif isinstance(x, pAdicGenericElement): + if self.prime_pow.prime != x.parent().prime(): + raise TypeError("no conversion between padics when prime numbers differ") if not ((x)._is_base_elt(self.prime_pow.prime) or x.parent() is self.parent()): if x.parent().modulus().change_ring(self.base_ring()) == self.parent().modulus(): x = x.polynomial().change_ring(self.base_ring()).list() From 8dc327a72bde1a0d20cd69fce80953bde13b7edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 3 Jun 2022 21:13:41 +0200 Subject: [PATCH 257/338] get rid of "have_ring" in singular interface --- .../multi_polynomial_libsingular.pyx | 5 ---- .../polynomial/polynomial_modn_dense_ntl.pyx | 12 ++++---- .../polynomial/polynomial_rational_flint.pyx | 6 ++-- .../polynomial_singular_interface.py | 28 +++++++------------ .../rings/polynomial/polynomial_template.pxi | 6 ++-- src/sage/structure/sage_object.pyx | 4 +-- 6 files changed, 21 insertions(+), 40 deletions(-) diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx index d09ddf63c58..d015d5cab30 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx @@ -5005,9 +5005,6 @@ cdef class MPolynomial_libsingular(MPolynomial): - ``singular`` - interpreter (default: ``singular_default``) - - ``have_ring`` - should the correct ring not be set in - SINGULAR first (default: ``False``) - EXAMPLES:: sage: P. = PolynomialRing(GF(127),3) @@ -5239,8 +5236,6 @@ cdef class MPolynomial_libsingular(MPolynomial): - ``variable`` - the derivative is taken with respect to variable - - ``have_ring`` - ignored, accepted for compatibility reasons - .. NOTE:: See also :meth:`derivative` EXAMPLES:: diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx index 2519b6e598d..44b957e0da1 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -368,9 +368,8 @@ cdef class Polynomial_dense_mod_n(Polynomial): self.__poly = ZZ_pX(v, self.parent().modulus()) # Polynomial_singular_repr stuff, copied due to lack of multiple inheritance - def _singular_(self, singular=singular_default, have_ring=False, force=False): - if not have_ring: - self.parent()._singular_(singular,force=force).set_ring() # this is expensive + def _singular_(self, singular=singular_default, force=False): + self.parent()._singular_(singular, force=force).set_ring() # this is expensive if self.__singular is not None: try: self.__singular._check_valid() @@ -378,11 +377,10 @@ cdef class Polynomial_dense_mod_n(Polynomial): return self.__singular except (AttributeError, ValueError): pass - return self._singular_init_(singular, have_ring=have_ring) + return self._singular_init_(singular) - def _singular_init_(self, singular=singular_default, have_ring=False, force=False): - if not have_ring: - self.parent()._singular_(singular,force=force).set_ring() # this is expensive + def _singular_init_(self, singular=singular_default, force=False): + self.parent()._singular_(singular, force=force).set_ring() # this is expensive self.__singular = singular(str(self)) return self.__singular diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx index cfe230ad974..f6c89d97f52 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx @@ -332,14 +332,13 @@ cdef class Polynomial_rational_flint(Polynomial): fmpq_poly_set(res.__poly, self.__poly) return res - def _singular_(self, singular=singular_default, have_ring=False): + def _singular_(self, singular=singular_default): """ Return a Singular representation of self. INPUT: - ``singular`` - Singular interpreter (default: default interpreter) - - ``have_ring`` - set to True if the ring was already set in Singular EXAMPLES:: @@ -348,8 +347,7 @@ cdef class Polynomial_rational_flint(Polynomial): sage: singular(f) 3*x^2+2*x+5 """ - if not have_ring: - self._parent._singular_(singular).set_ring() # Expensive! + self._parent._singular_(singular).set_ring() # Expensive! return singular(self._singular_init_()) cpdef list list(self, bint copy=True): diff --git a/src/sage/rings/polynomial/polynomial_singular_interface.py b/src/sage/rings/polynomial/polynomial_singular_interface.py index 37d7e155b1f..40b77534d19 100644 --- a/src/sage/rings/polynomial/polynomial_singular_interface.py +++ b/src/sage/rings/polynomial/polynomial_singular_interface.py @@ -452,24 +452,20 @@ class Polynomial_singular_repr: Due to the incompatibility of Python extension classes and multiple inheritance, this just defers to module-level functions. """ - def _singular_(self, singular=singular, have_ring=False): - return _singular_func(self, singular, have_ring) + def _singular_(self, singular=singular): + return _singular_func(self, singular) - def _singular_init_func(self, singular=singular, have_ring=False): - return _singular_init_func(self, singular, have_ring) + def _singular_init_func(self, singular=singular): + return _singular_init_func(self, singular) -def _singular_func(self, singular=singular, have_ring=False): +def _singular_func(self, singular=singular): """ Return Singular polynomial matching this polynomial. INPUT: - ``singular`` - Singular instance to use. - - ``have_ring`` - if True we will not attempt to set this element's ring as - the current Singular ring. This is useful to speed up a batch of - ``f._singular_()`` calls. However, it's dangerous as it might lead to wrong - results if another ring is ``singular.current_ring()``. (Default: False) EXAMPLES:: @@ -494,8 +490,7 @@ def _singular_func(self, singular=singular, have_ring=False): sage: R(h^20) == f^20 True """ - if not have_ring: - self.parent()._singular_(singular).set_ring() # this is expensive + self.parent()._singular_(singular).set_ring() # this is expensive try: self.__singular._check_valid() @@ -503,19 +498,16 @@ def _singular_func(self, singular=singular, have_ring=False): return self.__singular except (AttributeError, ValueError): pass -# return self._singular_init_(singular, have_ring=have_ring) - return _singular_init_func(self, singular, have_ring=have_ring) + return _singular_init_func(self, singular) + -def _singular_init_func(self, singular=singular, have_ring=False): +def _singular_init_func(self, singular=singular): """ Return corresponding Singular polynomial but enforce that a new instance is created in the Singular interpreter. Use ``self._singular_()`` instead. """ - if not have_ring: - self.parent()._singular_(singular).set_ring() # this is expensive - + self.parent()._singular_(singular).set_ring() # this is expensive self.__singular = singular(str(self)) - return self.__singular diff --git a/src/sage/rings/polynomial/polynomial_template.pxi b/src/sage/rings/polynomial/polynomial_template.pxi index 959b5b38c8e..7b4bc755b83 100644 --- a/src/sage/rings/polynomial/polynomial_template.pxi +++ b/src/sage/rings/polynomial/polynomial_template.pxi @@ -765,14 +765,13 @@ cdef class Polynomial_template(Polynomial): celement_truncate(&r.x, &self.x, n, (self)._cparent) return r - def _singular_(self, singular=singular_default, have_ring=False): + def _singular_(self, singular=singular_default): r""" Return Singular representation of this polynomial INPUT: - ``singular`` -- Singular interpreter (default: default interpreter) - - ``have_ring`` -- set to True if the ring was already set in Singular EXAMPLES:: @@ -781,6 +780,5 @@ cdef class Polynomial_template(Polynomial): sage: singular(f) 3*x^2+2*x-2 """ - if not have_ring: - self.parent()._singular_(singular).set_ring() #this is expensive + self.parent()._singular_(singular).set_ring() # this is expensive return singular(self._singular_init_()) diff --git a/src/sage/structure/sage_object.pyx b/src/sage/structure/sage_object.pyx index c932029f9de..466b0025db2 100644 --- a/src/sage/structure/sage_object.pyx +++ b/src/sage/structure/sage_object.pyx @@ -934,13 +934,13 @@ cdef class SageObject: I = sage.interfaces.r.r return self._interface_init_(I) - def _singular_(self, G=None, have_ring=False): + def _singular_(self, G=None): if G is None: import sage.interfaces.singular G = sage.interfaces.singular.singular return self._interface_(G) - def _singular_init_(self, have_ring=False): + def _singular_init_(self): import sage.interfaces.singular I = sage.interfaces.singular.singular return self._interface_init_(I) From 0adf8cb96be21d41da5dc02eedb61178319f1a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 5 Jun 2022 15:24:05 +0200 Subject: [PATCH 258/338] partial pep cleaning of sandpiles/sandpile --- src/sage/sandpiles/sandpile.py | 301 +++++++++++++++------------------ 1 file changed, 139 insertions(+), 162 deletions(-) diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py index da3955bf6f2..314135bede1 100644 --- a/src/sage/sandpiles/sandpile.py +++ b/src/sage/sandpiles/sandpile.py @@ -341,7 +341,6 @@ from sage.arith.srange import xsrange from sage.modules.free_module_element import vector from sage.misc.lazy_import import lazy_import -lazy_import("sage.plot.colors", "rainbow") from sage.arith.functions import lcm from sage.arith.misc import falling_factorial from sage.rings.integer import Integer @@ -351,6 +350,7 @@ from sage.symbolic.constants import I, pi from sage.symbolic.ring import SR from sage.features.four_ti_2 import FourTi2Executable +lazy_import("sage.plot.colors", "rainbow") def _sandpile_help(cls, usage, verbose=True): @@ -496,11 +496,10 @@ def help(verbose=True): zero_config -- The all-zero configuration. zero_div -- The all-zero divisor. """ - _sandpile_help(Sandpile, dedent("""\ For detailed help with any method FOO listed below, enter "Sandpile.FOO?" or enter "S.FOO?" for any Sandpile S."""), - verbose=verbose) + verbose=verbose) def __init__(self, g, sink=None): r""" @@ -602,13 +601,13 @@ def __init__(self, g, sink=None): if p == -1: name = name + ' sandpile graph' else: - name = name[:p] + 'sandpile graph' + name[p+5:] + name = name[:p] + 'sandpile graph' + name[p + 5:] self._name = name else: self._name = 'sandpile graph' # preprocess a graph, if necessary if isinstance(g, dict) and isinstance(next(iter(g.values())), dict): - pass # this is the default format + pass # this is the default format elif isinstance(g, dict) and isinstance(next(iter(g.values())), list): processed_g = {i: dict(Counter(g[i])) for i in g} g = processed_g @@ -637,7 +636,7 @@ def __init__(self, g, sink=None): self._laplacian = self.laplacian_matrix(indegree=False) temp = list(range(self.num_verts())) del temp[self._sink_ind] - self._reduced_laplacian = self._laplacian[temp,temp] + self._reduced_laplacian = self._laplacian[temp, temp] def __copy__(self): """ @@ -722,8 +721,7 @@ def __getattr__(self, name): elif name == '_betti_complexes': self._set_betti_complexes() return deepcopy(self.__dict__[name]) - elif (name == '_postulation' or name == '_h_vector' - or name == '_hilbert_function'): + elif name in ['_postulation', '_h_vector', '_hilbert_function']: self._set_hilbert_function() return deepcopy(self.__dict__[name]) elif (name == '_ring' or name == '_unsaturated_ideal'): @@ -732,8 +730,7 @@ def __getattr__(self, name): elif name == '_ideal': self._set_ideal() return self.__dict__[name] - elif (name == '_resolution' or name == '_betti' or name == - '_singular_resolution'): + elif name in ['_resolution', '_betti', '_singular_resolution']: self._set_resolution() return self.__dict__[name] elif name == '_groebner': @@ -781,7 +778,7 @@ def _repr_(self): """ return self._name + ': ' + str(self.num_verts()) + ' vertices, sink = ' + str(self.sink()) - def show(self,**kwds): + def show(self, **kwds): r""" Draw the underlying graph. @@ -870,7 +867,6 @@ def laplacian(self): matrix - EXAMPLES:: sage: G = sandpiles.Diamond() @@ -895,7 +891,6 @@ def reduced_laplacian(self): matrix - EXAMPLES:: sage: S = sandpiles.Diamond() @@ -943,8 +938,8 @@ def _set_max_stable(self): sage: '_max_stable' in S.__dict__ True """ - m = {v:self.out_degree(v)-1 for v in self._nonsink_vertices} - self._max_stable = SandpileConfig(self,m) + m = {v: self.out_degree(v) - 1 for v in self._nonsink_vertices} + self._max_stable = SandpileConfig(self, m) def max_stable(self): r""" @@ -974,8 +969,8 @@ def _set_max_stable_div(self): sage: '_max_stable_div' in S.__dict__ True """ - m = {v:self.out_degree(v)-1 for v in self.vertices()} - self._max_stable_div = SandpileDivisor(self,m) + m = {v: self.out_degree(v) - 1 for v in self.vertices()} + self._max_stable_div = SandpileDivisor(self, m) def max_stable_div(self): r""" @@ -1006,7 +1001,7 @@ def _set_out_degrees(self): sage: '_out_degrees' in s.__dict__ True """ - self._out_degrees = {v:0 for v in self.vertices()} + self._out_degrees = {v: 0 for v in self.vertices()} for v in self.vertices(): for e in self.edges_incident(v): self._out_degrees[v] += e[2] @@ -1046,7 +1041,7 @@ def _set_in_degrees(self): sage: '_in_degrees' in s.__dict__ True """ - self._in_degrees = {v:0 for v in self.vertices()} + self._in_degrees = {v: 0 for v in self.vertices()} for e in self.edges(): self._in_degrees[e[1]] += e[2] @@ -1089,7 +1084,7 @@ def _set_burning_config(self): # TODO: Cythonize! d = self._reduced_laplacian.nrows() burn = sum(self._reduced_laplacian) - script=[1]*d # d 1s + script = [1] * d # d 1s done = False while not done: bad = -1 @@ -1101,16 +1096,16 @@ def _set_burning_config(self): done = True else: burn += self._reduced_laplacian[bad] - script[bad]+=1 + script[bad] += 1 b = iter(burn) s = iter(script) - bc = {} # burning config - bs = {} # burning script + bc = {} # burning config + bs = {} # burning script for v in self._nonsink_vertices: bc[v] = next(b) bs[v] = next(s) - self._burning_config = SandpileConfig(self,bc) - self._burning_script = SandpileConfig(self,bs) + self._burning_config = SandpileConfig(self, bc) + self._burning_script = SandpileConfig(self, bs) def burning_config(self): r""" @@ -1250,7 +1245,7 @@ def all_k_config(self, k): sage: s.all_k_config(7) {1: 7, 2: 7, 3: 7} """ - return SandpileConfig(self,[k]*(self.num_verts()-1)) + return SandpileConfig(self, [k] * (self.num_verts() - 1)) def zero_config(self): r""" @@ -1270,7 +1265,7 @@ def zero_config(self): # TODO: cythonize stabilization! # The following would presumably be moved to the SandpileConfig class - #def new_stabilize(self, config): + # def new_stabilize(self, config): # r""" # Stabilize \code{config}, returning \code{[out_config, firing_vector]}, # where \code{out_config} is the modified configuration. @@ -1293,7 +1288,7 @@ def _set_identity(self): True """ m = self._max_stable - self._identity = (m&m).dualize()&m + self._identity = (m & m).dualize() & m def identity(self, verbose=True): r""" @@ -1338,15 +1333,16 @@ def _set_recurrents(self): """ if self.name() == 'Complete sandpile graph': n = self.num_verts() - self._recurrents = [SandpileConfig(self,[n-1-i for i in p]) for p in ParkingFunctions(n-1)] + self._recurrents = [SandpileConfig(self, [n - 1 - i for i in p]) + for p in ParkingFunctions(n - 1)] elif self.name() == 'Cycle sandpile graph': n = self.num_verts() - one = [1]*(n-2) - self._recurrents = [SandpileConfig(self,[1]*(n-1))] + [SandpileConfig(self, one[:i]+[0]+one[i:]) for i in range(n-1)] + one = [1] * (n - 2) + self._recurrents = [SandpileConfig(self, [1]*(n-1))] + [SandpileConfig(self, one[:i]+[0]+one[i:]) for i in range(n - 1)] else: self._recurrents = [] active = [self._max_stable] - while active != []: + while active: c = active.pop() self._recurrents.append(c) for v in self._nonsink_vertices: @@ -1474,7 +1470,7 @@ def _set_group_gens(self): D, U, _ = self.reduced_laplacian().transpose().smith_form() F = U.inverse() self._group_gens = [SandpileConfig(self,[Integer(j) for j in F.column(i)]).equivalent_recurrent() - for i in range(F.nrows()) if D[i][i]!=1] + for i in range(F.nrows()) if D[i][i] != 1] def group_gens(self, verbose=True): r""" @@ -1562,7 +1558,7 @@ def _set_min_recurrents(self): """ if self.is_undirected(): m = min([r.deg() for r in self.recurrents()]) - rec = [r for r in self.recurrents() if r.deg()==m] + rec = [r for r in self.recurrents() if r.deg() == m] else: rec = list(self.recurrents()) for r in self.recurrents(): @@ -1669,7 +1665,6 @@ def tutte_polynomial(self): else: raise UserWarning("The underlying graph must be undirected.") - def _set_avalanche_polynomial(self): """ Compute the avalanche polynomial. See ``self.avalanche_polynomial`` for details. @@ -1736,7 +1731,6 @@ def avalanche_polynomial(self, multivariable=True): X = R.gens() return self._avalanche_polynomial.subs({X[i]:X[0] for i in range(1,self.num_verts()-1)}) - def nonspecial_divisors(self, verbose=True): r""" The nonspecial divisors. Only for undirected graphs. (See NOTE.) @@ -1863,11 +1857,11 @@ def _set_hilbert_function(self): """ v = [i.deg() for i in self._superstables] self._postulation = max(v) - self._h_vector = [v.count(i) for i in range(self._postulation+1)] + self._h_vector = [v.count(i) for i in range(self._postulation + 1)] self._hilbert_function = [1] for i in range(self._postulation): self._hilbert_function.append(self._hilbert_function[i] - +self._h_vector[i+1]) + + self._h_vector[i + 1]) def h_vector(self): r""" @@ -1879,7 +1873,6 @@ def h_vector(self): list of nonnegative integers - EXAMPLES:: sage: s = sandpiles.Grid(2,2) @@ -2255,10 +2248,10 @@ def markov_chain(self,state, distrib=None): V = self.vertices() n = len(V) if isinstance(st, list): - if len(st)==self.num_verts()-1: - st = SandpileConfig(self,st) - elif len(st)==self.num_verts(): - st = SandpileDivisor(self,st) + if len(st) == self.num_verts() - 1: + st = SandpileConfig(self, st) + elif len(st) == self.num_verts(): + st = SandpileDivisor(self, st) else: raise SyntaxError(state) if distrib is None: # default = uniform distribution @@ -2300,13 +2293,13 @@ def _set_stationary_density(self): """ if self.name() == 'Complete sandpile graph': n = Integer(self.num_verts()) - self._stationary_density = (n + QQ.one() / n + sum(falling_factorial(n,i)/n**i for i in range(1,n+1)) - 3)/2 + self._stationary_density = (n + QQ.one() / n + sum(falling_factorial(n, i) / n**i for i in range(1, n + 1)) - 3) / 2 elif self.is_undirected() and '_h_vector' not in self.__dict__: t = Graph(self).tutte_polynomial().subs(x=1) - myR = PolynomialRing(QQ,'y') + myR = PolynomialRing(QQ, 'y') y = myR.gens()[0] t = myR(t) - dt = derivative(t,y).subs(y=1) + dt = derivative(t, y).subs(y=1) t = t.subs(y=1) self._stationary_density = (self.num_edges()/2 + dt/t)/self.num_verts() else: @@ -2345,7 +2338,7 @@ def stationary_density(self): """ return self._stationary_density -#################### Functions for divisors ##################### + # ---------------- Functions for divisors ---------------- def all_k_div(self, k): r""" @@ -2452,9 +2445,9 @@ def betti_complexes(self): """ return deepcopy(self._betti_complexes) -####################################### -######### Algebraic Geometry ########## -####################################### + ####################################### + # Algebraic Geometry # + ####################################### def _set_ring(self): r""" @@ -2593,15 +2586,15 @@ def _set_resolution(self): # get the resolution in singular form res = self.ideal()._singular_().mres(0) # compute the betti numbers - #self._betti = [1] + [len(res[i]) + # self._betti = [1] + [len(res[i]) # for i in range(1,len(res)-2)] self._betti = [1] + [len(x) for x in res] # convert the resolution to a list of Sage poly matrices result = [] - zero = self._ring.gens()[0]*0 - for i in range(1, len(res)+1): + zero = self._ring.gens()[0] * 0 + for i in range(1, len(res) + 1): syz_mat = [] - new = [res[i][j] for j in range(1, int(res[i].size())+1)] + new = [res[i][j] for j in range(1, int(res[i].size()) + 1)] for j in range(self._betti[i]): row = new[j].transpose().sage_matrix(self._ring) row = [r for r in row[0]] @@ -2764,14 +2757,14 @@ def solve(self): vars_ = '({})'.format(','.join(str(i) for i in v)) L = singular.subst(self._ideal, - singular.var(singular.nvars(self._ring)), 1) + singular.var(singular.nvars(self._ring)), 1) _ = singular.ring(0, vars_, 'lp') K = singular.fetch(self._ring, L) K = singular.groebner(K) singular.LIB('solve.lib') M = K.solve(5, 1) singular.setring(M) - sol= singular('SOL').sage_structured_str_list() + sol = singular('SOL').sage_structured_str_list() sol = sol[0][0] sol = [[SR(j) for j in k] for k in sol] return sol @@ -2792,9 +2785,10 @@ def _set_points(self): n = self.num_verts() - 1 D, U, V = L.smith_form() self._points = [] - one = [1]*n + one = [1] * n + twopii = 2 * pi * I for k in range(n): - x = [exp(2*pi*I*U[k,t]/D[k,k]) for t in range(n)] + x = [exp(twopii * U[k, t] / D[k, k]) for t in range(n)] if x not in self._points and x != one: self._points.append(x) @@ -2859,7 +2853,7 @@ def symmetric_recurrents(self, orbits): """ sym_recurrents = [] active = [self._max_stable] - while active != []: + while active: c = active.pop() sym_recurrents.append(c) for orb in orbits: @@ -2871,8 +2865,9 @@ def symmetric_recurrents(self, orbits): active.append(cnext) return deepcopy(sym_recurrents) + ########################################## -########### SandpileConfig Class ######### +# SandpileConfig Class # ########################################## class SandpileConfig(dict): r""" @@ -2926,7 +2921,6 @@ def help(verbose=True): unstable -- The unstable vertices. values -- The values of the configuration as a list. """ - _sandpile_help(SandpileConfig, dedent("""\ Shortcuts for SandpileConfig operations: ~c -- stabilize @@ -2937,7 +2931,7 @@ def help(verbose=True): For detailed help with any method FOO listed below, enter "SandpileConfig.FOO?" or enter "c.FOO?" for any SandpileConfig c."""), - verbose=verbose) + verbose=verbose) def __init__(self, S, c): r""" @@ -2962,7 +2956,7 @@ def __init__(self, S, c): sage: ~(3*c) # stabilization {1: 2, 2: 2, 3: 0} """ - if len(c)==S.num_verts()-1: + if len(c) == S.num_verts()-1: if isinstance(c, (dict, SandpileConfig)): dict.__init__(self,c) elif isinstance(c, list): @@ -3547,8 +3541,8 @@ def fire_vertex(self, v): c = dict(self) c[v] -= self._sandpile.out_degree(v) for e in self._sandpile.outgoing_edges(v): - if e[1]!=self._sandpile.sink(): - c[e[1]]+=e[2] + if e[1] != self._sandpile.sink(): + c[e[1]] += e[2] return SandpileConfig(self._sandpile,c) def fire_script(self, sigma): @@ -3583,8 +3577,8 @@ def fire_script(self, sigma): v = self._vertices[i] c[v] -= sigma[i]*self._sandpile.out_degree(v) for e in self._sandpile.outgoing_edges(v): - if e[1]!=self._sandpile.sink(): - c[e[1]]+=sigma[i]*e[2] + if e[1] != self._sandpile.sink(): + c[e[1]] += sigma[i]*e[2] return SandpileConfig(self._sandpile, c) def unstable(self): @@ -3624,8 +3618,8 @@ def fire_unstable(self): for v in self.unstable(): c[v] -= self._sandpile.out_degree(v) for e in self._sandpile.outgoing_edges(v): - if e[1]!=self._sandpile.sink(): - c[e[1]]+=e[2] + if e[1] != self._sandpile.sink(): + c[e[1]] += e[2] return SandpileConfig(self._sandpile,c) def _set_stabilize(self): @@ -3727,7 +3721,6 @@ def support(self): """ return [i for i in self if self[i] !=0] - def add_random(self, distrib=None): r""" Add one grain of sand to a random vertex. Optionally, a probability @@ -3794,11 +3787,11 @@ def add_random(self, distrib=None): n = self._sandpile.num_verts() if distrib is None: # default = uniform distribution on nonsink vertices distrib = [QQ.one() / (n - 1)] * (n - 1) - if len(distrib)==n-1: # prob. dist. on nonsink vertices + if len(distrib) == n - 1: # prob. dist. on nonsink vertices X = GeneralDiscreteDistribution(distrib) V = self._sandpile.nonsink_vertices() c[V[X.get_random_element()]] += 1 - else: # prob. dist. on all the vertices + else: # prob. dist. on all the vertices X = GeneralDiscreteDistribution(distrib) V = self._sandpile.vertices() i = X.get_random_element() @@ -4128,7 +4121,7 @@ def burst_size(self, v): w = deepcopy(self) w[v] -= 1 w = w.equivalent_recurrent() - return w.deg() - self.deg() +1 + return w.deg() - self.deg() + 1 def show(self, sink=True, colors=True, heights=False, directed=None, **kwds): r""" @@ -4176,7 +4169,7 @@ def show(self, sink=True, colors=True, heights=False, directed=None, **kwds): T.relabel(a) if colors: vc = {} # vertex colors - r = rainbow(max_height) # colors + r = rainbow(max_height) # colors for i in range(max_height): vc[r[i]] = [] for i in self.sandpile().nonsink_vertices(): @@ -4198,7 +4191,7 @@ def show(self, sink=True, colors=True, heights=False, directed=None, **kwds): ############################################### -########### SandpileDivisor Class ############# +# SandpileDivisor Class # ############################################### class SandpileDivisor(dict): @@ -4256,11 +4249,10 @@ def help(verbose=True): weierstrass_pts -- The Weierstrass points (vertices). weierstrass_rank_seq -- The Weierstrass rank sequence at the given vertex. """ - _sandpile_help(SandpileDivisor, dedent("""\ For detailed help with any method FOO listed below, enter "SandpileDivisor.FOO?" or enter "D.FOO?" for any SandpileDivisor D."""), - verbose=verbose) + verbose=verbose) def __init__(self, S, D): r""" @@ -4282,9 +4274,8 @@ def __init__(self, S, D): sage: D = SandpileDivisor(S,[0,1,0,1,1,3]) sage: D.support() [1, 3, 4, 5] - """ - if len(D)==S.num_verts(): + if len(D) == S.num_verts(): if type(D) in [dict, SandpileDivisor, SandpileConfig]: dict.__init__(self,dict(D)) elif isinstance(D, list): @@ -5041,7 +5032,7 @@ def is_linearly_equivalent(self, D, with_firing_vector=False): D,U,V = self.sandpile()._smith_form b = v - w ub = U*b - if ub[-1]!=0: + if ub[-1] != 0: if with_firing_vector: return vector([]) else: @@ -5174,7 +5165,7 @@ def _set_linear_system(self): path_to_zsolve = FourTi2Executable('zsolve').absolute_filename() os.system(shlex.quote(path_to_zsolve) + ' -q ' + lin_sys + ' > ' + lin_sys_log) # process the results - zhom_file = open(lin_sys_zhom,'r') + zhom_file = open(lin_sys_zhom, 'r') except IOError: print(""" ********************************** @@ -5182,22 +5173,21 @@ def _set_linear_system(self): ********************************** """) return - ## first, the cone generators (the homogeneous points) + # first, the cone generators (the homogeneous points) a = zhom_file.read() zhom_file.close() a = a.split('\n') # a starts with two numbers. We are interested in the first one num_homog = int(a[0].split()[0]) - homog = [map(int,i.split()) for i in a[1:-1]] - ## second, the inhomogeneous points - zinhom_file = open(lin_sys_zinhom,'r') - b = zinhom_file.read() - zinhom_file.close() + homog = [map(int, i.split()) for i in a[1:-1]] + # second, the inhomogeneous points + with open(lin_sys_zinhom, 'r') as zinhom_file: + b = zinhom_file.read() b = b.split('\n') num_inhomog = int(b[0].split()[0]) - inhomog = [map(int,i.split()) for i in b[1:-1]] - self._linear_system = {'num_homog':num_homog, 'homog':homog, - 'num_inhomog':num_inhomog, 'inhomog':inhomog} + inhomog = [map(int, i.split()) for i in b[1:-1]] + self._linear_system = {'num_homog': num_homog, 'homog': homog, + 'num_inhomog': num_inhomog, 'inhomog': inhomog} def _set_polytope(self): r""" @@ -5376,9 +5366,9 @@ def effective_div(self, verbose=True, with_firing_vectors=False): return list(zip(eff, fv)) elif verbose: # verbose without firing vectors return eff - elif with_firing_vectors: # not verbose but with firing vectors + elif with_firing_vectors: # not verbose but with firing vectors return list(zip([i.values() for i in eff], fv)) - else: # not verbose, no firing vectors + else: # not verbose, no firing vectors return [i.values() for i in eff] def _set_rank(self, set_witness=False): @@ -5414,14 +5404,15 @@ def _set_rank(self, set_witness=False): """ S = self.sandpile() # If undirected and D has high degree, use Riemann-Roch. - if S.is_undirected() and not set_witness: # We've been careful about loops - g = sum(S.laplacian().diagonal())/2 - S.num_verts() + 1 - if self.deg() > 2*g - 2: + if S.is_undirected() and not set_witness: + # We've been careful about loops + g = sum(S.laplacian().diagonal()) / 2 - S.num_verts() + 1 + if self.deg() > 2 * g - 2: self._rank = self.deg() - g return # return early # If S is a complete sandpile graph and a witness is not needed, use # the Cori-Le Borgne algorithm - if S.name()=='Complete sandpile graph' and not set_witness: + if S.name() == 'Complete sandpile graph' and not set_witness: # Cori-LeBorgne algorithm n = S.num_verts() rk = -1 @@ -5446,9 +5437,9 @@ def _set_rank(self, set_witness=False): else: rk = -1 while True: - for e in integer_vectors_nk_fast_iter(rk+1,S.num_verts()): + for e in integer_vectors_nk_fast_iter(rk + 1, S.num_verts()): E = SandpileDivisor(S, e) - if (self - E).effective_div() == []: + if not (self - E).effective_div(): self._rank = rk self._rank_witness = E return @@ -5534,7 +5525,7 @@ def _set_r_of_D(self, verbose=False): eff = self.effective_div() n = self._sandpile.num_verts() r = -1 - if eff == []: + if not eff: self._r_of_D = (r, self) return else: @@ -5559,7 +5550,7 @@ def _set_r_of_D(self, verbose=False): C = d - w C = SandpileDivisor(self._sandpile,list(C)) eff = C.effective_div() - if eff == []: + if not eff: self._r_of_D = (r, SandpileDivisor(self._sandpile,list(w))) return level = new_level @@ -5643,10 +5634,10 @@ def weierstrass_gap_seq(self, v='sink', weight=True): `\mathrm{rank}(D), \mathrm{rank}(D - v), \mathrm{rank}(D - 2v), \dots` """ L = self.weierstrass_rank_seq(v) - gaps = [i for i in range(1,len(L)) if L[i]!=L[i-1]] + gaps = [i for i in range(1, len(L)) if L[i] != L[i - 1]] gaps = tuple(gaps) if weight: - return gaps, sum(gaps)-binomial(len(gaps)+1,2) + return gaps, sum(gaps) - binomial(len(gaps) + 1, 2) else: return gaps @@ -5811,7 +5802,7 @@ def _set_Dcomplex(self): simp.append(supp_E) result = [] simp.reverse() - while simp != []: + while simp: supp = simp.pop() test = True for s in simp: @@ -5955,7 +5946,7 @@ def _set_life(self): oldD = deepcopy(self) result = [oldD] while True: - if oldD.unstable()==[]: + if oldD.unstable() == []: self._life = [] return newD = oldD.fire_unstable() @@ -5989,10 +5980,7 @@ def is_alive(self, cycle=False): sage: D.is_alive(True) [{0: 4, 1: 3, 2: 3, 3: 2}, {0: 3, 1: 2, 2: 2, 3: 5}, {0: 1, 1: 4, 2: 4, 3: 3}] """ - if cycle: - return self._life - else: - return self._life != [] + return self._life if cycle else bool(self._life) def _set_stabilize(self): r""" @@ -6079,8 +6067,9 @@ def show(self, heights=True, directed=None, **kwds): # See note about this after the definition of SandpileConfig pretty.for_type(SandpileDivisor, pretty.for_type(dict, None)) + ####################################### -######### Some test graphs ############ +# Some test graphs # ####################################### def sandlib(selector=None): @@ -6114,54 +6103,37 @@ def sandlib(selector=None): """ # The convention is for the sink to be zero. sandpiles = { - 'generic':{ - 'description':'generic digraph with 6 vertices', - 'graph':{0:{},1:{0:1,3:1,4:1},2:{0:1,3:1,5:1},3:{2:1,5:1},4:{1:1,3:1},5:{2:1,3:1}} - }, - 'kite':{ - 'description':'generic undirected graphs with 5 vertices', - 'graph':{0:{}, 1:{0:1,2:1,3:1}, 2:{1:1,3:1,4:1}, 3:{1:1,2:1,4:1}, - 4:{2:1,3:1}} - }, - 'riemann-roch1':{ - 'description':'directed graph with postulation 9 and 3 maximal weight superstables', - 'graph':{0: {1: 3, 3: 1}, - 1: {0: 2, 2: 2, 3: 2}, - 2: {0: 1, 1: 1}, - 3: {0: 3, 1: 1, 2: 1} - } - }, - 'riemann-roch2':{ - 'description':'directed graph with a superstable not majorized by a maximal superstable', - 'graph':{ - 0: {}, - 1: {0: 1, 2: 1}, - 2: {0: 1, 3: 1}, - 3: {0: 1, 1: 1, 2: 1} - } - }, - 'gor':{ - 'description':'Gorenstein but not a complete intersection', - 'graph':{ - 0: {}, - 1: {0:1, 2: 1, 3: 4}, - 2: {3: 5}, - 3: {1: 1, 2: 1} - } - }, - 'ci1':{ - 'description':'complete intersection, non-DAG but equivalent to a DAG', - 'graph':{0:{}, 1: {2: 2}, 2: {0: 4, 1: 1}} - }, - 'genus2':{ - 'description':'Undirected graph of genus 2', - 'graph':{ - 0:[1,2], - 1:[0,2,3], - 2:[0,1,3], - 3:[1,2] - } - }, + 'generic': {'description': 'generic digraph with 6 vertices', + 'graph': {0: {}, 1: {0: 1, 3: 1, 4: 1}, + 2: {0: 1, 3: 1, 5: 1}, + 3: {2: 1, 5: 1}, 4: {1: 1, 3: 1}, + 5: {2: 1, 3: 1}}}, + 'kite': {'description': 'generic undirected graphs with 5 vertices', + 'graph': {0: {}, 1: {0: 1, 2: 1, 3: 1}, + 2: {1: 1, 3: 1, 4: 1}, 3: {1: 1, 2: 1, 4: 1}, + 4: {2: 1, 3: 1}}}, + 'riemann-roch1': {'description': 'directed graph with postulation 9 and 3 maximal weight superstables', + 'graph': {0: {1: 3, 3: 1}, + 1: {0: 2, 2: 2, 3: 2}, + 2: {0: 1, 1: 1}, + 3: {0: 3, 1: 1, 2: 1}}}, + 'riemann-roch2': {'description': 'directed graph with a superstable not majorized by a maximal superstable', + 'graph': {0: {}, + 1: {0: 1, 2: 1}, + 2: {0: 1, 3: 1}, + 3: {0: 1, 1: 1, 2: 1}}}, + 'gor': {'description': 'Gorenstein but not a complete intersection', + 'graph': {0: {}, + 1: {0: 1, 2: 1, 3: 4}, + 2: {3: 5}, + 3: {1: 1, 2: 1}}}, + 'ci1': {'description': 'complete intersection, non-DAG but equivalent to a DAG', + 'graph': {0: {}, 1: {2: 2}, 2: {0: 4, 1: 1}}}, + 'genus2': {'description': 'Undirected graph of genus 2', + 'graph': {0: [1, 2], + 1: [0, 2, 3], + 2: [0, 1, 3], + 3: [1, 2]}}, } if selector is None: print('') @@ -6174,11 +6146,11 @@ def sandlib(selector=None): else: return Sandpile(sandpiles[selector]['graph'], 0) + ################################################# -########## Some useful functions ################ +# Some useful functions # ################################################# - def triangle_sandpile(n): r""" A triangular sandpile. Each nonsink vertex has out-degree six. The @@ -6283,6 +6255,7 @@ def aztec_sandpile(n): aztec_sandpile[(0, 0)][vert] = out_degree return aztec_sandpile + def glue_graphs(g, h, glue_g, glue_h): r""" Glue two graphs together. @@ -6405,6 +6378,7 @@ def firing_graph(S, eff): g.add_edge((i,eff.index(new_div))) return g + def parallel_firing_graph(S, eff): r""" Creates a digraph with divisors as vertices and edges between two divisors @@ -6442,6 +6416,7 @@ def parallel_firing_graph(S, eff): g.add_edge((i,eff.index(new_div))) return g + def admissible_partitions(S, k): r""" The partitions of the vertices of `S` into `k` parts, each of which is @@ -6537,15 +6512,16 @@ def partition_sandpile(S, p): from sage.combinat.combination import Combinations g = Graph() g.add_vertices([tuple(i) for i in p]) - for u,v in Combinations(g.vertices(), 2): + for u, v in Combinations(g.vertices(), 2): for i in u: for j in v: - if (i,j,1) in S.edges(): + if (i, j, 1) in S.edges(): g.add_edge((u, v)) break for i in g.vertices(): if S.sink() in i: - return Sandpile(g,i) + return Sandpile(g, i) + def min_cycles(G, v): r""" @@ -6572,6 +6548,7 @@ def min_cycles(G, v): sp = G.shortest_paths(v) return [sp[i] for i in pr if i in sp] + def wilmes_algorithm(M): r""" Computes an integer matrix `L` with the same integer row span as `M` and From aa7d2e4cad01772483add28e3e6c884809b4e9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 5 Jun 2022 16:23:12 +0200 Subject: [PATCH 259/338] some better .join with no list inside --- src/sage/databases/findstat.py | 4 ++-- src/sage/doctest/sources.py | 5 ++-- src/sage/graphs/graph_database.py | 2 +- src/sage/groups/matrix_gps/matrix_group.py | 2 +- .../groups/perm_gps/permgroup_element.pyx | 5 ++-- src/sage/schemes/curves/closed_point.py | 2 +- src/sage/schemes/curves/curve.py | 6 ++--- src/sage/schemes/curves/projective_curve.py | 2 +- .../schemes/projective/projective_space.py | 2 +- src/sage/stats/time_series.pyx | 6 ++--- src/sage/symbolic/pynac_impl.pxi | 9 +++---- src/sage/topology/simplicial_set.py | 4 ++-- .../topology/simplicial_set_constructions.py | 24 +++++++++---------- 13 files changed, 38 insertions(+), 35 deletions(-) diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 4a84ef1edb3..0e3941aa38f 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -4594,8 +4594,8 @@ def name(self, style="singular"): "DecoratedPermutations": _SupportedFindStatCollection(lambda x: DecoratedPermutation([v if v > 0 else (i if v == 0 else -i) for i, v in enumerate(literal_eval(x.replace("+","0").replace("-","-1")), 1)]), - lambda x: "[" + ",".join([str(v) if abs(v) != i else ("+" if v > 0 else "-") - for i, v in enumerate(x, 1)]) + "]", + lambda x: "[" + ",".join((str(v) if abs(v) != i else ("+" if v > 0 else "-") + for i, v in enumerate(x, 1))) + "]", DecoratedPermutations, lambda x: x.size(), lambda x: isinstance(x, DecoratedPermutation)), diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py index f9470e14d2e..21fdd3b57cc 100644 --- a/src/sage/doctest/sources.py +++ b/src/sage/doctest/sources.py @@ -1556,10 +1556,11 @@ def parse_docstring(self, docstring, namespace, start): PythonStringSource = dynamic_class("sage.doctest.sources.PythonStringSource", (StringDocTestSource, PythonSource)) min_indent = self.parser._min_indent(docstring) - pysource = '\n'.join([l[min_indent:] for l in docstring.split('\n')]) + pysource = '\n'.join(l[min_indent:] for l in docstring.split('\n')) inner_source = PythonStringSource(self.basename, pysource, self.options, - self.printpath, lineno_shift=start+1) + self.printpath, + lineno_shift=start + 1) inner_doctests, _ = inner_source._create_doctests(namespace, True) safe_docstring = inner_source._neutralize_doctests(min_indent) outer_doctest = self.parser.get_doctest(safe_docstring, namespace, diff --git a/src/sage/graphs/graph_database.py b/src/sage/graphs/graph_database.py index b0a71370dc8..9db59191da7 100644 --- a/src/sage/graphs/graph_database.py +++ b/src/sage/graphs/graph_database.py @@ -666,7 +666,7 @@ def show(self, max_field_size=20, with_picture=False): """ relabel = {} for col in valid_kwds: - relabel[col] = ' '.join([word.capitalize() for word in col.split('_')]) + relabel[col] = ' '.join(word.capitalize() for word in col.split('_')) if re.search('SELECT .*degree_sequence.* FROM', self.__query_string__): format_cols = {'degree_sequence': data_to_degseq} diff --git a/src/sage/groups/matrix_gps/matrix_group.py b/src/sage/groups/matrix_gps/matrix_group.py index f2ce966c9ed..48cf2eb1af0 100644 --- a/src/sage/groups/matrix_gps/matrix_group.py +++ b/src/sage/groups/matrix_gps/matrix_group.py @@ -348,7 +348,7 @@ def _latex_(self): 0 & 1 \end{array}\right) \right\rangle """ - gens = ', '.join([latex(x) for x in self.gens()]) + gens = ', '.join(latex(x) for x in self.gens()) return '\\left\\langle %s \\right\\rangle' % gens def sign_representation(self, base_ring=None, side="twosided"): diff --git a/src/sage/groups/perm_gps/permgroup_element.pyx b/src/sage/groups/perm_gps/permgroup_element.pyx index 31693c20e4d..2c4977a8a84 100644 --- a/src/sage/groups/perm_gps/permgroup_element.pyx +++ b/src/sage/groups/perm_gps/permgroup_element.pyx @@ -1804,9 +1804,10 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): '(1,3)(2)' """ cycles = self.cycle_tuples(singletons) - if len(cycles) == 0: + if not cycles: return '()' - return ''.join([repr(c) for c in cycles]).replace(', ',',').replace(',)',')') + text = ''.join(repr(c) for c in cycles) + return text.replace(', ', ',').replace(',)', ')') def cycle_type(self, singletons=True, as_list=False): r""" diff --git a/src/sage/schemes/curves/closed_point.py b/src/sage/schemes/curves/closed_point.py index 003d140d4b0..abda0906c92 100644 --- a/src/sage/schemes/curves/closed_point.py +++ b/src/sage/schemes/curves/closed_point.py @@ -181,7 +181,7 @@ def _repr_(self): sage: pts[0] Point (x, y) """ - return "Point ({})".format(', '.join([repr(g) for g in self.prime_ideal().gens()])) + return "Point ({})".format(', '.join(repr(g) for g in self.prime_ideal().gens())) def curve(self): """ diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index f9cea384986..c08183d41d5 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -67,9 +67,9 @@ def _repr_(self): """ if self.defining_ideal().is_zero() and self.ambient_space().dimension() == 1: return "{} Line over {}".format(self._repr_type(), self.base_ring()) - else: - return "{} Curve over {} defined by {}".format(self._repr_type(), self.base_ring(), - ', '.join([str(x) for x in self.defining_polynomials()])) + return "{} Curve over {} defined by {}".format(self._repr_type(), + self.base_ring(), + ', '.join(str(x) for x in self.defining_polynomials())) def _repr_type(self): r""" diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 2e69efabc54..ae96943fea7 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -2038,7 +2038,7 @@ def riemann_roch_basis(self, D): Dcoeffs.append(D.coefficient(coords[x[1]])) else: Dcoeffs.append(0) - G = singular(','.join([str(x) for x in Dcoeffs]), type='intvec') + G = singular(','.join(str(x) for x in Dcoeffs), type='intvec') # call singular's brill noether routine and return T = X2[1][2] T.set_ring() diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index c0673c112e1..1bd4540983e 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -853,7 +853,7 @@ def _repr_generic_point(self, v=None): """ if v is None: v = self.gens() - return '(%s)' % (" : ".join([repr(f) for f in v])) + return '(%s)' % (" : ".join(repr(f) for f in v)) def _latex_generic_point(self, v=None): """ diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx index 7045ed8b09d..d20ae2db4a4 100644 --- a/src/sage/stats/time_series.pyx +++ b/src/sage/stats/time_series.pyx @@ -310,10 +310,10 @@ cdef class TimeSeries: if len(self) > max_print: v0 = self[:max_print//2] v1 = self[-max_print//2:] - return '[' + ', '.join([format%x for x in v0]) + ' ... ' + \ - ', '.join([format%x for x in v1]) + ']' + return '[' + ', '.join(format%x for x in v0) + ' ... ' + \ + ', '.join(format%x for x in v1) + ']' else: - return '[' + ', '.join([format%x for x in self]) + ']' + return '[' + ', '.join(format%x for x in self) + ']' def __len__(self): """ diff --git a/src/sage/symbolic/pynac_impl.pxi b/src/sage/symbolic/pynac_impl.pxi index fba8c3d1495..8d0a5d93cb8 100644 --- a/src/sage/symbolic/pynac_impl.pxi +++ b/src/sage/symbolic/pynac_impl.pxi @@ -598,7 +598,7 @@ def py_latex_function_pystring(id, args, fname_paren=False): olist = [name] # print the arguments from sage.misc.latex import latex - olist.extend([r'\left(', ', '.join([latex(x) for x in args]), + olist.extend([r'\left(', ', '.join(latex(x) for x in args), r'\right)']) return ''.join(olist) @@ -646,10 +646,11 @@ cdef stdstring* py_print_fderivative(unsigned id, params, - args -- arguments of the function. """ if all(tolerant_is_symbol(a) for a in args) and len(set(args)) == len(args): - diffvarstr = ', '.join([repr(args[i]) for i in params]) - py_res = ''.join(['diff(',py_print_function_pystring(id,args,False),', ',diffvarstr,')']) + diffvarstr = ', '.join(repr(args[i]) for i in params) + py_res = ''.join(['diff(', py_print_function_pystring(id, args, False), + ', ', diffvarstr, ')']) else: - ostr = ''.join(['D[', ', '.join([repr(int(x)) for x in params]), ']']) + ostr = ''.join(['D[', ', '.join(repr(int(x)) for x in params), ']']) fstr = py_print_function_pystring(id, args, True) py_res = ostr + fstr return string_from_pystr(py_res) diff --git a/src/sage/topology/simplicial_set.py b/src/sage/topology/simplicial_set.py index 882001ebed0..f91c292700e 100644 --- a/src/sage/topology/simplicial_set.py +++ b/src/sage/topology/simplicial_set.py @@ -868,7 +868,7 @@ def _repr_(self): s_1 s_0 v """ if self.degeneracies(): - degens = ' '.join(['s_{}'.format(i) for i in self.degeneracies()]) + degens = ' '.join(f's_{i}' for i in self.degeneracies()) return degens + ' {}'.format(self.nondegenerate()) return 'Delta^{}'.format(self._dim) @@ -903,7 +903,7 @@ def _latex_(self): else: simplex = "\\Delta^{{{}}}".format(self._dim) if self.degeneracies(): - degens = ' '.join(['s_{{{}}}'.format(i) for i in self.degeneracies()]) + degens = ' '.join(f's_{{{i}}}' for i in self.degeneracies()) return degens + ' ' + simplex return simplex diff --git a/src/sage/topology/simplicial_set_constructions.py b/src/sage/topology/simplicial_set_constructions.py index 5b192d019bc..615264c0362 100644 --- a/src/sage/topology/simplicial_set_constructions.py +++ b/src/sage/topology/simplicial_set_constructions.py @@ -523,10 +523,10 @@ def __init__(self, maps=None): continue simplex_factors = tuple(zip(simplices, tuple(degens))) - s = '(' + ', '.join(['{}'.format(_[0].apply_degeneracies(*_[1])) - for _ in simplex_factors]) + ')' - ls = '(' + ', '.join(['{}'.format(latex(_[0].apply_degeneracies(*_[1]))) - for _ in simplex_factors]) + ')' + s = '(' + ', '.join('{}'.format(_[0].apply_degeneracies(*_[1])) + for _ in simplex_factors) + ')' + ls = '(' + ', '.join('{}'.format(latex(_[0].apply_degeneracies(*_[1]))) + for _ in simplex_factors) + ')' simplex = AbstractSimplex(d, name=s, latex_name=ls) translate[simplex_factors] = simplex # Now compute the faces of simplex. @@ -968,7 +968,7 @@ def _repr_(self): sage: S2.product(K, B) S^2 x Klein bottle x Classifying space of Multiplicative Abelian group isomorphic to C2 """ - return ' x '.join([str(X) for X in self._factors]) + return ' x '.join(str(X) for X in self._factors) def _latex_(self): r""" @@ -983,7 +983,7 @@ def _latex_(self): sage: latex(S2.product(RPoo, S2)) S^{2} \times RP^{\infty} \times S^{2} """ - return ' \\times '.join([latex(X) for X in self._factors]) + return ' \\times '.join(latex(X) for X in self._factors) class ProductOfSimplicialSets_finite(ProductOfSimplicialSets, PullbackOfSimplicialSets_finite): @@ -1934,7 +1934,7 @@ def _repr_(self): Smash product: (S^1 ^ RP^4 ^ S^1) """ s = 'Smash product: (' - s += ' ^ '.join([str(X) for X in self._factors]) + s += ' ^ '.join(str(X) for X in self._factors) s += ')' return s @@ -1949,7 +1949,7 @@ def _latex_(self): sage: latex(S1.smash_product(RP4, S1)) S^{1} \wedge RP^{4} \wedge S^{1} """ - return ' \\wedge '.join([latex(X) for X in self._factors]) + return ' \\wedge '.join(latex(X) for X in self._factors) class WedgeOfSimplicialSets(PushoutOfSimplicialSets, Factors): @@ -2039,7 +2039,7 @@ def _repr_(self): Wedge: (Klein bottle v Klein bottle v Klein bottle) """ s = 'Wedge: (' - s += ' v '.join([str(X) for X in self._factors]) + s += ' v '.join(str(X) for X in self._factors) s += ')' return s @@ -2054,7 +2054,7 @@ def _latex_(self): sage: latex(S1.wedge(RP4, S1)) S^{1} \vee RP^{4} \vee S^{1} """ - return ' \\vee '.join([latex(X) for X in self._factors]) + return ' \\vee '.join(latex(X) for X in self._factors) class WedgeOfSimplicialSets_finite(WedgeOfSimplicialSets, PushoutOfSimplicialSets_finite): @@ -2245,7 +2245,7 @@ def _repr_(self): Disjoint union: (Torus u Torus u RP^3) """ s = 'Disjoint union: (' - s += ' u '.join([str(X) for X in self._factors]) + s += ' u '.join(str(X) for X in self._factors) s += ')' return s @@ -2260,7 +2260,7 @@ def _latex_(self): sage: latex(S1.disjoint_union(RP4, S1)) S^{1} \amalg RP^{4} \amalg S^{1} """ - return ' \\amalg '.join([latex(X) for X in self._factors]) + return ' \\amalg '.join(latex(X) for X in self._factors) class DisjointUnionOfSimplicialSets_finite(DisjointUnionOfSimplicialSets, From b1ce8d6cb361701b388e3c2c3be7e1c831ee85ff Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 17:21:34 -0700 Subject: [PATCH 260/338] sage -t: Handle --optional=!FEATURE --- src/sage/doctest/control.py | 16 +++++++++++++++- src/sage/doctest/external.py | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index a9d11d0863e..f4947d5edce 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -398,6 +398,7 @@ def __init__(self, options, args): if options.verbose: options.show_skipped = True + options.disabled_optional = set() if isinstance(options.optional, str): s = options.optional.lower() options.optional = set(s.split(',')) @@ -421,10 +422,15 @@ def __init__(self, options, args): for system in package_systems()) # Check that all tags are valid for o in options.optional: - if not optionaltag_regex.search(o): + if o.startswith('!'): + if not optionaltag_regex.search(o[1:]): + raise ValueError('invalid optional tag {!r}'.format(o)) + options.disabled_optional.add(o[1:]) + elif not optionaltag_regex.search(o): raise ValueError('invalid optional tag {!r}'.format(o)) options.optional |= auto_optional_tags + options.optional -= options.disabled_optional self.options = options @@ -1340,6 +1346,14 @@ def run(self): self.log("Using --optional=" + self._optional_tags_string()) available_software._allow_external = self.options.optional is True or 'external' in self.options.optional + for o in self.options.disabled_optional: + try: + i = available_software._indices[o] + except KeyError: + pass + else: + available_software._seen[i] = -1 + self.log("Features to be detected: " + ','.join(available_software.detectable())) self.add_files() self.expand_files_into_sources() diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py index 546835698e2..4667c1f1fb3 100644 --- a/src/sage/doctest/external.py +++ b/src/sage/doctest/external.py @@ -471,8 +471,8 @@ def detectable(self): Return the list of names of those features for which testing their presence is allowed. """ return [feature.name - for feature in self._features - if self._allow_external or feature not in self._external_features] + for feature, seen in zip(self._features, self._seen) + if seen >= 0 and (self._allow_external or feature not in self._external_features)] def seen(self): """ From a670ae8ac34dff7c29f84744463a1c4aeb6892d4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 17:38:42 -0700 Subject: [PATCH 261/338] src/bin/sage-runtests: Update documentation of --optional --- src/bin/sage-runtests | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests index 1976bcee5d8..c1f0aee2c18 100755 --- a/src/bin/sage-runtests +++ b/src/bin/sage-runtests @@ -43,13 +43,14 @@ if __name__ == "__main__": # By default, include all tests marked 'sagemath_doc_html' -- see # https://trac.sagemath.org/ticket/25345 and # https://trac.sagemath.org/ticket/26110: - parser.add_argument("--optional", metavar="PKGS", default=_get_optional_defaults(), - help='only run tests including one of the "# optional" tags listed in PKGS; ' + parser.add_argument("--optional", metavar="FEATURES", default=_get_optional_defaults(), + help='only run tests including one of the "# optional" tags listed in FEATURES (separated by commas); ' 'if "sage" is listed, will also run the standard doctests; ' 'if "sagemath_doc_html" is listed, will also run the tests relying on the HTML documentation; ' - 'if "optional" is listed, will also run tests for installed optional (new-style) packages; ' + 'if "optional" is listed, will also run tests for installed optional packages or detected features; ' 'if "external" is listed, will also run tests for available external software; ' - 'if set to "all", then all tests will be run') + 'if set to "all", then all tests will be run; ' + 'use "!FEATURE" to disable FEATURE') parser.add_argument("--randorder", type=int, metavar="SEED", help="randomize order of tests") parser.add_argument("--random-seed", dest="random_seed", type=int, metavar="SEED", help="random seed (integer) for fuzzing doctests", default=os.environ.get("SAGE_DOCTEST_RANDOM_SEED")) From ba86146e5a5e3308026aac49d87d2716a80c6a93 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Jun 2022 11:23:43 -0700 Subject: [PATCH 262/338] src/bin/sage-runtests --help: Say that ! needs to be quoted --- src/bin/sage-runtests | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests index c1f0aee2c18..75e2119c99a 100755 --- a/src/bin/sage-runtests +++ b/src/bin/sage-runtests @@ -50,7 +50,8 @@ if __name__ == "__main__": 'if "optional" is listed, will also run tests for installed optional packages or detected features; ' 'if "external" is listed, will also run tests for available external software; ' 'if set to "all", then all tests will be run; ' - 'use "!FEATURE" to disable FEATURE') + 'use "!FEATURE" to disable tests marked "# optional - FEATURE". ' + 'Note that "!" needs to be quoted or escaped in the shell.') parser.add_argument("--randorder", type=int, metavar="SEED", help="randomize order of tests") parser.add_argument("--random-seed", dest="random_seed", type=int, metavar="SEED", help="random seed (integer) for fuzzing doctests", default=os.environ.get("SAGE_DOCTEST_RANDOM_SEED")) From eb8340ec7fdfb6a87c161c350a0eef372037fb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 6 Jun 2022 07:40:24 +0200 Subject: [PATCH 263/338] a few more changes in sandpile --- src/sage/sandpiles/sandpile.py | 51 +++++++++++++++------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py index 314135bede1..d28d7948d6b 100644 --- a/src/sage/sandpiles/sandpile.py +++ b/src/sage/sandpiles/sandpile.py @@ -1338,7 +1338,7 @@ def _set_recurrents(self): elif self.name() == 'Cycle sandpile graph': n = self.num_verts() one = [1] * (n - 2) - self._recurrents = [SandpileConfig(self, [1]*(n-1))] + [SandpileConfig(self, one[:i]+[0]+one[i:]) for i in range(n - 1)] + self._recurrents = [SandpileConfig(self, [1] * (n - 1))] + [SandpileConfig(self, one[:i] + [0] + one[i:]) for i in range(n - 1)] else: self._recurrents = [] active = [self._max_stable] @@ -1469,7 +1469,7 @@ def _set_group_gens(self): """ D, U, _ = self.reduced_laplacian().transpose().smith_form() F = U.inverse() - self._group_gens = [SandpileConfig(self,[Integer(j) for j in F.column(i)]).equivalent_recurrent() + self._group_gens = [SandpileConfig(self, [Integer(j) for j in F.column(i)]).equivalent_recurrent() for i in range(F.nrows()) if D[i][i] != 1] def group_gens(self, verbose=True): @@ -1521,7 +1521,7 @@ def genus(self): 1 """ if self.is_undirected(): - return self.laplacian().trace()/2 - self.num_verts() + 1 + return self.laplacian().trace() / 2 - self.num_verts() + 1 else: raise UserWarning("The underlying graph must be undirected.") @@ -1562,7 +1562,7 @@ def _set_min_recurrents(self): else: rec = list(self.recurrents()) for r in self.recurrents(): - if exists(rec, lambda x: r>x)[0]: + if exists(rec, lambda x: r > x)[0]: rec.remove(r) self._min_recurrents = rec @@ -1677,7 +1677,7 @@ def _set_avalanche_polynomial(self): True """ n = self.num_verts() - 1 - R = PolynomialRing(QQ,"x",n) + R = PolynomialRing(QQ, "x", n) A = R(0) V = [] for i in range(n): @@ -1687,7 +1687,7 @@ def _set_avalanche_polynomial(self): for r in self.recurrents(): for i in range(n): e = tuple((r + V[i]).stabilize(True)[1].values()) - A += R({e:1}) + A += R({e: 1}) self._avalanche_polynomial = A def avalanche_polynomial(self, multivariable=True): @@ -1726,10 +1726,9 @@ def avalanche_polynomial(self, multivariable=True): """ if multivariable: return deepcopy(self._avalanche_polynomial) - else: - R = self._avalanche_polynomial.parent() - X = R.gens() - return self._avalanche_polynomial.subs({X[i]:X[0] for i in range(1,self.num_verts()-1)}) + X = self._avalanche_polynomial.parent().gens() + return self._avalanche_polynomial.subs({X[i]: X[0] + for i in range(1, self.num_verts() - 1)}) def nonspecial_divisors(self, verbose=True): r""" @@ -1804,9 +1803,8 @@ def canonical_divisor(self): The underlying graph must be undirected. """ if self.is_undirected(): - return SandpileDivisor(self,[self.laplacian()[i][i] - 2 for i in range(self.num_verts())]) - else: - raise UserWarning("Only for undirected graphs.") + return SandpileDivisor(self, [self.laplacian()[i][i] - 2 for i in range(self.num_verts())]) + raise UserWarning("Only for undirected graphs.") def _set_invariant_factors(self): r""" @@ -1985,15 +1983,15 @@ def reorder_vertices(self): key=lambda v: self.distance(v, self._sink), reverse=True) perm = {} for i in range(len(verts)): - perm[verts[i]]=i + perm[verts[i]] = i old = self.dict() new = {} for i in old: entry = {} for j in old[i]: - entry[perm[j]]=old[i][j] + entry[perm[j]] = old[i][j] new[perm[i]] = entry - return Sandpile(new,len(verts)-1) + return Sandpile(new, len(verts) - 1) def _set_jacobian_representatives(self): r""" @@ -2011,26 +2009,23 @@ def _set_jacobian_representatives(self): else: ker = self.laplacian().left_kernel().basis() tau = abs(ker[self._sink_ind]) - if tau==1: - easy = True - else: - easy = False + easy = bool(tau == 1) if easy: result = [] for r in self.superstables(): - D = {v:r[v] for v in self._nonsink_vertices} + D = {v: r[v] for v in self._nonsink_vertices} D[self._sink] = - r.deg() result.append(SandpileDivisor(self, D)) self._jacobian_representatives = result else: result = [] sr = self.superstables() - order = self.group_order()/tau - while len(result) Date: Mon, 6 Jun 2022 08:41:16 +0200 Subject: [PATCH 264/338] a few more tweaks in nu-Tamari --- src/sage/combinat/nu_dyck_word.py | 15 ++++++--------- src/sage/combinat/nu_tamari_lattice.py | 5 +---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index 503b1e00fe5..b319f1326fe 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -1368,15 +1368,12 @@ def __iter__(self, N=[], D=[], i=None, X=None): """ # Define successor function for recursion def transpose_close_open(N): - return [self.element_class(self, - N._list[0:k-1] - + list(reversed(N._list[k-1:k+1])) - + N._list[k+1:]) - for k, v in enumerate(N._list) - if k > 0 - and v == ndw_open_symbol - and N._list[k-1] == ndw_close_symbol - ] + for k, v in enumerate(N._list): + if k > 0 and v == ndw_open_symbol: + w = N._list[k - 1] + if w == ndw_close_symbol: + new = N._list[:k - 1] + [v, w] + N._list[k + 1:] + yield self.element_class(self, new) RES = RecursivelyEnumeratedSet([self.element_class(self, self._nu)], transpose_close_open) diff --git a/src/sage/combinat/nu_tamari_lattice.py b/src/sage/combinat/nu_tamari_lattice.py index f6cb83bbd5b..e90fc4d6791 100644 --- a/src/sage/combinat/nu_tamari_lattice.py +++ b/src/sage/combinat/nu_tamari_lattice.py @@ -66,7 +66,7 @@ def NuTamariLattice(nu): OUTPUT: - - a finite lattice + a finite lattice The elements of the lattice are :func:`\nu-Dyck paths` weakly above @@ -88,11 +88,8 @@ def NuTamariLattice(nu): Finite lattice containing 14 elements sage: NuTamariLattice([1,0,1,0,1,0,0,0,1]) Finite lattice containing 24 elements - """ - NDW = NuDyckWords(nu) - covers = [] elements = [] height = NDW[0].height() From 52f47a0b44da91a394a66602efbffa10d617d93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 6 Jun 2022 11:16:20 +0200 Subject: [PATCH 265/338] cleaning two files in graphs/ --- src/sage/graphs/bipartite_graph.py | 72 ++++++++++++++------------- src/sage/graphs/digraph_generators.py | 33 ++++++------ 2 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/sage/graphs/bipartite_graph.py b/src/sage/graphs/bipartite_graph.py index 6d95e9c07c1..2ec92b073a1 100644 --- a/src/sage/graphs/bipartite_graph.py +++ b/src/sage/graphs/bipartite_graph.py @@ -11,7 +11,7 @@ - Ryan W. Hinton (2010-03-04): overrides for adding and deleting vertices and edges -- Enjeck M. Cleopatra(2022): fixes incorrect partite sets and adds graph +- Enjeck M. Cleopatra (2022): fixes incorrect partite sets and adds graph creation from graph6 string TESTS:: @@ -20,16 +20,13 @@ sage: loads(dumps(B)) == B True -:: - sage: B = BipartiteGraph(graphs.CycleGraph(4)) sage: B == B.copy() True sage: type(B.copy()) """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008 Robert L. Miller # 2018 Julian Rüth # 2022 Enjeck M. Cleopatra @@ -40,7 +37,6 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** - from collections import defaultdict from collections.abc import Iterable import itertools @@ -48,9 +44,9 @@ from .generic_graph import GenericGraph from .graph import Graph from sage.rings.integer import Integer - from sage.misc.decorators import rename_keyword + class BipartiteGraph(Graph): r""" Bipartite graph. @@ -259,7 +255,7 @@ class BipartiteGraph(Graph): sage: B = BipartiteGraph(file_name) sage: B.is_isomorphic(H) True - + #. From a ``graph6`` string:: sage: B = BipartiteGraph('Bo') @@ -282,14 +278,14 @@ class BipartiteGraph(Graph): {0, 1, 2, 3} sage: B.right {4, 5, 6} - + :: sage: B = BipartiteGraph('Bo', partition=[[0], [1, 2]]) sage: B.left {0} sage: B.right {1, 2} - + :: sage: B = BipartiteGraph('F?^T_\n', partition=[[0, 1, 2], [3, 4, 5, 6]]) @@ -423,12 +419,12 @@ def __init__(self, data=None, partition=None, check=True, *args, **kwds): # methods; initialize left and right attributes self.left = set() self.right = set() - + # determine partitions and populate self.left and self.right if not alist_file: if partition is not None: left, right = set(partition[0]), set(partition[1]) - + # Some error checking. if left & right: raise ValueError("the parts are not disjoint") @@ -1321,7 +1317,7 @@ def matching_polynomial(self, algorithm="Godsil", name=None): n = A.ncols() b = [0] * (m + n + 1) for i in range(min(m, n) + 1): - b[m + n - 2*i] = a[i] * (-1) ** i + b[m + n - 2 * i] = a[i] * (-1)**i if name is None: name = 'x' K = PolynomialRing(A.base_ring(), name) @@ -1528,7 +1524,8 @@ def load_afile(self, fname): # read header information num_cols, num_rows = [int(_) for _ in fi.readline().split()] - max_col_degree, max_row_degree = [int(_) for _ in fi.readline().split()] + # next are max_col_degree, max_row_degree, not used + _ = [int(_) for _ in fi.readline().split()] col_degrees = [int(_) for _ in fi.readline().split()] row_degrees = [int(_) for _ in fi.readline().split()] @@ -1636,8 +1633,12 @@ def save_afile(self, fname): max_cdeg = max(self.degree(cnodes)) vnode_to_str = {v: str(i + 1) for i, v in enumerate(vnodes)} cnode_to_str = {v: str(i + 1) for i, v in enumerate(cnodes)} - vnbr_str = lambda idx: cnode_to_str[idx] - cnbr_str = lambda idx: vnode_to_str[idx] + + def vnbr_str(idx): + return cnode_to_str[idx] + + def cnbr_str(idx): + return vnode_to_str[idx] # write header information fi.write("%d %d\n" % (len(vnodes), len(cnodes))) @@ -1962,7 +1963,8 @@ class :class:`MixedIntegerLinearProgram m = networkx.bipartite.hopcroft_karp_matching(h) else: m = networkx.bipartite.eppstein_matching(h) - d.extend((u, v, g.edge_label(u,v)) for u,v in m.items() if v2int[u] < v2int[v]) + d.extend((u, v, g.edge_label(u, v)) for u, v in m.items() + if v2int[u] < v2int[v]) if value_only: return Integer(len(d)) @@ -2087,11 +2089,13 @@ def vertex_cover(self, algorithm="Konig", value_only=False, sage: all(B.vertex_cover(algorithm=algo, value_only=True) == 0 for algo in algorithms) True """ - if not algorithm == "Konig": - return Graph.vertex_cover(self, algorithm=algorithm, value_only=value_only, - reduction_rules=reduction_rules, solver=solver, - verbose=verbose, - integrality_tolerance=integrality_tolerance) + if algorithm != "Konig": + return Graph.vertex_cover(self, algorithm=algorithm, + value_only=value_only, + reduction_rules=reduction_rules, + solver=solver, + verbose=verbose, + integrality_tolerance=integrality_tolerance) if not self.is_connected(): VC = [] @@ -2346,9 +2350,9 @@ class by some canonization function `c`. If `G` and `H` are graphs, EXAMPLES:: - sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), + sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), ....: (1, 7), (1, 8), (2, 6), (2, 7), (2, 8), - ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), + ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), ....: (6, 9), (7, 9)] ) sage: C = B.canonical_label(partition=(B.left,B.right), algorithm='sage') sage: C @@ -2360,9 +2364,9 @@ class by some canonization function `c`. If `G` and `H` are graphs, :: - sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), + sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), ....: (1, 7), (1, 8), (2, 6), (2, 7), (2, 8), - ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), + ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), ....: (6, 9), (7, 9)] ) sage: C, cert = B.canonical_label(partition=(B.left,B.right), certificate=True, algorithm='sage') sage: C @@ -2389,10 +2393,10 @@ class by some canonization function `c`. If `G` and `H` are graphs, :meth:`~sage.graphs.generic_graph.GenericGraph.canonical_label()` """ - + if certificate: C, cert = GenericGraph.canonical_label(self, partition=partition, certificate=certificate, edge_labels=edge_labels, algorithm=algorithm, return_graph=return_graph) - + else: from sage.groups.perm_gps.partn_ref.refinement_graphs import search_tree from sage.graphs.graph import Graph @@ -2400,25 +2404,25 @@ class by some canonization function `c`. If `G` and `H` are graphs, from itertools import chain cert = {} - + if edge_labels or self.has_multiple_edges(): G, partition, relabeling = graph_isom_equivalent_non_edge_labeled_graph(self, partition, return_relabeling=True) G_vertices = list(chain(*partition)) - G_to = {u: i for i,u in enumerate(G_vertices)} + G_to = {u: i for i, u in enumerate(G_vertices)} H = Graph(len(G_vertices)) HB = H._backend - for u,v in G.edge_iterator(labels=False): + for u, v in G.edge_iterator(labels=False): HB.add_edge(G_to[u], G_to[v], None, False) GC = HB.c_graph()[0] partition = [[G_to[vv] for vv in cell] for cell in partition] a, b, c = search_tree(GC, partition, certificate=True, dig=False) - # c is a permutation to the canonical label of G, + # c is a permutation to the canonical label of G, # which depends only on isomorphism class of self. cert = {v: c[G_to[relabeling[v]]] for v in self} - + else: G_vertices = list(chain(*partition)) - G_to = {u: i for i,u in enumerate(G_vertices)} + G_to = {u: i for i, u in enumerate(G_vertices)} H = Graph(len(G_vertices)) HB = H._backend for u, v in self.edge_iterator(labels=False): diff --git a/src/sage/graphs/digraph_generators.py b/src/sage/graphs/digraph_generators.py index 9b6209ffc2f..d464c0e090d 100644 --- a/src/sage/graphs/digraph_generators.py +++ b/src/sage/graphs/digraph_generators.py @@ -65,13 +65,14 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.cpython.string import bytes_to_str - import sys +import subprocess + +from sage.cpython.string import bytes_to_str from sage.misc.randstate import current_randstate from sage.graphs.digraph import DiGraph from sage.graphs.graph import Graph -import subprocess + class DiGraphGenerators(): r""" @@ -345,7 +346,7 @@ def Path(self, n): if n: g.add_path(list(range(n))) - g.set_pos({i: (i,0) for i in range(n)}) + g.set_pos({i: (i, 0) for i in range(n)}) return g def Paley(self, q): @@ -397,8 +398,10 @@ def Paley(self, q): raise ValueError("parameter q must be a prime power") if not mod(q, 4) == 3: raise ValueError("parameter q must be congruent to 3 mod 4") - g = DiGraph([FiniteField(q,'a'), lambda i,j: (i!=j) and (j-i).is_square()], - loops=False, name="Paley digraph with parameter {}".format(q)) + g = DiGraph([FiniteField(q, 'a'), + lambda i, j: (i != j) and (j - i).is_square()], + loops=False, + name="Paley digraph with parameter {}".format(q)) return g def TransitiveTournament(self, n): @@ -545,7 +548,7 @@ def tournaments_nauty(self, n, if strongly_connected: nauty_input += " -c" - nauty_input += " " + str(n) + " " + nauty_input += " " + str(n) + " " import shlex from sage.features.nauty import NautyExecutable @@ -979,7 +982,6 @@ def GeneralizedDeBruijn(self, n, d): GB.add_edge(u, a % n) return GB - def ImaseItoh(self, n, d): r""" Return the Imase-Itoh digraph of order `n` and degree `d`. @@ -1045,7 +1047,6 @@ def ImaseItoh(self, n, d): II.add_edge(u, a % n) return II - def Kautz(self, k, D, vertices='strings'): r""" Return the Kautz digraph of degree `d` and diameter `D`. @@ -1251,7 +1252,7 @@ def RandomDirectedAcyclicGraph(self, n, p, weight_max=None): # integers are on 31 bits. We thus set the pivot value to p*2^31 from sage.misc.prandom import randint from sage.misc.randstate import random - RAND_MAX_f = float(1<<31) + RAND_MAX_f = float(1 << 31) pp = int(round(float(p * RAND_MAX_f))) if weight_max is None: @@ -1265,11 +1266,11 @@ def RandomDirectedAcyclicGraph(self, n, p, weight_max=None): D = DiGraph(n, name=f"RandomWeightedDAG({n}, {p}, {weight_max})") D.add_edges((i, j, randint(1, weight_max)) - for i in range(n) for j in range(i) if random() < pp) + for i in range(n) for j in range(i) if random() < pp) return D - def RandomDirectedGN(self, n, kernel=lambda x:x, seed=None): + def RandomDirectedGN(self, n, kernel=lambda x: x, seed=None): r""" Return a random growing network (GN) digraph with `n` vertices. @@ -1376,7 +1377,7 @@ def RandomDirectedGNP(self, n, p, loops=False, seed=None): if seed is None: seed = current_randstate().long_seed() - return RandomGNP(n, p, directed=True, loops=loops) + return RandomGNP(n, p, directed=True, loops=loops, seed=seed) def RandomDirectedGNM(self, n, m, loops=False): r""" @@ -1672,9 +1673,11 @@ def __call__(self, vertices=None, property=lambda x: True, augment='edges', """ from copy import copy as copyfun if size is not None: - extra_property = lambda x: x.size() == size + def extra_property(x): + return x.size() == size else: - extra_property = lambda x: True + def extra_property(x): + return True if augment == 'vertices': if vertices is None: raise NotImplementedError From 905a6bb15b1e8e41b074e35658df397902bc9e75 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Mon, 6 Jun 2022 16:55:22 +0200 Subject: [PATCH 266/338] trac #33959: some care in sandpile.py --- src/sage/sandpiles/sandpile.py | 81 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py index d28d7948d6b..74ebc2541c2 100644 --- a/src/sage/sandpiles/sandpile.py +++ b/src/sage/sandpiles/sandpile.py @@ -616,21 +616,24 @@ def __init__(self, g, sink=None): h = g.to_dictionary(multiple_edges=True) g = {i: dict(Counter(h[i])) for i in h} else: - vi = {v: g.vertices().index(v) for v in g.vertices()} + vi = {v: i for i, v in enumerate(g.vertices())} ad = g.weighted_adjacency_matrix() - g = {v: {w: ad[vi[v], vi[w]] for w in g.neighbors(v)} - for v in g.vertices()} + g = {v: {w: ad[vi[v], vi[w]] for w in g.neighbor_iterator(v)} + for v in g} else: raise SyntaxError(g) # create digraph and initialize some variables DiGraph.__init__(self, g, weighted=True) self._dict = deepcopy(g) + vertices = self.vertices() if sink is None: - sink = self.vertices()[0] - self._sink = sink # key for sink - self._sink_ind = self.vertices().index(sink) - self._nonsink_vertices = deepcopy(self.vertices()) + self._sink = vertices[0] + self._sink_ind = 0 + else: + self._sink = sink # key for sink + self._sink_ind = vertices.index(sink) + self._nonsink_vertices = vertices del self._nonsink_vertices[self._sink_ind] # compute Laplacians: self._laplacian = self.laplacian_matrix(indegree=False) @@ -1041,8 +1044,8 @@ def _set_in_degrees(self): sage: '_in_degrees' in s.__dict__ True """ - self._in_degrees = {v: 0 for v in self.vertices()} - for e in self.edges(): + self._in_degrees = {v: 0 for v in self} + for e in self.edge_iterator(): self._in_degrees[e[1]] += e[2] def in_degree(self, v=None): @@ -1977,13 +1980,10 @@ def reorder_vertices(self): sage: T.dict() {0: {1: 1}, 1: {0: 1, 2: 1}, 2: {0: 1}} """ - - # first order the vertices according to their distance from the sink - verts = sorted(self.vertices(), - key=lambda v: self.distance(v, self._sink), reverse=True) - perm = {} - for i in range(len(verts)): - perm[verts[i]] = i + # first order the vertices according to their distance to the sink + distance_to_sink = self.reverse().shortest_path_lengths(self._sink) + verts = sorted(self, key=lambda v: distance_to_sink[v], reverse=True) + perm = {v: i for i, v in enumerate(verts)} old = self.dict() new = {} for i in old: @@ -2455,12 +2455,13 @@ def _set_ring(self): sage: '_ring' in S.__dict__ True """ - # first order the vertices according to their distance from the sink - verts = sorted(self.vertices(), - key=lambda v: self.distance(v, self._sink)) + # first order the vertices according to their distance to the sink + distance_to_sink = self.reverse().shortest_path_lengths(self._sink) + verts = sorted(self, key=lambda v: distance_to_sink[v]) # variable i refers to the i-th vertex in self.vertices() - names = [self.vertices().index(v) for v in reversed(verts)] + vertex_to_int = {v: i for i, v in enumerate(self.vertices())} + names = [vertex_to_int[v] for v in reversed(verts)] vars = '' for i in names: @@ -2471,11 +2472,11 @@ def _set_ring(self): # create the ideal gens = [] for i in self.nonsink_vertices(): - new_gen = 'x' + str(self.vertices().index(i)) + new_gen = 'x' + str(vertex_to_int[i]) new_gen += '^' + str(self.out_degree(i)) new_gen += '-' for j in self._dict[i]: - new_gen += 'x' + str(self.vertices().index(j)) + new_gen += 'x' + str(vertex_to_int[j]) new_gen += '^' + str(self._dict[i][j]) + '*' new_gen = new_gen[:-1] gens.append(new_gen) @@ -3535,7 +3536,7 @@ def fire_vertex(self, v): """ c = dict(self) c[v] -= self._sandpile.out_degree(v) - for e in self._sandpile.outgoing_edges(v): + for e in self._sandpile.outgoing_edge_iterator(v): if e[1] != self._sandpile.sink(): c[e[1]] += e[2] return SandpileConfig(self._sandpile,c) @@ -3571,7 +3572,7 @@ def fire_script(self, sigma): for i in range(len(sigma)): v = self._vertices[i] c[v] -= sigma[i]*self._sandpile.out_degree(v) - for e in self._sandpile.outgoing_edges(v): + for e in self._sandpile.outgoing_edge_iterator(v): if e[1] != self._sandpile.sink(): c[e[1]] += sigma[i]*e[2] return SandpileConfig(self._sandpile, c) @@ -3612,7 +3613,7 @@ def fire_unstable(self): c = dict(self) for v in self.unstable(): c[v] -= self._sandpile.out_degree(v) - for e in self._sandpile.outgoing_edges(v): + for e in self._sandpile.outgoing_edge_iterator(v): if e[1] != self._sandpile.sink(): c[e[1]] += e[2] return SandpileConfig(self._sandpile,c) @@ -3638,7 +3639,7 @@ def _set_stabilize(self): dm = divmod(c[v],s.out_degree(v)) c[v] = dm[1] firing_vector[v] += dm[0] - for e in s.outgoing_edges(v): + for e in s.outgoing_edge_iterator(v): if e[1] != s.sink(): c[e[1]] += dm[0]* e[2] unstable = c.unstable() @@ -4156,8 +4157,8 @@ def show(self, sink=True, colors=True, heights=False, directed=None, **kwds): T.delete_vertex(self.sandpile().sink()) if heights: a = {} - for i in T.vertices(): - if i==self.sandpile().sink(): + for i in T: + if i == self.sandpile().sink(): a[i] = str(i) else: a[i] = str(i)+":"+str(self[i]) @@ -4272,12 +4273,12 @@ def __init__(self, S, D): """ if len(D) == S.num_verts(): if type(D) in [dict, SandpileDivisor, SandpileConfig]: - dict.__init__(self,dict(D)) + dict.__init__(self, dict(D)) elif isinstance(D, list): div = {} - for i in range(S.num_verts()): - div[S.vertices()[i]] = D[i] - dict.__init__(self,div) + for i, v in enumerate(S.vertices()): + div[v] = D[i] + dict.__init__(self, div) else: raise SyntaxError(D) @@ -4809,8 +4810,8 @@ def fire_vertex(self, v): """ D = dict(self) D[v] -= self._sandpile.out_degree(v) - for e in self._sandpile.outgoing_edges(v): - D[e[1]]+=e[2] + for e in self._sandpile.outgoing_edge_iterator(v): + D[e[1]] += e[2] return SandpileDivisor(self._sandpile,D) def fire_script(self, sigma): @@ -4844,8 +4845,8 @@ def fire_script(self, sigma): for i in range(len(sigma)): v = self._vertices[i] D[v] -= sigma[i]*self._sandpile.out_degree(v) - for e in self._sandpile.outgoing_edges(v): - D[e[1]]+=sigma[i]*e[2] + for e in self._sandpile.outgoing_edge_iterator(v): + D[e[1]] += sigma[i] * e[2] return SandpileDivisor(self._sandpile, D) def unstable(self): @@ -4884,8 +4885,8 @@ def fire_unstable(self): D = dict(self) for v in self.unstable(): D[v] -= self._sandpile.out_degree(v) - for e in self._sandpile.outgoing_edges(v): - D[e[1]]+=e[2] + for e in self._sandpile.outgoing_edge_iterator(v): + D[e[1]] += e[2] return SandpileDivisor(self._sandpile,D) def _set_q_reduced(self): @@ -6052,9 +6053,7 @@ def show(self, heights=True, directed=None, **kwds): T = Graph(self.sandpile()) if heights: - a = {} - for i in T.vertices(): - a[i] = str(i) + ":" + str(T[i]) + a = {i: str(i) + ":" + str(T[i]) for i in T} T.relabel(a) T.show(**kwds) From ddda2f46316b586aff6fdce5b4b43eaa56184e76 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Mon, 6 Jun 2022 17:07:03 +0200 Subject: [PATCH 267/338] trac #33959: another change --- src/sage/sandpiles/sandpile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py index 74ebc2541c2..0d9563dc291 100644 --- a/src/sage/sandpiles/sandpile.py +++ b/src/sage/sandpiles/sandpile.py @@ -4275,10 +4275,8 @@ def __init__(self, S, D): if type(D) in [dict, SandpileDivisor, SandpileConfig]: dict.__init__(self, dict(D)) elif isinstance(D, list): - div = {} - for i, v in enumerate(S.vertices()): - div[v] = D[i] - dict.__init__(self, div) + div = {v: D[i] for i, v in enumerate(S.vertices())} + dict.__init__(self, div) else: raise SyntaxError(D) From 0f5876a1234d0465abdeb87a1384f5b023a010db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 7 Jun 2022 10:40:26 +0200 Subject: [PATCH 268/338] adding interface to Pari L-function for genus 2 curves --- src/sage/lfunctions/pari.py | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py index 34959343cff..0bf997d7361 100644 --- a/src/sage/lfunctions/pari.py +++ b/src/sage/lfunctions/pari.py @@ -325,6 +325,8 @@ def lfun_eta_quotient(scalings, exponents): """ Return the L-function of an eta-quotient. + This uses :pari:`lfunetaquo`. + INPUT: - scalings -- a list of integers, the scaling factors @@ -372,6 +374,8 @@ def lfun_quadratic_form(qf): """ Return the L-function of a positive definite quadratic form. + This uses :pari:`lfunqf`. + EXAMPLES:: sage: from sage.lfunctions.pari import lfun_quadratic_form, LFunction @@ -385,6 +389,49 @@ def lfun_quadratic_form(qf): return pari.lfunqf(qf.matrix()) +def lfun_genus2(C): + """ + Return the L-function of a curve of genus 2. + + INPUT: + + - ``C`` -- hyperelliptic curve of genus 2 + + Currently, the model needs to be minimal at 2. + + This uses :pari:`lfungenus2`. + + EXAMPLES:: + + sage: from sage.lfunctions.pari import lfun_genus2, LFunction + sage: x = polygen(QQ, 'x') + sage: C = HyperellipticCurve(x^5 + x + 1) + sage: L = LFunction(lfun_genus2(C)) + ... + sage: L(3) + 0.965946926261520 + + sage: C = HyperellipticCurve(x^2+x, x^3+x^2+1) + sage: L = LFunction(lfun_genus2(C)) + sage: L(2) + 0.364286342944359 + + TESTS:: + + sage: x = polygen(QQ, 'x') + sage: H = HyperellipticCurve(x^15 + x + 1) + sage: L = LFunction(lfun_genus2(H)) + Traceback (most recent call last): + ... + ValueError: curve must be hyperelliptic of genus 2 + """ + from sage.schemes.hyperelliptic_curves.hyperelliptic_g2 import HyperellipticCurve_g2 as hyp_g2 + if not isinstance(C, hyp_g2): + raise ValueError('curve must be hyperelliptic of genus 2') + P, Q = C.hyperelliptic_polynomials() + return pari.lfungenus2(P) if not Q else pari.lfungenus2([P, Q]) + + class LFunction(SageObject): r""" Build the L-function from a PARI L-function. From c0114095a3706112f5bda36fa5b6a50ce97b9c94 Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Wed, 8 Jun 2022 13:07:28 -0600 Subject: [PATCH 269/338] trac 33962: fix legendre polynomial --- src/sage/functions/orthogonal_polys.py | 7 +++++++ src/sage/symbolic/ginac/inifcns_orthopoly.cpp | 13 ++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py index aace3cc767d..ade05522bdd 100644 --- a/src/sage/functions/orthogonal_polys.py +++ b/src/sage/functions/orthogonal_polys.py @@ -1290,6 +1290,13 @@ class Func_legendre_P(GinacFunction): Traceback (most recent call last): ... RuntimeError: derivative w.r.t. to the index is not supported yet + + TESTS:: + + # verify that :trac:`33962` is fixed + sage: [legendre_P(n, 0) for n in range(-10, 10)] + [0, 35/128, 0, -5/16, 0, 3/8, 0, -1/2, 0, 1, + 1, 0, -1/2, 0, 3/8, 0, -5/16, 0, 35/128, 0] """ def __init__(self): r""" diff --git a/src/sage/symbolic/ginac/inifcns_orthopoly.cpp b/src/sage/symbolic/ginac/inifcns_orthopoly.cpp index 6693a044098..a591cb4cd7c 100644 --- a/src/sage/symbolic/ginac/inifcns_orthopoly.cpp +++ b/src/sage/symbolic/ginac/inifcns_orthopoly.cpp @@ -185,10 +185,17 @@ static ex legp_eval(const ex& n_, const ex& x) if (n.info(info_flags::even)) { if (is_exactly_a(n)) { const numeric& numn = ex_to(n); - return (numn+*_num_1_p).factorial() / numn.mul(*_num1_2_p).factorial().pow_intexp(2) * numn / _num2_p->pow_intexp(numn.to_int()); + return (numn + *_num_1_p).factorial() + / numn.mul(*_num1_2_p).factorial().pow_intexp(2) + * numn + / _num2_p->pow_intexp(numn.to_int()) + * _num_1_p->pow_intexp(numn.mul(*_num1_2_p).to_int()); } - return gamma(n) / pow(gamma(n/_ex2), - _ex2) / pow(_ex2, n-_ex2) / n; + return gamma(n) + / pow(gamma(n / _ex2), _ex2) + / pow(_ex2, n - _ex2) + / n + * pow(_ex_1, n / _ex2); } } if (is_exactly_a(n) From 0b6382da3b8714b10c48f1ce55ba2ff0f55e7623 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Thu, 9 Jun 2022 09:50:15 +0800 Subject: [PATCH 270/338] more efficient algorithm for square roots modulo 2^n --- src/sage/rings/finite_rings/integer_mod.pyx | 110 +++++++++++++------- 1 file changed, 75 insertions(+), 35 deletions(-) diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 0489e50b1bc..401bd3cd794 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -75,7 +75,7 @@ from cpython.int cimport * from cpython.list cimport * from cpython.ref cimport * -from libc.math cimport log, ceil +from libc.math cimport log2, ceil from sage.libs.gmp.all cimport * @@ -1116,9 +1116,8 @@ cdef class IntegerMod_abstract(FiniteRingElement): them `p`-adically and uses the CRT to find a square root mod `n`. - See also ``square_root_mod_prime_power`` and - ``square_root_mod_prime`` (in this module) for more - algorithmic details. + See also :meth:`square_root_mod_prime_power` and + :meth:`square_root_mod_prime` for more algorithmic details. EXAMPLES:: @@ -2900,9 +2899,8 @@ cdef class IntegerMod_int(IntegerMod_abstract): them `p`-adically and uses the CRT to find a square root mod `n`. - See also ``square_root_mod_prime_power`` and - ``square_root_mod_prime`` (in this module) for more - algorithmic details. + See also :meth:`square_root_mod_prime_power` and + :meth:`square_root_mod_prime` for more algorithmic details. EXAMPLES:: @@ -3891,66 +3889,108 @@ def square_root_mod_prime_power(IntegerMod_abstract a, p, e): Calculates the square root of `a`, where `a` is an integer mod `p^e`. - ALGORITHM: Perform `p`-adically by stripping off even - powers of `p` to get a unit and lifting - `\sqrt{unit} \bmod p` via Newton's method. + ALGORITHM: Compute `p`-adically by stripping off even powers of `p` + to get a unit and lifting `\sqrt{unit} \bmod p` via Newton's method + whenever `p` is odd and via + `\sqrt{1+y} = \sum_{k=0}^\infty \binom{1/2}{k} y^k` + for `p = 2`. AUTHORS: - Robert Bradshaw + - Lorenz Panny (2022): polynomial-time algorithm for `p = 2` EXAMPLES:: sage: from sage.rings.finite_rings.integer_mod import square_root_mod_prime_power - sage: a=Mod(17,2^20) - sage: b=square_root_mod_prime_power(a,2,20) + sage: a = Mod(17,2^20) + sage: b = square_root_mod_prime_power(a,2,20) sage: b^2 == a True :: - sage: a=Mod(72,97^10) - sage: b=square_root_mod_prime_power(a,97,10) + sage: a = Mod(72,97^10) + sage: b = square_root_mod_prime_power(a,97,10) sage: b^2 == a True sage: mod(100, 5^7).sqrt()^2 100 + + TESTS: + + A big example for the binary case (:trac:`33961`):: + + sage: y = Mod(-7, 2^777) + sage: hex(y.sqrt()^2 - y) + '0x0' + + Testing with random squares in random rings:: + + sage: p = random_prime(999) + sage: e = randrange(1, 999) + sage: x = Zmod(p^e).random_element() + sage: (x^2).sqrt()^2 == x^2 + True """ if a.is_zero() or a.is_one(): return a - if p == 2: - if e == 1: - return a - # TODO: implement something that isn't totally idiotic. - for x in a.parent(): - if x**2 == a: - return x - # strip off even powers of p cdef int i, val = a.lift().valuation(p) if val % 2 == 1: - raise ValueError("self must be a square.") + raise ValueError("self must be a square") if val > 0: unit = a._parent(a.lift() // p**val) else: unit = a - # find square root of unit mod p - x = unit.parent()(square_root_mod_prime(mod(unit, p), p)) + cdef int n + + if p == 2: + # squares in Z/2^e are of the form 4^n*(1+8*m) + if unit.lift() % 8 != 1: + raise ValueError("self must be a square") + + if unit == 1: + return a.parent()(one_Z << val//2) - # lift p-adically using Newton iteration - # this is done to higher precision than necessary except at the last step - one_half = ~(a._new_c_from_long(2)) - # need at least (e - val//2) p-adic digits of precision, which doubles - # at each step - cdef int n = ceil(log(e - val//2)/log(2)) - for i in range(n): - x = (x+unit/x) * one_half + # sqrt(1+y) = sum_{k=0}^{oo} binomial(1/2,k) y^k + y = unit - 1 + v = y.valuation(2) + y >>= v + + # 2-valuation of y^k / binomial(1/2,k) is >= (v-2)*k + n = 1 + (e + v-3) // (v-2) + + t = a.parent().one() # unit part + s = 0 # shift + + x = a.parent().one() + for i in range(1, n): + d = Integer(i) << 1 + c = 3 - d + t *= y * c.prime_to_m_part(2) / d.prime_to_m_part(2) + s += v + c.valuation(2) - d.valuation(2) +# assert t.is_unit() and s >= 0 + x += t << s + + else: + # find square root of unit mod p + x = unit.parent()(square_root_mod_prime(mod(unit, p), p)) + + # lift p-adically using Newton iteration + # this is done to higher precision than necessary except at the last step + one_half = ~(a._new_c_from_long(2)) + # need at least (e - val//2) p-adic digits of precision, which doubles + # at each step + n = ceil(log2(e - val//2)) + for i in range(n): + x = (x + unit/x) * one_half # multiply in powers of p (if any) if val > 0: - x *= p**(val // 2) + x *= p**(val//2) return x cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): @@ -4010,7 +4050,7 @@ cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): p = Integer(p) cdef int p_mod_16 = p % 16 - cdef double bits = log(float(p))/log(2) + cdef double bits = log2(float(p)) cdef long r, m cdef Integer resZ From 975f28a911fa54085a339255944527923453ac19 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 9 Jun 2022 08:21:39 +0200 Subject: [PATCH 271/338] 33965: initial --- src/sage/knots/link.py | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index c6680df23c5..b70a6638cb6 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -1958,6 +1958,65 @@ def conway_polynomial(self): conway += coeff * t_poly**M return conway + def khovanov_polynomial(self, var1='q', var2='t', base_ring=ZZ): + r""" + Return the Khovanov polynomial of ``self``. This is the Poincaré + polynomial of the Khovanov homology (in characteristic zero). + + INPUT: + + - ``var1`` -- (default: ``'q'``) the first variable. Its exponents + give the (torsion free) rank of the height of Khovanov homology + - ``var2`` -- (default: ``'t'``) the second variable. Its exponents + give the (torsion free) rank of the degree of Khovanov homology + - ``base_ring`` -- (default: ``ZZ``) the ring of the polynomial's + coefficients + + OUTPUT: + + A two variate Laurent Polynomial over the ``base_ring``, more precisely an + instance of :class:`~sage.rings.polynomial.laurent_polynomial.LaurentPolynomial`. + + EXAMPLES:: + + sage: K = Link([[[1, -2, 3, -1, 2, -3]],[-1, -1, -1]]) + sage: K.khovanov_polynomial() + q^-1 + q^-3 + q^-5*t^-2 + q^-9*t^-3 + sage: K.khovanov_polynomial(base_ring=GF(2)) + q^-1 + q^-3 + q^-5*t^-2 + q^-7*t^-2 + q^-9*t^-3 + + The figure eight knot:: + + sage: L = Link([[1, 6, 2, 7], [5, 2, 6, 3], [3, 1, 4, 8], [7, 5, 8, 4]]) + sage: L.khovanov_polynomial(var1='p') + p^5*t^2 + p*t + p + p^-1 + p^-1*t^-1 + p^-5*t^-2 + sage: L.khovanov_polynomial(var1='p', var2='s', base_ring=GF(4)) + p^5*s^2 + p^3*s^2 + p*s + p + p^-1 + p^-1*s^-1 + p^-3*s^-1 + p^-5*s^-2 + + The Hopf link:: + + sage: B = BraidGroup(2) + sage: b = B([1, 1]) + sage: K = Link(b) + sage: K.khovanov_polynomial() + q^6*t^2 + q^4*t^2 + q^2 + 1 + + .. SEEALSO:: :meth:`khovanov_homology` + """ + L = LaurentPolynomialRing(base_ring, [var1, var2]) + ch = base_ring.characteristic() + coeff = {} + kh = self.khovanov_homology() + from sage.rings.infinity import infinity + for h in kh: + for d in kh[h]: + H = kh[h][d] + gens = [g for g in H.gens() if g.order() == infinity or ch.divides(g.order())] + l = len(gens) + if l: + coeff[(h,d)]=l + return L(coeff) + def determinant(self): r""" Return the determinant of ``self``. From d6bf7a06eb15788636df3d9772b5bb57d22b1502 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 9 Jun 2022 08:32:10 +0200 Subject: [PATCH 272/338] 33965: small fix in docstring --- src/sage/knots/link.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index b70a6638cb6..f84756863fb 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -1961,7 +1961,7 @@ def conway_polynomial(self): def khovanov_polynomial(self, var1='q', var2='t', base_ring=ZZ): r""" Return the Khovanov polynomial of ``self``. This is the Poincaré - polynomial of the Khovanov homology (in characteristic zero). + polynomial of the Khovanov homology. INPUT: From 99345e14d8182d09ac8da35a53af78964d77c2e8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 9 Jun 2022 18:44:50 +0200 Subject: [PATCH 273/338] 33966: initial --- src/sage/knots/knotinfo.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sage/knots/knotinfo.py b/src/sage/knots/knotinfo.py index 9a07897fdc0..45417f83757 100644 --- a/src/sage/knots/knotinfo.py +++ b/src/sage/knots/knotinfo.py @@ -611,6 +611,13 @@ def braid_notation(self, original=False): '{3, {-2, -2, -1, 2, -1}}' sage: L[L.items.braid_notation_old] '{4, {1, -2, 3, -2, -1, -2, -3, -2}}' + + TESTS: + + Check that :trac:`33966` is fixed:: + + sage: KnotInfo.K0_1.braid_notation() + (1,) """ braid_notation = self[self.items.braid_notation] if original: @@ -618,7 +625,7 @@ def braid_notation(self, original=False): if not braid_notation: # don't forget the unknot - return (1, -1) + return (1, ) braid_notation = eval_knotinfo(braid_notation) if type(braid_notation) is list: From 4ae68cc3cf82ab8d3ce5676044fae0fbfe3f8f38 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 14:38:55 -0700 Subject: [PATCH 274/338] foo From d242f96d3302bb9124dd5dc345e80b76e2f3caa3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 15:08:33 -0700 Subject: [PATCH 275/338] src/sage/doctest/control.py: Show also 'git describe --always --dirty' --- src/sage/doctest/control.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index a9d11d0863e..f8e20be3016 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -1337,6 +1337,16 @@ def run(self): self.log("Git branch: " + branch, end="") except subprocess.CalledProcessError: pass + try: + ref = subprocess.check_output(["git", + "--git-dir=" + SAGE_ROOT_GIT, + "describe", + "--always", + "--dirty"]) + ref = ref.decode('utf-8') + self.log("Git ref: " + ref, end="") + except subprocess.CalledProcessError: + pass self.log("Using --optional=" + self._optional_tags_string()) available_software._allow_external = self.options.optional is True or 'external' in self.options.optional From f2468abaa1275cf58dd1ad5cafd111478d0df5ba Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 15:08:56 -0700 Subject: [PATCH 276/338] src/sage/doctest/control.py: Show SAGE_LOCAL, SAGE_VENV --- src/sage/doctest/control.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index f8e20be3016..85866a52e76 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -1322,7 +1322,7 @@ def run(self): return self.run_val_gdb() else: self.create_run_id() - from sage.env import SAGE_ROOT_GIT + from sage.env import SAGE_ROOT_GIT, SAGE_LOCAL, SAGE_VENV # SAGE_ROOT_GIT can be None on distributions which typically # only have the SAGE_LOCAL install tree but not SAGE_ROOT if (SAGE_ROOT_GIT is not None) and os.path.isdir(SAGE_ROOT_GIT): @@ -1348,6 +1348,8 @@ def run(self): except subprocess.CalledProcessError: pass + self.log(f"Running with {SAGE_LOCAL=} and {SAGE_VENV=}") + self.log("Using --optional=" + self._optional_tags_string()) available_software._allow_external = self.options.optional is True or 'external' in self.options.optional self.log("Features to be detected: " + ','.join(available_software.detectable())) From 94d9d75d07444fac858d9954992ccc89e6bcb349 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Fri, 10 Jun 2022 09:24:07 +0900 Subject: [PATCH 277/338] Fixing bad link in permutation.py. --- src/sage/combinat/permutation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 1dce5cdfa06..abfa7bd42fb 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -4760,7 +4760,7 @@ def remove_extra_fixed_points(self): identity permutation. This is mostly a helper method for - :module:`sage.combinat.schubert_polynomial`, where it is + :mod:`sage.combinat.schubert_polynomial`, where it is used to normalize finitary permutations of `\{1,2,3,\ldots\}`. From 4c0e7d75dbf60a415134689e9bd62c1e91042335 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 20:45:27 -0700 Subject: [PATCH 278/338] sage.algebras: Replace $...$ in docstrings by `...` --- src/sage/algebras/commutative_dga.py | 6 +- .../steenrod/steenrod_algebra_mult.py | 114 +++++++++--------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 327d7ae8f5e..ff80254caf9 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -2281,7 +2281,7 @@ def cohomology_generators(self, max_degree): ALGORITHM: - Reduce a basis of the `n`'th cohomology modulo all the degree $n$ + Reduce a basis of the `n`'th cohomology modulo all the degree `n` products of the lower degree cohomologies. EXAMPLES:: @@ -2292,12 +2292,12 @@ def cohomology_generators(self, max_degree): {1: [a], 2: [x], 3: [a*y]} The previous example has infinitely generated cohomology: - $a y^n$ is a cohomology generator for each $n$:: + `a y^n` is a cohomology generator for each `n`:: sage: B.cohomology_generators(10) {1: [a], 2: [x], 3: [a*y], 5: [a*y^2], 7: [a*y^3], 9: [a*y^4]} - In contrast, the corresponding algebra in characteristic $p$ + In contrast, the corresponding algebra in characteristic `p` has finitely generated cohomology:: sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) diff --git a/src/sage/algebras/steenrod/steenrod_algebra_mult.py b/src/sage/algebras/steenrod/steenrod_algebra_mult.py index e2c1e888b66..0934c31f92d 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_mult.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_mult.py @@ -13,13 +13,13 @@ See Milnor's paper [Mil1958]_ for proofs, etc. -To multiply Milnor basis elements $\text{Sq}(r_1, r_2, ...)$ and -$\text{Sq}(s_1, s_2,...)$ at the prime 2, form all possible matrices -$M$ with rows and columns indexed starting at 0, with position (0,0) -deleted (or ignored), with $s_i$ equal to the sum of column $i$ for -each $i$, and with $r_j$ equal to the 'weighted' sum of row $j$. The -weights are as follows: elements from column $i$ are multiplied by -$2^i$. For example, to multiply $\text{Sq}(2)$ and $\text{Sq}(1,1)$, +To multiply Milnor basis elements `\text{Sq}(r_1, r_2, ...)` and +`\text{Sq}(s_1, s_2,...)` at the prime 2, form all possible matrices +`M` with rows and columns indexed starting at 0, with position (0,0) +deleted (or ignored), with `s_i` equal to the sum of column `i` for +each `i`, and with `r_j` equal to the 'weighted' sum of row `j`. The +weights are as follows: elements from column `i` are multiplied by +`2^i`. For example, to multiply `\text{Sq}(2)` and `\text{Sq}(1,1)`, form the matrices .. MATH:: @@ -34,18 +34,18 @@ 0 & 1 & 0 \end{Vmatrix} -(The $*$ is the ignored (0,0)-entry of the matrix.) For each such -matrix $M$, compute a multinomial coefficient, mod 2: for each -diagonal $\{m_{ij}: i+j=n\}$, compute $(\sum m_{i,j}!) / (m_{0,n}! -m_{1,n-1}! ... m_{n,0}!)$. Multiply these together for all $n$. (To +(The `*` is the ignored (0,0)-entry of the matrix.) For each such +matrix `M`, compute a multinomial coefficient, mod 2: for each +diagonal `\{m_{ij}: i+j=n\}`, compute `(\sum m_{i,j}!) / (m_{0,n}! +m_{1,n-1}! ... m_{n,0}!)`. Multiply these together for all `n`. (To compute this mod 2, view the entries of the matrix as their base 2 expansions; then this coefficient is zero if and only if there is some diagonal containing two numbers which have a summand in common in their base 2 expansion. For example, if 3 and 10 are in the same -diagonal, the coefficient is zero, because $3=1+2$ and $10=2+8$: they +diagonal, the coefficient is zero, because `3=1+2` and `10=2+8`: they both have a summand of 2.) -Now, for each matrix with multinomial coefficient 1, let $t_n$ be +Now, for each matrix with multinomial coefficient 1, let `t_n` be the sum of the nth diagonal in the matrix; then .. MATH:: @@ -53,12 +53,12 @@ \text{Sq}(r_1, r_2, ...) \text{Sq}(s_1, s_2, ...) = \sum \text{Sq}(t_1, t_2, ...) The function :func:`milnor_multiplication` takes as input two tuples -of non-negative integers, $r$ and $s$, which represent -$\text{Sq}(r)=\text{Sq}(r_1, r_2, ...)$ and -$\text{Sq}(s)=\text{Sq}(s_1, s_2, ...)$; it returns as output a -dictionary whose keys are tuples $t=(t_1, t_2, ...)$ of non-negative +of non-negative integers, `r` and `s`, which represent +`\text{Sq}(r)=\text{Sq}(r_1, r_2, ...)` and +`\text{Sq}(s)=\text{Sq}(s_1, s_2, ...)`; it returns as output a +dictionary whose keys are tuples `t=(t_1, t_2, ...)` of non-negative integers, and for each tuple the associated value is the coefficient -of $\text{Sq}(t)$ in the product formula. (Since we are working mod 2, +of `\text{Sq}(t)` in the product formula. (Since we are working mod 2, this coefficient is 1 -- if it is zero, the element is omitted from the dictionary altogether). @@ -66,9 +66,9 @@ As for the `p=2` case, see Milnor's paper [Mil1958]_ for proofs. -Fix an odd prime $p$. There are three steps to multiply Milnor basis -elements $Q_{f_1} Q_{f_2} ... \mathcal{P}(q_1, q_2, ...)$ and -$Q_{g_1} Q_{g_2} ... \mathcal{P}(s_1, s_2,...)$: first, use the formula +Fix an odd prime `p`. There are three steps to multiply Milnor basis +elements `Q_{f_1} Q_{f_2} ... \mathcal{P}(q_1, q_2, ...)` and +`Q_{g_1} Q_{g_2} ... \mathcal{P}(s_1, s_2,...)`: first, use the formula .. MATH:: @@ -77,9 +77,9 @@ + Q_{k+2} \mathcal{P}(q_1, q_2 - p^k, ...) + ... -Second, use the fact that the $Q_k$'s form an exterior algebra: $Q_k^2 = -0$ for all $k$, and if $i \neq j$, then $Q_i$ and $Q_j$ anticommute: -$Q_i Q_j = -Q_j Q_i$. After these two steps, the product is a linear +Second, use the fact that the `Q_k`'s form an exterior algebra: `Q_k^2 = +0` for all `k`, and if `i \neq j`, then `Q_i` and `Q_j` anticommute: +`Q_i Q_j = -Q_j Q_i`. After these two steps, the product is a linear combination of terms of the form .. MATH:: @@ -87,13 +87,13 @@ Q_{e_1} Q_{e_2} ... \mathcal{P}(r_1, r_2, ...) \mathcal{P}(s_1, s_2, ...). Finally, use Milnor matrices to multiply the pairs of -$\mathcal{P}(...)$ terms, as at the prime 2: form all possible -matrices $M$ with rows and columns indexed starting at 0, with -position (0,0) deleted (or ignored), with $s_i$ equal to the sum of -column $i$ for each $i$, and with $r_j$ equal to the weighted sum of -row $j$: elements from column $i$ are multiplied by $p^i$. For -example when $p=5$, to multiply $\mathcal{P}(5)$ and -$\mathcal{P}(1,1)$, form the matrices +`\mathcal{P}(...)` terms, as at the prime 2: form all possible +matrices `M` with rows and columns indexed starting at 0, with +position (0,0) deleted (or ignored), with `s_i` equal to the sum of +column `i` for each `i`, and with `r_j` equal to the weighted sum of +row `j`: elements from column `i` are multiplied by `p^i`. For +example when `p=5`, to multiply `\mathcal{P}(5)` and +`\mathcal{P}(1,1)`, form the matrices .. MATH:: @@ -107,30 +107,30 @@ 0 & 1 & 0 \end{Vmatrix} -For each such matrix $M$, compute a multinomial coefficient, mod $p$: -for each diagonal $\{m_{ij}: i+j=n\}$, compute $(\sum m_{i,j}!) / +For each such matrix `M`, compute a multinomial coefficient, mod `p`: +for each diagonal `\{m_{ij}: i+j=n\}`, compute `(\sum m_{i,j}!) / (m_{0,n}! m_{1,n-1}! ... m_{n,0}!)$. Multiply these together for -all $n$. +all `n`. -Now, for each matrix with nonzero multinomial coefficient $b_M$, let -$t_n$ be the sum of the $n$-th diagonal in the matrix; then +Now, for each matrix with nonzero multinomial coefficient `b_M`, let +`t_n` be the sum of the `n`-th diagonal in the matrix; then .. MATH:: \mathcal{P}(r_1, r_2, ...) \mathcal{P}(s_1, s_2, ...) = \sum b_M \mathcal{P}(t_1, t_2, ...) -For example when $p=5$, we have +For example when `p=5`, we have .. MATH:: \mathcal{P}(5) \mathcal{P}(1,1) = \mathcal{P}(6,1) + 2 \mathcal{P}(0,2). The function :func:`milnor_multiplication` takes as input two pairs of -tuples of non-negative integers, $(g,q)$ and $(f,s)$, which represent -$Q_{g_1} Q_{g_2} ... \mathcal{P}(q_1, q_2, ...)$ and -$Q_{f_1} Q_{f_2} ... \mathcal{P}(s_1, s_2, ...)$. It returns as output a -dictionary whose keys are pairs of tuples $(e,t)$ of non-negative +tuples of non-negative integers, `(g,q)` and `(f,s)`, which represent +`Q_{g_1} Q_{g_2} ... \mathcal{P}(q_1, q_2, ...)` and +`Q_{f_1} Q_{f_2} ... \mathcal{P}(s_1, s_2, ...)`. It returns as output a +dictionary whose keys are pairs of tuples `(e,t)` of non-negative integers, and for each tuple the associated value is the coefficient in the product formula. @@ -216,10 +216,10 @@ def milnor_multiplication(r,s): Dictionary of terms of the form (tuple: coeff), where 'tuple' is a tuple of non-negative integers and 'coeff' is 1. - This computes Milnor matrices for the product of $\text{Sq}(r)$ - and $\text{Sq}(s)$, computes their multinomial coefficients, and - for each matrix whose coefficient is 1, add $\text{Sq}(t)$ to the - output, where $t$ is the tuple formed by the diagonals sums from + This computes Milnor matrices for the product of `\text{Sq}(r)` + and `\text{Sq}(s)`, computes their multinomial coefficients, and + for each matrix whose coefficient is 1, add `\text{Sq}(t)` to the + output, where `t` is the tuple formed by the diagonals sums from the matrix. EXAMPLES:: @@ -327,11 +327,11 @@ def multinomial(list): None if the multinomial coefficient is 0, or sum of list if it is 1 - Given the input $[n_1, n_2, n_3, ...]$, this computes the + Given the input `[n_1, n_2, n_3, ...]`, this computes the multinomial coefficient $(n_1 + n_2 + n_3 + ...)! / (n_1! n_2! n_3! ...)$, mod 2. The method is roughly this: expand each - $n_i$ in binary. If there is a 1 in the same digit for any $n_i$ - and $n_j$ with $i\neq j$, then the coefficient is 0; otherwise, it + `n_i` in binary. If there is a 1 in the same digit for any `n_i` + and `n_j` with `i\neq j`, then the coefficient is 0; otherwise, it is 1. EXAMPLES:: @@ -387,8 +387,8 @@ def milnor_multiplication_odd(m1,m2,p): a pair of tuples, as for r and s, and 'coeff' is an integer mod p. This computes the product of the Milnor basis elements - $Q_{e_1} Q_{e_2} ... P(r_1, r_2, ...)$ and - $Q_{f_1} Q_{f_2} ... P(s_1, s_2, ...)$. + `Q_{e_1} Q_{e_2} ... P(r_1, r_2, ...)` and + `Q_{f_1} Q_{f_2} ... P(s_1, s_2, ...)`. EXAMPLES:: @@ -578,15 +578,15 @@ def multinomial_odd(list,p): Associated multinomial coefficient, mod p - Given the input $[n_1, n_2, n_3, ...]$, this computes the + Given the input `[n_1, n_2, n_3, ...]`, this computes the multinomial coefficient $(n_1 + n_2 + n_3 + ...)! / (n_1! n_2! - n_3! ...)$, mod $p$. The method is this: expand each $n_i$ in - base $p$: $n_i = \sum_j p^j n_{ij}$. Do the same for the sum of - the $n_i$'s, which we call $m$: $m = \sum_j p^j m_j$. Then the - multinomial coefficient is congruent, mod $p$, to the product of - the multinomial coefficients $m_j! / (n_{1j}! n_{2j}! ...)$. + n_3! ...)`, mod `p`. The method is this: expand each `n_i` in + base `p`: `n_i = \sum_j p^j n_{ij}`. Do the same for the sum of + the `n_i`'s, which we call `m`: `m = \sum_j p^j m_j`. Then the + multinomial coefficient is congruent, mod `p`, to the product of + the multinomial coefficients `m_j! / (n_{1j}! n_{2j}! ...)`. - Furthermore, any multinomial coefficient $m! / (n_1! n_2! ...)$ + Furthermore, any multinomial coefficient `m! / (n_1! n_2! ...)` can be computed as a product of binomial coefficients: it equals .. MATH:: From 7b6016f23cebfc749932b95945cbcf7fac7ee114 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 20:47:15 -0700 Subject: [PATCH 279/338] sage.calculus: Replace $...$ in docstrings by `...` --- src/sage/calculus/integration.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/calculus/integration.pyx b/src/sage/calculus/integration.pyx index da48f93de4c..f2125bbc2d7 100644 --- a/src/sage/calculus/integration.pyx +++ b/src/sage/calculus/integration.pyx @@ -111,12 +111,12 @@ def numerical_integral(func, a, b=None, EXAMPLES: - To integrate the function $x^2$ from 0 to 1, we do :: + To integrate the function `x^2` from 0 to 1, we do :: sage: numerical_integral(x^2, 0, 1, max_points=100) (0.3333333333333333, 3.700743415417188e-15) - To integrate the function $\sin(x)^3 + \sin(x)$ we do :: + To integrate the function `\sin(x)^3 + \sin(x)` we do :: sage: numerical_integral(sin(x)^3 + sin(x), 0, pi) (3.333333333333333, 3.700743415417188e-14) From 6e2d614510ae0c2236f041fbf0e3e0c4d1e5905d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 20:56:13 -0700 Subject: [PATCH 280/338] sage.categories, coding, databases: Replace $...$ in docstrings by `...` --- src/sage/categories/action.pyx | 2 +- src/sage/categories/algebra_modules.py | 2 +- src/sage/categories/coxeter_groups.py | 24 ++++++------- .../examples/commutative_additive_monoids.py | 2 +- .../commutative_additive_semigroups.py | 2 +- src/sage/categories/examples/semigroups.py | 2 +- .../categories/examples/semigroups_cython.pyx | 2 +- src/sage/categories/finite_monoids.py | 12 +++---- src/sage/categories/finite_semigroups.py | 10 +++--- src/sage/categories/g_sets.py | 4 +-- src/sage/categories/simplicial_sets.py | 10 +++--- src/sage/coding/binary_code.pyx | 34 +++++++++---------- src/sage/coding/guava.py | 2 +- src/sage/coding/reed_muller_code.py | 4 +-- src/sage/combinat/designs/covering_design.py | 2 +- src/sage/combinat/parallelogram_polyomino.py | 2 +- src/sage/combinat/posets/posets.py | 2 +- src/sage/combinat/words/word_generators.py | 2 +- src/sage/databases/cunningham_tables.py | 2 +- src/sage/databases/db_modular_polynomials.py | 6 ++-- 20 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 0a2085f6f52..b15cebde220 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -4,7 +4,7 @@ Group, ring, etc. actions on objects The terminology and notation used is suggestive of groups acting on sets, but this framework can be used for modules, algebras, etc. -A group action $G \times S \rightarrow S$ is a functor from $G$ to Sets. +A group action `G \times S \rightarrow S` is a functor from `G` to Sets. .. WARNING:: diff --git a/src/sage/categories/algebra_modules.py b/src/sage/categories/algebra_modules.py index d2e16148fd8..2472989723d 100644 --- a/src/sage/categories/algebra_modules.py +++ b/src/sage/categories/algebra_modules.py @@ -15,7 +15,7 @@ class AlgebraModules(Category_module): """ - The category of modules over a fixed algebra $A$. + The category of modules over a fixed algebra `A`. EXAMPLES:: diff --git a/src/sage/categories/coxeter_groups.py b/src/sage/categories/coxeter_groups.py index 543f5a3763e..3f164f536a1 100644 --- a/src/sage/categories/coxeter_groups.py +++ b/src/sage/categories/coxeter_groups.py @@ -1924,8 +1924,8 @@ def canonical_matrix(self): def coset_representative(self, index_set, side='right'): r""" Return the unique shortest element of the Coxeter group - $W$ which is in the same left (resp. right) coset as - ``self``, with respect to the parabolic subgroup $W_I$. + `W` which is in the same left (resp. right) coset as + ``self``, with respect to the parabolic subgroup `W_I`. INPUT: @@ -2605,7 +2605,7 @@ def apply_demazure_product(self, element, side='right', def min_demazure_product_greater(self, element): r""" - Find the unique Bruhat-minimum element ``u`` such that ``v`` $\le$ ``w`` * ``u`` where ``v`` is ``self``, ``w`` is ``element`` and ``*`` is the Demazure product. + Find the unique Bruhat-minimum element ``u`` such that ``v`` `\le` ``w`` * ``u`` where ``v`` is ``self``, ``w`` is ``element`` and ``*`` is the Demazure product. INPUT: @@ -2651,13 +2651,13 @@ def deodhar_factor_element(self, w, index_set): - ``index_set`` is a subset of Dynkin nodes defining a parabolic subgroup ``W'`` of ``W`` It is assumed that ``v = self`` and ``w`` are minimum length coset representatives - for ``W/W'`` such that ``v`` $\le$ ``w`` in Bruhat order. + for ``W/W'`` such that ``v`` `\le` ``w`` in Bruhat order. OUTPUT: Deodhar's element ``f(v,w)`` is the unique element of ``W'`` such that, - for all ``v'`` and ``w'`` in ``W'``, ``vv'`` $\le$ ``ww'`` in ``W`` if and only if - ``v'`` $\le$ ``f(v,w) * w'`` in ``W'`` where ``*`` is the Demazure product. + for all ``v'`` and ``w'`` in ``W'``, ``vv'`` `\le` ``ww'`` in ``W`` if and only if + ``v'`` `\le` ``f(v,w) * w'`` in ``W'`` where ``*`` is the Demazure product. EXAMPLES:: @@ -2698,9 +2698,9 @@ def deodhar_factor_element(self, w, index_set): def deodhar_lift_up(self, w, index_set): r""" - Letting ``v = self``, given a Bruhat relation ``v W'`` $\le$ ``w W'`` among cosets + Letting ``v = self``, given a Bruhat relation ``v W'`` `\le` ``w W'`` among cosets with respect to the subgroup ``W'`` given by the Dynkin node subset ``index_set``, - returns the Bruhat-minimum lift ``x`` of ``wW'`` such that ``v`` $\le$ ``x``. + returns the Bruhat-minimum lift ``x`` of ``wW'`` such that ``v`` `\le` ``x``. INPUT: @@ -2710,7 +2710,7 @@ def deodhar_lift_up(self, w, index_set): OUTPUT: The unique Bruhat-minimum element ``x`` in ``W`` such that ``x W' = w W'`` - and ``v`` $\le$ ``x``. + and ``v`` `\le` ``x``. .. SEEALSO:: :meth:`sage.categories.coxeter_groups.CoxeterGroups.ElementMethods.deodhar_lift_down` @@ -2732,9 +2732,9 @@ def deodhar_lift_up(self, w, index_set): def deodhar_lift_down(self, w, index_set): r""" - Letting ``v = self``, given a Bruhat relation ``v W'`` $\ge$ ``w W'`` among cosets + Letting ``v = self``, given a Bruhat relation ``v W'`` `\ge` ``w W'`` among cosets with respect to the subgroup ``W'`` given by the Dynkin node subset ``index_set``, - returns the Bruhat-maximum lift ``x`` of ``wW'`` such that ``v`` $\ge$ ``x``. + returns the Bruhat-maximum lift ``x`` of ``wW'`` such that ``v`` `\ge` ``x``. INPUT: @@ -2744,7 +2744,7 @@ def deodhar_lift_down(self, w, index_set): OUTPUT: The unique Bruhat-maximum element ``x`` in ``W`` such that ``x W' = w W'`` - and ``v $\ge$ ``x``. + and ``v `\ge` ``x``. .. SEEALSO:: :meth:`sage.categories.coxeter_groups.CoxeterGroups.ElementMethods.deodhar_lift_up` diff --git a/src/sage/categories/examples/commutative_additive_monoids.py b/src/sage/categories/examples/commutative_additive_monoids.py index 01c2821f64f..229f66ae7e0 100644 --- a/src/sage/categories/examples/commutative_additive_monoids.py +++ b/src/sage/categories/examples/commutative_additive_monoids.py @@ -32,7 +32,7 @@ class FreeCommutativeAdditiveMonoid(FreeCommutativeAdditiveSemigroup): sage: S.additive_semigroup_generators() Family (a, b, c, d) - with product rule given by $a \times b = a$ for all $a, b$:: + with product rule given by `a \times b = a` for all `a, b`:: sage: (a,b,c,d) = S.additive_semigroup_generators() diff --git a/src/sage/categories/examples/commutative_additive_semigroups.py b/src/sage/categories/examples/commutative_additive_semigroups.py index a278d781285..88cdeeee55d 100644 --- a/src/sage/categories/examples/commutative_additive_semigroups.py +++ b/src/sage/categories/examples/commutative_additive_semigroups.py @@ -34,7 +34,7 @@ class FreeCommutativeAdditiveSemigroup(UniqueRepresentation, Parent): sage: S.additive_semigroup_generators() Family (a, b, c, d) - with product rule given by $a \times b = a$ for all $a, b$:: + with product rule given by `a \times b = a` for all `a, b`:: sage: (a,b,c,d) = S.additive_semigroup_generators() diff --git a/src/sage/categories/examples/semigroups.py b/src/sage/categories/examples/semigroups.py index 180cef37fca..4d7767a3c51 100644 --- a/src/sage/categories/examples/semigroups.py +++ b/src/sage/categories/examples/semigroups.py @@ -31,7 +31,7 @@ class LeftZeroSemigroup(UniqueRepresentation, Parent): sage: S.some_elements() [3, 42, 'a', 3.4, 'raton laveur'] - with product rule given by $a \times b = a$ for all $a, b$:: + with product rule given by `a \times b = a` for all `a, b`:: sage: S('hello') * S('world') 'hello' diff --git a/src/sage/categories/examples/semigroups_cython.pyx b/src/sage/categories/examples/semigroups_cython.pyx index c05ab880fb6..95e79315e6b 100644 --- a/src/sage/categories/examples/semigroups_cython.pyx +++ b/src/sage/categories/examples/semigroups_cython.pyx @@ -151,7 +151,7 @@ class LeftZeroSemigroup(LeftZeroSemigroupPython): sage: S.some_elements() [3, 42, 'a', 3.4, 'raton laveur'] - with product rule is given by $a \times b = a$ for all $a,b$. :: + with product rule is given by `a \times b = a` for all `a,b`. :: sage: S('hello') * S('world') 'hello' diff --git a/src/sage/categories/finite_monoids.py b/src/sage/categories/finite_monoids.py index 69e4a6bc83e..c58cfc3e4e8 100644 --- a/src/sage/categories/finite_monoids.py +++ b/src/sage/categories/finite_monoids.py @@ -35,17 +35,17 @@ def nerve(self): r""" The nerve (classifying space) of this monoid. - OUTPUT: the nerve $BG$ (if $G$ denotes this monoid), as a - simplicial set. The $k$-dimensional simplices of this - object are indexed by products of $k$ elements in the + OUTPUT: the nerve `BG` (if `G` denotes this monoid), as a + simplicial set. The `k`-dimensional simplices of this + object are indexed by products of `k` elements in the monoid: .. MATH:: a_1 * a_2 * \cdots * a_k - The 0th face of this is obtained by deleting $a_1$, and - the $k$-th face is obtained by deleting $a_k$. The other + The 0th face of this is obtained by deleting `a_1`, and + the `k`-th face is obtained by deleting `a_k`. The other faces are obtained by multiplying elements: the 1st face is @@ -58,7 +58,7 @@ def nerve(self): set. A simplex in this simplicial set will be degenerate if in - the corresponding product of $k$ elements, one of those + the corresponding product of `k` elements, one of those elements is the identity. So we only need to keep track of the products of non-identity elements. Similarly, if a product `a_{i-1} a_i` is the identity element, then the diff --git a/src/sage/categories/finite_semigroups.py b/src/sage/categories/finite_semigroups.py index 13687e6004b..a7f9b9a20a1 100644 --- a/src/sage/categories/finite_semigroups.py +++ b/src/sage/categories/finite_semigroups.py @@ -74,14 +74,14 @@ def idempotents(self): @cached_method def j_classes(self): r""" - Returns the $J$-classes of the semigroup. + Returns the `J`-classes of the semigroup. - Two elements $u$ and $v$ of a monoid are in the same $J$-class - if $u$ divides $v$ and $v$ divides $u$. + Two elements `u` and `v` of a monoid are in the same `J`-class + if `u` divides `v` and `v` divides `u`. OUTPUT: - All the $J$-classes of self, as a list of lists. + All the `J`-classes of self, as a list of lists. EXAMPLES:: @@ -117,7 +117,7 @@ def j_transversal_of_idempotents(self): sage: S = FiniteSemigroups().example(alphabet=('a','b', 'c')) - The chosen elements depend on the order of each $J$-class, + The chosen elements depend on the order of each `J`-class, and that order is random when using Python 3. :: sage: sorted(S.j_transversal_of_idempotents()) # random diff --git a/src/sage/categories/g_sets.py b/src/sage/categories/g_sets.py index f28c34a4223..b9447203e42 100644 --- a/src/sage/categories/g_sets.py +++ b/src/sage/categories/g_sets.py @@ -15,11 +15,11 @@ ############################################################# # GSets -# $G$-Sets play an important role in permutation groups. +# `G`-Sets play an important role in permutation groups. ############################################################# class GSets(Category): """ - The category of $G$-sets, for a group $G$. + The category of `G`-sets, for a group `G`. EXAMPLES:: diff --git a/src/sage/categories/simplicial_sets.py b/src/sage/categories/simplicial_sets.py index 7376e4ea721..039f7c60230 100644 --- a/src/sage/categories/simplicial_sets.py +++ b/src/sage/categories/simplicial_sets.py @@ -509,13 +509,13 @@ def unset_base_point(self): def fat_wedge(self, n): """ - Return the $n$-th fat wedge of this pointed simplicial set. + Return the `n`-th fat wedge of this pointed simplicial set. - This is the subcomplex of the $n$-fold product `X^n` + This is the subcomplex of the `n`-fold product `X^n` consisting of those points in which at least one - factor is the base point. Thus when $n=2$, this is the - wedge of the simplicial set with itself, but when $n$ - is larger, the fat wedge is larger than the $n$-fold + factor is the base point. Thus when `n=2`, this is the + wedge of the simplicial set with itself, but when `n` + is larger, the fat wedge is larger than the `n`-fold wedge. EXAMPLES:: diff --git a/src/sage/coding/binary_code.pyx b/src/sage/coding/binary_code.pyx index 11af1f7aadf..df4ce58c212 100644 --- a/src/sage/coding/binary_code.pyx +++ b/src/sage/coding/binary_code.pyx @@ -1,13 +1,13 @@ r""" Optimized low-level binary code representation -Some computations with linear binary codes. Fix a basis for $GF(2)^n$. -A linear binary code is a linear subspace of $GF(2)^n$, together with -this choice of basis. A permutation $g \in S_n$ of the fixed basis -gives rise to a permutation of the vectors, or words, in $GF(2)^n$, -sending $(w_i)$ to $(w_{g(i)})$. The permutation automorphism group of -the code $C$ is the set of permutations of the basis that bijectively -map $C$ to itself. Note that if $g$ is such a permutation, then +Some computations with linear binary codes. Fix a basis for `GF(2)^n`. +A linear binary code is a linear subspace of `GF(2)^n`, together with +this choice of basis. A permutation `g \in S_n` of the fixed basis +gives rise to a permutation of the vectors, or words, in `GF(2)^n`, +sending `(w_i)` to `(w_{g(i)})`. The permutation automorphism group of +the code `C` is the set of permutations of the basis that bijectively +map `C` to itself. Note that if `g` is such a permutation, then .. MATH:: @@ -15,7 +15,7 @@ map $C$ to itself. Note that if $g$ is such a permutation, then Over other fields, it is also required that the map be linear, which as per above boils down to scalar multiplication. However, over -$GF(2),$ the only scalars are 0 and 1, so the linearity condition has +`GF(2),` the only scalars are 0 and 1, so the linearity condition has trivial effect. AUTHOR: @@ -279,7 +279,7 @@ def test_word_perms(t_limit=5.0): cdef WordPermutation *create_word_perm(object list_perm): r""" Create a word permutation from a Python list permutation L, i.e. such that - $i \mapsto L[i]$. + `i \mapsto L[i]`. """ cdef int i, j, parity, comb, words_per_chunk, num_chunks = 1 cdef codeword *images_i @@ -426,7 +426,7 @@ cdef WordPermutation *create_id_word_perm(int degree): cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation *h): r""" - Create the composition of word permutations $g \circ h$. + Create the composition of word permutations `g \circ h`. """ cdef int i, j, parity, comb, words_per_chunk, num_chunks = 1 cdef codeword *images_i @@ -477,7 +477,7 @@ cdef WordPermutation *create_comp_word_perm(WordPermutation *g, WordPermutation cdef WordPermutation *create_inv_word_perm(WordPermutation *g): r""" - Create the inverse $g^{-1}$ of the word permutation of $g$. + Create the inverse `g^{-1}` of the word permutation of `g`. """ cdef int i, j cdef int *array = sig_malloc( g.degree * sizeof(int) ) @@ -528,9 +528,9 @@ def test_expand_to_ortho_basis(B=None): OUTPUT: - An array of codewords which represent the expansion of a basis for $B$ to a - basis for $(B^\prime)^\perp$, where $B^\prime = B$ if the all-ones vector 1 - is in $B$, otherwise $B^\prime = \text{span}(B,1)$ (note that this guarantees + An array of codewords which represent the expansion of a basis for `B` to a + basis for `(B^\prime)^\perp`, where `B^\prime = B` if the all-ones vector 1 + is in `B`, otherwise `B^\prime = \text{span}(B,1)` (note that this guarantees that all the vectors in the span of the output have even weight). TESTS:: @@ -580,9 +580,9 @@ cdef codeword *expand_to_ortho_basis(BinaryCode B, int n): OUTPUT: - An array of codewords which represent the expansion of a basis for $B$ to a - basis for $(B^\prime)^\perp$, where $B^\prime = B$ if the all-ones vector 1 - is in $B$, otherwise $B^\prime = \text{span}(B,1)$ (note that this guarantees + An array of codewords which represent the expansion of a basis for `B` to a + basis for `(B^\prime)^\perp`, where `B^\prime = B` if the all-ones vector 1 + is in `B`, otherwise `B^\prime = \text{span}(B,1)` (note that this guarantees that all the vectors in the span of the output have even weight). """ # assumes B is already in standard form diff --git a/src/sage/coding/guava.py b/src/sage/coding/guava.py index b76c980d766..e031b00af3d 100644 --- a/src/sage/coding/guava.py +++ b/src/sage/coding/guava.py @@ -62,7 +62,7 @@ def QuasiQuadraticResidueCode(p): sage: C = codes.QuasiQuadraticResidueCode(11); C # optional - gap_packages (Guava package) [22, 11] linear code over GF(2) - These are self-orthogonal in general and self-dual when $p \\equiv 3 \\pmod 4$. + These are self-orthogonal in general and self-dual when `p \\equiv 3 \\pmod 4`. AUTHOR: David Joyner (11-2005) """ diff --git a/src/sage/coding/reed_muller_code.py b/src/sage/coding/reed_muller_code.py index 653cae234f9..8eca7c8647f 100644 --- a/src/sage/coding/reed_muller_code.py +++ b/src/sage/coding/reed_muller_code.py @@ -461,7 +461,7 @@ def number_of_variables(self): def minimum_distance(self): r""" Returns the minimum distance of ``self``. - The minimum distance of a binary Reed-Muller code of order $d$ and number of variables $m$ is $q^{m-d}$ + The minimum distance of a binary Reed-Muller code of order `d` and number of variables `m` is `q^{m-d}` EXAMPLES:: @@ -663,7 +663,7 @@ def generator_matrix(self): def points(self): r""" - Returns the points of $F^m$, where $F$ is base field and $m$ is the number of variables, in order of which polynomials are evaluated on. + Returns the points of `F^m`, where `F` is base field and `m` is the number of variables, in order of which polynomials are evaluated on. EXAMPLES:: diff --git a/src/sage/combinat/designs/covering_design.py b/src/sage/combinat/designs/covering_design.py index 0fe08095880..1c0dfa47628 100644 --- a/src/sage/combinat/designs/covering_design.py +++ b/src/sage/combinat/designs/covering_design.py @@ -134,7 +134,7 @@ def trivial_covering_design(v, k, t): Cases are: * `t=0`: This could be empty, but it's a useful convention to have - one block (which is empty if $k=0$). + one block (which is empty if `k=0`). * `t=1` : This contains `\lceil v/k \rceil` blocks: `[0, ..., k-1], [k, ..., 2k-1], ...`. The last block wraps around if diff --git a/src/sage/combinat/parallelogram_polyomino.py b/src/sage/combinat/parallelogram_polyomino.py index 134fb61f4a5..5ff137f4eaf 100644 --- a/src/sage/combinat/parallelogram_polyomino.py +++ b/src/sage/combinat/parallelogram_polyomino.py @@ -4156,7 +4156,7 @@ def cardinality(self): Return the number of parallelogram polyominoes. The number of parallelogram polyominoes of size n is given by - the Catalan number $c_{n-1}$. + the Catalan number `c_{n-1}`. EXAMPLES:: diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 6b7aed790b8..096dcd0f807 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -7886,7 +7886,7 @@ def is_slender(self, certificate=False): interval contains three or four elements, as defined in [Stan2009]_. (This notion of "slender" is unrelated to the eponymous notion defined by Graetzer and Kelly in - "The Free $\mathfrak{m}$-Lattice on the Poset $H$", + "The Free `\mathfrak{m}`-Lattice on the Poset `H`", Order 1 (1984), 47--65.) This function *does not* check if the poset is graded or not. diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index 9a1ac2c4483..5cb363d248a 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -1558,7 +1558,7 @@ def _s_adic_iterator(self, sequence, letters): DEFINITION (from [Fogg]_): Let `w` be a infinite word over an alphabet `A = A_0`. A - standard representation of $w$ is obtained from a sequence of + standard representation of `w` is obtained from a sequence of substitutions `\sigma_k : A_{k+1} \to A_k` and a sequence of letters `a_k \in A_k` such that: diff --git a/src/sage/databases/cunningham_tables.py b/src/sage/databases/cunningham_tables.py index 0ffadf2ed02..9c23bf31816 100644 --- a/src/sage/databases/cunningham_tables.py +++ b/src/sage/databases/cunningham_tables.py @@ -14,7 +14,7 @@ def cunningham_prime_factors(): r""" List of all the prime numbers occurring in the so called Cunningham table. - They occur in the factorization of numbers of type $b^n+1$ or $b^n-1$ with $b \in \{2,3,5,6,7,10,11,12\}$. + They occur in the factorization of numbers of type `b^n+1` or `b^n-1` with `b \in \{2,3,5,6,7,10,11,12\}`. Data from http://cage.ugent.be/~jdemeyer/cunningham/ """ diff --git a/src/sage/databases/db_modular_polynomials.py b/src/sage/databases/db_modular_polynomials.py index 8b9a74ef481..d9f4b0752c2 100644 --- a/src/sage/databases/db_modular_polynomials.py +++ b/src/sage/databases/db_modular_polynomials.py @@ -207,8 +207,8 @@ class DedekindEtaModularPolynomialDatabase(ModularPolynomialDatabase): class DedekindEtaModularCorrespondenceDatabase(ModularCorrespondenceDatabase): r""" - The database of modular correspondences in $X_0(p) \times X_0(p)$, where - the model of the curves $X_0(p) = \Bold{P}^1$ are specified by quotients of + The database of modular correspondences in `X_0(p) \times X_0(p)`, where + the model of the curves `X_0(p) = \Bold{P}^1` are specified by quotients of Dedekind's eta function. """ model = "EtaCrr" @@ -216,7 +216,7 @@ class DedekindEtaModularCorrespondenceDatabase(ModularCorrespondenceDatabase): class AtkinModularPolynomialDatabase(ModularPolynomialDatabase): """ - The database of modular polynomials Phi(x,j) for $X_0(p)$, where + The database of modular polynomials Phi(x,j) for `X_0(p)`, where x is a function on invariant under the Atkin-Lehner invariant, with pole of minimal order at infinity. """ From f0f707b3c364cd2f64a530e56ca899deed18d4f1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 21:09:23 -0700 Subject: [PATCH 281/338] sage.geometry: Replace $...$ in docstrings by `...` --- src/sage/geometry/fan_morphism.py | 8 +- src/sage/geometry/lattice_polytope.py | 82 ++++----- .../parametrized_surface3d.py | 156 +++++++++--------- 3 files changed, 123 insertions(+), 123 deletions(-) diff --git a/src/sage/geometry/fan_morphism.py b/src/sage/geometry/fan_morphism.py index 5c1a71a488a..966947f0b22 100644 --- a/src/sage/geometry/fan_morphism.py +++ b/src/sage/geometry/fan_morphism.py @@ -1251,7 +1251,7 @@ def is_fibration(self): the linear map of vector spaces `\phi_\RR` induces a bijection between `\sigma` and `\sigma'`, and, in addition, `\phi` is :meth:`dominant ` (that is, `\phi_\RR: N_\RR \to - N'_\RR$ is surjective). + N'_\RR` is surjective). If a fan morphism `\phi: \Sigma \to \Sigma'` is a fibration, then the associated morphism between toric varieties `\tilde{\phi}: X_\Sigma \to @@ -1410,7 +1410,7 @@ def is_surjective(self): `\sigma' \in \Sigma'` there is at least one preimage cone `\sigma \in \Sigma` such that the relative interior of `\sigma` is mapped to the relative interior of `\sigma'` and, in addition, - `\phi_\RR: N_\RR \to N'_\RR$ is surjective. + `\phi_\RR: N_\RR \to N'_\RR` is surjective. If a fan morphism `\phi: \Sigma \to \Sigma'` is surjective, then the associated morphism between toric varieties `\tilde{\phi}: X_\Sigma \to @@ -1465,8 +1465,8 @@ def is_dominant(self): r""" Return whether the fan morphism is dominant. - A fan morphism $\phi$ is dominant if it is surjective as a map - of vector spaces. That is, $\phi_\RR: N_\RR \to N'_\RR$ is + A fan morphism `\phi` is dominant if it is surjective as a map + of vector spaces. That is, `\phi_\RR: N_\RR \to N'_\RR` is surjective. If the domain fan is :meth:`complete diff --git a/src/sage/geometry/lattice_polytope.py b/src/sage/geometry/lattice_polytope.py index 00d95c86285..89a4e9a2191 100644 --- a/src/sage/geometry/lattice_polytope.py +++ b/src/sage/geometry/lattice_polytope.py @@ -4209,8 +4209,8 @@ class NefPartition(SageObject, Hashable): INPUT: - - ``data`` -- a list of integers, the $i$-th element of this list must be - the part of the $i$-th vertex of ``Delta_polar`` in this nef-partition; + - ``data`` -- a list of integers, the `i`-th element of this list must be + the part of the `i`-th vertex of ``Delta_polar`` in this nef-partition; - ``Delta_polar`` -- a :class:`lattice polytope `; @@ -4224,20 +4224,20 @@ class NefPartition(SageObject, Hashable): - a nef-partition of ``Delta_polar``. - Let $M$ and $N$ be dual lattices. Let $\Delta \subset M_\RR$ be a reflexive - polytope with polar $\Delta^\circ \subset N_\RR$. Let $X_\Delta$ be the - toric variety associated to the normal fan of $\Delta$. A **nef-partition** - is a decomposition of the vertex set $V$ of $\Delta^\circ$ into a disjoint - union $V = V_0 \sqcup V_1 \sqcup \dots \sqcup V_{k-1}$ such that divisors - $E_i = \sum_{v\in V_i} D_v$ are Cartier (here $D_v$ are prime - torus-invariant Weil divisors corresponding to vertices of $\Delta^\circ$). - Equivalently, let $\nabla_i \subset N_\RR$ be the convex hull of vertices - from $V_i$ and the origin. These polytopes form a nef-partition if their - Minkowski sum $\nabla \subset N_\RR$ is a reflexive polytope. - - The **dual nef-partition** is formed by polytopes $\Delta_i \subset M_\RR$ - of $E_i$, which give a decomposition of the vertex set of $\nabla^\circ - \subset M_\RR$ and their Minkowski sum is $\Delta$, i.e. the polar duality + Let `M` and `N` be dual lattices. Let `\Delta \subset M_\RR` be a reflexive + polytope with polar `\Delta^\circ \subset N_\RR`. Let `X_\Delta` be the + toric variety associated to the normal fan of `\Delta`. A **nef-partition** + is a decomposition of the vertex set `V` of `\Delta^\circ` into a disjoint + union `V = V_0 \sqcup V_1 \sqcup \dots \sqcup V_{k-1}` such that divisors + `E_i = \sum_{v\in V_i} D_v` are Cartier (here `D_v` are prime + torus-invariant Weil divisors corresponding to vertices of `\Delta^\circ`). + Equivalently, let `\nabla_i \subset N_\RR` be the convex hull of vertices + from `V_i` and the origin. These polytopes form a nef-partition if their + Minkowski sum `\nabla \subset N_\RR` is a reflexive polytope. + + The **dual nef-partition** is formed by polytopes `\Delta_i \subset M_\RR` + of `E_i`, which give a decomposition of the vertex set of `\nabla^\circ + \subset M_\RR` and their Minkowski sum is `\Delta`, i.e. the polar duality of reflexive polytopes switches convex hull and Minkowski sum for dual nef-partitions: @@ -4259,25 +4259,25 @@ class NefPartition(SageObject, Hashable): \mathrm{Conv} \left(\Delta_0, \Delta_1, \dots, \Delta_{k-1}\right). One can also interpret the duality of nef-partitions as the duality of the - associated cones. Below $\overline{M} = M \times \ZZ^k$ and - $\overline{N} = N \times \ZZ^k$ are dual lattices. + associated cones. Below `\overline{M} = M \times \ZZ^k` and + `\overline{N} = N \times \ZZ^k` are dual lattices. - The **Cayley polytope** $P \subset \overline{M}_\RR$ of a nef-partition is + The **Cayley polytope** `P \subset \overline{M}_\RR` of a nef-partition is given by $P = \mathrm{Conv}(\Delta_0 \times e_0, \Delta_1 \times e_1, - \ldots, \Delta_{k-1} \times e_{k-1})$, where $\{e_i\}_{i=0}^{k-1}$ is the - standard basis of $\ZZ^k$. The **dual Cayley polytope** - $P^* \subset \overline{N}_\RR$ is the Cayley polytope of the dual + \ldots, \Delta_{k-1} \times e_{k-1})`, where `\{e_i\}_{i=0}^{k-1}` is the + standard basis of `\ZZ^k`. The **dual Cayley polytope** + `P^* \subset \overline{N}_\RR` is the Cayley polytope of the dual nef-partition. - The **Cayley cone** $C \subset \overline{M}_\RR$ of a nef-partition is the + The **Cayley cone** `C \subset \overline{M}_\RR` of a nef-partition is the cone spanned by its Cayley polytope. The **dual Cayley cone** - $C^\vee \subset \overline{M}_\RR$ is the usual dual cone of $C$. It turns - out, that $C^\vee$ is spanned by $P^*$. + `C^\vee \subset \overline{M}_\RR` is the usual dual cone of `C`. It turns + out, that `C^\vee` is spanned by `P^*`. It is also possible to go back from the Cayley cone to the Cayley polytope, - since $C$ is a reflexive Gorenstein cone supported by $P$: primitive - integral ray generators of $C$ are contained in an affine hyperplane and - coincide with vertices of $P$. + since `C` is a reflexive Gorenstein cone supported by `P`: primitive + integral ray generators of `C` are contained in an affine hyperplane and + coincide with vertices of `P`. See Section 4.3.1 in [CK1999]_ and references therein for further details, or [BN2008]_ for a purely combinatorial approach. @@ -4550,11 +4550,11 @@ def _sage_input_(self, sib, coerced): def Delta(self, i=None): r""" - Return the polytope $\Delta$ or $\Delta_i$ corresponding to ``self``. + Return the polytope `\Delta` or `\Delta_i` corresponding to ``self``. INPUT: - - ``i`` -- an integer. If not given, $\Delta$ will be returned. + - ``i`` -- an integer. If not given, `\Delta` will be returned. OUTPUT: @@ -4594,7 +4594,7 @@ def Delta(self, i=None): def Delta_polar(self): r""" - Return the polytope $\Delta^\circ$ corresponding to ``self``. + Return the polytope `\Delta^\circ` corresponding to ``self``. OUTPUT: @@ -4615,7 +4615,7 @@ def Delta_polar(self): def Deltas(self): r""" - Return the polytopes $\Delta_i$ corresponding to ``self``. + Return the polytopes `\Delta_i` corresponding to ``self``. OUTPUT: @@ -4749,11 +4749,11 @@ def hodge_numbers(self): def nabla(self, i=None): r""" - Return the polytope $\nabla$ or $\nabla_i$ corresponding to ``self``. + Return the polytope `\nabla` or `\nabla_i` corresponding to ``self``. INPUT: - - ``i`` -- an integer. If not given, $\nabla$ will be returned. + - ``i`` -- an integer. If not given, `\nabla` will be returned. OUTPUT: @@ -4798,7 +4798,7 @@ def nabla(self, i=None): def nabla_polar(self): r""" - Return the polytope $\nabla^\circ$ corresponding to ``self``. + Return the polytope `\nabla^\circ` corresponding to ``self``. OUTPUT: @@ -4829,7 +4829,7 @@ def nabla_polar(self): def nablas(self): r""" - Return the polytopes $\nabla_i$ corresponding to ``self``. + Return the polytopes `\nabla_i` corresponding to ``self``. OUTPUT: @@ -4904,7 +4904,7 @@ def part(self, i, all_points=False): OUTPUT: - a tuple of integers, indices of vertices (or all lattice points) of - $\Delta^\circ$ belonging to $V_i$. + `\Delta^\circ` belonging to `V_i`. See :class:`nef-partition ` class documentation for definitions and notation. @@ -4937,8 +4937,8 @@ def parts(self, all_points=False): OUTPUT: - - a tuple of tuples of integers. The $i$-th tuple contains indices of - vertices (or all lattice points) of $\Delta^\circ$ belonging to $V_i$ + - a tuple of tuples of integers. The `i`-th tuple contains indices of + vertices (or all lattice points) of `\Delta^\circ` belonging to `V_i` See :class:`nef-partition ` class documentation for definitions and notation. @@ -4977,8 +4977,8 @@ def part_of(self, i): OUTPUT: - - an integer $j$ such that the ``i``-th vertex of $\Delta^\circ$ - belongs to $V_j$. + - an integer `j` such that the ``i``-th vertex of `\Delta^\circ` + belongs to `V_j`. See :class:`nef-partition ` class documentation for definitions and notation. diff --git a/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py b/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py index acd70e6bc75..c1a126b630a 100644 --- a/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py +++ b/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py @@ -62,8 +62,8 @@ class ParametrizedSurface3D(SageObject): - ``variables`` -- a 2-tuple of intrinsic coordinates `(u, v)` on the surface, with `u` and `v` symbolic variables, or a 2-tuple of triples - $(u, u_{min}, u_{max})$, - $(v, v_{min}, v_{max})$ when the parameter range + `(u, u_{min}, u_{max})`, + `(v, v_{min}, v_{max})` when the parameter range for the coordinates is known. - ``name`` -- name of the surface (optional). @@ -162,8 +162,8 @@ class ParametrizedSurface3D(SageObject): The first fundamental form can be used to compute the length of a curve on the surface. For example, let us find the length of the - curve $u^1 = t$, $u^2 = t$, $t \in [0,2\pi]$, on the ellipsoid - with axes $a=1$, $b=1.5$ and $c=1$. So we take the curve:: + curve `u^1 = t`, `u^2 = t`, `t \in [0,2\pi]`, on the ellipsoid + with axes `a=1`, `b=1.5` and `c=1`. So we take the curve:: sage: t = var('t', domain='real') sage: u1 = t @@ -183,7 +183,7 @@ class ParametrizedSurface3D(SageObject): sage: numerical_integral(L.substitute(a=2, b=1.5, c=1),0,1)[0] # rel tol 1e-11 2.00127905972 - We find the area of the sphere of radius $R$:: + We find the area of the sphere of radius `R`:: sage: R = var('R', domain='real') sage: u, v = var('u,v', domain='real') @@ -193,7 +193,7 @@ class ParametrizedSurface3D(SageObject): sage: integral(integral(sphere.area_form(),u,0,2*pi),v,-pi/2,pi/2) 4*pi*R^2 - We can find an orthonormal frame field $\{e_1, e_2\}$ of a surface + We can find an orthonormal frame field `\{e_1, e_2\}` of a surface and calculate its structure functions. Let us first determine the orthonormal frame field for the elliptic paraboloid:: @@ -204,7 +204,7 @@ class ParametrizedSurface3D(SageObject): We can express the orthogonal frame field both in exterior coordinates (i.e. expressed as vector field fields in the ambient - space $\RR^3$, the default) or in intrinsic coordinates + space `\RR^3`, the default) or in intrinsic coordinates (with respect to the natural frame). Here we use intrinsic coordinates:: @@ -212,9 +212,9 @@ class ParametrizedSurface3D(SageObject): {1: (1/sqrt(4*u^2 + 1), 0), 2: (-4*u*v/(sqrt(4*u^2 + 4*v^2 + 1)*sqrt(4*u^2 + 1)), sqrt(4*u^2 + 1)/sqrt(4*u^2 + 4*v^2 + 1))} Using the orthonormal frame in interior coordinates, we can calculate - the structure functions $c^k_{ij}$ of the surface, defined by - $[e_i,e_j] = c^k_{ij} e_k$, where $[e_i, e_j]$ represents the Lie - bracket of two frame vector fields $e_i, e_j$. For the + the structure functions `c^k_{ij}` of the surface, defined by + `[e_i,e_j] = c^k_{ij} e_k`, where `[e_i, e_j]` represents the Lie + bracket of two frame vector fields `e_i, e_j`. For the elliptic paraboloid, we get:: sage: EE = eparaboloid.orthonormal_frame(coordinates='int') @@ -476,7 +476,7 @@ def plot(self, urange=None, vrange=None, **kwds): the surface parameters `u` and `v`. If either of these parameters is ``None``, the method checks whether a parameter range was specified when the surface was created. If not, the default of - $(0, 2 \pi)$ is used. + `(0, 2 \pi)` is used. INPUT: @@ -597,18 +597,18 @@ def _compute_first_fundamental_form_coefficient(self, index): def first_fundamental_form_coefficient(self, index): r""" - Compute a single component $g_{ij}$ of the first fundamental form. If + Compute a single component `g_{ij}` of the first fundamental form. If the parametric representation of the surface is given by the vector - function $\vec r(u^i)$, where $u^i$, $i = 1, 2$ are curvilinear - coordinates, then $g_{ij} = \frac{\partial \vec r}{\partial u^i} \cdot \frac{\partial \vec r}{\partial u^j}$. + function `\vec r(u^i)`, where `u^i`, `i = 1, 2` are curvilinear + coordinates, then `g_{ij} = \frac{\partial \vec r}{\partial u^i} \cdot \frac{\partial \vec r}{\partial u^j}`. INPUT: - - ``index`` - tuple ``(i, j)`` specifying the index of the component $g_{ij}$. + - ``index`` - tuple ``(i, j)`` specifying the index of the component `g_{ij}`. OUTPUT: - - Component $g_{ij}$ of the first fundamental form + - Component `g_{ij}` of the first fundamental form EXAMPLES:: @@ -636,8 +636,8 @@ def first_fundamental_form_coefficient(self, index): def first_fundamental_form_coefficients(self): r""" Returns the coefficients of the first fundamental form as a dictionary. - The keys are tuples $(i, j)$, where $i$ and $j$ range over $1, 2$, - while the values are the corresponding coefficients $g_{ij}$. + The keys are tuples `(i, j)`, where `i` and `j` range over `1, 2`, + while the values are the corresponding coefficients `g_{ij}`. OUTPUT: @@ -661,9 +661,9 @@ def first_fundamental_form(self, vector1, vector2): r""" Evaluate the first fundamental form on two vectors expressed with respect to the natural coordinate frame on the surface. In other words, - if the vectors are $v = (v^1, v^2)$ and $w = (w^1, w^2)$, calculate - $g_{11} v^1 w^1 + g_{12}(v^1 w^2 + v^2 w^1) + g_{22} v^2 w^2$, with - $g_{ij}$ the coefficients of the first fundamental form. + if the vectors are `v = (v^1, v^2)` and `w = (w^1, w^2)`, calculate + `g_{11} v^1 w^1 + g_{12}(v^1 w^2 + v^2 w^1) + g_{22} v^2 w^2`, with + `g_{ij}` the coefficients of the first fundamental form. INPUT: @@ -696,9 +696,9 @@ def first_fundamental_form(self, vector1, vector2): def area_form_squared(self): """ Returns the square of the coefficient of the area form on the surface. - In terms of the coefficients $g_{ij}$ (where $i, j = 1, 2$) of the + In terms of the coefficients `g_{ij}` (where `i, j = 1, 2`) of the first fundamental form, this invariant is given by - $A^2 = g_{11}g_{22} - g_{12}^2$. + `A^2 = g_{11}g_{22} - g_{12}^2`. See also :meth:`.area_form`. @@ -722,9 +722,9 @@ def area_form_squared(self): def area_form(self): r""" Returns the coefficient of the area form on the surface. In terms of - the coefficients $g_{ij}$ (where $i, j = 1, 2$) of the first + the coefficients `g_{ij}` (where `i, j = 1, 2`) of the first fundamental form, the coefficient of the area form is given by - $A = \sqrt{g_{11}g_{22} - g_{12}^2}$. + `A = \sqrt{g_{11}g_{22} - g_{12}^2}`. See also :meth:`.area_form_squared`. @@ -746,9 +746,9 @@ def area_form(self): def first_fundamental_form_inverse_coefficients(self): r""" - Returns the coefficients $g^{ij}$ of the inverse of the fundamental + Returns the coefficients `g^{ij}` of the inverse of the fundamental form, as a dictionary. The inverse coefficients are defined by - $g^{ij} g_{jk} = \delta^i_k$ with $\delta^i_k$ the Kronecker + `g^{ij} g_{jk} = \delta^i_k` with `\delta^i_k` the Kronecker delta. OUTPUT: @@ -777,12 +777,12 @@ def first_fundamental_form_inverse_coefficients(self): def first_fundamental_form_inverse_coefficient(self, index): r""" - Returns a specific component $g^{ij}$ of the inverse of the fundamental + Returns a specific component `g^{ij}` of the inverse of the fundamental form. INPUT: - - ``index`` - tuple ``(i, j)`` specifying the index of the component $g^{ij}$. + - ``index`` - tuple ``(i, j)`` specifying the index of the component `g^{ij}`. OUTPUT: @@ -810,7 +810,7 @@ def first_fundamental_form_inverse_coefficient(self, index): @cached_method def rotation(self,theta): r""" - Gives the matrix of the rotation operator over a given angle $\theta$ + Gives the matrix of the rotation operator over a given angle `\theta` with respect to the natural frame. INPUT: @@ -823,9 +823,9 @@ def rotation(self,theta): ALGORITHM: - The operator of rotation over $\pi/2$ is $J^i_j = g^{ik}\omega_{jk}$, - where $\omega$ is the area form. The operator of rotation over an - angle $\theta$ is $\cos(\theta) I + sin(\theta) J$. + The operator of rotation over `\pi/2` is `J^i_j = g^{ik}\omega_{jk}`, + where `\omega` is the area form. The operator of rotation over an + angle `\theta` is `\cos(\theta) I + sin(\theta) J`. EXAMPLES:: @@ -833,13 +833,13 @@ def rotation(self,theta): sage: assume(cos(v)>0) sage: sphere = ParametrizedSurface3D([cos(u)*cos(v),sin(u)*cos(v),sin(v)],[u,v],'sphere') - We first compute the matrix of rotation over $\pi/3$:: + We first compute the matrix of rotation over `\pi/3`:: sage: rotation = sphere.rotation(pi/3); rotation [ 1/2 -1/2*sqrt(3)/cos(v)] [ 1/2*sqrt(3)*cos(v) 1/2] - We verify that three successive rotations over $\pi/3$ yield minus the identity:: + We verify that three successive rotations over `\pi/3` yield minus the identity:: sage: rotation^3 [-1 0] @@ -863,7 +863,7 @@ def orthonormal_frame(self, coordinates='ext'): r""" Returns the orthonormal frame field on the surface, expressed either in exterior coordinates (i.e. expressed as vector fields in the - ambient space $\mathbb{R}^3$, the default) or interior coordinates + ambient space `\mathbb{R}^3`, the default) or interior coordinates (with respect to the natural frame) INPUT: @@ -876,9 +876,9 @@ def orthonormal_frame(self, coordinates='ext'): ALGORITHM: - We normalize the first vector $\vec e_1$ of the natural frame and then - get the second frame vector as $\vec e_2 = [\vec n, \vec e_1]$, where - $\vec n$ is the unit normal to the surface. + We normalize the first vector `\vec e_1` of the natural frame and then + get the second frame vector as `\vec e_2 = [\vec n, \vec e_1]`, where + `\vec n` is the unit normal to the surface. EXAMPLES:: @@ -978,7 +978,7 @@ def lie_bracket(self, v, w): OUTPUT: - - The Lie bracket $[v, w]$. + - The Lie bracket `[v, w]`. EXAMPLES:: @@ -1006,10 +1006,10 @@ def lie_bracket(self, v, w): def frame_structure_functions(self, e1, e2): r""" - Returns the structure functions $c^k_{ij}$ for a frame field - $e_1, e_2$, i.e. a pair of vector fields on the surface which are + Returns the structure functions `c^k_{ij}` for a frame field + `e_1, e_2`, i.e. a pair of vector fields on the surface which are linearly independent at each point. The structure functions are - defined using the Lie bracket by $[e_i,e_j] = c^k_{ij}e_k$. + defined using the Lie bracket by `[e_i,e_j] = c^k_{ij}e_k`. INPUT: @@ -1020,7 +1020,7 @@ def frame_structure_functions(self, e1, e2): OUTPUT: - Dictionary of structure functions, where the key ``(i, j, k)`` refers to - the structure function $c_{i,j}^k$. + the structure function `c_{i,j}^k`. EXAMPLES:: @@ -1096,12 +1096,12 @@ def second_order_natural_frame(self): r""" Returns the second-order frame of the surface, i.e. computes the second-order derivatives (with respect to the parameters on the - surface) of the parametric expression $\vec r = \vec r(u^1,u^2)$ + surface) of the parametric expression `\vec r = \vec r(u^1,u^2)` of the surface. OUTPUT: - - Dictionary where the keys are 2-tuples ``(i, j)`` and the values are the corresponding derivatives $r_{ij}$. + - Dictionary where the keys are 2-tuples ``(i, j)`` and the values are the corresponding derivatives `r_{ij}`. EXAMPLES: @@ -1129,7 +1129,7 @@ def second_order_natural_frame_element(self, index): r""" Returns a vector in the second-order frame of the surface, i.e. computes the second-order derivatives of the parametric expression - $\vec{r}$ of the surface with respect to the parameters listed in the + `\vec{r}` of the surface with respect to the parameters listed in the argument. INPUT: @@ -1138,7 +1138,7 @@ def second_order_natural_frame_element(self, index): OUTPUT: - - The second-order derivative $r_{ij}$. + - The second-order derivative `r_{ij}`. EXAMPLES:: @@ -1179,10 +1179,10 @@ def _compute_second_fundamental_form_coefficient(self, index): def second_fundamental_form_coefficient(self, index): r""" - Returns the coefficient $h_{ij}$ of the second fundamental form - corresponding to the index $(i, j)$. If the equation of the surface - is $\vec{r}(u^1, u^2)$, then $h_{ij} = \vec{r}_{u^i u^j} \cdot \vec{n}$, - where $\vec{n}$ is the unit normal. + Returns the coefficient `h_{ij}` of the second fundamental form + corresponding to the index `(i, j)`. If the equation of the surface + is `\vec{r}(u^1, u^2)`, then `h_{ij} = \vec{r}_{u^i u^j} \cdot \vec{n}`, + where `\vec{n}` is the unit normal. INPUT: @@ -1190,7 +1190,7 @@ def second_fundamental_form_coefficient(self, index): OUTPUT: - - Component $h_{ij}$ of the second fundamental form. + - Component `h_{ij}` of the second fundamental form. EXAMPLES:: @@ -1212,9 +1212,9 @@ def second_fundamental_form_coefficient(self, index): def second_fundamental_form_coefficients(self): """ - Returns the coefficients $h_{ij}$ of the second fundamental form as - a dictionary, where the keys are the indices $(i, j)$ and the values - are the corresponding components $h_{ij}$. + Returns the coefficients `h_{ij}` of the second fundamental form as + a dictionary, where the keys are the indices `(i, j)` and the values + are the corresponding components `h_{ij}`. When only one component is needed, consider instead the function :meth:`second_fundamental_form_coefficient`. @@ -1243,8 +1243,8 @@ def second_fundamental_form_coefficients(self): def second_fundamental_form(self,vector1,vector2): r""" Evaluates the second fundamental form on two vectors on the surface. - If the vectors are given by $v=(v^1,v^2)$ and $w=(w^1,w^2)$, the - result of this function is $h_{11} v^1 w^1 + h_{12}(v^1 w^2 + v^2 w^1) + h_{22} v^2 w^2$. + If the vectors are given by `v=(v^1,v^2)` and `w=(w^1,w^2)`, the + result of this function is `h_{11} v^1 w^1 + h_{12}(v^1 w^2 + v^2 w^1) + h_{22} v^2 w^2`. INPUT: @@ -1283,8 +1283,8 @@ def second_fundamental_form(self,vector1,vector2): def gauss_curvature(self): r""" Finds the gaussian curvature of the surface, given by - $K = \frac{h_{11}h_{22} - h_{12}^2}{g_{11}g_{22} - g_{12}^2}$, - where $g_{ij}$ and $h_{ij}$ are the coefficients of the first + `K = \frac{h_{11}h_{22} - h_{12}^2}{g_{11}g_{22} - g_{12}^2}`, + where `g_{ij}` and `h_{ij}` are the coefficients of the first and second fundamental form, respectively. OUTPUT: @@ -1310,8 +1310,8 @@ def gauss_curvature(self): def mean_curvature(self): r""" Finds the mean curvature of the surface, given by - $H = \frac{1}{2}\frac{g_{22}h_{11} - 2g_{12}h_{12} + g_{11}h_{22}}{g_{11}g_{22} - g_{12}^2}$, - where $g_{ij}$ and $h_{ij}$ are the components of the first and second + `H = \frac{1}{2}\frac{g_{22}h_{11} - 2g_{12}h_{12} + g_{11}h_{22}}{g_{11}g_{22} - g_{12}^2}`, + where `g_{ij}` and `h_{ij}` are the components of the first and second fundamental forms, respectively. OUTPUT: @@ -1418,8 +1418,8 @@ def principal_directions(self): OUTPUT: For each principal curvature, returns a list of the form - $(\rho, V, n)$, where $\rho$ is the principal curvature, - $V$ is the corresponding principal direction, and $n$ is + `(\rho, V, n)`, where `\rho` is the principal curvature, + `V` is the corresponding principal direction, and `n` is the multiplicity. EXAMPLES:: @@ -1450,19 +1450,19 @@ def principal_directions(self): def connection_coefficients(self): r""" Computes the connection coefficients or Christoffel symbols - $\Gamma^k_{ij}$ of the surface. If the coefficients of the first - fundamental form are given by $g_{ij}$ (where $i, j = 1, 2$), then + `\Gamma^k_{ij}` of the surface. If the coefficients of the first + fundamental form are given by `g_{ij}` (where `i, j = 1, 2`), then $\Gamma^k_{ij} = \frac{1}{2} g^{kl} \left( \frac{\partial g_{li}}{\partial x^j} - \frac{\partial g_{ij}}{\partial x^l} + \frac{\partial g_{lj}}{\partial x^i} \right)$. - Here, $(g^{kl})$ is the inverse of the matrix $(g_{ij})$, with - $i, j = 1, 2$. + Here, `(g^{kl})` is the inverse of the matrix `(g_{ij})`, with + `i, j = 1, 2`. OUTPUT: Dictionary of connection coefficients, where the keys are 3-tuples - $(i,j,k)$ and the values are the corresponding coefficients - $\Gamma^k_{ij}$. + `(i,j,k)` and the values are the corresponding coefficients + `\Gamma^k_{ij}`. EXAMPLES:: @@ -1540,12 +1540,12 @@ def geodesics_numerical(self, p0, v0, tinterval): r""" Numerical integration of the geodesic equations. Explicitly, the geodesic equations are given by - $\frac{d^2 u^i}{dt^2} + \Gamma^i_{jk} \frac{d u^j}{dt} \frac{d u^k}{dt} = 0$. + `\frac{d^2 u^i}{dt^2} + \Gamma^i_{jk} \frac{d u^j}{dt} \frac{d u^k}{dt} = 0`. - Solving these equations gives the coordinates $(u^1, u^2)$ of + Solving these equations gives the coordinates `(u^1, u^2)` of the geodesic on the surface. The coordinates in space can - then be found by substituting $(u^1, u^2)$ into the vector - $\vec{r}(u^1, u^2)$ representing the surface. + then be found by substituting `(u^1, u^2)` into the vector + `\vec{r}(u^1, u^2)` representing the surface. ALGORITHM: @@ -1656,10 +1656,10 @@ def parallel_translation_numerical(self,curve,t,v0,tinterval): Numerically solves the equations for parallel translation of a vector along a curve on the surface. Explicitly, the equations for parallel translation are given by - $\frac{d u^i}{dt} + u^j \frac{d c^k}{dt} \Gamma^i_{jk} = 0$, - where $\Gamma^i_{jk}$ are the connection coefficients of the surface, - the vector to be transported has components $u^j$ and the curve along - which to transport has components $c^k$. + `\frac{d u^i}{dt} + u^j \frac{d c^k}{dt} \Gamma^i_{jk} = 0`, + where `\Gamma^i_{jk}` are the connection coefficients of the surface, + the vector to be transported has components `u^j` and the curve along + which to transport has components `c^k`. ALGORITHM: From 03895c086ca74afd2156051c6785d40b6109a606 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 21:14:36 -0700 Subject: [PATCH 282/338] sage.topology: Replace $...$ in docstrings by `...` --- .../topology/simplicial_set_constructions.py | 18 +++++++++--------- src/sage/topology/simplicial_set_examples.py | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sage/topology/simplicial_set_constructions.py b/src/sage/topology/simplicial_set_constructions.py index 5b192d019bc..3c124b04841 100644 --- a/src/sage/topology/simplicial_set_constructions.py +++ b/src/sage/topology/simplicial_set_constructions.py @@ -728,7 +728,7 @@ def factors(self): def factor(self, i): r""" - Return the $i$-th factor of this construction of simplicial sets. + Return the `i`-th factor of this construction of simplicial sets. INPUT: @@ -902,7 +902,7 @@ def n_skeleton(self, n): def factor(self, i, as_subset=False): r""" - Return the $i$-th factor of the product. + Return the `i`-th factor of the product. INPUT: @@ -910,14 +910,14 @@ def factor(self, i, as_subset=False): - ``as_subset`` -- boolean, optional (default ``False``) - If ``as_subset`` is ``True``, return the $i$-th factor as a + If ``as_subset`` is ``True``, return the `i`-th factor as a subsimplicial set of the product, identifying it with its product with the base point in each other factor. As a subsimplicial set, it comes equipped with an inclusion map. This option will raise an error if any factor does not have a base point. - If ``as_subset`` is ``False``, return the $i$-th factor in + If ``as_subset`` is ``False``, return the `i`-th factor in its original form as a simplicial set. EXAMPLES:: @@ -1030,7 +1030,7 @@ def __init__(self, factors=None): def projection_map(self, i): """ - Return the map projecting onto the $i$-th factor. + Return the map projecting onto the `i`-th factor. INPUT: @@ -1569,7 +1569,7 @@ def __init__(self, maps=None, vertex_name=None): def structure_map(self, i): r""" - Return the $i$-th structure map of the pushout. + Return the `i`-th structure map of the pushout. INPUT: @@ -2095,7 +2095,7 @@ def __init__(self, factors=None): def inclusion_map(self, i): """ - Return the inclusion map of the $i$-th factor. + Return the inclusion map of the `i`-th factor. EXAMPLES:: @@ -2116,7 +2116,7 @@ def inclusion_map(self, i): def projection_map(self, i): """ - Return the projection map onto the $i$-th factor. + Return the projection map onto the `i`-th factor. EXAMPLES:: @@ -2300,7 +2300,7 @@ def __init__(self, factors=None): def inclusion_map(self, i): """ - Return the inclusion map of the $i$-th factor. + Return the inclusion map of the `i`-th factor. EXAMPLES:: diff --git a/src/sage/topology/simplicial_set_examples.py b/src/sage/topology/simplicial_set_examples.py index 1ddb7103447..279cf8b7c7d 100644 --- a/src/sage/topology/simplicial_set_examples.py +++ b/src/sage/topology/simplicial_set_examples.py @@ -488,10 +488,10 @@ def Point(): def Horn(n, k): r""" - Return the horn $\Lambda^n_k$. + Return the horn `\Lambda^n_k`. - This is the subsimplicial set of the $n$-simplex obtained by - removing its $k$-th face. + This is the subsimplicial set of the `n`-simplex obtained by + removing its `k`-th face. EXAMPLES:: From 9715f3fdb67a629a0ebd6ad245727d9c925e8067 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 21:15:40 -0700 Subject: [PATCH 283/338] sage.symbolic: Replace $...$ in docstrings by `...` --- src/sage/symbolic/expression.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index eb50443ff29..6c7fa547fd2 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -9205,7 +9205,7 @@ cdef class Expression(Expression_abc): r""" Return sinh of self. - We have $\sinh(x) = (e^{x} - e^{-x})/2$. + We have `\sinh(x) = (e^{x} - e^{-x})/2`. EXAMPLES:: @@ -9263,7 +9263,7 @@ cdef class Expression(Expression_abc): r""" Return cosh of self. - We have $\cosh(x) = (e^{x} + e^{-x})/2$. + We have `\cosh(x) = (e^{x} + e^{-x})/2`. EXAMPLES:: @@ -9319,7 +9319,7 @@ cdef class Expression(Expression_abc): r""" Return tanh of self. - We have $\tanh(x) = \sinh(x) / \cosh(x)$. + We have `\tanh(x) = \sinh(x) / \cosh(x)`. EXAMPLES:: From 73ce3e33e2a092bb16df2def931e3f60a8d30102 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 21:17:13 -0700 Subject: [PATCH 284/338] sage.structure: Replace $...$ in docstrings by `...` --- src/sage/structure/coerce.pyx | 2 +- src/sage/structure/coerce_maps.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 884e14b5ed7..caedace90a1 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -1291,7 +1291,7 @@ cdef class CoercionModel: sage: type(a) - We also make an exception for 0, even if $\ZZ$ does not map in:: + We also make an exception for 0, even if `\ZZ` does not map in:: sage: canonical_coercion(vector([1, 2, 3]), 0) ((1, 2, 3), (0, 0, 0)) diff --git a/src/sage/structure/coerce_maps.pyx b/src/sage/structure/coerce_maps.pyx index bd3b5575825..884ca57cabb 100644 --- a/src/sage/structure/coerce_maps.pyx +++ b/src/sage/structure/coerce_maps.pyx @@ -329,7 +329,7 @@ cdef class CallableConvertMap(Map): From: Integer Ring To: Rational Field - Create a homomorphism from $\RR$ to $\RR^+$ viewed as additive groups. + Create a homomorphism from `\RR` to `\RR^+` viewed as additive groups. :: From cdb74b4273d3241bc62b00f1ea60049b52d7bfe0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 21:59:33 -0700 Subject: [PATCH 285/338] src/sage/algebras/steenrod/steenrod_algebra_mult.py: Replace $...$ in docstrings by `...` (fixup) --- src/sage/algebras/steenrod/steenrod_algebra_mult.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/algebras/steenrod/steenrod_algebra_mult.py b/src/sage/algebras/steenrod/steenrod_algebra_mult.py index 0934c31f92d..ec92c86fcc5 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_mult.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_mult.py @@ -109,7 +109,7 @@ For each such matrix `M`, compute a multinomial coefficient, mod `p`: for each diagonal `\{m_{ij}: i+j=n\}`, compute `(\sum m_{i,j}!) / -(m_{0,n}! m_{1,n-1}! ... m_{n,0}!)$. Multiply these together for +(m_{0,n}! m_{1,n-1}! ... m_{n,0}!)`. Multiply these together for all `n`. Now, for each matrix with nonzero multinomial coefficient `b_M`, let @@ -328,8 +328,8 @@ def multinomial(list): None if the multinomial coefficient is 0, or sum of list if it is 1 Given the input `[n_1, n_2, n_3, ...]`, this computes the - multinomial coefficient $(n_1 + n_2 + n_3 + ...)! / (n_1! n_2! - n_3! ...)$, mod 2. The method is roughly this: expand each + multinomial coefficient `(n_1 + n_2 + n_3 + ...)! / (n_1! n_2! + n_3! ...)`, mod 2. The method is roughly this: expand each `n_i` in binary. If there is a 1 in the same digit for any `n_i` and `n_j` with `i\neq j`, then the coefficient is 0; otherwise, it is 1. @@ -579,7 +579,7 @@ def multinomial_odd(list,p): Associated multinomial coefficient, mod p Given the input `[n_1, n_2, n_3, ...]`, this computes the - multinomial coefficient $(n_1 + n_2 + n_3 + ...)! / (n_1! n_2! + multinomial coefficient `(n_1 + n_2 + n_3 + ...)! / (n_1! n_2! n_3! ...)`, mod `p`. The method is this: expand each `n_i` in base `p`: `n_i = \sum_j p^j n_{ij}`. Do the same for the sum of the `n_i`'s, which we call `m`: `m = \sum_j p^j m_j`. Then the From 8cfdab1e449b441d0bc957aa835e2a89508958b7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 22:24:37 -0700 Subject: [PATCH 286/338] sage.schemes: Replace $...$ in docstrings by `...` --- .../elliptic_curves/ell_rational_field.py | 2 +- .../schemes/elliptic_curves/saturation.py | 26 +++++++++---------- .../hyperelliptic_finite_field.py | 22 ++++++++-------- .../hyperelliptic_generic.py | 2 +- .../projective/projective_subscheme.py | 8 +++--- src/sage/schemes/toric/divisor.py | 2 +- src/sage/schemes/toric/homset.py | 4 +-- src/sage/schemes/toric/morphism.py | 4 +-- src/sage/schemes/toric/points.py | 2 +- src/sage/schemes/toric/sheaf/klyachko.py | 4 +-- src/sage/schemes/toric/weierstrass.py | 2 +- src/sage/schemes/toric/weierstrass_higher.py | 8 +++--- 12 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 3636a97176f..eb10937f3f0 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -5662,7 +5662,7 @@ def faltings_height(self, stable=False, prec=None): False If the model is changed, the Faltings height changes but the - stable height does not. It is reduced by $\log(u)$ where $u$ + stable height does not. It is reduced by `\log(u)` where `u` is the scale factor:: sage: E1 = E.change_weierstrass_model([10,0,0,0]) diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index aa0e25a1413..07b4738c079 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -601,16 +601,16 @@ def p_projections(Eq, Plist, p, debug=False): OUTPUT: - A list of $r\le2$ vectors in $\GF{p^n}$, the images of the points in - $G \otimes \GF{p}$, where $r$ is the number of vectors is the - $p$-rank of `Eq`. + A list of `r\le2` vectors in `\GF{p^n}`, the images of the points in + `G \otimes \GF{p}`, where `r` is the number of vectors is the + `p`-rank of `Eq`. ALGORITHM: - First project onto the $p$-primary part of `Eq`. If that has - $p$-rank 1 (i.e. is cyclic), use discrete logs there to define a - map to $\GF{p}$, otherwise use the Weil pairing to define two - independent maps to $\GF{p}$. + First project onto the `p`-primary part of `Eq`. If that has + `p`-rank 1 (i.e. is cyclic), use discrete logs there to define a + map to `\GF{p}`, otherwise use the Weil pairing to define two + independent maps to `\GF{p}`. EXAMPLES: @@ -618,9 +618,9 @@ def p_projections(Eq, Plist, p, debug=False): sage: E = EllipticCurve([0,0,1,-7,6]) - We reduce modulo $409$ where its order is $3^2\cdot7^2$; the - $3$-primary part is non-cyclic while the $7$-primary part is - cyclic of order $49$:: + We reduce modulo `409` where its order is `3^2\cdot7^2`; the + `3`-primary part is non-cyclic while the `7`-primary part is + cyclic of order `49`:: sage: F = GF(409) sage: EF = E.change_ring(F) @@ -630,9 +630,9 @@ def p_projections(Eq, Plist, p, debug=False): sage: G.order().factor() 3^2 * 7^2 - We construct three points and project them to the $p$-primary - parts for $p=2,3,5,7$, yielding 0,2,0,1 vectors of length 3 modulo - $p$ respectively. The exact vectors output depend on the computed + We construct three points and project them to the `p`-primary + parts for `p=2,3,5,7`, yielding 0,2,0,1 vectors of length 3 modulo + `p` respectively. The exact vectors output depend on the computed generators of `G`:: sage: Plist = [EF([-2,3]), EF([0,2]), EF([1,0])] diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index b3d227d5d0c..3d6588e413e 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -811,12 +811,12 @@ def points(self): [(0 : 6 : 1), (0 : 1 : 1), (1 : 4 : 1), (1 : 3 : 1), (2 : 4 : 1), (2 : 3 : 1), (3 : 6 : 1), (3 : 1 : 1)] The method currently lists points on the plane projective model, that - is the closure in $\mathbb{P}^2$ of the curve defined by $y^2+hy=f$. - This means that one point $(0:1:0)$ at infinity is returned if the - degree of the curve is at least 4 and $\deg(f)>\deg(h)+1$. This point + is the closure in `\mathbb{P}^2` of the curve defined by `y^2+hy=f`. + This means that one point `(0:1:0)` at infinity is returned if the + degree of the curve is at least 4 and `\deg(f)>\deg(h)+1`. This point is a singular point of the plane model. Later implementations may consider a smooth model instead since that would be a more relevant - object. Then, for a curve whose only singularity is at $(0:1:0)$, the + object. Then, for a curve whose only singularity is at `(0:1:0)`, the point at infinity would be replaced by a number of rational points of the smooth model. We illustrate this with an example of a genus 2 hyperelliptic curve:: @@ -827,13 +827,13 @@ def points(self): [(0 : 1 : 0), (0 : 0 : 1), (1 : 7 : 1), (1 : 4 : 1), (5 : 7 : 1), (5 : 4 : 1), (6 : 0 : 1), (7 : 0 : 1), (8 : 0 : 1), (9 : 0 : 1), (10 : 0 : 1)] The plane model of the genus 2 hyperelliptic curve in the above example - is the curve in $\mathbb{P}^2$ defined by $y^2z^4=g(x,z)$ where - $g(x,z)=x(x+z)(x+2z)(x+3z)(x+4z)(x+5z).$ This model has one point at - infinity $(0:1:0)$ which is also the only singular point of the plane + is the curve in `\mathbb{P}^2` defined by `y^2z^4=g(x,z)` where + `g(x,z)=x(x+z)(x+2z)(x+3z)(x+4z)(x+5z).` This model has one point at + infinity `(0:1:0)` which is also the only singular point of the plane model. In contrast, the hyperelliptic curve is smooth and imbeds via - the equation $y^2=g(x,z)$ into weighted projected space - $\mathbb{P}(1,3,1)$. The latter model has two points at infinity: - $(1:1:0)$ and $(1:-1:0)$. + the equation `y^2=g(x,z)` into weighted projected space + `\mathbb{P}(1,3,1)`. The latter model has two points at infinity: + `(1:1:0)` and `(1:-1:0)`. """ from sage.rings.finite_rings.finite_field_constructor import zech_log_bound try: @@ -1426,7 +1426,7 @@ def _Cartier_matrix_cached(self): OUTPUT: - - matrix(Fq,M)' The matrix $M = (c_(pi-j)), f(x)^((p-1)/2) = \sum c_i x^i$ + - matrix(Fq,M)' The matrix `M = (c_(pi-j)), f(x)^((p-1)/2) = \sum c_i x^i` - 'Coeff' List of Coeffs of F, this is needed for Hasse-Witt function. - 'g' genus of the curve self, this is needed by a-number. - 'Fq' is the base field of self, and it is needed for Hasse-Witt diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index f76c6e06bac..b9d32c897b0 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -393,7 +393,7 @@ def monsky_washnitzer_gens(self): def invariant_differential(self): """ - Returns $dx/2y$, as an element of the Monsky-Washnitzer cohomology + Returns `dx/2y`, as an element of the Monsky-Washnitzer cohomology of self EXAMPLES:: diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 2087a47be82..fec6ea3558c 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -604,10 +604,10 @@ def _forward_image(self, f, check = True): The forward image is computed through elimination and ``f`` must be a morphism for this to be well defined. - In particular, let $X = V(h_1,\ldots, h_t)$ and define the ideal - $I = (h_1,\ldots,h_t,y_0-f_0(\bar{x}), \ldots, y_n-f_n(\bar{x}))$. - Then the elimination ideal $I_{n+1} = I \cap K[y_0,\ldots,y_n]$ is a homogeneous - ideal and $self(X) = V(I_{n+1})$. + In particular, let `X = V(h_1,\ldots, h_t)` and define the ideal + `I = (h_1,\ldots,h_t,y_0-f_0(\bar{x}), \ldots, y_n-f_n(\bar{x}))`. + Then the elimination ideal `I_{n+1} = I \cap K[y_0,\ldots,y_n]` is a homogeneous + ideal and `self(X) = V(I_{n+1})`. INPUT: diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index e0255c1b6ae..f0619f33dbf 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1259,7 +1259,7 @@ def Kodaira_map(self, names='z'): Return the Kodaira map. The Kodaira map is the rational map $X_\Sigma \to - \mathbb{P}^{n-1}$, where $n$ equals the number of sections. It + \mathbb{P}^{n-1}`, where `n` equals the number of sections. It is defined by the monomial sections of the line bundle. If the divisor is ample and the toric variety smooth or of diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index 01e721532cd..4cc0c2e340c 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -472,8 +472,8 @@ class SchemeHomset_points_toric_field(SchemeHomset_points_toric_base): [1 : 3 : 6]] As for a non-compact example, the blow-up of the plane is the line - bundle $O_{\mathbf{P}^1}(-1)$. Its point set is the Cartesian - product of the points on the base $\mathbf{P}^1$ with the points + bundle `O_{\mathbf{P}^1}(-1)`. Its point set is the Cartesian + product of the points on the base `\mathbf{P}^1` with the points on the fiber:: sage: fan = Fan([Cone([(1,0), (1,1)]), Cone([(1,1), (0,1)])]) diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index 092290fa54c..ca5686eebe8 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -158,7 +158,7 @@ that is dominant over the image or its closure). For example, consider the blow-up restricted to one of the two -coordinate charts of $O_{\mathbb{P}^1}(2)$ :: +coordinate charts of `O_{\mathbb{P}^1}(2)` :: sage: O2_P1_chart = ToricVariety(Fan([O2_P1.fan().generating_cones()[0]])) @@ -230,7 +230,7 @@ So we see that the fiber over this point is an affine line. Together with another affine line in the other coordinate patch, this covers -the exceptional $\mathbb{P}^1$ of the blowup $O_{\mathbb{P}^1}(2) \to +the exceptional `\mathbb{P}^1` of the blowup `O_{\mathbb{P}^1}(2) \to \CC^2/\ZZ_2$. Here is an example with higher dimensional varieties involved:: diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index 8d79a7760c6..5da8f26a9c5 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -525,7 +525,7 @@ def _Chow_group_torsion_generators(self): OUTPUT: A tuple containing generators for - $Hom(A_{d-1,\text{tors}}, F^\times)$. + `Hom(A_{d-1,\text{tors}}, F^\times)`. EXAMPLES:: diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 2932d9b03e5..b1304a16913 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -391,8 +391,8 @@ def E_degree(self, alpha, m): OUTPUT: - The subspace $E^\alpha(\alpha m)$ of the filtration indexed by - the ray $\alpha$ and at the filtration degree $\alpha * m$ + The subspace `E^\alpha(\alpha m)` of the filtration indexed by + the ray `\alpha` and at the filtration degree `\alpha * m` EXAMPLES:: diff --git a/src/sage/schemes/toric/weierstrass.py b/src/sage/schemes/toric/weierstrass.py index 3813cf53b80..552a91093d6 100644 --- a/src/sage/schemes/toric/weierstrass.py +++ b/src/sage/schemes/toric/weierstrass.py @@ -353,7 +353,7 @@ def Newton_polygon_embedded(polynomial, variables): def WeierstrassForm(polynomial, variables=None, transformation=False): r""" Return the Weierstrass form of an elliptic curve inside either - inside a toric surface or $\mathbb{P}^3$. + inside a toric surface or `\mathbb{P}^3`. INPUT: diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index d8bd20cf4f6..2f68532b48c 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -123,7 +123,7 @@ def _check_polynomials_P3(quadratic1, quadratic2, variables): ###################################################################### def _biquadratic_syzygy_quartic(quadratic1, quadratic2, variables=None): r""" - Helper function for the Weierstrass form of a biquadratic in $`\mathbb{P}^3$ + Helper function for the Weierstrass form of a biquadratic in `\mathbb{P}^3` The invariants and covariants of a quaternary biquadratic satisfy the relation @@ -131,9 +131,9 @@ def _biquadratic_syzygy_quartic(quadratic1, quadratic2, variables=None): which is (modulo the two quadratic equations) of the form $J^2 = p_4(T, T')$ where - * $J$, $T$, $T'$ are the covariants of the biquadratic. + * `J`, `T`, `T'` are the covariants of the biquadratic. - * $p_4$ is some quartic polynomial whose coefficients are + * `p_4` is some quartic polynomial whose coefficients are invariants of the biquadratic. INPUT: @@ -147,7 +147,7 @@ def _biquadratic_syzygy_quartic(quadratic1, quadratic2, variables=None): - The quaternary biquadratic as an algebraic form :class:`~sage.rings.invariant_theory.TwoQuaternaryQuadratics` - - The binary quartic $p_4$ as a + - The binary quartic `p_4` as a :class:`~sage.rings.invariant_theory.BinaryQuartic` - The dictionary of variable substitutions from the variables of From b215c7e23bce4166d936c9dc8aec04959fde3e00 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 9 Jun 2022 22:28:16 -0700 Subject: [PATCH 287/338] sage.rings: Replace $...$ in docstrings by `...` --- src/sage/rings/bernmm.pyx | 8 +++--- src/sage/rings/cfinite_sequence.py | 4 +-- src/sage/rings/number_field/S_unit_solver.py | 4 +-- .../polynomial_padic_capped_relative_dense.py | 28 +++++++++---------- src/sage/rings/polynomial/pbori/fglm.py | 4 +-- src/sage/rings/power_series_poly.pyx | 4 +-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/sage/rings/bernmm.pyx b/src/sage/rings/bernmm.pyx index 74c2aa19738..00a3da0d1ff 100644 --- a/src/sage/rings/bernmm.pyx +++ b/src/sage/rings/bernmm.pyx @@ -52,7 +52,7 @@ def bernmm_bern_rat(long k, int num_threads = 1): COMPLEXITY: - Pretty much quadratic in $k$. See the paper "A multimodular algorithm + Pretty much quadratic in `k`. See the paper "A multimodular algorithm for computing Bernoulli numbers", David Harvey, 2008, for more details. EXAMPLES:: @@ -98,9 +98,9 @@ def bernmm_bern_rat(long k, int num_threads = 1): def bernmm_bern_modp(long p, long k): r""" - Computes $B_k \mod p$, where $B_k$ is the k-th Bernoulli number. + Computes `B_k \mod p`, where `B_k` is the k-th Bernoulli number. - If $B_k$ is not $p$-integral, returns -1. + If `B_k` is not `p`-integral, returns -1. INPUT: @@ -109,7 +109,7 @@ def bernmm_bern_modp(long p, long k): COMPLEXITY: - Pretty much linear in $p$. + Pretty much linear in `p`. EXAMPLES:: diff --git a/src/sage/rings/cfinite_sequence.py b/src/sage/rings/cfinite_sequence.py index adf8cd9415b..02520ec2efb 100644 --- a/src/sage/rings/cfinite_sequence.py +++ b/src/sage/rings/cfinite_sequence.py @@ -1106,8 +1106,8 @@ def _coerce_map_from_(self, S): def from_recurrence(self, coefficients, values): r""" - Create a C-finite sequence given the coefficients $c$ and - starting values $a$ of a homogeneous linear recurrence. + Create a C-finite sequence given the coefficients `c` and + starting values `a` of a homogeneous linear recurrence. .. MATH:: diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py index 4e440c36ea0..6b50b7a66b6 100644 --- a/src/sage/rings/number_field/S_unit_solver.py +++ b/src/sage/rings/number_field/S_unit_solver.py @@ -1,7 +1,7 @@ r""" Solve S-unit equation x + y = 1 -Inspired by work of Tzanakis--de Weger, Baker--Wustholz and Smart, we use the LLL methods in Sage to implement an algorithm that returns all S-unit solutions to the equation $x + y = 1$. +Inspired by work of Tzanakis--de Weger, Baker--Wustholz and Smart, we use the LLL methods in Sage to implement an algorithm that returns all S-unit solutions to the equation `x + y = 1`. REFERENCES: @@ -850,7 +850,7 @@ def K1_func(SUK, v, A, prec=106): - ``SUK`` -- a group of `S`-units - ``v`` -- an infinite place of ``K`` (element of ``SUK.number_field().places(prec)``) - - ``A`` -- a list of all products of each potential ``a``, ``b`` in the $S$-unit equation ``ax + by + 1 = 0`` with each root of unity of ``K`` + - ``A`` -- a list of all products of each potential ``a``, ``b`` in the `S`-unit equation ``ax + by + 1 = 0`` with each root of unity of ``K`` - ``prec`` -- the precision of the real field (default: 106) OUTPUT: diff --git a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py index 6eac70126dc..42d2b9ce1db 100644 --- a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +++ b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py @@ -489,19 +489,19 @@ def _mul_(self, right): ALGORITHM: We use an algorithm thought up by Joe Wetherell to find the precisions of the product. It works as follows: - Suppose $f = \sum_i a_i x^i$ and $g = \sum_j b_j x^j$. Let $N - = \max(\deg f, \deg g) + 1$ (in the actual implementation we - use $N = 2^{\lfloor \log_2\max(\deg f, \deg g)\rfloor + 1}$). + Suppose `f = \sum_i a_i x^i` and `g = \sum_j b_j x^j`. Let `N + = \max(\deg f, \deg g) + 1` (in the actual implementation we + use `N = 2^{\lfloor \log_2\max(\deg f, \deg g)\rfloor + 1}`). The valuations and absolute precisions of each coefficient contribute to the absolute precision of the kth coefficient of - the product in the following way: for each $i + j = k$, you - take the valuation of $a_i$ plus the absolute precision of - $b_j$, and then take the valuation of $b_j$ plus the absolute - precision of $a_i$, take the minimum of those two, and then - take the minimum over all $i$, $j$ summing to $k$. + the product in the following way: for each `i + j = k`, you + take the valuation of `a_i` plus the absolute precision of + `b_j`, and then take the valuation of `b_j` plus the absolute + precision of `a_i`, take the minimum of those two, and then + take the minimum over all `i`, `j` summing to `k`. You can simulate this as follows. Construct new polynomials of - degree $N$: + degree `N`: \begin{align*} A &= \sum_i N^{\mbox{valuation of $a_i$}} x^i \\ @@ -519,7 +519,7 @@ def _mul_(self, right): our implementation. Since we're working 'N-adically' we can just consider - $N^{\infty} = 0$. + `N^{\infty} = 0`. NOTE: The timing of normalization in arithmetic operations may very well change as we do more tests on the relative time @@ -762,8 +762,8 @@ def degree(self, secure=False): indistinguishable from 0), an error is raised. If ``secure`` is ``False``, the returned value is the largest - $n$ so that the coefficient of $x^n$ does not compare equal - to $0$. + `n` so that the coefficient of `x^n` does not compare equal + to `0`. EXAMPLES:: @@ -801,8 +801,8 @@ def degree(self, secure=False): def prec_degree(self): """ - Return the largest $n$ so that precision information is - stored about the coefficient of $x^n$. + Return the largest `n` so that precision information is + stored about the coefficient of `x^n`. Always greater than or equal to degree. diff --git a/src/sage/rings/polynomial/pbori/fglm.py b/src/sage/rings/polynomial/pbori/fglm.py index bbcfd33fe35..dc60adef14c 100644 --- a/src/sage/rings/polynomial/pbori/fglm.py +++ b/src/sage/rings/polynomial/pbori/fglm.py @@ -61,9 +61,9 @@ def vars_real_divisors(monomial, monomial_set): def m_k_plus_one(completed_elements, variables): r""" - Calculate $m_{k+1}$ from the FGLM algorithm. + Calculate `m_{k+1}` from the FGLM algorithm. - Calculate $m_{k+1}$ from the FGLM algorithm as described in Wichmann [Wich1997]_. + Calculate `m_{k+1}` from the FGLM algorithm as described in Wichmann [Wich1997]_. .. NOTE:: diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 566b0c3d251..198c8e99438 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -754,8 +754,8 @@ cdef class PowerSeries_poly(PowerSeries): def truncate_powerseries(self, long prec): r""" - Given input ``prec`` = $n$, returns the power series of degree - $< n$ which is equivalent to self modulo $x^n$. + Given input ``prec`` = `n`, returns the power series of degree + `< n` which is equivalent to self modulo `x^n`. EXAMPLES:: From 3b2311ae275505f9243a64251de9d7ec8b796753 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 10 Jun 2022 17:13:24 +0900 Subject: [PATCH 288/338] Remove a period sneaked in --- src/doc/en/website/templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/en/website/templates/index.html b/src/doc/en/website/templates/index.html index d8895243052..cdadfb78ffd 100644 --- a/src/doc/en/website/templates/index.html +++ b/src/doc/en/website/templates/index.html @@ -33,7 +33,7 @@

    {{ docstitle|e }}

    This is documentation for Sage {{ release }}. Documentations in other languages are available here. -

    . +

    {% block tables %}

    From aa06a211bd923aeb7ebc51b7de088a1e224646b4 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Fri, 10 Jun 2022 16:55:06 +0800 Subject: [PATCH 289/338] faster 2-adic lifting for square roots modulo 2^n --- src/sage/rings/finite_rings/integer_mod.pyx | 36 +++++++-------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 401bd3cd794..f14ecbc5412 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -3891,9 +3891,7 @@ def square_root_mod_prime_power(IntegerMod_abstract a, p, e): ALGORITHM: Compute `p`-adically by stripping off even powers of `p` to get a unit and lifting `\sqrt{unit} \bmod p` via Newton's method - whenever `p` is odd and via - `\sqrt{1+y} = \sum_{k=0}^\infty \binom{1/2}{k} y^k` - for `p = 2`. + whenever `p` is odd and by a variant of Hensel lifting for `p = 2`. AUTHORS: @@ -3952,28 +3950,16 @@ def square_root_mod_prime_power(IntegerMod_abstract a, p, e): if unit.lift() % 8 != 1: raise ValueError("self must be a square") - if unit == 1: - return a.parent()(one_Z << val//2) - - # sqrt(1+y) = sum_{k=0}^{oo} binomial(1/2,k) y^k - y = unit - 1 - v = y.valuation(2) - y >>= v - - # 2-valuation of y^k / binomial(1/2,k) is >= (v-2)*k - n = 1 + (e + v-3) // (v-2) - - t = a.parent().one() # unit part - s = 0 # shift - - x = a.parent().one() - for i in range(1, n): - d = Integer(i) << 1 - c = 3 - d - t *= y * c.prime_to_m_part(2) / d.prime_to_m_part(2) - s += v + c.valuation(2) - d.valuation(2) -# assert t.is_unit() and s >= 0 - x += t << s + u = unit.lift() + x = next(i for i in range(1,8,2) if i*i & 31 == u & 31) + t = (x*x - u) >> 5 + for i in range(4, e-1 - val//2): + if t & 1: + x |= one_Z << i + t += x - (one_Z << i-1) + t >>= 1 +# assert t << i+2 == x*x - u + x = a.parent()(x) else: # find square root of unit mod p From 8e34f345233af19473f8b52afde5a398b5f08efc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 10 Jun 2022 12:38:16 -0700 Subject: [PATCH 290/338] Reviewer fixes to docstrings --- src/sage/categories/coxeter_groups.py | 2 +- src/sage/categories/examples/semigroups_cython.pyx | 2 +- src/sage/coding/guava.py | 2 +- .../geometry/riemannian_manifolds/parametrized_surface3d.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/categories/coxeter_groups.py b/src/sage/categories/coxeter_groups.py index 3f164f536a1..11a082d2fe6 100644 --- a/src/sage/categories/coxeter_groups.py +++ b/src/sage/categories/coxeter_groups.py @@ -2744,7 +2744,7 @@ def deodhar_lift_down(self, w, index_set): OUTPUT: The unique Bruhat-maximum element ``x`` in ``W`` such that ``x W' = w W'`` - and ``v `\ge` ``x``. + and ``v`` `\ge` ``x``. .. SEEALSO:: :meth:`sage.categories.coxeter_groups.CoxeterGroups.ElementMethods.deodhar_lift_up` diff --git a/src/sage/categories/examples/semigroups_cython.pyx b/src/sage/categories/examples/semigroups_cython.pyx index 95e79315e6b..ffd8dad8342 100644 --- a/src/sage/categories/examples/semigroups_cython.pyx +++ b/src/sage/categories/examples/semigroups_cython.pyx @@ -151,7 +151,7 @@ class LeftZeroSemigroup(LeftZeroSemigroupPython): sage: S.some_elements() [3, 42, 'a', 3.4, 'raton laveur'] - with product rule is given by `a \times b = a` for all `a,b`. :: + with product rule given by `a \times b = a` for all `a,b`. :: sage: S('hello') * S('world') 'hello' diff --git a/src/sage/coding/guava.py b/src/sage/coding/guava.py index e031b00af3d..26d94e068f3 100644 --- a/src/sage/coding/guava.py +++ b/src/sage/coding/guava.py @@ -62,7 +62,7 @@ def QuasiQuadraticResidueCode(p): sage: C = codes.QuasiQuadraticResidueCode(11); C # optional - gap_packages (Guava package) [22, 11] linear code over GF(2) - These are self-orthogonal in general and self-dual when `p \\equiv 3 \\pmod 4`. + These are self-orthogonal in general and self-dual when `p \equiv 3 \pmod 4`. AUTHOR: David Joyner (11-2005) """ diff --git a/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py b/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py index c1a126b630a..15285685477 100644 --- a/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py +++ b/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py @@ -825,7 +825,7 @@ def rotation(self,theta): The operator of rotation over `\pi/2` is `J^i_j = g^{ik}\omega_{jk}`, where `\omega` is the area form. The operator of rotation over an - angle `\theta` is `\cos(\theta) I + sin(\theta) J`. + angle `\theta` is `\cos(\theta) I + \sin(\theta) J`. EXAMPLES:: From afa5bed0f784d25343cbf9c95a680e5af1a3a61c Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Fri, 10 Jun 2022 15:10:36 -0700 Subject: [PATCH 291/338] trac 33968: more changes --- src/sage/combinat/matrices/hadamard_matrix.py | 2 +- src/sage/geometry/lattice_polytope.py | 2 +- src/sage/groups/matrix_gps/isometries.py | 8 ++++---- src/sage/rings/number_field/number_field.py | 2 +- src/sage/rings/rational_field.py | 2 +- src/sage/schemes/toric/morphism.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index d12f3e644c4..ea2d5160622 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -1156,7 +1156,7 @@ def symmetric_conference_matrix(n, check=True): A conference matrix is an `n\times n` matrix `C` with 0s on the main diagonal and 1s and -1s elsewhere, satisfying `CC^\top=(n-1)I`. - If `C=C^\top$ then `n \cong 2 \mod 4` and `C` is Seidel adjacency matrix of + If `C=C^\top` then `n \cong 2 \mod 4` and `C` is Seidel adjacency matrix of a graph, whose descendent graphs are strongly regular graphs with parameters `(n-1,(n-2)/2,(n-6)/4,(n-2)/4)`, see Sec.10.4 of [BH2012]_. Thus we build `C` from the Seidel adjacency matrix of the latter by adding row and column of 1s. diff --git a/src/sage/geometry/lattice_polytope.py b/src/sage/geometry/lattice_polytope.py index 89a4e9a2191..eba29281a7c 100644 --- a/src/sage/geometry/lattice_polytope.py +++ b/src/sage/geometry/lattice_polytope.py @@ -4263,7 +4263,7 @@ class NefPartition(SageObject, Hashable): `\overline{N} = N \times \ZZ^k` are dual lattices. The **Cayley polytope** `P \subset \overline{M}_\RR` of a nef-partition is - given by $P = \mathrm{Conv}(\Delta_0 \times e_0, \Delta_1 \times e_1, + given by `P = \mathrm{Conv}(\Delta_0 \times e_0, \Delta_1 \times e_1, \ldots, \Delta_{k-1} \times e_{k-1})`, where `\{e_i\}_{i=0}^{k-1}` is the standard basis of `\ZZ^k`. The **dual Cayley polytope** `P^* \subset \overline{N}_\RR` is the Cayley polytope of the dual diff --git a/src/sage/groups/matrix_gps/isometries.py b/src/sage/groups/matrix_gps/isometries.py index ab611b4ce7f..f9111a2c926 100644 --- a/src/sage/groups/matrix_gps/isometries.py +++ b/src/sage/groups/matrix_gps/isometries.py @@ -1,10 +1,10 @@ r""" Groups of isometries. -Let `M = \ZZ^n` or `\QQ^n`, `b: M \times M \rightarrow \QQ$ a bilinear form and -$f: M \rightarrow M$ a linear map. We say that $f$ is an isometry if for all -elements $x,y$ of $M$ we have that $b(x,y)=b(f(x),f(y))$. -A group of isometries is a subgroup of $GL(M)$ consisting of isometries. +Let `M = \ZZ^n` or `\QQ^n`, `b: M \times M \rightarrow \QQ` a bilinear form and +`f: M \rightarrow M` a linear map. We say that `f` is an isometry if for all +elements `x,y` of `M` we have that `b(x,y)=b(f(x),f(y))`. +A group of isometries is a subgroup of `GL(M)` consisting of isometries. EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index 78e0eb50e92..e00dbe9b7d2 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -5133,7 +5133,7 @@ def selmer_space(self, S, p, proof=None): `K(S,p)`, mapping them via the inverse isomorphism to the abstract vector space ``KSp``. - The group `K(S,p)` is the finite subgroup of `K^*/(K^*)^p$ + The group `K(S,p)` is the finite subgroup of `K^*/(K^*)^p` consisting of elements whose valuation at all primes not in `S` is a multiple of `p`. It contains the subgroup of those `a\in K^*` such that `K(\sqrt[p]{a})/K` is unramified at all diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 5327b921799..50710e0c13d 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -1405,7 +1405,7 @@ def selmer_space(self, S, p, proof=None): abstract vector space ``QSp``. The group `\QQ(S,p)` is the finite subgroup of - `\QQ^*/(\QQ^*)^p$ consisting of elements whose valuation at + `\QQ^*/(\QQ^*)^p` consisting of elements whose valuation at all primes not in `S` is a multiple of `p`. It contains the subgroup of those `a\in \QQ^*` such that `\QQ(\sqrt[p]{a})/\QQ` is unramified at all primes of `\QQ` diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index ca5686eebe8..75b683a41f7 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -231,7 +231,7 @@ So we see that the fiber over this point is an affine line. Together with another affine line in the other coordinate patch, this covers the exceptional `\mathbb{P}^1` of the blowup `O_{\mathbb{P}^1}(2) \to -\CC^2/\ZZ_2$. +\CC^2/\ZZ_2`. Here is an example with higher dimensional varieties involved:: From 8131256c2145a5645e0bb5cf33cf4eff330d0320 Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Fri, 10 Jun 2022 18:31:00 -0600 Subject: [PATCH 292/338] reviewer corrections --- src/sage/functions/orthogonal_polys.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py index ade05522bdd..85d8f603164 100644 --- a/src/sage/functions/orthogonal_polys.py +++ b/src/sage/functions/orthogonal_polys.py @@ -1291,12 +1291,13 @@ class Func_legendre_P(GinacFunction): ... RuntimeError: derivative w.r.t. to the index is not supported yet - TESTS:: + TESTS: + + Verify that :trac:`33962` is fixed:: - # verify that :trac:`33962` is fixed sage: [legendre_P(n, 0) for n in range(-10, 10)] [0, 35/128, 0, -5/16, 0, 3/8, 0, -1/2, 0, 1, - 1, 0, -1/2, 0, 3/8, 0, -5/16, 0, 35/128, 0] + 1, 0, -1/2, 0, 3/8, 0, -5/16, 0, 35/128, 0] """ def __init__(self): r""" From a3608a41a27c55eed9de19c40fb85c9c84db32db Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Wed, 8 Jun 2022 22:57:11 -0600 Subject: [PATCH 293/338] trac 33963: fix legendre polynomial --- src/sage/functions/orthogonal_polys.py | 9 +++++++++ src/sage/symbolic/ginac/mul.cpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py index 85d8f603164..6ea987aaa19 100644 --- a/src/sage/functions/orthogonal_polys.py +++ b/src/sage/functions/orthogonal_polys.py @@ -1298,6 +1298,15 @@ class Func_legendre_P(GinacFunction): sage: [legendre_P(n, 0) for n in range(-10, 10)] [0, 35/128, 0, -5/16, 0, 3/8, 0, -1/2, 0, 1, 1, 0, -1/2, 0, 3/8, 0, -5/16, 0, 35/128, 0] + + Verify that :trac:`33963` is fixed:: + + sage: n = var("n") + sage: assume(n, "integer") + sage: assume(n, "even") + sage: legendre_P(n, 0) + 2^(-n + 2)*(-1)^(1/2*n)*gamma(n)/(n*gamma(1/2*n)^2) + sage: forget() """ def __init__(self): r""" diff --git a/src/sage/symbolic/ginac/mul.cpp b/src/sage/symbolic/ginac/mul.cpp index c800cbf8475..6a3a8321bd2 100644 --- a/src/sage/symbolic/ginac/mul.cpp +++ b/src/sage/symbolic/ginac/mul.cpp @@ -415,6 +415,8 @@ bool mul::info(unsigned inf) const return overall_coeff.info(inf); } case info_flags::even: { + if (not overall_coeff.is_integer()) + return false; bool even_seen = false; for (const auto &elem : seq) { const ex &e = recombine_pair_to_ex(elem); From 13eced813040aab0eed0a440b9ed961c0850f492 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 10 Jun 2022 18:21:15 -0700 Subject: [PATCH 294/338] src/sage/misc/sagedoc.py (process_dollars): Emit deprecation warnings --- src/sage/misc/sagedoc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 37fd5d8b6e6..fe369cd0036 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -448,6 +448,7 @@ def process_dollars(s): """ if s.find("$") == -1: return s + from sage.misc.superseded import deprecation # find how much leading whitespace s has, for later comparison: # ignore all $ on lines which start with more whitespace. whitespace = re.match(r'\s*\S', s.lstrip('\n')) @@ -485,6 +486,9 @@ def process_dollars(s): while dollar.search(s, start, end): m = dollar.search(s, start, end) s = s[:m.end()-1] + "`" + s[m.end():] + deprecation(33973, + "using dollar signs to mark up math in Sage docstrings " + "is deprecated; use backticks instead") while slashdollar.search(s, start, end): m = slashdollar.search(s, start, end) s = s[:m.start()] + "$" + s[m.end():] From 63135495551c8cde3b267baa95f6c65c9071c78c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 10 Jun 2022 18:54:32 -0700 Subject: [PATCH 295/338] src/doc/en/developer/coding_basics.rst: No more dollar signs for math --- src/doc/en/developer/coding_basics.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index 2b540852a61..be52a2734b3 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -728,10 +728,9 @@ there is not one already. That is, you can do the following: LaTeX Typesetting ----------------- -In Sage's documentation LaTeX code is allowed and is marked with **backticks or -dollar signs**: +In Sage's documentation LaTeX code is allowed and is marked with **backticks**: - ```x^2 + y^2 = 1``` and ``$x^2 + y^2 = 1$`` both yield `x^2 + y^2 = 1`. + ```x^2 + y^2 = 1``` yields `x^2 + y^2 = 1`. **Backslashes:** For LaTeX commands containing backslashes, either use double backslashes or begin the docstring with a ``r"""`` instead of ``"""``. Both of @@ -744,7 +743,7 @@ the following are valid:: def sin(x): r""" - Return $\sin(x)$. + Return `\sin(x)`. """ **MATH block:** This is similar to the LaTeX syntax ``\[\]`` From 00ef03f93178000daaf7f108d55b9bbfac811a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 11 Jun 2022 10:26:31 +0200 Subject: [PATCH 296/338] get rid of commented-out old-style print --- src/bin/sage-preparse | 3 +- src/sage/algebras/q_system.py | 8 +-- src/sage/combinat/growth.py | 5 +- .../hecke_algebra_representation.py | 5 +- .../weight_lattice_realizations.py | 2 - src/sage/geometry/voronoi_diagram.py | 2 - .../graphs/graph_decompositions/bandwidth.pyx | 3 +- src/sage/interfaces/kash.py | 18 ------ src/sage/libs/symmetrica/symmetrica.pxi | 3 - src/sage/modular/modform/half_integral.py | 6 +- .../graded_ring_element.py | 3 - src/sage/modules/fg_pid/fgp_element.py | 9 +-- src/sage/numerical/linear_functions.pyx | 2 +- src/sage/plot/bar_chart.py | 5 +- src/sage/quadratic_forms/extras.py | 18 ++---- .../quadratic_form__local_field_invariants.py | 8 --- ...c_form__local_representation_conditions.py | 5 +- ...dratic_form__mass__Conway_Sloane_masses.py | 12 ---- .../quadratic_form__mass__Siegel_densities.py | 63 ++----------------- .../quadratic_forms/quadratic_form__theta.py | 51 +-------------- .../rings/padics/padic_extension_leaves.py | 4 +- src/sage/rings/padics/pow_computer_ext.pyx | 57 ----------------- src/sage/rings/polynomial/refine_root.pyx | 3 +- src/sage/rings/tate_algebra_ideal.pyx | 1 - src/sage/schemes/elliptic_curves/BSD.py | 2 +- src/sage/schemes/elliptic_curves/height.py | 4 -- src/sage/tests/benchmark.py | 4 +- 27 files changed, 33 insertions(+), 273 deletions(-) diff --git a/src/bin/sage-preparse b/src/bin/sage-preparse index 564ef9639a6..6392909ce1c 100755 --- a/src/bin/sage-preparse +++ b/src/bin/sage-preparse @@ -278,8 +278,7 @@ def do_load_and_attach(G, file, files_before): files = z.group('files').split() lws = z.group('lws') for w in files: - name = w.replace(',','').replace('"','').replace("'","") - #print "'%s'"%name, files_before + name = w.replace(',', '').replace('"', '').replace("'", "") if name in files_before: print("WARNING: not loading {} (in {}) again since would cause circular loop" .format(name, file)) diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index bbbf71e42cf..e7f808af4b7 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -263,16 +263,14 @@ def _ascii_art_term(self, t): ret += AsciiArt(['*'], baseline=0) else: first = False - a,m = k + a, m = k var = AsciiArt([" ({})".format(a), "Q{}".format(m)], baseline=0) - #print var - #print " "*(len(str(m))+1) + "({})".format(a) + '\n' + "Q{}".format(m) if exp > 1: - var = (AsciiArt(['(','('], baseline=0) + var + var = (AsciiArt(['(', '('], baseline=0) + var + AsciiArt([')', ')'], baseline=0)) - var = AsciiArt([" "*len(var) + str(exp)], baseline=-1) * var + var = AsciiArt([" " * len(var) + str(exp)], baseline=-1) * var ret += var return ret diff --git a/src/sage/combinat/growth.py b/src/sage/combinat/growth.py index 7be7b2a877b..6d584f6dea6 100644 --- a/src/sage/combinat/growth.py +++ b/src/sage/combinat/growth.py @@ -2194,13 +2194,12 @@ def forward_rule(self, y, e, t, f, x, content): g, z = 1, _make_partition(y).add_cell(row) # black else: g, z = 2, _make_partition(y).add_cell(row) # blue - elif x == y != t and f in [1, 3]: # black or red + elif x == y != t and f in [1, 3]: # black or red c = SkewPartition([x, t]).cells()[0] col = c[0] + c[1] + 1 - # print y, t, x, c, col for i in range(len(y)): if i + y[i] == col: - z = y[:i] + [y[i]+1] + y[i+1:] + z = y[:i] + [y[i] + 1] + y[i + 1:] break g = 3 else: diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py index 3eff906dc39..e146784ad98 100644 --- a/src/sage/combinat/root_system/hecke_algebra_representation.py +++ b/src/sage/combinat/root_system/hecke_algebra_representation.py @@ -611,7 +611,6 @@ def Y_lambdacheck(self, lambdacheck): alphacheck = P_check.simple_roots() c = Q_check.cartan_type().translation_factors() t = P_check.linear_combination( (alphacheck[i], c[i] * coeff) for i,coeff in lambdacheck ) - #print lambdacheck, "=", t # In type BC, c[i] may introduce rational coefficients # If we want to work in the lattice we might want to use the # following workaround after the fact ... @@ -1138,9 +1137,7 @@ def __getitem__(self, mu): muaffi = self.twist(muaff, i) mui = self.affine_retract(muaffi) E_mui = self[mui] - #print "Computing %s from E_%s=%s with T_%s"%(l, mui, E_mui, i) - q1,q2 = self.hecke_parameters(i) - #print q1, q2, self.eigenvalue(mui, -alphacheck[i]) + q1, q2 = self.hecke_parameters(i) coroot = alphacheck[i] ct = self.cartan_type() special_node = ct.special_node() diff --git a/src/sage/combinat/root_system/weight_lattice_realizations.py b/src/sage/combinat/root_system/weight_lattice_realizations.py index 07595137351..d6092d01968 100644 --- a/src/sage/combinat/root_system/weight_lattice_realizations.py +++ b/src/sage/combinat/root_system/weight_lattice_realizations.py @@ -694,7 +694,6 @@ def _test_reduced_word_of_translation(self, elements=None, **options): tester.assertIn(root, rank_simple_roots) permutation[i] = rank_simple_roots[root] tester.assertEqual(set(permutation), set(self.index_set())) - #print permutation # It could be nicer to test equality of G and its relabelling for i in self.index_set(): for j in self.index_set(): @@ -708,7 +707,6 @@ def _test_reduced_word_of_translation(self, elements=None, **options): # automorphisms, which are in bijection with the special nodes #from sage.groups.perm_gps.permgroup import PermutationGroup #P = PermutationGroup([[i+1 for i in permutation] for permutation in permutations]) - #print P, len(P) #tester.assertEqual(P, G.automorphism_group()) pass diff --git a/src/sage/geometry/voronoi_diagram.py b/src/sage/geometry/voronoi_diagram.py index 20ea56efeb3..e280a41143a 100644 --- a/src/sage/geometry/voronoi_diagram.py +++ b/src/sage/geometry/voronoi_diagram.py @@ -134,7 +134,6 @@ def __init__(self, points): enormalized.append(ineq) else: enormalized.append([i / ineq[0] for i in ineq[1:]]) - # print enormalized hlist = [list(ineq) for ineq in p.Hrepresentation()] hlistnormalized = [] for ineq in hlist: @@ -142,7 +141,6 @@ def __init__(self, points): hlistnormalized.append(ineq) else: hlistnormalized.append([i / ineq[0] for i in ineq[1:]]) - # print hlistnormalized for i in range(self._n): # for base ring RDF and AA, Polyhedron keeps the order of the diff --git a/src/sage/graphs/graph_decompositions/bandwidth.pyx b/src/sage/graphs/graph_decompositions/bandwidth.pyx index 91ffeeab130..44125b798db 100644 --- a/src/sage/graphs/graph_decompositions/bandwidth.pyx +++ b/src/sage/graphs/graph_decompositions/bandwidth.pyx @@ -392,12 +392,11 @@ cdef bint is_matching_feasible(int n, range_t * range_array, range_t * range_arr cdef int v, M, m, j for v in range(n): if range_array[v].M < range_array[v].m: - # print range_array[v].m, range_array[v].M return 0 index_array_tmp[v] = 0 # Sort the guys according to increasing value of M in O(n). - # + # Step 1: count the occurrences of each M for v in range(n): index_array_tmp[range_array[v].M] += 1 diff --git a/src/sage/interfaces/kash.py b/src/sage/interfaces/kash.py index 8cfc1dd8483..ce837b87737 100644 --- a/src/sage/interfaces/kash.py +++ b/src/sage/interfaces/kash.py @@ -558,24 +558,6 @@ def eval(self, x, newlines=False, strip=True, **kwds): else: return s.replace("\\\n", "") -# def help(self, name=None): -# """ -# Return help on KASH commands. - -# EXAMPLES:: - -# sage: X = kash.help('IntegerRing') # optional - kash - -# """ -# if name is None: -# print '\nTo use KASH help enter kash.help(s). ' -# print 'The syntax of the string s is given below.\n' -# print self.eval('?') -# elif name[0] == '?': -# print self.eval(name) -# else: -# print self.eval('?%s'%name) - def help(self, name=None): """ Return help on KASH commands. diff --git a/src/sage/libs/symmetrica/symmetrica.pxi b/src/sage/libs/symmetrica/symmetrica.pxi index e8b85194d0b..045fd8b760e 100644 --- a/src/sage/libs/symmetrica/symmetrica.pxi +++ b/src/sage/libs/symmetrica/symmetrica.pxi @@ -706,11 +706,8 @@ cdef void* _op_skew_partition(object p, OP a): cdef OP gross, klein gross = callocobject() klein = callocobject() - - #print p[0], p[1] _op_partition(p[0], gross) _op_partition(p[1], klein) - b_gk_spa(gross, klein, a) cdef object _py_skew_partition(OP a): diff --git a/src/sage/modular/modform/half_integral.py b/src/sage/modular/modform/half_integral.py index f67e1bf82df..3bef523c33b 100644 --- a/src/sage/modular/modform/half_integral.py +++ b/src/sage/modular/modform/half_integral.py @@ -128,11 +128,7 @@ def half_integral_weight_modform_basis(chi, k, prec): B = C.basis() # This computation of S below -- of course --dominates the whole function. - #from sage.misc.misc import cputime - #tm = cputime() - #print "Computing basis..." - S = [f.q_expansion(prec) for f in B] - #print "Time to compute basis", cputime(tm) + S = [f.q_expansion(prec) for f in B] T2 = theta2_qexp(prec) T3 = theta_qexp(prec) diff --git a/src/sage/modular/modform_hecketriangle/graded_ring_element.py b/src/sage/modular/modform_hecketriangle/graded_ring_element.py index b0af21809f2..4ec4b6e258b 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring_element.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring_element.py @@ -1547,10 +1547,7 @@ def _q_expansion_cached(self, prec, fix_d, subs_d, d_num_prec, fix_prec = False) sage: J_inv._q_expansion_cached(prec=5, fix_d=True, subs_d=None, d_num_prec=53, fix_prec=False) == J_inv.q_expansion_fixed_d() True """ - if not fix_prec: - #if (prec <1): - # print "Warning: non-positive precision!" if ((not self.is_zero()) and prec <= self.order_at(infinity)): from warnings import warn warn("precision too low to determine any coefficient!") diff --git a/src/sage/modules/fg_pid/fgp_element.py b/src/sage/modules/fg_pid/fgp_element.py index a862cb04530..c2ed4590188 100644 --- a/src/sage/modules/fg_pid/fgp_element.py +++ b/src/sage/modules/fg_pid/fgp_element.py @@ -5,15 +5,15 @@ - William Stein, 2009 """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2009 William Stein # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.structure.element import ModuleElement from sage.structure.richcmp import richcmp @@ -233,7 +233,6 @@ def _rmul_(self, c): sage: x._rmul_(1/4) (1/4, 0) """ - # print "_rmul_" P = self.parent() return P.element_class(P, self._x._rmul_(c)) @@ -279,11 +278,9 @@ def _lmul_(self, s): sage: x._lmul_(1/4) (1/4, 0) """ - # print '_lmul_' P = self.parent() return P.element_class(P, self._x._lmul_(s)) - def _repr_(self): """ diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx index 6aa5608c3fd..d35272b6f3f 100644 --- a/src/sage/numerical/linear_functions.pyx +++ b/src/sage/numerical/linear_functions.pyx @@ -1077,7 +1077,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): return '' try: from sage.rings.integer_ring import ZZ - coeff = ZZ(coeff) # print as integer if possible + coeff = ZZ(coeff) except (TypeError, ValueError): pass if constant_term: diff --git a/src/sage/plot/bar_chart.py b/src/sage/plot/bar_chart.py index e776d41889f..1f0d7d62cf7 100644 --- a/src/sage/plot/bar_chart.py +++ b/src/sage/plot/bar_chart.py @@ -179,11 +179,8 @@ def bar_chart(datalist, **options): sphinx_plot(bar_chart([-2,8,-7,3], rgbcolor=(1,0,0), axes=False)) """ dl = len(datalist) - # if dl > 1: - # print "WARNING, currently only 1 data set allowed" - # datalist = datalist[0] if dl == 3: - datalist = datalist+[0] + datalist = datalist + [0] # bardata = [] # cnt = 1 # for pnts in datalist: diff --git a/src/sage/quadratic_forms/extras.py b/src/sage/quadratic_forms/extras.py index 2baa4e3cfa7..ede37f6d77d 100644 --- a/src/sage/quadratic_forms/extras.py +++ b/src/sage/quadratic_forms/extras.py @@ -127,24 +127,18 @@ def extend_to_primitive(A_input): ## Extend the matrix in new coordinates, then switch back. B = A * V - B_new = matrix(R, n-k, n) - for i in range(n-k): - B_new[i, n-i-1] = 1 + B_new = matrix(R, n - k, n) + for i in range(n - k): + B_new[i, n - i - 1] = 1 C = B.stack(B_new) D = C * V**(-1) - ## DIAGNOSTIC - #print "A = ", A, "\n" - #print "B = ", B, "\n" - #print "C = ", C, "\n" - #print "D = ", D, "\n" - # Normalize for a positive determinant if D.det() < 0: - D.rescale_row(n-1, -1) + D.rescale_row(n - 1, -1) - ## Return the current information - if vec_output_flag: + # Return the current information + if vec_output_flag: return D.rows() else: return D diff --git a/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py b/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py index 03f74d51ed0..a78b99f3068 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py +++ b/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py @@ -460,10 +460,6 @@ def hasse_invariant(self, p): Diag = self.rational_diagonal_form() R = Diag.base_ring() - ## DIAGNOSTIC - #print "\n Q = " + str(self) - #print "\n Q diagonalized at p = " + str(p) + " gives " + str(Diag) - hasse_temp = 1 n = Diag.dim() @@ -548,10 +544,6 @@ def hasse_invariant__OMeara(self, p): Diag = self.rational_diagonal_form() R = Diag.base_ring() - ## DIAGNOSTIC - #print "\n Q = " + str(self) - #print "\n Q diagonalized at p = " + str(p) + " gives " + str(Diag) - hasse_temp = 1 n = Diag.dim() if R == QQ: diff --git a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py index df2c4fc5894..4ca4a0d0910 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py +++ b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py @@ -602,16 +602,13 @@ def is_locally_represented_at_place(self, m, p): else: ## m == 0 return True - ## Check at a finite place + # Check at a finite place sqclass = self.squareclass_vector(p) for s in sqclass: - #print "m =", m, " s =", s, " m/s =", (QQ(m)/s) if (QQ(m)/s).is_padic_square(p): nu = valuation(m//s, p) return local_vec[sqclass.index(s) + 1] <= (nu / 2) - - def is_locally_represented(self, m): """ Determines if the rational number `m` is locally represented by diff --git a/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py b/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py index f91857adb82..e40ba2f9e91 100644 --- a/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +++ b/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py @@ -617,13 +617,6 @@ def conway_standard_mass(self): else: s = (n+1) // 2 - ## DIAGNOSTIC - #print "n = ", n - #print "s = ", s - #print "Gamma Factor = \n", prod([gamma__exact(j / ZZ(2)) for j in range(1, n+1)]) - #print "Zeta Factor = \n", prod([zeta__exact(2*k) for k in range(1, s)]) - #print "Pi Factor = \n", pi**((-1) * n * (n+1) / ZZ(4)) - generic_mass = 2 * pi**((-1) * n * (n+1) / ZZ(4)) \ * prod([gamma__exact(j / ZZ(2)) for j in range(1, n+1)]) \ * prod([zeta__exact(2*k) for k in range(1, s)]) @@ -682,11 +675,6 @@ def conway_mass(self): return self.__conway_mass -## ======================================================== - - - - #def conway_generic_mass(self): # """ # Computes the generic mass given as diff --git a/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py b/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py index 2941df73430..9301bd2efcc 100644 --- a/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +++ b/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py @@ -73,34 +73,18 @@ def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson ########################################## generic_prod *= (self.det())**(ZZ(n+1)/2) ## ***** This uses the Hessian Determinant ******** ########################################## - #print "gp1 = ", generic_prod generic_prod *= prod([gamma__exact(ZZ(j)/2) for j in range(1,n+1)]) - #print "\n---", [(ZZ(j)/2, gamma__exact(ZZ(j)/2)) for j in range(1,n+1)] - #print "\n---", prod([gamma__exact(ZZ(j)/2) for j in range(1,n+1)]) - #print "gp2 = ", generic_prod generic_prod *= prod([zeta__exact(ZZ(j)) for j in range(2, 2*s+1, 2)]) - #print "\n---", [zeta__exact(ZZ(j)) for j in range(2, 2*s+1, 2)] - #print "\n---", prod([zeta__exact(ZZ(j)) for j in range(2, 2*s+1, 2)]) - #print "gp3 = ", generic_prod if (n % 2 == 0): generic_prod *= quadratic_L_function__exact(n//2, ZZ(-1)**(n//2) * char_d) - #print " NEW = ", ZZ(1) * quadratic_L_function__exact(n/2, (-1)**(n/2) * char_d) - #print - #print "gp4 = ", generic_prod - - #print "generic_prod =", generic_prod - - ## Determine the adjustment factors + # Determine the adjustment factors adj_prod = ZZ.one() for p in prime_divisors(2 * self.det()): ## Cancel out the generic factors p_adjustment = prod([1 - ZZ(p)**(-j) for j in range(2, 2*s+1, 2)]) if (n % 2 == 0): p_adjustment *= (1 - kronecker((-1)**(n//2) * char_d, p) * ZZ(p)**(-n//2)) - #print " EXTRA = ", ZZ(1) * (1 - kronecker((-1)**(n/2) * char_d, p) * ZZ(p)**(-n/2)) - #print "Factor to cancel the generic one:", p_adjustment - - ## Insert the new mass factors + # Insert the new mass factors if p == 2: if even_algorithm == "Kitaoka": p_adjustment = p_adjustment / self.Kitaoka_mass_at_2() @@ -114,24 +98,18 @@ def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson else: raise TypeError("There is a problem -- your optional arguments are invalid. Try again. =(") - #print "p_adjustment for p =", p, "is", p_adjustment - - ## Put them together (cumulatively) + # Put them together (cumulatively) adj_prod *= p_adjustment - #print "Cumulative adj_prod =", adj_prod - - ## Extra adjustment for the case of a 2-dimensional form. + # Extra adjustment for the case of a 2-dimensional form. #if (n == 2): # generic_prod *= 2 - ## Return the mass mass = generic_prod * adj_prod return mass - def Pall_mass_density_at_odd_prime(self, p): """ Returns the local representation density of a form (for @@ -168,19 +146,14 @@ def Pall_mass_density_at_odd_prime(self, p): ## compute the invariants for each Jordan block. jordan_list = self.jordan_blocks_by_scale_and_unimodular(p) modified_jordan_list = [(a, Q.dim(), Q.det()) for (a,Q) in jordan_list] ## List of pairs (scale, det) - #print jordan_list - #print modified_jordan_list - ## Step 2: Compute the list of local masses for each Jordan block jordan_mass_list = [] for (s,n,d) in modified_jordan_list: generic_factor = prod([1 - p**(-2*j) for j in range(1, (n-1)//2+1)]) - #print "generic factor: ", generic_factor if (n % 2 == 0): m = n/2 generic_factor *= (1 + legendre_symbol(((-1)**m) * d, p) * p**(-m)) - #print "jordan_mass: ", generic_factor jordan_mass_list = jordan_mass_list + [generic_factor] @@ -188,7 +161,6 @@ def Pall_mass_density_at_odd_prime(self, p): MJL = modified_jordan_list s = len(modified_jordan_list) M = [sum([MJL[j][1] for j in range(i, s)]) for i in range(s-1)] ## Note: It's s-1 since we don't need the last M. - #print "M = ", M nu = sum([M[i] * MJL[i][0] * MJL[i][1] for i in range(s-1)]) - ZZ(sum([J[0] * J[1] * (J[1]-1) for J in MJL]))/ZZ(2) p_mass = prod(jordan_mass_list) p_mass *= 2**(s-1) * p**nu @@ -243,10 +215,6 @@ def Watson_mass_at_2(self): else: diag_dict[s] = L - #print "diag_dict = ", diag_dict - #print "dim2_dict = ", dim2_dict - #print "Jordan_Blocks = ", Jordan_Blocks - ## Step 2: Compute three dictionaries of invariants (for n_j, m_j, nu_j) n_dict = dict((j,0) for j in range(s_min+1, s_max+2)) m_dict = dict((j,0) for j in range(s_min, s_max+4)) @@ -256,15 +224,10 @@ def Watson_mass_at_2(self): m_dict[s+1] = ZZ.one()/ZZ(2) * L.dim() else: m_dict[s+1] = floor(ZZ(L.dim() - 1) / ZZ(2)) - #print " ==>", ZZ(L.dim() - 1) / ZZ(2), floor(ZZ(L.dim() - 1) / ZZ(2)) nu_dict = dict((j,n_dict[j+1] - 2*m_dict[j+1]) for j in range(s_min, s_max+1)) nu_dict[s_max+1] = 0 - #print "n_dict = ", n_dict - #print "m_dict = ", m_dict - #print "nu_dict = ", nu_dict - ## Step 3: Compute the e_j dictionary eps_dict = {} for j in range(s_min, s_max+3): @@ -284,9 +247,6 @@ def Watson_mass_at_2(self): else: eps_dict[j] = -1 - #print "eps_dict = ", eps_dict - - ## Step 4: Compute the quantities nu, q, P, E for the local mass at 2 nu = sum([j * n_dict[j] * (ZZ(n_dict[j] + 1) / ZZ(2) + \ sum([n_dict[r] for r in range(j+1, s_max+2)])) for j in range(s_min+1, s_max+2)]) @@ -343,11 +303,6 @@ def Kitaoka_mass_at_2(self): else: diag_dict[s] = L - #print "diag_dict = ", diag_dict - #print "dim2_dict = ", dim2_dict - #print "Jordan_Blocks = ", Jordan_Blocks - - ################## START EDITING HERE ################## ## Compute q := sum of the q_j @@ -381,14 +336,7 @@ def Kitaoka_mass_at_2(self): else: E *= 2 - ## DIAGNOSTIC - #print "\nFinal Summary:" - #print "nu =", nu - #print "q = ", q - #print "P = ", P - #print "E = ", E - - ## Compute the exponent w + # Compute the exponent w w = QQ.zero() for j in range(s_min, s_max+1): n_j = Jordan_Blocks[j][1].dim() @@ -396,7 +344,6 @@ def Kitaoka_mass_at_2(self): n_k = Jordan_Blocks[k][1].dim() w += j * n_j * (n_k + QQ(n_j + 1) / 2) - ## Step 5: Compute the local mass for the prime 2. mass_at_2 = (QQ(2)**(w - q)) * P * E return mass_at_2 diff --git a/src/sage/quadratic_forms/quadratic_form__theta.py b/src/sage/quadratic_forms/quadratic_form__theta.py index ba9bcebcd53..36594ff09d5 100644 --- a/src/sage/quadratic_forms/quadratic_form__theta.py +++ b/src/sage/quadratic_forms/quadratic_form__theta.py @@ -237,61 +237,25 @@ def theta_by_cholesky(self, q_prec): ## 3a. Main loop - - ## DIAGNOSTIC - #print - #print " L = ", L - #print " x = ", x - x[i] += 1 while (x[i] > L[i]): - - ## DIAGNOSTIC - #print " x = ", x - i += 1 x[i] += 1 - ## 3b. Main loop if (i > 0): from_step3_flag = True - - ## DIAGNOSTIC - #print " i = " + str(i) - #print " T[i] = " + str(T[i]) - #print " Q[i,i] = " + str(Q[i,i]) - #print " x[i] = " + str(x[i]) - #print " U[i] = " + str(U[i]) - #print " x[i] + U[i] = " + str(x[i] + U[i]) - #print " T[i-1] = " + str(T[i-1]) - T[i-1] = T[i] - Q[i,i] * (x[i] + U[i]) * (x[i] + U[i]) - - # DIAGNOSTIC - #print " T[i-1] = " + str(T[i-1]) - #print - i += - 1 U[i] = 0 for j in range(i+1, n): U[i] += Q[i,j] * x[j] - - ## 4. Solution found (This happens when i=0) from_step4_flag = True Q_val_double = q_prec - T[0] + Q[0,0] * (x[0] + U[0]) * (x[0] + U[0]) Q_val = floor(Q_val_double + half) ## Note: This rounds the value up, since the "round" function returns a float, but floor returns integer. - - - ## DIAGNOSTIC - #print " Q_val_double = ", Q_val_double - #print " Q_val = ", Q_val - #raise RuntimeError - - ## OPTIONAL SAFETY CHECK: eps = 0.000000001 if (abs(Q_val_double - Q_val) > eps): @@ -300,12 +264,6 @@ def theta_by_cholesky(self, q_prec): + " Q_val = " + str(Q_val) + "\n" \ + " x = " + str(x) + "\n") - - ## DIAGNOSTIC - #print " The float value is " + str(Q_val_double) - #print " The associated long value is " + str(Q_val) - #print - if (Q_val <= q_prec): theta[Q_val] += 2 @@ -315,15 +273,10 @@ def theta_by_cholesky(self, q_prec): if (x[j] != 0): done_flag = False - - ## Set the value: theta[0] = 1 + # Set the value: theta[0] = 1 theta[0] = 1 - ## DIAGNOSTIC - #print "Leaving ComputeTheta \n" - - - ## Return the series, truncated to the desired q-precision + # Return the series, truncated to the desired q-precision return PS(theta) diff --git a/src/sage/rings/padics/padic_extension_leaves.py b/src/sage/rings/padics/padic_extension_leaves.py index 5e6c9df80f1..48359ef12ab 100644 --- a/src/sage/rings/padics/padic_extension_leaves.py +++ b/src/sage/rings/padics/padic_extension_leaves.py @@ -686,8 +686,8 @@ def __init__(self, exact_modulus, poly, prec, print_mode, shift_seed, names, imp """ unram_prec = (prec + poly.degree() - 1) // poly.degree() ntl_poly = ntl_ZZ_pX([a.lift() for a in poly.list()], poly.base_ring().prime()**unram_prec) - shift_poly = ntl_ZZ_pX([a.lift() for a in shift_seed.list()], shift_seed.base_ring().prime()**unram_prec) - #print poly.base_ring().prime(), prec, poly.degree(), ntl_poly + shift_poly = ntl_ZZ_pX([a.lift() for a in shift_seed.list()], + shift_seed.base_ring().prime()**unram_prec) # deal with prec not a multiple of e better. self.prime_pow = PowComputer_ext_maker(poly.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, ntl_poly, "FM", "e", shift_poly) self._shift_seed = shift_seed diff --git a/src/sage/rings/padics/pow_computer_ext.pyx b/src/sage/rings/padics/pow_computer_ext.pyx index 0b370efbe93..7dc2887337d 100644 --- a/src/sage/rings/padics/pow_computer_ext.pyx +++ b/src/sage/rings/padics/pow_computer_ext.pyx @@ -206,18 +206,15 @@ cdef int ZZ_pX_Eis_init(PowComputer_ZZ_pX prime_pow, ntl_ZZ_pX shift_seed) excep #ZZ_negate(a, a) ##cdef ntl_ZZ_pX printer = ntl_ZZ_pX([],prime_pow.get_context(prime_pow.prec_cap)) ##printer.x = modup - ##print printer # Note that we're losing one digit of precision here. # This is correct because right shifting does not preserve precision. # a is now the negative of the inverse of the unit part of the constant of the defining polynomial (there's a mouthful) #ZZ_pX_RightShift(tmp, modup, 1) ##printer.x = modup - ##print printer #ZZ_pX_mul_ZZ_p(tmp, tmp, ZZ_to_ZZ_p(a)) # tmp is now p/x #ZZ_pX_conv_modulus(into_multiplier, tmp, prime_pow.get_top_context().x) ##printer.x = into_multiplier - ##print printer #if multiplier: # ZZ_pX_Multiplier_construct(low_shifter_m) # ZZ_pX_Multiplier_build(low_shifter_m[0], into_multiplier, prime_pow.get_top_modulus()[0]) @@ -225,7 +222,6 @@ cdef int ZZ_pX_Eis_init(PowComputer_ZZ_pX prime_pow, ntl_ZZ_pX shift_seed) excep # ZZ_pX_construct(low_shifter_p) # low_shifter_p[0] = into_multiplier ##printer.x = (low_shifter[0]).val() - ##print printer ZZ_pX_InvMod_newton_ram(shift_seed_inv, shift_seed.x, prime_pow.get_top_modulus()[0], prime_pow.get_top_context().x) for i in range(low_length): # Currently tmp = p / x^(2^(i-1)). Squaring yields p^2 / x^(2^i) @@ -236,7 +232,6 @@ cdef int ZZ_pX_Eis_init(PowComputer_ZZ_pX prime_pow, ntl_ZZ_pX shift_seed) excep ZZ_pX_PowerXMod_long_pre(into_multiplier, prime_pow.e - (1L << i), prime_pow.get_top_modulus()[0]) ZZ_pX_MulMod_pre(into_multiplier, into_multiplier, shift_seed_inv, prime_pow.get_top_modulus()[0]) ##printer.x = into_multiplier - ##print printer if multiplier: ZZ_pX_Multiplier_build(low_shifter_m[i], into_multiplier, prime_pow.get_top_modulus()[0]) else: @@ -253,21 +248,15 @@ cdef int ZZ_pX_Eis_init(PowComputer_ZZ_pX prime_pow, ntl_ZZ_pX shift_seed) excep ###ZZ_pX_right_pshift(into_multiplier, modup, prime_pow.small_powers[1], prime_pow.get_top_context().x) ###printer.x = into_multiplier - ###print printer # into_multiplier now holds x^e/p # prime_pow.c.x should have been restored, but we make sure prime_pow.restore_top_context() - ##print "shift_seed=%s"%shift_seed ##printer.x = prime_pow.get_top_modulus()[0].val() - ##print "top_modulus=%s"%printer - ##print "top_context=%s"%prime_pow.get_top_context() into_multiplier = shift_seed_inv #ZZ_pX_InvMod_newton_ram(into_multiplier, shift_seed.x, prime_pow.get_top_modulus()[0], prime_pow.get_top_context().x) ##printer.x = into_multiplier - ##print "inverse = %s"%printer ##ZZ_pX_MulMod_pre(printer.x, into_multiplier, shift_seed.x, prime_pow.get_top_modulus()[0]) - ##print "product = %s"%printer if multiplier: ZZ_pX_Multiplier_build(high_shifter_m[0], into_multiplier, prime_pow.get_top_modulus()[0]) else: @@ -331,7 +320,6 @@ cdef int ZZ_pX_eis_shift_p(PowComputer_ZZ_pX self, ZZ_pX_c* x, ZZ_pX_c* a, long sage: f_dtr = yr*dtr; f_dtr O(a^456)*t^2 + O(a^306)*t^3 + O(a^156)*t^4 + (a^6 + 6*a^36 + 2*a^66 + 7*a^96 + 4*a^126 + O(a^156))*t^5 + O(a^158)*t^6 + (a^8 + 2*a^38 + 8*a^68 + 3*a^98 + O(a^158))*t^7 + O(a^160)*t^8 + (8*a^40 + 10*a^100 + 5*a^130 + O(a^160))*t^9 + O(a^162)*t^10 + (2*a^12 + 5*a^42 + 3*a^72 + 7*a^102 + O(a^162))*t^11 + O(a^164)*t^12 + (8*a^14 + a^44 + 6*a^74 + 4*a^104 + 7*a^134 + O(a^164))*t^13 + O(a^166)*t^14 + (2*a^16 + 8*a^46 + 5*a^106 + 4*a^136 + O(a^166))*t^15 + O(a^168)*t^16 + (a^18 + 6*a^48 + 5*a^78 + 2*a^108 + 9*a^138 + O(a^168))*t^17 + O(a^170)*t^18 + (8*a^50 + 2*a^110 + O(a^170))*t^19 + O(a^172)*t^20 + (4*a^52 + 2*a^82 + 7*a^112 + 5*a^142 + O(a^172))*t^21 + O(a^174)*t^22 + (2*a^54 + 3*a^84 + 8*a^114 + 6*a^144 + O(a^174))*t^23 + O(a^176)*t^24 + (a^26 + 6*a^56 + 4*a^86 + 9*a^116 + 3*a^146 + O(a^176))*t^25 + O(a^178)*t^26 + (10*a^28 + 5*a^58 + 4*a^88 + 10*a^118 + 6*a^148 + O(a^178))*t^27 + O(a^180)*t^28 + (5*a^30 + 5*a^60 + 4*a^90 + 9*a^120 + 3*a^150 + O(a^180))*t^29 + O(a^182)*t^30 + (4*a^32 + 10*a^62 + 5*a^92 + 7*a^122 + 3*a^152 + O(a^182))*t^31 + O(a^184)*t^32 + (5*a^34 + 9*a^94 + 3*a^124 + 6*a^154 + O(a^184))*t^33 + O(a^186)*t^34 + (4*a^36 + 3*a^66 + 10*a^96 + 2*a^126 + 6*a^156 + O(a^186))*t^35 + O(a^188)*t^36 + (6*a^38 + 9*a^68 + 7*a^128 + 10*a^158 + O(a^188))*t^37 + O(a^190)*t^38 + (7*a^40 + 3*a^70 + 4*a^100 + 4*a^130 + 8*a^160 + O(a^190))*t^39 + O(a^192)*t^40 + (a^42 + 10*a^72 + 10*a^102 + a^132 + 7*a^162 + O(a^192))*t^41 + O(a^194)*t^42 + (8*a^74 + 8*a^104 + 9*a^134 + 7*a^164 + O(a^194))*t^43 + O(a^196)*t^44 + (10*a^136 + 2*a^166 + O(a^196))*t^45 + O(a^198)*t^46 + (7*a^48 + 10*a^78 + 5*a^108 + 8*a^138 + 3*a^168 + O(a^198))*t^47 + O(a^200)*t^48 + (6*a^50 + 5*a^80 + a^110 + 6*a^170 + O(a^200))*t^49 + O(a^202)*t^50 + (a^52 + 8*a^82 + 2*a^112 + 10*a^172 + O(a^202))*t^51 + O(a^204)*t^52 + (9*a^54 + 2*a^84 + 6*a^114 + 4*a^144 + O(a^204))*t^53 + O(a^206)*t^54 + (2*a^56 + 5*a^86 + 2*a^116 + 4*a^146 + a^176 + O(a^206))*t^55 + O(a^208)*t^56 + (3*a^58 + 3*a^88 + a^118 + 5*a^148 + 2*a^178 + O(a^208))*t^57 + O(a^210)*t^58 + (5*a^60 + 10*a^90 + 9*a^120 + a^150 + 6*a^180 + O(a^210))*t^59 + O(a^212)*t^60 + (4*a^62 + 9*a^92 + 7*a^122 + 7*a^152 + 9*a^182 + O(a^212))*t^61 + O(a^214)*t^62 + (10*a^64 + 8*a^94 + 6*a^124 + 8*a^154 + 4*a^184 + O(a^214))*t^63 + O(a^216)*t^64 + (4*a^126 + 10*a^156 + 9*a^186 + O(a^216))*t^65 + O(a^218)*t^66 + (7*a^98 + 4*a^128 + 6*a^158 + 6*a^188 + O(a^218))*t^67 + O(a^220)*t^68 + (3*a^70 + 6*a^100 + 8*a^130 + 9*a^160 + 10*a^190 + O(a^220))*t^69 + O(a^222)*t^70 + (9*a^72 + 5*a^102 + 9*a^132 + 3*a^162 + 10*a^192 + O(a^222))*t^71 + O(a^224)*t^72 + (3*a^74 + 8*a^104 + 7*a^134 + 2*a^164 + O(a^224))*t^73 + O(a^226)*t^74 + (10*a^76 + a^106 + 2*a^136 + 4*a^166 + 9*a^196 + O(a^226))*t^75 + O(a^228)*t^76 + (3*a^78 + 6*a^108 + 9*a^138 + 4*a^168 + 5*a^198 + O(a^228))*t^77 + O(a^230)*t^78 + (4*a^80 + 10*a^110 + 7*a^170 + 8*a^200 + O(a^230))*t^79 + O(a^232)*t^80 + (5*a^82 + 4*a^112 + 9*a^142 + 8*a^172 + 8*a^202 + O(a^232))*t^81 + O(a^234)*t^82 + (4*a^84 + 9*a^114 + 8*a^144 + 2*a^174 + 6*a^204 + O(a^234))*t^83 + O(a^236)*t^84 + (3*a^86 + 5*a^116 + 4*a^146 + 8*a^206 + O(a^236))*t^85 + O(a^238)*t^86 + (a^118 + 7*a^148 + 6*a^208 + O(a^238))*t^87 + O(a^240)*t^88 + (4*a^90 + 9*a^120 + 9*a^150 + 6*a^180 + 6*a^210 + O(a^240))*t^89 + O(a^244)*t^90 + (10*a^122 + 3*a^152 + 8*a^182 + 4*a^212 + 2*a^242 + O(a^244))*t^91 + O(a^276)*t^92 + (9*a^154 + 10*a^184 + 10*a^214 + 7*a^244 + 9*a^274 + O(a^276))*t^93 + O(a^308)*t^94 + (9*a^186 + 4*a^216 + 5*a^246 + a^276 + 10*a^306 + O(a^308))*t^95 """ - ##print "starting..." cdef ZZ_pX_c low_part cdef ZZ_pX_c shifted_high_part cdef ZZ_pX_c powerx @@ -381,11 +369,9 @@ cdef int ZZ_pX_eis_shift_p(PowComputer_ZZ_pX self, ZZ_pX_c* x, ZZ_pX_c* a, long ##printer = ntl_ZZ_pX([],c) ZZ_pX_PowerXMod_long_pre(powerx, -n, m[0]) ##printer.x = powerx - ##print printer ZZ_pX_conv_modulus(x[0], a[0], c.x) ZZ_pX_MulMod_pre(x[0], powerx, a[0], m[0]) ##printer.x = x[0] - ##print printer return 0 elif n == 0: if x != a: @@ -396,9 +382,6 @@ cdef int ZZ_pX_eis_shift_p(PowComputer_ZZ_pX self, ZZ_pX_c* x, ZZ_pX_c* a, long ZZ_pX_conv_modulus(x[0], a[0], c.x) return 0 - ##print "eis_part: %s" %(eis_part) - ##print "pshift: %s"%(pshift) - # The following doesn't work, sadly. It should be possible to precompute and do better than what I replace this code with. # c = self.get_context(finalprec) # m = self.get_modulus(finalprec)[0] @@ -408,34 +391,27 @@ cdef int ZZ_pX_eis_shift_p(PowComputer_ZZ_pX self, ZZ_pX_c* x, ZZ_pX_c* a, long # else: # ZZ_pX_conv_modulus(x[0], a[0], c.x) # ##printer.x = a[0] -# ##print "beginning: a = %s"%(printer) # c.restore_c() # if pshift: # i = 0 # # This line restores the top context # #ZZ_pX_right_pshift(x[0], x[0], self.pow_ZZ_tmp(pshift)[0], c.x) # ##printer.x = x[0] -# ##print printer # if pshift >= self.prec_cap: # # shifter = p^(2^(high_length - 1))/x^(e*2^(high_length - 1)) # ZZ_pX_conv_modulus(shifter, high_shifter[high_length-1], c.x) # ##printer.x = shifter -# ##print printer # # if val = r + s * 2^(high_length - 1) # # then shifter = p^(s*2^(high_length - 1))/x^(e*s*2^(high_length - 1)) # ZZ_pX_PowerMod_long_pre(shifter, shifter, (pshift / (1L << (high_length - 1))), m) # ##printer.x = shifter -# ##print printer # ZZ_pX_MulMod_pre(x[0], x[0], shifter, m) # ##printer.x = shifter -# ##print printer # # Now we only need to multiply self.unit by p^r/x^(e*r) where r < 2^(high_length - 1), which is tractible. # pshift = pshift % (1L << (high_length - 1)) # while pshift > 0: # if pshift & 1: -# ##print "pshift = %s"%pshift # ##printer.x = x[0] -# ##print printer # ZZ_pX_conv_modulus(highshift, high_shifter[i], c.x) # ZZ_pX_MulMod_pre(x[0], x[0], highshift, m) # i += 1 @@ -465,32 +441,23 @@ cdef int ZZ_pX_eis_shift_p(PowComputer_ZZ_pX self, ZZ_pX_c* x, ZZ_pX_c* a, long i = 0 two_shift = 1 while eis_part > 0: - ##print "eis_part = %s"%(eis_part) if eis_part & 1: - ##print "i = %s"%(i) - ##print "two_shift = %s"%(two_shift) ##printer.x = working2 - ##print "working2 = %s"%(printer) ZZ_pX_RightShift(shifted_high_part, working2, two_shift) ##printer.x = shifted_high_part - ##print "shifted_high_part = %s"%(printer) ZZ_pX_LeftShift(low_part, shifted_high_part, two_shift) ZZ_pX_sub(low_part, working2, low_part) ##printer.x = low_part - ##print "low_part = %s"%(printer) ZZ_pX_right_pshift(low_part, low_part, self.pow_ZZ_tmp(1)[0], c.x) ##printer.x = low_part - ##print "low_part = %s"%(printer) if fm: ZZ_pX_MulMod_premul(low_part, low_part, low_shifter_fm[i], m[0]) else: ZZ_pX_conv_modulus(lowshift, low_shifter[i], c.x) ZZ_pX_MulMod_pre(low_part, low_part, lowshift, m[0]) ##printer.x = low_part - ##print "low_part = %s"%(printer) ZZ_pX_add(working2, low_part, shifted_high_part) ##printer.x = working2 - ##print "x = %s"%(printer) i += 1 two_shift = two_shift << 1 eis_part = eis_part >> 1 @@ -1016,12 +983,8 @@ cdef class PowComputer_ZZ_pX(PowComputer_ext): 4 """ if self.pow_Integer(mpz_get_si(n.value)) != Integer(a.c.p): - #print self.pow_Integer(mpz_get_si(n.value)) - #print a.c.p raise ValueError("a context mismatch") if self.pow_Integer(mpz_get_si(n.value)) != Integer(b.c.p): - #print self.pow_Integer(mpz_get_si(n.value)) - #print b.c.p raise ValueError("b context mismatch") cdef ntl_ZZ_pX r = (a)._new() cdef ntl_ZZ_pX aa = (a)._new() @@ -1504,7 +1467,6 @@ cdef class PowComputer_ZZ_pX_FM_Eis(PowComputer_ZZ_pX_FM): """ return ZZ_pX_eis_shift_p(self, x, a, n, finalprec) -# ##print "starting..." # cdef ZZ_pX_c low_part # cdef ZZ_pX_c shifted_high_part # cdef ZZ_pX_c high_shifter @@ -1515,10 +1477,8 @@ cdef class PowComputer_ZZ_pX_FM_Eis(PowComputer_ZZ_pX_FM): # ##printer = ntl_ZZ_pX([],self.get_top_context()) # ZZ_pX_PowerXMod_long_pre(high_shifter, -n, self.get_top_modulus()[0]) # ##printer.x = high_shifter -# ##print printer # ZZ_pX_MulMod_pre(x[0],high_shifter,a[0],self.get_top_modulus()[0]) # ##printer.x = x[0] -# ##print printer # return 0 # elif n == 0: # if x != a: @@ -1530,36 +1490,27 @@ cdef class PowComputer_ZZ_pX_FM_Eis(PowComputer_ZZ_pX_FM): # cdef int i # ##printer = ntl_ZZ_pX([],self.get_top_context()) -# ##print "eis_part: %s" %(eis_part) -# ##print "pshift: %s"%(pshift) # if x != a: -# ##print "copying" # x[0] = a[0] # ##printer.x = a[0] -# ##print "beginning: a = %s"%(printer) # if pshift: # i = 0 # # This line restores the top context # ZZ_pX_right_pshift(x[0], x[0], self.pow_ZZ_tmp(pshift)[0], self.get_top_context().x) # ##printer.x = x[0] -# ##print printer # if pshift >= self.prec_cap: # # high_shifter = p^(2^(high_length - 1))/x^(e*2^(high_length - 1)) # # if val = r + s * 2^(high_length - 1) # # then high_shifter = p^(s*2^(high_length - 1))/x^(e*s*2^(high_length - 1)) # ZZ_pX_PowerMod_long_pre(high_shifter, self.high_shifter[self.high_length-1].val(), (pshift / (1L << (self.high_length - 1))), self.get_top_modulus()[0]) # ##printer.x = high_shifter -# ##print printer # ZZ_pX_MulMod_pre(x[0], x[0], high_shifter, self.get_top_modulus()[0]) # ##printer.x = high_shifter -# ##print printer # # Now we only need to multiply self.unit by p^r/x^(e*r) where r < 2^(high_length - 1), which is tractible. # pshift = pshift % (1L << (self.high_length - 1)) # while pshift > 0: # if pshift & 1: -# ##print "pshift = %s"%pshift # ##printer.x = x[0] -# ##print printer # ZZ_pX_MulMod_premul(x[0], x[0], self.high_shifter[i], self.get_top_modulus()[0]) # i += 1 # pshift = pshift >> 1 @@ -1568,26 +1519,18 @@ cdef class PowComputer_ZZ_pX_FM_Eis(PowComputer_ZZ_pX_FM): # i = 0 # two_shift = 1 # while eis_part > 0: -# ##print "eis_part = %s"%(eis_part) # if eis_part & 1: -# ##print "i = %s"%(i) -# ##print "two_shift = %s"%(two_shift) # ZZ_pX_RightShift(shifted_high_part, x[0], two_shift) # ##printer.x = shifted_high_part -# ##print "shifted_high_part = %s"%(printer) # ZZ_pX_LeftShift(low_part, shifted_high_part, two_shift) # ZZ_pX_sub(low_part, x[0], low_part) # ##printer.x = low_part -# ##print "low_part = %s"%(printer) # ZZ_pX_right_pshift(low_part, low_part, self.pow_ZZ_tmp(1)[0], self.get_top_context().x) # ##printer.x = low_part -# ##print "low_part = %s"%(printer) # ZZ_pX_MulMod_premul(low_part, low_part, self.low_shifter[i], self.get_top_modulus()[0]) # ##printer.x = low_part -# ##print "low_part = %s"%(printer) # ZZ_pX_add(x[0], low_part, shifted_high_part) # ##printer.x = x[0] -# ##print "x = %s"%(printer) # i += 1 # two_shift = two_shift << 1 # eis_part = eis_part >> 1 diff --git a/src/sage/rings/polynomial/refine_root.pyx b/src/sage/rings/polynomial/refine_root.pyx index aafbeb442f3..082bf810881 100644 --- a/src/sage/rings/polynomial/refine_root.pyx +++ b/src/sage/rings/polynomial/refine_root.pyx @@ -109,11 +109,10 @@ def refine_root(ip, ipd, irt, fld): val = ip(center) nirt = center - val / slope - # print irt, nirt, (nirt in irt), nirt.diameter(), irt.diameter(), center, val, slope if nirt in irt and (nirt.diameter() >= irt.diameter() >> 3 or i >= 8): # If the new diameter is much less than the original diameter, # then we have not yet converged. (Perhaps we were asked - # for a particularly high-precision result.) So we don't + # for a particularly high-precision result.) So we do not # return yet. return nirt diff --git a/src/sage/rings/tate_algebra_ideal.pyx b/src/sage/rings/tate_algebra_ideal.pyx index 12e12ce4791..e9d8fc522ce 100644 --- a/src/sage/rings/tate_algebra_ideal.pyx +++ b/src/sage/rings/tate_algebra_ideal.pyx @@ -952,7 +952,6 @@ def groebner_basis_pote(I, prec, verbose=0): if not v or v.valuation() >= prec: # We have a new element in (I0:f) whose signature # could be useful to strengthen the syzygy criterium - #print ("| add signature for syzygy criterium: %s" % s) gb0.append(s) else: # We update the current strong Grobner basis diff --git a/src/sage/schemes/elliptic_curves/BSD.py b/src/sage/schemes/elliptic_curves/BSD.py index 16734687c15..a9a42ebd84b 100644 --- a/src/sage/schemes/elliptic_curves/BSD.py +++ b/src/sage/schemes/elliptic_curves/BSD.py @@ -907,7 +907,7 @@ def prove_BSD(E, verbosity=0, two_desc='mwrank', proof=None, secs_hi=5, BSD.primes.remove(p) break - # print some extra information + # some extra information if verbosity > 1: if BSD.primes: print('Remaining primes:') diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 0770e3284bc..21403a196de 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -1574,12 +1574,8 @@ def wp(z): pole_approx = abs(z) ** -2 else: pole_approx = z ** -2 - # print "pole approx", pole_approx + eps(err, abs_only) - # print approx in approx.intersection(pole_approx + eps(err, abs_only)) approx = approx.intersection(pole_approx + eps(err, abs_only)) - return approx - return wp @cached_method diff --git a/src/sage/tests/benchmark.py b/src/sage/tests/benchmark.py index 3649a81f4f8..3612f941168 100644 --- a/src/sage/tests/benchmark.py +++ b/src/sage/tests/benchmark.py @@ -1,7 +1,6 @@ """ Benchmarks - COMMENTS: Taken as a whole these benchmarks suggest that by far the fastest math @@ -85,7 +84,6 @@ def run(self, systems=None, timeout=60, trials=1, sort=False, optional=False): if sort: systems.sort() print('\n\n\n' + str(self)) - #print "Timeout: %s seconds"%timeout print(' %-12s%-12s%-12s%-12s%-12s%15s' % ('System', 'min', 'avg', 'max', 'trials', 'cpu or wall')) @@ -142,6 +140,7 @@ def __repr__(self): except AttributeError: return 'sage.tests.benchmark.Benchmark instance' + class Divpoly(Benchmark): def __init__(self, n): """ @@ -582,7 +581,6 @@ def __init__(self, nvars=2, base=QQ, allow_singular=True): ## z1 = gp(str(z1)) ## gp.eval('gettime') ## f = z0*z1 -## print f ## return float(gp.eval('gettime/1000.0')) def maxima(self): From 017c3a28645dc708f4187fa5debf56e012f416d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 11 Jun 2022 11:36:27 +0200 Subject: [PATCH 297/338] some pep fixes in pxi files --- .../libs/linkages/padics/Polynomial_ram.pxi | 3 +- .../libs/linkages/padics/fmpz_poly_unram.pxi | 30 ++++++--- src/sage/libs/linkages/padics/mpz.pxi | 3 +- src/sage/libs/ntl/ntl_GF2X_linkage.pxi | 13 ++-- src/sage/libs/symmetrica/sb.pxi | 63 +++++++++++++------ src/sage/libs/symmetrica/symmetrica.pxi | 3 +- .../matrix/matrix_modn_dense_template.pxi | 52 +++++++++------ src/sage/rings/padics/CA_template.pxi | 9 ++- src/sage/rings/padics/CR_template.pxi | 13 ++-- src/sage/rings/padics/FM_template.pxi | 6 +- src/sage/rings/padics/FP_template.pxi | 10 ++- 11 files changed, 138 insertions(+), 67 deletions(-) diff --git a/src/sage/libs/linkages/padics/Polynomial_ram.pxi b/src/sage/libs/linkages/padics/Polynomial_ram.pxi index 3742ffd567d..1ac51f1211f 100644 --- a/src/sage/libs/linkages/padics/Polynomial_ram.pxi +++ b/src/sage/libs/linkages/padics/Polynomial_ram.pxi @@ -319,7 +319,8 @@ _expansion_zero = [] # the expansion_mode enum is defined in padic_template_element_header.pxi cdef inline cexpansion_next(celement value, expansion_mode mode, long curpower, PowComputer_ prime_pow): - if mode == teichmuller_mode: raise NotImplementedError + if mode == teichmuller_mode: + raise NotImplementedError # This is not very efficient, but there's no clear better way. # We assume this is only called on two-step extensions (for more general # extensions, convert to the absolute field). diff --git a/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi b/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi index b797782c657..60fb9439388 100644 --- a/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi +++ b/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi @@ -87,20 +87,25 @@ cdef inline int ccmp(celement a, celement b, long prec, bint reduce_a, bint redu if prec == 0: return 0 - if ciszero(prime_pow.poly_ccmp, prime_pow): return 0 + if ciszero(prime_pow.poly_ccmp, prime_pow): + return 0 cdef long da = fmpz_poly_degree(a) cdef long db = fmpz_poly_degree(b) - if da < db: return -1 - elif da > db: return 1 + if da < db: + return -1 + elif da > db: + return 1 cdef long cmp cdef long i for i in range(da+1): fmpz_poly_get_coeff_fmpz(prime_pow.fmpz_ccmp, prime_pow.poly_ccmp, i) cmp = fmpz_cmp_si(prime_pow.fmpz_ccmp, 0) - if cmp < 0: return -1 - elif cmp > 0: return 1 + if cmp < 0: + return -1 + elif cmp > 0: + return 1 assert False cdef inline int cneg(celement out, celement a, long prec, PowComputer_ prime_pow) except -1: @@ -238,7 +243,8 @@ cdef inline long cvaluation(celement a, long prec, PowComputer_ prime_pow) excep if fmpz_is_zero(prime_pow.fmpz_cval): continue val = fmpz_remove(prime_pow.fmpz_cval, prime_pow.fmpz_cval, prime_pow.fprime) - if val < ret: ret = val + if val < ret: + ret = val return ret cdef inline bint cisunit(celement a, PowComputer_ prime_pow) except -1: @@ -354,10 +360,12 @@ cdef inline int cinvert(celement out, celement a, long prec, PowComputer_ prime_ fmpz_poly_scalar_divexact_fmpz(out, a, prime_pow.fmpz_cinv) fmpz_poly_xgcd(prime_pow.fmpz_cinv2, out, prime_pow.poly_cinv2, out, prime_pow.poly_cinv) - if fmpz_is_zero(prime_pow.fmpz_cinv2): raise ValueError("polynomials are not coprime") + if fmpz_is_zero(prime_pow.fmpz_cinv2): + raise ValueError("polynomials are not coprime") fmpz_mul(prime_pow.fmpz_cinv2, prime_pow.fmpz_cinv, prime_pow.fmpz_cinv2) - if not fmpz_invmod(prime_pow.fmpz_cinv2, prime_pow.fmpz_cinv2, prime_pow.pow_fmpz_t_tmp(prec)[0]): raise ValueError("content or xgcd is not a unit") + if not fmpz_invmod(prime_pow.fmpz_cinv2, prime_pow.fmpz_cinv2, prime_pow.pow_fmpz_t_tmp(prec)[0]): + raise ValueError("content or xgcd is not a unit") fmpz_poly_scalar_mul_fmpz(out, out, prime_pow.fmpz_cinv2) creduce(out, out, prec, prime_pow) @@ -581,7 +589,8 @@ cdef inline cexpansion_next(fmpz_poly_t value, expansion_mode mode, long curpowe is being found. Only used in ``smallest_mode``. - ``prime_pow`` -- A ``PowComputer`` holding `p`-adic data. """ - if mode == teichmuller_mode: raise NotImplementedError + if mode == teichmuller_mode: + raise NotImplementedError ans = [] cdef fmpz* c cdef long i @@ -728,7 +737,8 @@ cdef int cconv(celement out, x, long prec, long valshift, PowComputer_ prime_pow for i in range(len(x)): cconv(prime_pow.poly_cconv, x[i], prec, valshift, prime_pow) degree = fmpz_poly_degree(prime_pow.poly_cconv) - if degree == -1: continue + if degree == -1: + continue elif degree == 0: fmpz_poly_get_coeff_fmpz(prime_pow.fmpz_cconv, prime_pow.poly_cconv, 0) fmpz_poly_set_coeff_fmpz(out, i, prime_pow.fmpz_cconv) diff --git a/src/sage/libs/linkages/padics/mpz.pxi b/src/sage/libs/linkages/padics/mpz.pxi index a766ce99bb1..a7200b0c4fa 100644 --- a/src/sage/libs/linkages/padics/mpz.pxi +++ b/src/sage/libs/linkages/padics/mpz.pxi @@ -505,7 +505,8 @@ cdef inline cexpansion_next(mpz_t value, expansion_mode mode, long curpower, Pow is being found. Only used in ``smallest_mode``. - ``prime_pow`` -- A ``PowComputer`` holding `p`-adic data. """ - if mode == teichmuller_mode: raise NotImplementedError + if mode == teichmuller_mode: + raise NotImplementedError cdef Integer ans = PY_NEW(Integer) cdef bint neg mpz_mod(ans.value, value, prime_pow.prime.value) diff --git a/src/sage/libs/ntl/ntl_GF2X_linkage.pxi b/src/sage/libs/ntl/ntl_GF2X_linkage.pxi index bccdbc15bad..91d52652cd5 100644 --- a/src/sage/libs/ntl/ntl_GF2X_linkage.pxi +++ b/src/sage/libs/ntl/ntl_GF2X_linkage.pxi @@ -347,16 +347,21 @@ cdef inline int celement_pow(GF2X_c* res, GF2X_c* x, long e, GF2X_c *modulus, lo GF2X_LeftShift(res[0], x[0], e - 1) else: do_sig = GF2X_deg(x[0]) > 1e5 - if do_sig: sig_on() + if do_sig: + sig_on() GF2X_power(res[0], x[0], e) - if do_sig: sig_off() + if do_sig: + sig_off() else: GF2XModulus_build(mod, modulus[0]) do_sig = GF2X_deg(x[0]) > 1e5 - if do_sig: sig_on() + if do_sig: + sig_on() GF2X_PowerMod_long_pre(res[0], x[0], e, mod) - if do_sig: sig_off() + if do_sig: + sig_off() + cdef inline int celement_gcd(GF2X_c* res, GF2X_c* a, GF2X_c *b, long parent) except -2: """ diff --git a/src/sage/libs/symmetrica/sb.pxi b/src/sage/libs/symmetrica/sb.pxi index 2a7b7ed6a5c..732d9811901 100644 --- a/src/sage/libs/symmetrica/sb.pxi +++ b/src/sage/libs/symmetrica/sb.pxi @@ -12,8 +12,6 @@ cdef extern from 'symmetrica/def.h': INT mult_schubert_polynom(OP a,OP b,OP c) - - cdef object _check_schubert(object a, OP ca): if a in Permutations(): if isinstance(a, builtinlist): @@ -48,7 +46,9 @@ def mult_schubert_schubert_symmetrica(a, b): max_a = _check_schubert(a, ca) max_b = _check_schubert(b, cb) except (ValueError, TypeError), err: - freeall(ca); freeall(cb); freeall(cres) + freeall(ca) + freeall(cb) + freeall(cres) raise err @@ -81,7 +81,8 @@ def t_SCHUBERT_POLYNOM_symmetrica(a): try: max_a = _check_schubert(a, ca) except (ValueError, TypeError), err: - freeall(ca); freeall(cres) + freeall(ca) + freeall(cres) raise err sig_on() @@ -111,12 +112,14 @@ def t_POLYNOM_SCHUBERT_symmetrica(a): cdef OP ca = callocobject(), cres = callocobject() if not is_MPolynomial(a): - freeall(ca); freeall(cres) + freeall(ca) + freeall(cres) raise TypeError("a (= %s) must be a multivariate polynomial") else: br = a.parent().base_ring() if br != QQ and br != ZZ: - freeall(ca); freeall(cres) + freeall(ca) + freeall(cres) raise ValueError("a's base ring must be either ZZ or QQ") else: _op_polynom(a, ca) @@ -151,7 +154,9 @@ def mult_schubert_variable_symmetrica(a, i): try: max_a = _check_schubert(a, ca) except (ValueError, TypeError), err: - freeall(ca); freeall(ci); freeall(cres) + freeall(ca) + freeall(ci) + freeall(cres) raise err _op_integer(i, ci) @@ -162,7 +167,9 @@ def mult_schubert_variable_symmetrica(a, i): res = _py(cres) - freeall(ca); freeall(ci); freeall(cres) + freeall(ca) + freeall(ci) + freeall(cres) return res @@ -191,11 +198,15 @@ def divdiff_perm_schubert_symmetrica(perm, a): try: max_a = _check_schubert(a, ca) except (ValueError, TypeError), err: - freeall(ca); freeall(cperm); freeall(cres) + freeall(ca) + freeall(cperm) + freeall(cres) raise err if perm not in Permutations(): - freeall(ca); freeall(cperm); freeall(cres) + freeall(ca) + freeall(cperm) + freeall(cres) raise TypeError("perm must be a permutation") else: perm = Permutation(perm) @@ -204,7 +215,9 @@ def divdiff_perm_schubert_symmetrica(perm, a): _op_permutation(perm, cperm) if max_perm > max_a: - freeall(ca); freeall(cperm); freeall(cres) + freeall(ca) + freeall(cperm) + freeall(cres) raise ValueError(r"cannot apply \delta_{%s} to a (= %s)" % (perm, a)) sig_on() @@ -213,7 +226,9 @@ def divdiff_perm_schubert_symmetrica(perm, a): res = _py(cres) - freeall(ca); freeall(cperm); freeall(cres) + freeall(ca) + freeall(cperm) + freeall(cres) return res @@ -235,7 +250,9 @@ def scalarproduct_schubert_symmetrica(a, b): max_a = _check_schubert(a, ca) max_b = _check_schubert(b, cb) except (ValueError, TypeError), err: - freeall(ca); freeall(cb); freeall(cres) + freeall(ca) + freeall(cb) + freeall(cres) raise err sig_on() @@ -247,7 +264,9 @@ def scalarproduct_schubert_symmetrica(a, b): else: res = _py(cres) - freeall(ca); freeall(cb); freeall(cres) + freeall(ca) + freeall(cb) + freeall(cres) return res @@ -275,17 +294,23 @@ def divdiff_schubert_symmetrica(i, a): try: max_a = _check_schubert(a, ca) except (ValueError, TypeError), err: - freeall(ca); freeall(ci); freeall(cres) + freeall(ca) + freeall(ci) + freeall(cres) raise err if not isinstance(i, (int, Integer)): - freeall(ca); freeall(ci); freeall(cres) + freeall(ca) + freeall(ci) + freeall(cres) raise TypeError("i must be an integer") else: _op_integer(i, ci) if i > max_a or i <= 0: - freeall(ca); freeall(ci); freeall(cres) + freeall(ca) + freeall(ci) + freeall(cres) raise ValueError(r"cannot apply \delta_{%s} to a (= %s)" % (i, a)) sig_on() @@ -294,6 +319,8 @@ def divdiff_schubert_symmetrica(i, a): res = _py(cres) - freeall(ca); freeall(ci); freeall(cres) + freeall(ca) + freeall(ci) + freeall(cres) return res diff --git a/src/sage/libs/symmetrica/symmetrica.pxi b/src/sage/libs/symmetrica/symmetrica.pxi index e8b85194d0b..75fce1b8220 100644 --- a/src/sage/libs/symmetrica/symmetrica.pxi +++ b/src/sage/libs/symmetrica/symmetrica.pxi @@ -667,8 +667,7 @@ cdef object _py_sq_radical(OP a): else: res += _py(S_PO_K(ptr))*sqrt(_py(S_PO_S(ptr))) - - ptr = S_L_N(ptr); + ptr = S_L_N(ptr) return res.radical_simplify() diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index 11859c6bda1..77339965aa4 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -189,12 +189,14 @@ cdef inline linbox_echelonize(celement modulus, celement* entries, Py_ssize_t nr cdef size_t nbthreads nbthreads = Parallelism().get('linbox') cdef bool transform = False - if nrows*ncols > 1000: sig_on() + if nrows * ncols > 1000: + sig_on() if nbthreads > 1 : r = pReducedRowEchelonForm(F[0], nrows, ncols, entries, ncols, P, Q, transform, nbthreads) else : r = ReducedRowEchelonForm(F[0], nrows, ncols, entries, ncols, P, Q) - if nrows*ncols > 1000: sig_off() + if nrows * ncols > 1000: + sig_off() for i in range(nrows): for j in range(r): @@ -257,12 +259,14 @@ cdef inline int linbox_rank(celement modulus, celement* entries, Py_ssize_t nrow cdef Py_ssize_t r cdef size_t nbthreads nbthreads = Parallelism().get('linbox') - if nrows*ncols > 1000: sig_on() + if nrows * ncols > 1000: + sig_on() if nbthreads > 1: r = pRank(F[0], nrows, ncols, cpy, ncols, nbthreads) else: r = Rank(F[0], nrows, ncols, cpy, ncols) - if nrows*ncols > 1000: sig_off() + if nrows * ncols > 1000: + sig_off() sig_free(cpy) del F return r @@ -278,12 +282,14 @@ cdef inline celement linbox_det(celement modulus, celement* entries, Py_ssize_t cdef size_t nbthreads nbthreads = Parallelism().get('linbox') - if n*n > 1000: sig_on() + if n*n > 1000: + sig_on() if nbthreads > 1 : pDet(F[0], d, n, cpy, n, nbthreads) else : Det(F[0], d, n, cpy, n) - if n*n > 1000: sig_off() + if n*n > 1000: + sig_off() sig_free(cpy) del F return d @@ -300,7 +306,8 @@ cdef inline celement linbox_matrix_matrix_multiply(celement modulus, celement* a cdef size_t nbthreads nbthreads = Parallelism().get('linbox') - if m*n*k > 100000: sig_on() + if m*n*k > 100000: + sig_on() if nbthreads > 1 : pfgemm(F[0], FflasNoTrans, FflasNoTrans, m, n, k, one, A, k, B, n, zero, @@ -310,7 +317,8 @@ cdef inline celement linbox_matrix_matrix_multiply(celement modulus, celement* a A, k, B, n, zero, ans, n) - if m*n*k > 100000: sig_off() + if m*n*k > 100000: + sig_off() del F @@ -323,12 +331,14 @@ cdef inline int linbox_matrix_vector_multiply(celement modulus, celement* C, cel F.init(one, 1) F.init(zero, 0) - if m*n > 100000: sig_on() + if m*n > 100000: + sig_on() fgemv(F[0], trans, m, n, one, A, n, b, 1, zero, C, 1) - if m*n > 100000: sig_off() + if m*n > 100000: + sig_off() del F @@ -340,9 +350,11 @@ cdef inline linbox_minpoly(celement modulus, Py_ssize_t nrows, celement* entries cdef ModField *F = new ModField(modulus) cdef vector[ModField.Element] *minP = new vector[ModField.Element]() - if nrows*nrows > 1000: sig_on() + if nrows*nrows > 1000: + sig_on() MinPoly(F[0], minP[0], nrows, entries, nrows) - if nrows*nrows > 1000: sig_off() + if nrows*nrows > 1000: + sig_off() l = [] for i in range(minP.size()): @@ -362,9 +374,11 @@ cdef inline linbox_charpoly(celement modulus, Py_ssize_t nrows, celement* entrie cdef celement *cpy = linbox_copy(modulus, entries, nrows, nrows) - if nrows*nrows > 1000: sig_on() + if nrows * nrows > 1000: + sig_on() CharPoly(R[0], P, nrows, cpy, nrows) - if nrows*nrows > 1000: sig_off() + if nrows * nrows > 1000: + sig_off() sig_free(cpy) @@ -1704,7 +1718,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): ....: A.echelonize(algorithm='all') """ x = self.fetch('in_echelon_form') - if not x is None: + if x is not None: return # already known to be in echelon form if not self.base_ring().is_field(): @@ -1941,8 +1955,8 @@ cdef class Matrix_modn_dense_template(Matrix_dense): """ self.check_mutability() x = self.fetch('in_hessenberg_form') - if not x is None and x: return # already known to be in Hessenberg form - + if x is not None and x: + return # already known to be in Hessenberg form if self._nrows != self._ncols: raise ArithmeticError("Matrix must be square to compute Hessenberg form.") @@ -2134,7 +2148,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): cdef Matrix_modn_dense_template A if self.p > 2 and is_prime(self.p): x = self.fetch('rank') - if not x is None: + if x is not None: return x r = Integer(linbox_rank(self.p, self._entries, self._nrows, self._ncols)) self.cache('rank', r) @@ -2237,7 +2251,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): if self.p > 2 and is_prime(self.p): x = self.fetch('det') - if not x is None: + if x is not None: return x d = linbox_det(self.p, self._entries, self._nrows) d2 = self._coerce_element(d) diff --git a/src/sage/rings/padics/CA_template.pxi b/src/sage/rings/padics/CA_template.pxi index 257aa09036b..8f1c4c7795c 100644 --- a/src/sage/rings/padics/CA_template.pxi +++ b/src/sage/rings/padics/CA_template.pxi @@ -860,7 +860,8 @@ cdef class CAElement(pAdicTemplateElement): :meth:`sage.misc.cachefunc._cache_key` """ - tuple_recursive = lambda l: tuple(tuple_recursive(x) for x in l) if isinstance(l, Iterable) else l + def tuple_recursive(l): + return tuple(tuple_recursive(x) for x in l) if isinstance(l, Iterable) else l return (self.parent(), tuple_recursive(trim_zeros(list(self.expansion()))), self.precision_absolute()) def _teichmuller_set_unsafe(self): @@ -1671,7 +1672,8 @@ cdef class pAdicConvert_CA_frac_field(Morphism): a + O(3^20) """ cdef CRElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") cdef CAElement ans = self._zero._new_c() cdef bint reduce = (x.prime_pow.e > 1) ans.absprec = x.relprec + x.ordp @@ -1721,7 +1723,8 @@ cdef class pAdicConvert_CA_frac_field(Morphism): """ cdef long aprec, rprec cdef CRElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") cdef CAElement ans = self._zero._new_c() cdef bint reduce = False _process_args_and_kwds(&aprec, &rprec, args, kwds, True, ans.prime_pow) diff --git a/src/sage/rings/padics/CR_template.pxi b/src/sage/rings/padics/CR_template.pxi index e8080c29856..602a756a2a9 100644 --- a/src/sage/rings/padics/CR_template.pxi +++ b/src/sage/rings/padics/CR_template.pxi @@ -358,7 +358,9 @@ cdef class CRElement(pAdicTemplateElement): else: if self.ordp > right.ordp: # Addition is commutative, swap so self.ordp < right.ordp - ans = right; right = self; self = ans + ans = right + right = self + self = ans tmpL = right.ordp - self.ordp if tmpL > self.relprec: return self @@ -1249,7 +1251,8 @@ cdef class CRElement(pAdicTemplateElement): :meth:`sage.misc.cachefunc._cache_key` """ - tuple_recursive = lambda l: tuple(tuple_recursive(x) for x in l) if isinstance(l, list) else l + def tuple_recursive(l): + return tuple(tuple_recursive(x) for x in l) if isinstance(l, list) else l return (self.parent(), tuple_recursive(trim_zeros(list(self.expansion()))), self.valuation(), self.precision_relative()) def _teichmuller_set_unsafe(self): @@ -2392,7 +2395,8 @@ cdef class pAdicConvert_CR_frac_field(Morphism): a + O(3^20) """ cdef CRElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") cdef CRElement ans = self._zero._new_c() ans.relprec = x.relprec ans.ordp = x.ordp @@ -2436,7 +2440,8 @@ cdef class pAdicConvert_CR_frac_field(Morphism): """ cdef long aprec, rprec cdef CRElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") cdef CRElement ans = self._zero._new_c() cdef bint reduce = False _process_args_and_kwds(&aprec, &rprec, args, kwds, False, ans.prime_pow) diff --git a/src/sage/rings/padics/FM_template.pxi b/src/sage/rings/padics/FM_template.pxi index c940f131464..df7bd8bdf38 100644 --- a/src/sage/rings/padics/FM_template.pxi +++ b/src/sage/rings/padics/FM_template.pxi @@ -1426,7 +1426,8 @@ cdef class pAdicConvert_FM_frac_field(Morphism): a """ cdef FPElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") if x.ordp >= self._zero.prime_pow.ram_prec_cap: return self._zero cdef FMElement ans = self._zero._new_c() @@ -1470,7 +1471,8 @@ cdef class pAdicConvert_FM_frac_field(Morphism): """ cdef long aprec, rprec cdef FPElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") if x.ordp >= self._zero.prime_pow.ram_prec_cap: return self._zero cdef FMElement ans = self._zero._new_c() diff --git a/src/sage/rings/padics/FP_template.pxi b/src/sage/rings/padics/FP_template.pxi index 6c70c8a1c75..65485cdc0ad 100644 --- a/src/sage/rings/padics/FP_template.pxi +++ b/src/sage/rings/padics/FP_template.pxi @@ -359,7 +359,9 @@ cdef class FPElement(pAdicTemplateElement): else: if self.ordp > right.ordp: # Addition is commutative, swap so self.ordp < right.ordp - ans = right; right = self; self = ans + ans = right + right = self + self = ans tmpL = right.ordp - self.ordp if tmpL > self.prime_pow.ram_prec_cap: return self @@ -2015,7 +2017,8 @@ cdef class pAdicConvert_FP_frac_field(Morphism): a """ cdef FPElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") cdef FPElement ans = self._zero._new_c() ans.ordp = x.ordp cshift_notrunc(ans.unit, x.unit, 0, ans.prime_pow.ram_prec_cap, ans.prime_pow, False) @@ -2058,7 +2061,8 @@ cdef class pAdicConvert_FP_frac_field(Morphism): """ cdef long aprec, rprec cdef FPElement x = _x - if x.ordp < 0: raise ValueError("negative valuation") + if x.ordp < 0: + raise ValueError("negative valuation") cdef FPElement ans = self._zero._new_c() cdef bint reduce = False _process_args_and_kwds(&aprec, &rprec, args, kwds, False, ans.prime_pow) From 88e71c553a6e7579a4d66fd4cf5a2d4f44193db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 11 Jun 2022 11:42:05 +0200 Subject: [PATCH 298/338] some pep fixes for E7 in pxd files --- .../perm_gps/partn_ref/data_structures.pxd | 9 +- src/sage/libs/flint/padic.pxd | 120 +++++++++--------- src/sage/libs/flint/thread_pool.pxd | 2 +- src/sage/libs/gmp/randomize.pxd | 6 +- src/sage/libs/singular/decl.pxd | 30 ++--- 5 files changed, 86 insertions(+), 81 deletions(-) diff --git a/src/sage/groups/perm_gps/partn_ref/data_structures.pxd b/src/sage/groups/perm_gps/partn_ref/data_structures.pxd index b6af8190d51..b469d09c2b5 100644 --- a/src/sage/groups/perm_gps/partn_ref/data_structures.pxd +++ b/src/sage/groups/perm_gps/partn_ref/data_structures.pxd @@ -151,7 +151,8 @@ cdef inline int OP_merge_list_perm(OrbitPartition *OP, int *gamma): """ cdef int i, i_root, gamma_i_root, changed = 0 for i from 0 <= i < OP.degree: - if gamma[i] == i: continue + if gamma[i] == i: + continue i_root = OP_find(OP, i) gamma_i_root = OP_find(OP, gamma[i]) if i_root != gamma_i_root: @@ -508,8 +509,10 @@ cdef inline bint SC_contains(StabilizerChain *SC, int level, int *pi, bint modif for i from level <= i < SC.base_size: b = SC.base_orbits[i][0] x = perm[b] - if x == b: continue - if SC.parents[i][x] == -1: return 0 + if x == b: + continue + if SC.parents[i][x] == -1: + return 0 SC_compose_up_to_base(SC, i, x, perm) return SC_perm_is_identity(perm, n) diff --git a/src/sage/libs/flint/padic.pxd b/src/sage/libs/flint/padic.pxd index 831d8746920..e155ddabfd8 100644 --- a/src/sage/libs/flint/padic.pxd +++ b/src/sage/libs/flint/padic.pxd @@ -15,40 +15,40 @@ cdef extern from "flint_wrap.h": #* Context *******************************************************************/ void padic_ctx_init(padic_ctx_t ctx, const fmpz_t p, slong min, slong max, - padic_print_mode mode); - void padic_ctx_clear(padic_ctx_t ctx); + padic_print_mode mode) + void padic_ctx_clear(padic_ctx_t ctx) int _padic_ctx_pow_ui(fmpz_t rop, ulong e, const padic_ctx_t ctx) void padic_ctx_pow_ui(fmpz_t rop, ulong e, const padic_ctx_t ctx) #* Memory management *********************************************************/ - void padic_init(padic_t rop); - void padic_init2(padic_t rop, slong N); - void padic_clear(padic_t rop); + void padic_init(padic_t rop) + void padic_init2(padic_t rop, slong N) + void padic_clear(padic_t rop) void _padic_canonicalise(padic_t rop, const padic_ctx_t ctx) - void _padic_reduce(padic_t rop, const padic_ctx_t ctx); - void padic_reduce(padic_t rop, const padic_ctx_t ctx); + void _padic_reduce(padic_t rop, const padic_ctx_t ctx) + void padic_reduce(padic_t rop, const padic_ctx_t ctx) #* Randomisation *************************************************************/ - void padic_randtest(padic_t rop, flint_rand_t state, const padic_ctx_t ctx); + void padic_randtest(padic_t rop, flint_rand_t state, const padic_ctx_t ctx) void padic_randtest_not_zero(padic_t rop, flint_rand_t state, - const padic_ctx_t ctx); + const padic_ctx_t ctx) void padic_randtest_int(padic_t rop, flint_rand_t state, - const padic_ctx_t ctx); + const padic_ctx_t ctx) #* Assignments and conversions ***********************************************/ - void padic_set(padic_t rop, const padic_t op, const padic_ctx_t ctx); - void padic_set_si(padic_t rop, slong op, const padic_ctx_t ctx); - void padic_set_ui(padic_t rop, ulong op, const padic_ctx_t ctx); - void padic_set_fmpz(padic_t rop, const fmpz_t op, const padic_ctx_t ctx); - void padic_set_fmpq(padic_t rop, const fmpq_t op, const padic_ctx_t ctx); - void padic_set_mpz(padic_t rop, const mpz_t op, const padic_ctx_t ctx); - void padic_set_mpq(padic_t rop, const mpq_t op, const padic_ctx_t ctx); - void padic_get_fmpz(fmpz_t rop, const padic_t op, const padic_ctx_t ctx); - void padic_get_fmpq(fmpq_t rop, const padic_t op, const padic_ctx_t ctx); - void padic_get_mpz(mpz_t rop, const padic_t op, const padic_ctx_t ctx); - void padic_get_mpq(mpq_t rop, const padic_t op, const padic_ctx_t ctx); + void padic_set(padic_t rop, const padic_t op, const padic_ctx_t ctx) + void padic_set_si(padic_t rop, slong op, const padic_ctx_t ctx) + void padic_set_ui(padic_t rop, ulong op, const padic_ctx_t ctx) + void padic_set_fmpz(padic_t rop, const fmpz_t op, const padic_ctx_t ctx) + void padic_set_fmpq(padic_t rop, const fmpq_t op, const padic_ctx_t ctx) + void padic_set_mpz(padic_t rop, const mpz_t op, const padic_ctx_t ctx) + void padic_set_mpq(padic_t rop, const mpq_t op, const padic_ctx_t ctx) + void padic_get_fmpz(fmpz_t rop, const padic_t op, const padic_ctx_t ctx) + void padic_get_fmpq(fmpq_t rop, const padic_t op, const padic_ctx_t ctx) + void padic_get_mpz(mpz_t rop, const padic_t op, const padic_ctx_t ctx) + void padic_get_mpq(mpq_t rop, const padic_t op, const padic_ctx_t ctx) void padic_swap(padic_t op1, padic_t op2) void padic_zero(padic_t rop) void padic_one(padic_t rop) @@ -59,58 +59,58 @@ cdef extern from "flint_wrap.h": int padic_equal(const padic_t op1, const padic_t op2) #* Arithmetic operations *****************************************************/ - slong * _padic_lifts_exps(slong *n, slong N); - void _padic_lifts_pows(fmpz *pow, const slong *a, slong n, const fmpz_t p); + slong * _padic_lifts_exps(slong *n, slong N) + void _padic_lifts_pows(fmpz *pow, const slong *a, slong n, const fmpz_t p) void padic_add(padic_t rop, const padic_t op1, const padic_t op2, - const padic_ctx_t ctx); + const padic_ctx_t ctx) void padic_sub(padic_t rop, const padic_t op1, const padic_t op2, - const padic_ctx_t ctx); - void padic_neg(padic_t rop, const padic_t op, const padic_ctx_t ctx); + const padic_ctx_t ctx) + void padic_neg(padic_t rop, const padic_t op, const padic_ctx_t ctx) void padic_mul(padic_t rop, const padic_t op1, const padic_t op2, - const padic_ctx_t ctx); - void padic_shift(padic_t rop, const padic_t op, slong v, const padic_ctx_t ctx); + const padic_ctx_t ctx) + void padic_shift(padic_t rop, const padic_t op, slong v, const padic_ctx_t ctx) void padic_div(padic_t rop, const padic_t op1, const padic_t op2, - const padic_ctx_t ctx); - void _padic_inv_precompute(padic_inv_t S, const fmpz_t p, slong N); - void _padic_inv_clear(padic_inv_t S); - void _padic_inv_precomp(fmpz_t rop, const fmpz_t op, const padic_inv_t S); - void _padic_inv(fmpz_t rop, const fmpz_t op, const fmpz_t p, slong N); - void padic_inv(padic_t rop, const padic_t op, const padic_ctx_t ctx); - int padic_sqrt(padic_t rop, const padic_t op, const padic_ctx_t ctx); + const padic_ctx_t ctx) + void _padic_inv_precompute(padic_inv_t S, const fmpz_t p, slong N) + void _padic_inv_clear(padic_inv_t S) + void _padic_inv_precomp(fmpz_t rop, const fmpz_t op, const padic_inv_t S) + void _padic_inv(fmpz_t rop, const fmpz_t op, const fmpz_t p, slong N) + void padic_inv(padic_t rop, const padic_t op, const padic_ctx_t ctx) + int padic_sqrt(padic_t rop, const padic_t op, const padic_ctx_t ctx) void padic_pow_si(padic_t rop, const padic_t op, slong e, - const padic_ctx_t ctx); + const padic_ctx_t ctx) #* Exponential ***************************************************************/ - slong _padic_exp_bound(slong v, slong N, const fmpz_t p); - void _padic_exp(fmpz_t rop, const fmpz_t u, slong v, const fmpz_t p, slong N); - void _padic_exp_rectangular(fmpz_t rop, const fmpz_t u, slong v, const fmpz_t p, slong N); - void _padic_exp_balanced(fmpz_t rop, const fmpz_t u, slong v, const fmpz_t p, slong N); - int padic_exp(padic_t rop, const padic_t op, const padic_ctx_t ctx); - int padic_exp_rectangular(padic_t rop, const padic_t op, const padic_ctx_t ctx); - int padic_exp_balanced(padic_t rop, const padic_t op, const padic_ctx_t ctx); + slong _padic_exp_bound(slong v, slong N, const fmpz_t p) + void _padic_exp(fmpz_t rop, const fmpz_t u, slong v, const fmpz_t p, slong N) + void _padic_exp_rectangular(fmpz_t rop, const fmpz_t u, slong v, const fmpz_t p, slong N) + void _padic_exp_balanced(fmpz_t rop, const fmpz_t u, slong v, const fmpz_t p, slong N) + int padic_exp(padic_t rop, const padic_t op, const padic_ctx_t ctx) + int padic_exp_rectangular(padic_t rop, const padic_t op, const padic_ctx_t ctx) + int padic_exp_balanced(padic_t rop, const padic_t op, const padic_ctx_t ctx) #* Logarithm *****************************************************************/ - slong _padic_log_bound(slong v, slong N, const fmpz_t p); - void _padic_log(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); - void _padic_log_rectangular(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); - void _padic_log_satoh(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); - void _padic_log_balanced(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N); - int padic_log(padic_t rop, const padic_t op, const padic_ctx_t ctx); - int padic_log_rectangular(padic_t rop, const padic_t op, const padic_ctx_t ctx); - int padic_log_satoh(padic_t rop, const padic_t op, const padic_ctx_t ctx); - int padic_log_balanced(padic_t rop, const padic_t op, const padic_ctx_t ctx); + slong _padic_log_bound(slong v, slong N, const fmpz_t p) + void _padic_log(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N) + void _padic_log_rectangular(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N) + void _padic_log_satoh(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N) + void _padic_log_balanced(fmpz_t z, const fmpz_t y, slong v, const fmpz_t p, slong N) + int padic_log(padic_t rop, const padic_t op, const padic_ctx_t ctx) + int padic_log_rectangular(padic_t rop, const padic_t op, const padic_ctx_t ctx) + int padic_log_satoh(padic_t rop, const padic_t op, const padic_ctx_t ctx) + int padic_log_balanced(padic_t rop, const padic_t op, const padic_ctx_t ctx) #* Special functions *********************************************************/ - void _padic_teichmuller(fmpz_t rop, const fmpz_t op, const fmpz_t p, slong N); - void padic_teichmuller(padic_t rop, const padic_t op, const padic_ctx_t ctx); - ulong padic_val_fac_ui_2(ulong N); - ulong padic_val_fac_ui(ulong N, const fmpz_t p); - void padic_val_fac(fmpz_t rop, const fmpz_t op, const fmpz_t p); + void _padic_teichmuller(fmpz_t rop, const fmpz_t op, const fmpz_t p, slong N) + void padic_teichmuller(padic_t rop, const padic_t op, const padic_ctx_t ctx) + ulong padic_val_fac_ui_2(ulong N) + ulong padic_val_fac_ui(ulong N, const fmpz_t p) + void padic_val_fac(fmpz_t rop, const fmpz_t op, const fmpz_t p) #* Input and output **********************************************************/ - char * padic_get_str(char * str, const padic_t op, const padic_ctx_t ctx); - int _padic_fprint(FILE * file, const fmpz_t u, slong v, const padic_ctx_t ctx); - int padic_fprint(FILE * file, const padic_t op, const padic_ctx_t ctx); + char * padic_get_str(char * str, const padic_t op, const padic_ctx_t ctx) + int _padic_fprint(FILE * file, const fmpz_t u, slong v, const padic_ctx_t ctx) + int padic_fprint(FILE * file, const padic_t op, const padic_ctx_t ctx) int _padic_print(const fmpz_t u, slong v, const padic_ctx_t ctx) int padic_print(const padic_t op, const padic_ctx_t ctx) diff --git a/src/sage/libs/flint/thread_pool.pxd b/src/sage/libs/flint/thread_pool.pxd index b773695d2de..a2cd915de79 100644 --- a/src/sage/libs/flint/thread_pool.pxd +++ b/src/sage/libs/flint/thread_pool.pxd @@ -18,7 +18,7 @@ cdef extern from "flint/thread_pool.h": ctypedef struct thread_pool_entry_struct: pass - ctypedef thread_pool_entry_struct thread_pool_entry_t[1]; + ctypedef thread_pool_entry_struct thread_pool_entry_t[1] ctypedef struct thread_pool_struct: pass diff --git a/src/sage/libs/gmp/randomize.pxd b/src/sage/libs/gmp/randomize.pxd index b2ddb55f555..51087eaa02e 100644 --- a/src/sage/libs/gmp/randomize.pxd +++ b/src/sage/libs/gmp/randomize.pxd @@ -43,10 +43,12 @@ cdef inline void mpq_randomize_entry_recip_uniform(mpq_t x): # probability distribution is $X = \mbox{trunc}(1/R)$, where R # varies uniformly between 0 and 1.) cdef int den = rstate.c_random() - SAGE_RAND_MAX/2 - if den == 0: den = 1 + if den == 0: + den = 1 mpz_set_si(mpq_numref(x), (SAGE_RAND_MAX/5*2) / den) den = rstate.c_random() - if den == 0: den = 1 + if den == 0: + den = 1 mpz_set_si(mpq_denref(x), SAGE_RAND_MAX / den) mpq_canonicalize(x) diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd index d5cf0444119..d6b2f28bf2a 100644 --- a/src/sage/libs/singular/decl.pxd +++ b/src/sage/libs/singular/decl.pxd @@ -159,8 +159,8 @@ cdef extern from "singular/Singular/libsingular.h": ring *extRing int ch - mpz_ptr modBase; - unsigned long modExponent; + mpz_ptr modBase + unsigned long modExponent #n_coeffType type int type @@ -475,9 +475,9 @@ cdef extern from "singular/Singular/libsingular.h": # see coeffs.h ctypedef struct GFInfo: - int GFChar; - int GFDegree; - const char* GFPar_name; + int GFChar + int GFDegree + const char* GFPar_name # parameter is pointer to gGFInfo # @@ -1008,8 +1008,8 @@ cdef extern from "singular/coeffs/rmodulon.h": # see rmodulon.h ctypedef struct ZnmInfo: - mpz_ptr base; - unsigned long exp; + mpz_ptr base + unsigned long exp cdef extern from "singular/coeffs/rintegers.h": @@ -1035,7 +1035,7 @@ cdef extern from "singular/polys/sbuckets.h": sBucket *sBucketCreate(ring *r) #destroy an sBucket (note: pointer to pointer) - void sBucketDestroy(sBucket **bucket); + void sBucketDestroy(sBucket **bucket) #merge contents of sBucket into polynomial and clear bucket #(use when monomials are distinct). @@ -1051,29 +1051,29 @@ cdef extern from "singular/polys/sbuckets.h": void sBucketDestroyAdd(sBucket *bucket, poly *p, int *length) #delete bucket constant and clear pointer - void sBucketDeleteAndDestroy(sBucket **bucket_pt); + void sBucketDeleteAndDestroy(sBucket **bucket_pt) #merge p into bucket (distinct monomials assumed) #destroys poly in the process - void sBucket_Merge_p(sBucket *bucket, poly *p, int lp); + void sBucket_Merge_p(sBucket *bucket, poly *p, int lp) #merge p into bucket (distinct monomials assumed) #destroys poly in the process - void sBucket_Merge_m(sBucket *bucket, poly *p); + void sBucket_Merge_m(sBucket *bucket, poly *p) #adds p into bucket (distinct monomials assumed) #destroys poly in the process - void sBucket_Add_p(sBucket *bucket, poly *p, int lp); + void sBucket_Add_p(sBucket *bucket, poly *p, int lp) #adds p into bucket (distinct monomials assumed) #destroys poly in the process - void sBucket_Add_m(sBucket *bucket, poly *p); + void sBucket_Add_m(sBucket *bucket, poly *p) #sorts p with bucketSort: assumes all monomials of p are different - poly *sBucketSortMerge(poly *p, const ring *r); + poly *sBucketSortMerge(poly *p, const ring *r) #sorts p with bucketSort: p may have equal monomials - poly *sBucketSortAdd(poly *p, const ring *r); + poly *sBucketSortAdd(poly *p, const ring *r) cdef extern from "singular/polys/nc/nc.h": # Non-commutative functions From e49f0d2a90d870423c2ba78dc6b17fe6955389ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 11 Jun 2022 17:15:16 +0200 Subject: [PATCH 299/338] fix pycodestyle E306 in geometry and schemes --- .../geometry/hyperbolic_space/hyperbolic_geodesic.py | 4 +++- .../geometry/hyperplane_arrangement/arrangement.py | 3 ++- src/sage/geometry/polyhedron/base.py | 4 +++- src/sage/geometry/polyhedron/base_ZZ.py | 3 ++- .../polyhedron/double_description_inhomogeneous.py | 3 ++- src/sage/geometry/polyhedron/library.py | 3 ++- src/sage/schemes/elliptic_curves/ell_rational_field.py | 6 ++++-- .../schemes/elliptic_curves/gal_reps_number_field.py | 3 +++ src/sage/schemes/elliptic_curves/heegner.py | 10 ++++++---- src/sage/schemes/elliptic_curves/height.py | 4 +++- 10 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py b/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py index 76de0b72983..6168e033670 100644 --- a/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py +++ b/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py @@ -2325,12 +2325,14 @@ def plot(self, boundary=True, **options): opts = {'axes': False, 'aspect_ratio': 1} opts.update(self.graphics_options()) opts.update(options) + def map_pt(pt): if pt in CC: return CC(pt) return CC(*pt) end_1, end_2 = [map_pt(k.coordinates()) for k in self.endpoints()] - pic = bezier_path([[(real(end_1), imag(end_1)), (real(end_2), imag(end_2))]], **opts) + pic = bezier_path([[(real(end_1), imag(end_1)), + (real(end_2), imag(end_2))]], **opts) if boundary: pic += self._model.get_background_graphic() return pic diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index fa979354148..e83b6aeacd7 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -846,8 +846,9 @@ def update(mapping, val, I): mapping[val] = len(mapping) elif element_label == "subset": from sage.sets.set import Set + def update(mapping, val, I): - mapping[val] = Set(val) + mapping[val] = Set(val) elif element_label == "subspace": def update(mapping, val, I): mapping[val] = I diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py index 338c9ca0700..576e073a825 100644 --- a/src/sage/geometry/polyhedron/base.py +++ b/src/sage/geometry/polyhedron/base.py @@ -1024,8 +1024,10 @@ def permutations_to_matrices(self, conj_class_reps, acting_group=None, additiona G = acting_group group_dict = {} + def permutation_to_matrix(permutation, V, Vplus, W): - A = sum(V[permutation(i)].column() * Vplus[i].row() for i in range(len(V))) + A = sum(V[permutation(i)].column() * Vplus[i].row() + for i in range(len(V))) return A + W for perm in G.gens(): diff --git a/src/sage/geometry/polyhedron/base_ZZ.py b/src/sage/geometry/polyhedron/base_ZZ.py index 8cda8150e79..cfb62d03834 100644 --- a/src/sage/geometry/polyhedron/base_ZZ.py +++ b/src/sage/geometry/polyhedron/base_ZZ.py @@ -812,6 +812,7 @@ def minkowski_decompositions(self): if self.dim() > 2 or not self.is_compact(): raise NotImplementedError('only implemented for bounded polygons') summands = [] + def is_known_summand(poly): for summand in summands: try: @@ -825,7 +826,7 @@ def is_known_summand(poly): continue Y = self - X Y = Y.change_ring(ZZ) # Minkowski difference returns QQ-polyhedron - if X+Y != self: + if X + Y != self: continue decompositions.append((X, Y)) summands += [X, Y] diff --git a/src/sage/geometry/polyhedron/double_description_inhomogeneous.py b/src/sage/geometry/polyhedron/double_description_inhomogeneous.py index 369697dc63c..068c3317434 100644 --- a/src/sage/geometry/polyhedron/double_description_inhomogeneous.py +++ b/src/sage/geometry/polyhedron/double_description_inhomogeneous.py @@ -508,10 +508,11 @@ def _extract_Hrep(self, DD): sage: V2H._extract_Hrep(DD) """ zero = self.base_ring.zero() + def is_trivial(ray): # trivial Hrep output 1 >= 0 return ray[0] > zero and all(r == zero for r in ray[1:]) - ieqs = [self._unpivot_ray(_) for _ in DD.R] + ieqs = (self._unpivot_ray(ra) for ra in DD.R) self.inequalities = [r for r in ieqs if not is_trivial(r)] self.equations = self._linear_subspace.matrix().rows() diff --git a/src/sage/geometry/polyhedron/library.py b/src/sage/geometry/polyhedron/library.py index 95ecc6aac9c..b71e1e29d2b 100644 --- a/src/sage/geometry/polyhedron/library.py +++ b/src/sage/geometry/polyhedron/library.py @@ -2558,8 +2558,9 @@ def permutahedron(self, n, project=False, backend=None): return Polyhedron(vertices=verts, backend=backend) else: parent = Polyhedra(ZZ, n, backend=backend) + def tri(m): - return (m*(m+1))//2 + return (m * (m + 1)) // 2 # Each proper `S \subset [n]` corresponds exactly to # a facet that minimizes the coordinates in `S`. diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 3636a97176f..5586b8bc07b 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -1349,11 +1349,11 @@ def modular_symbol_numerical(self, sign=1, prec=20): """ from sage.schemes.elliptic_curves.mod_sym_num import ModularSymbolNumerical M = ModularSymbolNumerical(self, sign=sign) + def f(r): return M.approximative_value(r, prec=prec) return f - def pollack_stevens_modular_symbol(self, sign=0, implementation='eclib'): """ Create the modular symbol attached to the elliptic curve, @@ -2743,10 +2743,12 @@ def silverman_height_bound(self, algorithm='default'): b2 = self.b2() twostar = 2 if b2 else 1 from math import log + def h(x): return log(max(abs(x.numerator()), abs(x.denominator()))) + def h_oo(x): - return log(max(abs(x),1)) + return log(max(abs(x), 1)) mu = h(Delta)/12 + h_oo(j)/12 + h_oo(b2/12)/2 + log(twostar)/2 lower = 2*(-h(j)/24 - mu - 0.961) upper = 2*(mu + 1.07) diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py index 0692e1e9217..cc950676c6d 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -540,6 +540,7 @@ def Frobenius_filter(E, L, patience=100): K_is_Q = (K==QQ) from sage.arith.misc import primes from sage.rings.infinity import infinity + def primes_iter(): for p in primes(start=2, stop=infinity): if K_is_Q: @@ -1306,6 +1307,7 @@ def Billerey_B_bound(E, max_l=200, num_l=8, small_prime_bound=0, debug=False): DK = K.discriminant() ED = E.discriminant().norm() B0 = ZZ(6*DK*ED) + def remove_primes(B): B1 = B.prime_to_m_part(B0) for p in primes(small_prime_bound): @@ -1413,6 +1415,7 @@ def Billerey_R_bound(E, max_l=200, num_l=8, small_prime_bound=None, debug=False) DK = K.discriminant() ED = E.discriminant().norm() B0 = ZZ(6*DK*ED) + def remove_primes(B): B1 = B.prime_to_m_part(B0) for p in primes(small_prime_bound): diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index 8548c4cbdb7..7c9e4cb0193 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -5054,11 +5054,12 @@ def modp_splitting_map(self, p): [10 5] """ I, J = self.modp_splitting_data(p) - K = I*J + K = I * J F = I.base_ring() + def phi(q): v = [F(a) for a in q.coefficient_tuple()] - return v[0] + I*v[1] + J*v[2] + K*v[3] + return v[0] + I * v[1] + J * v[2] + K * v[3] return phi def cyclic_subideal_p1(self, I, c): @@ -5739,12 +5740,13 @@ def best_heegner_D(ell_1, ell_2): raise ValueError("if first_only is not True, then the curve E must have rank 1 or 2") P, Q = E.gens() + def kernel_of_reduction(ell): # return list of reps for the kernel as a subgroup of the map # E(Q) / q E(Q) ----> E(F_ell) / q E(F_ell) m = ZZ(E.Np(ell) / q) - A = [a*P + b*Q for a in range(q) for b in range(q)] - return [z for z in A if red(z,ell) * m == 0] + A = (a * P + b * Q for a in range(q) for b in range(q)) + return [z for z in A if red(z, ell) * m == 0] # compute first good odd prime ell_1 = ZZ(3) diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 0770e3284bc..1edda0bc949 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -943,8 +943,9 @@ def pair_max(f, g): g = g.change_ring(CDF) dfn = [fast_callable(f.derivative(n)/factorial(n), CDF) for n in range(f.degree()+1)] dgn = [fast_callable(g.derivative(n)/factorial(n), CDF) for n in range(g.degree()+1)] + def max_f_g(s): - (a,b),(c,d) = s.real().endpoints(), s.imag().endpoints() + (a,b), (c,d) = s.real().endpoints(), s.imag().endpoints() dx = a - b dy = c - d eta = RDF(dx*dx + dy*dy).sqrt() @@ -1728,6 +1729,7 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): T = PeriodicRegion(CDF(1), CDF(tau), vals < B, full=not use_half).expand().refine() B = RIF(B) leaning_right = tau.real() / tau.imag() >= 0 + def check_line(z): wpz = wp(z) if wpz > B: From 56ee208e59725b45e06d4d0f0bd0e90811e03664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 11 Jun 2022 19:03:59 +0200 Subject: [PATCH 300/338] latex for elements of quotient rings --- src/sage/rings/quotient_ring_element.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/sage/rings/quotient_ring_element.py b/src/sage/rings/quotient_ring_element.py index 7a3790f744b..69df8d3319e 100644 --- a/src/sage/rings/quotient_ring_element.py +++ b/src/sage/rings/quotient_ring_element.py @@ -224,6 +224,31 @@ def _repr_(self): with localvars(R, P.variable_names(), normalize=False): return str(self.__rep) + def _latex_(self): + """ + Return the LaTeX representation as a string. + + EXAMPLES:: + + sage: R = PolynomialRing(QQ, 'a, b, c') + sage: a = R.gen(0) + sage: I = R.ideal(a**2 + a + 1) + sage: S = R.quotient(I, names=R.variable_names()) + sage: a = S.gen(0) + sage: latex(a) + a + """ + from sage.structure.parent_gens import localvars + P = self.parent() + R = P.cover_ring() + # see _repr_ above for the idea + try: + P.variable_names() + except ValueError: + return self.__rep._latex_() + with localvars(R, P.variable_names(), normalize=False): + return self.__rep._latex_() + def __pari__(self): """ The Pari representation of this quotient element. From c9167d13c98daabe345a90e84b2bb40ab34904dc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:24:52 -0700 Subject: [PATCH 301/338] src/sage/interfaces/tachyon.py: Convert help from latex to rst using pandoc --- src/sage/interfaces/tachyon.py | 1261 +++++++++++++++++--------------- 1 file changed, 669 insertions(+), 592 deletions(-) diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index 3f1dcdb5385..c796bc4241c 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -24,7 +24,7 @@ class TachyonRT(SageObject): - """ + r""" The Tachyon Ray Tracer tachyon_rt(model, outfile='sage.png', verbose=1, block=True, extra_opts='') @@ -71,6 +71,673 @@ class TachyonRT(SageObject): - The file outfile is created. + This help, which was written by John Stone, describes how to create + scene files. + + At the present time, scene description files are very simple. The parser + can’t handle multiple file scene descriptions, although they may be + added in the future. Most of the objects and their scene description are + closely related to the RAY API *(See the API docs for additional info.)* + + Basic Scene Requirements + ------------------------ + + Unlike some other ray tracers out there, RAY requires that you specify + most of the scene parameters in the scene description file itself. If + users would rather specify some of these parameters at the command line, + then I may add that feature in the future. A scene description file + contains keywords, and values associated or grouped with a keyword. All + keywords can be in caps, lower case, or mixed case for the convenience + of the user. File names and texture names are normally case-sensitive, + although the behavior for file names is operating system-dependent. All + values are either character strings, or floating point numbers. In some + cases, the presence of one keyword will require additional keyword / + value pairs. + + At the moment there are several keywords with values, that must appear + in every scene description file. Every scene description file must begin + with the **BEGIN_SCENE** keyword, and end with the **END_SCENE** + keyword. All definitions and declarations of any kind must be inside the + **BEGIN_SCENE**, **END_SCENE** pair. The **RESOLUTION** keyword is + followed by an x resolution and a y resolution in terms of pixels on + each axis. There are currently no limits placed on the resolution of an + output image other than the computer’s available memory and reasonable + execution time. An example of a simple scene description skeleton is + show below: + + :: + + BEGIN_SCENE + RESOLUTION 1024 1024 + ... + ... Camera definition.. + ... + ... Other objects, etc.. + ... + + END_SCENE + + Camera and viewing parameters + ----------------------------- + + One of the most important parts of any scene, is the camera position and + orientation. Having a good angle on a scene can make the difference + between an average looking scene and a strikingly interesting one. There + may be multiple camera definitions in a scene file, but the last camera + definition overrides all previous definitions. There are several + parameters that control the camera in , **PROJECTION**, **ZOOM**, + **ASPECTRATIO**, **ANTIALIASING**, **CENTER**, **RAYDEPTH**, + **VIEWDIR**, and **UPDIR**. + + The first and last keywords required in the definition of a camera are + the **CAMERA** and **END_CAMERA** keywords. The **PROJECTION** keyword + is optional, the remaining camera keywords are required, and must be + written in the sequence they are listed in the examples in this section. + + Camera projection modes + ~~~~~~~~~~~~~~~~~~~~~~~ + + The **PROJECTION** keyword must be followed by one of the supported + camera projection mode identifiers **PERSPECTIVE**, **PERSPECTIVE_DOF**, + **ORTHOGRAPHIC**, or **FISHEYE**. The **FISHEYE** projection mode + requires two extra parameters **FOCALLENGTH** and **APERTURE** which + precede the regular camera options. + + :: + + Camera + projection perspective_dof + focallength 0.75 + aperture 0.02 + Zoom 0.666667 + Aspectratio 1.000000 + Antialiasing 128 + Raydepth 30 + Center 0.000000 0.000000 -2.000000 + Viewdir -0.000000 -0.000000 2.000000 + Updir 0.000000 1.000000 -0.000000 + End_Camera + + Common camera parameters + ~~~~~~~~~~~~~~~~~~~~~~~~ + + The **ZOOM** parameter controls the camera in a way similar to a + telephoto lens on a 35mm camera. A zoom value of 1.0 is standard, with a + 90 degree field of view. By changing the zoom factor to 2.0, the + relative size of any feature in the frame is twice as big, while the + field of view is decreased slightly. The zoom effect is implemented as a + scaling factor on the height and width of the image plane relative to + the world. + + The **ASPECTRATIO** parameter controls the aspect ratio of the resulting + image. By using the aspect ratio parameter, one can produce images which + look correct on any screen. Aspect ratio alters the relative width of + the image plane, while keeping the height of the image plane constant. + In general, most workstation displays have an aspect ratio of 1.0. To + see what aspect ratio your display has, you can render a simple sphere, + at a resolution of 512x512 and measure the ratio of its width to its + height. + + The **ANTIALIASING** parameter controls the maximum level of + supersampling used to obtain higher image quality. The parameter given + sets the number of additional rays to trace per-pixel to attain higher + image quality. + + The **RAYDEPTH** parameter tells RAY what the maximum level of + reflections, refraction, or in general the maximum recursion depth to + trace rays to. A value between 4 and 12 is usually good. A value of 1 + will disable rendering of reflective or transmissive objects (they’ll be + black). + + The remaining three camera parameters are the most important, because + they define the coordinate system of the camera, and its position in the + scene. The **CENTER** parameter is an X, Y, Z coordinate defining the + center of the camera *(also known as the Center of Projection)*. Once + you have determined where the camera will be placed in the scene, you + need to tell RAY what the camera should be looking at. The **VIEWDIR** + parameter is a vector indicating the direction the camera is facing. It + may be useful for me to add a "Look At" type keyword in the future to + make camera aiming easier. If people want or need the "Look At" style + camera, let me know. The last parameter needed to completely define a + camera is the "up" direction. The **UPDIR** parameter is a vector which + points in the direction of the "sky". I wrote the camera so that + **VIEWDIR** and **UPDIR** don’t have to be perpendicular, and there + shouldn’t be a need for a "right" vector although some other ray tracers + require it. Here’s a snippet of a camera definition: + + :: + + CAMERA + ZOOM 1.0 + ASPECTRATIO 1.0 + ANTIALIASING 0 + RAYDEPTH 12 + CENTER 0.0 0.0 2.0 + VIEWDIR 0 0 -1 + UPDIR 0 1 0 + END_CAMERA + + Viewing frustum + ~~~~~~~~~~~~~~~ + + An optional **FRUSTUM** parameter provides a means for rendering + sub-images in a larger frame, and correct stereoscopic images. The + **FRUSTUM** keyword must be followed by four floating parameters, which + indicate the top, bottom, left and right coordinates of the image plane + in eye coordinates. When the projection mode is set to **FISHEYE**, the + frustum parameters correspond to spherical coordinates specified in + radians. + + :: + + CAMERA + ZOOM 1.0 + ASPECTRATIO 1.0 + ANTIALIASING 0 + RAYDEPTH 4 + CENTER 0.0 0.0 -6.0 + VIEWDIR 0.0 0.0 1.0 + UPDIR 0.0 1.0 0.0 + FRUSTUM -0.5 0.5 -0.5 0.5 + END_CAMERA + + Including Files + --------------- + + The **INCLUDE** keyword is used anywhere after the camera description, + and is immediately followed by a valid filename, for a file containing + additional scene description information. The included file is opened, + and processing continues as if it were part of the current file, until + the end of the included file is reached. Parsing of the current file + continues from where it left off prior to the included file. + + Scene File Comments + ------------------- + + The **:math:`\#`** keyword is used anywhere after the camera + description, and will cause RAY to ignore all characters from the + **:math:`\#`** to the end of the input line. The **:math:`\#`** + character must be surrounded by whitespace in order to be recognized. A + sequence such as **:math:`\#\#\#`** will not be recognized as a comment. + + Lights + ------ + + The most frequently used type of lights provided by RAY are positional + point light sources. The lights are actually small spheres, which are + visible. A point light is composed of three pieces of information, a + center, a radius (since its a sphere), and a color. To define a light, + simply write the **LIGHT** keyword, followed by its **CENTER** (a X, Y, + Z coordinate), its **RAD** (radius, a scalar), and its **COLOR** (a Red + Green Blue triple). The radius parameter will accept any value of 0.0 or + greater. Lights of radius 0.0 will not be directly visible in the + rendered scene, but contribute light to the scene normally. For a light, + the color values range from 0.0 to 1.0, any values outside this range + may yield unpredictable results. A simple light definition looks like + this: + + :: + + LIGHT CENTER 4.0 3.0 2.0 + RAD 0.2 + COLOR 0.5 0.5 0.5 + + This light would be gray colored if seen directly, and would be 50% + intensity in each RGB color component. + + RAY supports simple directional lighting, commonly used in CAD and + scientific visualization programs for its performance advantages over + positional lights. Directional lights cannot be seen directly in scenes + rendered by , only their illumination contributes to the final image. + + :: + + DIRECTIONAL_LIGHT + DIRECTION 0.0 -1.0 0.0 + COLOR 1.0 0.0 0.0 + + RAY supports spotlights, which are described very similarly to a point + light, but they are attenuated by angle from the direction vector, based + on a “falloff start” angle and “falloff end”angle. Between the starting + and ending angles, the illumination is attenuated linearly. The syntax + for a spotlight description in a scene file is as follows. + + :: + + SPOTLIGHT + CENTER 0.0 3.0 17.0 + RAD 0.2 + DIRECTION 0.0 -1.0 0.0 + FALLOFF_START 20.0 + FALLOFF_END 45.0 + COLOR 1.0 0.0 0.0 + + The lighting system implemented by RAY provides various levels of + distance-based lighting attenuation. By default, a light is not + attenuated by distance. If the *attenuation* keywords is present + immediately prior to the light’s color, RAY will accept coefficients + which are used to calculate distance-based attenuation, which is applied + the light by multiplying with the resulting value. The attenuation + factor is calculated from the equation + + .. math:: 1/(K_c + K_l d + k_q d^2) + + This attenuation equation should be familiar to some as it is the same + lighting attenuation equation used by OpenGL. The constant, linear, and + quadratic terms are specified in a scene file as shown in the following + example. + + :: + + LIGHT + CENTER -5.0 0.0 10.0 + RAD 1.0 + ATTENUATION CONSTANT 1.0 LINEAR 0.2 QUADRATIC 0.05 + COLOR 1.0 0.0 0.0 + + Atmospheric effects + ------------------- + + RAY currently only implements one atmospheric effect, simple + distance-based fog. + + Fog + ~~~ + + RAY provides a simple distance-based fog effect intended to provide + functionality similar to that found in OpenGL, for compatibility with + software that requires an OpenGL-like fog implementation. Much like + OpenGL, RAY provides linear, exponential, and exponential-squared fog. + + :: + + FOG + LINEAR START 0.0 END 50.0 DENSITY 1.0 COLOR 1.0 1.0 1.0 + + :: + + FOG + EXP START 0.0 END 50.0 DENSITY 1.0 COLOR 1.0 1.0 1.0 + + :: + + FOG + EXP2 START 0.0 END 50.0 DENSITY 1.0 COLOR 1.0 1.0 1.0 + + Objects + ------- + + Spheres + ~~~~~~~ + + Spheres are the simplest object supported by RAY and they are also the + fastest object to render. Spheres are defined as one would expect, with + a **CENTER**, **RAD** (radius), and a texture. The texture may be + defined along with the object as discussed earlier, or it may be + declared and assigned a name. Here’s a sphere definition using a + previously defined "NitrogenAtom" texture: + + :: + + SPHERE CENTER 26.4 27.4 -2.4 RAD 1.0 NitrogenAtom + + A sphere with an inline texture definition is declared like this: + + :: + + Sphere center 1.0 0.0 10.0 + Rad 1.0 + Texture Ambient 0.2 Diffuse 0.8 Specular 0.0 Opacity 1.0 + Color 1.0 0.0 0.5 + TexFunc 0 + + Notice that in this example I used mixed case for the keywords, this is + allowable... Review the section on textures if the texture definitions + are confusing. + + Triangles + ~~~~~~~~~ + + Triangles are also fairly simple objects, constructed by listing the + three vertices of the triangle, and its texture. The order of the + vertices isn’t important, the triangle object is "double sided", so the + surface normal is always pointing back in the direction of the incident + ray. The triangle vertices are listed as **V1**, **V2**, and **V3** each + one is an X, Y, Z coordinate. An example of a triangle is shown below: + + :: + + TRI + V0 0.0 -4.0 12.0 + V1 4.0 -4.0 8.0 + V2 -4.0 -4.0 8.0 + TEXTURE + AMBIENT 0.1 DIFFUSE 0.2 SPECULAR 0.7 OPACITY 1.0 + COLOR 1.0 1.0 1.0 + TEXFUNC 0 + + Smoothed Triangles + ~~~~~~~~~~~~~~~~~~ + + Smoothed triangles are just like regular triangles, except that the + surface normal for each of the three vertices is used to determine the + surface normal across the triangle by linear interpolation. Smoothed + triangles yield curved looking objects and have nice reflections. + + :: + + STRI + V0 1.4 0.0 2.4 + V1 1.35 -0.37 2.4 + V2 1.36 -0.32 2.45 + N0 -0.9 -0.0 -0.4 + N1 -0.8 0.23 -0.4 + N2 -0.9 0.27 -0.15 + TEXTURE + AMBIENT 0.1 DIFFUSE 0.2 SPECULAR 0.7 OPACITY 1.0 + COLOR 1.0 1.0 1.0 + TEXFUNC 0 + + Infinite Planes + ~~~~~~~~~~~~~~~ + + Useful for things like desert floors, backgrounds, skies etc, the + infinite plane is pretty easy to use. An infinite plane only consists of + two pieces of information, the **CENTER** of the plane, and a **NORMAL** + to the plane. The center of the plane is just any point on the plane + such that the point combined with the surface normal define the equation + for the plane. As with triangles, planes are double sided. Here is an + example of an infinite plane: + + :: + + PLANE + CENTER 0.0 -5.0 0.0 + NORMAL 0.0 1.0 0.0 + TEXTURE + AMBIENT 0.1 DIFFUSE 0.9 SPECULAR 0.0 OPACITY 1.0 + COLOR 1.0 1.0 1.0 + TEXFUNC 1 + CENTER 0.0 -5.0 0.0 + ROTATE 0. 0.0 0.0 + SCALE 1.0 1.0 1.0 + + Rings + ~~~~~ + + Rings are a simple object, they are really a not-so-infinite plane. + Rings are simply an infinite plane cut into a washer shaped ring, + infinitely thing just like a plane. A ring only requires two more pieces + of information than an infinite plane does, an inner and outer radius. + Here’s an example of a ring: + + :: + + Ring + Center 1.0 1.0 1.0 + Normal 0.0 1.0 0.0 + Inner 1.0 + Outer 5.0 + MyNewRedTexture + + Infinite Cylinders + ~~~~~~~~~~~~~~~~~~ + + Infinite cylinders are quite simple. They are defined by a center, an + axis, and a radius. An example of an infinite cylinder is: + + :: + + Cylinder + Center 0.0 0.0 0.0 + Axis 0.0 1.0 0.0 + Rad 1.0 + SomeRandomTexture + + Finite Cylinders + ~~~~~~~~~~~~~~~~ + + Finite cylinders are almost the same as infinite ones, but the center + and length of the axis determine the extents of the cylinder. The finite + cylinder is also really a shell, it doesn’t have any caps. If you need + to close off the ends of the cylinder, use two ring objects, with the + inner radius set to 0.0 and the normal set to be the axis of the + cylinder. Finite cylinders are built this way to enhance speed. + + :: + + FCylinder + Center 0.0 0.0 0.0 + Axis 0.0 9.0 0.0 + Rad 1.0 + SomeRandomTexture + + This defines a finite cylinder with radius 1.0, going from 0.0 0.0 0.0, + to 0.0 9.0 0.0 along the Y axis. The main difference between an infinite + cylinder and a finite cylinder is in the interpretation of the **AXIS** + parameter. In the case of the infinite cylinder, the length of the axis + vector is ignored. In the case of the finite cylinder, the axis + parameter is used to determine the length of the overall cylinder. + + Axis Aligned Boxes + ~~~~~~~~~~~~~~~~~~ + + Axis aligned boxes are fast, but of limited usefulness. As such, I’m not + going to waste much time explaining ’em. An axis aligned box is defined + by a **MIN** point, and a **MAX** point. The volume between the min and + max points is the box. Here’s a simple box: + + :: + + BOX + MIN -1.0 -1.0 -1.0 + MAX 1.0 1.0 1.0 + Boxtexture1 + + Fractal Landscapes + ~~~~~~~~~~~~~~~~~~ + + Currently fractal landscapes are a built-in function. In the near future + I’ll allow the user to load an image map for use as a heightfield. + Fractal landscapes are currently forced to be axis aligned. Any + suggestion on how to make them more appealing to users is welcome. A + fractal landscape is defined by its "resolution" which is the number of + grid points along each axis, and by its scale and center. The "scale" is + how large the landscape is along the X, and Y axes in world coordinates. + Here’s a simple landscape: + + :: + + SCAPE + RES 30 30 + SCALE 80.0 80.0 + CENTER 0.0 -4.0 20.0 + TEXTURE + AMBIENT 0.1 DIFFUSE 0.9 SPECULAR 0.0 OPACITY 1.0 + COLOR 1.0 1.0 1.0 + TEXFUNC 0 + + The landscape shown above generates a square landscape made of 1,800 + triangles. When time permits, the heightfield code will be rewritten to + be more general and to increase rendering speed. + + Arbitrary Quadric Surfaces + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Docs soon. I need to add these into the parser, must have forgotten + before ;-) + + Volume Rendered Scalar Voxels + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + These are a little trickier than the average object :-) These are likely + to change substantially in the very near future so I’m not going to get + too detailed yet. A volume rendered data set is described by its axis + aligned bounding box, and its resolution along each axis. The final + parameter is the voxel data file. If you are seriously interested in + messing with these, get hold of me and I’ll give you more info. Here’s a + quick example: + + :: + + SCALARVOL + MIN -1.0 -1.0 -0.4 + MAX 1.0 1.0 0.4 + DIM 256 256 100 + FILE /cfs/johns/vol/engine.256x256x110 + TEXTURE + AMBIENT 1.0 DIFFUSE 0.0 SPECULAR 0.0 OPACITY 8.1 + COLOR 1.0 1.0 1.0 + TEXFUNC 0 + + Texture and Color + ----------------- + + Simple Texture Characteristics + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The surface textures applied to an object drastically alter its overall + appearance, making textures and color one of the most important topics + in this manual. As with many other renderers, textures can be declared + and associated with a name so that they may be used over and over again + in a scene definition with less typing. If a texture is only need once, + or it is unique to a particular object in the scene, then it may be + declared along with the object it is applied to, and does not need a + name. + + The simplest texture definition is a solid color with no image mapping + or procedural texture mapping. A solid color texture is defined by the + **AMBIENT**, **DIFFUSE**, **SPECULAR**, **OPACITY** and **COLOR** + parameters. The **AMBIENT** parameter defines the ambient lighting + coefficient to be used when shading the object. Similarly, the + **DIFFUSE** parameter is the relative contribution of the diffuse + shading to the surface appearance. The **SPECULAR** parameter is the + contribution from perfectly reflected rays, as if on a mirrored surface. + **OPACITY** defines how transparent a surface is. An **OPACITY** value + of 0.0 renders the object completely invisible. An **OPACITY** value of + 1.0 makes the object completely solid, and non-transmissive. In general, + the values for the ambient, diffuse, and specular parameters should add + up to 1.0, if they don’t then pixels may be over or underexposed quite + easily. These parameters function in a manner similar to that of other + ray tracers. The **COLOR** parameter is an RGB triple with each value + ranging from 0.0 to 1.0 inclusive. If the RGB values stray from 0.0 to + 1.0, results are undefined. In the case of solid textures, a final + parameter, **TEXFUNC** is set to zero (integer). + + Texture Declaration and Aliasing + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + To define a simple texture for use on several objects in a scene, the + **TEXDEF** keyword is used. The **TEXDEF** keyword is followed by a case + sensitive texture name, which will subsequently be used while defining + objects. If many objects in a scene use the same texture through texture + definition, a significant amount of memory may be saved since only one + copy of the texture is present in memory, and its shared by all of the + objects. Here is an example of a solid texture definition: + + :: + + TEXDEF MyNewRedTexture + AMBIENT 0.1 DIFFUSE 0.9 SPECULAR 0.0 OPACITY 1.0 + COLOR 1.0 0.0 0.0 TEXFUNC 0 + + When this texture is used in an object definition, it is referenced only + by name. Be careful not to use one of the other keywords as a defined + texture, this will probably cause the parser to explode, as I don’t + check for use of keywords as texture names. + + When a texture is declared within an object definition, it appears in an + identical format to the **TEXDEF** declaration, but the **TEXTURE** + keyword is used instead of **TEXDEF**. If it is useful to have several + names for the same texture (when you are too lazy to actually finish + defining different variations of a wood texture for example, and just + want to be approximately correct for example) aliases can be constructed + using the **TEXALIAS** keyword, along with the alias name, and the + original name. An example of a texture alias is: + + :: + + TEXALIAS MyNewestRedTexture MyNewRedTexture + + This line would alias MyNewestRedTexture to be the same thing as the + previously declared MyNewRedTexture. Note that the source texture must + be declared before any aliases that use it. + + Image Maps and Procedural Textures + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Image maps and procedural textures very useful in making realistic + looking scenes. A good image map can do as much for the realism of a + wooden table as any amount of sophisticated geometry or lighting. Image + maps are made by wrapping an image on to an object in one of three ways, + a spherical map, a cylindrical map, and a planar map. Procedural + textures are used in a way similar to the image maps, but they are on + the fly and do not use much memory compared to the image maps. The main + disadvantage of the procedural maps is that they must be hard-coded into + RAY when it is compiled. + + The syntax used for all texture maps is fairly simple to learn. The + biggest problem with the way that the parser is written now is that the + different mappings are selected by an integer, which is not very user + friendly. I expect to rewrite this section of the parser sometime in the + near future to alleviate this problem. When I rewrite the parser, I may + also end up altering the parameters that are used to describe a texture + map, and some of them may become optional rather than required. + + .. container:: center + + +---------------------------+-----------------------------------------+ + | Texture Mapping Functions | | + +===========================+=========================================+ + | Value for TEXFUNC | Mapping and Texture Description | + +---------------------------+-----------------------------------------+ + | 0 | No special texture, plain shading | + +---------------------------+-----------------------------------------+ + | 1 | 3D checkerboard function, like a | + | | Rubik’s cube | + +---------------------------+-----------------------------------------+ + | 2 | Grit Texture, randomized surface color | + +---------------------------+-----------------------------------------+ + | 3 | 3D marble texture, uses object’s base | + | | color | + +---------------------------+-----------------------------------------+ + | 4 | 3D wood texture, light and dark brown, | + | | not very good yet | + +---------------------------+-----------------------------------------+ + | 5 | 3D gradient noise function (can’t | + | | remember what it look like | + +---------------------------+-----------------------------------------+ + | 6 | Don’t remember | + +---------------------------+-----------------------------------------+ + | 7 | Cylindrical Image Map, requires ppm | + | | filename | + +---------------------------+-----------------------------------------+ + | 8 | Spherical Image Map, requires ppm | + | | filename | + +---------------------------+-----------------------------------------+ + | 9 | Planar Image Map, requires ppm filename | + +---------------------------+-----------------------------------------+ + + Here’s an example of a sphere, with a spherical image map applied to its + surface: + + :: + + SPHERE + CENTER 2.0 0.0 5.0 + RAD 2.0 + TEXTURE + AMBIENT 0.4 DIFFUSE 0.8 SPECULAR 0.0 OPACITY 1.0 + COLOR 1.0 1.0 1.0 + TEXFUNC 7 /cfs/johns/imaps/fire644.ppm + CENTER 2.0 0.0 5.0 + ROTATE 0.0 0.0 0.0 + SCALE 2.0 -2.0 1.0 + + Basically, the image maps require the center, rotate and scale + parameters so that you can position the image map on the object + properly. + EXAMPLES: @@ -196,598 +863,8 @@ def help(self, use_pager=True): sage: t.help(use_pager=False) This help, which was written by John Stone, describes ... """ - s = r""" -This help, which was written by John Stone, describes how to create -scene files. - -At the present time, scene description files are very simple. -The parser can't handle multiple file scene descriptions, although they -may be added in the future. Most of the objects and their scene description -are closely related to the RAY API -\emph{(See the API docs for additional info.)} - -\subsection{Basic Scene Requirements} - Unlike some other ray tracers out there, RAY requires that you -specify most of the scene parameters in the scene description file itself. -If users would rather specify some of these parameters at the command line, -then I may add that feature in the future. -A scene description file contains keywords, and values associated or grouped -with a keyword. All keywords can be in caps, lower case, or mixed case -for the convenience of the user. File names and texture names are -normally case-sensitive, although the behavior for file names is -operating system-dependent. All values are either character strings, or -floating point numbers. In some cases, the presence of one keyword will -require additional keyword / value pairs. - - At the moment there are several keywords with values, -that must appear in every scene description file. -Every scene description file must begin with the -{\bf BEGIN\_SCENE} keyword, and end with the {\bf END\_SCENE} keyword. -All definitions and declarations of any kind must be inside the -{\bf BEGIN\_SCENE}, {\bf END\_SCENE} pair. -The {\bf RESOLUTION} keyword is followed by an x resolution -and a y resolution in terms of pixels on each axis. There are currently -no limits placed on the resolution of an output image other than the -computer's available memory and reasonable execution time. -An example of a simple scene description skeleton is show below: -\begin{verbatim} -BEGIN_SCENE - RESOLUTION 1024 1024 -... -... Camera definition.. -... -... Other objects, etc.. -... - -END_SCENE -\end{verbatim} - -\subsection{Camera and viewing parameters} - One of the most important parts of any scene, is the camera position and -orientation. Having a good angle on a scene can make the difference between -an average looking scene and a strikingly interesting one. There may be -multiple camera definitions in a scene file, but the last camera definition -overrides all previous definitions. -There are several parameters that control the camera in \RAY, -{\bf PROJECTION}, {\bf ZOOM}, {\bf ASPECTRATIO}, {\bf ANTIALIASING}, - {\bf CENTER}, {\bf RAYDEPTH}, {\bf VIEWDIR}, and {\bf UPDIR}. - -The first and last keywords required in the definition of a camera are the -{\bf CAMERA} and {\bf END\_CAMERA} keywords. The {\bf PROJECTION} keyword -is optional, the remaining camera keywords are required, and must be -written in the sequence they are listed in the examples in this section. - -\subsubsection{Camera projection modes} - The {\bf PROJECTION} keyword must be followed by one of the supported -camera projection mode identifiers {\bf PERSPECTIVE}, {\bf PERSPECTIVE_DOF}, -{\bf ORTHOGRAPHIC}, or {\bf FISHEYE}. The {\bf FISHEYE} projection mode -requires two extra parameters {\bf FOCALLENGTH} and {\bf APERTURE} -which precede the regular camera options. - -\begin{verbatim} -Camera - projection perspective_dof - focallength 0.75 - aperture 0.02 - Zoom 0.666667 - Aspectratio 1.000000 - Antialiasing 128 - Raydepth 30 - Center 0.000000 0.000000 -2.000000 - Viewdir -0.000000 -0.000000 2.000000 - Updir 0.000000 1.000000 -0.000000 -End_Camera -\end{verbatim} - -\subsubsection{Common camera parameters} - The {\bf ZOOM} parameter controls the camera in a way similar to a -telephoto lens on a 35mm camera. A zoom value of 1.0 is standard, -with a 90 degree field of view. By changing the zoom factor to 2.0, -the relative size of any feature in the frame is twice as big, while -the field of view is decreased slightly. The zoom effect is -implemented as a scaling factor on the height and width of the image -plane relative to the world. - - The {\bf ASPECTRATIO} parameter controls the aspect ratio of the resulting -image. By using the aspect ratio parameter, one can produce images which -look correct on any screen. Aspect ratio alters the relative width of the -image plane, while keeping the height of the image plane constant. In -general, most workstation displays have an aspect ratio of 1.0. To see -what aspect ratio your display has, you can render a simple sphere, at -a resolution of 512x512 and measure the ratio of its width to its height. - -The {\bf ANTIALIASING} parameter controls the maximum level of supersampling -used to obtain higher image quality. The parameter given sets the number of -additional rays to trace per-pixel to attain higher image quality. - - The {\bf RAYDEPTH} parameter tells RAY what the maximum -level of reflections, refraction, or in general the maximum recursion -depth to trace rays to. A value between 4 and 12 is usually good. A -value of 1 will disable rendering of reflective or transmissive -objects (they'll be black). - - The remaining three camera parameters are the most important, because -they define the coordinate system of the camera, and its position in the -scene. The {\bf CENTER} parameter is an X, Y, Z coordinate defining the -center of the camera \emph{(also known as the Center of Projection)}. -Once you have determined where the camera will be placed in the scene, you -need to tell RAY what the camera should be looking at. The -{\bf VIEWDIR} parameter is a vector indicating the direction the camera -is facing. It may be useful for me to add a "Look At" type keyword in -the future to make camera aiming easier. If people want or need the -"Look At" style camera, let me know. The last parameter needed to completely -define a camera is the "up" direction. The {\bf UPDIR} parameter is a vector -which points in the direction of the "sky". I wrote the camera so that -{\bf VIEWDIR} and {\bf UPDIR} don't have to be perpendicular, and there -shouldn't be a need for a "right" vector although some other ray tracers -require it. Here's a snippet of a camera definition: -\begin{verbatim} -CAMERA - ZOOM 1.0 - ASPECTRATIO 1.0 - ANTIALIASING 0 - RAYDEPTH 12 - CENTER 0.0 0.0 2.0 - VIEWDIR 0 0 -1 - UPDIR 0 1 0 -END_CAMERA -\end{verbatim} - - -\subsubsection{Viewing frustum} -An optional {\bf FRUSTUM} parameter provides a means for rendering sub-images -in a larger frame, and correct stereoscopic images. The {\bf FRUSTUM} -keyword must be followed by four floating parameters, which indicate -the top, bottom, left and right coordinates of the image plane in -eye coordinates. When the projection mode is set to {\bf FISHEYE}, -the frustum parameters correspond to spherical coordinates specified -in radians. - -\begin{verbatim} -CAMERA - ZOOM 1.0 - ASPECTRATIO 1.0 - ANTIALIASING 0 - RAYDEPTH 4 - CENTER 0.0 0.0 -6.0 - VIEWDIR 0.0 0.0 1.0 - UPDIR 0.0 1.0 0.0 - FRUSTUM -0.5 0.5 -0.5 0.5 -END_CAMERA -\end{verbatim} - - -\subsection{Including Files} -The {\bf INCLUDE} keyword is used anywhere after the camera description, -and is immediately followed by a valid filename, for a file containing -additional scene description information. The included file is opened, -and processing continues as if it were part of the current file, until -the end of the included file is reached. Parsing of the current file -continues from where it left off prior to the included file. - -\subsection{Scene File Comments} -The {\bf $\#$} keyword is used anywhere after the camera description, and -will cause RAY to ignore all characters from the {\bf $\#$} to the end -of the input line. The {\bf $\#$} character must be surrounded by whitespace -in order to be recognized. A sequence such as {\bf $\#\#\#$} will not be -recognized as a comment. - -\subsection{Lights} -The most frequently used type of lights provided by RAY are positional -point light sources. The lights are actually small spheres, which are -visible. A point light is composed of three pieces of -information, a center, a radius (since its a sphere), and a color. -To define a light, simply write the {\bf LIGHT} keyword, followed by -its {\bf CENTER} (a X, Y, Z coordinate), its {\bf RAD} (radius, a scalar), -and its {\bf COLOR} (a Red Green Blue triple). The radius parameter will -accept any value of 0.0 or greater. Lights of radius 0.0 will not be -directly visible in the rendered scene, but contribute light to the scene -normally. -For a light, the color values -range from 0.0 to 1.0, any values outside this range may yield unpredictable -results. A simple light definition looks like this: -\begin{verbatim} - LIGHT CENTER 4.0 3.0 2.0 - RAD 0.2 - COLOR 0.5 0.5 0.5 -\end{verbatim} -This light would be gray colored if seen directly, and would be 50\% -intensity in each RGB color component. - - -RAY supports simple directional lighting, commonly used in -CAD and scientific visualization programs for its performance -advantages over positional lights. Directional lights cannot be -seen directly in scenes rendered by \RAY, only their illumination -contributes to the final image. - -\begin{verbatim} -DIRECTIONAL_LIGHT - DIRECTION 0.0 -1.0 0.0 - COLOR 1.0 0.0 0.0 -\end{verbatim} - -RAY supports spotlights, which are described very similarly to a -point light, but they are attenuated by angle from the direction vector, -based on a ``falloff start'' angle and ``falloff end''angle. Between -the starting and ending angles, the illumination is attenuated linearly. -The syntax for a spotlight description in a scene file is as follows. -\begin{verbatim} -SPOTLIGHT - CENTER 0.0 3.0 17.0 - RAD 0.2 - DIRECTION 0.0 -1.0 0.0 - FALLOFF_START 20.0 - FALLOFF_END 45.0 - COLOR 1.0 0.0 0.0 -\end{verbatim} - -The lighting system implemented by RAY provides various levels of -distance-based lighting attenuation. By default, a light is not attenuated -by distance. If the \emph{attenuation} keywords is present immediately -prior to the light's color, RAY will accept coefficients which are used -to calculate distance-based attenuation, which is applied the light by -multiplying with the resulting value. The attenuation factor is calculated -from the equation -$$ - 1/(K_c + K_l d + k_q d^2) -$$ - -This attenuation equation should be familiar to some as it -is the same lighting attenuation equation used by OpenGL. -The constant, linear, and quadratic terms are specified in a scene file -as shown in the following example. -\begin{verbatim} -LIGHT - CENTER -5.0 0.0 10.0 - RAD 1.0 - ATTENUATION CONSTANT 1.0 LINEAR 0.2 QUADRATIC 0.05 - COLOR 1.0 0.0 0.0 -\end{verbatim} - - - -\subsection{Atmospheric effects} -RAY currently only implements one atmospheric effect, -simple distance-based fog. - -\subsubsection{Fog} -RAY provides a simple distance-based fog effect intended to provide -functionality similar to that found in OpenGL, for compatibility with -software that requires an OpenGL-like fog implementation. Much like -OpenGL, RAY provides linear, exponential, and exponential-squared fog. - -\begin{verbatim} - FOG - LINEAR START 0.0 END 50.0 DENSITY 1.0 COLOR 1.0 1.0 1.0 -\end{verbatim} - -\begin{verbatim} - FOG - EXP START 0.0 END 50.0 DENSITY 1.0 COLOR 1.0 1.0 1.0 -\end{verbatim} - -\begin{verbatim} - FOG - EXP2 START 0.0 END 50.0 DENSITY 1.0 COLOR 1.0 1.0 1.0 -\end{verbatim} - - -\subsection{Objects} - -\subsubsection{Spheres} - Spheres are the simplest object supported by RAY and they are -also the fastest object to render. Spheres are defined as one would expect, -with a {\bf CENTER}, {\bf RAD} (radius), and a texture. The texture may -be defined along with the object as discussed earlier, or it may be declared -and assigned a name. -Here's a sphere definition using a previously defined "NitrogenAtom" texture: -\begin{verbatim} - SPHERE CENTER 26.4 27.4 -2.4 RAD 1.0 NitrogenAtom -\end{verbatim} -A sphere with an inline texture definition is declared like this: -\begin{verbatim} - Sphere center 1.0 0.0 10.0 - Rad 1.0 - Texture Ambient 0.2 Diffuse 0.8 Specular 0.0 Opacity 1.0 - Color 1.0 0.0 0.5 - TexFunc 0 -\end{verbatim} -Notice that in this example I used mixed case for the keywords, this is -allowable... -Review the section on textures if the texture definitions are confusing. - -\subsubsection{Triangles} - Triangles are also fairly simple objects, constructed by listing the -three vertices of the triangle, and its texture. The order of the -vertices isn't important, the triangle object is "double sided", so the -surface normal is always pointing back in the direction of the incident ray. -The triangle vertices are listed as {\bf V1}, {\bf V2}, and {\bf V3} each one -is an X, Y, Z coordinate. An example of a triangle is shown below: -\begin{verbatim} -TRI - V0 0.0 -4.0 12.0 - V1 4.0 -4.0 8.0 - V2 -4.0 -4.0 8.0 - TEXTURE - AMBIENT 0.1 DIFFUSE 0.2 SPECULAR 0.7 OPACITY 1.0 - COLOR 1.0 1.0 1.0 - TEXFUNC 0 -\end{verbatim} - -\subsubsection{Smoothed Triangles} - Smoothed triangles are just like regular triangles, except that the - surface normal for each of the three vertices is used to determine the - surface normal across the triangle by linear interpolation. - Smoothed triangles yield curved looking objects and have nice - reflections. -\begin{verbatim} -STRI - V0 1.4 0.0 2.4 - V1 1.35 -0.37 2.4 - V2 1.36 -0.32 2.45 - N0 -0.9 -0.0 -0.4 - N1 -0.8 0.23 -0.4 - N2 -0.9 0.27 -0.15 - TEXTURE - AMBIENT 0.1 DIFFUSE 0.2 SPECULAR 0.7 OPACITY 1.0 - COLOR 1.0 1.0 1.0 - TEXFUNC 0 -\end{verbatim} - -\subsubsection{Infinite Planes} - - Useful for things like desert floors, backgrounds, skies etc, the infinite -plane is pretty easy to use. An infinite plane only consists of two pieces -of information, the {\bf CENTER} of the plane, and a {\bf NORMAL} to the plane. -The center of the plane is just any point on the plane such that the point -combined with the surface normal define the equation for the plane. -As with triangles, planes are double sided. Here is an example of an -infinite plane: -\begin{verbatim} -PLANE - CENTER 0.0 -5.0 0.0 - NORMAL 0.0 1.0 0.0 - TEXTURE - AMBIENT 0.1 DIFFUSE 0.9 SPECULAR 0.0 OPACITY 1.0 - COLOR 1.0 1.0 1.0 - TEXFUNC 1 - CENTER 0.0 -5.0 0.0 - ROTATE 0. 0.0 0.0 - SCALE 1.0 1.0 1.0 -\end{verbatim} - -\subsubsection{Rings} - Rings are a simple object, they are really a not-so-infinite plane. -Rings are simply an infinite plane cut into a washer shaped ring, infinitely -thing just like a plane. A ring only requires two more pieces of information -than an infinite plane does, an inner and outer radius. Here's an example -of a ring: -\begin{verbatim} - Ring - Center 1.0 1.0 1.0 - Normal 0.0 1.0 0.0 - Inner 1.0 - Outer 5.0 - MyNewRedTexture -\end{verbatim} - -\subsubsection{Infinite Cylinders} - Infinite cylinders are quite simple. They are defined by a center, an -axis, and a radius. An example of an infinite cylinder is: -\begin{verbatim} - Cylinder - Center 0.0 0.0 0.0 - Axis 0.0 1.0 0.0 - Rad 1.0 - SomeRandomTexture -\end{verbatim} - -\subsubsection{Finite Cylinders} - Finite cylinders are almost the same as infinite ones, but the - center and length of the axis determine the extents of the cylinder. - The finite cylinder is also really a shell, it doesn't have any - caps. If you need to close off the ends of the cylinder, use two - ring objects, with the inner radius set to 0.0 and the normal set - to be the axis of the cylinder. Finite cylinders are built this - way to enhance speed. - -\begin{verbatim} - FCylinder - Center 0.0 0.0 0.0 - Axis 0.0 9.0 0.0 - Rad 1.0 - SomeRandomTexture -\end{verbatim} -This defines a finite cylinder with radius 1.0, going from 0.0 0.0 0.0, to -0.0 9.0 0.0 along the Y axis. The main difference between an infinite cylinder -and a finite cylinder is in the interpretation of the {\bf AXIS} parameter. -In the case of the infinite cylinder, the length of the axis vector is -ignored. In the case of the finite cylinder, the axis parameter is used -to determine the length of the overall cylinder. - -\subsubsection{Axis Aligned Boxes} - Axis aligned boxes are fast, but of limited usefulness. As such, I'm -not going to waste much time explaining 'em. An axis aligned box is -defined by a {\bf MIN} point, and a {\bf MAX} point. The volume between -the min and max points is the box. Here's a simple box: -\begin{verbatim} - BOX - MIN -1.0 -1.0 -1.0 - MAX 1.0 1.0 1.0 - Boxtexture1 -\end{verbatim} - -\subsubsection{Fractal Landscapes} - Currently fractal landscapes are a built-in function. In the near future -I'll allow the user to load an image map for use as a heightfield. -Fractal landscapes are currently forced to be axis aligned. Any suggestion -on how to make them more appealing to users is welcome. A fractal landscape -is defined by its "resolution" which is the number of grid points along -each axis, and by its scale and center. The "scale" is how large the -landscape is along the X, and Y axes in world coordinates. Here's a simple -landscape: -\begin{verbatim} -SCAPE - RES 30 30 - SCALE 80.0 80.0 - CENTER 0.0 -4.0 20.0 - TEXTURE - AMBIENT 0.1 DIFFUSE 0.9 SPECULAR 0.0 OPACITY 1.0 - COLOR 1.0 1.0 1.0 - TEXFUNC 0 -\end{verbatim} -The landscape shown above generates a square landscape made of 1,800 triangles. -When time permits, the heightfield code will be rewritten to be more -general and to increase rendering speed. - -\subsubsection{Arbitrary Quadric Surfaces} - Docs soon. I need to add these into the parser, must have forgotten -before ;-) - -\subsubsection{Volume Rendered Scalar Voxels} -These are a little trickier than the average object :-) -These are likely to change substantially in the very near future so I'm not -going to get too detailed yet. -A volume rendered data set is described by its axis aligned bounding box, and -its resolution along each axis. The final parameter is the voxel data -file. If you are seriously interested in messing with these, get hold of -me and I'll give you more info. Here's a quick example: -\begin{verbatim} -SCALARVOL - MIN -1.0 -1.0 -0.4 - MAX 1.0 1.0 0.4 - DIM 256 256 100 - FILE /cfs/johns/vol/engine.256x256x110 - TEXTURE - AMBIENT 1.0 DIFFUSE 0.0 SPECULAR 0.0 OPACITY 8.1 - COLOR 1.0 1.0 1.0 - TEXFUNC 0 -\end{verbatim} - -\subsection{Texture and Color} -\subsubsection{Simple Texture Characteristics} - The surface textures applied to an object drastically alter its overall -appearance, making textures and color one of the most important topics in -this manual. As with many other renderers, textures can be declared and -associated with a name so that they may be used over and over again in -a scene definition with less typing. If a texture is only need once, or it -is unique to a particular object in the scene, then it may be declared along -with the object it is applied to, and does not need a name. - - The simplest texture definition is a solid color with no image mapping -or procedural texture mapping. A solid color texture is defined by the -{\bf AMBIENT}, {\bf DIFFUSE}, {\bf SPECULAR}, {\bf OPACITY} and {\bf COLOR} -parameters. The {\bf AMBIENT} parameter defines the ambient lighting -coefficient to be used when shading the object. Similarly, the {\bf DIFFUSE} -parameter is the relative contribution of the diffuse shading to the surface -appearance. The {\bf SPECULAR} parameter is the contribution from perfectly -reflected rays, as if on a mirrored surface. {\bf OPACITY} defines how -transparent a surface is. An {\bf OPACITY} value of 0.0 renders the object -completely invisible. An {\bf OPACITY} value of 1.0 makes the object -completely solid, and non-transmissive. In general, the values for the -ambient, diffuse, and specular parameters should add up to 1.0, if they don't -then pixels may be over or underexposed quite easily. These parameters -function in a manner similar to that of other ray tracers. The {\bf COLOR} -parameter is an RGB triple with each value ranging from 0.0 to 1.0 inclusive. -If the RGB values stray from 0.0 to 1.0, results are undefined. -In the case of solid textures, a final parameter, {\bf TEXFUNC} is set to -zero (integer). - -\subsubsection{Texture Declaration and Aliasing} - To define a simple texture for use on several objects in a scene, the -{\bf TEXDEF} keyword is used. The {\bf TEXDEF} keyword is followed by -a case sensitive texture name, which will subsequently be used while -defining objects. If many objects in a scene use the same texture through -texture definition, a significant amount of memory may be saved since only -one copy of the texture is present in memory, and its shared by all -of the objects. Here is an example of a solid texture definition: -\begin{verbatim} - TEXDEF MyNewRedTexture - AMBIENT 0.1 DIFFUSE 0.9 SPECULAR 0.0 OPACITY 1.0 - COLOR 1.0 0.0 0.0 TEXFUNC 0 -\end{verbatim} -When this texture is used in an object definition, it is referenced only by -name. Be careful not to use one of the other keywords as a defined texture, -this will probably cause the parser to explode, as I don't check for use -of keywords as texture names. - - When a texture is declared within an object definition, it appears in -an identical format to the {\bf TEXDEF} declaration, but the {\bf TEXTURE} -keyword is used instead of {\bf TEXDEF}. If it is useful to have several -names for the same texture (when you are too lazy to actually finish defining -different variations of a wood texture for example, and just want to be -approximately correct for example) aliases can be constructed using the -{\bf TEXALIAS} keyword, along with the alias name, and the original name. -An example of a texture alias is: -\begin{verbatim} - TEXALIAS MyNewestRedTexture MyNewRedTexture -\end{verbatim} -This line would alias MyNewestRedTexture to be the same thing as the -previously declared MyNewRedTexture. Note that the source texture must -be declared before any aliases that use it. - -\subsubsection{Image Maps and Procedural Textures} Image maps and -procedural textures very useful in making realistic looking scenes. A -good image map can do as much for the realism of a wooden table as any -amount of sophisticated geometry or lighting. Image maps are made by -wrapping an image on to an object in one of three ways, a spherical -map, a cylindrical map, and a planar map. Procedural textures are -used in a way similar to the image maps, but they are on the fly and -do not use much memory compared to the image maps. The main -disadvantage of the procedural maps is that they must be hard-coded -into RAY when it is compiled. - - The syntax used for all texture maps is fairly simple to learn. The biggest -problem with the way that the parser is written now is that the different -mappings are selected by an integer, which is not very user friendly. I -expect to rewrite this section of the parser sometime in the near future to -alleviate this problem. When I rewrite the parser, I may also end up altering -the parameters that are used to describe a texture map, and some of them may -become optional rather than required. - -\begin{center} -\begin{tabular}{|c|c|} -\multicolumn{2}{c}{Texture Mapping Functions} \\ -\hline -{Value for TEXFUNC} & {Mapping and Texture Description}\\ -\hline -{0} & {No special texture, plain shading} \\ -{1} & {3D checkerboard function, like a Rubik's cube} \\ -{2} & {Grit Texture, randomized surface color} \\ -{3} & {3D marble texture, uses object's base color} \\ -{4} & {3D wood texture, light and dark brown, not very good yet} \\ -{5} & {3D gradient noise function (can't remember what it look like} \\ -{6} & {Don't remember} \\ -{7} & {Cylindrical Image Map, requires ppm filename} \\ -{8} & {Spherical Image Map, requires ppm filename} \\ -{9} & {Planar Image Map, requires ppm filename} \\ -\hline -\end{tabular} -\end{center} - -Here's an example of a sphere, with a spherical image map applied to its -surface: -\begin{verbatim} -SPHERE - CENTER 2.0 0.0 5.0 - RAD 2.0 - TEXTURE - AMBIENT 0.4 DIFFUSE 0.8 SPECULAR 0.0 OPACITY 1.0 - COLOR 1.0 1.0 1.0 - TEXFUNC 7 /cfs/johns/imaps/fire644.ppm - CENTER 2.0 0.0 5.0 - ROTATE 0.0 0.0 0.0 - SCALE 2.0 -2.0 1.0 -\end{verbatim} - -Basically, the image maps require the center, rotate and scale -parameters so that you can position the image map on the object -properly. -""" from sage.misc.sagedoc import format - f = format(s) - f = f.replace('{ ','').replace('}','').replace('{','') + f = format(self.__doc__) if use_pager: pager()(f) else: From cc07fc0bb4f7b512344d8899117432384fc1de02 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:27:51 -0700 Subject: [PATCH 302/338] src/sage/interfaces/tachyon.py: Mark up tachyon keywords with double backticks --- src/sage/interfaces/tachyon.py | 80 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index c796bc4241c..444f22e9357 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -96,9 +96,9 @@ class TachyonRT(SageObject): At the moment there are several keywords with values, that must appear in every scene description file. Every scene description file must begin - with the **BEGIN_SCENE** keyword, and end with the **END_SCENE** + with the ``BEGIN_SCENE`` keyword, and end with the ``END_SCENE`` keyword. All definitions and declarations of any kind must be inside the - **BEGIN_SCENE**, **END_SCENE** pair. The **RESOLUTION** keyword is + ``BEGIN_SCENE``, ``END_SCENE`` pair. The ``RESOLUTION`` keyword is followed by an x resolution and a y resolution in terms of pixels on each axis. There are currently no limits placed on the resolution of an output image other than the computer’s available memory and reasonable @@ -125,22 +125,22 @@ class TachyonRT(SageObject): between an average looking scene and a strikingly interesting one. There may be multiple camera definitions in a scene file, but the last camera definition overrides all previous definitions. There are several - parameters that control the camera in , **PROJECTION**, **ZOOM**, - **ASPECTRATIO**, **ANTIALIASING**, **CENTER**, **RAYDEPTH**, - **VIEWDIR**, and **UPDIR**. + parameters that control the camera in , ``PROJECTION``, ``ZOOM``, + ``ASPECTRATIO``, ``ANTIALIASING``, ``CENTER``, ``RAYDEPTH``, + ``VIEWDIR``, and ``UPDIR``. The first and last keywords required in the definition of a camera are - the **CAMERA** and **END_CAMERA** keywords. The **PROJECTION** keyword + the ``CAMERA`` and ``END_CAMERA`` keywords. The ``PROJECTION`` keyword is optional, the remaining camera keywords are required, and must be written in the sequence they are listed in the examples in this section. Camera projection modes ~~~~~~~~~~~~~~~~~~~~~~~ - The **PROJECTION** keyword must be followed by one of the supported - camera projection mode identifiers **PERSPECTIVE**, **PERSPECTIVE_DOF**, - **ORTHOGRAPHIC**, or **FISHEYE**. The **FISHEYE** projection mode - requires two extra parameters **FOCALLENGTH** and **APERTURE** which + The ``PROJECTION`` keyword must be followed by one of the supported + camera projection mode identifiers ``PERSPECTIVE``, ``PERSPECTIVE_DOF``, + ``ORTHOGRAPHIC``, or ``FISHEYE``. The ``FISHEYE`` projection mode + requires two extra parameters ``FOCALLENGTH`` and ``APERTURE`` which precede the regular camera options. :: @@ -161,7 +161,7 @@ class TachyonRT(SageObject): Common camera parameters ~~~~~~~~~~~~~~~~~~~~~~~~ - The **ZOOM** parameter controls the camera in a way similar to a + The ``ZOOM`` parameter controls the camera in a way similar to a telephoto lens on a 35mm camera. A zoom value of 1.0 is standard, with a 90 degree field of view. By changing the zoom factor to 2.0, the relative size of any feature in the frame is twice as big, while the @@ -169,7 +169,7 @@ class TachyonRT(SageObject): scaling factor on the height and width of the image plane relative to the world. - The **ASPECTRATIO** parameter controls the aspect ratio of the resulting + The ``ASPECTRATIO`` parameter controls the aspect ratio of the resulting image. By using the aspect ratio parameter, one can produce images which look correct on any screen. Aspect ratio alters the relative width of the image plane, while keeping the height of the image plane constant. @@ -178,12 +178,12 @@ class TachyonRT(SageObject): at a resolution of 512x512 and measure the ratio of its width to its height. - The **ANTIALIASING** parameter controls the maximum level of + The ``ANTIALIASING`` parameter controls the maximum level of supersampling used to obtain higher image quality. The parameter given sets the number of additional rays to trace per-pixel to attain higher image quality. - The **RAYDEPTH** parameter tells RAY what the maximum level of + The ``RAYDEPTH`` parameter tells RAY what the maximum level of reflections, refraction, or in general the maximum recursion depth to trace rays to. A value between 4 and 12 is usually good. A value of 1 will disable rendering of reflective or transmissive objects (they’ll be @@ -191,17 +191,17 @@ class TachyonRT(SageObject): The remaining three camera parameters are the most important, because they define the coordinate system of the camera, and its position in the - scene. The **CENTER** parameter is an X, Y, Z coordinate defining the + scene. The ``CENTER`` parameter is an X, Y, Z coordinate defining the center of the camera *(also known as the Center of Projection)*. Once you have determined where the camera will be placed in the scene, you - need to tell RAY what the camera should be looking at. The **VIEWDIR** + need to tell RAY what the camera should be looking at. The ``VIEWDIR`` parameter is a vector indicating the direction the camera is facing. It may be useful for me to add a "Look At" type keyword in the future to make camera aiming easier. If people want or need the "Look At" style camera, let me know. The last parameter needed to completely define a - camera is the "up" direction. The **UPDIR** parameter is a vector which + camera is the "up" direction. The ``UPDIR`` parameter is a vector which points in the direction of the "sky". I wrote the camera so that - **VIEWDIR** and **UPDIR** don’t have to be perpendicular, and there + ``VIEWDIR`` and ``UPDIR`` don’t have to be perpendicular, and there shouldn’t be a need for a "right" vector although some other ray tracers require it. Here’s a snippet of a camera definition: @@ -220,11 +220,11 @@ class TachyonRT(SageObject): Viewing frustum ~~~~~~~~~~~~~~~ - An optional **FRUSTUM** parameter provides a means for rendering + An optional ``FRUSTUM`` parameter provides a means for rendering sub-images in a larger frame, and correct stereoscopic images. The - **FRUSTUM** keyword must be followed by four floating parameters, which + ``FRUSTUM`` keyword must be followed by four floating parameters, which indicate the top, bottom, left and right coordinates of the image plane - in eye coordinates. When the projection mode is set to **FISHEYE**, the + in eye coordinates. When the projection mode is set to ``FISHEYE``, the frustum parameters correspond to spherical coordinates specified in radians. @@ -244,7 +244,7 @@ class TachyonRT(SageObject): Including Files --------------- - The **INCLUDE** keyword is used anywhere after the camera description, + The ``INCLUDE`` keyword is used anywhere after the camera description, and is immediately followed by a valid filename, for a file containing additional scene description information. The included file is opened, and processing continues as if it were part of the current file, until @@ -267,8 +267,8 @@ class TachyonRT(SageObject): point light sources. The lights are actually small spheres, which are visible. A point light is composed of three pieces of information, a center, a radius (since its a sphere), and a color. To define a light, - simply write the **LIGHT** keyword, followed by its **CENTER** (a X, Y, - Z coordinate), its **RAD** (radius, a scalar), and its **COLOR** (a Red + simply write the ``LIGHT`` keyword, followed by its ``CENTER`` (a X, Y, + Z coordinate), its ``RAD`` (radius, a scalar), and its ``COLOR`` (a Red Green Blue triple). The radius parameter will accept any value of 0.0 or greater. Lights of radius 0.0 will not be directly visible in the rendered scene, but contribute light to the scene normally. For a light, @@ -372,7 +372,7 @@ class TachyonRT(SageObject): Spheres are the simplest object supported by RAY and they are also the fastest object to render. Spheres are defined as one would expect, with - a **CENTER**, **RAD** (radius), and a texture. The texture may be + a ``CENTER``, ``RAD`` (radius), and a texture. The texture may be defined along with the object as discussed earlier, or it may be declared and assigned a name. Here’s a sphere definition using a previously defined "NitrogenAtom" texture: @@ -443,7 +443,7 @@ class TachyonRT(SageObject): Useful for things like desert floors, backgrounds, skies etc, the infinite plane is pretty easy to use. An infinite plane only consists of - two pieces of information, the **CENTER** of the plane, and a **NORMAL** + two pieces of information, the ``CENTER`` of the plane, and a ``NORMAL`` to the plane. The center of the plane is just any point on the plane such that the point combined with the surface normal define the equation for the plane. As with triangles, planes are double sided. Here is an @@ -514,7 +514,7 @@ class TachyonRT(SageObject): This defines a finite cylinder with radius 1.0, going from 0.0 0.0 0.0, to 0.0 9.0 0.0 along the Y axis. The main difference between an infinite - cylinder and a finite cylinder is in the interpretation of the **AXIS** + cylinder and a finite cylinder is in the interpretation of the ``AXIS`` parameter. In the case of the infinite cylinder, the length of the axis vector is ignored. In the case of the finite cylinder, the axis parameter is used to determine the length of the overall cylinder. @@ -524,7 +524,7 @@ class TachyonRT(SageObject): Axis aligned boxes are fast, but of limited usefulness. As such, I’m not going to waste much time explaining ’em. An axis aligned box is defined - by a **MIN** point, and a **MAX** point. The volume between the min and + by a ``MIN`` point, and a ``MAX`` point. The volume between the min and max points is the box. Here’s a simple box: :: @@ -607,28 +607,28 @@ class TachyonRT(SageObject): The simplest texture definition is a solid color with no image mapping or procedural texture mapping. A solid color texture is defined by the - **AMBIENT**, **DIFFUSE**, **SPECULAR**, **OPACITY** and **COLOR** - parameters. The **AMBIENT** parameter defines the ambient lighting + ``AMBIENT``, ``DIFFUSE``, ``SPECULAR``, ``OPACITY`` and ``COLOR`` + parameters. The ``AMBIENT`` parameter defines the ambient lighting coefficient to be used when shading the object. Similarly, the - **DIFFUSE** parameter is the relative contribution of the diffuse - shading to the surface appearance. The **SPECULAR** parameter is the + ``DIFFUSE`` parameter is the relative contribution of the diffuse + shading to the surface appearance. The ``SPECULAR`` parameter is the contribution from perfectly reflected rays, as if on a mirrored surface. - **OPACITY** defines how transparent a surface is. An **OPACITY** value - of 0.0 renders the object completely invisible. An **OPACITY** value of + ``OPACITY`` defines how transparent a surface is. An ``OPACITY`` value + of 0.0 renders the object completely invisible. An ``OPACITY`` value of 1.0 makes the object completely solid, and non-transmissive. In general, the values for the ambient, diffuse, and specular parameters should add up to 1.0, if they don’t then pixels may be over or underexposed quite easily. These parameters function in a manner similar to that of other - ray tracers. The **COLOR** parameter is an RGB triple with each value + ray tracers. The ``COLOR`` parameter is an RGB triple with each value ranging from 0.0 to 1.0 inclusive. If the RGB values stray from 0.0 to 1.0, results are undefined. In the case of solid textures, a final - parameter, **TEXFUNC** is set to zero (integer). + parameter, ``TEXFUNC`` is set to zero (integer). Texture Declaration and Aliasing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To define a simple texture for use on several objects in a scene, the - **TEXDEF** keyword is used. The **TEXDEF** keyword is followed by a case + ``TEXDEF`` keyword is used. The ``TEXDEF`` keyword is followed by a case sensitive texture name, which will subsequently be used while defining objects. If many objects in a scene use the same texture through texture definition, a significant amount of memory may be saved since only one @@ -647,12 +647,12 @@ class TachyonRT(SageObject): check for use of keywords as texture names. When a texture is declared within an object definition, it appears in an - identical format to the **TEXDEF** declaration, but the **TEXTURE** - keyword is used instead of **TEXDEF**. If it is useful to have several + identical format to the ``TEXDEF`` declaration, but the ``TEXTURE`` + keyword is used instead of ``TEXDEF``. If it is useful to have several names for the same texture (when you are too lazy to actually finish defining different variations of a wood texture for example, and just want to be approximately correct for example) aliases can be constructed - using the **TEXALIAS** keyword, along with the alias name, and the + using the ``TEXALIAS`` keyword, along with the alias name, and the original name. An example of a texture alias is: :: From bcff99fbab52a9bafe61edf95ee2b8b6355adb38 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:31:01 -0700 Subject: [PATCH 303/338] src/sage/interfaces/tachyon.py: More fixes to mark up --- src/sage/interfaces/tachyon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index 444f22e9357..875f3551602 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -254,11 +254,11 @@ class TachyonRT(SageObject): Scene File Comments ------------------- - The **:math:`\#`** keyword is used anywhere after the camera + The ``#`` keyword is used anywhere after the camera description, and will cause RAY to ignore all characters from the - **:math:`\#`** to the end of the input line. The **:math:`\#`** + ``#`` to the end of the input line. The ``#`` character must be surrounded by whitespace in order to be recognized. A - sequence such as **:math:`\#\#\#`** will not be recognized as a comment. + sequence such as ``###`` will not be recognized as a comment. Lights ------ @@ -402,7 +402,7 @@ class TachyonRT(SageObject): three vertices of the triangle, and its texture. The order of the vertices isn’t important, the triangle object is "double sided", so the surface normal is always pointing back in the direction of the incident - ray. The triangle vertices are listed as **V1**, **V2**, and **V3** each + ray. The triangle vertices are listed as ``V1``, ``V2``, and ``V3`` each one is an X, Y, Z coordinate. An example of a triangle is shown below: :: From fc788853aee37573c9667e137a863e351b110c4a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:32:51 -0700 Subject: [PATCH 304/338] src/sage/interfaces/tachyon.py: Update doctest --- src/sage/interfaces/tachyon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index 875f3551602..a5b11f4cfab 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -861,7 +861,7 @@ def help(self, use_pager=True): sage: from sage.interfaces.tachyon import TachyonRT sage: t = TachyonRT() sage: t.help(use_pager=False) - This help, which was written by John Stone, describes ... + The Tachyon Ray Tracer... This help, which was written by John Stone, describes ... """ from sage.misc.sagedoc import format f = format(self.__doc__) From b24b06c98dfe9b570862d072c3a729399665296a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:36:01 -0700 Subject: [PATCH 305/338] src/sage/misc/sagedoc.py: Update doctest output --- src/sage/misc/sagedoc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index fe369cd0036..d2c1bac6b05 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -418,6 +418,10 @@ def process_dollars(s): sage: process_dollars('hello') 'hello' sage: process_dollars('some math: $x=y$') + doctest:warning... + DeprecationWarning: using dollar signs to mark up math in Sage docstrings + is deprecated; use backticks instead + See https://trac.sagemath.org/33973 for details. 'some math: `x=y`' Replace \\$ with $, and don't do anything when backticks are involved:: From 903e44ad3ac592275a455cbfc6beca557ea7f62b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:55:59 -0700 Subject: [PATCH 306/338] sage.schemes: Replace $...$ in docstrings by `...` (fixup) --- src/sage/schemes/toric/divisor.py | 2 +- src/sage/schemes/toric/weierstrass_higher.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index f0619f33dbf..ec5ea7db889 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1258,7 +1258,7 @@ def Kodaira_map(self, names='z'): r""" Return the Kodaira map. - The Kodaira map is the rational map $X_\Sigma \to + The Kodaira map is the rational map `X_\Sigma \to \mathbb{P}^{n-1}`, where `n` equals the number of sections. It is defined by the monomial sections of the line bundle. diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index 2f68532b48c..034d3ead9e4 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -16,8 +16,8 @@ sage: WeierstrassForm([quadratic1, quadratic2]) (-1/4, 0) -Hence, the Weierstrass form of this complete intersection is $Y^2 = -X^3 - \frac{1}{4} X Z^4$. +Hence, the Weierstrass form of this complete intersection is `Y^2 = +X^3 - \frac{1}{4} X Z^4`. """ #***************************************************************************** @@ -128,8 +128,8 @@ def _biquadratic_syzygy_quartic(quadratic1, quadratic2, variables=None): The invariants and covariants of a quaternary biquadratic satisfy the relation :meth:`sage.rings.invariant_theory.TwoQuaternaryQuadratics.syzygy`, - which is (modulo the two quadratic equations) of the form $J^2 = - p_4(T, T')$ where + which is (modulo the two quadratic equations) of the form `J^2 = + p_4(T, T')` where * `J`, `T`, `T'` are the covariants of the biquadratic. From a5adc4806f97d46facb88dfb572e17511d0e7a2c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:56:13 -0700 Subject: [PATCH 307/338] sage.plot: Replace $...$ in docstrings by `...` --- src/sage/plot/line.py | 2 +- src/sage/plot/plot3d/transform.pyx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/plot/line.py b/src/sage/plot/line.py index 511f9640943..e4b3b4ddc82 100644 --- a/src/sage/plot/line.py +++ b/src/sage/plot/line.py @@ -200,7 +200,7 @@ def __setitem__(self, i, point): EXAMPLES: - We create a line graphics object $L$ and get ahold of the + We create a line graphics object ``L`` and get ahold of the corresponding line graphics primitive:: sage: L = line([(1,2), (3,-4), (2, 5), (1,2)]) diff --git a/src/sage/plot/plot3d/transform.pyx b/src/sage/plot/plot3d/transform.pyx index aba8fa69598..7e91d30823b 100644 --- a/src/sage/plot/plot3d/transform.pyx +++ b/src/sage/plot/plot3d/transform.pyx @@ -199,25 +199,25 @@ def rotate_arbitrary(v, double theta): sage: def rotX(theta): return matrix(SR, 3, 3, [1, 0, 0, 0, cos(theta), -sin(theta), 0, sin(theta), cos(theta)]) sage: def rotZ(theta): return matrix(SR, 3, 3, [cos(theta), -sin(theta), 0, sin(theta), cos(theta), 0, 0, 0, 1]) - Normalizing $y$ so that $|v|=1$. Perhaps there is a better - way to tell Maxima that $x^2+y^2+z^2=1$ which would make for + Normalizing `y` so that `|v|=1`. Perhaps there is a better + way to tell Maxima that `x^2+y^2+z^2=1` which would make for a much cleaner calculation:: sage: vy = sqrt(1-vx^2-vz^2) - Now we rotate about the $x$-axis so $v$ is in the $xy$-plane:: + Now we rotate about the `x`-axis so `v` is in the `xy`-plane:: sage: t = arctan(vy/vz)+pi/2 sage: m = rotX(t) sage: new_y = vy*cos(t) - vz*sin(t) - And rotate about the $z$ axis so $v$ lies on the $x$ axis:: + And rotate about the `z` axis so `v` lies on the `x` axis:: sage: s = arctan(vx/new_y) + pi/2 sage: m = rotZ(s) * m - Rotating about $v$ in our old system is the same as rotating - about the $x$-axis in the new:: + Rotating about `v` in our old system is the same as rotating + about the `x`-axis in the new:: sage: m = rotX(theta) * m From eb98d68fc7f3f0ff47a61ff0c4ee8a0fd6cea941 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:56:25 -0700 Subject: [PATCH 308/338] sage.sets: Replace $...$ in docstrings by `...` --- src/sage/sets/real_set.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/sets/real_set.py b/src/sage/sets/real_set.py index 0cf6f27fc28..ce849c612e2 100644 --- a/src/sage/sets/real_set.py +++ b/src/sage/sets/real_set.py @@ -1350,7 +1350,7 @@ def get_interval(self, i): OUTPUT: - The $i$-th connected component as a :class:`RealInterval`. + The ``i``-th connected component as a :class:`RealInterval`. EXAMPLES:: From 8ff93695bf341c8aff86ecff3eb25476b84dc96c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:58:10 -0700 Subject: [PATCH 309/338] sage.modules: Replace $...$ in docstrings by `...` --- src/sage/modules/filtered_vector_space.py | 8 ++++---- src/sage/modules/multi_filtered_vector_space.py | 8 ++++---- src/sage/modules/tensor_operations.py | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/modules/filtered_vector_space.py b/src/sage/modules/filtered_vector_space.py index dd5784041eb..b56a64e111a 100644 --- a/src/sage/modules/filtered_vector_space.py +++ b/src/sage/modules/filtered_vector_space.py @@ -544,8 +544,8 @@ def is_exhaustive(self): r""" Return whether the filtration is exhaustive. - A filtration $\{F_d\}$ in an ambient vector space $V$ is - exhaustive if $\cup F_d = V$. See also :meth:`is_separating`. + A filtration `\{F_d\}` in an ambient vector space `V` is + exhaustive if `\cup F_d = V`. See also :meth:`is_separating`. OUTPUT: @@ -569,8 +569,8 @@ def is_separating(self): r""" Return whether the filtration is separating. - A filtration $\{F_d\}$ in an ambient vector space $V$ is - exhaustive if $\cap F_d = 0$. See also :meth:`is_exhaustive`. + A filtration `\{F_d\}` in an ambient vector space `V` is + exhaustive if `\cap F_d = 0`. See also :meth:`is_exhaustive`. OUTPUT: diff --git a/src/sage/modules/multi_filtered_vector_space.py b/src/sage/modules/multi_filtered_vector_space.py index 61e4754452e..18d87cc1197 100644 --- a/src/sage/modules/multi_filtered_vector_space.py +++ b/src/sage/modules/multi_filtered_vector_space.py @@ -238,8 +238,8 @@ def is_exhaustive(self): r""" Return whether the multi-filtration is exhaustive. - A filtration $\{F_d\}$ in an ambient vector space $V$ is - exhaustive if $\cup F_d = V$. See also :meth:`is_separating`. + A filtration `\{F_d\}` in an ambient vector space `V` is + exhaustive if `\cup F_d = V`. See also :meth:`is_separating`. OUTPUT: @@ -260,8 +260,8 @@ def is_separating(self): r""" Return whether the multi-filtration is separating. - A filtration $\{F_d\}$ in an ambient vector space $V$ is - exhaustive if $\cap F_d = 0$. See also :meth:`is_exhaustive`. + A filtration `\{F_d\}` in an ambient vector space `V` is + exhaustive if `\cap F_d = 0`. See also :meth:`is_exhaustive`. OUTPUT: diff --git a/src/sage/modules/tensor_operations.py b/src/sage/modules/tensor_operations.py index ce3bd555434..d6f2144a61d 100644 --- a/src/sage/modules/tensor_operations.py +++ b/src/sage/modules/tensor_operations.py @@ -25,7 +25,7 @@ (1, -1) In a convenient choice of basis, the tensor product is -$(a,b)\otimes(c,d)=(ac,ad,bc,bd)$. In this example, it is one of the +`(a,b)\otimes(c,d)=(ac,ad,bc,bd)`. In this example, it is one of the vectors of the vector collection ``VW`` :: sage: VW.index_map(0, 1) @@ -308,9 +308,9 @@ def _init_product_vectors(self, i): INPUT: - `i` -- list/tuple of integers. Multi-index of length equal - to the number of constituent vector collections. The $j$-th - entry $i[j]$ indexes a ray in the $j$-th vector - collection. Hence, $i$ specifies one element in each vector + to the number of constituent vector collections. The `j`-th + entry `i[j]` indexes a ray in the `j`-th vector + collection. Hence, `i` specifies one element in each vector collection. OUTPUT: @@ -326,7 +326,7 @@ def _init_product_vectors(self, i): .. NOTE:: In a convenient choice of coordinates the tensor product - of, say, two vectors $(a,b)$ and $(c,d)$, is $(ac, ad, bc, + of, say, two vectors `(a,b)` and `(c,d)`, is `(ac, ad, bc, bd)$. EXAMPLES:: @@ -370,7 +370,7 @@ def _init_power_operation_vectors(self, i, linear_combinations): :meth:`_init_product_vector`. - ``linear_combination`` -- formal linear combination of - vector indices in the vectors specified by $i$. + vector indices in the vectors specified by `i`. EXAMPLES:: From 47b9894fcf30327a57b5ad4649b572d278070806 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 14:59:54 -0700 Subject: [PATCH 310/338] src/sage/probability/probability_distribution.pyx: Fix math markup --- src/sage/probability/probability_distribution.pyx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index 22fcc0c0090..a76518b7969 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -986,7 +986,7 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): EXAMPLES: Constructs a ``GeneralDiscreteDistribution`` with the probability - distribution `$P$` where `$P(0) = 0.3$`, `$P(1) = 0.4$`, `$P(2) = 0.3$`:: + distribution `P` where `P(0) = 0.3`, `P(1) = 0.4`, `P(2) = 0.3`:: sage: P = [0.3, 0.4, 0.3] sage: X = GeneralDiscreteDistribution(P) @@ -1004,7 +1004,6 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): sage: [1.0*x/nr_samples for x in counts] # abs tol 3e-2 [0.3, 0.4, 0.3] - The distribution probabilities will automatically be normalised:: sage: P = [0.1, 0.3] From 089d6fb57d7a527a5bf0789dab742b500edb7f1a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:02:46 -0700 Subject: [PATCH 311/338] sage.modular: Replace $...$ in docstrings by `...` --- src/sage/modular/abvar/abvar.py | 6 +++--- src/sage/modular/arithgroup/congroup.pyx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/modular/abvar/abvar.py b/src/sage/modular/abvar/abvar.py index c0834b3b804..80467d9b5b0 100644 --- a/src/sage/modular/abvar/abvar.py +++ b/src/sage/modular/abvar/abvar.py @@ -2871,9 +2871,9 @@ def _ambient_cuspidal_subgroup(self, rational_only=False, rational_subgroup=Fals def shimura_subgroup(self): r""" Return the Shimura subgroup of this modular abelian variety. This is - the kernel of $J_0(N) \rightarrow J_1(N)$ under the natural map. + the kernel of `J_0(N) \rightarrow J_1(N)` under the natural map. Here we compute the Shimura subgroup as the kernel of - $J_0(N) \rightarrow J_0(Np)$ where the map is the difference between the + `J_0(N) \rightarrow J_0(Np)` where the map is the difference between the two degeneracy maps. EXAMPLES:: @@ -3623,7 +3623,7 @@ def _isogeny_to_product_of_powers(self): `\phi: A \rightarrow B_1 \times \cdots \times B_n`, where each `B_i` is a power of a simple abelian variety. These factors will be exactly those returned by - self.decomposition(simple=False).Note that this isogeny is not + ``self.decomposition(simple=False)``. Note that this isogeny is not unique. EXAMPLES:: diff --git a/src/sage/modular/arithgroup/congroup.pyx b/src/sage/modular/arithgroup/congroup.pyx index 3cb2a84b334..1f20ebfb478 100644 --- a/src/sage/modular/arithgroup/congroup.pyx +++ b/src/sage/modular/arithgroup/congroup.pyx @@ -70,7 +70,7 @@ def degeneracy_coset_representatives_gamma0(int N, int M, int t): ALGORITHM: - 1. Compute representatives for $\Gamma_0(N/t,t)$ inside of $\Gamma_0(M)$: + 1. Compute representatives for `\Gamma_0(N/t,t)` inside of `\Gamma_0(M)`: + COSET EQUIVALENCE: Two right cosets represented by `[a,b;c,d]` and `[a',b';c',d']` of `\Gamma_0(N/t,t)` in `\SL_2(\ZZ)` are equivalent if From b18479b647983ddb2a1467eb828063076a238618 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:05:12 -0700 Subject: [PATCH 312/338] src/sage/interfaces/qepcad.py: Replace $...$ in docstrings by `...` --- src/sage/interfaces/qepcad.py | 122 +++++++++++++++++----------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/src/sage/interfaces/qepcad.py b/src/sage/interfaces/qepcad.py index c2e6c00ec48..e83f5dedeeb 100644 --- a/src/sage/interfaces/qepcad.py +++ b/src/sage/interfaces/qepcad.py @@ -3,31 +3,31 @@ =================== The basic function of QEPCAD is to construct cylindrical algebraic -decompositions (CADs) of $\RR^k$, given a list of polynomials. Using +decompositions (CADs) of `\RR^k`, given a list of polynomials. Using this CAD, it is possible to perform quantifier elimination and formula simplification. -A CAD for a set $A$ of $k$-variate polynomials decomposes $\RR^j$ into -disjoint cells, for each $j$ in $0 \leq j \leq k$. The sign of each -polynomial in $A$ is constant in each cell of $\RR^k$, and for each -cell in $\RR^j$ ($j > 1$), the projection of that cell into -$\RR^{j-1}$ is a cell of $\RR^{j-1}$. (This property makes the +A CAD for a set `A` of `k`-variate polynomials decomposes `\RR^j` into +disjoint cells, for each `j` in `0 \leq j \leq k`. The sign of each +polynomial in `A` is constant in each cell of `\RR^k`, and for each +cell in `\RR^j` (`j > 1`), the projection of that cell into +`\RR^{j-1}` is a cell of `\RR^{j-1}`. (This property makes the decomposition 'cylindrical'.) -Given a formula $\exists x. P(a,b,x) = 0$ (for a polynomial $P$), and -a cylindrical algebraic decomposition for $P$, we can eliminate the -quantifier (find an equivalent formula in the two variables $a$, $b$ -without the quantifier $\exists$) as follows. For each cell $C$ in -$\RR^2$, find the cells of $\RR^3$ which project to $C$. (This -collection is called the ``stack`` over $C$.) Mark $C$ as true if -some member of the stack has sign $= 0$; otherwise, mark $C$ as false. -Then, construct a polynomial formula in $a$, $b$ which specifies +Given a formula `\exists x. P(a,b,x) = 0` (for a polynomial `P`), and +a cylindrical algebraic decomposition for `P`, we can eliminate the +quantifier (find an equivalent formula in the two variables `a`, `b` +without the quantifier `\exists`) as follows. For each cell `C` in +`\RR^2`, find the cells of `\RR^3` which project to `C`. (This +collection is called the ``stack`` over `C`.) Mark `C` as true if +some member of the stack has sign `= 0`; otherwise, mark `C` as false. +Then, construct a polynomial formula in `a`, `b` which specifies exactly the true cells (this is always possible). The same technique works if the body of the quantifier is any boolean combination of polynomial equalities and inequalities. Formula simplification is a similar technique. Given a formula which -describes a simple set of $\RR^k$ in a complicated way as a boolean +describes a simple set of `\RR^k` in a complicated way as a boolean combination of polynomial equalities and inequalities, QEPCAD can construct a CAD for the polynomials and recover a simple equivalent formula. @@ -64,7 +64,7 @@ sage: ellipse = 3*x^2 + 2*x*y + y^2 - x + y - 7 -What is the projection onto the $x$ axis of this ellipse? First we +What is the projection onto the `x` axis of this ellipse? First we construct a formula asking this question. :: sage: F = qf.exists(y, ellipse == 0); F @@ -75,7 +75,7 @@ sage: qepcad(F) # optional - qepcad 8 x^2 - 8 x - 29 <= 0 -How about the projection onto the $y$ axis? :: +How about the projection onto the `y` axis? :: sage: qepcad(qf.exists(x, ellipse == 0)) # optional - qepcad 8 y^2 + 16 y - 85 <= 0 @@ -90,7 +90,7 @@ sage: circle = x^2 + y^2 - 3 -For what values $k$ does a vertical line $x=k$ intersect the combined +For what values `k` does a vertical line `x=k` intersect the combined figure of the circle and ellipse exactly three times? :: sage: F = qf.exactly_k(3, y, circle * ellipse == 0); F @@ -98,7 +98,7 @@ sage: qepcad(F) # not tested (random order) x^2 - 3 <= 0 /\ 8 x^2 - 8 x - 29 <= 0 /\ 8 x^4 - 26 x^2 - 4 x + 13 >= 0 /\ [ 8 x^4 - 26 x^2 - 4 x + 13 = 0 \/ x^2 - 3 = 0 \/ 8 x^2 - 8 x - 29 = 0 ] -Here we see that the solutions are among the eight ($4 + 2 + 2$) roots +Here we see that the solutions are among the eight (`4 + 2 + 2`) roots of the three polynomials inside the brackets, but not all of these roots are solutions; the polynomial inequalities outside the brackets are needed to select those roots that are solutions. @@ -168,7 +168,7 @@ There is another reason to prefer output using _root_ expressions; not only does it sometimes give added insight into the geometric structure, it also can be more efficient to construct. Consider this -formula for the projection of a particular semicircle onto the $x$ +formula for the projection of a particular semicircle onto the `x` axis:: sage: F = qf.exists(y, qf.and_(circle == 0, x + y > 0)); F @@ -176,9 +176,9 @@ sage: qepcad(F) # not tested (random order) x^2 - 3 <= 0 /\ [ x > 0 \/ 2 x^2 - 3 < 0 ] -Here, the formula $x > 0$ had to be introduced in order to get a +Here, the formula `x > 0` had to be introduced in order to get a solution formula; the original CAD of F did not include the -polynomial $x$. To avoid having QEPCAD do the extra work to come up +polynomial `x`. To avoid having QEPCAD do the extra work to come up with a solution formula, we can tell it to use the extended language; it is always possible to construct a solution formula in the extended language without introducing new polynomials. :: @@ -251,7 +251,7 @@ sage: pts = qepcad(F, solution='all-points'); pts # optional - qepcad [{'x': 1.732050807568878?}, {'x': 1.731054913462534?}, {'x': 0.678911384208004?}, {'x': -0.9417727377417167?}, {'x': -1.468193559928821?}, {'x': -1.468501968502953?}] -Since $y$ is bound by the quantifier, the solutions only refer to $x$. +Since `y` is bound by the quantifier, the solutions only refer to `x`. We can substitute one of these solutions into the original equation:: @@ -339,19 +339,19 @@ We said before that QEPCAD creates 'cylindrical algebraic decompositions'; since we have a bivariate polynomial, we get -decompositions of $\RR^0$, $\RR^1$, and $\RR^2$. In this case, where -our example is a circle of radius $\sqrt{3}$ centered on the origin, +decompositions of `\RR^0`, `\RR^1`, and `\RR^2`. In this case, where +our example is a circle of radius `\sqrt{3}` centered on the origin, these decompositions are as follows: -The decomposition of $\RR^0$ is trivial (of course). The -decomposition of $\RR^1$ has five cells: $x < -\sqrt{3}$, $x = --\sqrt{3}$, $-\sqrt{3} < x < \sqrt{3}$, $x = \sqrt{3}$, and $x > -\sqrt{3}$. These five cells comprise the ``stack`` over the single -cell in the trivial decomposition of $\RR^0$. +The decomposition of `\RR^0` is trivial (of course). The +decomposition of `\RR^1` has five cells: `x < -\sqrt{3}`, `x = +-\sqrt{3}`, `-\sqrt{3} < x < \sqrt{3}`, `x = \sqrt{3}`, and `x > +\sqrt{3}`. These five cells comprise the ``stack`` over the single +cell in the trivial decomposition of `\RR^0`. -These five cells give rise to five stacks in $\RR^2$. The first and +These five cells give rise to five stacks in `\RR^2`. The first and fifth stack have just one cell apiece. The second and fourth stacks -have three cells: $y < 0$, $y = 0$, and $y > 0$. The third stack has +have three cells: `y < 0`, `y = 0`, and `y > 0`. The third stack has five cells: below the circle, the lower semicircle, the interior of the circle, the upper semicircle, and above the circle. @@ -359,7 +359,7 @@ starting with 1. Each cell has an ``index``, which is a tuple of integers describing the path to the cell in the tree of all cells. For example, the cell 'below the circle' has index (3,1) (the first -cell in the stack over the third cell of $\RR^1$) and the interior of +cell in the stack over the third cell of `\RR^1`) and the interior of the circle has index (3,3). We can view these cells with the QEPCAD command ``d_cell``. For @@ -389,7 +389,7 @@ ---------------------------------------------------- We see that, the level of this cell is 2, meaning that it is part of -the decomposition of $\RR^2$. The dimension is 1, meaning that the +the decomposition of `\RR^2`. The dimension is 1, meaning that the cell is homeomorphic to a line (rather than a plane or a point). The sample point gives the coordinates of one point in the cell, both symbolically and numerically. @@ -482,8 +482,8 @@ QEPCAD object has moved to phase 'Before Choice' QEPCAD object has moved to phase 'Before Solution' -Now we want to find all cells $c$ in the decomposition of $\RR^1$ such -that the stack over $c$ contains exactly two cells on the ellipse, and +Now we want to find all cells `c` in the decomposition of `\RR^1` such +that the stack over `c` contains exactly two cells on the ellipse, and also contains exactly two cells on the circle. Our input polynomials are 'level-2 projection factors', we see:: @@ -792,7 +792,7 @@ def __init__(self, formula, Requires a formula, which may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or inequality, a - polynomial $p$ (meaning $p = 0$), or a string, which is passed + polynomial `p` (meaning `p = 0`), or a string, which is passed straight to QEPCAD. ``vars`` specifies the variables to use; this gives the variable @@ -1470,7 +1470,7 @@ def qepcad(formula, assume=None, interact=False, solution=None, sage: qepcad(qf.exists(x, a*x^2 + b*x + c == 0), assume=(a != 0)) # optional - qepcad 4 a c - b^2 <= 0 - For which values of $a$, $b$, $c$ does $a x^2 + b x + c$ have + For which values of `a`, `b`, `c` does `a x^2 + b x + c` have 2 real zeroes? :: sage: exact2 = qepcad(qf.exactly_k(2, x, a*x^2 + b*x + c == 0)); exact2 # not tested (random order) @@ -1486,7 +1486,7 @@ def qepcad(formula, assume=None, interact=False, solution=None, sage: exact0 = qepcad(qf.forall(x, a*x^2 + b*x + c != 0)); exact0 # not tested (random order) 4 a c - b^2 >= 0 /\ c /= 0 /\ [ b = 0 \/ 4 a c - b^2 > 0 ] - $3^{75}$ real zeroes? :: + `3^{75}` real zeroes? :: sage: qepcad(qf.exactly_k(3^75, x, a*x^2 + b*x + c == 0)) # optional - qepcad FALSE @@ -1505,7 +1505,7 @@ def qepcad(formula, assume=None, interact=False, solution=None, sage: qepcad(r'[[%s] \/ [%s] \/ [%s]]' % (exact0, exact1, exact2), vars=(a,b,c)) # not tested (random order) b /= 0 \/ a /= 0 \/ c /= 0 - So we have finitely many zeroes if $a$, $b$, or $c$ is nonzero; + So we have finitely many zeroes if `a`, `b`, or `c` is nonzero; which means we should have infinitely many zeroes if they are all zero. :: @@ -1532,7 +1532,7 @@ def qepcad(formula, assume=None, interact=False, solution=None, sage: qepcad(r'[[%s] \/ [%s] \/ [a = 0 /\ b = 0 /\ c = 0]]' % (exact0, exact1), vars='a,b,c') # not tested (random order) a = 0 \/ 4 a c - b^2 >= 0 - Since polynomials are continuous and $y > 0$ is an open set, + Since polynomials are continuous and `y > 0` is an open set, they are positive infinitely often iff they are positive at least once. :: @@ -1541,9 +1541,9 @@ def qepcad(formula, assume=None, interact=False, solution=None, sage: qepcad(qf.exists(x, a*x^2 + b*x + c > 0)) # not tested (random order) c > 0 \/ a > 0 \/ 4 a c - b^2 < 0 - However, since $y >= 0$ is not open, the equivalence does not + However, since `y >= 0` is not open, the equivalence does not hold if you replace 'positive' with 'nonnegative'. - (We assume $a \neq 0$ to get simpler formulas.) :: + (We assume `a \neq 0` to get simpler formulas.) :: sage: qepcad(qf.infinitely_many(x, a*x^2 + b*x + c >= 0), assume=(a != 0)) # not tested (random order) a > 0 \/ 4 a c - b^2 < 0 @@ -1944,7 +1944,7 @@ def formula(self, formula): - ``formula`` -- a polynomial, a symbolic equality or inequality, or a list of polynomials, equalities, or inequalities - A polynomial $p$ is interpreted as the equation $p = 0$. + A polynomial `p` is interpreted as the equation `p = 0`. A list is interpreted as the conjunction ('and') of the elements. EXAMPLES:: @@ -1971,7 +1971,7 @@ def and_(self, *formulas): Each input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -1997,7 +1997,7 @@ def or_(self, *formulas): Each input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2023,7 +2023,7 @@ def not_(self, formula): The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2044,11 +2044,11 @@ def not_(self, formula): def implies(self, f1, f2): r""" Return the implication of its input formulas (that is, given - formulas $P$ and $Q$, returns '$P$ implies $Q$'). + formulas `P` and `Q`, returns '`P` implies `Q`'). The input formulas may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2070,11 +2070,11 @@ def implies(self, f1, f2): def iff(self, f1, f2): r""" Return the equivalence of its input formulas (that is, given - formulas $P$ and $Q$, returns '$P$ iff $Q$'). + formulas `P` and `Q`, returns '`P` iff `Q`'). The input formulas may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2100,7 +2100,7 @@ def exists(self, v, formula): The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2127,7 +2127,7 @@ def forall(self, v, formula): The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2155,7 +2155,7 @@ def infinitely_many(self, v, formula): The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2181,7 +2181,7 @@ def all_but_finitely_many(self, v, formula): The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2208,7 +2208,7 @@ def connected_subset(self, v, formula, allow_multi=False): The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: @@ -2225,20 +2225,20 @@ def connected_subset(self, v, formula, allow_multi=False): def exactly_k(self, k, v, formula, allow_multi=False): r""" - Given a nonnegative integer $k$, a variable, and a formula, + Given a nonnegative integer `k`, a variable, and a formula, returns a new formula which is true iff the original formula - is true for exactly $k$ values of the variable. + is true for exactly `k` values of the variable. This method is available both as :meth:`exactly_k` and :meth:`X` (the QEPCAD name for this quantifier). - (Note that QEPCAD does not support $k=0$ with this syntax, so if - $k=0$ is requested we implement it with :meth:`forall` and + (Note that QEPCAD does not support `k=0` with this syntax, so if + `k=0` is requested we implement it with :meth:`forall` and :meth:`not_`.) The input formula may be a :class:`qformula` as returned by the methods of ``qepcad_formula``, a symbolic equality or - inequality, or a polynomial $p$ (meaning $p = 0$). + inequality, or a polynomial `p` (meaning `p = 0`). EXAMPLES:: From 65d1b6832d96cea235caf0670e4b0d4336991fdf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:06:11 -0700 Subject: [PATCH 313/338] src/sage/interfaces/r.py: Replace $...$ in docstrings by `...` --- src/sage/interfaces/r.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/interfaces/r.py b/src/sage/interfaces/r.py index 1e0d6ff73b1..6b1f601b563 100644 --- a/src/sage/interfaces/r.py +++ b/src/sage/interfaces/r.py @@ -22,7 +22,7 @@ The simplest data structure in R is the numeric vector which consists of an ordered collection of numbers. To create a -vector named $x$ using the R interface in Sage, you pass the +vector named `x` using the R interface in Sage, you pass the R interpreter object a list or tuple of numbers:: sage: x = r([10.4,5.6,3.1,6.4,21.7]); x # optional - rpy2 @@ -36,16 +36,16 @@ sage: 1/x # optional - rpy2 [1] 0.09615385 0.17857143 0.32258065 0.15625000 0.04608295 -The following assignment creates a vector $y$ with 11 entries which -consists of two copies of $x$ with a 0 in between:: +The following assignment creates a vector `y` with 11 entries which +consists of two copies of `x` with a 0 in between:: sage: y = r([x,0,x]); y # optional - rpy2 [1] 10.4 5.6 3.1 6.4 21.7 0.0 10.4 5.6 3.1 6.4 21.7 Vector Arithmetic -The following command generates a new vector $v$ of length 11 constructed -by adding together (element by element) $2x$ repeated 2.2 times, $y$ +The following command generates a new vector `v` of length 11 constructed +by adding together (element by element) `2x` repeated 2.2 times, `y` repeated just once, and 1 repeated 11 times:: sage: v = 2*x+y+1; v # optional - rpy2 From 91885fafc48cd4c7fdc9a4b8a11889b63f645284 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:08:16 -0700 Subject: [PATCH 314/338] src/sage/lfunctions/zero_sums.pyx: Replace $...$ in docstrings by `...` --- src/sage/lfunctions/zero_sums.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/lfunctions/zero_sums.pyx b/src/sage/lfunctions/zero_sums.pyx index 4a71c1e84eb..a67ad9d8ebb 100644 --- a/src/sage/lfunctions/zero_sums.pyx +++ b/src/sage/lfunctions/zero_sums.pyx @@ -1002,7 +1002,7 @@ cdef class LFunctionZeroSum_EllipticCurve(LFunctionZeroSum_abstract): The returned value is zero if `n` is not a perfect prime power; when `n=p^e` for `p` a prime of bad reduction it is `-a_p^e log(p)/p^e`, - where `a_p` is `+1, -1` or `0` according to the reduction type of $p$; + where `a_p` is `+1, -1` or `0` according to the reduction type of `p`; and when `n=p^e` for a prime `p` of good reduction, the value is `-(\alpha_p^e + \beta_p^e) \log(p)/p^e`, where `\alpha_p` and `\beta_p` are the two complex roots of the characteristic equation From ce9e3647b7805f178cedb866ec2f5edf0a02f3fd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:10:15 -0700 Subject: [PATCH 315/338] src/sage/manifolds/differentiable/examples/euclidean.py: Replace $...$ in docstrings by `...` --- src/sage/manifolds/differentiable/examples/euclidean.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/manifolds/differentiable/examples/euclidean.py b/src/sage/manifolds/differentiable/examples/euclidean.py index d508003d301..8b3cb23531d 100644 --- a/src/sage/manifolds/differentiable/examples/euclidean.py +++ b/src/sage/manifolds/differentiable/examples/euclidean.py @@ -2480,7 +2480,7 @@ def scalar_triple_product(self, name=None, latex_name=None): \epsilon(u,v,w) = u \cdot (v \times w). - The scalar triple product operator $\epsilon$ is a *3-form*, i.e. a + The scalar triple product operator `\epsilon` is a *3-form*, i.e. a field of fully antisymmetric trilinear forms; it is also called the *volume form* of `E` or the *Levi-Civita tensor* of `E`. @@ -2494,7 +2494,7 @@ def scalar_triple_product(self, name=None, latex_name=None): OUTPUT: - - the scalar triple product operator $\epsilon$, as an instance of + - the scalar triple product operator `\epsilon`, as an instance of :class:`~sage.manifolds.differentiable.diff_form.DiffFormParal` EXAMPLES:: From 53d36469831f0ad0460b0a5e0f824ab6b2ba8d54 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:11:26 -0700 Subject: [PATCH 316/338] sage.quadratic_forms: Replace $...$ in docstrings by `...` --- src/sage/quadratic_forms/genera/normal_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/quadratic_forms/genera/normal_form.py b/src/sage/quadratic_forms/genera/normal_form.py index 51bf5a64b45..4744e3d079e 100644 --- a/src/sage/quadratic_forms/genera/normal_form.py +++ b/src/sage/quadratic_forms/genera/normal_form.py @@ -159,7 +159,7 @@ def p_adic_normal_form(G, p, precision=None, partial=False, debug=False): [1 2] For `p=2` the partial normal form is a block diagonal matrix with blocks - `2^k G_k` such that $G_k$ is a block diagonal matrix of the form + `2^k G_k` such that `G_k` is a block diagonal matrix of the form `[U`, ... , `U`, `V`, `Wa`, `Wb]` where we allow `V`, `Wa`, `Wb` to be `0 \times 0` matrices. From b72f0f9458bef5cd6fb3d632596374bd7b304d20 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 11 Jun 2022 15:19:34 -0700 Subject: [PATCH 317/338] sage.libs: Replace $...$ in docstrings by `...` --- src/sage/libs/eclib/homspace.pyx | 2 +- src/sage/libs/eclib/newforms.pyx | 6 +++--- src/sage/libs/flint/fmpz_poly.pyx | 4 ++-- src/sage/libs/ntl/ntl_GF2X.pyx | 4 ++-- src/sage/libs/ntl/ntl_ZZX.pyx | 24 ++++++++++++------------ src/sage/libs/ntl/ntl_ZZ_p.pyx | 6 +++--- src/sage/libs/ntl/ntl_ZZ_pE.pyx | 6 +++--- src/sage/libs/ntl/ntl_ZZ_pEX.pyx | 10 +++++----- src/sage/libs/ntl/ntl_lzz_p.pyx | 2 +- src/sage/libs/ntl/ntl_lzz_pX.pyx | 14 +++++++------- src/sage/libs/ntl/ntl_mat_GF2.pyx | 8 ++++---- src/sage/libs/ntl/ntl_mat_GF2E.pyx | 4 ++-- src/sage/libs/ntl/ntl_mat_ZZ.pyx | 20 ++++++++++---------- src/sage/libs/symmetrica/sb.pxi | 4 ++-- 14 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/sage/libs/eclib/homspace.pyx b/src/sage/libs/eclib/homspace.pyx index 5f284139363..9868795ab20 100644 --- a/src/sage/libs/eclib/homspace.pyx +++ b/src/sage/libs/eclib/homspace.pyx @@ -108,7 +108,7 @@ cdef class ModularSymbols: def number_of_cusps(self): r""" - Return the number of cusps for $\Gamma_0(N)$, where $N$ is the + Return the number of cusps for `\Gamma_0(N)`, where `N` is the level. EXAMPLES:: diff --git a/src/sage/libs/eclib/newforms.pyx b/src/sage/libs/eclib/newforms.pyx index 82364945a0d..d30ac0e3758 100644 --- a/src/sage/libs/eclib/newforms.pyx +++ b/src/sage/libs/eclib/newforms.pyx @@ -32,18 +32,18 @@ cdef class ECModularSymbol: sage: M = ECModularSymbol(E,1); M Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field - By default, symbols are based at the cusp $\infty$, i.e. we evaluate $\{\infty,r\}$:: + By default, symbols are based at the cusp `\infty`, i.e. we evaluate `\{\infty,r\}`:: sage: [M(1/i) for i in range(1,11)] [2/5, -8/5, -3/5, 7/5, 12/5, 12/5, 7/5, -3/5, -8/5, 2/5] - We can also switch the base point to the cusp $0$:: + We can also switch the base point to the cusp `0`:: sage: [M(1/i, base_at_infinity=False) for i in range(1,11)] [0, -2, -1, 1, 2, 2, 1, -1, -2, 0] For the minus symbols this makes no difference since - $\{0,\infty\}$ is in the plus space. Note that to evaluate minus + `\{0,\infty\}` is in the plus space. Note that to evaluate minus symbols the space must be defined with sign 0, which makes both signs available:: diff --git a/src/sage/libs/flint/fmpz_poly.pyx b/src/sage/libs/flint/fmpz_poly.pyx index ba7f81d7143..d894478ba60 100644 --- a/src/sage/libs/flint/fmpz_poly.pyx +++ b/src/sage/libs/flint/fmpz_poly.pyx @@ -74,7 +74,7 @@ cdef class Fmpz_poly(SageObject): def __setitem__(self, i, value): """ - Set the $i$-th item of self, which is the coefficient of the $x^i$ term. + Set the `i`-th item of self, which is the coefficient of the `x^i` term. EXAMPLES:: @@ -93,7 +93,7 @@ cdef class Fmpz_poly(SageObject): def __getitem__(self, i): """ - Return the $i$-th item of self, which is the coefficient of the $x^i$ term. + Return the `i`-th item of self, which is the coefficient of the `x^i` term. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_GF2X.pyx b/src/sage/libs/ntl/ntl_GF2X.pyx index 8aa4c43d348..101f36bb895 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pyx +++ b/src/sage/libs/ntl/ntl_GF2X.pyx @@ -368,7 +368,7 @@ cdef class ntl_GF2X(object): def __lshift__(ntl_GF2X self, int i): """ Return left shift of self by i bits ( == multiplication by - $X^i$). + `X^i`). INPUT: i -- offset/power of X @@ -387,7 +387,7 @@ cdef class ntl_GF2X(object): def __rshift__(ntl_GF2X self, int offset): """ Return right shift of self by i bits ( == floor division by - $X^i$). + `X^i`). INPUT: i -- offset/power of X diff --git a/src/sage/libs/ntl/ntl_ZZX.pyx b/src/sage/libs/ntl/ntl_ZZX.pyx index 8c596bd23a6..7f4d7a6366d 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pyx +++ b/src/sage/libs/ntl/ntl_ZZX.pyx @@ -81,7 +81,7 @@ cdef proof_flag(t): cdef class ntl_ZZX(object): r""" - The class \class{ZZX} implements polynomials in $\Z[X]$, i.e., + The class \class{ZZX} implements polynomials in `\Z[X]`, i.e., univariate polynomials with integer coefficients. Polynomial multiplication is very fast, and is implemented using @@ -703,11 +703,11 @@ cdef class ntl_ZZX(object): function computes s and t such that: a*s + b*t = r; otherwise s and t are both 0. If proof = False (*not* the default), then resultant computation may use a randomized strategy that - errors with probability no more than $2^{-80}$. The default is + errors with probability no more than `2^{-80}`. The default is default is proof=None, see proof.polynomial or sage.structure.proof, but the global default is True), then this function may use a randomized strategy that errors with probability no more than - $2^{-80}$. + `2^{-80}`. EXAMPLES:: @@ -929,7 +929,7 @@ cdef class ntl_ZZX(object): def invert_and_truncate(self, long m): """ - Compute and return the inverse of self modulo $x^m$. + Compute and return the inverse of self modulo `x^m`. The constant term of self must be 1 or -1. EXAMPLES:: @@ -983,7 +983,7 @@ cdef class ntl_ZZX(object): def trace_list(self): """ - Return the list of traces of the powers $x^i$ of the + Return the list of traces of the powers `x^i` of the monomial x modulo this polynomial for i = 0, ..., deg(f)-1. This polynomial must be monic. @@ -1016,7 +1016,7 @@ cdef class ntl_ZZX(object): default is proof=None, see proof.polynomial or sage.structure.proof, but the global default is True), then this function may use a randomized strategy that errors with probability no more than - $2^{-80}$. + `2^{-80}`. EXAMPLES:: @@ -1041,7 +1041,7 @@ cdef class ntl_ZZX(object): is proof=None, see proof.polynomial or sage.structure.proof, but the global default is proof=True) then it may use a randomized strategy that errors with probability no more than - $2^{-80}$. + `2^{-80}`. EXAMPLES:: @@ -1070,7 +1070,7 @@ cdef class ntl_ZZX(object): proof.polynomial or sage.structure.proof, but the global default is proof=True), then this function may use a randomized strategy that errors with probability no more than - $2^{-80}$. + `2^{-80}`. EXAMPLES:: @@ -1096,7 +1096,7 @@ cdef class ntl_ZZX(object): proof.polynomial or sage.structure.proof, but the global default is proof=True), then this function may use a randomized strategy that errors with probability no more than - $2^{-80}$. + `2^{-80}`. EXAMPLES:: @@ -1115,7 +1115,7 @@ cdef class ntl_ZZX(object): Return the minimal polynomial of this polynomial modulo the modulus. The modulus must be monic of degree bigger than self. In all cases, this function may use a randomized - strategy that errors with probability no more than $2^{-80}$. + strategy that errors with probability no more than `2^{-80}`. EXAMPLES:: @@ -1124,8 +1124,8 @@ cdef class ntl_ZZX(object): sage: f.charpoly_mod(g) [0 0 0 0 1] - However, since $f^2 = 0$ modulo $g$, its minimal polynomial - is of degree $2$:: + However, since `f^2 = 0` modulo `g`, its minimal polynomial + is of degree `2`:: sage: f.minpoly_mod_noproof(g) [0 0 1] diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pyx b/src/sage/libs/ntl/ntl_ZZ_p.pyx index 114963b1882..dcb13030882 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_p.pyx @@ -76,11 +76,11 @@ def ntl_ZZ_p_random_element(v): ############################################################################## cdef class ntl_ZZ_p(object): r""" - The \class{ZZ_p} class is used to represent integers modulo $p$. - The modulus $p$ may be any positive integer, not necessarily prime. + The \class{ZZ_p} class is used to represent integers modulo `p`. + The modulus `p` may be any positive integer, not necessarily prime. Objects of the class \class{ZZ_p} are represented as a \code{ZZ} in the - range $0, \ldots, p-1$. + range `0, \ldots, p-1`. Each \class{ZZ_p} contains a pointer of a \class{ZZ_pContext} which contains pre-computed data for NTL. These can be explicitly constructed diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pyx b/src/sage/libs/ntl/ntl_ZZ_pE.pyx index 6e3684521de..b809099baa8 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pyx @@ -56,12 +56,12 @@ ZZ_sage = IntegerRing() ############################################################################## cdef class ntl_ZZ_pE(object): r""" - The \class{ZZ_pE} class is used to model $\Z / p\Z [x] / (f(x))$. - The modulus $p$ may be any positive integer, not necessarily prime, + The \class{ZZ_pE} class is used to model `\Z / p\Z [x] / (f(x))`. + The modulus `p` may be any positive integer, not necessarily prime, and the modulus f is not required to be irreducible. Objects of the class \class{ZZ_pE} are represented as a \code{ZZ_pX} of - degree less than the degree of $f$. + degree less than the degree of `f`. Each \class{ZZ_pE} contains a pointer of a \class{ZZ_pEContext} which contains pre-computed data for NTL. These can be explicitly constructed diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx index a23d84bd4ad..b2ea533a15c 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx @@ -6,7 +6,7 @@ # distutils: language = c++ """ -Wrapper for NTL's polynomials over finite ring extensions of $\Z / p\Z.$ +Wrapper for NTL's polynomials over finite ring extensions of `\Z / p\Z.` AUTHORS: -- David Roe (2007-10-10) @@ -53,9 +53,9 @@ from sage.arith.power cimport generic_power_pos cdef class ntl_ZZ_pEX(object): r""" - The class \class{ZZ_pEX} implements polynomials over finite ring extensions of $\Z / p\Z$. + The class \class{ZZ_pEX} implements polynomials over finite ring extensions of `\Z / p\Z`. - It can be used, for example, for arithmetic in $GF(p^n)[X]$. + It can be used, for example, for arithmetic in `GF(p^n)[X]`. However, except where mathematically necessary (e.g., GCD computations), ZZ_pE need not be a field. """ @@ -449,7 +449,7 @@ cdef class ntl_ZZ_pEX(object): def square(self): """ - Return $f^2$. + Return `f^2`. EXAMPLES:: @@ -997,7 +997,7 @@ cdef class ntl_ZZ_pEX(object): def invert_and_truncate(self, long m): """ - Compute and return the inverse of self modulo $x^m$. + Compute and return the inverse of self modulo `x^m`. The constant term of self must be invertible. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_lzz_p.pyx b/src/sage/libs/ntl/ntl_lzz_p.pyx index 2152f299967..9e787aaf6cd 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pyx +++ b/src/sage/libs/ntl/ntl_lzz_p.pyx @@ -61,7 +61,7 @@ ZZ_sage = IntegerRing() cdef class ntl_zz_p(object): r""" - The class \class{zz_p} implements arithmetic modulo $p$, + The class \class{zz_p} implements arithmetic modulo `p`, for p smaller than a machine word. NOTE: This type is provided mostly for completeness, and diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pyx b/src/sage/libs/ntl/ntl_lzz_pX.pyx index d7a88da82fd..0941c68460c 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pX.pyx @@ -54,7 +54,7 @@ ZZ_sage = IntegerRing() cdef class ntl_zz_pX(object): r""" - The class \class{zz_pX} implements polynomial arithmetic modulo $p$, + The class \class{zz_pX} implements polynomial arithmetic modulo `p`, for p smaller than a machine word. Polynomial arithmetic is implemented using the FFT, combined with @@ -409,7 +409,7 @@ cdef class ntl_zz_pX(object): """ Returns the quotient and remainder when self is divided by right. - Specifically, this return r, q such that $self = q * right + r$ + Specifically, this return r, q such that `self = q * right + r` EXAMPLES:: @@ -434,7 +434,7 @@ cdef class ntl_zz_pX(object): def __floordiv__(ntl_zz_pX self, ntl_zz_pX right): """ - Returns the whole part of $self / right$. + Returns the whole part of `self / right`. EXAMPLES:: @@ -452,7 +452,7 @@ cdef class ntl_zz_pX(object): def __lshift__(ntl_zz_pX self, long n): """ - Shifts this polynomial to the left, which is multiplication by $x^n$. + Shifts this polynomial to the left, which is multiplication by `x^n`. EXAMPLES:: @@ -467,7 +467,7 @@ cdef class ntl_zz_pX(object): def __rshift__(ntl_zz_pX self, long n): """ - Shifts this polynomial to the right, which is division by $x^n$ (and truncation). + Shifts this polynomial to the right, which is division by `x^n` (and truncation). EXAMPLES:: @@ -497,7 +497,7 @@ cdef class ntl_zz_pX(object): def reverse(self): """ - Returns self with coefficients reversed, i.e. $x^n self(x^{-n})$. + Returns self with coefficients reversed, i.e. `x^n self(x^{-n})`. EXAMPLES:: @@ -722,7 +722,7 @@ cdef class ntl_zz_pX(object): def invert_and_truncate(self, long m): """ - Compute and return the inverse of self modulo $x^m$. + Compute and return the inverse of self modulo `x^m`. The constant term of self must be 1 or -1. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pyx b/src/sage/libs/ntl/ntl_mat_GF2.pyx index 6967d469cef..bd87dd9984c 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2.pyx @@ -6,10 +6,10 @@ # distutils: language = c++ """ -Matrices over the $\GF{2}$ via NTL +Matrices over the `\GF{2}` via NTL This class is only provided to have a complete NTL interface and for -comparison purposes. Sage's native matrices over $F_2$ are much faster +comparison purposes. Sage's native matrices over `F_2` are much faster for many problems like matrix multiplication and Gaussian elimination. AUTHORS: @@ -47,7 +47,7 @@ from sage.libs.ntl.ntl_ZZ import unpickle_class_args cdef class ntl_mat_GF2(object): r""" - The \class{mat_GF2} class implements arithmetic with matrices over $F_2$. + The \class{mat_GF2} class implements arithmetic with matrices over `F_2`. """ def __init__(self, nrows=0, ncols=0, v=None): """ @@ -498,7 +498,7 @@ cdef class ntl_mat_GF2(object): def __invert__(self): """ - Return $X = A^{-1}$; an error is raised if A is singular. + Return `X = A^{-1}`; an error is raised if A is singular. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pyx b/src/sage/libs/ntl/ntl_mat_GF2E.pyx index 85fd9d6d46f..b3b98b4d266 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pyx @@ -47,7 +47,7 @@ from sage.libs.ntl.ntl_ZZ import unpickle_class_args cdef class ntl_mat_GF2E(object): r""" - The \class{mat_GF2E} class implements arithmetic with matrices over $GF(2**x)$. + The \class{mat_GF2E} class implements arithmetic with matrices over `GF(2**x)`. """ def __init__(self, modulus = None, nrows=0, ncols=0, v=None): """ @@ -571,7 +571,7 @@ cdef class ntl_mat_GF2E(object): def __invert__(self): """ - Return $X = A^{-1}$; an error is raised if A is singular. + Return `X = A^{-1}`; an error is raised if A is singular. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pyx b/src/sage/libs/ntl/ntl_mat_ZZ.pyx index c9f054602e8..00db7a54c64 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pyx @@ -70,11 +70,11 @@ cdef inline ntl_mat_ZZ make_mat_ZZ_sig_off(mat_ZZ_c* x): cdef class ntl_mat_ZZ(object): # see ntl_mat_ZZ.pxd for data members r""" - The \class{mat_ZZ} class implements arithmetic with matrices over $\Z$. + The \class{mat_ZZ} class implements arithmetic with matrices over `\Z`. """ def __init__(self, nrows=0, ncols=0, v=None): """ - The \class{mat_ZZ} class implements arithmetic with matrices over $\Z$. + The \class{mat_ZZ} class implements arithmetic with matrices over `\Z`. EXAMPLES:: @@ -1167,19 +1167,19 @@ cdef class ntl_mat_ZZ(object): r""" Performs LLL reduction of self (puts \code{self} in an LLL form). - \code{self} is an $m x n$ matrix, viewed as $m$ rows of - $n$-vectors. $m$ may be less than, equal to, or greater than $n$, + \code{self} is an `m x n` matrix, viewed as `m` rows of + `n`-vectors. `m` may be less than, equal to, or greater than `n`, and the rows need not be linearly independent. self is transformed into an LLL-reduced basis, and the return value is - the rank r of self so as det2 (see below). The first $m-r$ rows + the rank r of self so as det2 (see below). The first `m-r` rows of self are zero. More specifically, elementary row transformations are performed on \code{self} so that the non-zero rows of new-\code{self} form an LLL-reduced basis for the lattice spanned by the rows of old-\code{self}. The default reduction - parameter is $\delta=3/4$, which means that the squared length - of the first non-zero basis vector is no more than $2^{r-1}$ + parameter is `\delta=3/4`, which means that the squared length + of the first non-zero basis vector is no more than `2^{r-1}` times that of the shortest vector in the lattice. det2 is calculated as the \emph{square} of the determinant of @@ -1193,10 +1193,10 @@ cdef class ntl_mat_ZZ(object): of old-B. The parameters a and b allow an arbitrary reduction parameter - $\delta=a/b$, where $1/4 < a/b \leq 1$, where a and b are positive + `\delta=a/b`, where `1/4 < a/b \leq 1`, where a and b are positive integers. For a basis reduced with parameter delta, the squared length of the first non-zero basis vector is no more - than $1/(delta-1/4)^{r-1}$ times that of the shortest vector in + than `1/(delta-1/4)^{r-1}` times that of the shortest vector in the lattice. The algorithm employed here is essentially the one in Cohen's @@ -1280,7 +1280,7 @@ cdef class ntl_mat_ZZ(object): different, improving both stability and performance. If return_U is True, then also U is returned which is - the transition matrix: $U * self_{old} = self_{new}$ + the transition matrix: `U * self_{old} = self_{new}` The optional argument 'delta' is the reduction parameter, and may be set so that 0.50 <= delta < 1. Setting it close to 1 diff --git a/src/sage/libs/symmetrica/sb.pxi b/src/sage/libs/symmetrica/sb.pxi index 2a7b7ed6a5c..73a5b61c64d 100644 --- a/src/sage/libs/symmetrica/sb.pxi +++ b/src/sage/libs/symmetrica/sb.pxi @@ -170,7 +170,7 @@ def mult_schubert_variable_symmetrica(a, i): def divdiff_perm_schubert_symmetrica(perm, a): r""" Returns the result of applying the divided difference operator - $\delta_i$ to $a$ where $a$ is either a permutation or a + `\delta_i` to `a` where `a` is either a permutation or a Schubert polynomial over QQ. EXAMPLES:: @@ -254,7 +254,7 @@ def scalarproduct_schubert_symmetrica(a, b): def divdiff_schubert_symmetrica(i, a): r""" Returns the result of applying the divided difference operator - $\delta_i$ to $a$ where $a$ is either a permutation or a + `\delta_i` to `a` where `a` is either a permutation or a Schubert polynomial over QQ. EXAMPLES:: From 997689644971cd75c1a074efbc6348165adf181c Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 12 Jun 2022 10:12:20 +0200 Subject: [PATCH 318/338] trac #33980: typos in graphs --- src/sage/graphs/bliss.pyx | 2 +- src/sage/graphs/chrompoly.pyx | 2 +- src/sage/graphs/comparability.pyx | 2 +- src/sage/graphs/generators/distance_regular.pyx | 6 +++--- src/sage/graphs/generators/families.py | 6 +++--- src/sage/graphs/graph_decompositions/cutwidth.pyx | 4 ++-- .../graphs/graph_decompositions/modular_decomposition.py | 2 +- src/sage/graphs/graph_decompositions/tree_decomposition.pyx | 4 ++-- src/sage/graphs/spanning_tree.pyx | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sage/graphs/bliss.pyx b/src/sage/graphs/bliss.pyx index 921bc6a7659..140b83b4e3b 100644 --- a/src/sage/graphs/bliss.pyx +++ b/src/sage/graphs/bliss.pyx @@ -525,7 +525,7 @@ cpdef canonical_form(G, partition=None, return_graph=False, use_edge_labels=True if partition: from itertools import chain int2vert = list(chain(*partition)) - # We check that the partition constains only vertices of the graph + # We check that the partition contains only vertices of the graph # and that it is actually a partition seen = set() for u in int2vert: diff --git a/src/sage/graphs/chrompoly.pyx b/src/sage/graphs/chrompoly.pyx index 221caa5431a..4fb9f382894 100644 --- a/src/sage/graphs/chrompoly.pyx +++ b/src/sage/graphs/chrompoly.pyx @@ -402,7 +402,7 @@ def chromatic_polynomial_with_cache(G, cache=None): sage: chromatic_polynomial_with_cache(graphs.CompleteBipartiteGraph(3,3)) x^6 - 9*x^5 + 36*x^4 - 75*x^3 + 78*x^2 - 31*x - If a cache is provided, it is feeded:: + If a cache is provided, it is fed:: sage: cache = {} sage: G = graphs.CycleGraph(4) diff --git a/src/sage/graphs/comparability.pyx b/src/sage/graphs/comparability.pyx index 9c6e0d68f9b..d81887a2b12 100644 --- a/src/sage/graphs/comparability.pyx +++ b/src/sage/graphs/comparability.pyx @@ -161,7 +161,7 @@ Implementation details This is done by a call to :meth:`Graph.is_bipartite`, and here is how : Around a vertex `u`, any two edges `uv, uv'` such that `vv'\not\in G` are - equivalent. Hence, the equivalence classe of edges around a vertex are + equivalent. Hence, the equivalence class of edges around a vertex are precisely the connected components of the complement of the graph induced by the neighbors of `u`. diff --git a/src/sage/graphs/generators/distance_regular.pyx b/src/sage/graphs/generators/distance_regular.pyx index e8a731b6824..8d047a19191 100644 --- a/src/sage/graphs/generators/distance_regular.pyx +++ b/src/sage/graphs/generators/distance_regular.pyx @@ -1871,7 +1871,7 @@ def is_classical_parameters_graph(list array): from sage.combinat.q_analogues import q_binomial def integral_log(const int x, const int b): - # compute log_b(x) if is not a positive iteger, return -1 + # compute log_b(x) if is not a positive integer, return -1 if x <= 0: return -1 k = log(x, b) @@ -2358,7 +2358,7 @@ def is_near_polygon(array): sage: _.is_distance_regular(True) ([7, 6, 6, 5, 5, 4, None], [None, 1, 1, 2, 2, 3, 3]) - REFERECES: + REFERENCES: See [BCN1989]_ pp. 198-206 for some theory about near polygons as well as a list of known examples. @@ -2481,7 +2481,7 @@ def near_polygon_graph(family, params): - ``family`` -- int; an element of the enum ``NearPolygonGraph``. - - ``params`` -- int or tuple; the paramters needed to construct a graph + - ``params`` -- int or tuple; the parameters needed to construct a graph of the family ``family``. EXAMPLES:: diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index 4e8ad05527b..c6220e32eba 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -1851,10 +1851,10 @@ def RoseWindowGraph(n, a, r): - ``n`` -- the number of nodes is `2 * n` - - ``a`` -- integer such that `1 \leq a < n` determing a-spoke edges + - ``a`` -- integer such that `1 \leq a < n` determining a-spoke edges - - ``r`` -- integer such that `1 \leq r < n` and `r \neq n / 2` determing how - inner vertices are connected + - ``r`` -- integer such that `1 \leq r < n` and `r \neq n / 2` determining + how inner vertices are connected PLOTTING: Upon construction, the position dictionary is filled to override the spring-layout algorithm. By convention, the rose window graphs are diff --git a/src/sage/graphs/graph_decompositions/cutwidth.pyx b/src/sage/graphs/graph_decompositions/cutwidth.pyx index 9b1711107e9..7a38495c0f1 100644 --- a/src/sage/graphs/graph_decompositions/cutwidth.pyx +++ b/src/sage/graphs/graph_decompositions/cutwidth.pyx @@ -117,7 +117,7 @@ optimal layout for the cutwidth of `G`. - `z` -- Objective value to minimize. It is equal to the maximum over all position `k` of the number of edges with one extremity at position at most `k` - and the other at position stricly more than `k`, that is `\sum_{uv\in + and the other at position strictly more than `k`, that is `\sum_{uv\in E}y_{u,v}^{k}`. @@ -142,7 +142,7 @@ optimal layout for the cutwidth of `G`. Constraints (1)-(3) ensure that all vertices have a distinct position. Constraints (4)-(5) force variable `y_{u,v}^k` to 1 if the edge is in the cut. Constraint (6) count the number of edges starting at position at most `k` and -ending at a position stricly larger than `k`. +ending at a position strictly larger than `k`. This formulation corresponds to method :meth:`cutwidth_MILP`. diff --git a/src/sage/graphs/graph_decompositions/modular_decomposition.py b/src/sage/graphs/graph_decompositions/modular_decomposition.py index 941aaa26b29..ebb66d3fc21 100644 --- a/src/sage/graphs/graph_decompositions/modular_decomposition.py +++ b/src/sage/graphs/graph_decompositions/modular_decomposition.py @@ -2962,7 +2962,7 @@ def test_module(module, graph): # Function implemented for testing def children_node_type(module, node_type): """ - Check whether the node type of the childrens of ``module`` is ``node_type``. + Check whether the node type of the children of ``module`` is ``node_type``. INPUT: diff --git a/src/sage/graphs/graph_decompositions/tree_decomposition.pyx b/src/sage/graphs/graph_decompositions/tree_decomposition.pyx index 22f041f0b94..872d0d9ffe3 100644 --- a/src/sage/graphs/graph_decompositions/tree_decomposition.pyx +++ b/src/sage/graphs/graph_decompositions/tree_decomposition.pyx @@ -5,7 +5,7 @@ Tree decompositions This module implements tree-decomposition methods. A tree-decomposition of a graph `G = (V, E)` is a pair `(X, T)`, where `X=\{X_1, -X_2, \ldots, X_t\}` is a familly of subsets of `V`, usually called *bags*, and +X_2, \ldots, X_t\}` is a family of subsets of `V`, usually called *bags*, and `T` is a tree of order `t` whose nodes are the subsets `X_i` satisfying the following properties: @@ -33,7 +33,7 @@ dist_G(u, v)`). The *treelength* `tl(G)` of a graph `G` is the minimum length among all possible tree decompositions of `G`. While deciding whether a graph has treelength 1 can be done in linear time -(equivalant to deciding if the graph is chordal), deciding if it has treelength +(equivalent to deciding if the graph is chordal), deciding if it has treelength at most `k` for any fixed constant `k \leq 2` is NP-complete [Lokshtanov2009]_. Treewidth and treelength are different measures of tree-likeness. In particular, diff --git a/src/sage/graphs/spanning_tree.pyx b/src/sage/graphs/spanning_tree.pyx index 7a2a9153b90..2054cd975bc 100644 --- a/src/sage/graphs/spanning_tree.pyx +++ b/src/sage/graphs/spanning_tree.pyx @@ -1305,7 +1305,7 @@ def edge_disjoint_spanning_trees(G, k, by_weight=False, weight_function=None, ch # Initialization of data structures - # - partition[0] is used to maitain known clumps. + # - partition[0] is used to maintain known clumps. # - partition[i], 1 <= i <= k, is used to check if a given edge has both its # endpoints in the same tree of forest Fi. partition = [DisjointSet_of_hashables(G) for _ in range(k + 1)] From a6e696e91d2f2a3ab91031b3e1fcd795af3e6e62 Mon Sep 17 00:00:00 2001 From: Release Manager Date: Sun, 12 Jun 2022 14:18:49 +0200 Subject: [PATCH 319/338] Updated SageMath version to 9.7.beta2 --- .zenodo.json | 8 ++++---- VERSION.txt | 2 +- build/pkgs/configure/checksums.ini | 6 +++--- build/pkgs/configure/package-version.txt | 2 +- pkgs/sage-conf/VERSION.txt | 2 +- pkgs/sage-conf_pypi/VERSION.txt | 2 +- pkgs/sage-docbuild/VERSION.txt | 2 +- pkgs/sage-setup/VERSION.txt | 2 +- pkgs/sage-sws2rst/VERSION.txt | 2 +- pkgs/sagemath-categories/VERSION.txt | 2 +- pkgs/sagemath-environment/VERSION.txt | 2 +- pkgs/sagemath-objects/VERSION.txt | 2 +- pkgs/sagemath-repl/VERSION.txt | 2 +- src/VERSION.txt | 2 +- src/bin/sage-version.sh | 6 +++--- src/sage/version.py | 6 +++--- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index be408937a6f..f05573e690c 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,10 +1,10 @@ { "description": "Mirror of the Sage https://sagemath.org/ source tree", "license": "other-open", - "title": "sagemath/sage: 9.7.beta1", - "version": "9.7.beta1", + "title": "sagemath/sage: 9.7.beta2", + "version": "9.7.beta2", "upload_type": "software", - "publication_date": "2022-05-26", + "publication_date": "2022-06-12", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/9.7.beta1", + "identifier": "https://github.com/sagemath/sage/tree/9.7.beta2", "relation": "isSupplementTo" }, { diff --git a/VERSION.txt b/VERSION.txt index 8cb99453ed0..8f5b1728548 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 9.7.beta1, Release Date: 2022-05-26 +SageMath version 9.7.beta2, Release Date: 2022-06-12 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 2f353640452..1bc9808428d 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=6d548fec179a7c4d71f327f409320a06e0d9d35e -md5=7289e1187b21d5cd30a891838410fcd0 -cksum=1487266202 +sha1=fee64e7ae45bcfd9bfa1c55605a579f49b19057e +md5=42d9e4a2308a8c01f4e68f3915c3b856 +cksum=3408158874 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 615282f9973..d45eb7f9401 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -6b0fd1ca2d493aec6beadae8b15f926c19070098 +b95c1659af1d26926ddf421d28b2d1f76dbc4810 diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 27f66583915..4cd5a231c54 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -9.6.rc3.post2 +9.7.beta2 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index be2310e2ea1..4cd5a231c54 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -9.6.rc3.post4 +9.7.beta2 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 24562793a28..4cd5a231c54 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -9.6.rc3 +9.7.beta2 diff --git a/src/VERSION.txt b/src/VERSION.txt index 6442b83e510..4cd5a231c54 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -9.7.beta1 +9.7.beta2 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index bc8b231097a..3dc222edd01 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -1,5 +1,5 @@ # Sage version information for shell scripts # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='9.7.beta1' -SAGE_RELEASE_DATE='2022-05-26' -SAGE_VERSION_BANNER='SageMath version 9.7.beta1, Release Date: 2022-05-26' +SAGE_VERSION='9.7.beta2' +SAGE_RELEASE_DATE='2022-06-12' +SAGE_VERSION_BANNER='SageMath version 9.7.beta2, Release Date: 2022-06-12' diff --git a/src/sage/version.py b/src/sage/version.py index 6671c264512..3ea94539369 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,5 +1,5 @@ # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '9.7.beta1' -date = '2022-05-26' -banner = 'SageMath version 9.7.beta1, Release Date: 2022-05-26' +version = '9.7.beta2' +date = '2022-06-12' +banner = 'SageMath version 9.7.beta2, Release Date: 2022-06-12' From d490b8f8b2e22edb74e225e2d8878aa0f47dcac7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 3 Jun 2022 22:29:41 -0700 Subject: [PATCH 320/338] build/pkgs/sage_setup/dependencies: Add jinja2 --- build/pkgs/sage_setup/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sage_setup/dependencies b/build/pkgs/sage_setup/dependencies index fb4de797d36..dc512520b14 100644 --- a/build/pkgs/sage_setup/dependencies +++ b/build/pkgs/sage_setup/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) cython pkgconfig $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/interpreters/specs/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/command/*.py | $(PYTHON_TOOLCHAIN) +$(PYTHON) cython pkgconfig jinja2 $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/autogen/interpreters/specs/*.py $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/command/*.py | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From c53de989a77e0d2c4858c3011ab59057cb1aedaa Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Sun, 12 Jun 2022 13:41:06 -0700 Subject: [PATCH 321/338] trac 33973: remove more dollar signs --- src/sage/combinat/words/suffix_trees.py | 2 +- .../parametrized_surface3d.py | 4 +- src/sage/geometry/toric_plotter.py | 2 +- .../graphs/generators/classical_geometries.py | 2 +- .../abelian_gps/dual_abelian_group_element.py | 2 +- src/sage/groups/braid.py | 10 ++-- src/sage/groups/perm_gps/permgroup_named.py | 48 +++++++++---------- src/sage/interfaces/frobby.py | 4 +- src/sage/matrix/matrix_cyclo_dense.pyx | 10 ++-- src/sage/matrix/matrix_double_dense.pyx | 12 ++--- .../matrix/matrix_integer_dense_saturation.py | 2 +- src/sage/matrix/matrix_mpolynomial_dense.pyx | 2 +- src/sage/matrix/special.py | 2 +- src/sage/matrix/symplectic_basis.py | 18 +++---- src/sage/media/wav.py | 6 +-- src/sage/modular/arithgroup/congroup_sl2z.py | 4 +- src/sage/modular/modform/numerical.py | 2 +- 17 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/sage/combinat/words/suffix_trees.py b/src/sage/combinat/words/suffix_trees.py index a70eb02f7ff..1cfdb629213 100644 --- a/src/sage/combinat/words/suffix_trees.py +++ b/src/sage/combinat/words/suffix_trees.py @@ -1570,7 +1570,7 @@ class DecoratedSuffixTree(ImplicitSuffixTree): A *decorated suffix tree* of a word `w` is the suffix tree of `w` marked with the end point of all squares in the `w`. - The symbol ``"$"`` is appended to ``w`` to ensure that each final + The symbol ``$`` is appended to ``w`` to ensure that each final state is a leaf of the suffix tree. INPUT: diff --git a/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py b/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py index 15285685477..e1021f66a97 100644 --- a/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py +++ b/src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py @@ -1452,9 +1452,9 @@ def connection_coefficients(self): Computes the connection coefficients or Christoffel symbols `\Gamma^k_{ij}` of the surface. If the coefficients of the first fundamental form are given by `g_{ij}` (where `i, j = 1, 2`), then - $\Gamma^k_{ij} = \frac{1}{2} g^{kl} \left( \frac{\partial g_{li}}{\partial x^j} + `\Gamma^k_{ij} = \frac{1}{2} g^{kl} \left( \frac{\partial g_{li}}{\partial x^j} - \frac{\partial g_{ij}}{\partial x^l} - + \frac{\partial g_{lj}}{\partial x^i} \right)$. + + \frac{\partial g_{lj}}{\partial x^i} \right)`. Here, `(g^{kl})` is the inverse of the matrix `(g_{ij})`, with `i, j = 1, 2`. diff --git a/src/sage/geometry/toric_plotter.py b/src/sage/geometry/toric_plotter.py index 17e7730fbae..923fb43440d 100644 --- a/src/sage/geometry/toric_plotter.py +++ b/src/sage/geometry/toric_plotter.py @@ -836,7 +836,7 @@ def label_list(label, n, math_mode, index_set=None): If ``label`` was a list of ``n`` entries, it is returned without changes. If ``label`` is ``None``, a list of ``n`` ``None``'s is returned. If - ``label`` is a string, a list of strings of the form "$label_{i}$" is + ``label`` is a string, a list of strings of the form ``$label_{i}$`` is returned, where `i` ranges over ``index_set``. (If ``math_mode=False``, the form "label_i" is used instead.) If ``n=1``, there is no subscript added, unless ``index_set`` was specified explicitly. diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py index 6290002cc1b..4e049f44a6d 100644 --- a/src/sage/graphs/generators/classical_geometries.py +++ b/src/sage/graphs/generators/classical_geometries.py @@ -1433,7 +1433,7 @@ def Nowhere0WordsTwoWeightCodeGraph(q, hyperoval=None, field=None, check_hyperov def OrthogonalDualPolarGraph(e, d, q): r""" - Return the dual polar graph on $GO^e(n,q)$ of diameter `d`. + Return the dual polar graph on `GO^e(n,q)` of diameter `d`. The value of `n` is determined by `d` and `e`. diff --git a/src/sage/groups/abelian_gps/dual_abelian_group_element.py b/src/sage/groups/abelian_gps/dual_abelian_group_element.py index 31f132c7b73..174d1435b68 100644 --- a/src/sage/groups/abelian_gps/dual_abelian_group_element.py +++ b/src/sage/groups/abelian_gps/dual_abelian_group_element.py @@ -200,7 +200,7 @@ def word_problem(self, words, display=True): [[b^2*c^2*d^3*e^5, 245]] The command e.word_problem([u,v,w,x,y],display=True) returns - the same list but also prints $e = (b^2*c^2*d^3*e^5)^245$. + the same list but also prints `e = (b^2*c^2*d^3*e^5)^245`. """ ## First convert the problem to one using AbelianGroups import copy diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index c2ac473b8d7..8144aa7b9d6 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -628,8 +628,8 @@ def LKB_matrix(self, variables='x,y'): r""" Return the Lawrence-Krammer-Bigelow representation matrix. - The matrix is expressed in the basis $\{e_{i, j} \mid 1\leq i - < j \leq n\}$, where the indices are ordered + The matrix is expressed in the basis `\{e_{i, j} \mid 1\leq i + < j \leq n\}`, where the indices are ordered lexicographically. It is a matrix whose entries are in the ring of Laurent polynomials on the given variables. By default, the variables are ``'x'`` and ``'y'``. @@ -1345,7 +1345,7 @@ def _left_normal_form_coxeter(self): OUTPUT: - A tuple whose first element is the power of $\Delta$, and the + A tuple whose first element is the power of `\Delta`, and the rest are the permutations corresponding to the simple factors. EXAMPLES:: @@ -3080,8 +3080,8 @@ class group of the punctured disk. x_{j} & \text{otherwise} \end{cases}, - where $\sigma_i$ are the generators of the braid group on $n$ - strands, and $x_j$ the generators of the free group of rank $n$. + where `\sigma_i` are the generators of the braid group on `n` + strands, and `x_j` the generators of the free group of rank `n`. You should left multiplication of the free group element by the braid to compute the action. Alternatively, use the diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index cc780adc4dc..deb7e9c4657 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3,34 +3,34 @@ You can construct the following permutation groups: --- SymmetricGroup, $S_n$ of order $n!$ (n can also be a list $X$ of distinct - positive integers, in which case it returns $S_X$) +-- SymmetricGroup, `S_n` of order `n!` (n can also be a list `X` of distinct + positive integers, in which case it returns `S_X`) --- AlternatingGroup, $A_n$ of order $n!/2$ (n can also be a list $X$ +-- AlternatingGroup, `A_n` of order `n!/2` (n can also be a list `X` of distinct positive integers, in which case it returns - $A_X$) + `A_X`) --- DihedralGroup, $D_n$ of order $2n$ +-- DihedralGroup, `D_n` of order `2n` --- GeneralDihedralGroup, $Dih(G)$, where G is an abelian group +-- GeneralDihedralGroup, `Dih(G)`, where G is an abelian group --- CyclicPermutationGroup, $C_n$ of order $n$ +-- CyclicPermutationGroup, `C_n` of order `n` -- DiCyclicGroup, nonabelian groups of order `4m` with a unique element of order 2 --- TransitiveGroup, $n^{th}$ transitive group of degree $d$ +-- TransitiveGroup, `n^{th}` transitive group of degree `d` from the GAP tables of transitive groups -- TransitiveGroups(d), TransitiveGroups(), set of all of the above --- PrimitiveGroup, $n^{th}$ primitive group of degree $d$ +-- PrimitiveGroup, `n^{th}` primitive group of degree `d` from the GAP tables of primitive groups -- PrimitiveGroups(d), PrimitiveGroups(), set of all of the above -- MathieuGroup(degree), Mathieu group of degree 9, 10, 11, 12, 21, 22, 23, or 24. --- KleinFourGroup, subgroup of $S_4$ of order $4$ which is not $C_2 \times C_2$ +-- KleinFourGroup, subgroup of `S_4` of order `4` which is not `C_2 \times C_2` -- QuaternionGroup, non-abelian group of order `8`, `\{\pm 1, \pm I, \pm J, \pm K\}` @@ -39,24 +39,24 @@ -- SemidihedralGroup, nonabelian 2-groups with cyclic subgroups of index 2 --- PGL(n,q), projective general linear group of $n\times n$ matrices over +-- PGL(n,q), projective general linear group of `n\times n` matrices over the finite field GF(q) --- PSL(n,q), projective special linear group of $n\times n$ matrices over +-- PSL(n,q), projective special linear group of `n\times n` matrices over the finite field GF(q) --- PSp(2n,q), projective symplectic linear group of $2n\times 2n$ matrices +-- PSp(2n,q), projective symplectic linear group of `2n\times 2n` matrices over the finite field GF(q) --- PSU(n,q), projective special unitary group of $n \times n$ matrices having - coefficients in the finite field $GF(q^2)$ that respect a +-- PSU(n,q), projective special unitary group of `n \times n` matrices having + coefficients in the finite field `GF(q^2)` that respect a fixed nondegenerate sesquilinear form, of determinant 1. --- PGU(n,q), projective general unitary group of $n\times n$ matrices having - coefficients in the finite field $GF(q^2)$ that respect a +-- PGU(n,q), projective general unitary group of `n\times n` matrices having + coefficients in the finite field `GF(q^2)` that respect a fixed nondegenerate sesquilinear form, modulo the centre. --- SuzukiGroup(q), Suzuki group over GF(q), $^2 B_2(2^{2k+1}) = Sz(2^{2k+1})$. +-- SuzukiGroup(q), Suzuki group over GF(q), `^2 B_2(2^{2k+1}) = Sz(2^{2k+1})`. -- ComplexReflectionGroup, the complex reflection group `G(m, p, n)` or the exceptional complex reflection group `G_m` @@ -622,7 +622,7 @@ def algebra(self, base_ring, category=None): class AlternatingGroup(PermutationGroup_symalt): def __init__(self, domain=None): """ - The alternating group of order $n!/2$, as a permutation group. + The alternating group of order `n!/2`, as a permutation group. INPUT: @@ -968,8 +968,8 @@ def is_abelian(self): class KleinFourGroup(PermutationGroup_unique): def __init__(self): r""" - The Klein 4 Group, which has order $4$ and exponent $2$, viewed - as a subgroup of $S_4$. + The Klein 4 Group, which has order `4` and exponent `2`, viewed + as a subgroup of `S_4`. OUTPUT: @@ -1703,7 +1703,7 @@ def _repr_(self): class MathieuGroup(PermutationGroup_unique): def __init__(self, n): """ - The Mathieu group of degree $n$. + The Mathieu group of degree `n`. INPUT: @@ -2777,7 +2777,7 @@ def ramification_module_decomposition_modular_curve(self): REFERENCE: D. Joyner and A. Ksir, 'Modular representations on some Riemann-Roch spaces of modular curves - $X(N)$', Computational Aspects of Algebraic Curves, + `X(N)`', Computational Aspects of Algebraic Curves, (Editor: T. Shaska) Lecture Notes in Computing, WorldScientific, 2005.) @@ -2990,7 +2990,7 @@ class SuzukiGroup(PermutationGroup_unique): def __init__(self, q, name='a'): r""" The Suzuki group over GF(q), - $^2 B_2(2^{2k+1}) = Sz(2^{2k+1})$. + `^2 B_2(2^{2k+1}) = Sz(2^{2k+1})`. A wrapper for the GAP function SuzukiGroup. diff --git a/src/sage/interfaces/frobby.py b/src/sage/interfaces/frobby.py index ed852f74efe..58f2ebbb51d 100644 --- a/src/sage/interfaces/frobby.py +++ b/src/sage/interfaces/frobby.py @@ -144,8 +144,8 @@ def hilbert(self, monomial_ideal): The Hilbert-Poincaré series of a monomial ideal is the sum of all monomials not in the ideal. This sum can be written as a (finite) - rational function with $(x_1-1)(x_2-1)...(x_n-1)$ in the denominator, - assuming the variables of the ring are $x_1,x2,...,x_n$. This action + rational function with `(x_1-1)(x_2-1)...(x_n-1)` in the denominator, + assuming the variables of the ring are `x_1,x2,...,x_n`. This action computes the polynomial in the numerator of this fraction. INPUT: diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index 1845be41cbd..ba9c043f25f 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -922,7 +922,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): sage: A.coefficient_bound() 16 - The above bound is just $9 + 7$, coming from the lower left entry. + The above bound is just `9 + 7`, coming from the lower left entry. A better bound would be the following:: sage: (A[1,0]).abs() @@ -1309,7 +1309,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): def _charpoly_mod(self, p): """ Return the characteristic polynomial of self*denom modulo all - primes over $p$. + primes over `p`. This is used internally by the multimodular charpoly algorithm. @@ -1356,9 +1356,9 @@ cdef class Matrix_cyclo_dense(Matrix_dense): INPUT: proof -- bool (default: global flag); if False, compute - using primes $p_i$ until the lift modulo all - primes up to $p_i$ is the same as the lift modulo - all primes up to $p_{i+3}$ or the bound is + using primes `p_i` until the lift modulo all + primes up to `p_i` is the same as the lift modulo + all primes up to `p_{i+3}` or the bound is reached. EXAMPLES:: diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index d62c2f2c14b..7e799e30993 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -1108,7 +1108,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): OUTPUT: - Default output for a square matrix of size $n$ is a list of $n$ + Default output for a square matrix of size `n` is a list of `n` eigenvalues from the complex double field, :class:`~sage.rings.complex_double.CDF`. If the ``'symmetric'`` or ``'hermitian'`` algorithms are chosen, the returned eigenvalues @@ -1120,11 +1120,11 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): where each pair is an eigenvalue followed by its multiplicity. The eigenvalue reported is the mean of the eigenvalues computed, and these eigenvalues are contained in an interval (or disk) whose - radius is less than ``5*tol`` for $n < 10,000$ in the worst case. + radius is less than ``5*tol`` for `n < 10,000` in the worst case. - More precisely, for an $n\times n$ matrix, the diameter of the + More precisely, for an `n\times n` matrix, the diameter of the interval containing similar eigenvalues could be as large as sum - of the reciprocals of the first $n$ integers times ``tol``. + of the reciprocals of the first `n` integers times ``tol``. .. WARNING:: @@ -1875,7 +1875,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): OUTPUT: - - U, S, V -- immutable matrices such that $A = U*S*V.conj().transpose()$ + - U, S, V -- immutable matrices such that `A = U*S*V.conj().transpose()` where U and V are orthogonal and S is zero off of the diagonal. Note that if self is m-by-n, then the dimensions of the @@ -3604,7 +3604,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): def _hadamard_row_bound(self): r""" Return an integer n such that the absolute value of the - determinant of this matrix is at most $10^n$. + determinant of this matrix is at most `10^n`. EXAMPLES:: diff --git a/src/sage/matrix/matrix_integer_dense_saturation.py b/src/sage/matrix/matrix_integer_dense_saturation.py index b88e7b23472..9ac854ea2d1 100644 --- a/src/sage/matrix/matrix_integer_dense_saturation.py +++ b/src/sage/matrix/matrix_integer_dense_saturation.py @@ -118,7 +118,7 @@ def random_sublist_of_size(k, n): def solve_system_with_difficult_last_row(B, A): """ - Solve the matrix equation B*Z = A when the last row of $B$ + Solve the matrix equation B*Z = A when the last row of `B` contains huge entries. INPUT: diff --git a/src/sage/matrix/matrix_mpolynomial_dense.pyx b/src/sage/matrix/matrix_mpolynomial_dense.pyx index 5ceb931ee36..ee700a93148 100644 --- a/src/sage/matrix/matrix_mpolynomial_dense.pyx +++ b/src/sage/matrix/matrix_mpolynomial_dense.pyx @@ -437,7 +437,7 @@ cdef class Matrix_mpolynomial_dense(Matrix_generic_dense): of the Gauss-Bareiss algorithm (see :meth:`echelon_form` for details). The tuple as length equal to the rank of self and the value at the - $i$-th position indicates the source column which was put as the $i$-th + `i`-th position indicates the source column which was put as the `i`-th column. If no Gauss-Bareiss reduction was performed yet, None is diff --git a/src/sage/matrix/special.py b/src/sage/matrix/special.py index 37840617e31..619d5d7c892 100644 --- a/src/sage/matrix/special.py +++ b/src/sage/matrix/special.py @@ -1486,7 +1486,7 @@ def circulant(v, sparse=None): Return the circulant matrix specified by its 1st row `v` A circulant `n \times n` matrix specified by the 1st row `v=(v_0...v_{n-1})` is - the matrix $(c_{ij})_{0 \leq i,j\leq n-1}$, where $c_{ij}=v_{j-i \mod b}$. + the matrix `(c_{ij})_{0 \leq i,j\leq n-1}`, where `c_{ij}=v_{j-i \mod b}`. INPUT: diff --git a/src/sage/matrix/symplectic_basis.py b/src/sage/matrix/symplectic_basis.py index 29e04edd6e2..4caee7a6da6 100644 --- a/src/sage/matrix/symplectic_basis.py +++ b/src/sage/matrix/symplectic_basis.py @@ -145,17 +145,17 @@ def symplectic_basis_over_field(M): Returns a pair (F, C) such that the rows of C form a symplectic basis for M and ``F = C * M * C.transpose()``. - Anti-symmetric means that $M = -M^t$. Alternating means that the - diagonal of $M$ is identically zero. + Anti-symmetric means that `M = -M^t`. Alternating means that the + diagonal of `M` is identically zero. - A symplectic basis is a basis of the form $e_1, - \ldots, e_j, f_1, \ldots f_j, z_1, \ldots, z_k$ such that + A symplectic basis is a basis of the form `e_1, + \ldots, e_j, f_1, \ldots f_j, z_1, \ldots, z_k` such that - * $z_i M v^t$ = 0 for all vectors $v$; - * $e_i M {e_j}^t = 0$ for all $i, j$; - * $f_i M {f_j}^t = 0$ for all $i, j$; - * $e_i M {f_i}^t = 1$ for all $i$; - * $e_i M {f_j}^t = 0$ for all $i$ not equal $j$. + * `z_i M v^t` = 0 for all vectors `v`; + * `e_i M {e_j}^t = 0` for all `i, j`; + * `f_i M {f_j}^t = 0` for all `i, j`; + * `e_i M {f_i}^t = 1` for all `i`; + * `e_i M {f_j}^t = 0` for all `i` not equal `j`. See the examples for a pictorial description of such a basis. diff --git a/src/sage/media/wav.py b/src/sage/media/wav.py index cbe77237003..6252c6080e1 100644 --- a/src/sage/media/wav.py +++ b/src/sage/media/wav.py @@ -70,8 +70,8 @@ class Wave(SageObject): Indexing: - Getting the $n$th item in a Wave object will give you the value - of the $n$th frame. + Getting the `n^{th}` item in a Wave object will give you the value + of the `n^{th}` frame. """ def __init__(self, data=None, **kwds): if data is not None: @@ -197,7 +197,7 @@ def getnframes(self): def readframes(self, n): """ - Read out the raw data for the first $n$ frames of this wave object. + Read out the raw data for the first `n` frames of this wave object. INPUT: diff --git a/src/sage/modular/arithgroup/congroup_sl2z.py b/src/sage/modular/arithgroup/congroup_sl2z.py index ce8a4a80f2c..062f835517c 100644 --- a/src/sage/modular/arithgroup/congroup_sl2z.py +++ b/src/sage/modular/arithgroup/congroup_sl2z.py @@ -48,7 +48,7 @@ class SL2Z_class(Gamma0_class): def __init__(self): r""" - The modular group $\SL_2(\Z)$. + The modular group `\SL_2(\Z)`. EXAMPLES:: @@ -165,7 +165,7 @@ def reduce_cusp(self, c): r""" Return the unique reduced cusp equivalent to c under the action of self. Always returns Infinity, since there is only - one equivalence class of cusps for $SL_2(Z)$. + one equivalence class of cusps for `SL_2(Z)`. EXAMPLES:: diff --git a/src/sage/modular/modform/numerical.py b/src/sage/modular/modform/numerical.py index 47dbdd6762b..eb66a1ab69b 100644 --- a/src/sage/modular/modform/numerical.py +++ b/src/sage/modular/modform/numerical.py @@ -53,7 +53,7 @@ class NumericalEigenforms(SageObject): A numerical eigenforms object, with the following useful methods: - - :meth:`ap` - return all eigenvalues of $T_p$ + - :meth:`ap` - return all eigenvalues of `T_p` - :meth:`eigenvalues` - list of eigenvalues corresponding to the given list of primes, e.g.,:: From 1176758659e48a56fe3cf8e5a871a212f5a5f8a9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Jun 2022 14:00:44 -0700 Subject: [PATCH 322/338] pkgs/sage-setup: Add jinja2 dep to requirements.txt, setup.cfg --- pkgs/sage-setup/requirements.txt | 1 + pkgs/sage-setup/setup.cfg | 1 + 2 files changed, 2 insertions(+) diff --git a/pkgs/sage-setup/requirements.txt b/pkgs/sage-setup/requirements.txt index e92efbdfa0e..3853e7d55b7 100644 --- a/pkgs/sage-setup/requirements.txt +++ b/pkgs/sage-setup/requirements.txt @@ -1,2 +1,3 @@ Cython pkgconfig +jinja2 diff --git a/pkgs/sage-setup/setup.cfg b/pkgs/sage-setup/setup.cfg index 79fd069f7c0..05f152ef60b 100644 --- a/pkgs/sage-setup/setup.cfg +++ b/pkgs/sage-setup/setup.cfg @@ -35,3 +35,4 @@ python_requires = >=3.8, <3.11 install_requires = pkgconfig + jinja2 From 25228977a73b100d8179fdb6d2662989deb993c6 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Sun, 12 Jun 2022 13:41:26 -0700 Subject: [PATCH 323/338] trac 33973: remove dollar signs in matrix_polynomial_dense.pyx --- src/sage/matrix/matrix_polynomial_dense.pyx | 242 ++++++++++---------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/src/sage/matrix/matrix_polynomial_dense.pyx b/src/sage/matrix/matrix_polynomial_dense.pyx index 6f2969d91c8..0c7ad5e4aa8 100644 --- a/src/sage/matrix/matrix_polynomial_dense.pyx +++ b/src/sage/matrix/matrix_polynomial_dense.pyx @@ -47,29 +47,29 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): r""" Dense matrix over a univariate polynomial ring over a field. - For a field $\Bold{K}$, we consider matrices over the univariate - polynomial ring $\Bold{K}[x]$. + For a field `\Bold{K}`, we consider matrices over the univariate + polynomial ring `\Bold{K}[x]`. - They are often used to represent bases of some $\Bold{K}[x]$-modules. In + They are often used to represent bases of some `\Bold{K}[x]`-modules. In this context, there are two possible representations which are both commonly used in the literature. - Working column-wise: each column of the matrix is a vector in the basis; - then, a $\\Bold{K}[x]$-submodule of $\\Bold{K}[x]^{m}$ of rank $n$ is - represented by an $m \\times n$ matrix, whose columns span the module - (via $\\Bold{K}[x]$-linear combinations). This matrix has full rank, - and $n \\leq m$. + then, a `\Bold{K}[x]`-submodule of `\Bold{K}[x]^{m}` of rank `n` is + represented by an `m \times n` matrix, whose columns span the module + (via `\Bold{K}[x]`-linear combinations). This matrix has full rank, + and `n \leq m`. - Working row-wise: each row of the matrix is a vector in the basis; then, - a $\\Bold{K}[x]$-submodule of $\\Bold{K}[x]^{n}$ of rank $m$ is - represented by an $m \\times n$ matrix, whose rows span the module (via - $\\Bold{K}[x]$-linear combinations). This matrix has full rank, and $m - \\leq n$. + a `\Bold{K}[x]`-submodule of `\Bold{K}[x]^{n}` of rank `m` is + represented by an `m \times n` matrix, whose rows span the module (via + `\Bold{K}[x]`-linear combinations). This matrix has full rank, and `m + \leq n`. For the rest of this class description, we assume that one is working row-wise. For a given such module, all its bases are equivalent under left-multiplication by a unimodular matrix, that is, a square matrix which - has determinant in $\Bold{K}\setminus\{0\}$. + has determinant in `\Bold{K}\setminus\{0\}`. There are bases which are called reduced or minimal: their rows have the minimal degree possible among all bases of this module; here the degree of @@ -82,17 +82,17 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): These notions can be extended via a more general degree measure, involving a tuple of integers which is called shift and acts as column degree shifts - in the definition of row degree. Precisely, for given $s_1,\ldots,s_n \in - \ZZ$ and a row vector $[p_1 \; \cdots \; p_n] \in \Bold{K}[x]^{1 \times - n}$, its shifted row degree is the maximum of $\deg(p_j) + s_j$ for $1 \leq - j \leq n$ (see :meth:`row_degrees`). Then, reduced bases and Popov bases + in the definition of row degree. Precisely, for given `s_1,\ldots,s_n \in + \ZZ` and a row vector `[p_1 \; \cdots \; p_n] \in \Bold{K}[x]^{1 \times + n}`, its shifted row degree is the maximum of `\deg(p_j) + s_j` for `1 \leq + j \leq n` (see :meth:`row_degrees`). Then, reduced bases and Popov bases are defined similarly, with respect to this notion of degree. Another important canonical basis is the Hermite basis, which is an upper triangular matrix satisfying a normalization condition similar to that for - the Popov basis. In fact, if $d$ is the largest degree appearing in the + the Popov basis. In fact, if `d` is the largest degree appearing in the Hermite basis, then the Hermite basis coincide with the shifted Popov basis - with the shifts $((n-1)d,\ldots,2d,d,0)$. + with the shifts `((n-1)d,\ldots,2d,d,0)`. """ def _check_shift_dimension(self, shifts, row_wise=True): @@ -100,9 +100,9 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Raises an exception if the ``shifts`` argument does not have the right length. - For an $m \times n$ polynomial matrix, if working row-wise then - ``shifts`` should have $n$ entries; if working column-wise, it should - have $m$ entries. + For an `m \times n` polynomial matrix, if working row-wise then + ``shifts`` should have `n` entries; if working column-wise, it should + have `m` entries. INPUT: @@ -168,17 +168,17 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): r""" Return the matrix of the (shifted) degrees in this matrix. - For a given polynomial matrix $M = (M_{i,j})_{i,j}$, its degree matrix - is the matrix $(\deg(M_{i,j}))_{i,j}$ formed by the degrees of its - entries. Here, the degree of the zero polynomial is $-1$. + For a given polynomial matrix `M = (M_{i,j})_{i,j}`, its degree matrix + is the matrix `(\deg(M_{i,j}))_{i,j}` formed by the degrees of its + entries. Here, the degree of the zero polynomial is `-1`. - For given shifts $s_1,\ldots,s_m \in \ZZ$, the shifted degree - matrix of $M$ is either $(\deg(M_{i,j})+s_j)_{i,j}$ if working - row-wise, or $(\deg(M_{i,j})+s_i)_{i,j}$ if working column-wise. In the - former case, $m$ has to be the number of columns of $M$; in the latter - case, the number of its rows. Here, if $M_{i,j}=0$ then the + For given shifts `s_1,\ldots,s_m \in \ZZ`, the shifted degree + matrix of `M` is either `(\deg(M_{i,j})+s_j)_{i,j}` if working + row-wise, or `(\deg(M_{i,j})+s_i)_{i,j}` if working column-wise. In the + former case, `m` has to be the number of columns of `M`; in the latter + case, the number of its rows. Here, if `M_{i,j}=0` then the corresponding entry in the shifted degree matrix is - $\min(s_1,\ldots,s_m)-1$. For more on shifts and working row-wise + `\min(s_1,\ldots,s_m)-1`. For more on shifts and working row-wise versus column-wise, see the class documentation. INPUT: @@ -295,12 +295,12 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): - if `d` is an integer, this selects the coefficient of `d` for all entries; - - if `d` is a list $(d_1,\ldots,d_m)$ and ``row_wise`` is ``True``, - this selects the coefficient of degree $d_i$ for all entries of the - $i$th row for each $i$; - - if `d` is a list $(d_1,\ldots,d_n)$ and ``row_wise`` is ``False``, - this selects the coefficient of degree $d_i$ for all entries of the - $j$th column for each $j$. + - if `d` is a list `(d_1,\ldots,d_m)` and ``row_wise`` is ``True``, + this selects the coefficient of degree `d_i` for all entries of the + `i`th row for each `i`; + - if `d` is a list `(d_1,\ldots,d_n)` and ``row_wise`` is ``False``, + this selects the coefficient of degree `d_i` for all entries of the + `j`th column for each `j`. INPUT: @@ -388,12 +388,12 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): - if `d` is an integer, the truncation is at precision `d` for all entries; - - if `d` is a list $(d_1,\ldots,d_m)$ and ``row_wise`` is ``True``, all - entries of the $i$th row are truncated at precision $d_i$ for each - $i$; - - if `d` is a list $(d_1,\ldots,d_n)$ and ``row_wise`` is ``False``, - all entries of the $j$th column are truncated at precision $d_j$ for - each $j$. + - if `d` is a list `(d_1,\ldots,d_m)` and ``row_wise`` is ``True``, all + entries of the `i`th row are truncated at precision `d_i` for each + `i`; + - if `d` is a list `(d_1,\ldots,d_n)` and ``row_wise`` is ``False``, + all entries of the `j`th column are truncated at precision `d_j` for + each `j`. Here the convention for univariate polynomials is to take zero for the truncation for a negative `d`. @@ -480,10 +480,10 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): all its entries as specified by `d`. - if `d` is an integer, the shift is by `d` for all entries; - - if `d` is a list $(d_1,\ldots,d_m)$ and ``row_wise`` is ``True``, all - entries of the $i$th row are shifted by $d_i$ for each $i$; - - if `d` is a list $(d_1,\ldots,d_n)$ and ``row_wise`` is ``False``, - all entries of the $j$th column are shifted by $d_j$ for each $j$. + - if `d` is a list `(d_1,\ldots,d_m)` and ``row_wise`` is ``True``, all + entries of the `i`th row are shifted by `d_i` for each `i`; + - if `d` is a list `(d_1,\ldots,d_n)` and ``row_wise`` is ``False``, + all entries of the `j`th column are shifted by `d_j` for each `j`. Shifting by `d` means multiplying by the variable to the power `d`; if `d` is negative then terms of negative degree after shifting are @@ -586,12 +586,12 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): it; - if ``degree`` is not provided, then all entries are reversed with respect to the degree of the whole matrix; - - if ``degree`` is a list $(d_1,\ldots,d_m)$ and ``row_wise`` is - ``True``, all entries of the $i$th row are reversed with respect to - $d_i$ for each $i$; - - if ``degree`` is a list $(d_1,\ldots,d_n)$ and ``row_wise`` is - ``False``, all entries of the $j$th column are reversed with respect - to $d_j$ for each $j$. + - if ``degree`` is a list `(d_1,\ldots,d_m)` and ``row_wise`` is + ``True``, all entries of the `i`th row are reversed with respect to + `d_i` for each `i`; + - if ``degree`` is a list `(d_1,\ldots,d_n)` and ``row_wise`` is + ``False``, all entries of the `j`th column are reversed with respect + to `d_j` for each `j`. INPUT: @@ -733,7 +733,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): INPUT: a positive integer `d` . - OUTPUT: the unique polynomial matrix $B$ of degree less than `d` such + OUTPUT: the unique polynomial matrix `B` of degree less than `d` such that `AB` and `BA` are the identity matrix modulo `x^d`, where `A` is ``self``. @@ -1069,15 +1069,15 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): r""" Return the (shifted) row degrees of this matrix. - For a given polynomial matrix $M = (M_{i,j})_{i,j}$ with $m$ rows and - $n$ columns, its row degrees is the tuple $(d_1,\ldots,d_m)$ where $d_i - = \max_j(\deg(M_{i,j}))$ for $1\leq i \leq m$. Thus, $d_i=-1$ if - the $i$-th row of $M$ is zero, and $d_i \geq 0$ otherwise. + For a given polynomial matrix `M = (M_{i,j})_{i,j}` with `m` rows and + `n` columns, its row degrees is the tuple `(d_1,\ldots,d_m)` where `d_i + = \max_j(\deg(M_{i,j}))` for `1\leq i \leq m`. Thus, `d_i=-1` if + the `i`-th row of `M` is zero, and `d_i \geq 0` otherwise. - For given shifts $s_1,\ldots,s_n \in \ZZ$, the shifted row degrees of - $M$ is $(d_1,\ldots,d_m)$ where $d_i = \max_j(\deg(M_{i,j})+s_j)$. - Here, if the $i$-th row of $M$ is zero then $d_i - =\min(s_1,\ldots,s_n)-1$; otherwise, $d_i$ is larger than this value. + For given shifts `s_1,\ldots,s_n \in \ZZ`, the shifted row degrees of + `M` is `(d_1,\ldots,d_m)` where `d_i = \max_j(\deg(M_{i,j})+s_j)`. + Here, if the `i`-th row of `M` is zero then `d_i + =\min(s_1,\ldots,s_n)-1`; otherwise, `d_i` is larger than this value. INPUT: @@ -1114,7 +1114,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): sage: M.row_degrees(shifts=[-2,1,2]) [2, 1, -3] - The row degrees of an empty matrix ($0\times n$ or $m\times 0$) is + The row degrees of an empty matrix (`0\times n` or `m\times 0`) is not defined:: sage: M = Matrix( pR, 0, 3 ) @@ -1144,15 +1144,15 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): r""" Return the (shifted) column degrees of this matrix. - For a given polynomial matrix $M = (M_{i,j})_{i,j}$ with $m$ rows and - $n$ columns, its column degrees is the tuple $(d_1,\ldots,d_n)$ where - $d_j = \max_i(\deg(M_{i,j}))$ for $1\leq j \leq n$. Thus, $d_j=-1$ if - the $j$-th column of $M$ is zero, and $d_j \geq 0$ otherwise. + For a given polynomial matrix `M = (M_{i,j})_{i,j}` with `m` rows and + `n` columns, its column degrees is the tuple `(d_1,\ldots,d_n)` where + `d_j = \max_i(\deg(M_{i,j}))` for `1\leq j \leq n`. Thus, `d_j=-1` if + the `j`-th column of `M` is zero, and `d_j \geq 0` otherwise. - For given shifts $s_1,\ldots,s_m \in \ZZ$, the shifted column degrees of - $M$ is $(d_1,\ldots,d_n)$ where $d_j = \max_i(\deg(M_{i,j})+s_i)$. - Here, if the $j$-th column of $M$ is zero then $d_j = - \min(s_1,\ldots,s_m)-1$; otherwise $d_j$ is larger than this value. + For given shifts `s_1,\ldots,s_m \in \ZZ`, the shifted column degrees of + `M` is `(d_1,\ldots,d_n)` where `d_j = \max_i(\deg(M_{i,j})+s_i)`. + Here, if the `j`-th column of `M` is zero then `d_j = + \min(s_1,\ldots,s_m)-1`; otherwise `d_j` is larger than this value. INPUT: @@ -1177,7 +1177,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): sage: M.column_degrees(shifts=[-2,1]) [4, -3, -2] - The column degrees of an empty matrix ($0\times n$ or $m\times 0$) is + The column degrees of an empty matrix (`0\times n` or `m\times 0`) is not defined:: sage: M = Matrix( pR, 0, 3 ) @@ -1211,22 +1211,22 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): r""" Return the (shifted) leading matrix of this matrix. - Let $M$ be a univariate polynomial matrix in $\Bold{K}[x]^{m \times - n}$. Working row-wise and without shifts, its leading matrix is the - matrix in $\Bold{K}^{m \times n}$ formed by the leading coefficients of - the entries of $M$ which reach the degree of the corresponding row. + Let `M` be a univariate polynomial matrix in `\Bold{K}[x]^{m \times + n}`. Working row-wise and without shifts, its leading matrix is the + matrix in `\Bold{K}^{m \times n}` formed by the leading coefficients of + the entries of `M` which reach the degree of the corresponding row. - More precisely, if working row-wise, let $s_1,\ldots,s_n \in \ZZ$ - be a shift, and let $(d_1,\ldots,d_m)$ denote the shifted row degrees of - $M$. Then, the shifted leading matrix of $M$ is the matrix in - $\Bold{K}^{m \times n}$ whose entry $i,j$ is the coefficient of degree - $d_i-s_j$ of the entry $i,j$ of $M$. - - If working column-wise, let $s_1,\ldots,s_m \in \ZZ$ be a shift, - and let $(d_1,\ldots,d_n)$ denote the shifted column degrees of $M$. - Then, the shifted leading matrix of $M$ is the matrix in $\Bold{K}^{m - \times n}$ whose entry $i,j$ is the coefficient of degree $d_j-s_i$ of - the entry $i,j$ of $M$. + More precisely, if working row-wise, let `s_1,\ldots,s_n \in \ZZ` + be a shift, and let `(d_1,\ldots,d_m)` denote the shifted row degrees of + `M`. Then, the shifted leading matrix of `M` is the matrix in + `\Bold{K}^{m \times n}` whose entry `i,j` is the coefficient of degree + `d_i-s_j` of the entry `i,j` of `M`. + + If working column-wise, let `s_1,\ldots,s_m \in \ZZ` be a shift, + and let `(d_1,\ldots,d_n)` denote the shifted column degrees of `M`. + Then, the shifted leading matrix of `M` is the matrix in `\Bold{K}^{m + \times n}` whose entry `i,j` is the coefficient of degree `d_j-s_i` of + the entry `i,j` of `M`. INPUT: @@ -1296,12 +1296,12 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): def _is_empty_popov(self, row_wise=True, include_zero_vectors=True): r""" - Assuming that this matrix is empty, that is, of dimensions $0\times n$ - or $m\times 0$, return a boolean indicating if it is in shifted Popov + Assuming that this matrix is empty, that is, of dimensions `0\times n` + or `m\times 0`, return a boolean indicating if it is in shifted Popov form. If zero vectors are allowed in shifted reduced forms, this always returns true. Otherwise, by convention and if working row-wise, for - $n\geq 0$ the $0\times n$ matrix is in shifted Popov form for all - shifts, and for $m>0$ the $m \times 0$ matrix is not in shifted Popov + `n\geq 0` the `0\times n` matrix is in shifted Popov form for all + shifts, and for `m>0` the `m \times 0` matrix is not in shifted Popov form for any shift. The convention is similar if working column-wise. The behaviour of this method for non-empty matrices is not defined. @@ -1355,18 +1355,18 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return a boolean indicating whether this matrix is in (shifted) reduced form. - An $m \times n$ univariate polynomial matrix $M$ is said to be in - shifted row reduced form if it has $k$ nonzero rows with $k \leq n$ and - its shifted leading matrix has rank $k$. Equivalently, when considering - all the matrices obtained by left-multiplying $M$ by a unimodular - matrix, then the shifted row degrees of $M$ -- once sorted in + An `m \times n` univariate polynomial matrix `M` is said to be in + shifted row reduced form if it has `k` nonzero rows with `k \leq n` and + its shifted leading matrix has rank `k`. Equivalently, when considering + all the matrices obtained by left-multiplying `M` by a unimodular + matrix, then the shifted row degrees of `M` -- once sorted in nondecreasing order -- is lexicographically minimal. - Similarly, $M$ is said to be in shifted column reduced form if it has - $k$ nonzero columns with $k \leq m$ and its shifted leading matrix has - rank $k$. + Similarly, `M` is said to be in shifted column reduced form if it has + `k` nonzero columns with `k \leq m` and its shifted leading matrix has + rank `k`. - Sometimes, one forbids $M$ to have zero rows (resp. columns) in the + Sometimes, one forbids `M` to have zero rows (resp. columns) in the above definitions; an optional parameter allows one to adopt this more restrictive setting. @@ -1435,15 +1435,15 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return the (shifted) leading positions (also known as the pivot indices), and optionally the (shifted) pivot degrees of this matrix. - If working row-wise, for a given shift $s_1,\ldots,s_n \in - \ZZ$, taken as $(0,\ldots,0)$ by default, and a row vector of - univariate polynomials $[p_1,\ldots,p_n]$, the leading position of - this vector is the index $j$ of the rightmost nonzero entry $p_j$ such - that $\deg(p_j) + s_j$ is equal to the shifted row degree of the vector. - Then the pivot degree of the vector is the degree $\deg(p_j)$. + If working row-wise, for a given shift `s_1,\ldots,s_n \in + \ZZ`, taken as `(0,\ldots,0)` by default, and a row vector of + univariate polynomials `[p_1,\ldots,p_n]`, the leading position of + this vector is the index `j` of the rightmost nonzero entry `p_j` such + that `\deg(p_j) + s_j` is equal to the shifted row degree of the vector. + Then the pivot degree of the vector is the degree `\deg(p_j)`. - For the zero row, both the leading positions and degree are $-1$. For - a $m \times n$ polynomial matrix, the leading positions and pivot + For the zero row, both the leading positions and degree are `-1`. For + a `m \times n` polynomial matrix, the leading positions and pivot degrees are the two lists containing the leading positions and the pivot degrees of its rows. @@ -1498,8 +1498,8 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): sage: M.leading_positions(shifts=[2,0], row_wise=False,return_degree=True) ([1, -1, 0], [3, -1, 0]) - The leading positions and pivot degrees of an empty matrix ($0\times n$ - or $m\times 0$) is not defined:: + The leading positions and pivot degrees of an empty matrix (`0\times n` + or `m\times 0`) is not defined:: sage: M = Matrix( pR, 0, 3 ) sage: M.leading_positions() @@ -1834,9 +1834,9 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): the matrix, and in each nonzero row the pivot (leftmost nonzero entry) is strictly to the right of the pivot of the row just above this row. - Note that, for any integer $d$ strictly greater than all degrees + Note that, for any integer `d` strictly greater than all degrees appearing in the Hermite form, then the Hermite form coincides with the - shifted Popov form with the shifts $((n-1)d,\ldots,2d,d,0)$, where $n$ + shifted Popov form with the shifts `((n-1)d,\ldots,2d,d,0)`, where `n` is the column dimension. If working column-wise, a polynomial matrix is said to be in Hermite @@ -1932,8 +1932,8 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return a (shifted) (ordered) weak Popov form of this matrix. See :meth:`is_weak_popov` for a definition of weak Popov forms. If the - input matrix is $A$, a weak Popov form of $A$ is any matrix $P$ in weak - Popov form and such that $UA = P$ for some unimodular matrix $U$. The + input matrix is `A`, a weak Popov form of `A` is any matrix `P` in weak + Popov form and such that `UA = P` for some unimodular matrix `U`. The latter matrix is called the transformation, and the first optional argument allows one to specify whether to return this transformation. @@ -2230,9 +2230,9 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return the (shifted) Popov form of this matrix. See :meth:`is_popov` for a definition of Popov forms. If the input - matrix is $A$, the (shifted) Popov form of $A$ is the unique matrix $P$ - in (shifted) Popov form and such that $UA = P$ for some unimodular - matrix $U$. The latter matrix is called the transformation, and the + matrix is `A`, the (shifted) Popov form of `A` is the unique matrix `P` + in (shifted) Popov form and such that `UA = P` for some unimodular + matrix `U`. The latter matrix is called the transformation, and the first optional argument allows one to specify whether to return this transformation. We refer to the description of :meth:`weak_popov_form` for an explanation of the option ``include_zero_vectors`` . @@ -2424,9 +2424,9 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return a row reduced form of this matrix (resp. a column reduced form if the optional parameter ``row_wise`` is set to ``False``). - An $m \times n$ univariate polynomial matrix $M$ is said to be in - (shifted) row reduced form if it has $k$ nonzero rows with $k \leq n$ - and its (shifted) leading matrix has rank $k$. See :meth:`is_reduced` + An `m \times n` univariate polynomial matrix `M` is said to be in + (shifted) row reduced form if it has `k` nonzero rows with `k \leq n` + and its (shifted) leading matrix has rank `k`. See :meth:`is_reduced` for more information. Currently, the implementation of this method is a direct call to @@ -2548,8 +2548,8 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): Return the Hermite form of this matrix. See :meth:`is_hermite` for a definition of Hermite forms. If the input - is a matrix $A$, then its Hermite form is the unique matrix $H$ in Hermite - form such that $UA = H$ for some unimodular matrix $U$. + is a matrix `A`, then its Hermite form is the unique matrix `H` in Hermite + form such that `UA = H` for some unimodular matrix `U`. INPUT: From 9fa71012bd6bb05fef4d5e53acb95f64a612c7f2 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Mon, 13 Jun 2022 09:30:58 +0900 Subject: [PATCH 324/338] Add missing title to conf.py --- .gitignore | 1 + src/sage_docbuild/conf.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.gitignore b/.gitignore index 1c92edd7e12..59b7fb8b9e4 100644 --- a/.gitignore +++ b/.gitignore @@ -187,6 +187,7 @@ build/bin/sage-build-env-config # Generated by docbuild /src/doc/en/reference/*/sage +/src/doc/en/reference/*/sage_docbuild /src/doc/en/reference/sage /src/doc/en/reference/spkg/*.rst /src/doc/output diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index c0866c0af75..f8268444f4f 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -1,3 +1,20 @@ +r""" +Sphinx build configuration + +This file contains configuration needed to customize Sphinx input and output +behavior. +""" + +# **************************************************************************** +# Copyright (C) 2022 Kwankyu Lee +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# https://www.gnu.org/licenses/ +# **************************************************************************** + import importlib import sys import os From 818410f0f4c4b14e14741e0c7b4fe2aabac8ba61 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 13 Feb 2022 16:11:29 -0500 Subject: [PATCH 325/338] Trac #33213: replace SAGE_TMP in the isgci database download routine. ...and make it work on python3. The database download requires internet access and isn't tested by default. As a result, it lay broken for a while -- the local file needs to be opened in binary mode to write the bytes returned by urlopen(). --- src/sage/graphs/isgci.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/sage/graphs/isgci.py b/src/sage/graphs/isgci.py index 69858727ee7..ac6b3d15605 100644 --- a/src/sage/graphs/isgci.py +++ b/src/sage/graphs/isgci.py @@ -826,22 +826,20 @@ def _download_db(self): sage: graph_classes._download_db() # Not tested -- requires internet """ - from sage.misc.misc import SAGE_TMP + import tempfile u = urlopen('https://www.graphclasses.org/data.zip', - context=default_context()) - localFile = open(os.path.join(SAGE_TMP, 'isgci.zip'), 'w') - localFile.write(u.read()) - localFile.close() - z = zipfile.ZipFile(os.path.join(SAGE_TMP, 'isgci.zip')) - - # Save a systemwide updated copy whenever possible - - try: - z.extract(_XML_FILE, GRAPHS_DATA_DIR) - z.extract(_SMALLGRAPHS_FILE, GRAPHS_DATA_DIR) - except IOError: - z.extract(_XML_FILE, SAGE_TMP) - z.extract(_SMALLGRAPHS_FILE, GRAPHS_DATA_DIR) + context=SSLContext()) + with tempfile.NamedTemporaryFile(suffix=".zip") as f: + f.write(u.read()) + z = zipfile.ZipFile(f.name) + + # Save a systemwide updated copy whenever possible + try: + z.extract(_XML_FILE, GRAPHS_DATA_DIR) + z.extract(_SMALLGRAPHS_FILE, GRAPHS_DATA_DIR) + except IOError: + z.extract(_XML_FILE, d) + z.extract(_SMALLGRAPHS_FILE, GRAPHS_DATA_DIR) def _parse_db(self, directory): r""" From 71c93257a890243480177145bfad474e3a94e1de Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 13 Feb 2022 20:11:04 -0500 Subject: [PATCH 326/338] Trac #33213: replace SAGE_TMP in GLPK graph backend doctests. --- .../numerical/backends/glpk_graph_backend.pyx | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/sage/numerical/backends/glpk_graph_backend.pyx b/src/sage/numerical/backends/glpk_graph_backend.pyx index 564c108fdf4..877b45c2ed3 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pyx +++ b/src/sage/numerical/backends/glpk_graph_backend.pyx @@ -160,11 +160,12 @@ cdef class GLPKGraphBackend(): sage: gbe.add_vertices([None, None]) ['0', '1'] sage: a = gbe.add_edge('0', '1') - sage: gbe.write_graph(SAGE_TMP+"/graph.txt") + sage: import tempfile + sage: with tempfile.NamedTemporaryFile() as f: + ....: _ = gbe.write_graph(f.name) + ....: gbe1 = GLPKGraphBackend(f.name, "plain") Writing graph to ... 4 lines were written - 0 - sage: gbe1 = GLPKGraphBackend(SAGE_TMP+"/graph.txt", "plain") Reading graph from ... Graph has 2 vertices and 1 edge 3 lines were read @@ -1048,7 +1049,9 @@ cdef class GLPKGraphBackend(): sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend sage: gbe = GLPKGraphBackend() sage: a = gbe.add_edge("0", "1") - sage: gbe.write_graph(SAGE_TMP+"/graph.txt") + sage: import tempfile + sage: with tempfile.NamedTemporaryFile() as f: + ....: gbe.write_graph(f.name) Writing graph to ... 4 lines were written 0 @@ -1078,7 +1081,9 @@ cdef class GLPKGraphBackend(): sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend sage: gbe = GLPKGraphBackend() sage: a = gbe.add_edge("0", "1") - sage: gbe.write_ccdata(SAGE_TMP+"/graph.dat") + sage: import tempfile + sage: with tempfile.NamedTemporaryFile() as f: + ....: gbe.write_ccdata(f.name) Writing graph to ... 6 lines were written 0 @@ -1104,7 +1109,9 @@ cdef class GLPKGraphBackend(): sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend sage: gbe = GLPKGraphBackend() sage: a = gbe.add_edge("0", "1") - sage: gbe.write_mincost(SAGE_TMP+"/graph.min") + sage: import tempfile + sage: with tempfile.NamedTemporaryFile() as f: + ....: gbe.write_mincost(f.name) Writing min-cost flow problem data to ... 4 lines were written 0 @@ -1200,20 +1207,23 @@ cdef class GLPKGraphBackend(): sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend sage: gbe = GLPKGraphBackend() + sage: import tempfile + sage: with tempfile.NamedTemporaryFile() as f: + ....: gbe.write_maxflow(f.name) + Traceback (most recent call last): + ... + OSError: Cannot write empty graph sage: gbe.add_vertices([None for i in range(2)]) ['0', '1'] sage: a = gbe.add_edge('0', '1') sage: gbe.maxflow_ffalg('0', '1') 0.0 - sage: gbe.write_maxflow(SAGE_TMP+"/graph.max") + sage: with tempfile.NamedTemporaryFile() as f: + ....: gbe.write_maxflow(f.name) Writing maximum flow problem data to ... 6 lines were written 0 - sage: gbe = GLPKGraphBackend() - sage: gbe.write_maxflow(SAGE_TMP+"/graph.max") - Traceback (most recent call last): - ... - OSError: Cannot write empty graph + """ if self.graph.nv <= 0: From 08213fa71416b2f41936097bcb7379dc1e1c4ff0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 13 Feb 2022 12:50:45 -0500 Subject: [PATCH 327/338] Trac #33213: replace SAGE_TMP in graph doctests. --- src/sage/graphs/bipartite_graph.py | 53 ++++++++++++++++-------------- src/sage/graphs/generic_graph.py | 6 ++-- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/sage/graphs/bipartite_graph.py b/src/sage/graphs/bipartite_graph.py index 2ec92b073a1..2d421accf32 100644 --- a/src/sage/graphs/bipartite_graph.py +++ b/src/sage/graphs/bipartite_graph.py @@ -245,14 +245,15 @@ class BipartiteGraph(Graph): #. From an alist file:: - sage: file_name = os.path.join(SAGE_TMP, 'deleteme.alist.txt') - sage: fi = open(file_name, 'w') - sage: _ = fi.write("7 4 \n 3 4 \n 3 3 1 3 1 1 1 \n 3 3 3 4 \n\ - 1 2 4 \n 1 3 4 \n 1 0 0 \n 2 3 4 \n\ - 2 0 0 \n 3 0 0 \n 4 0 0 \n\ - 1 2 3 0 \n 1 4 5 0 \n 2 4 6 0 \n 1 2 4 7 \n") - sage: fi.close() - sage: B = BipartiteGraph(file_name) + sage: import tempfile + sage: with tempfile.NamedTemporaryFile(mode="w+t") as f: + ....: _ = f.write("7 4 \n 3 4 \n 3 3 1 3 1 1 1 \n\ + ....: 3 3 3 4 \n 1 2 4 \n 1 3 4 \n 1 0 0 \n\ + ....: 2 3 4 \n 2 0 0 \n 3 0 0 \n 4 0 0 \n\ + ....: 1 2 3 0 \n 1 4 5 0 \n 2 4 6 0 \n\ + ....: 1 2 4 7 \n") + ....: f.flush() + ....: B = BipartiteGraph(f.name) sage: B.is_isomorphic(H) True @@ -1487,15 +1488,17 @@ def load_afile(self, fname): EXAMPLES:: - sage: file_name = os.path.join(SAGE_TMP, 'deleteme.alist.txt') - sage: fi = open(file_name, 'w') - sage: _ = fi.write("7 4 \n 3 4 \n 3 3 1 3 1 1 1 \n 3 3 3 4 \n\ - 1 2 4 \n 1 3 4 \n 1 0 0 \n 2 3 4 \n\ - 2 0 0 \n 3 0 0 \n 4 0 0 \n\ - 1 2 3 0 \n 1 4 5 0 \n 2 4 6 0 \n 1 2 4 7 \n") - sage: fi.close() - sage: B = BipartiteGraph() - sage: B.load_afile(file_name) + sage: import tempfile + sage: with tempfile.NamedTemporaryFile(mode="w+t") as f: + ....: _ = f.write("7 4 \n 3 4 \n 3 3 1 3 1 1 1 \n\ + ....: 3 3 3 4 \n 1 2 4 \n 1 3 4 \n\ + ....: 1 0 0 \n 2 3 4 \n 2 0 0 \n 3 0 0 \n\ + ....: 4 0 0 \n 1 2 3 0 \n 1 4 5 0 \n\ + ....: 2 4 6 0 \n 1 2 4 7 \n") + ....: f.flush() + ....: B = BipartiteGraph() + ....: B2 = BipartiteGraph(f.name) + ....: B.load_afile(f.name) Bipartite graph on 11 vertices sage: B.edges() [(0, 7, None), @@ -1511,7 +1514,6 @@ def load_afile(self, fname): (4, 8, None), (5, 9, None), (6, 10, None)] - sage: B2 = BipartiteGraph(file_name) sage: B2 == B True """ @@ -1582,15 +1584,17 @@ def save_afile(self, fname): [0 1 0 1 0 1 0] [1 1 0 1 0 0 1] sage: b = BipartiteGraph(M) - sage: file_name = os.path.join(SAGE_TMP, 'deleteme.alist.txt') - sage: b.save_afile(file_name) - sage: b2 = BipartiteGraph(file_name) + sage: import tempfile + sage: with tempfile.NamedTemporaryFile() as f: + ....: b.save_afile(f.name) + ....: b2 = BipartiteGraph(f.name) sage: b.is_isomorphic(b2) True TESTS:: - sage: file_name = os.path.join(SAGE_TMP, 'deleteme.alist.txt') + sage: import tempfile + sage: f = tempfile.NamedTemporaryFile() sage: for order in range(3, 13, 3): ....: num_chks = int(order / 3) ....: num_vars = order - num_chks @@ -1599,8 +1603,8 @@ def save_afile(self, fname): ....: g = graphs.RandomGNP(order, 0.5) ....: try: ....: b = BipartiteGraph(g, partition, check=False) - ....: b.save_afile(file_name) - ....: b2 = BipartiteGraph(file_name) + ....: b.save_afile(f.name) + ....: b2 = BipartiteGraph(f.name) ....: if not b.is_isomorphic(b2): ....: print("Load/save failed for code with edges:") ....: print(b.edges()) @@ -1610,6 +1614,7 @@ def save_afile(self, fname): ....: print("with edges: ") ....: g.edges() ....: raise + sage: f.close() # this removes the file """ # open the file try: diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 5cc9122c7f0..6f282621c46 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -21514,9 +21514,9 @@ def graphviz_to_file_named(self, filename, **options): EXAMPLES:: sage: G = Graph({0: {1: None, 2: None}, 1: {0: None, 2: None}, 2: {0: None, 1: None, 3: 'foo'}, 3: {2: 'foo'}}, sparse=True) - sage: tempfile = os.path.join(SAGE_TMP, 'temp_graphviz') - sage: G.graphviz_to_file_named(tempfile, edge_labels=True) - sage: with open(tempfile) as f: + sage: import tempfile + sage: with tempfile.NamedTemporaryFile(mode="a+t") as f: + ....: G.graphviz_to_file_named(f.name, edge_labels=True) ....: print(f.read()) graph { node_0 [label="0"]; From 976f0d686ee5375ed3894009a13b2cd54fcd89f2 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Fri, 10 Jun 2022 23:24:55 +0100 Subject: [PATCH 328/338] remove crud after except, make it pass --- src/sage/graphs/isgci.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/graphs/isgci.py b/src/sage/graphs/isgci.py index ac6b3d15605..811ce322156 100644 --- a/src/sage/graphs/isgci.py +++ b/src/sage/graphs/isgci.py @@ -838,8 +838,7 @@ def _download_db(self): z.extract(_XML_FILE, GRAPHS_DATA_DIR) z.extract(_SMALLGRAPHS_FILE, GRAPHS_DATA_DIR) except IOError: - z.extract(_XML_FILE, d) - z.extract(_SMALLGRAPHS_FILE, GRAPHS_DATA_DIR) + pass def _parse_db(self, directory): r""" From 4610b1c97f8c09e9b0a502491102d0e52448a19e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 13 Feb 2022 20:33:45 -0500 Subject: [PATCH 329/338] Trac #33213: replace ECL_TMP (based on SAGE_TMP) in maxima/ecl interfaces. We have historically massaged TMPDIR and TMP when interfacing with ECL to ensure that SAGE_TMP was used consistently for temporary files. Simply removing this code seems to do the trick, since ECL wants to use the system location by default. The existing ECL_TMP path is marked with a deprecation warning. --- src/sage/interfaces/maxima.py | 2 -- src/sage/interfaces/maxima_abstract.py | 2 -- src/sage/libs/ecl.pyx | 6 ------ src/sage/misc/misc.py | 17 +++++++++++++---- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py index 5044771eb7d..a05b4995cac 100644 --- a/src/sage/interfaces/maxima.py +++ b/src/sage/interfaces/maxima.py @@ -496,7 +496,6 @@ from random import randrange from sage.env import MAXIMA -from sage.misc.misc import ECL_TMP from .expect import (Expect, ExpectElement, gc_disabled) @@ -570,7 +569,6 @@ def __init__(self, script_subdirectory=None, logfile=None, server=None, name = 'maxima', prompt = r'\(\%i[0-9]+\) ', command = '{0} -p {1}'.format(MAXIMA, shlex.quote(STARTUP)), - env = {'TMPDIR': str(ECL_TMP)}, script_subdirectory = script_subdirectory, restart_on_ctrlc = False, verbose_start = False, diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py index 14cf31e9b98..3c563149393 100644 --- a/src/sage/interfaces/maxima_abstract.py +++ b/src/sage/interfaces/maxima_abstract.py @@ -59,7 +59,6 @@ from sage.cpython.string import bytes_to_str -from sage.misc.misc import ECL_TMP from sage.misc.multireplace import multiple_replace from sage.structure.richcmp import richcmp, rich_to_bool @@ -166,7 +165,6 @@ def _command_runner(self, command, s, redirect=True): """ cmd = '{} --very-quiet --batch-string="{}({});" '.format(MAXIMA, command, s) env = os.environ.copy() - env['TMPDIR'] = str(ECL_TMP) if redirect: res = bytes_to_str(subprocess.check_output(cmd, shell=True, diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx index 22730718183..2cfac57f544 100644 --- a/src/sage/libs/ecl.pyx +++ b/src/sage/libs/ecl.pyx @@ -21,7 +21,6 @@ from posix.signal cimport sigaction, sigaction_t cimport cysignals.signals from sage.libs.gmp.types cimport mpz_t -from sage.misc.misc import ECL_TMP from sage.cpython.string cimport str_to_bytes, char_to_str from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational @@ -273,11 +272,6 @@ def init_ecl(): list_of_objects=cl_cons(ECL_NIL,cl_cons(ECL_NIL,ECL_NIL)) cl_set(string_to_object(b"*SAGE-LIST-OF-OBJECTS*"), list_of_objects) - cl_eval(string_to_object(b""" - (setf (logical-pathname-translations "TMP") - '(("**;*.*" "%s/**/*.*"))) - """ % str_to_bytes(str(ECL_TMP)))) - # We define our own error catching eval, apply and funcall/ # Presently these routines are only converted to byte-code. If they # ever turn out to be a bottle neck, it should be easy to properly diff --git a/src/sage/misc/misc.py b/src/sage/misc/misc.py index da354511413..5c6504e39b7 100644 --- a/src/sage/misc/misc.py +++ b/src/sage/misc/misc.py @@ -239,11 +239,20 @@ def ECL_TMP(): sage: from sage.misc.misc import ECL_TMP sage: ECL_TMP - l'.../temp/.../ecl' + doctest:warning... + DeprecationWarning: ECL_TMP is deprecated and is no longer used + by the ECL interface in sage + See https://trac.sagemath.org/33213 for details. + ... + """ - d = os.path.join(str(SAGE_TMP), 'ecl') - os.makedirs(d, exist_ok=True) - return d + from sage.misc.superseded import deprecation + deprecation(33213, "ECL_TMP is deprecated and is no longer used by the ECL interface in sage") + import atexit, tempfile + d = tempfile.TemporaryDirectory() + result = os.path.join(d.name, 'ecl') + atexit.register(lambda: d.cleanup()) + return result @lazy_string From c79c24d9006b01319f15967c43949f2977057d59 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Mon, 13 Jun 2022 08:04:41 -0700 Subject: [PATCH 330/338] trac 33973: reviewer comments --- src/sage/groups/abelian_gps/dual_abelian_group_element.py | 2 +- src/sage/media/wav.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/groups/abelian_gps/dual_abelian_group_element.py b/src/sage/groups/abelian_gps/dual_abelian_group_element.py index 174d1435b68..aaabe107781 100644 --- a/src/sage/groups/abelian_gps/dual_abelian_group_element.py +++ b/src/sage/groups/abelian_gps/dual_abelian_group_element.py @@ -200,7 +200,7 @@ def word_problem(self, words, display=True): [[b^2*c^2*d^3*e^5, 245]] The command e.word_problem([u,v,w,x,y],display=True) returns - the same list but also prints `e = (b^2*c^2*d^3*e^5)^245`. + the same list but also prints ``e = (b^2*c^2*d^3*e^5)^245``. """ ## First convert the problem to one using AbelianGroups import copy diff --git a/src/sage/media/wav.py b/src/sage/media/wav.py index 6252c6080e1..7be09afdf41 100644 --- a/src/sage/media/wav.py +++ b/src/sage/media/wav.py @@ -70,8 +70,8 @@ class Wave(SageObject): Indexing: - Getting the `n^{th}` item in a Wave object will give you the value - of the `n^{th}` frame. + Getting the `n`-th item in a Wave object will give you the value + of the `n`-th frame. """ def __init__(self, data=None, **kwds): if data is not None: From 247381bda6edd12de83b91fd4415a52300b1961d Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Thu, 16 Jun 2022 12:53:57 +0800 Subject: [PATCH 331/338] doc tweaks --- src/sage/schemes/elliptic_curves/ell_field.py | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index c2d26a80ab4..6cd458b0dbf 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -770,24 +770,25 @@ def descend_to(self, K, f=None): def division_field(self, l, names=None, map=False, **kwds): r""" Given an elliptic curve over a number field or finite field `F` - and a prime number `\ell`, construct the field `F(E[\ell])`. + and a prime number `\ell`, construct the `\ell`-division field + `F(E[\ell])`. - INPUT: - - - ``\ell`` -- a prime number (an element of `\ZZ`). + The `\ell`-division field is the smallest extension of `F` over + which all `\ell`-torsion points of `E` are defined. - - ``names`` -- (default: ``t``) a variable name for the division field. - - - ``map`` -- (default: ``False``) also return an embedding of - the :meth:`base_field` into the resulting field. + INPUT: - - ``kwds`` -- additional keywords passed to - :func:`~sage.rings.polynomial.polynomial_element.Polynomial.splitting_field`. + - `\ell` -- a prime number (an element of `\ZZ`) + - ``names`` -- (default: ``t``) a variable name for the division field + - ``map`` -- (default: ``False``) also return an embedding of the + :meth:`base_field` into the resulting field + - ``kwds`` -- additional keyword arguments passed to + :func:`~sage.rings.polynomial.polynomial_element.Polynomial.splitting_field` OUTPUT: - If ``map`` is ``False``, the division field as an absolute number - field or a finite field. + If ``map`` is ``False``, the division field `K` as an absolute + number field or a finite field. If ``map`` is ``True``, a tuple `(K, \phi)` where `\phi` is an embedding of the base field in the division field `K`. @@ -797,8 +798,8 @@ def division_field(self, l, names=None, map=False, **kwds): field is large (e.g. when `\ell` is large or when the Galois representation is surjective). The ``simplify`` flag also has a big influence on the running time over number fields: - sometimes ``simplify=False`` is faster, sometimes - ``simplify=True`` (the default) is faster. + sometimes ``simplify=False`` is faster, sometimes the default + ``simplify=True`` is faster. EXAMPLES: From 3be7fe8c681169cbc9d0e0e9efe1db6ff87d5863 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Thu, 16 Jun 2022 12:55:37 +0800 Subject: [PATCH 332/338] move default value to argument list, where it belongs --- src/sage/schemes/elliptic_curves/ell_field.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 6cd458b0dbf..d7801e940be 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -767,7 +767,7 @@ def descend_to(self, K, f=None): Elist = [E.minimal_model() for E in Elist] return Elist - def division_field(self, l, names=None, map=False, **kwds): + def division_field(self, l, names='t', map=False, **kwds): r""" Given an elliptic curve over a number field or finite field `F` and a prime number `\ell`, construct the `\ell`-division field @@ -779,7 +779,7 @@ def division_field(self, l, names=None, map=False, **kwds): INPUT: - `\ell` -- a prime number (an element of `\ZZ`) - - ``names`` -- (default: ``t``) a variable name for the division field + - ``names`` -- (default: ``'t'``) a variable name for the division field - ``map`` -- (default: ``False``) also return an embedding of the :meth:`base_field` into the resulting field - ``kwds`` -- additional keyword arguments passed to @@ -964,9 +964,6 @@ def division_field(self, l, names=None, map=False, **kwds): if not l.is_prime(): raise ValueError("l must be a prime number") - if names is None: - names = 't' - verbose("Adjoining X-coordinates of %s-torsion points" % l) F = self.base_ring() f = self.division_polynomial(l) From 9a82ed8168794501d7979c5f94c86b8c8d36072a Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Thu, 16 Jun 2022 11:08:34 -0400 Subject: [PATCH 333/338] sage/modular/modform/ring.py: fix mistake and format docstrings --- src/sage/modular/modform/ring.py | 78 ++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index 52b6185b37a..e6fc11c739e 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -161,19 +161,19 @@ class ModularFormsRing(Parent): True sage: m.generators() [(2, 1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + O(q^10)), - (2, q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10))] + (2, q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10))] sage: m.q_expansion_basis(2,10) [1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + O(q^10), - q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10)] + q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10)] sage: m.q_expansion_basis(3,10) [] sage: m.q_expansion_basis(10,10) [1 + 10560*q^6 + 3960*q^8 + O(q^10), - q - 8056*q^7 - 30855*q^9 + O(q^10), - q^2 - 796*q^6 - 8192*q^8 + O(q^10), - q^3 + 66*q^7 + 832*q^9 + O(q^10), - q^4 + 40*q^6 + 528*q^8 + O(q^10), - q^5 + 20*q^7 + 190*q^9 + O(q^10)] + q - 8056*q^7 - 30855*q^9 + O(q^10), + q^2 - 796*q^6 - 8192*q^8 + O(q^10), + q^3 + 66*q^7 + 832*q^9 + O(q^10), + q^4 + 40*q^6 + 528*q^8 + O(q^10), + q^5 + 20*q^7 + 190*q^9 + O(q^10)] Elements of modular forms ring can be initiated via multivariate polynomials (see :meth:`from_polynomial`):: @@ -250,7 +250,7 @@ def some_elements(self): sage: ModularFormsRing(1).some_elements() [1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6), - 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6)] + 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6)] """ return [self(f) for f in self.gen_forms()] @@ -365,8 +365,8 @@ def _generators_variables_dictionnary(self, poly_parent, gens): sage: P = QQ['x, y, z'] sage: M._generators_variables_dictionnary(P, M.gen_forms()) {z: q^2 - 2*q^3 + 3*q^4 + O(q^6), - y: q + 5*q^3 - 2*q^4 + 6*q^5 + O(q^6), - x: 1 + 24*q^3 + O(q^6)} + y: q + 5*q^3 - 2*q^4 + 6*q^5 + O(q^6), + x: 1 + 24*q^3 + O(q^6)} """ if poly_parent.base_ring() != self.base_ring(): raise ValueError('the base ring of `poly_parent` must be the same as the base ring of the modular forms ring') @@ -675,18 +675,22 @@ def generators(self, maxweight=8, prec=10, start_gens=[], start_weight=2): EXAMPLES:: sage: ModularFormsRing(SL2Z).generators() - [(4, 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + 60480*q^6 + 82560*q^7 + 140400*q^8 + 181680*q^9 + O(q^10)), (6, 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 - 4058208*q^6 - 8471232*q^7 - 17047800*q^8 - 29883672*q^9 + O(q^10))] + [(4, 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + 60480*q^6 + 82560*q^7 + 140400*q^8 + 181680*q^9 + O(q^10)), + (6, 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 - 4058208*q^6 - 8471232*q^7 - 17047800*q^8 - 29883672*q^9 + O(q^10))] sage: s = ModularFormsRing(SL2Z).generators(maxweight=5, prec=3); s [(4, 1 + 240*q + 2160*q^2 + O(q^3))] sage: s[0][1].parent() Power Series Ring in q over Rational Field sage: ModularFormsRing(1).generators(prec=4) - [(4, 1 + 240*q + 2160*q^2 + 6720*q^3 + O(q^4)), (6, 1 - 504*q - 16632*q^2 - 122976*q^3 + O(q^4))] + [(4, 1 + 240*q + 2160*q^2 + 6720*q^3 + O(q^4)), + (6, 1 - 504*q - 16632*q^2 - 122976*q^3 + O(q^4))] sage: ModularFormsRing(2).generators(prec=12) - [(2, 1 + 24*q + 24*q^2 + 96*q^3 + 24*q^4 + 144*q^5 + 96*q^6 + 192*q^7 + 24*q^8 + 312*q^9 + 144*q^10 + 288*q^11 + O(q^12)), (4, 1 + 240*q^2 + 2160*q^4 + 6720*q^6 + 17520*q^8 + 30240*q^10 + O(q^12))] + [(2, 1 + 24*q + 24*q^2 + 96*q^3 + 24*q^4 + 144*q^5 + 96*q^6 + 192*q^7 + 24*q^8 + 312*q^9 + 144*q^10 + 288*q^11 + O(q^12)), + (4, 1 + 240*q^2 + 2160*q^4 + 6720*q^6 + 17520*q^8 + 30240*q^10 + O(q^12))] sage: ModularFormsRing(4).generators(maxweight=2, prec=20) - [(2, 1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + 144*q^10 + 96*q^12 + 192*q^14 + 24*q^16 + 312*q^18 + O(q^20)), (2, q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + 12*q^11 + 14*q^13 + 24*q^15 + 18*q^17 + 20*q^19 + O(q^20))] + [(2, 1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + 144*q^10 + 96*q^12 + 192*q^14 + 24*q^16 + 312*q^18 + O(q^20)), + (2, q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + 12*q^11 + 14*q^13 + 24*q^15 + 18*q^17 + 20*q^19 + O(q^20))] Here we see that for ``\Gamma_0(11)`` taking a basis of forms in weights 2 and 4 is enough to generate everything up to weight 12 (and probably @@ -709,16 +713,27 @@ def generators(self, maxweight=8, prec=10, start_gens=[], start_weight=2): sage: ModularFormsRing(Gamma1(4)).generators(prec=10, maxweight=10) [(2, 1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + O(q^10)), - (2, q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10)), - (3, 1 + 12*q^2 + 64*q^3 + 60*q^4 + 160*q^6 + 384*q^7 + 252*q^8 + O(q^10)), - (3, q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + 32*q^6 + 48*q^7 + 64*q^8 + 73*q^9 + O(q^10))] + (2, q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10)), + (3, 1 + 12*q^2 + 64*q^3 + 60*q^4 + 160*q^6 + 384*q^7 + 252*q^8 + O(q^10)), + (3, q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + 32*q^6 + 48*q^7 + 64*q^8 + 73*q^9 + O(q^10))] Using different base rings will change the generators:: sage: ModularFormsRing(Gamma0(13)).generators(maxweight=12, prec=4) - [(2, 1 + 2*q + 6*q^2 + 8*q^3 + O(q^4)), (4, 1 + O(q^4)), (4, q + O(q^4)), (4, q^2 + O(q^4)), (4, q^3 + O(q^4)), (6, 1 + O(q^4)), (6, q + O(q^4))] + [(2, 1 + 2*q + 6*q^2 + 8*q^3 + O(q^4)), + (4, 1 + O(q^4)), (4, q + O(q^4)), + (4, q^2 + O(q^4)), (4, q^3 + O(q^4)), + (6, 1 + O(q^4)), + (6, q + O(q^4))] sage: ModularFormsRing(Gamma0(13),base_ring=ZZ).generators(maxweight=12, prec=4) - [(2, 1 + 2*q + 6*q^2 + 8*q^3 + O(q^4)), (4, q + 4*q^2 + 10*q^3 + O(q^4)), (4, 2*q^2 + 5*q^3 + O(q^4)), (4, q^2 + O(q^4)), (4, -2*q^3 + O(q^4)), (6, O(q^4)), (6, O(q^4)), (12, O(q^4))] + [(2, 1 + 2*q + 6*q^2 + 8*q^3 + O(q^4)), + (4, q + 4*q^2 + 10*q^3 + O(q^4)), + (4, 2*q^2 + 5*q^3 + O(q^4)), + (4, q^2 + O(q^4)), + (4, -2*q^3 + O(q^4)), + (6, O(q^4)), + (6, O(q^4)), + (12, O(q^4))] sage: [k for k,f in ModularFormsRing(1, QQ).generators(maxweight=12)] [4, 6] sage: [k for k,f in ModularFormsRing(1, ZZ).generators(maxweight=12)] @@ -738,7 +753,9 @@ def generators(self, maxweight=8, prec=10, start_gens=[], start_weight=2): sage: f = (M.0 + M.1).qexp(10); f 1 + 17/5*q + 26/5*q^2 + 43/5*q^3 + 94/5*q^4 + 77/5*q^5 + 154/5*q^6 + 86/5*q^7 + 36*q^8 + 146/5*q^9 + O(q^10) sage: ModularFormsRing(11).generators(start_gens = [(2, f)]) - [(2, 1 + 17/5*q + 26/5*q^2 + 43/5*q^3 + 94/5*q^4 + 77/5*q^5 + 154/5*q^6 + 86/5*q^7 + 36*q^8 + 146/5*q^9 + O(q^10)), (2, 1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + 36*q^8 + 36*q^9 + O(q^10)), (4, 1 + O(q^10))] + [(2, 1 + 17/5*q + 26/5*q^2 + 43/5*q^3 + 94/5*q^4 + 77/5*q^5 + 154/5*q^6 + 86/5*q^7 + 36*q^8 + 146/5*q^9 + O(q^10)), + (2, 1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + 36*q^8 + 36*q^9 + O(q^10)), + (4, 1 + O(q^10))] """ sgs = [] for x in start_gens: @@ -765,7 +782,7 @@ def generators(self, maxweight=8, prec=10, start_gens=[], start_weight=2): def gen_forms(self, maxweight=8, start_gens=[], start_weight=2): r""" - Returns a list of modular forms generating this ring (as an algebra over + Return a list of modular forms generating this ring (as an algebra over the appropriate base ring). This method differs from :meth:`generators` only in that it returns @@ -795,8 +812,8 @@ def gen_forms(self, maxweight=8, start_gens=[], start_weight=2): sage: A = ModularFormsRing(Gamma0(11), Zmod(5)).gen_forms(); A [1 + 2*q^2 + 2*q^3 + 2*q^4 + 2*q^5 + O(q^6), - q + 3*q^2 + 4*q^3 + 2*q^4 + q^5 + O(q^6), - q + q^4 + O(q^6)] + q + 3*q^2 + 4*q^3 + 2*q^4 + q^5 + O(q^6), + q + q^4 + O(q^6)] sage: A[0].parent() Ring of Modular Forms for Congruence Subgroup Gamma0(11) over Ring of integers modulo 5 """ @@ -830,7 +847,10 @@ def _find_generators(self, maxweight, start_gens, start_weight): sage: R = ModularFormsRing(Gamma1(4)) sage: R._find_generators(8, (), 2) - [(2, 1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + O(q^9), 1 + 24*q^2 + 24*q^4 + O(q^6)), (2, q + 4*q^3 + 6*q^5 + 8*q^7 + O(q^9), q + 4*q^3 + 6*q^5 + O(q^6)), (3, 1 + 12*q^2 + 64*q^3 + 60*q^4 + 160*q^6 + 384*q^7 + 252*q^8 + O(q^9), 1 + 12*q^2 + 64*q^3 + 60*q^4 + O(q^6)), (3, q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + 32*q^6 + 48*q^7 + 64*q^8 + O(q^9), q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + O(q^6))] + [(2, 1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + O(q^9), 1 + 24*q^2 + 24*q^4 + O(q^6)), + (2, q + 4*q^3 + 6*q^5 + 8*q^7 + O(q^9), q + 4*q^3 + 6*q^5 + O(q^6)), + (3, 1 + 12*q^2 + 64*q^3 + 60*q^4 + 160*q^6 + 384*q^7 + 252*q^8 + O(q^9), 1 + 12*q^2 + 64*q^3 + 60*q^4 + O(q^6)), + (3, q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + 32*q^6 + 48*q^7 + 64*q^8 + O(q^9), q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + O(q^6))] """ default_params = (start_gens == () and start_weight == 2) @@ -949,14 +969,14 @@ def q_expansion_basis(self, weight, prec=None, use_random=True): sage: m = ModularFormsRing(Gamma0(4)) sage: m.q_expansion_basis(2,10) [1 + 24*q^2 + 24*q^4 + 96*q^6 + 24*q^8 + O(q^10), - q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10)] + q + 4*q^3 + 6*q^5 + 8*q^7 + 13*q^9 + O(q^10)] sage: m.q_expansion_basis(3,10) [] sage: X = ModularFormsRing(SL2Z) sage: X.q_expansion_basis(12, 10) [1 + 196560*q^2 + 16773120*q^3 + 398034000*q^4 + 4629381120*q^5 + 34417656000*q^6 + 187489935360*q^7 + 814879774800*q^8 + 2975551488000*q^9 + O(q^10), - q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 - 6048*q^6 - 16744*q^7 + 84480*q^8 - 113643*q^9 + O(q^10)] + q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 - 6048*q^6 - 16744*q^7 + 84480*q^8 - 113643*q^9 + O(q^10)] We calculate a basis of a massive modular forms space, in two ways. Using this module is about twice as fast as Sage's generic code. :: @@ -969,7 +989,8 @@ def q_expansion_basis(self, weight, prec=None, use_random=True): Check that absurdly small values of ``prec`` don't mess things up:: sage: ModularFormsRing(11).q_expansion_basis(10, prec=5) - [1 + O(q^5), q + O(q^5), q^2 + O(q^5), q^3 + O(q^5), q^4 + O(q^5), O(q^5), O(q^5), O(q^5), O(q^5), O(q^5)] + [1 + O(q^5), q + O(q^5), q^2 + O(q^5), q^3 + O(q^5), + q^4 + O(q^5), O(q^5), O(q^5), O(q^5), O(q^5), O(q^5)] """ d = self.modular_forms_of_weight(weight).dimension() if d == 0: @@ -1097,7 +1118,8 @@ def cuspidal_submodule_q_expansion_basis(self, weight, prec=None): sage: R = ModularFormsRing(Gamma0(3)) sage: R.cuspidal_submodule_q_expansion_basis(20) - [q - 8532*q^6 - 88442*q^7 + O(q^8), q^2 + 207*q^6 + 24516*q^7 + O(q^8), q^3 + 456*q^6 + O(q^8), q^4 - 135*q^6 - 926*q^7 + O(q^8), q^5 + 18*q^6 + 135*q^7 + O(q^8)] + [q - 8532*q^6 - 88442*q^7 + O(q^8), q^2 + 207*q^6 + 24516*q^7 + O(q^8), + q^3 + 456*q^6 + O(q^8), q^4 - 135*q^6 - 926*q^7 + O(q^8), q^5 + 18*q^6 + 135*q^7 + O(q^8)] We compute a basis of a space of very large weight, quickly (using this module) and slowly (using modular symbols), and verify that the answers From 7ea68acb2dcdd5db3921681d7dd5d2d58decbad2 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Thu, 16 Jun 2022 11:30:21 -0400 Subject: [PATCH 334/338] sage/modular/modform/element.py: remove blank newlines --- src/sage/modular/modform/element.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/sage/modular/modform/element.py b/src/sage/modular/modform/element.py index 74f2ceb3697..3344e9aff95 100644 --- a/src/sage/modular/modform/element.py +++ b/src/sage/modular/modform/element.py @@ -491,8 +491,6 @@ def __bool__(self): """ return not self.element().is_zero() - - def prec(self): """ Return the precision to which self.q_expansion() is @@ -1743,8 +1741,6 @@ def __bool__(self): """ return True - - def character(self): r""" The nebentypus character of this newform (as a Dirichlet character with From 7873c83ce4417f7e59b39c510d74dcdc4f4115e0 Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Thu, 16 Jun 2022 11:36:02 -0400 Subject: [PATCH 335/338] sage/modular/modform/ring.py: add change_ring method --- src/sage/modular/modform/ring.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index e6fc11c739e..e07300439ba 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -242,6 +242,27 @@ def __init__(self, group, base_ring=QQ): self.__cached_cusp_gens = [] Parent.__init__(self, base=base_ring, category=GradedAlgebras(base_ring)) + def change_ring(self, base_ring): + r""" + Return the ring of modular forms over the given base ring and the same + group as ``self``. + + INPUT: + + - ``base_ring`` - a base ring, which should be `\QQ`, `\ZZ`, or the + integers mod `p` for some prime `p`. + + EXAMPLES:: + + sage: M = ModularFormsRing(11); M + Ring of Modular Forms for Congruence Subgroup Gamma0(11) over Rational Field + sage: M.change_ring(Zmod(7)) + Ring of Modular Forms for Congruence Subgroup Gamma0(11) over Ring of integers modulo 7 + sage: M.change_ring(ZZ) + Ring of Modular Forms for Congruence Subgroup Gamma0(11) over Integer Ring + """ + return ModularFormsRing(self.group(), base_ring=base_ring) + def some_elements(self): r""" Return a list of generators of ``self``. From b1ebc84736ec0a89a1cf7021e55ccb7fd28fc5de Mon Sep 17 00:00:00 2001 From: DavidAyotte Date: Thu, 16 Jun 2022 21:09:45 -0400 Subject: [PATCH 336/338] sage/modular/modform/: little doc tweak --- src/sage/modular/modform/element.py | 25 ++++++++++++++++--------- src/sage/modular/modform/ring.py | 24 +++++++++++++----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/sage/modular/modform/element.py b/src/sage/modular/modform/element.py index 3344e9aff95..c8dc792e139 100644 --- a/src/sage/modular/modform/element.py +++ b/src/sage/modular/modform/element.py @@ -3197,9 +3197,10 @@ def __init__(self, parent, forms_datum): r""" INPUT: - - ``parent`` - an object of the class ``ModularFormsRing`` - - ``forms_datum`` - a dictionary ``{k_1:f_1, k_2:f_2, ..., k_n:f_n}`` or a list ``[f_1, f_2,..., f_n]`` - where `f_i` is a modular form of weight `k_i` + - ``parent`` -- an object of the class ``ModularFormsRing`` + - ``forms_datum`` -- a dictionary ``{k_1:f_1, k_2:f_2, ..., k_n:f_n}`` + or a list ``[f_1, f_2,..., f_n]`` where `f_i` is a modular form of + weight `k_i` OUTPUT: @@ -3344,7 +3345,8 @@ def group(self): def q_expansion(self, prec=None): r""" - Compute the `q`-expansion of the graded modular form up to precision ``prec`` (default: 6). + Return the `q`-expansion of the graded modular form up to precision + ``prec`` (default: 6). An alias of this method is ``qexp``. @@ -3389,8 +3391,12 @@ def _repr_(self): def __getitem__(self, weight): r""" - Given a graded form `F = f_1 + ... + f_r`, return the modular form of the given weight corresponding to - the homogeneous component. + Return the homogeneous component of the given graded modular form. + + INPUT: + + - ``weight`` -- An integer corresponding to the weight of the + homogeneous component of the given graded modular form. EXAMPLES:: @@ -3500,9 +3506,10 @@ def _mul_(self, other): INPUT: - - ``other`` - a ```GradedModularForm`` + - ``other`` -- a ``GradedModularFormElement`` - OUTPUT: the ```GradedModularForm`` corresponding to the multiplication of ```self`` and ``other``. + OUTPUT: the ``GradedModularFormElement`` corresponding to the + multiplication of ``self`` and ``other``. TESTS:: @@ -3811,7 +3818,7 @@ def derivative(self, name='E2'): INPUT: - - ``name`` (str, default: 'E2') - the name of the weight 2 Eisenstein + - ``name`` (str, default: 'E2') -- the name of the weight 2 Eisenstein series generating the graded algebra of quasimodular forms over the ring of modular forms. diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index e07300439ba..bd3f6640ad9 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -249,8 +249,8 @@ def change_ring(self, base_ring): INPUT: - - ``base_ring`` - a base ring, which should be `\QQ`, `\ZZ`, or the - integers mod `p` for some prime `p`. + - ``base_ring`` -- a base ring, which should be `\QQ`, `\ZZ`, or the + integers mod `p` for some prime `p`. EXAMPLES:: @@ -293,7 +293,8 @@ def gen(self, i): INPUT: - - ``i`` (Integer) - correspond to the `i`-th modular form generating the ``ModularFormsRing``. + - ``i`` (Integer) -- correspond to the `i`-th modular form generating + the ring of modular forms. OUTPUT: A ``GradedModularFormElement`` @@ -470,8 +471,9 @@ def _element_constructor_(self, forms_datum): INPUT: - - ``forms_datum`` (dict, list, ModularFormElement, GradedModularFormElement, RingElement, Multivariate polynomial) - Try to coerce - ``forms_datum`` into self. + - ``forms_datum`` (dict, list, ModularFormElement, + GradedModularFormElement, RingElement, Multivariate polynomial) -- Try + to coerce ``forms_datum`` into self. TESTS:: @@ -853,12 +855,12 @@ def _find_generators(self, maxweight, start_gens, start_weight): INPUT: - - maxweight: maximum weight to try - - start_weight: minimum weight to try - - start_gens: a sequence of tuples of the form `(k, f, F)`, where `F` is a - modular form of weight `k` and `f` is its `q`-expansion coerced into - ``self.base_ring()`. Either (but not both) of `f` and `F` may be - None. + - ``maxweight`` -- maximum weight to try + - ``start_weight`` -- minimum weight to try + - ``start_gens`` -- a sequence of tuples of the form `(k, f, F)`, where + `F` is a modular form of weight `k` and `f` is its `q`-expansion + coerced into ``self.base_ring()`. Either (but not both) of `f` and `F` + may be ``None``. OUTPUT: From 695a66741f4eb2377d6a158ddade89e335b57e2e Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 17 Jun 2022 16:32:39 +0200 Subject: [PATCH 337/338] trac #33365: formatting --- src/sage/graphs/graph_generators.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index fcfa6bce198..8a98b0ddc99 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -1033,12 +1033,12 @@ def nauty_genbg(self, options="", debug=False): -l : canonically label output graphs Options which cause ``genbg`` to use an output format different than the - ``graph6`` format are not listed above (-s, -a) as they will confuse the - creation of a Sage graph. Option ``-q`` which suppress auxiliary output - (except from ``-v``) should never be used as we are unable to recover - the partition of the vertices of the bipartite graph without the - auxilary output. Hence the partition of the vertices of returned - bipartite graphs might not respect the requirement. + ``graph6`` format are not listed above (``-s``, ``-a``) as they will + confuse the creation of a Sage graph. Option ``-q`` which suppress + auxiliary output (except from ``-v``) should never be used as we are + unable to recover the partition of the vertices of the bipartite graph + without the auxilary output. Hence the partition of the vertices of + returned bipartite graphs might not respect the requirement. The res/mod option can be useful when using the output in a routine run several times in parallel. From f8df80820dc7321dc9b18c9644c3b8315999670b Mon Sep 17 00:00:00 2001 From: Release Manager Date: Sun, 19 Jun 2022 17:25:55 +0200 Subject: [PATCH 338/338] Updated SageMath version to 9.7.beta3 --- .zenodo.json | 8 ++++---- VERSION.txt | 2 +- build/pkgs/configure/checksums.ini | 6 +++--- build/pkgs/configure/package-version.txt | 2 +- pkgs/sage-conf/VERSION.txt | 2 +- pkgs/sage-conf_pypi/VERSION.txt | 2 +- pkgs/sage-docbuild/VERSION.txt | 2 +- pkgs/sage-setup/VERSION.txt | 2 +- pkgs/sage-sws2rst/VERSION.txt | 2 +- pkgs/sagemath-categories/VERSION.txt | 2 +- pkgs/sagemath-environment/VERSION.txt | 2 +- pkgs/sagemath-objects/VERSION.txt | 2 +- pkgs/sagemath-repl/VERSION.txt | 2 +- src/VERSION.txt | 2 +- src/bin/sage-version.sh | 6 +++--- src/sage/version.py | 6 +++--- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index f05573e690c..9818adbfe11 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,10 +1,10 @@ { "description": "Mirror of the Sage https://sagemath.org/ source tree", "license": "other-open", - "title": "sagemath/sage: 9.7.beta2", - "version": "9.7.beta2", + "title": "sagemath/sage: 9.7.beta3", + "version": "9.7.beta3", "upload_type": "software", - "publication_date": "2022-06-12", + "publication_date": "2022-06-19", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/9.7.beta2", + "identifier": "https://github.com/sagemath/sage/tree/9.7.beta3", "relation": "isSupplementTo" }, { diff --git a/VERSION.txt b/VERSION.txt index 8f5b1728548..07f40386ec2 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 9.7.beta2, Release Date: 2022-06-12 +SageMath version 9.7.beta3, Release Date: 2022-06-19 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index bea6fb69123..6759e5bee67 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=c250372aafc7d27ce8ae02fda5a70ea12ce2464a -md5=973d69177ce8ce4b12cc4f50349fdd42 -cksum=466625133 +sha1=b6a462ba966439bb0cbd460d2bd1cb02d3343fba +md5=95d6ce767184d6ee956feaf65494b4e8 +cksum=2637324690 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 2013ad087c0..9ad842adb86 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -08609a40ad9848c14b71daa9a27f0853e7494fc6 +b466c8ae02c04d287d28d2d669e1d111df3724ff diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/src/VERSION.txt b/src/VERSION.txt index 4cd5a231c54..3f1358a4f1f 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -9.7.beta2 +9.7.beta3 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index 3dc222edd01..c33cbfefeb8 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -1,5 +1,5 @@ # Sage version information for shell scripts # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='9.7.beta2' -SAGE_RELEASE_DATE='2022-06-12' -SAGE_VERSION_BANNER='SageMath version 9.7.beta2, Release Date: 2022-06-12' +SAGE_VERSION='9.7.beta3' +SAGE_RELEASE_DATE='2022-06-19' +SAGE_VERSION_BANNER='SageMath version 9.7.beta3, Release Date: 2022-06-19' diff --git a/src/sage/version.py b/src/sage/version.py index 3ea94539369..79bc5e851bd 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,5 +1,5 @@ # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '9.7.beta2' -date = '2022-06-12' -banner = 'SageMath version 9.7.beta2, Release Date: 2022-06-12' +version = '9.7.beta3' +date = '2022-06-19' +banner = 'SageMath version 9.7.beta3, Release Date: 2022-06-19'