From 926359ed07b1ec49c646e8f25389f183875f5a8e Mon Sep 17 00:00:00 2001 From: Steven Trogdon Date: Fri, 18 Jun 2021 09:39:25 -0600 Subject: [PATCH 001/416] Fix for when cython created temporary modules throw a ModuleNotFoundError when imported --- src/sage/misc/cython.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index e72c97f5c30..ec67e6042c8 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -526,6 +526,8 @@ def cython_import(filename, **kwds): oldpath = sys.path try: sys.path.append(build_dir) + import importlib + importlib.invalidate_caches() return builtins.__import__(name) finally: sys.path = oldpath From bd1bc0421bfa51216c625d059cd02dd7902b3b3d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 2 Mar 2022 22:42:03 -0800 Subject: [PATCH 002/416] build/pkgs/prompt_toolkit/install-requires.txt: Reject versions 3.0.25+ --- build/pkgs/prompt_toolkit/install-requires.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/pkgs/prompt_toolkit/install-requires.txt b/build/pkgs/prompt_toolkit/install-requires.txt index 3a62341b878..fe90872577d 100644 --- a/build/pkgs/prompt_toolkit/install-requires.txt +++ b/build/pkgs/prompt_toolkit/install-requires.txt @@ -1 +1,2 @@ -prompt_toolkit >=3.0.5 +# https://trac.sagemath.org/ticket/33428 - prompt_toolkit 3.0.25+ breaks Ctrl-C +prompt_toolkit >=3.0.5, <3.0.25 From 042b0591e63af38658c1d79190567008701c52e7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 2 Sep 2021 12:26:22 -0700 Subject: [PATCH 003/416] build/pkgs/giac/patches/autotools/0001-configure.ac-Do-not-link-to-libintl-if-USE_NLS-is-no.patch: Remove, not needed for giac 1.7 --- ...not-link-to-libintl-if-USE_NLS-is-no.patch | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 build/pkgs/giac/patches/autotools/0001-configure.ac-Do-not-link-to-libintl-if-USE_NLS-is-no.patch diff --git a/build/pkgs/giac/patches/autotools/0001-configure.ac-Do-not-link-to-libintl-if-USE_NLS-is-no.patch b/build/pkgs/giac/patches/autotools/0001-configure.ac-Do-not-link-to-libintl-if-USE_NLS-is-no.patch deleted file mode 100644 index 8d838f8bd32..00000000000 --- a/build/pkgs/giac/patches/autotools/0001-configure.ac-Do-not-link-to-libintl-if-USE_NLS-is-no.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 2285c11b3cfebc31aa2c032015c76820e3a62030 Mon Sep 17 00:00:00 2001 -From: Matthias Koeppe -Date: Thu, 25 Mar 2021 18:00:38 -0700 -Subject: [PATCH] configure.ac: Do not link to libintl if USE_NLS is no - ---- - configure.ac | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index bfa767d..43c6ff9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -464,7 +464,12 @@ AC_CHECK_FUNCS(system, , AC_DEFINE(HAVE_NO_SYSTEM, 1, [Set if system() function - ALL_LINGUAS="es fr el pt it en zh de" - AM_GNU_GETTEXT - AM_GNU_GETTEXT_VERSION([0.14.5]) --AC_CHECK_LIB(intl, main) -+AS_VAR_IF([USE_NLS], [yes], -+ dnl Whether this is needed at all, after all the AM_GNU_GETTEXT macros -+ dnl were run, is unknown. But at least we should disable it if NLS -+ dnl is disabled. -+ AC_CHECK_LIB(intl, main) -+])dnl - dnl auto-check will work if the function checked is alone in a file - dnl and independant from the whole micropython library - dnl otherwise it will fail because it depends on giac --- -2.28.0 - From c40e201e6867b6a2b7f1b87fcfd6f297b886547a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 2 Sep 2021 12:31:22 -0700 Subject: [PATCH 004/416] build/pkgs/giac: Update to 1.7.0.25 --- build/pkgs/giac/checksums.ini | 6 +++--- build/pkgs/giac/package-version.txt | 2 +- .../giac/patches/autotools/giac-1.5.0.87-gsl_lapack.patch | 6 +++--- build/pkgs/giac/spkg-src | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index f01435d5423..672d5e3cae9 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -1,5 +1,5 @@ tarball=giac-VERSION.tar.bz2 -sha1=b0e81969eb2527964efc802bf35c31d140031571 -md5=f8253082e5dcde5724b4d6f2300d8669 -cksum=3973759340 +sha1=e4a134b87719126e8f49899df9be5b58348392c6 +md5=a9f15b4d6011669d78f8ad39b2ba69ef +cksum=1102268850 upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31562/giac-VERSION.tar.bz2 diff --git a/build/pkgs/giac/package-version.txt b/build/pkgs/giac/package-version.txt index dc9d0d659ba..0f227907d41 100644 --- a/build/pkgs/giac/package-version.txt +++ b/build/pkgs/giac/package-version.txt @@ -1 +1 @@ -1.6.0.47p3 +1.7.0.25p0 diff --git a/build/pkgs/giac/patches/autotools/giac-1.5.0.87-gsl_lapack.patch b/build/pkgs/giac/patches/autotools/giac-1.5.0.87-gsl_lapack.patch index 5b7a9d3a2ad..8a023d3b6ba 100644 --- a/build/pkgs/giac/patches/autotools/giac-1.5.0.87-gsl_lapack.patch +++ b/build/pkgs/giac/patches/autotools/giac-1.5.0.87-gsl_lapack.patch @@ -73,10 +73,10 @@ index b5dd325..d45b553 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,8 @@ libgiac_la_SOURCES = input_lexer.ll sym2poly.cc gausspol.cc threaded.cc \ - help.cc lpsolve.cc optimization.cc signalprocessing.cc \ - graphe.cc graphtheory.cc nautywrapper.c markup.cc kdisplay.cc kadd.cc # Ugh.. + caseval.c cutils.c graphic.c libbf.c libregexp.c libunicode.c \ + qjsgiac.c quickjs.c quickjs-libc.c js.c --libgiac_la_LIBADD = $(NTL_LIBS) $(COCOA_LIBS) $(PARI_LIBS) $(GSL_LIBS) +-libgiac_la_LIBADD = $(NTL_LIBS) $(COCOA_LIBS) $(PARI_LIBS) $(GSL_LIBS) +libgiac_la_LIBADD = $(NTL_LIBS) $(COCOA_LIBS) $(PARI_LIBS) $(GSL_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) + +AM_LDFLAGS = -no-undefined diff --git a/build/pkgs/giac/spkg-src b/build/pkgs/giac/spkg-src index 064c7a092e0..00399744b73 100755 --- a/build/pkgs/giac/spkg-src +++ b/build/pkgs/giac/spkg-src @@ -13,9 +13,9 @@ fi # Exit on failure set -e -VERSION="1.6.0" -VERSIONREV="47" -PATCHSUFFIX="p3" +VERSION="1.7.0" +VERSIONREV="25" +PATCHSUFFIX="p0" # The upstream tarball name is: giac"$SOURCEORIG".tar.gz SOURCEORIG=_"$VERSION"-"$VERSIONREV" From c7d898b459a26d6b780375372d80c5cc6424ae17 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 2 Sep 2021 12:34:20 -0700 Subject: [PATCH 005/416] build/pkgs/giac/checksums.ini: Update upstream_url --- build/pkgs/giac/checksums.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index 672d5e3cae9..1e0178cf033 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -2,4 +2,4 @@ tarball=giac-VERSION.tar.bz2 sha1=e4a134b87719126e8f49899df9be5b58348392c6 md5=a9f15b4d6011669d78f8ad39b2ba69ef cksum=1102268850 -upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31562/giac-VERSION.tar.bz2 +upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31563/giac-VERSION.tar.bz2 From a67d6a44e8ebfea4f071b464057dc775ce1500c5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 31 Jan 2022 23:34:46 -0800 Subject: [PATCH 006/416] build/pkgs/giac: Update to 1.7.0.47 --- build/pkgs/giac/checksums.ini | 6 +++--- build/pkgs/giac/package-version.txt | 2 +- build/pkgs/giac/spkg-src | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index 1e0178cf033..8158c7a2dc3 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -1,5 +1,5 @@ tarball=giac-VERSION.tar.bz2 -sha1=e4a134b87719126e8f49899df9be5b58348392c6 -md5=a9f15b4d6011669d78f8ad39b2ba69ef -cksum=1102268850 +sha1=2fc4797df0843fe4917863dc09eecfdaec5eead4 +md5=dd3b6640a4538984a4d4727f2b6ecb9f +cksum=3913450788 upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31563/giac-VERSION.tar.bz2 diff --git a/build/pkgs/giac/package-version.txt b/build/pkgs/giac/package-version.txt index 0f227907d41..79ecb2c7c09 100644 --- a/build/pkgs/giac/package-version.txt +++ b/build/pkgs/giac/package-version.txt @@ -1 +1 @@ -1.7.0.25p0 +1.7.0.47p0 diff --git a/build/pkgs/giac/spkg-src b/build/pkgs/giac/spkg-src index 00399744b73..ad852356e28 100755 --- a/build/pkgs/giac/spkg-src +++ b/build/pkgs/giac/spkg-src @@ -14,7 +14,7 @@ fi set -e VERSION="1.7.0" -VERSIONREV="25" +VERSIONREV="47" PATCHSUFFIX="p0" # The upstream tarball name is: giac"$SOURCEORIG".tar.gz From 839ce7cde80bd0174427bb3ac58c802cf0b54965 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 31 Jan 2022 23:54:26 -0800 Subject: [PATCH 007/416] build/pkgs/giac/patches/macos-ifactor.patch: Update --- build/pkgs/giac/patches/macos-ifactor.patch | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build/pkgs/giac/patches/macos-ifactor.patch b/build/pkgs/giac/patches/macos-ifactor.patch index 34e84dda7ef..e8c4deb53b3 100644 --- a/build/pkgs/giac/patches/macos-ifactor.patch +++ b/build/pkgs/giac/patches/macos-ifactor.patch @@ -1,12 +1,11 @@ --- a/src/ifactor.cc 2014-10-11 16:29:01.000000000 +0200 +++ b/src/ifactor.cc 2014-10-11 16:29:28.000000000 +0200 -@@ -4007,7 +4007,7 @@ +@@ -4034,7 +4034,4 @@ #endif #ifdef HAVE_LIBPARI - #ifdef __APPLE__ -- return vecteur(1,gensizeerr(gettext("(Mac OS) Large number, you can try pari(); pari_factor(")+n0.print(contextptr)+")")); -+ // return vecteur(1,gensizeerr(gettext("(Mac OS) Large number, you can try pari(); pari_factor(")+n0.print(contextptr)+")")); - #endif - gen g(pari_ifactor(n0),contextptr); - if (g.type==_VECT){ - + if (ifactor_pari){ +-#ifdef __APPLE__ +- return vecteur(1,gensizeerr(gettext("(Mac OS) Large number, you can try pari(); pari_factor(")+n0.print(contextptr)+")")); +-#endif + gen g(pari_ifactor(n0),contextptr); + if (g.type==_VECT){ From 0a4dab2ed895b2efc3136e3dc25fb03592f72b2b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 1 Feb 2022 00:44:24 -0800 Subject: [PATCH 008/416] build/pkgs/giac/spkg-install.in: Use configure --disable-quickjs --- build/pkgs/giac/spkg-install.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/giac/spkg-install.in b/build/pkgs/giac/spkg-install.in index ca30dc6ea62..d7ecb5a4cef 100644 --- a/build/pkgs/giac/spkg-install.in +++ b/build/pkgs/giac/spkg-install.in @@ -53,7 +53,7 @@ if [ "$UNAME" = "CYGWIN" ]; then export ac_cv_header_nauty_naututil_h=no fi -sdh_configure --disable-gui --disable-ao "$DISABLENLS" --enable-png=no --disable-samplerate --disable-static --disable-micropy +sdh_configure --disable-gui --disable-ao "$DISABLENLS" --enable-png=no --disable-samplerate --disable-static --disable-micropy --disable-quickjs ############################################################# # Build From 11156a843e637fb5a15e983b29431538a8b04b6c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Apr 2022 13:06:42 -0700 Subject: [PATCH 009/416] build/pkgs/giac: Update to 1.9.0-5 --- build/pkgs/giac/checksums.ini | 6 +++--- build/pkgs/giac/package-version.txt | 2 +- build/pkgs/giac/spkg-src | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index 8158c7a2dc3..8b43e42303c 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -1,5 +1,5 @@ tarball=giac-VERSION.tar.bz2 -sha1=2fc4797df0843fe4917863dc09eecfdaec5eead4 -md5=dd3b6640a4538984a4d4727f2b6ecb9f -cksum=3913450788 +sha1=cb897dcdf6447719b4855ef93a3c8be88e514b16 +md5=1ca9060a6072e393313087d1e0290f0e +cksum=2786003060 upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31563/giac-VERSION.tar.bz2 diff --git a/build/pkgs/giac/package-version.txt b/build/pkgs/giac/package-version.txt index 79ecb2c7c09..942caae4a8a 100644 --- a/build/pkgs/giac/package-version.txt +++ b/build/pkgs/giac/package-version.txt @@ -1 +1 @@ -1.7.0.47p0 +1.9.0.5p0 diff --git a/build/pkgs/giac/spkg-src b/build/pkgs/giac/spkg-src index ad852356e28..7b9737f9e27 100755 --- a/build/pkgs/giac/spkg-src +++ b/build/pkgs/giac/spkg-src @@ -13,8 +13,8 @@ fi # Exit on failure set -e -VERSION="1.7.0" -VERSIONREV="47" +VERSION="1.9.0" +VERSIONREV="5" PATCHSUFFIX="p0" # The upstream tarball name is: giac"$SOURCEORIG".tar.gz From b953c7dc17565da0ff4d238306f858bf352b2633 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Apr 2022 15:53:42 -0700 Subject: [PATCH 010/416] build/pkgs/giac/dependencies: Add ecm --- build/pkgs/giac/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/giac/dependencies b/build/pkgs/giac/dependencies index c36972a1011..e16a178af5a 100644 --- a/build/pkgs/giac/dependencies +++ b/build/pkgs/giac/dependencies @@ -1,4 +1,4 @@ -readline libpng $(MP_LIBRARY) mpfr mpfi ntl gsl pari glpk curl +readline libpng $(MP_LIBRARY) mpfr mpfi ntl gsl pari glpk curl ecm ---------- All lines of this file are ignored except the first. From 0e4e618f3d2b73a9c8c408c7fc325af80b2cb6fa Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 24 Apr 2022 20:09:21 -0700 Subject: [PATCH 011/416] src/doc/en/developer/coding_basics.rst: Update advice regarding packages --- src/doc/en/developer/coding_basics.rst | 28 +++++++++++-------- .../en/developer/packaging_sage_library.rst | 2 ++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index 3dc549e71a7..391033d52c5 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -129,20 +129,20 @@ of several different types of polynomial rings. discussions, etc., in your package. Make these plain text files (with extension ``.txt``) in a subdirectory called ``notes``. -If you want to create a new directory in the Sage library -``SAGE_ROOT/src/sage`` (say, ``measure_theory``), that directory -should contain a file ``__init__.py`` that contains the single line -``import all`` in addition to whatever -files you want to add (say, ``borel_measure.py`` and -``banach_tarski.py``), and also a file ``all.py`` listing imports from -that directory that are important enough to be in the Sage’s global -namespace at startup. -The file ``all.py`` might look like this:: +If you want to create a new directory (package) in the Sage library +``SAGE_ROOT/src/sage`` (say, ``measure_theory``), that directory will +usually contain an empty file ``__init__.py``, which marks the +directory as an ordinary package (see +:ref:`section_namespace_packages`), and also a file ``all.py``, +listing imports from this package that are user-facing and important +enough to be in the global namespace of Sage at startup. The file +``all.py`` might look like this:: - from borel_measure import BorelMeasure - from banach_tarski import BanachTarskiParadox + from .borel_measure import BorelMeasure + from .banach_tarski import BanachTarskiParadox -but it is generally better to use the lazy import framework:: +but it is generally better to use the :mod:`~sage.misc.lazy_import` +framework:: from sage.misc.lazy_import import lazy_import lazy_import('sage.measure_theory.borel_measue', 'BorelMeasure') @@ -152,6 +152,10 @@ Then in the file ``SAGE_ROOT/src/sage/all.py``, add a line :: from sage.measure_theory.all import * +Adding new top-level packages below :mod:`sage` should be done +sparingly. It is often better to create subpackages of existing +packages. + Non-Python Sage source code and supporting files can be included in one of the following places: diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index a8ea6c8bd40..414c746ab74 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -75,6 +75,8 @@ Sage-specific distribution. Examples: :mod:`sage.ext.memory_allocator`, a part of the Sage library. +.. _section_namespace_packages: + Ordinary packages vs. implicit namespace packages ------------------------------------------------- From ca98d8aed2e419581072a0e1bf7ae949bde11bbb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 24 Apr 2022 21:00:49 -0700 Subject: [PATCH 012/416] src/doc/en/developer/coding_basics.rst: Link to Python tutorial for 'package' --- src/doc/en/developer/coding_basics.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index 391033d52c5..de00c206f8b 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -117,7 +117,7 @@ of the directory containing the Sage sources: upstream/ # tarballs of upstream sources local/ # installed binaries -Python Sage library code goes into ``src/`` and uses the following +Python Sage library code goes into ``src/sage/`` and uses the following conventions. Directory names may be plural (e.g. ``rings``) and file names are almost always singular (e.g. ``polynomial_ring.py``). Note that the file ``polynomial_ring.py`` might still contain definitions @@ -129,10 +129,11 @@ of several different types of polynomial rings. discussions, etc., in your package. Make these plain text files (with extension ``.txt``) in a subdirectory called ``notes``. -If you want to create a new directory (package) in the Sage library -``SAGE_ROOT/src/sage`` (say, ``measure_theory``), that directory will -usually contain an empty file ``__init__.py``, which marks the -directory as an ordinary package (see +If you want to create a new directory (`package +`_) in the +Sage library ``SAGE_ROOT/src/sage`` (say, ``measure_theory``), that +directory will usually contain an empty file ``__init__.py``, which +marks the directory as an ordinary package (see :ref:`section_namespace_packages`), and also a file ``all.py``, listing imports from this package that are user-facing and important enough to be in the global namespace of Sage at startup. The file @@ -145,7 +146,7 @@ but it is generally better to use the :mod:`~sage.misc.lazy_import` framework:: from sage.misc.lazy_import import lazy_import - lazy_import('sage.measure_theory.borel_measue', 'BorelMeasure') + lazy_import('sage.measure_theory.borel_measure', 'BorelMeasure') lazy_import('sage.measure_theory.banach_tarski', 'BanachTarskiParadox') Then in the file ``SAGE_ROOT/src/sage/all.py``, add a line :: From 934094038ac6d0765122447c7b597bb3f87b3eef Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 24 Apr 2022 21:01:18 -0700 Subject: [PATCH 013/416] src/doc/en/developer/coding_in_python.rst: Link to section in packaging_sage_library.rst --- src/doc/en/developer/coding_in_python.rst | 5 +++-- src/doc/en/developer/packaging_sage_library.rst | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/doc/en/developer/coding_in_python.rst b/src/doc/en/developer/coding_in_python.rst index 6214eb51e4d..21a69e150fd 100644 --- a/src/doc/en/developer/coding_in_python.rst +++ b/src/doc/en/developer/coding_in_python.rst @@ -496,7 +496,8 @@ Importing ========= We mention two issues with importing: circular imports and importing -large third-party modules. +large third-party modules. See also :ref:`section_dependencies_distributions` +for a discussion of imports from the viewpoint of modularization. First, you must avoid circular imports. For example, suppose that the file ``SAGE_ROOT/src/sage/algebras/steenrod_algebra.py`` @@ -542,7 +543,7 @@ look like this (omitting the documentation string): return steenrod_algebra_basis(n, basis=self._basis_name, p=self.prime) Second, do not import at the top level of your module a third-party -module that will take a long time to initialize (e.g. matplotlib). As +module that will take a long time to initialize (e.g. :mod:`matplotlib`). As above, you might instead import specific components of the module when they are needed, rather than at the top level of your file. diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index 414c746ab74..fb9d8ff334a 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -175,6 +175,7 @@ Some of these files may actually be generated from source files with suffix ``.m +.. _section_dependencies_distributions: Dependencies and distribution packages ====================================== From 26650f9391781b78b6d186e9b3c194f389ef4d90 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 24 Apr 2022 21:01:55 -0700 Subject: [PATCH 014/416] src/doc/en/developer/coding_in_python.rst: Add lazy_import advice from https://wiki.sagemath.org/import --- src/doc/en/developer/coding_in_python.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/doc/en/developer/coding_in_python.rst b/src/doc/en/developer/coding_in_python.rst index 21a69e150fd..d77064c4745 100644 --- a/src/doc/en/developer/coding_in_python.rst +++ b/src/doc/en/developer/coding_in_python.rst @@ -556,6 +556,25 @@ import but delay it until the object is actually used. See :ref:`chapter-directory-structure` for an example using lazy imports for a new module. +If your module needs to make some precomputed data available at the top level, +you can reduce its load time (and thus startup time, unless your module is +imported using :mod:`sage.misc.lazy_import`) by using the decorator +:func:`sage.misc.cache_func.cached_function` instead. For example, replace + +.. CODE-BLOCK:: python + + big_data = initialize_big_data() # bad: runs at module load time + +by + +.. CODE-BLOCK:: python + + @cached_function # good: runs on first use + def big_data(): + return initialize_big_data() + + + Deprecation =========== From c5547045dc14d5b11f2c63e16c59b8ff98228cf7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 24 Apr 2022 21:13:28 -0700 Subject: [PATCH 015/416] src/doc/en/developer/coding_in_python.rst: Fix up for cachefunc --- src/doc/en/developer/coding_in_python.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/doc/en/developer/coding_in_python.rst b/src/doc/en/developer/coding_in_python.rst index d77064c4745..f5212acc049 100644 --- a/src/doc/en/developer/coding_in_python.rst +++ b/src/doc/en/developer/coding_in_python.rst @@ -559,7 +559,7 @@ for a new module. If your module needs to make some precomputed data available at the top level, you can reduce its load time (and thus startup time, unless your module is imported using :mod:`sage.misc.lazy_import`) by using the decorator -:func:`sage.misc.cache_func.cached_function` instead. For example, replace +:func:`sage.misc.cachefunc.cached_function` instead. For example, replace .. CODE-BLOCK:: python @@ -569,6 +569,8 @@ by .. CODE-BLOCK:: python + from sage.misc.cachefunc import cached_function + @cached_function # good: runs on first use def big_data(): return initialize_big_data() From 73412bfbb2c99eee0e37a70c90d6d51163926b9a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 May 2022 21:02:08 +0200 Subject: [PATCH 016/416] 33798: initial version --- src/doc/en/reference/references/index.rst | 3 + src/sage/groups/braid.py | 152 ++++++++++++++++++++++ src/sage/knots/link.py | 23 ++++ 3 files changed, 178 insertions(+) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 46e46557a02..17116b467cf 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -4469,6 +4469,9 @@ REFERENCES: .. [MW2009] Meshulam and Wallach, "Homological connectivity of random `k`-dimensional complexes", preprint, math.CO/0609773. +.. [MW2012] Ivan Marin and Emmanuel Wagner, *A CUBIC DEFINING ALGEBRA FOR THE + LINKS-GOULD POLYNOMIAL* (:arxiv:`1203.5981v1` [mathGT] 27. Mar 2012) + .. _ref-N: **N** diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index c2ac473b8d7..d4627f8e094 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -54,6 +54,7 @@ - Sebastian Oehms (July and Nov 2018): add other versions for burau_matrix (unitary + simple, see :trac:`25760` and :trac:`26657`) - Moritz Firsching (Sept 2021): Colored Jones polynomial +- Sebastian Oehms (May 2022): add :meth:`links_gould_polynomial` """ ############################################################################## @@ -761,6 +762,78 @@ def TL_matrix(self, drain_size, variab=None, sparse=True): M = M*rep[-i-1][1] return M + @cached_method + def links_gould_matrix(self, varnames='t0, t1'): + r""" + Return the representation matrices of ``self`` of the R-matrix + representation beeing attached the quantum superalgebra `sl_q(2|1)`. + See [MW2012]_, section 3 and references given there. + + INPUT: + + - ``varnames`` -- string (default ``t0, t1``) + + OUTPUT: + + A representation matrix of ``self`` over the symbolic ring. + + EXAMPLES:: + + sage: Hopf = BraidGroup(2)([-1, -1]) + sage: HopfLG = Hopf.links_gould_matrix() + sage: HopfLG.dimensions() + (16, 16) + """ + rep = self.parent()._links_gould_representation(varnames=varnames) + M = rep[0][0].parent().one() + for i in self.Tietze(): + if i > 0: + M = M*rep[i-1][0] + if i < 0: + M = M*rep[-i-1][1] + return M + + @cached_method + def links_gould_polynomial(self, varnames='t0, t1'): + r""" + Return the Links-Gould polynomial of the closure of ``self``. + See [MW2012]_, section 3 and references given there. + + INPUT: + + - ``varnames`` -- string (default ``t0, t1``) + + OUTPUT: + + A Laurent polynomial in the given variable names. + + EXAMPLES:: + + sage: Hopf = BraidGroup(2)([-1, -1]) + sage: Hopf.links_gould_polynomial() + -1 + t1^-1 + t0^-1 - t0^-1*t1^-1 + + REFERENCES: + + - [MW2012]_ + """ + rep = self.parent()._links_gould_representation(varnames=varnames) + l = len(rep) + mu = rep[l-1] # quantum trace factor + M = mu * self.links_gould_matrix() + d1, d2 = M.dimensions() + e = d1//4 + B = M.base_ring() + from sage.rings.integer_ring import ZZ + R = LaurentPolynomialRing(ZZ, varnames) + + # partial quantum trace according to I. Marin section 2.5 + part_trace = matrix(B, 4, 4, lambda i, j: sum(M[e*i+ k, e*j+k] for k in range(e))) + psymb = part_trace[0,0] # part_trace == psymb*M.parent().one() + psimp = psymb._sympy_().simplify() + F = R.fraction_field() # to make coercion work + return R(F(str(psimp))) + def tropical_coordinates(self): r""" Return the tropical coordinates of ``self`` in the braid group `B_n`. @@ -2022,6 +2095,7 @@ def tuples(self): ....: q**3*bm_2*bp_1*am_0*cm_0) sage: for key, value in qw.tuples.items(): ....: print(key, value) + ....: (0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0) q (1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0) q^2 """ @@ -2438,6 +2512,84 @@ def _standard_lift_Tietze(self, p): i += 1 return tuple(l) + @cached_method + def _links_gould_representation(self, varnames='t0, t1', sparse=False): + """ + Compute the representation matrices of the generators of the R-matrix + representation beeing attached the quantum superalgebra `sl_q(2|1)`. + + INPUT: + + - ``varnames`` -- string (default ``t0, t1``) + + OUTPUT: + + A tuple of representation matrices over the symbolic ring, one item for + each generator of ``self``. + + TESTS:: + + sage: B = BraidGroup(3) + sage: g1, g2, mu3 = B._links_gould_representation() + sage: R1, R1I = g1 + sage: R2, R2I = g2 + sage: R1*R2*R1 == R2*R1*R2 # long time + True + """ + from sage.matrix.constructor import matrix + n = self.strands() + d = 4 # dimension of the natural module + from sage.symbolic.ring import SR + from sage.calculus.var import var + from sage.matrix.special import diagonal_matrix + t0, t1 = var(varnames) + + # degree one quantum trace operator as defined in I. Marin + mu = diagonal_matrix([t0**(-1), - t1, - t0**(-1), t1]) + if n == 2: + from sage.misc.functional import sqrt + + # R-Matrix taken from I. Marin + R = matrix(SR, {(0, 0): t0, (1, 4): sqrt(t0), (2, 8): sqrt(t0), (3, 12): 1, + (4, 1): sqrt(t0), (4, 4): t0 - 1, (5, 5): -1, (6, 6): t0*t1 - 1, + (6, 9): -sqrt(t0)*sqrt(t1), (6, 12): -sqrt(-(t0 - 1)*(t1 - 1))*sqrt(t0)*sqrt(t1), + (7, 13): sqrt(t1), (8, 2): sqrt(t0), (8, 8): t0 - 1, (9, 6): -sqrt(t0)*sqrt(t1), + (9, 12): sqrt(-(t0 - 1)*(t1 - 1)), (10, 10): -1, (11, 14): sqrt(t1), + (12, 3): 1, (12, 6): -sqrt(-(t0 - 1)*(t1 - 1))*sqrt(t0)*sqrt(t1), + (12, 9): sqrt(-(t0 - 1)*(t1 - 1)), (12, 12): -(t0 - 1)*(t1 - 1), + (13, 7): sqrt(t1), (13, 13): t1 - 1, (14, 11): sqrt(t1), (14, 14): t1 - 1, + (15, 15): t1}, sparse=sparse) + RI = R.inverse() + + # quantum trace operator on two fold tensor space + E = mu.parent().one() + mu2 = E.tensor_product(mu) + return tuple([[R, RI], mu2]) + from sage.matrix.matrix_space import MatrixSpace + Ed = MatrixSpace(SR, d, d, sparse=sparse).one() + BGsub = BraidGroup(n-1) + if n > 3: + BG2 = BraidGroup(2) + else: + BG2 = BGsub + g1 = list(BG2._links_gould_representation(varnames=varnames,sparse=sparse)) + mu2 = g1.pop() + R, RI = g1[0] + lg_sub = list(BGsub._links_gould_representation(varnames=varnames,sparse=sparse)) + musub = lg_sub.pop() + + # extend former generators + lg = [(g.tensor_product(Ed), gi.tensor_product(Ed)) for g, gi in lg_sub] + En = MatrixSpace(SR, d**(n-2), d**(n-2), sparse=sparse).one() + + # define new generator + gn = En.tensor_product(R) + gni = En.tensor_product(RI) + + # quantum trace operator on n fold tensor space + mun = musub.tensor_product(mu) + return tuple(lg + [[gn, gni], mun]) + @cached_method def _LKB_matrix_(self, braid, variab): """ diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index 1b246c70fd6..1090edb6ec1 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -38,6 +38,7 @@ - Miguel Angel Marco Buzunariz - Amit Jamadagni - Sebastian Oehms (October 2020, add :meth:`get_knotinfo` and meth:`is_isotopic`) +- Sebastian Oehms (May 2022): add :meth:`links_gould_polynomial` """ # **************************************************************************** @@ -2863,6 +2864,28 @@ def homfly_polynomial(self, var1=None, var2=None, normalization='lm'): else: raise ValueError('normalization must be either `lm`, `az` or `vz`') + def links_gould_polynomial(self, varnames='t0, t1'): + r""" + Return the Links-Gould polynomial of ``self``. See [MW2012]_, section 3 + and references given there. See also the docstring of + :meth:`~sage.groups.braid.Braid.links_gould_polynomial`. + + INPUT: + + - ``varnames`` -- string (default ``t0, t1``) + + OUTPUT: + + A Laurent polynomial in the given variable names. + + EXAMPLES:: + + sage: Hopf = Link([[1, 4, 2, 3], [4, 1, 3, 2]]) + sage: Hopf.links_gould_polynomial() + -1 + t1^-1 + t0^-1 - t0^-1*t1^-1 + """ + return self.braid().links_gould_polynomial(varnames=varnames) + def _coloring_matrix(self, n): r""" Return the coloring matrix of ``self``. From daacbbbe70b5a622980d1c86327329c0af3b8770 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 11:25:41 -0700 Subject: [PATCH 017/416] build/pkgs/build: New --- build/pkgs/build/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/build/dependencies | 4 ++++ build/pkgs/build/requirements.txt | 1 + build/pkgs/build/type | 1 + 4 files changed, 24 insertions(+) create mode 100644 build/pkgs/build/SPKG.rst create mode 100644 build/pkgs/build/dependencies create mode 100644 build/pkgs/build/requirements.txt create mode 100644 build/pkgs/build/type diff --git a/build/pkgs/build/SPKG.rst b/build/pkgs/build/SPKG.rst new file mode 100644 index 00000000000..8d222b8f6cc --- /dev/null +++ b/build/pkgs/build/SPKG.rst @@ -0,0 +1,18 @@ +build: A simple, correct PEP517 package builder +=============================================== + +Description +----------- + +A simple, correct PEP517 package builder + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/build/ + diff --git a/build/pkgs/build/dependencies b/build/pkgs/build/dependencies new file mode 100644 index 00000000000..769e08a8c26 --- /dev/null +++ b/build/pkgs/build/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) pyparsing tomli packaging | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/build/requirements.txt b/build/pkgs/build/requirements.txt new file mode 100644 index 00000000000..378eac25d31 --- /dev/null +++ b/build/pkgs/build/requirements.txt @@ -0,0 +1 @@ +build diff --git a/build/pkgs/build/type b/build/pkgs/build/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/build/type @@ -0,0 +1 @@ +optional From 7bf2c93069c4bc1c854678e9a000daa9196ac44b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 13 Feb 2022 19:48:30 -0800 Subject: [PATCH 018/416] pkgs/sagemath-{objects,categories}/setup.cfg.m4: Update python_requires --- pkgs/sagemath-categories/setup.cfg.m4 | 2 +- pkgs/sagemath-objects/setup.cfg.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/sagemath-categories/setup.cfg.m4 b/pkgs/sagemath-categories/setup.cfg.m4 index bad7e5ffd19..99bf2d3ecec 100644 --- a/pkgs/sagemath-categories/setup.cfg.m4 +++ b/pkgs/sagemath-categories/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 \ cython \ diff --git a/pkgs/sagemath-objects/setup.cfg.m4 b/pkgs/sagemath-objects/setup.cfg.m4 index d4dc4402264..d2ba39a4a2b 100644 --- a/pkgs/sagemath-objects/setup.cfg.m4 +++ b/pkgs/sagemath-objects/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 \ cython \ From b07a1db866cc48aa9e6e360e5d130e5d4078c567 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Dec 2021 13:26:57 -0800 Subject: [PATCH 019/416] 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 ddb80dccf4f8ace6915e7d6eb263e6cb9d91db7e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 13:08:42 -0700 Subject: [PATCH 020/416] build/pkgs/sagemath_objects/spkg-install: Build and store the wheel, use it for testing with tox --- build/pkgs/sagemath_objects/dependencies | 2 +- build/pkgs/sagemath_objects/spkg-install | 25 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index fcacb179b57..9b48a3a6c74 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 build $(and $(filter-out no,$(SAGE_CHECK)), tox) # FORCE: Always run the spkg-install script # ipython - for the doctester diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 59e83e7010f..35fc55090e5 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -1,8 +1,27 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash -x +# From sage-spkg. +# For type=script packages, the build rule in build/make/Makefile sources +# sage-env but not sage-dist-helpers. +lib="$SAGE_ROOT/build/bin/sage-dist-helpers" +source "$lib" +if [ $? -ne 0 ]; then + echo >&2 "Error: failed to source $lib" + echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" + exit 1 +fi cd src +# First build the sdist, then build the wheel from the sdist. +# https://pypa-build.readthedocs.io/en/latest/#python--m-build +# (Important because sagemath-objects uses MANIFEST.in for filtering.) +# Do not install the wheel. +DIST_DIR="$(mktemp -d)" +python3 -m build --outdir "$DIST_DIR"/dist . + +wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) + if [ "$SAGE_CHECK" != no ]; then - tox + tox --installpkg $wheel fi -# We skip the install for now. + exit 0 From 9c8f66817204670492bbce99456fc55aefe1431a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 14:48:13 -0700 Subject: [PATCH 021/416] build/pkgs/sagemath_objects/spkg-install: Handle errors --- build/pkgs/sagemath_objects/spkg-install | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 35fc55090e5..da533b030a2 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -16,12 +16,10 @@ cd src # (Important because sagemath-objects uses MANIFEST.in for filtering.) # Do not install the wheel. DIST_DIR="$(mktemp -d)" -python3 -m build --outdir "$DIST_DIR"/dist . +python3 -m build --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel" wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) if [ "$SAGE_CHECK" != no ]; then tox --installpkg $wheel fi - -exit 0 From dbfe66c7237362478b81258f360be11a1d773437 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 14:48:45 -0700 Subject: [PATCH 022/416] build/pkgs/sagemath_objects/dependencies: Add sage_setup --- build/pkgs/sagemath_objects/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index 9b48a3a6c74..d77d7c9ee02 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 build $(and $(filter-out no,$(SAGE_CHECK)), tox) +FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig build $(and $(filter-out no,$(SAGE_CHECK)), tox) # FORCE: Always run the spkg-install script # ipython - for the doctester From af7820248362eae1045551b86d7ef331169ba870 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 14:49:02 -0700 Subject: [PATCH 023/416] Makefile (pypi-wheels, wheels): New --- Makefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Makefile b/Makefile index 9e8955a07f6..d47571728be 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,29 @@ pypi-sdists: sage_setup ./sage --sh build/pkgs/sagemath_categories/spkg-src @echo "Built sdists are in upstream/" +# Ensuring wheels are present, even for packages that may have been installed +# as editable. Until we have better uninstallation of script packages, we +# just remove the timestamps, which will lead to rebuilds of the packages. +PYPI_WHEEL_PACKAGES = sage_sws2rst sage_docbuild sage_setup sagemath_objects sagemath_categories +pypi-wheels: + for a in $(PYPI_WHEEL_PACKAGES); do \ + rm -f venv/var/lib/sage/installed/$$a-*; \ + done + for a in $(PYPI_WHEEL_PACKAGES); do \ + $(MAKE) SAGE_EDITABLE=no $$a; \ + done + @echo "Built wheels are in venv/var/lib/sage/wheels/" + +WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) sage_conf sagelib +wheels: + for a in $(WHEEL_PACKAGES); do \ + rm -f venv/var/lib/sage/installed/$$a-*; \ + done + for a in $(WHEEL_PACKAGES); do \ + $(MAKE) SAGE_EDITABLE=no $$a; \ + done + @echo "Built wheels are in venv/var/lib/sage/wheels/" + # ssl: build Sage, and also install pyOpenSSL. This is necessary for # running the secure notebook. This make target requires internet # access. Note that this requires that your system have OpenSSL @@ -326,6 +349,7 @@ list: @$(MAKE) --silent -f build/make/Makefile SAGE_PKGCONFIG=dummy $@ .PHONY: default build dist install micro_release \ + pypi-sdists pypi-wheels wheels \ misc-clean bdist-clean distclean bootstrap-clean maintainer-clean \ test check testoptional testall testlong testoptionallong testallong \ ptest ptestoptional ptestall ptestlong ptestoptionallong ptestallong \ From 9c634c2da15de718be53418b2739494319b7354f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 14:49:41 -0700 Subject: [PATCH 024/416] .github/workflows/build.yml: Build/test modularized distributions --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8e901d82af..130976b598e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,3 +62,9 @@ jobs: uses: codecov/codecov-action@v2 with: files: ./coverage.xml + + - name: Build and test modularized distributions + run: make pypi-wheels + env: + MAKE: make -j2 + SAGE_NUM_THREADS: 2 From ce003ce4056886d311d9431d9cfed8082e19be63 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 6 May 2022 15:05:27 -0700 Subject: [PATCH 025/416] build/pkgs/sagemath_objects/spkg-install: Only use Sage wheels for the build --- build/pkgs/sagemath_objects/spkg-install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index da533b030a2..0fc3570dd08 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -1,4 +1,4 @@ -#!/usr/bin/env bash -x +#!/usr/bin/env bash # From sage-spkg. # For type=script packages, the build rule in build/make/Makefile sources # sage-env but not sage-dist-helpers. @@ -11,6 +11,9 @@ if [ $? -ne 0 ]; then fi cd src +export PIP_NO_INDEX=true +export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" + # First build the sdist, then build the wheel from the sdist. # https://pypa-build.readthedocs.io/en/latest/#python--m-build # (Important because sagemath-objects uses MANIFEST.in for filtering.) From 83cfb7470ab9d2b0d8a06f307047c029d4b12d52 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 13:57:29 -0700 Subject: [PATCH 026/416] .github/workflows/build.yml: Test modularized distributions earlier, continue testing on failures --- .github/workflows/build.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 130976b598e..e88be72004f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,7 @@ jobs: run: npm install -g pyright@1.1.232 - name: Prepare + id: prepare run: | # Reuse built SAGE_LOCAL contained in the Docker image ./bootstrap @@ -38,33 +39,37 @@ jobs: - name: Static code check with pyright run: pyright + - name: Build and test modularized distributions + if: ${{ steps.prepare.outcome == 'success' }} + run: make pypi-wheels + env: + MAKE: make -j2 + SAGE_NUM_THREADS: 2 + - name: Build + id: build + if: ${{ steps.prepare.outcome == 'success' }} run: make build env: MAKE: make -j2 SAGE_NUM_THREADS: 2 - name: Test + if: ${{ steps.build.outcome == 'success' }} run: | ../sage -python -m pip install coverage ../sage -python -m coverage run ./bin/sage-runtests --all -p2 working-directory: ./src - name: Prepare coverage results - if: always() + if: ${{ steps.build.outcome == 'success' }} run: | ./venv/bin/python3 -m coverage combine src/.coverage/ ./venv/bin/python3 -m coverage xml find . -name *coverage* - name: Upload coverage to codecov - if: always() + if: ${{ steps.build.outcome == 'success' }} uses: codecov/codecov-action@v2 with: files: ./coverage.xml - - - name: Build and test modularized distributions - run: make pypi-wheels - env: - MAKE: make -j2 - SAGE_NUM_THREADS: 2 From b03779d5bc096717dbd71a55a29cba8e58574dea Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 14:29:53 -0700 Subject: [PATCH 027/416] Makefile: Move sage_docbuild from PYPI_WHEEL_PACKAGES to WHEEL_PACKAGES --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d47571728be..d98090c41b6 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ pypi-sdists: sage_setup # Ensuring wheels are present, even for packages that may have been installed # as editable. Until we have better uninstallation of script packages, we # just remove the timestamps, which will lead to rebuilds of the packages. -PYPI_WHEEL_PACKAGES = sage_sws2rst sage_docbuild sage_setup sagemath_objects sagemath_categories +PYPI_WHEEL_PACKAGES = sage_sws2rst sage_setup sagemath_objects sagemath_categories pypi-wheels: for a in $(PYPI_WHEEL_PACKAGES); do \ rm -f venv/var/lib/sage/installed/$$a-*; \ @@ -102,7 +102,8 @@ pypi-wheels: done @echo "Built wheels are in venv/var/lib/sage/wheels/" -WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) sage_conf sagelib +# sage_docbuild is here, not in PYPI_WHEEL_PACKAGES, because it depends on sagelib +WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) sage_conf sagelib sage_docbuild wheels: for a in $(WHEEL_PACKAGES); do \ rm -f venv/var/lib/sage/installed/$$a-*; \ From 171b7c653be2815eef81bc5882322f26cfa11745 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 15:00:12 -0700 Subject: [PATCH 028/416] build/pkgs/sagemath_objects/spkg-install: When ensurepip is not available, fall back to using build --no-isolation --- build/pkgs/sagemath_objects/spkg-install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 0fc3570dd08..d5738556874 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -19,7 +19,11 @@ export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" # (Important because sagemath-objects uses MANIFEST.in for filtering.) # Do not install the wheel. DIST_DIR="$(mktemp -d)" -python3 -m build --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel" +if ! python3 -m build --outdir "$DIST_DIR"/dist .; then + # This happens on Debian without python3-venv installed - "ensurepip" is missing + echo "Falling back to --no-isolation" + python3 -m build --no-isolation --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel" +fi wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) From 3f4c1b8fbeebf4b32570f2ac732b615a355bc15b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 15:02:31 -0700 Subject: [PATCH 029/416] .github/workflows/build.yml: Run modularized dists earlier --- .github/workflows/build.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e88be72004f..11abccf6ee3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,17 +16,9 @@ jobs: container: ghcr.io/sagemath/sage/sage-docker-ubuntu-focal-standard-with-targets:dev steps: - name: Checkout + id: checkout uses: actions/checkout@v2 - - name: Set up node to install pyright - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Install pyright - # Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239 - run: npm install -g pyright@1.1.232 - - name: Prepare id: prepare run: | @@ -36,9 +28,6 @@ jobs: # Install test tools apt-get install -y git - - name: Static code check with pyright - run: pyright - - name: Build and test modularized distributions if: ${{ steps.prepare.outcome == 'success' }} run: make pypi-wheels @@ -46,6 +35,21 @@ jobs: MAKE: make -j2 SAGE_NUM_THREADS: 2 + - name: Set up node to install pyright + if: ${{ steps.prepare.outcome == 'success' }} + uses: actions/setup-node@v1 + with: + node-version: '12' + + - name: Install pyright + if: ${{ steps.prepare.outcome == 'success' }} + # Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239 + run: npm install -g pyright@1.1.232 + + - name: Static code check with pyright + if: ${{ steps.prepare.outcome == 'success' }} + run: pyright + - name: Build id: build if: ${{ steps.prepare.outcome == 'success' }} From 193f067b0fb51fddcbb4ae27748ea68a3f20ed2a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 15:25:01 -0700 Subject: [PATCH 030/416] build/pkgs/sagemath_objects/spkg-install: Run tox with --discover --- build/pkgs/sagemath_objects/spkg-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index d5738556874..87a71cc152d 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -28,5 +28,5 @@ fi wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) if [ "$SAGE_CHECK" != no ]; then - tox --installpkg $wheel + tox --discover "$SAGE_VENV/bin" --installpkg $wheel fi From 064f4530c5f9f6d8202eb71552285b662ba1ef2e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 15:53:41 -0700 Subject: [PATCH 031/416] build/pkgs/sagemath_objects/spkg-install: Use tox -e sagepython --- build/pkgs/sagemath_objects/spkg-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 87a71cc152d..b9f846b44e9 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -28,5 +28,5 @@ fi wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) if [ "$SAGE_CHECK" != no ]; then - tox --discover "$SAGE_VENV/bin" --installpkg $wheel + tox -e sagepython "$SAGE_VENV/bin" --installpkg $wheel fi From d1a1402768b8f883a05a38ff676c93498503e403 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 16:19:14 -0700 Subject: [PATCH 032/416] build/pkgs/sagemath_objects/spkg-install: Fixup --- build/pkgs/sagemath_objects/spkg-install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index b9f846b44e9..1833cca16fa 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -26,7 +26,8 @@ if ! python3 -m build --outdir "$DIST_DIR"/dist .; then fi wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) +ls -l "$wheel" if [ "$SAGE_CHECK" != no ]; then - tox -e sagepython "$SAGE_VENV/bin" --installpkg $wheel + tox -v -v -v -e sagepython --installpkg "$wheel" fi From 6a6ea4c3147b73f6811042a019c2540448fc993a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 16:44:22 -0700 Subject: [PATCH 033/416] pkgs/*/tox.ini: Use {envpython} --- pkgs/sagemath-categories/tox.ini | 4 ++-- pkgs/sagemath-objects/tox.ini | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/sagemath-categories/tox.ini b/pkgs/sagemath-categories/tox.ini index 74475d61031..a415a6e5356 100644 --- a/pkgs/sagemath-categories/tox.ini +++ b/pkgs/sagemath-categories/tox.ini @@ -25,10 +25,10 @@ whitelist_externals = commands = # Beware of the treacherous non-src layout. "./sage/" shadows the install sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.cpython.builtin_types, sage.cpython.cython_metaclass, sage.cpython.debug, sage.structure.all, sage.categories.all' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.cpython.builtin_types, sage.cpython.cython_metaclass, sage.cpython.debug, sage.structure.all, sage.categories.all' # Test that importing sage.categories.all initializes categories - python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()' bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_categories --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"' diff --git a/pkgs/sagemath-objects/tox.ini b/pkgs/sagemath-objects/tox.ini index 9be3fc7605d..e5bf6918c61 100644 --- a/pkgs/sagemath-objects/tox.ini +++ b/pkgs/sagemath-objects/tox.ini @@ -24,9 +24,9 @@ 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.structure.all, sage.categories.sets_cat' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.structure.all, sage.categories.sets_cat' - python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.all__sagemath_objects import *' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.all__sagemath_objects import *' 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/structure || echo "(lots of doctest failures are expected)"' From 4b9d10e0e3a09db06cd308d33e9374ce37092455 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 17:53:00 -0700 Subject: [PATCH 034/416] build/pkgs/tox: Use lower bound 3.21.4 --- build/pkgs/tox/install-requires.txt | 2 +- build/pkgs/tox/spkg-configure.m4 | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/build/pkgs/tox/install-requires.txt b/build/pkgs/tox/install-requires.txt index 053148f8486..ffbf4099ae8 100644 --- a/build/pkgs/tox/install-requires.txt +++ b/build/pkgs/tox/install-requires.txt @@ -1 +1 @@ -tox +tox >= 3.21.4 diff --git a/build/pkgs/tox/spkg-configure.m4 b/build/pkgs/tox/spkg-configure.m4 index 40f9a596fb6..98918e97397 100644 --- a/build/pkgs/tox/spkg-configure.m4 +++ b/build/pkgs/tox/spkg-configure.m4 @@ -1,8 +1,6 @@ SAGE_SPKG_CONFIGURE([tox], [ - dnl src/tox.ini has only minimal version requirements. We use 2.5.0 just to set a baseline. - dnl (SAGE_ROOT/tox.ini needs negated factor conditions introduced in 3.0.0, but it is - dnl best to run it with system tox anyway.) - m4_pushdef([TOX_MIN_VERSION], [2.5.0]) + dnl Use non-ancient tox with full support for PEP 517. + m4_pushdef([TOX_MIN_VERSION], [3.21.4]) AC_CACHE_CHECK([for tox >= ]TOX_MIN_VERSION, [ac_cv_path_TOX], [ AC_PATH_PROGS_FEATURE_CHECK([TOX], [tox], [ tox_version=$($ac_path_TOX --version 2> /dev/null | tail -1) From c0b1804f6a18f9686a83683263254e9aef800688 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 17:56:26 -0700 Subject: [PATCH 035/416] pkgs/sagemath-{objects,categories}/setup.cfg.m4: Add ipython as install-requires for now - needed for doctesting --- pkgs/sagemath-categories/setup.cfg.m4 | 1 + pkgs/sagemath-objects/setup.cfg.m4 | 1 + 2 files changed, 2 insertions(+) diff --git a/pkgs/sagemath-categories/setup.cfg.m4 b/pkgs/sagemath-categories/setup.cfg.m4 index 99bf2d3ecec..6b2b00d5525 100644 --- a/pkgs/sagemath-categories/setup.cfg.m4 +++ b/pkgs/sagemath-categories/setup.cfg.m4 @@ -30,6 +30,7 @@ install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ pkgconfig \ + ipython \ gmpy2 \ cysignals \ | sed "2,\$s/^/ /;"')dnl diff --git a/pkgs/sagemath-objects/setup.cfg.m4 b/pkgs/sagemath-objects/setup.cfg.m4 index d2ba39a4a2b..e5d409eb737 100644 --- a/pkgs/sagemath-objects/setup.cfg.m4 +++ b/pkgs/sagemath-objects/setup.cfg.m4 @@ -30,6 +30,7 @@ install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ pkgconfig \ + ipython \ gmpy2 \ cysignals \ | sed "2,\$s/^/ /;"')dnl From bf0d35abf2b4b529a5f51842a10251299e14dd09 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 17:58:00 -0700 Subject: [PATCH 036/416] build/pkgs/sagemath_objects/spkg-install: Use toxenv sagepython-norequirements --- build/pkgs/sagemath_objects/spkg-install | 2 +- pkgs/sagemath-categories/tox.ini | 5 ++++- pkgs/sagemath-objects/tox.ini | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 1833cca16fa..715d8690ff6 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -29,5 +29,5 @@ wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) ls -l "$wheel" if [ "$SAGE_CHECK" != no ]; then - tox -v -v -v -e sagepython --installpkg "$wheel" + tox -v -v -v -e sagepython-norequirements --installpkg "$wheel" fi diff --git a/pkgs/sagemath-categories/tox.ini b/pkgs/sagemath-categories/tox.ini index a415a6e5356..75f86b99908 100644 --- a/pkgs/sagemath-categories/tox.ini +++ b/pkgs/sagemath-categories/tox.ini @@ -7,9 +7,12 @@ # pkgs/sagemath-categories/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage diff --git a/pkgs/sagemath-objects/tox.ini b/pkgs/sagemath-objects/tox.ini index e5bf6918c61..ad243c5e830 100644 --- a/pkgs/sagemath-objects/tox.ini +++ b/pkgs/sagemath-objects/tox.ini @@ -7,9 +7,12 @@ # pkgs/sagemath-objects/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage From bcff32ac1aec31ddef2379dfac19159cc67aa4da Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 18:49:45 -0700 Subject: [PATCH 037/416] .github/workflows/build.yml: Add always() to conditions --- .github/workflows/build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11abccf6ee3..4982cf61e25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,51 +29,51 @@ jobs: apt-get install -y git - name: Build and test modularized distributions - if: ${{ steps.prepare.outcome == 'success' }} + if: always() && steps.prepare.outcome == 'success' run: make pypi-wheels env: MAKE: make -j2 SAGE_NUM_THREADS: 2 - name: Set up node to install pyright - if: ${{ steps.prepare.outcome == 'success' }} + if: always() && steps.prepare.outcome == 'success' uses: actions/setup-node@v1 with: node-version: '12' - name: Install pyright - if: ${{ steps.prepare.outcome == 'success' }} + if: always() && steps.prepare.outcome == 'success' # Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239 run: npm install -g pyright@1.1.232 - name: Static code check with pyright - if: ${{ steps.prepare.outcome == 'success' }} + if: always() && steps.prepare.outcome == 'success' run: pyright - name: Build id: build - if: ${{ steps.prepare.outcome == 'success' }} + if: always() && steps.prepare.outcome == 'success' run: make build env: MAKE: make -j2 SAGE_NUM_THREADS: 2 - name: Test - if: ${{ steps.build.outcome == 'success' }} + if: always() && steps.build.outcome == 'success' run: | ../sage -python -m pip install coverage ../sage -python -m coverage run ./bin/sage-runtests --all -p2 working-directory: ./src - name: Prepare coverage results - if: ${{ steps.build.outcome == 'success' }} + if: always() && steps.build.outcome == 'success' run: | ./venv/bin/python3 -m coverage combine src/.coverage/ ./venv/bin/python3 -m coverage xml find . -name *coverage* - name: Upload coverage to codecov - if: ${{ steps.build.outcome == 'success' }} + if: always() && steps.build.outcome == 'success' uses: codecov/codecov-action@v2 with: files: ./coverage.xml From e80cb796aa11e141f34eb4e202a2ef8dfb7c6c5d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 18:52:28 -0700 Subject: [PATCH 038/416] build/pkgs/sagemath_objects/spkg-install: Reduce tox verbosity --- build/pkgs/sagemath_objects/spkg-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 715d8690ff6..5c2ab2350c4 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -29,5 +29,5 @@ wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) ls -l "$wheel" if [ "$SAGE_CHECK" != no ]; then - tox -v -v -v -e sagepython-norequirements --installpkg "$wheel" + tox -v -e sagepython-norequirements --installpkg "$wheel" fi From 1552929ac028dba9f08f890360fbc4ad300ce886 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 14:09:47 -0700 Subject: [PATCH 039/416] build/pkgs/sagemath_objects/dependencies: Remove FORCE --- build/pkgs/sagemath_objects/dependencies | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index d77d7c9ee02..16291348293 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,4 +1,3 @@ -FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig build $(and $(filter-out no,$(SAGE_CHECK)), tox) +$(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig build $(and $(filter-out no,$(SAGE_CHECK)), tox) -# FORCE: Always run the spkg-install script # ipython - for the doctester From 728e8189d80ebc9376f0881bb71fb1723017ea64 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 14:51:04 -0700 Subject: [PATCH 040/416] .github/workflows/build.yml: When building tox, do it quietly --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4982cf61e25..2e3bffe7bea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - name: Build and test modularized distributions if: always() && steps.prepare.outcome == 'success' - run: make pypi-wheels + run: make V=0 tox && make pypi-wheels env: MAKE: make -j2 SAGE_NUM_THREADS: 2 From c228d826ed41b02cc02e1bd6a1d1b863eb36b5c1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 14:54:05 -0700 Subject: [PATCH 041/416] build/pkgs/sage_sws2rst/dependencies: Remove tox, not used --- build/pkgs/sage_sws2rst/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 8675f10647ea18b989a2ccb38fc2706285fb2400 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 7 May 2022 19:50:43 -0700 Subject: [PATCH 042/416] pkgs/sagemath-objects: Disable use of the Sage doctester --- pkgs/sagemath-objects/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/sagemath-objects/tox.ini b/pkgs/sagemath-objects/tox.ini index ad243c5e830..727254cf844 100644 --- a/pkgs/sagemath-objects/tox.ini +++ b/pkgs/sagemath-objects/tox.ini @@ -31,7 +31,7 @@ commands = {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.all__sagemath_objects import *' - 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/structure || 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_objects --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"' [testenv:sagepython] passenv = From 6801eb7caec9750b691d61eee8cce684df36be06 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Wed, 11 May 2022 15:57:44 +0200 Subject: [PATCH 043/416] trac #33839: initial commit --- src/sage/graphs/edge_connectivity.pyx | 1017 +++++++++++++++++++++++++ 1 file changed, 1017 insertions(+) create mode 100644 src/sage/graphs/edge_connectivity.pyx diff --git a/src/sage/graphs/edge_connectivity.pyx b/src/sage/graphs/edge_connectivity.pyx new file mode 100644 index 00000000000..6b48abe002e --- /dev/null +++ b/src/sage/graphs/edge_connectivity.pyx @@ -0,0 +1,1017 @@ +# cython: binding=True +# distutils: language = c++ +r""" +Edge connectivity + +This module implements methods for computing the edge-connectivity of graphs and +digraphs. It also implements methods to extract `k` edge-disjoint spanning trees +from a `2k` edge-connected graph or a `k` edge-connected digraph. + +.. TODO:: + + - Add speedup methods proposed in [GKLP2021]_ for the edge connectivity + - Implement the tree-packing algorithms proposed in [Gabow1985]_ and + [BHKP2018]_ and speed up methods proposed in [GKMN2022]_. + - Extend to digraphs with multiple edges + - Extend to weighted digraphs +""" +# **************************************************************************** +# Copyright (c) 2022 David Coudert +# +# 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/ +# **************************************************************************** + +from memory_allocator cimport MemoryAllocator +from sage.graphs.generic_graph_pyx cimport GenericGraph_pyx +from libc.limits cimport INT_MAX +from libcpp.pair cimport pair +from libcpp.vector cimport vector +from libcpp.queue cimport queue + + +cdef class GabowEdgeConnectivity: + r""" + Gabow's algorithm for finding the edge connectivity of digraphs. + + This class implements the algorithm proposed in [Gabow1985]_ for finding the + edge connectivity of a directed graph and `k` edge disjoint spanning trees + if the digraph is `k` edge connected. + + .. WARNING:: + + Multiple edges are currently not supported. The current implementation + act as if the digraph is simple and so the return results might not be + correct. We therefore raise an error if the digraph has multiple edges. + + INPUT: + + - ``D`` -- a :class:`~sage.graphs.digraph.DiGraph` + + EXAMPLES: + + A random `d`-regular digraph is `d`-edge-connected:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = DiGraph(graphs.RandomRegular(6, 50)) + sage: while not D.is_strongly_connected(): + ....: D = DiGraph(graphs.RandomRegular(6, 50)) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 6 + + TESTS: + + :trac:`32169`:: + + sage: dig6_string = r'[E_S?_hKIH@eos[BSg???Q@FShGC?hTHUGM?IPug?' + sage: dig6_string += r'JOEYCdOzdkQGo@ADA@AAg?GAQW?' + sage: dig6_string += r'[aIaSwHYcD@qQb@Dd?\hJTI@OHlJ_?C_OEIKoeCR@_BC?Q?' + sage: dig6_string += r'?YBFosqITEA?IvCU_' + sage: D = DiGraph(dig6_string) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 5 + sage: GabowEdgeConnectivity(D).edge_disjoint_spanning_trees() + Traceback (most recent call last): + ... + NotImplementedError: this method has not been implemented yet + + Corner cases:: + + sage: [GabowEdgeConnectivity(DiGraph(n)).edge_connectivity() for n in range(4)] + [0, 0, 0, 0] + sage: D = digraphs.Circuit(3) * 2 + sage: D.add_edge(0, 3) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 0 + sage: D.add_edge(3, 0) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 1 + + Looped digraphs are supported but not digraph with multiple edges:: + + sage: D = digraphs.Complete(5, loops=True) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + sage: D.allow_multiple_Edges(True) + sage: D.add_edges(D.edges()) + sage: GabowEdgeConnectivity(D).edge_connectivity() + Traceback (most recent call last): + ... + ValueError: This method is not known to work on graphs with multiedges. ... + """ + cdef MemoryAllocator mem + cdef Py_ssize_t n # number of nodes + cdef Py_ssize_t m # number of arcs + + cdef int max_ec # upper bound on the edge connectivity + cdef int ec # current (proven) value of edge connectivity + + cdef int UNUSED + cdef int FIRSTEDGE + + # The graph is stored as lists of incident edges + cdef readonly GenericGraph_pyx G # the original graph + cdef list int_to_vertex # mapping from integers to vertex labels + cdef vector[vector[int]] g_out + cdef vector[vector[int]] g_in + cdef vector[vector[int]] my_g # either g_out or g_in + + # values associated to edges + cdef int* tail # source of edge j + cdef int* head # target of edge j + cdef int* my_from # either tail or head + cdef int* my_to # either tail or head + + cdef int* labels # label of each edge given by the labeling algorithm, UNUSED if unlabeled + + cdef int* edge_state_1 # index of forest Ti to which belongs the arc j of g_out, UNUSED if not used + cdef int* edge_state_2 # index of forest Ti to which belongs the arc j of g_in, UNUSED if not used + cdef int* my_edge_state # either edge_state_1 or edge_state_2 + + # values associated to trees and forests + cdef int root_vertex # 0 by default + cdef int current_tree # index of the current tree + cdef int next_f_tree + cdef int augmenting_root + cdef bint* tree_flag # indicate whether a tree Ti has been touched + cdef int* root # current root vertex of f_tree i + cdef int* L_roots # L_roots of the trees + cdef bint* forests # indicate whether the f_tree is active or inactive + cdef bint** labeled # + + cdef int** parent_1 # parent of v in tree/forest Ti + cdef int** parent_2 # parent of v in tree/forest Ti + cdef int** my_parent # either parent_1 or parent_2 + cdef int** parent_edge_id_1 # edge id of parent of v in tree/forest Ti + cdef int** parent_edge_id_2 # edge id of parent of v in tree/forest Ti + cdef int** my_parent_edge_id # either parent_edge_id_1 or parent_edge_id_2 + cdef int** depth_1 # depth of v in tree/forest Ti + cdef int** depth_2 # depth of v in tree/forest Ti + cdef int** my_depth # either depth_1 or depth_2 + + # to store a path + cdef vector[int] A_path + cdef vector[int] left_traverse + cdef vector[int] right_traverse + + cdef bint* seen # for method re_init + cdef int* stack # stack of vertices for DFS in re_init + cdef vector[vector[int]] tree_edges # used to organise the edges of the trees + cdef vector[vector[int]] F # used to store a proven k-intersection (copy of tree_edges) + cdef vector[vector[int]] tree_edges_incident # lists of incident edges of a given tree + + cdef queue[int] my_Q # queue of labeled edges + cdef queue[pair[int, int]] joining_edges # queue of tuples (edge id, edge state) + cdef queue[int] incident_edges_Q # queue of edges + + def __init__(self, G): + r""" + Initialize this object. + + INPUT: + + - ``G`` -- a :class:`~sage.graphs.digraph.DiGraph` + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + from sage.graphs.digraph import DiGraph + if not isinstance(G, DiGraph): + raise ValueError("this method is for directed graphs only") + G._scream_if_not_simple(allow_loops=True) + if G.size() > INT_MAX - 2: + raise ValueError("the graph is too large for this code") + + # Trivial cases + if not G or not G.is_strongly_connected(): + self.ec = 0 + self.F.clear() + return + + # Set upper bound on the edge connectivity + self.max_ec = min(min(G.out_degree_iterator()), min(G.in_degree_iterator())) + + # + # Initialize some data structures + # + self.G = G + self.n = G.order() + self.m = G.size() + self.mem = MemoryAllocator() + + # Build compact graph data structure with out and in adjacencies + self.build_graph_data_structure() + # From now on, vertices are numbered in [0..n-1] and edges in [0..m-1] + + self.labels = self.mem.allocarray(self.m, sizeof(int)) + self.tree_flag = self.mem.allocarray(self.max_ec, sizeof(bint)) + self.forests = self.mem.allocarray(self.n, sizeof(bint)) + self.L_roots = self.mem.allocarray(self.max_ec, sizeof(int)) + self.labeled = self.mem.allocarray(self.max_ec, sizeof(bint*)) + self.seen = self.mem.allocarray(self.n, sizeof(bint)) + self.root = self.mem.allocarray(self.n, sizeof(int)) + self.edge_state_1 = self.mem.allocarray(self.m, sizeof(int)) + self.edge_state_2 = self.mem.allocarray(self.m, sizeof(int)) + self.parent_1 = self.mem.allocarray(self.max_ec, sizeof(int*)) + self.parent_2 = self.mem.allocarray(self.max_ec, sizeof(int*)) + self.parent_edge_id_1 = self.mem.allocarray(self.max_ec, sizeof(int*)) + self.parent_edge_id_2 = self.mem.allocarray(self.max_ec, sizeof(int*)) + self.depth_1 = self.mem.allocarray(self.max_ec, sizeof(int*)) + self.depth_2 = self.mem.allocarray(self.max_ec, sizeof(int*)) + self.stack = self.mem.allocarray(self.n, sizeof(int)) + self.tree_edges.resize(self.max_ec) + self.tree_edges_incident.resize(self.n) + + cdef int i + for i in range(self.max_ec): + self.labeled[i] = NULL + self.parent_1[i] = NULL + self.parent_2[i] = NULL + self.parent_edge_id_1[i] = NULL + self.parent_edge_id_2[i] = NULL + self.depth_1[i] = NULL + self.depth_2[i] = NULL + + # Set some constants + self.UNUSED = INT_MAX + self.FIRSTEDGE = INT_MAX - 1 + + for i in range(self.m): + self.edge_state_1[i] = self.UNUSED # edge i is unused + self.edge_state_2[i] = self.UNUSED + self.labels[i] = self.UNUSED # edge i is unlabeled + + self.compute_edge_connectivity() + + cdef build_graph_data_structure(self): + r""" + Build graph data structures. + + We assign each arc (u, v) a unique id and store in arrays the tail/head + of each arc. We use vector of vectors to quickly access incident edges. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int i + self.int_to_vertex = list(self.G) + cdef dict vertex_to_int = {u: i for i, u in enumerate(self.int_to_vertex)} + + self.tail = self.mem.allocarray(self.m, sizeof(int)) + self.head = self.mem.allocarray(self.m, sizeof(int)) + self.g_out.resize(self.n) + self.g_in.resize(self.n) + for i in range(self.n): + self.g_out[i].clear() + self.g_in[i].clear() + + cdef int x, y + cdef int e_id = 0 + for x, u in enumerate(self.int_to_vertex): + for v in self.G.neighbor_out_iterator(u): + y = vertex_to_int[v] + self.g_out[x].push_back(e_id) + self.g_in[y].push_back(e_id) + self.tail[e_id] = x + self.head[e_id] = y + e_id += 1 + + cdef void compute_edge_connectivity(self): + """ + Compute the edge connectivity using Round Robin algorithm. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int i + + self.root_vertex = 0 + self.next_f_tree = 0 + + # Search successively trees in g_in and g_out + self.ec = 0 + for i in range(self.max_ec): + if self.construct_trees(False, i) and self.construct_trees(True, i): + # We found both an in-arborescence and an out-arborescence. + # So we can increase the edge connectivity + self.ec += 1 + # and save the current k-intersection + self.save_current_k_intersection() + + cdef bint construct_trees(self, bint reverse, int tree): + r""" + Search for an in or out arborescence. + + INPUT: + + - ``reverse`` -- boolean; whether to search for an in-arborescence + (``True``) or an out-arborescence (``False``) + + - ``tree`` -- integer; index of the tree + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + if reverse: + # Search for a spanning tree in g-reversed + self.my_g = self.g_out + self.my_from = self.head + self.my_to = self.tail + self.my_parent = self.parent_2 + self.my_depth = self.depth_2 + self.my_parent_edge_id = self.parent_edge_id_2 + self.my_edge_state = self.edge_state_2 + else: + # Search for a spanning tree in g using incoming arcs + self.my_g = self.g_in + self.my_from = self.tail + self.my_to = self.head + self.my_parent = self.parent_1 + self.my_depth = self.depth_1 + self.my_parent_edge_id = self.parent_edge_id_1 + self.my_edge_state = self.edge_state_1 + + self.current_tree = tree + self.increase_memory_for_new_tree(tree) + + cdef int njoins = 0 + cdef int z + + while njoins < self.n - 1: + # Get the root of an active subtree or INT_MAX if none exists + z = self.choose_root() + while z != INT_MAX: + if self.search_joining(z): + # We have augmented the root of the corresponding f_tree + njoins += 1 + else: + # We cannot find a tree + return False + + z = self.choose_root() + + # Trace the paths in order to transfer the edges to the appropriate + # tree Ti + self.augmentation_algorithm() + # Reinitialize data structures and make all f_trees active for next round + self.re_init(tree) + + return True + + cdef void increase_memory_for_new_tree(self, int tree): + """ + Allocate data structure for the new tree/forest. + + This method also initializes data structures for this tree index. Data + structures for a given tree index are allocatated only once. + + INPUT: + + - ``tree`` -- integer; index of the tree + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + if not self.labeled[tree]: + self.labeled[tree] = self.mem.allocarray(self.n, sizeof(bint)) + if not self.my_parent[tree]: + self.my_parent[tree] = self.mem.allocarray(self.n, sizeof(int)) + if not self.my_depth[tree]: + self.my_depth[tree] = self.mem.allocarray(self.n, sizeof(int)) + if not self.my_parent_edge_id[tree]: + self.my_parent_edge_id[tree] = self.mem.allocarray(self.n, sizeof(int)) + + cdef int j + for j in range(self.n): + self.my_parent[tree][j] = 0 + self.my_parent_edge_id[tree][j] = self.UNUSED + self.my_depth[tree][j] = 0 + self.labeled[tree][j] = False + self.root[j] = j + self.forests[j] = True + + # Set inactive the f_trees of the root vertex + self.forests[self.root_vertex] = False + + self.L_roots[tree] = self.UNUSED + self.tree_flag[tree] = False + + cdef int choose_root(self): + """ + Return the root of an active f_tree, or INT_MAX if none exists. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int v + cdef int i + + for i in range(self.next_f_tree, self.n): + v = self.root[i] + if self.forests[v]: + # this forest is active + self.next_f_tree = i + 1 + return v + return INT_MAX + + cdef bint search_joining(self, int x): + """ + Try to augment the f_tree rooted at x. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int y + cdef int joining_edge + cdef int e_id, ep + + # Store the vertex that is about to be augmented + self.augmenting_root = x + + # Consider the incoming arcs of x + for e_id in self.my_g[x]: + y = self.my_from[e_id] + # find the root of the f_tree + y = self.root[y] + + if self.my_edge_state[e_id] == self.UNUSED: + # The edge is available + if x != y: + # ... and the f_trees have different roots. We set the + # label of edges in the queue to UNUSED and clear the queue + while not self.my_Q.empty(): + ep = self.my_Q.front() + self.my_Q.pop() + self.labels[ep] = self.UNUSED + # We then assign the edge to the current_tree + self.join(e_id) + return True + else: + # The f_trees have the same root (cycle). + # We add the edge to the queue + self.my_Q.push(e_id) + # and indicate the first edge of the path + self.labels[e_id] = self.FIRSTEDGE + + # If we did not find a free joining edge, we check for a sequence of + # swaps in order to free a joining edge + + # Initialize the L_i tree of every T_i with vertex x and make x labeled + cdef int i + for i in range(self.current_tree + 1): + self.L_roots[i] = x + self.labeled[i][x] = True + + # Start cycle_scanning algorithm + joining_edge = self.next_joining_edge_step() + + if joining_edge != INT_MAX: + # We found a joining edge + self.joining_edges.push((joining_edge, self.my_edge_state[joining_edge])) + self.join(joining_edge) + return True + return False + + cdef void join(self, int e_id): + """ + Assign edge e_id to current tree. + + This method joins 2 f_trees and updates the root of the new f_tree. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int x = self.my_from[e_id] + cdef int y = self.my_to[e_id] + cdef int root_x = self.root[x] + cdef int root_y = self.root[y] + + # Add the edge to the current tree + self.my_edge_state[e_id] = self.current_tree + + # Make the 2 joined f_trees inactive + self.forests[root_x] = False + self.forests[root_y] = False + + # Update the root of the joining f_tree + if self.augmenting_root == root_y: + self.root[root_y] = self.root[root_x] + else: + self.root[root_x] = self.root[root_y] + + # Empty the queue + while not self.my_Q.empty(): + self.my_Q.pop() + + cdef int next_joining_edge_step(self): + """ + Process edges in the queue and start labeling until the queue is empty + or a joining edge is found. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int e_id + cdef int found_joining + cdef int tree = 0 + + while not self.my_Q.empty(): + e_id = self.my_Q.front() + self.my_Q.pop() + + if self.my_edge_state[e_id] == tree: + # edge e_id is in Ti + tree += 1 + if tree > self.current_tree: + tree = 0 + + self.tree_flag[tree] = True + + # Search for the fundamental cycle of e_id in Ti + found_joining = self.fundamental_cycle_step(e_id, tree) + if found_joining != INT_MAX: + return found_joining + + return INT_MAX + + cdef int fundamental_cycle_step(self, int e_id, int tree): + """ + Traverse tree paths from the endpoints of edge e_id to build A_path + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int x = self.my_to[e_id] + cdef int y = self.my_from[e_id] + cdef bint left_first = True + + if self.labeled[tree][x]: + # Node x is labeled. We go to the root of Li + x = self.L_roots[tree] + elif not self.labeled[tree][y]: + raise ValueError("error in labeling") + if self.labeled[tree][y]: + # Node y is labeled. We go to the root of Li + y = self.L_roots[tree] + left_first = False + if x == y: + # The fundamental cycle contains no unlabeled edge + return INT_MAX + + cdef bint stop = False + cdef int q + cdef vector[int] left_traverse + cdef vector[int] right_traverse + left_traverse.clear() + right_traverse.clear() + + # Start double traversal + while True: + + while self.my_depth[tree][x] >= self.my_depth[tree][y]: + self.labeled[tree][x] = True + q = self.my_parent_edge_id[tree][x] + if q == self.UNUSED: + raise ValueError("did not find the right edge") + # We check if edge q is unlabeled + if self.labels[q] == self.UNUSED: + # If so, we place it in left_traverse array + left_traverse.push_back(q) + if self.is_joining_edge(q): + self.labels[q] = e_id + return q + x = self.my_parent[tree][x] + else: + # Otherwise, we stop + stop = True + break + if x == y: + break + + while self.my_depth[tree][y] > self.my_depth[tree][x]: + self.labeled[tree][y] = True + q = self.my_parent_edge_id[tree][y] + if q == self.UNUSED: + raise ValueError("did not find the right edge") + # We check if edge q is unlabeled + if self.labels[q] == self.UNUSED: + # If so, we place it in right_traverse array + right_traverse.push_back(q) + if self.is_joining_edge(q): + self.labels[q] = e_id + return q + y = self.my_parent[tree][y] + else: + # Otherwise, we stop + stop = True + break + + if x == y or stop: + break + + if x == y: + # Update the L_root of the tree + self.L_roots[tree] = x + self.labeled[tree][x] = True + + # Compute A_path + self.A_path.clear() + if left_first: + for x in left_traverse: + self.A_path.push_back(x) + for x in range(right_traverse.size() - 1, -1, -1): + self.A_path.push_back(right_traverse[x]) + else: + for x in right_traverse: + self.A_path.push_back(x) + for x in range(left_traverse.size() - 1, -1, -1): + self.A_path.push_back(left_traverse[x]) + + return self.label_A_path(e_id) + + cdef bint is_joining_edge(self, int e_id): + """ + Check if edge e_id is joining. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int root_x = self.root[self.my_from[e_id]] + cdef int root_y = self.root[self.my_to[e_id]] + return (root_x != root_y) and (root_x == self.augmenting_root or root_y == self.augmenting_root) + + cdef int label_A_path(self, int e_id): + """ + Labels the incident unused edges as the label_A_step of the algorithm + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int e, ep + + for e in self.A_path: + # Run label step with edge e and label e_id + if self.label_step(e, e_id): + return e + + if self.any_unused_is_unlabeled(self.my_to[e]): + while not self.incident_edges_Q.empty(): + ep = self.incident_edges_Q.front() + self.incident_edges_Q.pop() + if e != ep: + # Label each unused and unlabeled edge ep with e + if self.label_step(ep, e): + while not self.incident_edges_Q.empty(): + self.incident_edges_Q.pop() + return ep + + while not self.incident_edges_Q.empty(): + self.incident_edges_Q.pop() + + return INT_MAX + + cdef bint label_step(self, int e_id, int e_label): + """ + Label edge e_id with e_label and check wheteher edge e_id is joining. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + self.labels[e_id] = e_label + + cdef int root_x = self.root[self.my_from[e_id]] + cdef int root_y = self.root[self.my_to[e_id]] + + if root_x == root_y: + self.my_Q.push(e_id) + return False + # The roots are different. Check whether one of them is on the f_tree + return root_x == self.augmenting_root or root_y == self.augmenting_root + + cdef bint any_unused_is_unlabeled(self, int x): + """ + Check if each unused edge directed to x is unlabeled + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int e_id + for e_id in self.my_g[x]: + if self.my_edge_state[e_id] == self.UNUSED: + if self.labels[e_id] != self.UNUSED: + return False + self.incident_edges_Q.push(e_id) + + return True + + cdef void augmentation_algorithm(self): + """ + Trace the path of the found joining edges + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int e_id, e_state + while not self.joining_edges.empty(): + e_id, e_state = self.joining_edges.front() + self.joining_edges.pop() + self.trace_back(e_id, e_state) + + cdef void trace_back(self, int e_id, int e_state): + """ + Trace the path of a joining edge and transfer the edges to the + appropriate tree Ti. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + # Target x and source y of joining edge e_id + cdef int x = self.my_to[e_id] + cdef int y = self.my_from[e_id] + # Previous state (tree Ti or unused) of an edge + cdef int previous_state = self.FIRSTEDGE + + cdef int tree + cdef int e = self.labels[e_id] + cdef int ep = self.labels[e] + + if e_state == self.UNUSED: + tree = self.my_edge_state[e] + previous_state = self.my_edge_state[ep] + + # Transfer edge ep to tree Ti and remove edge e + self.my_edge_state[ep] = tree + self.my_edge_state[e] = self.UNUSED + + e = ep + ep = self.labels[e] + else: + tree = e_state + 1 + if tree > self.current_tree: + tree = 0 + e = e_id + ep = self.labels[e] + + # Transfer edges to the appropriate Ti + while ep != self.FIRSTEDGE: + tree -= 1 + if tree < 0: + tree = self.current_tree + + if previous_state == self.UNUSED: + e = ep + ep = self.labels[e] + self.my_edge_state[e] = self.UNUSED + + previous_state = self.my_edge_state[ep] + self.my_edge_state[ep] = tree + e = ep + ep = self.labels[e] + + cdef re_init(self, int tree): + """ + Make f_trees active (except the f_tree of the root), update depths and + parent values, and clear the labels. + + This method is called at the end of each round of method + construct_trees, right after the call to augmentation_algorithm. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int i, j + for j in range(self.m): + self.labels[j] = self.UNUSED + + # Arrange the edges of each tree + for j in range(tree + 1): + self.tree_edges[j].clear() + for j in range(self.m): + if self.my_edge_state[j] != self.UNUSED: + self.tree_edges[self.my_edge_state[j]].push_back(j) + + for j in range(tree + 1): + if not j or j == tree or self.tree_flag[j]: + # Build adjacency lists of incident edges (ignore direction) + for i in range(self.n): + self.tree_edges_incident[i].clear() + for i in self.tree_edges[j]: + self.tree_edges_incident[self.my_from[i]].push_back(i) + self.tree_edges_incident[self.my_to[i]].push_back(i) + + self.update_parents_depths(j) + + for i in range(tree + 1): + self.L_roots[i] = self.UNUSED # clear the root of each Li + self.tree_flag[i] = False + + # Unlabel all nodes from every Ti + for j in range(self.n): + self.labeled[i][j] = False + + self.next_f_tree = 0 + + # Finally, set active the roots of subtrees + for i in range(self.n): + j = self.root[i] + if j != self.root_vertex: + self.forests[j] = True + + cdef void update_parents_depths(self, int tree): + """ + Update parents, depths, and, if current_tree is k, the vertex labels to + the root of each f_tree. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int i, v + + for i in range(self.n): + self.my_parent[tree][i] = i + self.my_depth[tree][i] = 0 + self.seen[i] = False + + self.update_parents_dfs(tree, self.root_vertex) + + if tree == self.current_tree: + for i in range(self.n): + v = self.root[i] + if self.root[v] != v: + v = self.root[v] + if not self.seen[v]: + self.update_parents_dfs(tree, v) + self.root[i] = self.root[v] + + cdef void update_parents_dfs(self, int tree, int x): + """ + Helper method for ``update_parents_depths``. + + This method updates parents and depths in specified ``tree`` starting + from vertex ``x`` in depth first search manner. + + INPUT: + + - ``tree`` -- integer; index of the tree in which to update data + + - ``x`` -- integer; vertex from which to start the DFS + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int u, v, e_id + cdef int depth + cdef int i = 1 + self.stack[0] = x + self.seen[x] = True + + while i > 0: + i -= 1 + u = self.stack[i] + depth = self.my_depth[tree][u] + 1 + for e_id in self.tree_edges_incident[u]: + v = self.my_to[e_id] + if v == u: + v = self.my_from[e_id] + if not self.seen[v]: + self.stack[i] = v + i += 1 + self.seen[v] = True + self.my_parent[tree][v] = u + self.my_parent_edge_id[tree][v] = e_id + self.my_depth[tree][v] = depth + + cdef void save_current_k_intersection(self): + """ + Save the current k-intersection. + + This method is called each time the upper bound on the edge connectivity + has been increased. The k-intersection will be used to extract the + edge-disjoint spanning trees. If asking for the edge connectivity only, + there is no need to call this method. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + cdef int i, j + cdef int size = self.tree_edges.size() + self.F.resize(size) + for i in range(size): + self.F[i].clear() + for j in self.tree_edges[i]: + self.F[i].push_back(j) + + def edge_connectivity(self): + """ + Return the edge connectivity of the digraph. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_connectivity() + 4 + """ + return self.ec + + # + # Packing arborescences + # + + def edge_disjoint_spanning_trees(self): + r""" + Iterator over the edge disjoint spanning trees. + + EXAMPLES:: + + sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity + sage: D = digraphs.Complete(5) + sage: GabowEdgeConnectivity(D).edge_disjoint_spanning_trees() + Traceback (most recent call last): + ... + NotImplementedError: this method has not been implemented yet + """ + raise NotImplementedError('this method has not been implemented yet') From 6db002680bf1c615e8694bd1e55dc231b33101c7 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Wed, 11 May 2022 16:10:27 +0200 Subject: [PATCH 044/416] trac #33839: references and link in documentation --- src/doc/en/reference/graphs/index.rst | 1 + src/doc/en/reference/references/index.rst | 19 ++++++++++++++++++- src/sage/graphs/edge_connectivity.pyx | 6 +++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/doc/en/reference/graphs/index.rst b/src/doc/en/reference/graphs/index.rst index b1ec35240de..496f00ebcba 100644 --- a/src/doc/en/reference/graphs/index.rst +++ b/src/doc/en/reference/graphs/index.rst @@ -113,6 +113,7 @@ Libraries of algorithms sage/graphs/generic_graph_pyx sage/graphs/orientations sage/graphs/connectivity + sage/graphs/edge_connectivity sage/graphs/domination .. include:: ../footer.txt diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 46e46557a02..91967fd27b7 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -775,7 +775,13 @@ REFERENCES: of invariant theory for the symmetric group* `\mathsf{S}_n`. Preprint (2017). :arxiv:`1707.1410` -.. [BHS2008] Robert Bradshaw, David Harvey and William +.. [BHKP2008] Anand Bhalgat, Ramesh Hariharan, Telikepalli Kavitha and Debmalya + Panigrah. *Fast edge splitting and Edmonds' arborescence + construction for unweighted graphs*. ACM-SIAM Symposium on + Discrete Algorithms (SODA), pp 455-464, 2008. + :doi:`10.5555/1347082.1347132` + + .. [BHS2008] Robert Bradshaw, David Harvey and William Stein. strassen_window_multiply_c. strassen.pyx, Sage 3.0, 2008. http://www.sagemath.org @@ -2445,6 +2451,11 @@ REFERENCES: .. [Ga02] Shuhong Gao, A new algorithm for decoding Reed-Solomon Codes, January 31, 2002 +.. [Gabow1995] Harold N. Gabow. *A Matroid Approach to Finding Edge Connectivity + and Packing Arborescences*. Journal of Computer and System Sciences, + 50(2):259-273, 1995. + :doi:`10.1006/jcss.1995.1022` + .. [Gallai] T. Gallai, Elementare Relationen bezueglich der Glieder und trennenden Punkte von Graphen, Magyar Tud. Akad. Mat. Kutato Int. Kozl. 9 (1964) 235-236 @@ -2566,6 +2577,12 @@ REFERENCES: .. [GK2013] Roland Grinis and Alexander Kasprzyk, Normal forms of convex lattice polytopes, :arxiv:`1301.6641` +.. [GKLP2021] Loukas Georgiadis, Dionysios Kefallinos, Luigi Laura, Nikos + Parotsidis. *An Experimental Study of Algorithms for Computing the + Edge Connectivity of a Directed Graph*. SIAM Symposium on + Algorithm Engineering and Experiments (ALENEX), pp 85-97, 2021. + :doi:`10.1137/1.9781611976472.7` + .. [GKZ1994] Gelfand, I. M.; Kapranov, M. M.; and Zelevinsky, A. V. "Discriminants, Resultants and Multidimensional Determinants" Birkhauser 1994 diff --git a/src/sage/graphs/edge_connectivity.pyx b/src/sage/graphs/edge_connectivity.pyx index 6b48abe002e..b613ebcc035 100644 --- a/src/sage/graphs/edge_connectivity.pyx +++ b/src/sage/graphs/edge_connectivity.pyx @@ -10,8 +10,8 @@ from a `2k` edge-connected graph or a `k` edge-connected digraph. .. TODO:: - Add speedup methods proposed in [GKLP2021]_ for the edge connectivity - - Implement the tree-packing algorithms proposed in [Gabow1985]_ and - [BHKP2018]_ and speed up methods proposed in [GKMN2022]_. + - Implement the tree-packing algorithms proposed in [Gabow1995]_ and + [BHKP2008]_ - Extend to digraphs with multiple edges - Extend to weighted digraphs """ @@ -37,7 +37,7 @@ cdef class GabowEdgeConnectivity: r""" Gabow's algorithm for finding the edge connectivity of digraphs. - This class implements the algorithm proposed in [Gabow1985]_ for finding the + This class implements the algorithm proposed in [Gabow1995]_ for finding the edge connectivity of a directed graph and `k` edge disjoint spanning trees if the digraph is `k` edge connected. From 9e08a283349d622855ce95a366095e36aa5736b3 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Wed, 11 May 2022 16:25:14 +0200 Subject: [PATCH 045/416] trac #33839: typos --- src/sage/graphs/edge_connectivity.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/edge_connectivity.pyx b/src/sage/graphs/edge_connectivity.pyx index b613ebcc035..4d5cfdb0655 100644 --- a/src/sage/graphs/edge_connectivity.pyx +++ b/src/sage/graphs/edge_connectivity.pyx @@ -90,12 +90,12 @@ cdef class GabowEdgeConnectivity: sage: GabowEdgeConnectivity(D).edge_connectivity() 1 - Looped digraphs are supported but not digraph with multiple edges:: + Looped digraphs are supported but not digraphs with multiple edges:: sage: D = digraphs.Complete(5, loops=True) sage: GabowEdgeConnectivity(D).edge_connectivity() 4 - sage: D.allow_multiple_Edges(True) + sage: D.allow_multiple_edges(True) sage: D.add_edges(D.edges()) sage: GabowEdgeConnectivity(D).edge_connectivity() Traceback (most recent call last): From b0ce59e99990981874b73e8e8f3108c7556ffc77 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Thu, 12 May 2022 13:13:58 +0200 Subject: [PATCH 046/416] trac #33839: some reviewers comments --- src/doc/en/reference/references/index.rst | 2 +- src/sage/graphs/edge_connectivity.pyx | 55 ++++++++++------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 91967fd27b7..56bccd3863f 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -781,7 +781,7 @@ REFERENCES: Discrete Algorithms (SODA), pp 455-464, 2008. :doi:`10.5555/1347082.1347132` - .. [BHS2008] Robert Bradshaw, David Harvey and William +.. [BHS2008] Robert Bradshaw, David Harvey and William Stein. strassen_window_multiply_c. strassen.pyx, Sage 3.0, 2008. http://www.sagemath.org diff --git a/src/sage/graphs/edge_connectivity.pyx b/src/sage/graphs/edge_connectivity.pyx index 4d5cfdb0655..d338fee927f 100644 --- a/src/sage/graphs/edge_connectivity.pyx +++ b/src/sage/graphs/edge_connectivity.pyx @@ -210,39 +210,30 @@ cdef class GabowEdgeConnectivity: self.build_graph_data_structure() # From now on, vertices are numbered in [0..n-1] and edges in [0..m-1] - self.labels = self.mem.allocarray(self.m, sizeof(int)) - self.tree_flag = self.mem.allocarray(self.max_ec, sizeof(bint)) - self.forests = self.mem.allocarray(self.n, sizeof(bint)) - self.L_roots = self.mem.allocarray(self.max_ec, sizeof(int)) - self.labeled = self.mem.allocarray(self.max_ec, sizeof(bint*)) - self.seen = self.mem.allocarray(self.n, sizeof(bint)) - self.root = self.mem.allocarray(self.n, sizeof(int)) - self.edge_state_1 = self.mem.allocarray(self.m, sizeof(int)) - self.edge_state_2 = self.mem.allocarray(self.m, sizeof(int)) - self.parent_1 = self.mem.allocarray(self.max_ec, sizeof(int*)) - self.parent_2 = self.mem.allocarray(self.max_ec, sizeof(int*)) - self.parent_edge_id_1 = self.mem.allocarray(self.max_ec, sizeof(int*)) - self.parent_edge_id_2 = self.mem.allocarray(self.max_ec, sizeof(int*)) - self.depth_1 = self.mem.allocarray(self.max_ec, sizeof(int*)) - self.depth_2 = self.mem.allocarray(self.max_ec, sizeof(int*)) - self.stack = self.mem.allocarray(self.n, sizeof(int)) + self.labels = self.mem.calloc(self.m, sizeof(int)) + self.tree_flag = self.mem.calloc(self.max_ec, sizeof(bint)) + self.forests = self.mem.calloc(self.n, sizeof(bint)) + self.L_roots = self.mem.calloc(self.max_ec, sizeof(int)) + self.labeled = self.mem.calloc(self.max_ec, sizeof(bint*)) + self.seen = self.mem.calloc(self.n, sizeof(bint)) + self.root = self.mem.calloc(self.n, sizeof(int)) + self.edge_state_1 = self.mem.calloc(self.m, sizeof(int)) + self.edge_state_2 = self.mem.calloc(self.m, sizeof(int)) + self.parent_1 = self.mem.calloc(self.max_ec, sizeof(int*)) + self.parent_2 = self.mem.calloc(self.max_ec, sizeof(int*)) + self.parent_edge_id_1 = self.mem.calloc(self.max_ec, sizeof(int*)) + self.parent_edge_id_2 = self.mem.calloc(self.max_ec, sizeof(int*)) + self.depth_1 = self.mem.calloc(self.max_ec, sizeof(int*)) + self.depth_2 = self.mem.calloc(self.max_ec, sizeof(int*)) + self.stack = self.mem.calloc(self.n, sizeof(int)) self.tree_edges.resize(self.max_ec) self.tree_edges_incident.resize(self.n) - cdef int i - for i in range(self.max_ec): - self.labeled[i] = NULL - self.parent_1[i] = NULL - self.parent_2[i] = NULL - self.parent_edge_id_1[i] = NULL - self.parent_edge_id_2[i] = NULL - self.depth_1[i] = NULL - self.depth_2[i] = NULL - # Set some constants self.UNUSED = INT_MAX self.FIRSTEDGE = INT_MAX - 1 + cdef int i for i in range(self.m): self.edge_state_1[i] = self.UNUSED # edge i is unused self.edge_state_2[i] = self.UNUSED @@ -268,8 +259,8 @@ cdef class GabowEdgeConnectivity: self.int_to_vertex = list(self.G) cdef dict vertex_to_int = {u: i for i, u in enumerate(self.int_to_vertex)} - self.tail = self.mem.allocarray(self.m, sizeof(int)) - self.head = self.mem.allocarray(self.m, sizeof(int)) + self.tail = self.mem.calloc(self.m, sizeof(int)) + self.head = self.mem.calloc(self.m, sizeof(int)) self.g_out.resize(self.n) self.g_in.resize(self.n) for i in range(self.n): @@ -396,13 +387,13 @@ cdef class GabowEdgeConnectivity: 4 """ if not self.labeled[tree]: - self.labeled[tree] = self.mem.allocarray(self.n, sizeof(bint)) + self.labeled[tree] = self.mem.calloc(self.n, sizeof(bint)) if not self.my_parent[tree]: - self.my_parent[tree] = self.mem.allocarray(self.n, sizeof(int)) + self.my_parent[tree] = self.mem.calloc(self.n, sizeof(int)) if not self.my_depth[tree]: - self.my_depth[tree] = self.mem.allocarray(self.n, sizeof(int)) + self.my_depth[tree] = self.mem.calloc(self.n, sizeof(int)) if not self.my_parent_edge_id[tree]: - self.my_parent_edge_id[tree] = self.mem.allocarray(self.n, sizeof(int)) + self.my_parent_edge_id[tree] = self.mem.calloc(self.n, sizeof(int)) cdef int j for j in range(self.n): From 3566e6c578d819e84d0c6c0340039261a4c9a87f Mon Sep 17 00:00:00 2001 From: dcoudert Date: Thu, 12 May 2022 14:18:57 +0200 Subject: [PATCH 047/416] trac #33839: check signals --- src/sage/graphs/edge_connectivity.pyx | 32 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/sage/graphs/edge_connectivity.pyx b/src/sage/graphs/edge_connectivity.pyx index d338fee927f..ca0469e1902 100644 --- a/src/sage/graphs/edge_connectivity.pyx +++ b/src/sage/graphs/edge_connectivity.pyx @@ -26,6 +26,7 @@ from a `2k` edge-connected graph or a `k` edge-connected digraph. # **************************************************************************** from memory_allocator cimport MemoryAllocator +from cysignals.signals cimport sig_check from sage.graphs.generic_graph_pyx cimport GenericGraph_pyx from libc.limits cimport INT_MAX from libcpp.pair cimport pair @@ -108,6 +109,7 @@ cdef class GabowEdgeConnectivity: cdef int max_ec # upper bound on the edge connectivity cdef int ec # current (proven) value of edge connectivity + cdef bint ec_checked # whether we have well computed edge connectivity cdef int UNUSED cdef int FIRSTEDGE @@ -182,6 +184,7 @@ cdef class GabowEdgeConnectivity: sage: GabowEdgeConnectivity(D).edge_connectivity() 4 """ + self.ec_checked = False from sage.graphs.digraph import DiGraph if not isinstance(G, DiGraph): raise ValueError("this method is for directed graphs only") @@ -192,6 +195,7 @@ cdef class GabowEdgeConnectivity: # Trivial cases if not G or not G.is_strongly_connected(): self.ec = 0 + self.ec_checked = True self.F.clear() return @@ -239,7 +243,8 @@ cdef class GabowEdgeConnectivity: self.edge_state_2[i] = self.UNUSED self.labels[i] = self.UNUSED # edge i is unlabeled - self.compute_edge_connectivity() + _ = self.compute_edge_connectivity() + sig_check() cdef build_graph_data_structure(self): r""" @@ -278,10 +283,13 @@ cdef class GabowEdgeConnectivity: self.head[e_id] = y e_id += 1 - cdef void compute_edge_connectivity(self): + cdef bint compute_edge_connectivity(self) except -1: """ Compute the edge connectivity using Round Robin algorithm. + The method returns ``True`` if the computation ends normally. Otherwise + an exception is raised, for instance due to a keyboard interruption. + EXAMPLES:: sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity @@ -303,8 +311,11 @@ cdef class GabowEdgeConnectivity: self.ec += 1 # and save the current k-intersection self.save_current_k_intersection() + sig_check() + self.ec_checked = True + return True - cdef bint construct_trees(self, bint reverse, int tree): + cdef bint construct_trees(self, bint reverse, int tree) except -1: r""" Search for an in or out arborescence. @@ -365,6 +376,7 @@ cdef class GabowEdgeConnectivity: self.augmentation_algorithm() # Reinitialize data structures and make all f_trees active for next round self.re_init(tree) + sig_check() return True @@ -432,7 +444,7 @@ cdef class GabowEdgeConnectivity: return v return INT_MAX - cdef bint search_joining(self, int x): + cdef bint search_joining(self, int x) except -1: """ Try to augment the f_tree rooted at x. @@ -486,6 +498,7 @@ cdef class GabowEdgeConnectivity: # Start cycle_scanning algorithm joining_edge = self.next_joining_edge_step() + sig_check() if joining_edge != INT_MAX: # We found a joining edge @@ -529,7 +542,7 @@ cdef class GabowEdgeConnectivity: while not self.my_Q.empty(): self.my_Q.pop() - cdef int next_joining_edge_step(self): + cdef int next_joining_edge_step(self) except -1: """ Process edges in the queue and start labeling until the queue is empty or a joining edge is found. @@ -559,12 +572,13 @@ cdef class GabowEdgeConnectivity: # Search for the fundamental cycle of e_id in Ti found_joining = self.fundamental_cycle_step(e_id, tree) + sig_check() if found_joining != INT_MAX: return found_joining return INT_MAX - cdef int fundamental_cycle_step(self, int e_id, int tree): + cdef int fundamental_cycle_step(self, int e_id, int tree) except -1: """ Traverse tree paths from the endpoints of edge e_id to build A_path @@ -986,7 +1000,11 @@ cdef class GabowEdgeConnectivity: sage: GabowEdgeConnectivity(D).edge_connectivity() 4 """ - return self.ec + if self.ec_checked: + return self.ec + raise ValueError("the value of the edge connectivity has not been " + "properly computed. This may result from an interruption") + # # Packing arborescences From 20b3100dc7f3825eeb6e210e5f56dbe1a06aaa45 Mon Sep 17 00:00:00 2001 From: Martin Rubey Date: Thu, 19 May 2022 15:48:17 +0200 Subject: [PATCH 048/416] make generating_functions respect max_values --- src/sage/databases/findstat.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 4a84ef1edb3..11e8a940355 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -1934,7 +1934,8 @@ def _fetch_first_terms(self): return [(from_str(obj), Integer(val)) for obj, val in self._first_terms_raw_cache] - def _generating_functions_dict(self): + def _generating_functions_dict(self, + max_values=FINDSTAT_MAX_SUBMISSION_VALUES): r""" Return the generating functions of ``self`` as dictionary of dictionaries, computed from ``self.first_terms``. @@ -1949,10 +1950,14 @@ def _generating_functions_dict(self): lvls = {} domain = self.domain() levels_with_sizes = domain.levels_with_sizes() + total = 0 for elt, val in self.first_terms().items(): + if total == max_values: + break lvl = domain.element_level(elt) if lvl not in levels_with_sizes: continue + total += 1 if lvl not in gfs: gfs[lvl] = {} gfs[lvl][val] = gfs[lvl].get(val, 0) + 1 @@ -1963,7 +1968,8 @@ def _generating_functions_dict(self): del gfs[lvl] return gfs - def generating_functions(self, style="polynomial"): + def generating_functions(self, style="polynomial", + max_values=FINDSTAT_MAX_SUBMISSION_VALUES): r""" Return the generating functions of the statistic as a dictionary. @@ -2009,9 +2015,22 @@ def generating_functions(self, style="polynomial"): sage: st.generating_functions(style="list") # optional -- internet {2: [1], 4: [2, 1], 6: [5, 6, 3, 1], 8: [14, 28, 28, 20, 10, 4, 1]} + + TESTS:: + + sage: st = findstat(41) # optional -- internet + sage: st.generating_functions(max_values=19) # optional -- internet + {2: 1, 4: q + 2, 6: q^3 + 3*q^2 + 6*q + 5} + + sage: st = findstat("graphs", lambda G: G.size(), max_values=100) # optional -- internet + sage: st.generating_functions(max_values=18) # optional -- internet + {1: 1, + 2: q + 1, + 3: q^3 + q^2 + q + 1, + 4: q^6 + q^5 + 2*q^4 + 3*q^3 + 2*q^2 + q + 1} """ - return _generating_functions_from_dict(self._generating_functions_dict(), - style=style) + d = self._generating_functions_dict(max_values=max_values) + return _generating_functions_from_dict(d, style) def oeis_search(self, search_size=32, verbose=True): r""" @@ -2648,7 +2667,8 @@ def _first_terms_raw(self, max_values): return [(to_str(obj), val) for obj, val in self.first_terms(max_values=max_values).items()] - def _generating_functions_dict(self, max_values=FINDSTAT_MAX_VALUES): + def _generating_functions_dict(self, + max_values=FINDSTAT_MAX_SUBMISSION_VALUES): """ Return the generating functions of the levels where all values can be determined. From 563ea32d39f88cf11c2a942601d08f7c65c6c28b Mon Sep 17 00:00:00 2001 From: Martin Rubey Date: Thu, 19 May 2022 23:00:36 +0200 Subject: [PATCH 049/416] remove unnecessary bound --- src/sage/databases/findstat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 11e8a940355..307e0ff772f 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -775,7 +775,7 @@ def _distribution_from_data(data, domain, max_values, generating_functions=False [1, 1, 2, 2, 3, 3])] """ lvl_dict = {} # lvl: elts, vals - total = min(max_values, FINDSTAT_MAX_VALUES) + total = max_values iterator = iter(data) levels_with_sizes = domain.levels_with_sizes() while total > 0: From 3a1b8944befd6cfd6d35ac30a4f3666f70454b91 Mon Sep 17 00:00:00 2001 From: Martin Rubey Date: Thu, 19 May 2022 23:07:21 +0200 Subject: [PATCH 050/416] add appropriate test --- src/sage/databases/findstat.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 307e0ff772f..a351ced3c5a 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -2028,6 +2028,14 @@ def generating_functions(self, style="polynomial", 2: q + 1, 3: q^3 + q^2 + q + 1, 4: q^6 + q^5 + 2*q^4 + 3*q^3 + 2*q^2 + q + 1} + sage: st.generating_functions(max_values=1252) # optional -- internet + {1: 1, + 2: q + 1, + 3: q^3 + q^2 + q + 1, + 4: q^6 + q^5 + 2*q^4 + 3*q^3 + 2*q^2 + q + 1, + 5: q^10 + q^9 + 2*q^8 + 4*q^7 + 6*q^6 + 6*q^5 + 6*q^4 + 4*q^3 + 2*q^2 + q + 1, + 6: q^15 + q^14 + 2*q^13 + 5*q^12 + 9*q^11 + 15*q^10 + 21*q^9 + 24*q^8 + 24*q^7 + 21*q^6 + 15*q^5 + 9*q^4 + 5*q^3 + 2*q^2 + q + 1, + 7: q^21 + q^20 + 2*q^19 + 5*q^18 + 10*q^17 + 21*q^16 + 41*q^15 + 65*q^14 + 97*q^13 + 131*q^12 + 148*q^11 + 148*q^10 + 131*q^9 + 97*q^8 + 65*q^7 + 41*q^6 + 21*q^5 + 10*q^4 + 5*q^3 + 2*q^2 + q + 1} """ d = self._generating_functions_dict(max_values=max_values) return _generating_functions_from_dict(d, style) From 4b707736ac41b6a2e72083bd48ab14b1b2ab4f8a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:08:45 -0700 Subject: [PATCH 051/416] build/pkgs/appnope: Update to 0.1.3 --- build/pkgs/appnope/checksums.ini | 6 +++--- build/pkgs/appnope/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/appnope/checksums.ini b/build/pkgs/appnope/checksums.ini index 84592f939f2..f29070a251b 100644 --- a/build/pkgs/appnope/checksums.ini +++ b/build/pkgs/appnope/checksums.ini @@ -1,5 +1,5 @@ tarball=appnope-VERSION.tar.gz -sha1=2613cb737d132ee929e09924b19eb6eb088592c4 -md5=16198e5c4f2b049dc98aa444e96ca554 -cksum=224603249 +sha1=dd705054af5f6c80d0ce9e1b444428c7b1b07daa +md5=ca8ec0b1628061ce922dbf1ceee25bca +cksum=3863274580 upstream_url=https://pypi.io/packages/source/a/appnope/appnope-VERSION.tar.gz diff --git a/build/pkgs/appnope/package-version.txt b/build/pkgs/appnope/package-version.txt index d917d3e26ad..b1e80bb2480 100644 --- a/build/pkgs/appnope/package-version.txt +++ b/build/pkgs/appnope/package-version.txt @@ -1 +1 @@ -0.1.2 +0.1.3 From 14dff05fd8530cb7d3c3739e04738181c1b5b4b9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:09:22 -0700 Subject: [PATCH 052/416] build/pkgs/argcomplete: Update to 2.0.0 --- build/pkgs/argcomplete/checksums.ini | 6 +++--- build/pkgs/argcomplete/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/argcomplete/checksums.ini b/build/pkgs/argcomplete/checksums.ini index 6acbb72e9a2..842c0cce185 100644 --- a/build/pkgs/argcomplete/checksums.ini +++ b/build/pkgs/argcomplete/checksums.ini @@ -1,5 +1,5 @@ tarball=argcomplete-VERSION.tar.gz -sha1=bd6b35aee6fc44c82d02772b054b5c5ff1bc5983 -md5=ded03f9c5d41c193dfe5869634d78211 -cksum=3352024634 +sha1=8a2f63ec4b37798f7b455c6320d02efe95730914 +md5=50437bb1e6911540e8ba9b97c7768663 +cksum=4261535290 upstream_url=https://pypi.io/packages/source/a/argcomplete/argcomplete-VERSION.tar.gz diff --git a/build/pkgs/argcomplete/package-version.txt b/build/pkgs/argcomplete/package-version.txt index 81f363239f5..227cea21564 100644 --- a/build/pkgs/argcomplete/package-version.txt +++ b/build/pkgs/argcomplete/package-version.txt @@ -1 +1 @@ -1.12.3 +2.0.0 From ef900b215d15b330c170129173080fdeb011ad84 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:10:23 -0700 Subject: [PATCH 053/416] build/pkgs/attrs: Update to 21.4.0 --- build/pkgs/attrs/checksums.ini | 6 +++--- build/pkgs/attrs/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/attrs/checksums.ini b/build/pkgs/attrs/checksums.ini index b81557ec5ea..f329e28cb08 100644 --- a/build/pkgs/attrs/checksums.ini +++ b/build/pkgs/attrs/checksums.ini @@ -1,5 +1,5 @@ tarball=attrs-VERSION.tar.gz -sha1=d0c0f0d92f4860821c5aaeb9e07646dc22bc31d3 -md5=06af884070d9180694becdb106e5cd65 -cksum=4087843587 +sha1=693de5a8890c6f7bad4edd6ade6971ab3eaf416b +md5=5a9b5e9ceebc380a13fb93235b11bbda +cksum=2935089723 upstream_url=https://pypi.io/packages/source/a/attrs/attrs-VERSION.tar.gz diff --git a/build/pkgs/attrs/package-version.txt b/build/pkgs/attrs/package-version.txt index b295a689e74..8bd85214a48 100644 --- a/build/pkgs/attrs/package-version.txt +++ b/build/pkgs/attrs/package-version.txt @@ -1 +1 @@ -21.2.0 +21.4.0 From 66c7149369df39058991ac97d2df97eb5bb62694 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:11:40 -0700 Subject: [PATCH 054/416] build/pkgs/bleach: Update to 5.0.0 --- build/pkgs/bleach/checksums.ini | 6 +++--- build/pkgs/bleach/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/bleach/checksums.ini b/build/pkgs/bleach/checksums.ini index c24ce0f1c70..1eb2d84effa 100644 --- a/build/pkgs/bleach/checksums.ini +++ b/build/pkgs/bleach/checksums.ini @@ -1,5 +1,5 @@ tarball=bleach-VERSION.tar.gz -sha1=6adfc1d0374305cce7c4dc92fdb9a241b81400f7 -md5=41e70ac58aa7bc5ff96c8fef24b9d659 -cksum=2710248571 +sha1=8b4652eb5a4a1cd6dbf35905a25f389da512f940 +md5=97322e672e4b285e6354c40d07166fc4 +cksum=1632919602 upstream_url=https://pypi.io/packages/source/b/bleach/bleach-VERSION.tar.gz diff --git a/build/pkgs/bleach/package-version.txt b/build/pkgs/bleach/package-version.txt index ee74734aa22..0062ac97180 100644 --- a/build/pkgs/bleach/package-version.txt +++ b/build/pkgs/bleach/package-version.txt @@ -1 +1 @@ -4.1.0 +5.0.0 From cbc443af58135d23d24fb1175fe2206240669fe9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:12:28 -0700 Subject: [PATCH 055/416] build/pkgs/charset_normalizer: Update to 2.0.12 --- build/pkgs/charset_normalizer/checksums.ini | 6 +++--- build/pkgs/charset_normalizer/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/charset_normalizer/checksums.ini b/build/pkgs/charset_normalizer/checksums.ini index 6d9c5d74a1f..90d2c47aba4 100644 --- a/build/pkgs/charset_normalizer/checksums.ini +++ b/build/pkgs/charset_normalizer/checksums.ini @@ -1,5 +1,5 @@ tarball=charset-normalizer-VERSION.tar.gz -sha1=8eec37b27487fa08532914f4c96ad3d7001d379e -md5=40ecb4aa5ac6f08f87513a2ca0b32238 -cksum=1993471876 +sha1=6824bfae6dec62d93887b53468ea36124db5ecc8 +md5=f6664e0e90dbb3cc9cfc154a980f9864 +cksum=2680691552 upstream_url=https://pypi.io/packages/source/c/charset_normalizer/charset-normalizer-VERSION.tar.gz diff --git a/build/pkgs/charset_normalizer/package-version.txt b/build/pkgs/charset_normalizer/package-version.txt index 2165f8f9b6a..280a1e3368b 100644 --- a/build/pkgs/charset_normalizer/package-version.txt +++ b/build/pkgs/charset_normalizer/package-version.txt @@ -1 +1 @@ -2.0.4 +2.0.12 From 6e3cd5f0eeb9e47bd7927a85607174f989139a73 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:13:15 -0700 Subject: [PATCH 056/416] build/pkgs/debugpy: Update to 1.6.0 --- build/pkgs/debugpy/checksums.ini | 6 +++--- build/pkgs/debugpy/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/debugpy/checksums.ini b/build/pkgs/debugpy/checksums.ini index 4f00cc11258..5872243e9f5 100644 --- a/build/pkgs/debugpy/checksums.ini +++ b/build/pkgs/debugpy/checksums.ini @@ -1,5 +1,5 @@ tarball=debugpy-VERSION.zip -sha1=169efd648ce0903c30cd300f8040136ec0ee16cc -md5=7c8ef4f136c9bcf501e80a12b8e21ac1 -cksum=422456395 +sha1=5a0066e4641659c63ecc8d6ce35e96a2fd89b195 +md5=27a4789bfda161dc7de6a6860eeeff38 +cksum=708733483 upstream_url=https://pypi.io/packages/source/d/debugpy/debugpy-VERSION.zip diff --git a/build/pkgs/debugpy/package-version.txt b/build/pkgs/debugpy/package-version.txt index 26ca594609a..dc1e644a101 100644 --- a/build/pkgs/debugpy/package-version.txt +++ b/build/pkgs/debugpy/package-version.txt @@ -1 +1 @@ -1.5.1 +1.6.0 From c2a70d536ca2eb489fd835608c72b2ef06d95798 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:13:41 -0700 Subject: [PATCH 057/416] build/pkgs/decorator: Update to 5.1.1 --- build/pkgs/decorator/checksums.ini | 6 +++--- build/pkgs/decorator/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/decorator/checksums.ini b/build/pkgs/decorator/checksums.ini index d7abe4363b8..47bd53771d0 100644 --- a/build/pkgs/decorator/checksums.ini +++ b/build/pkgs/decorator/checksums.ini @@ -1,5 +1,5 @@ tarball=decorator-VERSION.tar.gz -sha1=4035760ce781a93181eeb3f8a36435eb799ceb76 -md5=a90526e45e7a30cf2710d6467f403e03 -cksum=1796541525 +sha1=929f42916ac8a4aa973599d558768b8f1728db46 +md5=a6b34700dcac8a4bb04efd55e99626c1 +cksum=4154678061 upstream_url=https://pypi.io/packages/source/d/decorator/decorator-VERSION.tar.gz diff --git a/build/pkgs/decorator/package-version.txt b/build/pkgs/decorator/package-version.txt index bb09d45b574..ac14c3dfaa8 100644 --- a/build/pkgs/decorator/package-version.txt +++ b/build/pkgs/decorator/package-version.txt @@ -1 +1 @@ -5.0.9 +5.1.1 From 2696cf090c5f232a3f1b187fd60c90db421bcade Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:14:07 -0700 Subject: [PATCH 058/416] build/pkgs/entrypoints: Update to 0.4 --- build/pkgs/entrypoints/checksums.ini | 6 +++--- build/pkgs/entrypoints/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/entrypoints/checksums.ini b/build/pkgs/entrypoints/checksums.ini index c019bce8ed5..2b08b5b80e5 100644 --- a/build/pkgs/entrypoints/checksums.ini +++ b/build/pkgs/entrypoints/checksums.ini @@ -1,4 +1,4 @@ tarball=entrypoints-VERSION.tar.gz -sha1=5e191cf9815cd66bace7f8bae9ee52c910923f4a -md5=c5c61ea2e46a0c50ea08f4af7955a0b1 -cksum=230030795 +sha1=ca5c5976781db7ec6e8faece06af31ff32960529 +md5=3acd8b72119a8fb1eac7030c24ac6b49 +cksum=3193499805 diff --git a/build/pkgs/entrypoints/package-version.txt b/build/pkgs/entrypoints/package-version.txt index be586341736..bd73f47072b 100644 --- a/build/pkgs/entrypoints/package-version.txt +++ b/build/pkgs/entrypoints/package-version.txt @@ -1 +1 @@ -0.3 +0.4 From 0c67de839b2eb5985730b86abd984a2d06206144 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:16:04 -0700 Subject: [PATCH 059/416] build/pkgs/idna: Update to 3.3 --- build/pkgs/idna/checksums.ini | 6 +++--- build/pkgs/idna/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/idna/checksums.ini b/build/pkgs/idna/checksums.ini index b6a3975b47f..d0e20f2098a 100644 --- a/build/pkgs/idna/checksums.ini +++ b/build/pkgs/idna/checksums.ini @@ -1,5 +1,5 @@ tarball=idna-VERSION.tar.gz -sha1=b1bb761203e1cc791318d80bdbd29f4f0a6893d3 -md5=08ea8e2ce09e522424e872409c221138 -cksum=752375109 +sha1=08c0449533fc94462f78652dea209099754d9ee4 +md5=5856306eac5f25db8249e37a4c6ee3e7 +cksum=2700709091 upstream_url=https://pypi.io/packages/source/i/idna/idna-VERSION.tar.gz diff --git a/build/pkgs/idna/package-version.txt b/build/pkgs/idna/package-version.txt index a3ec5a4bd3d..eb39e5382f4 100644 --- a/build/pkgs/idna/package-version.txt +++ b/build/pkgs/idna/package-version.txt @@ -1 +1 @@ -3.2 +3.3 From bbb20145c7d21526eaea5a65ec1b357f6433672f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:17:01 -0700 Subject: [PATCH 060/416] build/pkgs/ipywidgets: Update to 7.7.0 --- build/pkgs/ipywidgets/checksums.ini | 6 +++--- build/pkgs/ipywidgets/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/ipywidgets/checksums.ini b/build/pkgs/ipywidgets/checksums.ini index af4a04db8cf..e250f8111d0 100644 --- a/build/pkgs/ipywidgets/checksums.ini +++ b/build/pkgs/ipywidgets/checksums.ini @@ -1,5 +1,5 @@ tarball=ipywidgets-VERSION.tar.gz -sha1=ad63e99f44fd759c34ab70161e9ac8f4276294f8 -md5=420aabfddee27fc215ad9a9c14c9c529 -cksum=259379988 +sha1=db842df5008a1786ab6434875c2d56b974c5109a +md5=61deb9024c3de1848812b97c2560d0cf +cksum=3129459111 upstream_url=https://pypi.io/packages/source/i/ipywidgets/ipywidgets-VERSION.tar.gz diff --git a/build/pkgs/ipywidgets/package-version.txt b/build/pkgs/ipywidgets/package-version.txt index bf43f752a04..1985849fb58 100644 --- a/build/pkgs/ipywidgets/package-version.txt +++ b/build/pkgs/ipywidgets/package-version.txt @@ -1 +1 @@ -7.6.5 +7.7.0 From 482fd38cb33aed9c39c42f6e80a2d26f6608e1d1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:19:50 -0700 Subject: [PATCH 061/416] build/pkgs/jsonschema: Update to 4.4.0 --- build/pkgs/jsonschema/checksums.ini | 6 +++--- build/pkgs/jsonschema/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jsonschema/checksums.ini b/build/pkgs/jsonschema/checksums.ini index 9c88c7bee89..52b8b97b2cc 100644 --- a/build/pkgs/jsonschema/checksums.ini +++ b/build/pkgs/jsonschema/checksums.ini @@ -1,5 +1,5 @@ tarball=jsonschema-VERSION.tar.gz -sha1=f804244e37c3f8f1c587ed6aee8f1f6a851f90f5 -md5=87cf45f980c9b48e040c0c5897e574c4 -cksum=1105743845 +sha1=a05ab16478adf9663e301a02413dcd7efef7431e +md5=0fa6d31342d4a23952ae255abb4ae3d8 +cksum=2518167215 upstream_url=https://pypi.io/packages/source/j/jsonschema/jsonschema-VERSION.tar.gz diff --git a/build/pkgs/jsonschema/package-version.txt b/build/pkgs/jsonschema/package-version.txt index cc2fbe89b6c..fdc6698807a 100644 --- a/build/pkgs/jsonschema/package-version.txt +++ b/build/pkgs/jsonschema/package-version.txt @@ -1 +1 @@ -4.3.2 +4.4.0 From bdfac90c081395d934f376ab6439e3376bb66265 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:20:19 -0700 Subject: [PATCH 062/416] build/pkgs/jupyter_client; Update to 7.2.2 --- build/pkgs/jupyter_client/checksums.ini | 6 +++--- build/pkgs/jupyter_client/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jupyter_client/checksums.ini b/build/pkgs/jupyter_client/checksums.ini index cbe7b831ca8..5716d96ee47 100644 --- a/build/pkgs/jupyter_client/checksums.ini +++ b/build/pkgs/jupyter_client/checksums.ini @@ -1,5 +1,5 @@ tarball=jupyter_client-VERSION.tar.gz -sha1=aad5dd5337e20e53de66e094092333e04d9c4e1d -md5=33fb5eab82f3e89c68f2082b52a8e966 -cksum=481041414 +sha1=12c08a55363a38f00f8026c1832a2b615b5f2dde +md5=89ea1f88752df403c604175834f92eed +cksum=1087484837 upstream_url=https://pypi.io/packages/source/j/jupyter_client/jupyter_client-VERSION.tar.gz diff --git a/build/pkgs/jupyter_client/package-version.txt b/build/pkgs/jupyter_client/package-version.txt index a3fcc7121bb..77f5bec5b2b 100644 --- a/build/pkgs/jupyter_client/package-version.txt +++ b/build/pkgs/jupyter_client/package-version.txt @@ -1 +1 @@ -7.1.0 +7.2.2 From 8212473a057327e1d4d1ac107c220383ff110977 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:21:05 -0700 Subject: [PATCH 063/416] build/pkgs/jupyter_core: Update to 4.10.0 --- build/pkgs/jupyter_core/checksums.ini | 6 +++--- build/pkgs/jupyter_core/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jupyter_core/checksums.ini b/build/pkgs/jupyter_core/checksums.ini index f3a306800fb..88fbd83a188 100644 --- a/build/pkgs/jupyter_core/checksums.ini +++ b/build/pkgs/jupyter_core/checksums.ini @@ -1,5 +1,5 @@ tarball=jupyter_core-VERSION.tar.gz -sha1=afa48d85b3611beb42236be3c130767a6524ccfd -md5=77a1e7642abfb834a6046e14b94f5c88 -cksum=1811078933 +sha1=f5db3f86f2cf40c9371bfa16a783a79a3502cac4 +md5=812d7410ffb4b671b23a68ef4bf40c12 +cksum=2575874942 upstream_url=https://pypi.io/packages/source/j/jupyter_core/jupyter_core-VERSION.tar.gz diff --git a/build/pkgs/jupyter_core/package-version.txt b/build/pkgs/jupyter_core/package-version.txt index 5b341fd799e..2da4316236a 100644 --- a/build/pkgs/jupyter_core/package-version.txt +++ b/build/pkgs/jupyter_core/package-version.txt @@ -1 +1 @@ -4.9.1 +4.10.0 From 548239796274c9943075d8770f0ce9ee32f14b81 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:22:36 -0700 Subject: [PATCH 064/416] build/pkgs/nbclient: Update to 0.6.0 --- build/pkgs/nbclient/checksums.ini | 6 +++--- build/pkgs/nbclient/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/nbclient/checksums.ini b/build/pkgs/nbclient/checksums.ini index b1f9790bc67..bb9c8e3fedd 100644 --- a/build/pkgs/nbclient/checksums.ini +++ b/build/pkgs/nbclient/checksums.ini @@ -1,5 +1,5 @@ tarball=nbclient-VERSION.tar.gz -sha1=a5efba590429270c901f4f5a16c8b46a7e6b8e4a -md5=a3cf8c1c121b0718a6ccf384c5683424 -cksum=2650264415 +sha1=16ab7aa979aa2a0d1b393f204000c93a36d945bd +md5=8f99efbbf1b3a7dcde2632e46bd81a17 +cksum=3366584983 upstream_url=https://pypi.io/packages/source/n/nbclient/nbclient-VERSION.tar.gz diff --git a/build/pkgs/nbclient/package-version.txt b/build/pkgs/nbclient/package-version.txt index 416bfb0a221..a918a2aa18d 100644 --- a/build/pkgs/nbclient/package-version.txt +++ b/build/pkgs/nbclient/package-version.txt @@ -1 +1 @@ -0.5.9 +0.6.0 From 372a83c0aadd988c35d761c8eb7b66c15be0215d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:25:06 -0700 Subject: [PATCH 065/416] build/pkgs/nest_asyncio: Update to 1.5.5 --- build/pkgs/nest_asyncio/checksums.ini | 6 +++--- build/pkgs/nest_asyncio/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/nest_asyncio/checksums.ini b/build/pkgs/nest_asyncio/checksums.ini index d46939ec9cb..3ffec6bed8b 100644 --- a/build/pkgs/nest_asyncio/checksums.ini +++ b/build/pkgs/nest_asyncio/checksums.ini @@ -1,5 +1,5 @@ tarball=nest_asyncio-VERSION.tar.gz -sha1=a139466f747bcd3324b8e080e00fc443603e8fa6 -md5=a97d6622335d35563baeabb87afb758f -cksum=2526839264 +sha1=ca7b9c57e544a7ca1e96d37ead648588cfb9a3eb +md5=0243278ed8804811b00049a545856dcb +cksum=3944772454 upstream_url=https://pypi.io/packages/source/n/nest_asyncio/nest_asyncio-VERSION.tar.gz diff --git a/build/pkgs/nest_asyncio/package-version.txt b/build/pkgs/nest_asyncio/package-version.txt index 94fe62c2740..9075be49515 100644 --- a/build/pkgs/nest_asyncio/package-version.txt +++ b/build/pkgs/nest_asyncio/package-version.txt @@ -1 +1 @@ -1.5.4 +1.5.5 From 71f81494c4b46f9b2024dbedc47bd50b52f59f03 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:25:34 -0700 Subject: [PATCH 066/416] build/pkgs/notebook: Update to 6.4.11 --- build/pkgs/notebook/checksums.ini | 6 +++--- build/pkgs/notebook/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/notebook/checksums.ini b/build/pkgs/notebook/checksums.ini index e2f3c9114f6..70400abb964 100644 --- a/build/pkgs/notebook/checksums.ini +++ b/build/pkgs/notebook/checksums.ini @@ -1,5 +1,5 @@ tarball=notebook-VERSION.tar.gz -sha1=0980d6b666a40096110cf42dbd3888f0c40e720f -md5=dcf0e442d40d8d8407ded88276fb6a38 -cksum=1389780807 +sha1=f639d0ff0e812e4ebf8d642952db2b29a9e2a7ef +md5=d422490d81da301830a07065d3e1f8c9 +cksum=3535534309 upstream_url=https://pypi.io/packages/source/n/notebook/notebook-VERSION.tar.gz diff --git a/build/pkgs/notebook/package-version.txt b/build/pkgs/notebook/package-version.txt index b03e20c4567..e5a66bad386 100644 --- a/build/pkgs/notebook/package-version.txt +++ b/build/pkgs/notebook/package-version.txt @@ -1 +1 @@ -6.4.10 +6.4.11 From d72889b06b96281c621d2c06771db504f8296113 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:25:59 -0700 Subject: [PATCH 067/416] build/pkgs/pandocfilters: Update to 1.5.0 --- build/pkgs/pandocfilters/checksums.ini | 6 +++--- build/pkgs/pandocfilters/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pandocfilters/checksums.ini b/build/pkgs/pandocfilters/checksums.ini index f34dc605282..507472f9621 100644 --- a/build/pkgs/pandocfilters/checksums.ini +++ b/build/pkgs/pandocfilters/checksums.ini @@ -1,5 +1,5 @@ tarball=pandocfilters-VERSION.tar.gz -sha1=d53e1b78070d9c065a0fe581baa525470c739808 -md5=1663f8ad167897848e23c749ce668dc8 -cksum=3183692252 +sha1=bdee4f81063c02168b421640f3e18917011153df +md5=d625fec43c27f091e465ff28df763a66 +cksum=1628002258 upstream_url=https://pypi.io/packages/source/p/pandocfilters/pandocfilters-VERSION.tar.gz diff --git a/build/pkgs/pandocfilters/package-version.txt b/build/pkgs/pandocfilters/package-version.txt index 428b770e3e2..bc80560fad6 100644 --- a/build/pkgs/pandocfilters/package-version.txt +++ b/build/pkgs/pandocfilters/package-version.txt @@ -1 +1 @@ -1.4.3 +1.5.0 From 6d998308efcf20db362dce0f706da1d72d734e34 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:26:23 -0700 Subject: [PATCH 068/416] build/pkgs/parso: Update to 0.8.3 --- build/pkgs/parso/checksums.ini | 6 +++--- build/pkgs/parso/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/parso/checksums.ini b/build/pkgs/parso/checksums.ini index 16537b4f4e9..fdaddf5e808 100644 --- a/build/pkgs/parso/checksums.ini +++ b/build/pkgs/parso/checksums.ini @@ -1,5 +1,5 @@ tarball=parso-VERSION.tar.gz -sha1=3cf5650dcbfd276da6bb80c171240bd3653b07f8 -md5=dd8fed40ceb890d3e277ad44a678c1f1 -cksum=2519307140 +sha1=1a34ea6e597a6498ef5c154195f9ffe8dda3d254 +md5=7ee251113f31f8d851c4a5d9e98977cb +cksum=566121311 upstream_url=https://pypi.io/packages/source/p/parso/parso-VERSION.tar.gz diff --git a/build/pkgs/parso/package-version.txt b/build/pkgs/parso/package-version.txt index 100435be135..ee94dd834b5 100644 --- a/build/pkgs/parso/package-version.txt +++ b/build/pkgs/parso/package-version.txt @@ -1 +1 @@ -0.8.2 +0.8.3 From c82cfb7604f7cd8d19e6698307abf30f7864dfe6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:27:56 -0700 Subject: [PATCH 069/416] build/pkgs/prometheus_client: Update to 0.14.1 --- build/pkgs/prometheus_client/checksums.ini | 6 +++--- build/pkgs/prometheus_client/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/prometheus_client/checksums.ini b/build/pkgs/prometheus_client/checksums.ini index aaa1f105b0b..a4d2d472c6e 100644 --- a/build/pkgs/prometheus_client/checksums.ini +++ b/build/pkgs/prometheus_client/checksums.ini @@ -1,5 +1,5 @@ tarball=prometheus_client-VERSION.tar.gz -sha1=78932e768ad69d5ffe1f12abb41c51554ef12eb8 -md5=4439c954aa7bc68b15915c6360967851 -cksum=4269644267 +sha1=dabd66e652ea8275b4980e337cefcea68cc0b560 +md5=295568805ef560acd16eecb18137ef30 +cksum=1955633542 upstream_url=https://pypi.io/packages/source/p/prometheus-client/prometheus_client-VERSION.tar.gz diff --git a/build/pkgs/prometheus_client/package-version.txt b/build/pkgs/prometheus_client/package-version.txt index ac454c6a1fc..930e3000bdc 100644 --- a/build/pkgs/prometheus_client/package-version.txt +++ b/build/pkgs/prometheus_client/package-version.txt @@ -1 +1 @@ -0.12.0 +0.14.1 From 9f860e1afd55f9babbdd033ca79cd44dbee2ca37 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:28:31 -0700 Subject: [PATCH 070/416] build/pkgs/prompt_toolkit: Update to 3.0.29 --- build/pkgs/prompt_toolkit/checksums.ini | 6 +++--- build/pkgs/prompt_toolkit/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/prompt_toolkit/checksums.ini b/build/pkgs/prompt_toolkit/checksums.ini index 0e3fe149968..e490811967d 100644 --- a/build/pkgs/prompt_toolkit/checksums.ini +++ b/build/pkgs/prompt_toolkit/checksums.ini @@ -1,5 +1,5 @@ tarball=prompt_toolkit-VERSION.tar.gz -sha1=5efb27677b89b2c81241645c6658e60771af3b7b -md5=bbaeba1142a64ecf2264eaf4f85201b1 -cksum=1605705668 +sha1=b5797c39ab8ae04639768b04e9a557c524f99122 +md5=170d4c9b420570f58fa1a6f763d70b12 +cksum=3627149035 upstream_url=https://pypi.io/packages/source/p/prompt_toolkit/prompt_toolkit-VERSION.tar.gz diff --git a/build/pkgs/prompt_toolkit/package-version.txt b/build/pkgs/prompt_toolkit/package-version.txt index 6795d4dc3be..92eba66b0da 100644 --- a/build/pkgs/prompt_toolkit/package-version.txt +++ b/build/pkgs/prompt_toolkit/package-version.txt @@ -1 +1 @@ -3.0.22 +3.0.29 From 234d203e2e5eadbf504e6037a54ac38e968df0ce Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:28:51 -0700 Subject: [PATCH 071/416] build/pkgs/py: Update to 1.11.0 --- build/pkgs/py/checksums.ini | 6 +++--- build/pkgs/py/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/py/checksums.ini b/build/pkgs/py/checksums.ini index ea29f7298f5..83f808c63bc 100644 --- a/build/pkgs/py/checksums.ini +++ b/build/pkgs/py/checksums.ini @@ -1,5 +1,5 @@ tarball=py-VERSION.tar.gz -sha1=690e4e3dcaeafe02ad4af36233148e7e10032d1a -md5=5f108bfe00d5468cbdb8071051f86a55 -cksum=220330409 +sha1=bb8aa4f56e3ced1cd61906495150e7ca2dacc10b +md5=bde7dcc1cb452a1e10206ef2f811ba88 +cksum=1774689161 upstream_url=https://pypi.io/packages/source/p/py/py-VERSION.tar.gz diff --git a/build/pkgs/py/package-version.txt b/build/pkgs/py/package-version.txt index 81c871de46b..1cac385c6cb 100644 --- a/build/pkgs/py/package-version.txt +++ b/build/pkgs/py/package-version.txt @@ -1 +1 @@ -1.10.0 +1.11.0 From cd8ae1d371df839fafce7936abd9683a300abbe2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:29:21 -0700 Subject: [PATCH 072/416] build/pkgs/pygments: Update to 2.11.2 --- build/pkgs/pygments/checksums.ini | 6 +++--- build/pkgs/pygments/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pygments/checksums.ini b/build/pkgs/pygments/checksums.ini index e31c2cba8bd..af7d1669e27 100644 --- a/build/pkgs/pygments/checksums.ini +++ b/build/pkgs/pygments/checksums.ini @@ -1,5 +1,5 @@ tarball=Pygments-VERSION.tar.gz -sha1=c9dfaa0fbdc069bafec6d49bc4f209fdcd320d9a -md5=87369a4e15019caf9cf056ab2c5858b3 -cksum=3562236659 +sha1=024013e5b29050b7118b576cc98253af2ff92b17 +md5=217b4355612df4b61dc570df4b0148ba +cksum=3923445853 upstream_url=https://pypi.io/packages/source/p/pygments/Pygments-VERSION.tar.gz diff --git a/build/pkgs/pygments/package-version.txt b/build/pkgs/pygments/package-version.txt index 10c2c0c3d62..9e5bb77a3ba 100644 --- a/build/pkgs/pygments/package-version.txt +++ b/build/pkgs/pygments/package-version.txt @@ -1 +1 @@ -2.10.0 +2.11.2 From 94496e40a6cec8309d48ebea94ab16f9cff2386a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:29:46 -0700 Subject: [PATCH 073/416] build/pkgs/pyparsing: Update to 3.0.8 --- build/pkgs/pyparsing/checksums.ini | 6 +++--- build/pkgs/pyparsing/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pyparsing/checksums.ini b/build/pkgs/pyparsing/checksums.ini index d3c3d9b20a4..d9605e254a7 100644 --- a/build/pkgs/pyparsing/checksums.ini +++ b/build/pkgs/pyparsing/checksums.ini @@ -1,5 +1,5 @@ tarball=pyparsing-VERSION.tar.gz -sha1=9c25e076bcf191734a44b85d1eb5d8c3324894c6 -md5=2f5fad6c8e99ac2562ab08ad9e45b195 -cksum=421409881 +sha1=7fc0630d7ee2b4fc6b7db4494a8528c4a1394492 +md5=971252e99e1e02a4c27f001894e0422d +cksum=1215277843 upstream_url=https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-VERSION.tar.gz diff --git a/build/pkgs/pyparsing/package-version.txt b/build/pkgs/pyparsing/package-version.txt index 818bd47abfc..67786e246ef 100644 --- a/build/pkgs/pyparsing/package-version.txt +++ b/build/pkgs/pyparsing/package-version.txt @@ -1 +1 @@ -3.0.6 +3.0.8 From f753edd615e146ea12c7535d18c45f00fae329ee Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:30:19 -0700 Subject: [PATCH 074/416] build/pkgs/pyrsistent: Update to 0.18.1 --- build/pkgs/pyrsistent/checksums.ini | 6 +++--- build/pkgs/pyrsistent/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pyrsistent/checksums.ini b/build/pkgs/pyrsistent/checksums.ini index 4c6c352f8ee..7ea885d3db7 100644 --- a/build/pkgs/pyrsistent/checksums.ini +++ b/build/pkgs/pyrsistent/checksums.ini @@ -1,5 +1,5 @@ tarball=pyrsistent-VERSION.tar.gz -sha1=b81b38a0490737f0a1f5854c739a1d36b90e04e1 -md5=1b335355d3eb40d0870988a1a41894b3 -cksum=110778893 +sha1=58f9efc4800acb6f7a083688e988187cccee2266 +md5=cef3da08455664bf917dcf8cd00d49a4 +cksum=350737156 upstream_url=https://pypi.io/packages/source/p/pyrsistent/pyrsistent-VERSION.tar.gz diff --git a/build/pkgs/pyrsistent/package-version.txt b/build/pkgs/pyrsistent/package-version.txt index 66333910a4b..249afd517d9 100644 --- a/build/pkgs/pyrsistent/package-version.txt +++ b/build/pkgs/pyrsistent/package-version.txt @@ -1 +1 @@ -0.18.0 +0.18.1 From bf896c1a61eca5bd38e29264251aab4354825bc4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:31:20 -0700 Subject: [PATCH 075/416] build/pkgs/requests: Update to 2.27.1 --- build/pkgs/requests/checksums.ini | 6 +++--- build/pkgs/requests/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/requests/checksums.ini b/build/pkgs/requests/checksums.ini index eb260e2bb74..4151d2b2e97 100644 --- a/build/pkgs/requests/checksums.ini +++ b/build/pkgs/requests/checksums.ini @@ -1,5 +1,5 @@ tarball=requests-VERSION.tar.gz -sha1=8c7a89d183d3e9b70bf91ba5b75eccf7111b9d8d -md5=8c745949ad3e9ae83d9927fed213db8a -cksum=696962843 +sha1=96c46fc47e75d06fa7ead4d7fb1ae7d58d68989f +md5=bcc01b73974a305cc7c5b092e7d07004 +cksum=3325038591 upstream_url=https://pypi.io/packages/source/r/requests/requests-VERSION.tar.gz diff --git a/build/pkgs/requests/package-version.txt b/build/pkgs/requests/package-version.txt index 7a25c70f90c..f0465234b5a 100644 --- a/build/pkgs/requests/package-version.txt +++ b/build/pkgs/requests/package-version.txt @@ -1 +1 @@ -2.26.0 +2.27.1 From 13ef5d7acda060ff9f4276be9ed136115378666f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:31:46 -0700 Subject: [PATCH 076/416] build/pkgs/snowballstemmer: Update to 2.2.0 --- build/pkgs/snowballstemmer/checksums.ini | 6 +++--- build/pkgs/snowballstemmer/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/snowballstemmer/checksums.ini b/build/pkgs/snowballstemmer/checksums.ini index 31edae47d88..dcc56ed9ed4 100644 --- a/build/pkgs/snowballstemmer/checksums.ini +++ b/build/pkgs/snowballstemmer/checksums.ini @@ -1,5 +1,5 @@ tarball=snowballstemmer-VERSION.tar.gz -sha1=b5e307fc808d032cd553d1d9aa9c99c55abd2288 -md5=fad6a525534b2da052d1fa820a615100 -cksum=3882812599 +sha1=aaf1b0e3b58d25e2e297ea3dbef59d8534ef8d92 +md5=4332ddc7bbee0f344a03915b2ad59a54 +cksum=3477609484 upstream_url=https://pypi.io/packages/source/s/snowballstemmer/snowballstemmer-VERSION.tar.gz diff --git a/build/pkgs/snowballstemmer/package-version.txt b/build/pkgs/snowballstemmer/package-version.txt index 7ec1d6db408..ccbccc3dc62 100644 --- a/build/pkgs/snowballstemmer/package-version.txt +++ b/build/pkgs/snowballstemmer/package-version.txt @@ -1 +1 @@ -2.1.0 +2.2.0 From 0ef065c075a314fdf6c334cb04695611037f4dda Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:32:36 -0700 Subject: [PATCH 077/416] build/pkgs/testpath: Update to 0.6.0 --- build/pkgs/testpath/checksums.ini | 6 +++--- build/pkgs/testpath/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/testpath/checksums.ini b/build/pkgs/testpath/checksums.ini index c0ca6daca96..1f908a1e8d4 100644 --- a/build/pkgs/testpath/checksums.ini +++ b/build/pkgs/testpath/checksums.ini @@ -1,5 +1,5 @@ tarball=testpath-VERSION.tar.gz -sha1=e5ef826ebc44b0ea83f5140f1b14ea4279c8f64a -md5=b3a41d75aadeab905f7014a3189e852b -cksum=3536911147 +sha1=5aef4f497566a144a4682b26d2356b4c66dd8a3c +md5=9fd4339f76da12d15bc718e4aa2566e9 +cksum=3440988979 upstream_url=https://pypi.io/packages/source/t/testpath/testpath-VERSION.tar.gz diff --git a/build/pkgs/testpath/package-version.txt b/build/pkgs/testpath/package-version.txt index 8f0916f768f..a918a2aa18d 100644 --- a/build/pkgs/testpath/package-version.txt +++ b/build/pkgs/testpath/package-version.txt @@ -1 +1 @@ -0.5.0 +0.6.0 From 38cd063301244d1af32ce588962723ae62dc3cca Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:33:47 -0700 Subject: [PATCH 078/416] build/pkgs/urllib3: Update to 1.26.9 --- build/pkgs/urllib3/checksums.ini | 6 +++--- build/pkgs/urllib3/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/urllib3/checksums.ini b/build/pkgs/urllib3/checksums.ini index 74f53240ea1..102eb61180b 100644 --- a/build/pkgs/urllib3/checksums.ini +++ b/build/pkgs/urllib3/checksums.ini @@ -1,5 +1,5 @@ tarball=urllib3-VERSION.tar.gz -sha1=92a9850f0e9fcc8d9d144a787855a4b90a6cae3f -md5=3a88ec3bcb761ca23df2c3583949be37 -cksum=3104460018 +sha1=f7fc28c04042d141272d9aa24ca9506b9e59f870 +md5=d4b58522821a33c5e421191b83e0dbac +cksum=1538549000 upstream_url=https://pypi.io/packages/source/u/urllib3/urllib3-VERSION.tar.gz diff --git a/build/pkgs/urllib3/package-version.txt b/build/pkgs/urllib3/package-version.txt index f250c8f6045..3cd33cde0f7 100644 --- a/build/pkgs/urllib3/package-version.txt +++ b/build/pkgs/urllib3/package-version.txt @@ -1 +1 @@ -1.26.6 +1.26.9 From 247703697d99b35b421ba5b9212645411d98ae1b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:34:17 -0700 Subject: [PATCH 079/416] build/pkgs/widgetsnbextension: Update to 3.6.0 --- build/pkgs/widgetsnbextension/checksums.ini | 6 +++--- build/pkgs/widgetsnbextension/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/widgetsnbextension/checksums.ini b/build/pkgs/widgetsnbextension/checksums.ini index 81205c5a07e..81e6d3f9e10 100644 --- a/build/pkgs/widgetsnbextension/checksums.ini +++ b/build/pkgs/widgetsnbextension/checksums.ini @@ -1,5 +1,5 @@ tarball=widgetsnbextension-VERSION.tar.gz -sha1=010f70ab9a6d6e0a4f9607cce0da182ee6c1280a -md5=c126a06559afe658e285bcd483790710 -cksum=160710350 +sha1=f692865cf1dd4efd77d7d6f1be8ef6a5678ceb67 +md5=60c9ddbc7a04ff3c92c5570ec063f9b0 +cksum=1982133179 upstream_url=https://pypi.io/packages/source/w/widgetsnbextension/widgetsnbextension-VERSION.tar.gz diff --git a/build/pkgs/widgetsnbextension/package-version.txt b/build/pkgs/widgetsnbextension/package-version.txt index 87ce492908a..40c341bdcdb 100644 --- a/build/pkgs/widgetsnbextension/package-version.txt +++ b/build/pkgs/widgetsnbextension/package-version.txt @@ -1 +1 @@ -3.5.2 +3.6.0 From 9090c5c5264818e5a102e72fb8776d3c544fcc4e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:34:42 -0700 Subject: [PATCH 080/416] build/pkgs/zipp: Update to 3.8.0 --- build/pkgs/zipp/checksums.ini | 6 +++--- build/pkgs/zipp/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/zipp/checksums.ini b/build/pkgs/zipp/checksums.ini index 6af68aa3d57..3c82ab5cc17 100644 --- a/build/pkgs/zipp/checksums.ini +++ b/build/pkgs/zipp/checksums.ini @@ -1,5 +1,5 @@ tarball=zipp-VERSION.tar.gz -sha1=53234d6dbfc809d03f2b85db6dbb4e559ef200a1 -md5=617efbf3edb707c57008ec00f408972f -cksum=2911023413 +sha1=52f43da4467b178ac97ca78a2487ecbc94b4a9b2 +md5=8864ff5ed01cd28755cc87f1443dbc67 +cksum=3776620702 upstream_url=https://pypi.io/packages/source/z/zipp/zipp-VERSION.tar.gz diff --git a/build/pkgs/zipp/package-version.txt b/build/pkgs/zipp/package-version.txt index 1545d966571..19811903a7f 100644 --- a/build/pkgs/zipp/package-version.txt +++ b/build/pkgs/zipp/package-version.txt @@ -1 +1 @@ -3.5.0 +3.8.0 From 00f008cad89f4a7d0f51f020f789b637b7c74477 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 18:54:30 -0700 Subject: [PATCH 081/416] build/pkgs/ipython/dependencies: Add decorator --- build/pkgs/ipython/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/ipython/dependencies b/build/pkgs/ipython/dependencies index f15f6f0aca1..79f54c821fc 100644 --- a/build/pkgs/ipython/dependencies +++ b/build/pkgs/ipython/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets | $(PYTHON_TOOLCHAIN) wcwidth prompt_toolkit pygments pexpect appnope backcall jedi +$(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets decorator wcwidth prompt_toolkit pygments pexpect appnope backcall jedi | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 288f90d6283afe0f6f2ce9447f6d8457ee392e36 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 19:03:08 -0700 Subject: [PATCH 082/416] build/pkgs/entrypoints/spkg-install.in: Back out workaround for use of flit as the build system --- build/pkgs/entrypoints/spkg-install.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build/pkgs/entrypoints/spkg-install.in b/build/pkgs/entrypoints/spkg-install.in index cb4ba894442..058b1344dc2 100644 --- a/build/pkgs/entrypoints/spkg-install.in +++ b/build/pkgs/entrypoints/spkg-install.in @@ -1,8 +1,3 @@ cd src -# Make sure that modern pip uses the generated setup.py -# that is distributed with the PyPI tarball, -# so we do not have to have flit. Trac #29803. -rm -f pyproject.toml - sdh_pip_install . From 5fb56b67e8af68adb918b53f747a9f0c482ad715 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 19:21:38 -0700 Subject: [PATCH 083/416] build/pkgs/testpath/spkg-install.in: Back out workaround for use of flit as the build system --- build/pkgs/testpath/spkg-install.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build/pkgs/testpath/spkg-install.in b/build/pkgs/testpath/spkg-install.in index cb4ba894442..058b1344dc2 100644 --- a/build/pkgs/testpath/spkg-install.in +++ b/build/pkgs/testpath/spkg-install.in @@ -1,8 +1,3 @@ cd src -# Make sure that modern pip uses the generated setup.py -# that is distributed with the PyPI tarball, -# so we do not have to have flit. Trac #29803. -rm -f pyproject.toml - sdh_pip_install . From cc4b971cc343a3d941e27d5c89880d217800c765 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 19:39:51 -0700 Subject: [PATCH 084/416] build/pkgs/nbclient/dependencies: Add nbformat --- build/pkgs/nbclient/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/nbclient/dependencies b/build/pkgs/nbclient/dependencies index d6cb580bd7a..e21070fd3af 100644 --- a/build/pkgs/nbclient/dependencies +++ b/build/pkgs/nbclient/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jupyter_client | $(PYTHON_TOOLCHAIN) +$(PYTHON) jupyter_client nbformat | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 9992517cd1ee33bab1d171b24574c19d85cfc762 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 19:41:00 -0700 Subject: [PATCH 085/416] build/pkgs/entrypoints/checksums.ini: Add upstream_url --- build/pkgs/entrypoints/checksums.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pkgs/entrypoints/checksums.ini b/build/pkgs/entrypoints/checksums.ini index 2b08b5b80e5..88c67871e54 100644 --- a/build/pkgs/entrypoints/checksums.ini +++ b/build/pkgs/entrypoints/checksums.ini @@ -2,3 +2,4 @@ tarball=entrypoints-VERSION.tar.gz sha1=ca5c5976781db7ec6e8faece06af31ff32960529 md5=3acd8b72119a8fb1eac7030c24ac6b49 cksum=3193499805 +upstream_url=https://pypi.io/packages/source/e/entrypoints/entrypoints-VERSION.tar.gz From 812cc7eb516436e6b6ce648460b9a3f97d97a88e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 19:50:36 -0700 Subject: [PATCH 086/416] build/pkgs/{entrypoints,pyparsing,testpath}/dependencies: Add flit_core tomli --- build/pkgs/entrypoints/dependencies | 2 +- build/pkgs/pyparsing/dependencies | 2 +- build/pkgs/testpath/dependencies | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/pkgs/entrypoints/dependencies b/build/pkgs/entrypoints/dependencies index 15df0c4d6d8..35228f20368 100644 --- a/build/pkgs/entrypoints/dependencies +++ b/build/pkgs/entrypoints/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) | $(PYTHON_TOOLCHAIN) flit_core tomli ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pyparsing/dependencies b/build/pkgs/pyparsing/dependencies index 3614951f5cb..08d4b935364 100644 --- a/build/pkgs/pyparsing/dependencies +++ b/build/pkgs/pyparsing/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | setuptools pip wheel +$(PYTHON) | pip wheel flit_core tomli ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/testpath/dependencies b/build/pkgs/testpath/dependencies index 15df0c4d6d8..35228f20368 100644 --- a/build/pkgs/testpath/dependencies +++ b/build/pkgs/testpath/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) | $(PYTHON_TOOLCHAIN) flit_core tomli ---------- All lines of this file are ignored except the first. From 5e5e8ac7bd30c8a0eab32357575c9cee79804555 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 19:59:01 -0700 Subject: [PATCH 087/416] build/pkgs/nbconvert/dependencies: Add markupsafe --- build/pkgs/nbconvert/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/nbconvert/dependencies b/build/pkgs/nbconvert/dependencies index 86e4ceccf2e..889b9ac5db3 100644 --- a/build/pkgs/nbconvert/dependencies +++ b/build/pkgs/nbconvert/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters testpath defusedxml jupyter_client jupyterlab_pygments nbclient beautifulsoup4 | $(PYTHON_TOOLCHAIN) +$(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters testpath defusedxml jupyter_client jupyterlab_pygments nbclient beautifulsoup4 markupsafe | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 2616bc878222d2f826c4710df24434313cd94b7f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 21:13:25 -0700 Subject: [PATCH 088/416] build/pkgs/tinycss2: New, dependency of nbconvert >= 6.5.0 --- build/pkgs/tinycss2/SPKG.rst | 16 ++++++++++++++++ build/pkgs/tinycss2/checksums.ini | 5 +++++ build/pkgs/tinycss2/dependencies | 4 ++++ build/pkgs/tinycss2/install-requires.txt | 1 + build/pkgs/tinycss2/package-version.txt | 1 + build/pkgs/tinycss2/spkg-install.in | 2 ++ build/pkgs/tinycss2/type | 1 + 7 files changed, 30 insertions(+) create mode 100644 build/pkgs/tinycss2/SPKG.rst create mode 100644 build/pkgs/tinycss2/checksums.ini create mode 100644 build/pkgs/tinycss2/dependencies create mode 100644 build/pkgs/tinycss2/install-requires.txt create mode 100644 build/pkgs/tinycss2/package-version.txt create mode 100644 build/pkgs/tinycss2/spkg-install.in create mode 100644 build/pkgs/tinycss2/type diff --git a/build/pkgs/tinycss2/SPKG.rst b/build/pkgs/tinycss2/SPKG.rst new file mode 100644 index 00000000000..3ea02d649ff --- /dev/null +++ b/build/pkgs/tinycss2/SPKG.rst @@ -0,0 +1,16 @@ +tinycss2: A tiny CSS parser +=========================== + +Description +----------- + +A tiny CSS parser + +License +------- + +Upstream Contact +---------------- + +https://pypi.org/project/tinycss2/ + diff --git a/build/pkgs/tinycss2/checksums.ini b/build/pkgs/tinycss2/checksums.ini new file mode 100644 index 00000000000..668d72fa9e4 --- /dev/null +++ b/build/pkgs/tinycss2/checksums.ini @@ -0,0 +1,5 @@ +tarball=tinycss2-VERSION.tar.gz +sha1=4a05bce2f350b120791a59c6595564274ca4c6b3 +md5=60272f58f8d5834b2e09ffbc9bd5de53 +cksum=3520456675 +upstream_url=https://pypi.io/packages/source/t/tinycss2/tinycss2-VERSION.tar.gz diff --git a/build/pkgs/tinycss2/dependencies b/build/pkgs/tinycss2/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/tinycss2/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/tinycss2/install-requires.txt b/build/pkgs/tinycss2/install-requires.txt new file mode 100644 index 00000000000..29992f20d2c --- /dev/null +++ b/build/pkgs/tinycss2/install-requires.txt @@ -0,0 +1 @@ +tinycss2 diff --git a/build/pkgs/tinycss2/package-version.txt b/build/pkgs/tinycss2/package-version.txt new file mode 100644 index 00000000000..524cb55242b --- /dev/null +++ b/build/pkgs/tinycss2/package-version.txt @@ -0,0 +1 @@ +1.1.1 diff --git a/build/pkgs/tinycss2/spkg-install.in b/build/pkgs/tinycss2/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/tinycss2/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/tinycss2/type b/build/pkgs/tinycss2/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/tinycss2/type @@ -0,0 +1 @@ +standard From 42cae9fc215175d304e7cc55681e755c55517a0a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 21:14:27 -0700 Subject: [PATCH 089/416] build/pkgs/nbconvert: Update to 6.5.0 --- build/pkgs/nbconvert/checksums.ini | 6 +++--- build/pkgs/nbconvert/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/nbconvert/checksums.ini b/build/pkgs/nbconvert/checksums.ini index fe06e03536d..e10e8b224e8 100644 --- a/build/pkgs/nbconvert/checksums.ini +++ b/build/pkgs/nbconvert/checksums.ini @@ -1,5 +1,5 @@ tarball=nbconvert-VERSION.tar.gz -sha1=fc42c159a69ba269ca74ae93e8ffe301495a6072 -md5=58d38f0aeb5942e29f5bd346ef3a7bba -cksum=2705940899 +sha1=061c9f18039aa8b6c5f83fc2281cbf8f6c4f3198 +md5=486a48c4dc3986e8801058273964d189 +cksum=183380977 upstream_url=https://pypi.io/packages/source/n/nbconvert/nbconvert-VERSION.tar.gz diff --git a/build/pkgs/nbconvert/package-version.txt b/build/pkgs/nbconvert/package-version.txt index 49df80bfeb4..f22d756da39 100644 --- a/build/pkgs/nbconvert/package-version.txt +++ b/build/pkgs/nbconvert/package-version.txt @@ -1 +1 @@ -6.4.4 +6.5.0 From 3986b486251dbe8c1ee7ea81dd74e46bb6a8accc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 21:16:24 -0700 Subject: [PATCH 090/416] build/pkgs/testpath: Remove, no longer a dependency of nbconvert --- build/pkgs/nbconvert/dependencies | 2 +- build/pkgs/testpath/SPKG.rst | 8 -------- build/pkgs/testpath/checksums.ini | 5 ----- build/pkgs/testpath/dependencies | 5 ----- build/pkgs/testpath/distros/conda.txt | 1 - build/pkgs/testpath/distros/macports.txt | 1 - build/pkgs/testpath/distros/repology.txt | 2 -- build/pkgs/testpath/distros/void.txt | 1 - build/pkgs/testpath/install-requires.txt | 1 - build/pkgs/testpath/package-version.txt | 1 - build/pkgs/testpath/spkg-install.in | 3 --- build/pkgs/testpath/type | 1 - 12 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 build/pkgs/testpath/SPKG.rst delete mode 100644 build/pkgs/testpath/checksums.ini delete mode 100644 build/pkgs/testpath/dependencies delete mode 100644 build/pkgs/testpath/distros/conda.txt delete mode 100644 build/pkgs/testpath/distros/macports.txt delete mode 100644 build/pkgs/testpath/distros/repology.txt delete mode 100644 build/pkgs/testpath/distros/void.txt delete mode 100644 build/pkgs/testpath/install-requires.txt delete mode 100644 build/pkgs/testpath/package-version.txt delete mode 100644 build/pkgs/testpath/spkg-install.in delete mode 100644 build/pkgs/testpath/type diff --git a/build/pkgs/nbconvert/dependencies b/build/pkgs/nbconvert/dependencies index 889b9ac5db3..64f53502f34 100644 --- a/build/pkgs/nbconvert/dependencies +++ b/build/pkgs/nbconvert/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters testpath defusedxml jupyter_client jupyterlab_pygments nbclient beautifulsoup4 markupsafe | $(PYTHON_TOOLCHAIN) +$(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters defusedxml jupyter_client jupyterlab_pygments nbclient beautifulsoup4 markupsafe | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/testpath/SPKG.rst b/build/pkgs/testpath/SPKG.rst deleted file mode 100644 index c086c416d00..00000000000 --- a/build/pkgs/testpath/SPKG.rst +++ /dev/null @@ -1,8 +0,0 @@ -testpath: Testing utilities for filesystem-related code -======================================================= - -Description ------------ - -Testpath is a collection of utilities for testing code which uses and -manipulates the filesystem and system commands diff --git a/build/pkgs/testpath/checksums.ini b/build/pkgs/testpath/checksums.ini deleted file mode 100644 index 1f908a1e8d4..00000000000 --- a/build/pkgs/testpath/checksums.ini +++ /dev/null @@ -1,5 +0,0 @@ -tarball=testpath-VERSION.tar.gz -sha1=5aef4f497566a144a4682b26d2356b4c66dd8a3c -md5=9fd4339f76da12d15bc718e4aa2566e9 -cksum=3440988979 -upstream_url=https://pypi.io/packages/source/t/testpath/testpath-VERSION.tar.gz diff --git a/build/pkgs/testpath/dependencies b/build/pkgs/testpath/dependencies deleted file mode 100644 index 35228f20368..00000000000 --- a/build/pkgs/testpath/dependencies +++ /dev/null @@ -1,5 +0,0 @@ -$(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/testpath/distros/conda.txt b/build/pkgs/testpath/distros/conda.txt deleted file mode 100644 index 1dd2cb52320..00000000000 --- a/build/pkgs/testpath/distros/conda.txt +++ /dev/null @@ -1 +0,0 @@ -testpath diff --git a/build/pkgs/testpath/distros/macports.txt b/build/pkgs/testpath/distros/macports.txt deleted file mode 100644 index 5687656ee5a..00000000000 --- a/build/pkgs/testpath/distros/macports.txt +++ /dev/null @@ -1 +0,0 @@ -py-testpath diff --git a/build/pkgs/testpath/distros/repology.txt b/build/pkgs/testpath/distros/repology.txt deleted file mode 100644 index 5d3e402eadd..00000000000 --- a/build/pkgs/testpath/distros/repology.txt +++ /dev/null @@ -1,2 +0,0 @@ -testpath -python:testpath diff --git a/build/pkgs/testpath/distros/void.txt b/build/pkgs/testpath/distros/void.txt deleted file mode 100644 index 6c622800768..00000000000 --- a/build/pkgs/testpath/distros/void.txt +++ /dev/null @@ -1 +0,0 @@ -python3-testpath diff --git a/build/pkgs/testpath/install-requires.txt b/build/pkgs/testpath/install-requires.txt deleted file mode 100644 index acfcd4a1a03..00000000000 --- a/build/pkgs/testpath/install-requires.txt +++ /dev/null @@ -1 +0,0 @@ -testpath >=0.4.4 diff --git a/build/pkgs/testpath/package-version.txt b/build/pkgs/testpath/package-version.txt deleted file mode 100644 index a918a2aa18d..00000000000 --- a/build/pkgs/testpath/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -0.6.0 diff --git a/build/pkgs/testpath/spkg-install.in b/build/pkgs/testpath/spkg-install.in deleted file mode 100644 index 058b1344dc2..00000000000 --- a/build/pkgs/testpath/spkg-install.in +++ /dev/null @@ -1,3 +0,0 @@ -cd src - -sdh_pip_install . diff --git a/build/pkgs/testpath/type b/build/pkgs/testpath/type deleted file mode 100644 index a6a7b9cd726..00000000000 --- a/build/pkgs/testpath/type +++ /dev/null @@ -1 +0,0 @@ -standard From c3dfddbd20008e38abcef5d2940da83e9705bd69 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Apr 2022 22:21:51 -0700 Subject: [PATCH 091/416] build/pkgs/tinycss2/dependencies: Add webencodings --- build/pkgs/tinycss2/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/tinycss2/dependencies b/build/pkgs/tinycss2/dependencies index 0738c2d7777..89200065387 100644 --- a/build/pkgs/tinycss2/dependencies +++ b/build/pkgs/tinycss2/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) webencodings | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 534d955491f2eec1e2ef5991cf11d1629bbb4236 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 29 Apr 2022 10:51:55 -0700 Subject: [PATCH 092/416] build/pkgs/argcomplete: Remove, not needed with python >= 3.8 --- build/pkgs/argcomplete/SPKG.rst | 18 ------------------ build/pkgs/argcomplete/checksums.ini | 5 ----- build/pkgs/argcomplete/dependencies | 4 ---- build/pkgs/argcomplete/distros/void.txt | 1 - build/pkgs/argcomplete/install-requires.txt | 1 - build/pkgs/argcomplete/package-version.txt | 1 - build/pkgs/argcomplete/spkg-install.in | 2 -- build/pkgs/argcomplete/type | 1 - build/pkgs/ipykernel/dependencies | 2 +- 9 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 build/pkgs/argcomplete/SPKG.rst delete mode 100644 build/pkgs/argcomplete/checksums.ini delete mode 100644 build/pkgs/argcomplete/dependencies delete mode 100644 build/pkgs/argcomplete/distros/void.txt delete mode 100644 build/pkgs/argcomplete/install-requires.txt delete mode 100644 build/pkgs/argcomplete/package-version.txt delete mode 100644 build/pkgs/argcomplete/spkg-install.in delete mode 100644 build/pkgs/argcomplete/type diff --git a/build/pkgs/argcomplete/SPKG.rst b/build/pkgs/argcomplete/SPKG.rst deleted file mode 100644 index 4e823cf2f7d..00000000000 --- a/build/pkgs/argcomplete/SPKG.rst +++ /dev/null @@ -1,18 +0,0 @@ -argcomplete: Bash tab completion for argparse -============================================= - -Description ------------ - -Bash tab completion for argparse - -License -------- - -Apache Software License - -Upstream Contact ----------------- - -https://pypi.org/project/argcomplete/ - diff --git a/build/pkgs/argcomplete/checksums.ini b/build/pkgs/argcomplete/checksums.ini deleted file mode 100644 index 842c0cce185..00000000000 --- a/build/pkgs/argcomplete/checksums.ini +++ /dev/null @@ -1,5 +0,0 @@ -tarball=argcomplete-VERSION.tar.gz -sha1=8a2f63ec4b37798f7b455c6320d02efe95730914 -md5=50437bb1e6911540e8ba9b97c7768663 -cksum=4261535290 -upstream_url=https://pypi.io/packages/source/a/argcomplete/argcomplete-VERSION.tar.gz diff --git a/build/pkgs/argcomplete/dependencies b/build/pkgs/argcomplete/dependencies deleted file mode 100644 index 0738c2d7777..00000000000 --- a/build/pkgs/argcomplete/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/argcomplete/distros/void.txt b/build/pkgs/argcomplete/distros/void.txt deleted file mode 100644 index 11f098f9ee3..00000000000 --- a/build/pkgs/argcomplete/distros/void.txt +++ /dev/null @@ -1 +0,0 @@ -python3-argcomplete diff --git a/build/pkgs/argcomplete/install-requires.txt b/build/pkgs/argcomplete/install-requires.txt deleted file mode 100644 index e60624ffee6..00000000000 --- a/build/pkgs/argcomplete/install-requires.txt +++ /dev/null @@ -1 +0,0 @@ -argcomplete diff --git a/build/pkgs/argcomplete/package-version.txt b/build/pkgs/argcomplete/package-version.txt deleted file mode 100644 index 227cea21564..00000000000 --- a/build/pkgs/argcomplete/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -2.0.0 diff --git a/build/pkgs/argcomplete/spkg-install.in b/build/pkgs/argcomplete/spkg-install.in deleted file mode 100644 index 37ac1a53437..00000000000 --- a/build/pkgs/argcomplete/spkg-install.in +++ /dev/null @@ -1,2 +0,0 @@ -cd src -sdh_pip_install . diff --git a/build/pkgs/argcomplete/type b/build/pkgs/argcomplete/type deleted file mode 100644 index a6a7b9cd726..00000000000 --- a/build/pkgs/argcomplete/type +++ /dev/null @@ -1 +0,0 @@ -standard diff --git a/build/pkgs/ipykernel/dependencies b/build/pkgs/ipykernel/dependencies index 5b3708a31fc..4d4493c6e73 100644 --- a/build/pkgs/ipykernel/dependencies +++ b/build/pkgs/ipykernel/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) ipython_genutils importlib_metadata argcomplete matplotlib_inline ipython jupyter_client tornado appnope traitlets | $(PYTHON_TOOLCHAIN) +$(PYTHON) ipython_genutils importlib_metadata matplotlib_inline ipython jupyter_client tornado appnope traitlets | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 33289c7669c6f0b9c8f0ed319efda01d42dd9410 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 19:21:56 -0700 Subject: [PATCH 093/416] build/pkgs/ipython: Update to 8.3.0 --- build/pkgs/ipython/checksums.ini | 6 +++--- build/pkgs/ipython/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/ipython/checksums.ini b/build/pkgs/ipython/checksums.ini index 03da0120c1f..d5c70f8f762 100644 --- a/build/pkgs/ipython/checksums.ini +++ b/build/pkgs/ipython/checksums.ini @@ -1,5 +1,5 @@ tarball=ipython-VERSION.tar.gz -sha1=05165e7fdcebde908aa6b65892ef230795a01e6b -md5=159340b8ba158386f938a8b882749fed -cksum=1960065579 +sha1=933d31cb657f0adfac7c0f02ec5664a9d64267ea +md5=2c334d241c66551125467b583fc1871e +cksum=362811784 upstream_url=https://pypi.io/packages/source/i/ipython/ipython-VERSION.tar.gz diff --git a/build/pkgs/ipython/package-version.txt b/build/pkgs/ipython/package-version.txt index d88eca009e8..2bf50aaf17a 100644 --- a/build/pkgs/ipython/package-version.txt +++ b/build/pkgs/ipython/package-version.txt @@ -1 +1 @@ -7.29.0 +8.3.0 From a291d162b7314e3c3ca352b09ade05c2ff7e3c0d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 19:22:51 -0700 Subject: [PATCH 094/416] build/pkgs/jsonschema: Update to 4.5.1 --- build/pkgs/jsonschema/checksums.ini | 6 +++--- build/pkgs/jsonschema/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jsonschema/checksums.ini b/build/pkgs/jsonschema/checksums.ini index 52b8b97b2cc..955e0401faa 100644 --- a/build/pkgs/jsonschema/checksums.ini +++ b/build/pkgs/jsonschema/checksums.ini @@ -1,5 +1,5 @@ tarball=jsonschema-VERSION.tar.gz -sha1=a05ab16478adf9663e301a02413dcd7efef7431e -md5=0fa6d31342d4a23952ae255abb4ae3d8 -cksum=2518167215 +sha1=5f90a208235152dc4f0b8ae51ca2860c0771ff51 +md5=c3f7a29c187bf1d038c66a5d5763eab1 +cksum=2329724463 upstream_url=https://pypi.io/packages/source/j/jsonschema/jsonschema-VERSION.tar.gz diff --git a/build/pkgs/jsonschema/package-version.txt b/build/pkgs/jsonschema/package-version.txt index fdc6698807a..4404a17baed 100644 --- a/build/pkgs/jsonschema/package-version.txt +++ b/build/pkgs/jsonschema/package-version.txt @@ -1 +1 @@ -4.4.0 +4.5.1 From fc0ee6030aaf599df8cbec18bb7442d9cb1f4281 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 19:23:07 -0700 Subject: [PATCH 095/416] build/pkgs/jupyter_client: Update to 7.3.1 --- build/pkgs/jupyter_client/checksums.ini | 6 +++--- build/pkgs/jupyter_client/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jupyter_client/checksums.ini b/build/pkgs/jupyter_client/checksums.ini index 5716d96ee47..71b68d04aff 100644 --- a/build/pkgs/jupyter_client/checksums.ini +++ b/build/pkgs/jupyter_client/checksums.ini @@ -1,5 +1,5 @@ tarball=jupyter_client-VERSION.tar.gz -sha1=12c08a55363a38f00f8026c1832a2b615b5f2dde -md5=89ea1f88752df403c604175834f92eed -cksum=1087484837 +sha1=f620e8854f3ebbfd5a305d6c4831bd9fc94570ab +md5=6eb727d9dc2b7f19252d3ffb0c22bb9b +cksum=713839153 upstream_url=https://pypi.io/packages/source/j/jupyter_client/jupyter_client-VERSION.tar.gz diff --git a/build/pkgs/jupyter_client/package-version.txt b/build/pkgs/jupyter_client/package-version.txt index 77f5bec5b2b..643916c03f1 100644 --- a/build/pkgs/jupyter_client/package-version.txt +++ b/build/pkgs/jupyter_client/package-version.txt @@ -1 +1 @@ -7.2.2 +7.3.1 From 4608a352a094f5ab44feedfceaa5e4e715d4a47a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 19:23:22 -0700 Subject: [PATCH 096/416] build/pkgs/nbclient: Update to 0.6.3 --- build/pkgs/nbclient/checksums.ini | 6 +++--- build/pkgs/nbclient/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/nbclient/checksums.ini b/build/pkgs/nbclient/checksums.ini index bb9c8e3fedd..db16b8e3c59 100644 --- a/build/pkgs/nbclient/checksums.ini +++ b/build/pkgs/nbclient/checksums.ini @@ -1,5 +1,5 @@ tarball=nbclient-VERSION.tar.gz -sha1=16ab7aa979aa2a0d1b393f204000c93a36d945bd -md5=8f99efbbf1b3a7dcde2632e46bd81a17 -cksum=3366584983 +sha1=254e5882b028b1bda5eb4752fffa8e932399da53 +md5=895b6541e27a64eb33728c9387c65327 +cksum=4244298637 upstream_url=https://pypi.io/packages/source/n/nbclient/nbclient-VERSION.tar.gz diff --git a/build/pkgs/nbclient/package-version.txt b/build/pkgs/nbclient/package-version.txt index a918a2aa18d..844f6a91acb 100644 --- a/build/pkgs/nbclient/package-version.txt +++ b/build/pkgs/nbclient/package-version.txt @@ -1 +1 @@ -0.6.0 +0.6.3 From 0191ea8512ca75e9eebbbe14d9b4cf09a9d35958 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 19:24:40 -0700 Subject: [PATCH 097/416] build/pkgs/pygments: Update to 2.12.0 --- build/pkgs/pygments/checksums.ini | 6 +++--- build/pkgs/pygments/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pygments/checksums.ini b/build/pkgs/pygments/checksums.ini index af7d1669e27..f7b5fdbde3a 100644 --- a/build/pkgs/pygments/checksums.ini +++ b/build/pkgs/pygments/checksums.ini @@ -1,5 +1,5 @@ tarball=Pygments-VERSION.tar.gz -sha1=024013e5b29050b7118b576cc98253af2ff92b17 -md5=217b4355612df4b61dc570df4b0148ba -cksum=3923445853 +sha1=92e83541b557dad3f692d0d9d02733c2c842c836 +md5=2137c19d9ac0cc556badc89e746c0e62 +cksum=3384039979 upstream_url=https://pypi.io/packages/source/p/pygments/Pygments-VERSION.tar.gz diff --git a/build/pkgs/pygments/package-version.txt b/build/pkgs/pygments/package-version.txt index 9e5bb77a3ba..d8b698973a4 100644 --- a/build/pkgs/pygments/package-version.txt +++ b/build/pkgs/pygments/package-version.txt @@ -1 +1 @@ -2.11.2 +2.12.0 From f3e9acea8bfdcddaf42a38d48cc095ac898b48e8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 19:24:50 -0700 Subject: [PATCH 098/416] build/pkgs/pyparsing: Update to 3.0.9 --- build/pkgs/pyparsing/checksums.ini | 6 +++--- build/pkgs/pyparsing/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pyparsing/checksums.ini b/build/pkgs/pyparsing/checksums.ini index d9605e254a7..c002d3a3e65 100644 --- a/build/pkgs/pyparsing/checksums.ini +++ b/build/pkgs/pyparsing/checksums.ini @@ -1,5 +1,5 @@ tarball=pyparsing-VERSION.tar.gz -sha1=7fc0630d7ee2b4fc6b7db4494a8528c4a1394492 -md5=971252e99e1e02a4c27f001894e0422d -cksum=1215277843 +sha1=13f44b5b186a627f2481a8eb0d7aedcd6885a641 +md5=fadc2f3bf5872bf6310576a86c3566e0 +cksum=741417334 upstream_url=https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-VERSION.tar.gz diff --git a/build/pkgs/pyparsing/package-version.txt b/build/pkgs/pyparsing/package-version.txt index 67786e246ef..747457c6d22 100644 --- a/build/pkgs/pyparsing/package-version.txt +++ b/build/pkgs/pyparsing/package-version.txt @@ -1 +1 @@ -3.0.8 +3.0.9 From f79e3cf8c8675159a15954273763f8a94ef8d896 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 20:01:25 -0700 Subject: [PATCH 099/416] build/pkgs/{stack_data,pure_eval,asttokens,executing}: New, dependencies of ipython --- build/pkgs/asttokens/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/asttokens/checksums.ini | 5 +++++ build/pkgs/asttokens/dependencies | 4 ++++ build/pkgs/asttokens/install-requires.txt | 1 + build/pkgs/asttokens/package-version.txt | 1 + build/pkgs/asttokens/spkg-install.in | 2 ++ build/pkgs/asttokens/type | 1 + build/pkgs/executing/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/executing/checksums.ini | 5 +++++ build/pkgs/executing/dependencies | 4 ++++ build/pkgs/executing/install-requires.txt | 1 + build/pkgs/executing/package-version.txt | 1 + build/pkgs/executing/spkg-install.in | 2 ++ build/pkgs/executing/type | 1 + build/pkgs/ipython/dependencies | 2 +- build/pkgs/pure_eval/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/pure_eval/checksums.ini | 5 +++++ build/pkgs/pure_eval/dependencies | 4 ++++ build/pkgs/pure_eval/install-requires.txt | 1 + build/pkgs/pure_eval/package-version.txt | 1 + build/pkgs/pure_eval/spkg-install.in | 2 ++ build/pkgs/pure_eval/type | 1 + build/pkgs/stack_data/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/stack_data/checksums.ini | 5 +++++ build/pkgs/stack_data/dependencies | 4 ++++ build/pkgs/stack_data/install-requires.txt | 1 + build/pkgs/stack_data/package-version.txt | 1 + build/pkgs/stack_data/spkg-install.in | 2 ++ build/pkgs/stack_data/type | 1 + 29 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/asttokens/SPKG.rst create mode 100644 build/pkgs/asttokens/checksums.ini create mode 100644 build/pkgs/asttokens/dependencies create mode 100644 build/pkgs/asttokens/install-requires.txt create mode 100644 build/pkgs/asttokens/package-version.txt create mode 100644 build/pkgs/asttokens/spkg-install.in create mode 100644 build/pkgs/asttokens/type create mode 100644 build/pkgs/executing/SPKG.rst create mode 100644 build/pkgs/executing/checksums.ini create mode 100644 build/pkgs/executing/dependencies create mode 100644 build/pkgs/executing/install-requires.txt create mode 100644 build/pkgs/executing/package-version.txt create mode 100644 build/pkgs/executing/spkg-install.in create mode 100644 build/pkgs/executing/type create mode 100644 build/pkgs/pure_eval/SPKG.rst create mode 100644 build/pkgs/pure_eval/checksums.ini create mode 100644 build/pkgs/pure_eval/dependencies create mode 100644 build/pkgs/pure_eval/install-requires.txt create mode 100644 build/pkgs/pure_eval/package-version.txt create mode 100644 build/pkgs/pure_eval/spkg-install.in create mode 100644 build/pkgs/pure_eval/type create mode 100644 build/pkgs/stack_data/SPKG.rst create mode 100644 build/pkgs/stack_data/checksums.ini create mode 100644 build/pkgs/stack_data/dependencies create mode 100644 build/pkgs/stack_data/install-requires.txt create mode 100644 build/pkgs/stack_data/package-version.txt create mode 100644 build/pkgs/stack_data/spkg-install.in create mode 100644 build/pkgs/stack_data/type diff --git a/build/pkgs/asttokens/SPKG.rst b/build/pkgs/asttokens/SPKG.rst new file mode 100644 index 00000000000..4472ab6e023 --- /dev/null +++ b/build/pkgs/asttokens/SPKG.rst @@ -0,0 +1,18 @@ +asttokens: Annotate AST trees with source code positions +======================================================== + +Description +----------- + +Annotate AST trees with source code positions + +License +------- + +Apache 2.0 + +Upstream Contact +---------------- + +https://pypi.org/project/asttokens/ + diff --git a/build/pkgs/asttokens/checksums.ini b/build/pkgs/asttokens/checksums.ini new file mode 100644 index 00000000000..2ebd46ce567 --- /dev/null +++ b/build/pkgs/asttokens/checksums.ini @@ -0,0 +1,5 @@ +tarball=asttokens-VERSION.tar.gz +sha1=8a9c1fc8752fedb52189441f9f874f5e1afd5866 +md5=0a2a057b9c9a220bffdb3e7512062f17 +cksum=2612374104 +upstream_url=https://pypi.io/packages/source/a/asttokens/asttokens-VERSION.tar.gz diff --git a/build/pkgs/asttokens/dependencies b/build/pkgs/asttokens/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/asttokens/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/asttokens/install-requires.txt b/build/pkgs/asttokens/install-requires.txt new file mode 100644 index 00000000000..7adf4c51fd2 --- /dev/null +++ b/build/pkgs/asttokens/install-requires.txt @@ -0,0 +1 @@ +asttokens diff --git a/build/pkgs/asttokens/package-version.txt b/build/pkgs/asttokens/package-version.txt new file mode 100644 index 00000000000..e01025862f7 --- /dev/null +++ b/build/pkgs/asttokens/package-version.txt @@ -0,0 +1 @@ +2.0.5 diff --git a/build/pkgs/asttokens/spkg-install.in b/build/pkgs/asttokens/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/asttokens/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/asttokens/type b/build/pkgs/asttokens/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/asttokens/type @@ -0,0 +1 @@ +standard diff --git a/build/pkgs/executing/SPKG.rst b/build/pkgs/executing/SPKG.rst new file mode 100644 index 00000000000..9c0f46efb2f --- /dev/null +++ b/build/pkgs/executing/SPKG.rst @@ -0,0 +1,18 @@ +executing: Get the currently executing AST node of a frame, and other information +================================================================================= + +Description +----------- + +Get the currently executing AST node of a frame, and other information + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/executing/ + diff --git a/build/pkgs/executing/checksums.ini b/build/pkgs/executing/checksums.ini new file mode 100644 index 00000000000..660ea8654b9 --- /dev/null +++ b/build/pkgs/executing/checksums.ini @@ -0,0 +1,5 @@ +tarball=executing-VERSION.tar.gz +sha1=9588832c2abca704a0a287d2c43690c046424697 +md5=43da806fc75eaba315e4947b329d2a90 +cksum=2140182428 +upstream_url=https://pypi.io/packages/source/e/executing/executing-VERSION.tar.gz diff --git a/build/pkgs/executing/dependencies b/build/pkgs/executing/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/executing/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/executing/install-requires.txt b/build/pkgs/executing/install-requires.txt new file mode 100644 index 00000000000..a920f2c56c3 --- /dev/null +++ b/build/pkgs/executing/install-requires.txt @@ -0,0 +1 @@ +executing diff --git a/build/pkgs/executing/package-version.txt b/build/pkgs/executing/package-version.txt new file mode 100644 index 00000000000..ee94dd834b5 --- /dev/null +++ b/build/pkgs/executing/package-version.txt @@ -0,0 +1 @@ +0.8.3 diff --git a/build/pkgs/executing/spkg-install.in b/build/pkgs/executing/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/executing/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/executing/type b/build/pkgs/executing/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/executing/type @@ -0,0 +1 @@ +standard diff --git a/build/pkgs/ipython/dependencies b/build/pkgs/ipython/dependencies index 79f54c821fc..f8be8748ff2 100644 --- a/build/pkgs/ipython/dependencies +++ b/build/pkgs/ipython/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets decorator wcwidth prompt_toolkit pygments pexpect appnope backcall jedi | $(PYTHON_TOOLCHAIN) +$(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets decorator wcwidth prompt_toolkit pygments pexpect appnope backcall jedi stack_data | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/pure_eval/SPKG.rst b/build/pkgs/pure_eval/SPKG.rst new file mode 100644 index 00000000000..5abfdb62d58 --- /dev/null +++ b/build/pkgs/pure_eval/SPKG.rst @@ -0,0 +1,18 @@ +pure_eval: Safely evaluate AST nodes without side effects +========================================================= + +Description +----------- + +Safely evaluate AST nodes without side effects + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/pure-eval/ + diff --git a/build/pkgs/pure_eval/checksums.ini b/build/pkgs/pure_eval/checksums.ini new file mode 100644 index 00000000000..d83180b3c78 --- /dev/null +++ b/build/pkgs/pure_eval/checksums.ini @@ -0,0 +1,5 @@ +tarball=pure_eval-VERSION.tar.gz +sha1=45813e75b359573c2ef49430673812ea3f8f81f2 +md5=212fd27ca2c58d9effddec69748d738a +cksum=757891676 +upstream_url=https://pypi.io/packages/source/p/pure_eval/pure_eval-VERSION.tar.gz diff --git a/build/pkgs/pure_eval/dependencies b/build/pkgs/pure_eval/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/pure_eval/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/pure_eval/install-requires.txt b/build/pkgs/pure_eval/install-requires.txt new file mode 100644 index 00000000000..5ff473a5e6f --- /dev/null +++ b/build/pkgs/pure_eval/install-requires.txt @@ -0,0 +1 @@ +pure-eval diff --git a/build/pkgs/pure_eval/package-version.txt b/build/pkgs/pure_eval/package-version.txt new file mode 100644 index 00000000000..ee1372d33a2 --- /dev/null +++ b/build/pkgs/pure_eval/package-version.txt @@ -0,0 +1 @@ +0.2.2 diff --git a/build/pkgs/pure_eval/spkg-install.in b/build/pkgs/pure_eval/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/pure_eval/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/pure_eval/type b/build/pkgs/pure_eval/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/pure_eval/type @@ -0,0 +1 @@ +standard diff --git a/build/pkgs/stack_data/SPKG.rst b/build/pkgs/stack_data/SPKG.rst new file mode 100644 index 00000000000..762847108d8 --- /dev/null +++ b/build/pkgs/stack_data/SPKG.rst @@ -0,0 +1,18 @@ +stack_data: Extract data from python stack frames and tracebacks for informative displays +========================================================================================= + +Description +----------- + +Extract data from python stack frames and tracebacks for informative displays + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/stack-data/ + diff --git a/build/pkgs/stack_data/checksums.ini b/build/pkgs/stack_data/checksums.ini new file mode 100644 index 00000000000..a94ca505ead --- /dev/null +++ b/build/pkgs/stack_data/checksums.ini @@ -0,0 +1,5 @@ +tarball=stack_data-VERSION.tar.gz +sha1=641fbdc2646ed24005e185a85069fe1fff9b9ce1 +md5=aa4abb89e9a504aa55b57e039c997552 +cksum=1172090398 +upstream_url=https://pypi.io/packages/source/s/stack_data/stack_data-VERSION.tar.gz diff --git a/build/pkgs/stack_data/dependencies b/build/pkgs/stack_data/dependencies new file mode 100644 index 00000000000..cf6aae43990 --- /dev/null +++ b/build/pkgs/stack_data/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) executing asttokens pure_eval | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/stack_data/install-requires.txt b/build/pkgs/stack_data/install-requires.txt new file mode 100644 index 00000000000..fc7c2dc04a4 --- /dev/null +++ b/build/pkgs/stack_data/install-requires.txt @@ -0,0 +1 @@ +stack-data diff --git a/build/pkgs/stack_data/package-version.txt b/build/pkgs/stack_data/package-version.txt new file mode 100644 index 00000000000..0ea3a944b39 --- /dev/null +++ b/build/pkgs/stack_data/package-version.txt @@ -0,0 +1 @@ +0.2.0 diff --git a/build/pkgs/stack_data/spkg-install.in b/build/pkgs/stack_data/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/stack_data/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/stack_data/type b/build/pkgs/stack_data/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/stack_data/type @@ -0,0 +1 @@ +standard From 24ed07e3b34b39533f16916afbef6d8feddce6fd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 20:04:11 -0700 Subject: [PATCH 100/416] build/pkgs/rpy2/dependencies: Add missing dep --- build/pkgs/rpy2/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/rpy2/dependencies b/build/pkgs/rpy2/dependencies index 35bbdcc39c9..d34ae2f104e 100644 --- a/build/pkgs/rpy2/dependencies +++ b/build/pkgs/rpy2/dependencies @@ -1,4 +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 jinja2 | $(PYTHON_TOOLCHAIN) pycparser $(and $(filter-out no,$(SAGE_CHECK_rpy2)), pytest numpy ipython) ---------- All lines of this file are ignored except the first. From 5e650dbdcba3c87ef6ed83ed9ed1e22aa6896541 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 May 2022 20:04:22 -0700 Subject: [PATCH 101/416] build/pkgs/bleach/dependencies: Add missing dep --- build/pkgs/bleach/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/bleach/dependencies b/build/pkgs/bleach/dependencies index 7b139dc904c..5c44033aa62 100644 --- a/build/pkgs/bleach/dependencies +++ b/build/pkgs/bleach/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) packaging six | $(PYTHON_TOOLCHAIN) +$(PYTHON) packaging six webencodings | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 895abe0b7c17b7fc1dc4ba26e8854febd050ac12 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 27 Nov 2021 13:58:03 -0800 Subject: [PATCH 102/416] Remove __init__.py files --- src/sage/__init__.py | 34 --------------------------------- src/sage/arith/__init__.py | 0 src/sage/categories/__init__.py | 0 src/sage/ext/__init__.py | 0 src/sage/libs/__init__.py | 0 src/sage/misc/__init__.py | 0 src/sage/rings/__init__.py | 0 src/sage/sets/__init__.py | 0 8 files changed, 34 deletions(-) delete mode 100644 src/sage/__init__.py delete mode 100644 src/sage/arith/__init__.py delete mode 100644 src/sage/categories/__init__.py delete mode 100644 src/sage/ext/__init__.py delete mode 100644 src/sage/libs/__init__.py delete mode 100644 src/sage/misc/__init__.py delete mode 100644 src/sage/rings/__init__.py delete mode 100644 src/sage/sets/__init__.py diff --git a/src/sage/__init__.py b/src/sage/__init__.py deleted file mode 100644 index 6ea8b846de3..00000000000 --- a/src/sage/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -# Do not add anything to this file. -# It will be removed soon in order to turn 'sage' into a native namespace package. -# See https://trac.sagemath.org/ticket/29705 - - - -# Deprecated leftover of monkey-patching inspect.isfunction() to support Cython functions. -# We cannot use lazy_import for the deprecation here. -def isfunction(obj): - """ - Check whether something is a function. - - This is a variant of ``inspect.isfunction``: - We assume that anything which has a genuine ``__code__`` - attribute (not using ``__getattr__`` overrides) is a function. - This is meant to support Cython functions. - - This function is deprecated. Most uses of ``isfunction`` - can be replaced by ``callable``. - - EXAMPLES:: - - sage: from sage import isfunction - sage: def f(): pass - sage: isfunction(f) - doctest:warning... - DeprecationWarning: sage.isfunction is deprecated; use callable or sage.misc.sageinspect.is_function_or_cython_function instead - See https://trac.sagemath.org/32479 for details. - True - """ - from sage.misc.superseded import deprecation - deprecation(32479, "sage.isfunction is deprecated; use callable or sage.misc.sageinspect.is_function_or_cython_function instead") - from sage.misc.sageinspect import is_function_or_cython_function - return is_function_or_cython_function(obj) diff --git a/src/sage/arith/__init__.py b/src/sage/arith/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/categories/__init__.py b/src/sage/categories/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/ext/__init__.py b/src/sage/ext/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/libs/__init__.py b/src/sage/libs/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/misc/__init__.py b/src/sage/misc/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/__init__.py b/src/sage/rings/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/sets/__init__.py b/src/sage/sets/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 From 1f45f8a5634b042a5cdb7081095c281dc2d522c1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 16 Dec 2021 23:06:34 -0800 Subject: [PATCH 103/416] Remove __init__.py files, add some all.py files --- src/sage/graphs/{__init__.py => graph_decompositions/all.py} | 0 src/sage/interfaces/__init__.py | 0 src/sage/matrix/__init__.py | 0 src/sage/numerical/backends/__init__.py | 0 .../__init__.py => numerical/backends/all.py} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename src/sage/graphs/{__init__.py => graph_decompositions/all.py} (100%) delete mode 100644 src/sage/interfaces/__init__.py delete mode 100644 src/sage/matrix/__init__.py delete mode 100644 src/sage/numerical/backends/__init__.py rename src/sage/{graphs/graph_decompositions/__init__.py => numerical/backends/all.py} (100%) diff --git a/src/sage/graphs/__init__.py b/src/sage/graphs/graph_decompositions/all.py similarity index 100% rename from src/sage/graphs/__init__.py rename to src/sage/graphs/graph_decompositions/all.py diff --git a/src/sage/interfaces/__init__.py b/src/sage/interfaces/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/matrix/__init__.py b/src/sage/matrix/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/numerical/backends/__init__.py b/src/sage/numerical/backends/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/graphs/graph_decompositions/__init__.py b/src/sage/numerical/backends/all.py similarity index 100% rename from src/sage/graphs/graph_decompositions/__init__.py rename to src/sage/numerical/backends/all.py From f9038edc8259788e3693acec278393f821edb9dd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 17 Dec 2021 08:39:41 -0800 Subject: [PATCH 104/416] src/sage/__init__.py: Restore --- src/sage/__init__.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/sage/__init__.py diff --git a/src/sage/__init__.py b/src/sage/__init__.py new file mode 100644 index 00000000000..6ea8b846de3 --- /dev/null +++ b/src/sage/__init__.py @@ -0,0 +1,34 @@ +# Do not add anything to this file. +# It will be removed soon in order to turn 'sage' into a native namespace package. +# See https://trac.sagemath.org/ticket/29705 + + + +# Deprecated leftover of monkey-patching inspect.isfunction() to support Cython functions. +# We cannot use lazy_import for the deprecation here. +def isfunction(obj): + """ + Check whether something is a function. + + This is a variant of ``inspect.isfunction``: + We assume that anything which has a genuine ``__code__`` + attribute (not using ``__getattr__`` overrides) is a function. + This is meant to support Cython functions. + + This function is deprecated. Most uses of ``isfunction`` + can be replaced by ``callable``. + + EXAMPLES:: + + sage: from sage import isfunction + sage: def f(): pass + sage: isfunction(f) + doctest:warning... + DeprecationWarning: sage.isfunction is deprecated; use callable or sage.misc.sageinspect.is_function_or_cython_function instead + See https://trac.sagemath.org/32479 for details. + True + """ + from sage.misc.superseded import deprecation + deprecation(32479, "sage.isfunction is deprecated; use callable or sage.misc.sageinspect.is_function_or_cython_function instead") + from sage.misc.sageinspect import is_function_or_cython_function + return is_function_or_cython_function(obj) From 1326e173dfd625a3c65c763e213413f59e9c85cc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 13 Mar 2022 10:49:44 -0700 Subject: [PATCH 105/416] src/sage/numerical/__init__.py: Remove --- src/sage/numerical/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/sage/numerical/__init__.py diff --git a/src/sage/numerical/__init__.py b/src/sage/numerical/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 From 5aebcf338fb09db6dcc876cfd9048e8af218db61 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 7 Jun 2022 23:02:19 -0700 Subject: [PATCH 106/416] src/sage_docbuild/builders.py: Handle namespace packages --- src/sage_docbuild/builders.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py index b6b723976cd..9cc99254e64 100644 --- a/src/sage_docbuild/builders.py +++ b/src/sage_docbuild/builders.py @@ -1011,6 +1011,10 @@ def get_new_and_updated_modules(self): raise module_filename = sys.modules[module_name].__file__ + if module_filename is None: + # Namespace package + old_modules.append(module_name) + continue if (module_filename.endswith('.pyc') or module_filename.endswith('.pyo')): source_filename = module_filename[:-1] if (os.path.exists(source_filename)): From bba52849ad01f2977e1cc6b7a33342771a8671e0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 8 Jun 2022 04:24:35 -0700 Subject: [PATCH 107/416] src/sage_setup/find.py: Update doctest output --- src/sage_setup/find.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage_setup/find.py b/src/sage_setup/find.py index a6a023941eb..b5cf9095d51 100644 --- a/src/sage_setup/find.py +++ b/src/sage_setup/find.py @@ -399,7 +399,7 @@ def installed_files_by_module(site_packages, modules=('sage',)): Namespace packages:: sage: files_by_module['sage.graphs.graph_decompositions'] - {...'sage/graphs/graph_decompositions/__init__.py'...} + set() This takes about 30ms with warm cache:: From 0b293887a5693eda88ed233df83afb9ffd4579ac Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 29 May 2022 22:17:22 -0700 Subject: [PATCH 108/416] Makefile (pypi-wheels): Add sagemath-environment, sagemath-repl explicitly --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 93a609d0173..3b714565c66 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ pypi-sdists: sage_setup # Ensuring wheels are present, even for packages that may have been installed # as editable. Until we have better uninstallation of script packages, we # just remove the timestamps, which will lead to rebuilds of the packages. -PYPI_WHEEL_PACKAGES = sage_sws2rst sage_setup sagemath_objects sagemath_categories +PYPI_WHEEL_PACKAGES = sage_sws2rst sage_setup sagemath_environment sagemath_objects sagemath_repl sagemath_categories pypi-wheels: for a in $(PYPI_WHEEL_PACKAGES); do \ rm -f venv/var/lib/sage/installed/$$a-*; \ From 12a379c4c5fc9aaed3511a7990a191272cc1507a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 22 Jun 2022 11:37:31 +0200 Subject: [PATCH 109/416] add some spaces around comparison in paths.pyx and rational.pyx --- src/sage/quivers/paths.pyx | 35 ++++++++++++++++------------------- src/sage/rings/rational.pyx | 14 +++++++------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/sage/quivers/paths.pyx b/src/sage/quivers/paths.pyx index c31701d4348..6fb990f8821 100644 --- a/src/sage/quivers/paths.pyx +++ b/src/sage/quivers/paths.pyx @@ -1,7 +1,6 @@ """ Quiver Paths """ - # **************************************************************************** # Copyright (C) 2012 Jim Stark # 2013/14 Simon King @@ -26,6 +25,7 @@ from cpython.slice cimport PySlice_GetIndicesEx from sage.structure.richcmp cimport rich_to_bool from sage.data_structures.bitset_base cimport * + cdef class QuiverPath(MonoidElement): r""" Class for paths in a quiver. @@ -116,7 +116,6 @@ cdef class QuiverPath(MonoidElement): sage: from sage.quivers.paths import QuiverPath sage: Q = DiGraph({1:{2:['a']}, 2:{3:['b']}}).path_semigroup() sage: p = Q(['a']) * Q(['b']) # indirect doctest - """ cdef QuiverPath out = QuiverPath.__new__(self._parent.element_class) out._parent = self._parent @@ -174,7 +173,6 @@ cdef class QuiverPath(MonoidElement): True sage: loads(dumps(p)) is p False - """ return NewQuiverPath, (self._parent, self._start, self._end, biseq_pickle(self._path)) @@ -189,12 +187,11 @@ cdef class QuiverPath(MonoidElement): sage: q = Q([(1, 1)]) sage: {p:1, q:2}[Q(['a','b'])] # indirect doctest 1 - """ - if self._path.length==0: + if self._path.length == 0: return hash(self._start) cdef Py_hash_t h = self._start*(1073807360) + biseq_hash(self._path) - if h==-1: + if h == -1: return -2 return h ## bitset_hash is not a good hash either @@ -418,29 +415,29 @@ cdef class QuiverPath(MonoidElement): PySlice_GetIndicesEx(index, self._path.length, &start, &stop, &step, &slicelength) - if step!=1 and step!=-1: + if step != 1 and step != -1: raise ValueError("slicing only possible for step +/-1") - if step==-1: + if step == -1: return self.reversal()[self._path.length-1-start:self._path.length-1-stop] - if start==0 and stop==self._path.length: + if start == 0 and stop == self._path.length: return self - if start>stop: + if start > stop: stop=start E = self._parent._sorted_edges if start < self._path.length: init = E[biseq_getitem(self._path, start)][0] else: init = self._end - if start=self._path.length: + if index < 0 or index >= self._path.length: raise IndexError("list index out of range") E = self._parent._sorted_edges init = E[biseq_getitem(self._path, index)][0] @@ -537,7 +534,7 @@ cdef class QuiverPath(MonoidElement): # Handle trivial case if self._start != right._start: return None - if right._path.length==0: + if right._path.length == 0: return self # If other is the beginning, return the rest @@ -563,7 +560,7 @@ cdef class QuiverPath(MonoidElement): OUTPUT: - - :class:`QuiverPath`s ``(C1,G,C2)`` such that ``self==C1*G`` and ``P=G*C2``, or + - :class:`QuiverPath`s ``(C1,G,C2)`` such that ``self = C1*G`` and ``P = G*C2``, or - ``(None, None, None)``, if the paths do not overlap (or belong to different quivers). EXAMPLES:: @@ -612,7 +609,7 @@ cdef class QuiverPath(MonoidElement): cpdef tuple complement(self, QuiverPath subpath): """ - Return a pair ``(a,b)`` of paths s.t. ``self==a*subpath*b``, + Return a pair ``(a,b)`` of paths s.t. ``self = a*subpath*b``, or ``(None, None)`` if ``subpath`` is not a subpath of this path. .. NOTE:: @@ -672,7 +669,7 @@ cdef class QuiverPath(MonoidElement): cdef size_t max_i, bitsize if self._path.length < subpath._path.length: return 0 - if biseq_contains(self._path, subpath._path, 0)==-1: + if biseq_contains(self._path, subpath._path, 0) == -1: return 0 return 1 @@ -707,7 +704,7 @@ cdef class QuiverPath(MonoidElement): raise ValueError("the two paths belong to different quivers") if self._start != subpath._start: return 0 - if subpath._path.length==0: + if subpath._path.length == 0: return 1 if biseq_startswith(self._path, subpath._path): return 1 @@ -769,7 +766,7 @@ cdef class QuiverPath(MonoidElement): """ Q = self._parent.reverse() # Handle trivial paths - if self._path.length==0: + if self._path.length == 0: return Q.element_class(Q, self._end, self._start, []) # Reverse all the edges in the path, then reverse the path diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 3404edf4bfb..f215dff7e67 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -1761,7 +1761,7 @@ cdef class Rational(sage.structure.element.FieldElement): ## Deal with finite primes e, m = self.val_unit(p) - if e % 2 == 1: + if e % 2: return False if p == 2: @@ -2123,9 +2123,9 @@ cdef class Rational(sage.structure.element.FieldElement): """ if n == 0: raise ValueError("n cannot be zero") - if n<0: + if n < 0: n = -n - if n%2==0 and self<0: + if not n % 2 and self < 0: return False return self.numerator().nth_root(n, 1)[1]\ and self.denominator().nth_root(n, 1)[1] @@ -2278,7 +2278,7 @@ cdef class Rational(sage.structure.element.FieldElement): """ if n == 0 or n == -1: return self - raise IndexError("index n (=%s) out of range; it must be 0" % n) + raise IndexError(f"index n (={n}) out of range; it must be 0") ################################################################ # Optimized arithmetic @@ -3536,7 +3536,7 @@ cdef class Rational(sage.structure.element.FieldElement): import sage.rings.infinity if self.is_one(): return integer.Integer(1) - elif mpz_cmpabs(mpq_numref(self.value),mpq_denref(self.value))==0: + elif mpz_cmpabs(mpq_numref(self.value),mpq_denref(self.value)) == 0: # if the numerator and the denominator are equal in absolute value, # then the rational number is -1 return integer.Integer(2) @@ -3557,7 +3557,7 @@ cdef class Rational(sage.structure.element.FieldElement): True """ # A rational number is equal to 1 iff its numerator and denominator are equal - return mpz_cmp(mpq_numref(self.value),mpq_denref(self.value))==0 + return mpz_cmp(mpq_numref(self.value),mpq_denref(self.value)) == 0 def is_integral(self): r""" @@ -3649,7 +3649,7 @@ cdef class Rational(sage.structure.element.FieldElement): [1, 2, 4, 5, 8, 10] """ a = self.abs() - if a==1: + if a == 1: return True if S is None: return False From 8aabf996d39f2f561ff60790ab48dc279e8ce32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 23 Jun 2022 17:05:05 +0200 Subject: [PATCH 110/416] bunch of changes about not using double dieses --- src/sage/calculus/desolvers.py | 2 +- src/sage/calculus/wester.py | 7 +- src/sage/combinat/partition.py | 6 +- src/sage/modular/modform/ambient_R.py | 8 +- .../modular/modform/eisenstein_submodule.py | 10 +- src/sage/modular/modform/element.py | 11 +- src/sage/modular/modsym/ambient.py | 158 +++++++++--------- src/sage/rings/integer.pyx | 2 +- .../rings/number_field/number_field_rel.py | 13 +- src/sage/topology/simplicial_complex.py | 2 +- 10 files changed, 109 insertions(+), 110 deletions(-) diff --git a/src/sage/calculus/desolvers.py b/src/sage/calculus/desolvers.py index 02e4d0562d8..1e5d87de635 100644 --- a/src/sage/calculus/desolvers.py +++ b/src/sage/calculus/desolvers.py @@ -683,7 +683,7 @@ def sanitize_var(exprs): ## sage: de = lambda y: diff(y,x,x) - 2*diff(y,x) + y ## sage: desolve_laplace(de(f(x)),[f,x]) ## #x*%e^x*(?%at('diff('f(x),x,1),x=0))-'f(0)*x*%e^x+'f(0)*%e^x -## sage: desolve_laplace(de(f(x)),[f,x],[0,1,2]) ## IC option does not work +## sage: desolve_laplace(de(f(x)),[f,x],[0,1,2]) # IC option does not work ## #x*%e^x*(?%at('diff('f(x),x,1),x=0))-'f(0)*x*%e^x+'f(0)*%e^x ## AUTHOR: David Joyner (1st version 1-2006, 8-2007) diff --git a/src/sage/calculus/wester.py b/src/sage/calculus/wester.py index ef01bc0fc1b..10a64d25471 100644 --- a/src/sage/calculus/wester.py +++ b/src/sage/calculus/wester.py @@ -294,7 +294,9 @@ True sage: abs(float(a)) < 1e-10 True - sage: ## or we can do it using number fields. + +Or we can do it using number fields. :: + sage: reset('x') sage: k. = NumberField(x^3-2) sage: a = (b + b^2)^3 - 6*(b + b^2) - 6 @@ -326,8 +328,7 @@ sage: # (NO) Ln((2*Sqrt(r) + 1)/Sqrt(4*r 4*Sqrt(r) 1))=0. sage: var('r') r - sage: f = log( (2*sqrt(r) + 1) / sqrt(4*r + 4*sqrt(r) + 1)) - sage: f + sage: f = log( (2*sqrt(r) + 1) / sqrt(4*r + 4*sqrt(r) + 1)); f log((2*sqrt(r) + 1)/sqrt(4*r + 4*sqrt(r) + 1)) sage: bool(f == 0) False diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 769d38b13ed..3c2eae38c2c 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -6437,7 +6437,7 @@ def cardinality(self, algorithm='flint'): indeed agree:: sage: q = PowerSeriesRing(QQ, 'q', default_prec=9).gen() - sage: prod([(1-q^k)^(-1) for k in range(1,9)]) ## partial product of + sage: prod([(1-q^k)^(-1) for k in range(1,9)]) # partial product of 1 + q + 2*q^2 + 3*q^3 + 5*q^4 + 7*q^5 + 11*q^6 + 15*q^7 + 22*q^8 + O(q^9) sage: [Partitions(k).cardinality() for k in range(2,10)] [2, 3, 5, 7, 11, 15, 22, 30] @@ -8659,7 +8659,7 @@ def _an_element_(self): ######################################################################### -#### partitions +# partitions def number_of_partitions(n, algorithm='default'): r""" @@ -8726,7 +8726,7 @@ def number_of_partitions(n, algorithm='default'): instead agree:: sage: q = PowerSeriesRing(QQ, 'q', default_prec=9).gen() - sage: prod([(1-q^k)^(-1) for k in range(1,9)]) ## partial product of + sage: prod([(1-q^k)^(-1) for k in range(1,9)]) # partial product of 1 + q + 2*q^2 + 3*q^3 + 5*q^4 + 7*q^5 + 11*q^6 + 15*q^7 + 22*q^8 + O(q^9) sage: [number_of_partitions(k) for k in range(2,10)] [2, 3, 5, 7, 11, 15, 22, 30] diff --git a/src/sage/modular/modform/ambient_R.py b/src/sage/modular/modform/ambient_R.py index a99b080062f..29fe271b62e 100644 --- a/src/sage/modular/modform/ambient_R.py +++ b/src/sage/modular/modform/ambient_R.py @@ -22,7 +22,7 @@ def __init__(self, M, base_ring): EXAMPLES:: - sage: M = ModularForms(23,2,base_ring=GF(7)) ## indirect doctest + sage: M = ModularForms(23,2,base_ring=GF(7)) # indirect doctest sage: M Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(23) of weight 2 over Finite Field of size 7 sage: M == loads(dumps(M)) @@ -57,11 +57,11 @@ def modular_symbols(self,sign=0): def _repr_(self): """ - String representation for self. + String representation for ``self``. EXAMPLES:: - sage: M = ModularForms(23,2,base_ring=GF(7)) ## indirect doctest + sage: M = ModularForms(23,2,base_ring=GF(7)) # indirect doctest sage: M._repr_() 'Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(23) of weight 2 over Finite Field of size 7' @@ -73,7 +73,7 @@ def _repr_(self): i = s.find('over') if i != -1: s = s[:i] - return s + 'over %s'%self.base_ring() + return s + 'over %s' % self.base_ring() def _compute_q_expansion_basis(self, prec=None): """ diff --git a/src/sage/modular/modform/eisenstein_submodule.py b/src/sage/modular/modform/eisenstein_submodule.py index ab041a78fc4..0d606affd6d 100644 --- a/src/sage/modular/modform/eisenstein_submodule.py +++ b/src/sage/modular/modform/eisenstein_submodule.py @@ -11,11 +11,11 @@ from sage.rings.all import CyclotomicField from sage.arith.all import lcm, euler_phi - from . import eis_series from . import element from . import submodule + class EisensteinSubmodule(submodule.ModularFormsSubmodule): """ The Eisenstein submodule of an ambient space of modular forms. @@ -26,7 +26,7 @@ def __init__(self, ambient_space): EXAMPLES:: - sage: E = ModularForms(23,4).eisenstein_subspace() ## indirect doctest + sage: E = ModularForms(23,4).eisenstein_subspace() # indirect doctest sage: E Eisenstein subspace of dimension 2 of Modular Forms space of dimension 7 for Congruence Subgroup Gamma0(23) of weight 4 over Rational Field sage: E == loads(dumps(E)) @@ -44,15 +44,15 @@ def __init__(self, ambient_space): def _repr_(self): """ - Return the string representation of self. + Return the string representation of ``self``. EXAMPLES:: - sage: E = ModularForms(23,4).eisenstein_subspace() ## indirect doctest + sage: E = ModularForms(23,4).eisenstein_subspace() # indirect doctest sage: E._repr_() 'Eisenstein subspace of dimension 2 of Modular Forms space of dimension 7 for Congruence Subgroup Gamma0(23) of weight 4 over Rational Field' """ - return "Eisenstein subspace of dimension %s of %s"%(self.dimension(), self.ambient_module()) + return "Eisenstein subspace of dimension %s of %s" % (self.dimension(), self.ambient_module()) def eisenstein_submodule(self): """ diff --git a/src/sage/modular/modform/element.py b/src/sage/modular/modform/element.py index c8dc792e139..e2cd422a87d 100644 --- a/src/sage/modular/modform/element.py +++ b/src/sage/modular/modform/element.py @@ -262,7 +262,7 @@ def __eq__(self, other): sage: f = ModularForms(6,4).0 sage: g = ModularForms(23,2).0 - sage: f == g ## indirect doctest + sage: f == g # indirect doctest False sage: f == f True @@ -2440,7 +2440,7 @@ def _compute_q_expansion(self, prec): EXAMPLES:: sage: f = EllipticCurve('37a').modular_form() - sage: f.q_expansion() ## indirect doctest + sage: f.q_expansion() # indirect doctest q - 2*q^2 - 3*q^3 + 2*q^4 - 2*q^5 + O(q^6) sage: f._compute_q_expansion(10) @@ -2462,7 +2462,7 @@ def _add_(self, other): sage: g 1 + (-14/73*zeta8^3 + 57/73*zeta8^2 + 13/73*zeta8 - 6/73)*q^2 + (-90/73*zeta8^3 + 64/73*zeta8^2 - 52/73*zeta8 + 24/73)*q^3 + (-81/73*zeta8^3 + 189/73*zeta8^2 - 3/73*zeta8 + 153/73)*q^4 + (72/73*zeta8^3 + 124/73*zeta8^2 + 100/73*zeta8 + 156/73)*q^5 + O(q^6) - sage: f+g ## indirect doctest + sage: f+g # indirect doctest 1 + q + (-14/73*zeta8^3 - 16/73*zeta8^2 + 13/73*zeta8 + 140/73)*q^2 + (-90/73*zeta8^3 + 64/73*zeta8^2 + 21/73*zeta8 + 243/73)*q^3 + (-81/73*zeta8^3 + 43/73*zeta8^2 - 3/73*zeta8 + 372/73)*q^4 + (72/73*zeta8^3 + 124/73*zeta8^2 + 27/73*zeta8 + 521/73)*q^5 + O(q^6) """ return ModularFormElement(self.parent(), self.element() + other.element()) @@ -2774,7 +2774,7 @@ def _compute_element(self): """ M = self.parent() S = M.cuspidal_subspace() -## return S.find_in_space( self.__E.q_expansion( S.q_expansion_basis()[0].prec() ) ) + [0] * ( M.dimension() - S.dimension() ) +# return S.find_in_space( self.__E.q_expansion( S.q_expansion_basis()[0].prec() ) ) + [0] * ( M.dimension() - S.dimension() ) return vector(S.find_in_space(self.__E.q_expansion(S.sturm_bound())) + [0] * (M.dimension() - S.dimension())) def _compute_q_expansion(self, prec): @@ -2867,7 +2867,7 @@ def __init__(self, parent, vector, t, chi, psi): EXAMPLES:: - sage: E = EisensteinForms(1,12) ## indirect doctest + sage: E = EisensteinForms(1,12) # indirect doctest sage: E.eisenstein_series() [ 691/65520 + q + 2049*q^2 + 177148*q^3 + 4196353*q^4 + 48828126*q^5 + O(q^6) @@ -2895,7 +2895,6 @@ def __init__(self, parent, vector, t, chi, psi): if chi.parent().base_ring() != K or psi.parent().base_ring() != K: raise ArithmeticError("Incompatible base rings") t = int(t) - #if not isinstance(t, int): raise TypeError, "weight must be an int" if parent.weight() == 2 and chi.is_trivial() \ and psi.is_trivial() and t==1: raise ArithmeticError("If chi and psi are trivial and k=2, then t must be >1.") diff --git a/src/sage/modular/modsym/ambient.py b/src/sage/modular/modsym/ambient.py index b28de8d9d5e..5022b0fc07e 100644 --- a/src/sage/modular/modsym/ambient.py +++ b/src/sage/modular/modsym/ambient.py @@ -631,13 +631,13 @@ def _modular_symbol_0_to_alpha(self, alpha, i=0): if self.weight() > two: R = ZZ['X'] X = R.gen(0) - ## need to add first two terms, which aren't necessarily - ## zero in this case. we do the first here, and the - ## second in the k=0 case below, so as to avoid code - ## duplication + # need to add first two terms, which aren't necessarily + # zero in this case. we do the first here, and the + # second in the k=0 case below, so as to avoid code + # duplication a += self.manin_symbol((i,0,1), check=False) for k in range(0,len(c)): - ## matrix entries associated to this partial sum + # matrix entries associated to this partial sum if k == 0: x = c[0][0] y = -1 @@ -652,23 +652,23 @@ def _modular_symbol_0_to_alpha(self, alpha, i=0): y = -y w = -w - ## two options here: write out the polynomial directly, - ## and deal with all the separate cases, or create two - ## polynomials and then exponentiate and multiply them. - ## given how fast ntl/flint/etc are, the second may - ## be faster. - - ## method 1: write out solution. this is currently - ## incorrect, because it ends up doing 0^0 in the sum, - ## so I'll fix it and do timings soon. -## for s in range(0,self.weight()-two+1): -## coeff = sum([ binomial(i,t)*binomial(self.weight()-two-i,s-t)* -## x**t * y**(i-t) * z**(s-t) * -## w**(self.weight()-two-i-s+t) for t in range(0,s) ]) -## m = coeff * self.manin_symbol((s, y, w), check=False) -## a += m - - ## method 2 + # two options here: write out the polynomial directly, + # and deal with all the separate cases, or create two + # polynomials and then exponentiate and multiply them. + # given how fast ntl/flint/etc are, the second may + # be faster. + + # method 1: write out solution. this is currently + # incorrect, because it ends up doing 0^0 in the sum, + # so I'll fix it and do timings soon. +# for s in range(0,self.weight()-two+1): +# coeff = sum([ binomial(i,t)*binomial(self.weight()-two-i,s-t)* +# x**t * y**(i-t) * z**(s-t) * +# w**(self.weight()-two-i-s+t) for t in range(0,s) ]) +# m = coeff * self.manin_symbol((s, y, w), check=False) +# a += m + + # method 2 p1 = x*X+y p2 = z*X+w if i == 0: @@ -1406,8 +1406,8 @@ def cuspidal_submodule(self): S = self.boundary_map().kernel() S._set_is_cuspidal(True) S._is_full_hecke_module = True - ## We know the cuspidal subspace is stable, so - ## if it's one-dimensional, it must be simple + # We know the cuspidal subspace is stable, so + # if it's one-dimensional, it must be simple if S.dimension() == 1: S._is_simple = True if self.base_ring().characteristic() == 0: @@ -1682,54 +1682,54 @@ def factorization(self): (Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 7 and level 38, weight 2, character [zeta3], sign 1, over Cyclotomic Field of order 3 and degree 2) """ -## EXAMPLES:: - -## sage: M = ModularSymbols(Gamma0(22), 2); M -## Modular Symbols space of dimension 7 for Gamma_0(22) of weight 2 with sign 0 over Rational Field -## sage: M.factorization(): -## ... print b.dimension(), b.level(), e -## 1 11 2 -## 1 11 2 -## 1 11 2 -## 1 22 1 - -## An example with sign 1:: - -## sage: M = ModularSymbols(Gamma0(22), 2, sign=1); M -## Modular Symbols space of dimension 5 for Gamma_0(22) of weight 2 with sign 1 over Rational Field -## sage: for b, e in M.factorization(): -## ... print b.dimension(), b.level(), e -## 1 11 2 -## 1 11 2 -## 1 22 1 - -## An example for Gamma1:: - -## sage: M = ModularSymbols(Gamma1(26), 2, sign=1); M -## Modular Symbols space of dimension 33 for Gamma_1(26) of weight 2 with sign 1 over Rational Field -## sage: for b, e in M.factorization(): -## ... print b.dimension(), b.level(), e -## 1 13 2 -## 1 13 2 -## 1 13 2 -## 2 13 2 -## 2 13 2 -## 2 13 2 -## 2 13 2 -## 2 13 2 -## 1 26 1 -## 1 26 1 -## 1 26 1 -## 2 26 1 -## 2 26 1 - -## An example with level divisible by a square:: - -## sage: M = ModularSymbols(Gamma0(2*9),2); M -## ??? -## sage: for b, e in M.factorization(): -## ... print b.dimension(), b.level(), e -## ??? +# EXAMPLES:: + +# sage: M = ModularSymbols(Gamma0(22), 2); M +# Modular Symbols space of dimension 7 for Gamma_0(22) of weight 2 with sign 0 over Rational Field +# sage: M.factorization(): +# ... print b.dimension(), b.level(), e +# 1 11 2 +# 1 11 2 +# 1 11 2 +# 1 22 1 + +# An example with sign 1:: + +# sage: M = ModularSymbols(Gamma0(22), 2, sign=1); M +# Modular Symbols space of dimension 5 for Gamma_0(22) of weight 2 with sign 1 over Rational Field +# sage: for b, e in M.factorization(): +# ... print b.dimension(), b.level(), e +# 1 11 2 +# 1 11 2 +# 1 22 1 + +# An example for Gamma1:: + +# sage: M = ModularSymbols(Gamma1(26), 2, sign=1); M +# Modular Symbols space of dimension 33 for Gamma_1(26) of weight 2 with sign 1 over Rational Field +# sage: for b, e in M.factorization(): +# ... print b.dimension(), b.level(), e +# 1 13 2 +# 1 13 2 +# 1 13 2 +# 2 13 2 +# 2 13 2 +# 2 13 2 +# 2 13 2 +# 2 13 2 +# 1 26 1 +# 1 26 1 +# 1 26 1 +# 2 26 1 +# 2 26 1 + +# An example with level divisible by a square:: + +# sage: M = ModularSymbols(Gamma0(2*9),2); M +# ??? +# sage: for b, e in M.factorization(): +# ... print b.dimension(), b.level(), e +# ??? try: return self._factorization except AttributeError: @@ -1759,10 +1759,10 @@ def factorization(self): # In the special case of weight 2 we have to do a bunch of # annoying extra work below to deal with the Eisenstein series E_2. - ## If the characteristic of the base ring is 2, - ## the star involution is the identity, so we - ## want to avoid adding each cuspidal submodule - ## twice. + # If the characteristic of the base ring is 2, + # the star involution is the identity, so we + # want to avoid adding each cuspidal submodule + # twice. if self.base_ring().characteristic() == 2: skip_minus = True else: @@ -2007,7 +2007,7 @@ def _compute_sign_submodule(self, sign, compute_dual=True): EXAMPLES:: - sage: ModularSymbols(1,12,0,GF(5)).minus_submodule() ## indirect doctest + sage: ModularSymbols(1,12,0,GF(5)).minus_submodule() # indirect doctest Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 3 for Gamma_0(1) of weight 12 with sign 0 over Finite Field of size 5 """ S = self.star_involution().matrix() - self.base_ring()(sign) @@ -2048,8 +2048,8 @@ def star_involution(self): return self.__star_involution except AttributeError: pass - S = self.__heilbronn_operator(self, [[-1,0, 0,1]], 1) - S.name("Star involution on %s"%self) + S = self.__heilbronn_operator(self, [[-1, 0, 0, 1]], 1) + S.name("Star involution on %s" % self) self.__star_involution = S return self.__star_involution diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index a4399439015..4138e095cca 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -6024,7 +6024,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): TESTS:: sage: n = 10^10000000 - sage: m = n.__pari__() ## crash from trac 875 + sage: m = n.__pari__() # crash from trac 875 sage: m % 1234567 1041334 diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index 0a022049f02..e34c12bb4ce 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -2303,27 +2303,26 @@ def order(self, *gens, **kwds): def is_free(self, proof=None): r""" - Determine whether or not `L/K` is free (i.e. if `\mathcal{O}_L` is - a free `\mathcal{O}_K`-module). + Determine whether or not `L/K` is free. + + (i.e. if `\mathcal{O}_L` is a free `\mathcal{O}_K`-module). INPUT: - - ``proof`` -- default: True + - ``proof`` -- default: ``True`` EXAMPLES:: sage: x = polygen(QQ) sage: K. = NumberField(x^2+6) sage: x = polygen(K) - sage: L. = K.extension(x^2 + 3) ## extend by x^2+3 + sage: L. = K.extension(x^2 + 3) # extend by x^2+3 sage: L.is_free() False """ proof = proof_flag(proof) base_bnf = self._pari_base_bnf(proof) - if base_bnf.rnfisfree(self.pari_relative_polynomial()) == 1: - return True - return False + return base_bnf.rnfisfree(self.pari_relative_polynomial()) == 1 def _factor_univariate_polynomial(self, poly, **kwargs): """ diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index e4b61bb9474..3bd8cc4f3e6 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -1520,7 +1520,7 @@ def f_triangle(self): EXAMPLES:: sage: X = SimplicialComplex([[1,2,3], [3,4,5], [1,4], [1,5], [2,4], [2,5]]) - sage: X.f_triangle() ## this complex is not pure + sage: X.f_triangle() # this complex is not pure [[0], [0, 0], [0, 0, 4], From 36b45fae271573989f1c5b64b0fa6967471ebc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 24 Jun 2022 10:12:11 +0200 Subject: [PATCH 111/416] a few more fixes in simplicial_complex.py --- src/sage/topology/simplicial_complex.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index 3bd8cc4f3e6..91a978098e5 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -289,6 +289,7 @@ def lattice_paths(t1, t2, length=None): [path + [(t1[-1], t2[-1])] for path in lattice_paths(t1[:-1], t2[:-1], length=length-1)]) + def rename_vertex(n, keep, left=True): """ Rename a vertex: the vertices from the list ``keep`` get @@ -314,7 +315,7 @@ def rename_vertex(n, keep, left=True): sage: rename_vertex(3, [5, 6, 7], left=False) 'R3' """ - lookup = {i:v for v,i in enumerate(keep)} + lookup = {i: v for v, i in enumerate(keep)} try: return lookup[n] except KeyError: @@ -323,6 +324,7 @@ def rename_vertex(n, keep, left=True): else: return "R" + str(n) + @total_ordering class Simplex(SageObject): """ @@ -813,6 +815,7 @@ def _latex_(self): """ return latex(self.__tuple) + class SimplicialComplex(Parent, GenericCellComplex): r""" Define a simplicial complex. @@ -1051,7 +1054,7 @@ def __init__(self, try: normalize_names(1, v) except ValueError: - raise ValueError("the vertex %s does not have an appropriate name"%v) + raise ValueError("the vertex %s does not have an appropriate name" % v) # build dictionary of generator names try: gen_dict[v] = 'x%s' % int(v) @@ -1850,7 +1853,7 @@ def cone(self, is_mutable=True): True """ return self.join(SimplicialComplex([["0"]], is_mutable=is_mutable), - rename_vertices = True) + rename_vertices=True) def suspension(self, n=1, is_mutable=True): r""" @@ -1925,7 +1928,7 @@ def suspension(self, n=1, is_mutable=True): return SimplicialComplex(new_facets) else: return self.join(SimplicialComplex([["0"], ["1"]], is_mutable=is_mutable), - rename_vertices = True) + rename_vertices=True) return self.suspension(1, is_mutable).suspension(int(n-1), is_mutable) def disjoint_union(self, right, rename_vertices=True, is_mutable=True): @@ -2367,8 +2370,8 @@ def _homology_(self, dim=None, base_ring=ZZ, subcomplex=None, for (H, gen) in H_with_gens: v = gen.vector(i) new_gen = chains.zero() - for (coeff, chain) in zip(v, chains.gens()): - new_gen += coeff * chain + for (coeff, chaine) in zip(v, chains.gens()): + new_gen += coeff * chaine new_H.append((H, new_gen)) answer[i] = new_H @@ -4075,7 +4078,7 @@ def fundamental_group(self, base_point=None, simplify=True): # don't have to worry about it. Convert spanning_tree to a set # to make lookup faster. spanning_tree = set(frozenset((int_to_v[e[0]], int_to_v[e[1]])) - for e in spanning_tree) + for e in spanning_tree) gens_dict = {frozenset(g): i for i, g in enumerate(gens)} FG = FreeGroup(len(gens), 'e') rels = [] @@ -4720,6 +4723,7 @@ def intersection(self, other): F = F + [s for s in self.faces()[k] if s in other.faces()[k]] return SimplicialComplex(F) + # Miscellaneous utility functions. # The following two functions can be used to generate the facets for @@ -4788,4 +4792,4 @@ def facets_for_K3(): G = PermutationGroup([[(1,3,8,4,9,16,15,2,14,12,6,7,13,5,10)], [(1,11,16),(2,10,14),(3,12,13),(4,9,15),(5,7,8)]]) return ([tuple([g(i) for i in (1,2,3,8,12)]) for g in G] - +[tuple([g(i) for i in (1,2,5,8,14)]) for g in G]) + + [tuple([g(i) for i in (1,2,5,8,14)]) for g in G]) From e1890c1ad03f6287fe8df110f9e0b299b55154d3 Mon Sep 17 00:00:00 2001 From: Peter Bruin Date: Fri, 24 Jun 2022 10:54:47 +0200 Subject: [PATCH 112/416] Trac 34059: fix trivial case in conversion of list to number field element --- src/sage/rings/number_field/number_field.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index e00dbe9b7d2..1eb855eed1a 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -1765,6 +1765,12 @@ def _element_constructor_(self, x, check=True): 2*I + 1 sage: QQi(vector((RR(1), RR(2)))) 2*I + 1 + + Check that :trac:`34059` is fixed:: + + sage: K. = NumberField(x) + sage: K([1]).parent() + Number Field in a with defining polynomial x """ if isinstance(x, number_field_element.NumberFieldElement): K = x.parent() @@ -1820,10 +1826,7 @@ def _element_constructor_(self, x, check=True): if len(x) != self.relative_degree(): raise ValueError("Length must be equal to the degree of this number field") base = self.base_ring() - result = base(x[0]) - for i in range(1, self.relative_degree()): - result += base(x[i])*self.gen(0)**i - return result + return sum(base(c) * g for c, g in zip(x, self.gen(0).powers(len(x)))) return self._convert_non_number_field_element(x) def _convert_non_number_field_element(self, x): From 20625fdf79201dc7b176624fa823c8e569793313 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 17:25:26 +0200 Subject: [PATCH 113/416] trac #34063: static_sparse_backend.pyx --- .../graphs/base/static_sparse_backend.pyx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sage/graphs/base/static_sparse_backend.pyx b/src/sage/graphs/base/static_sparse_backend.pyx index 2e85c2290fe..952f7e9c28f 100644 --- a/src/sage/graphs/base/static_sparse_backend.pyx +++ b/src/sage/graphs/base/static_sparse_backend.pyx @@ -303,7 +303,7 @@ cdef class StaticSparseCGraph(CGraph): cdef int out_neighbors_unsafe(self, int u, int *neighbors, int size) except -2: cdef int degree = self.g.neighbors[u+1] - self.g.neighbors[u] cdef int i - for i in range(min(degree,size)): + for i in range(min(degree, size)): neighbors[i] = self.g.neighbors[u][i] return -1 if size < degree else degree @@ -421,6 +421,7 @@ cdef class StaticSparseCGraph(CGraph): else: return self.g_rev.neighbors[u+1] - self.g_rev.neighbors[u] + cdef class StaticSparseBackend(CGraphBackend): def __init__(self, G, loops=False, multiedges=False): @@ -517,7 +518,6 @@ cdef class StaticSparseBackend(CGraphBackend): self._directed = cg._directed - self._order = G.order() # Does it allow loops/multiedges ? @@ -766,11 +766,11 @@ cdef class StaticSparseBackend(CGraphBackend): # not necessarily toward the right label. As there may be many uv edges # with different labels, we first make edge point toward the leftmost uv # edge, then scan them all to find the right label. - while edge > cg.g.neighbors[u] and (edge - 1)[0] == v : + while edge > cg.g.neighbors[u] and (edge - 1)[0] == v: edge -= 1 while edge[0] == v and edge < cg.g.neighbors[u+1]: - if edge_label(cg.g,edge) == l: + if edge_label(cg.g, edge) == l: return True edge += 1 @@ -1077,7 +1077,7 @@ cdef class StaticSparseBackend(CGraphBackend): - ``1`` -- test whether subgraph of ``self`` induced by the vertices is a subgraph of ``other`` - ``2`` -- as ``1`` but ignore the labels """ - cdef object v, l + cdef object v, label cdef int u_int, prev_u_int, v_int, l_int, l_int_other, tmp cdef StaticSparseCGraph cg = self._cg cdef CGraph cg_other = other.cg() @@ -1149,10 +1149,10 @@ cdef class StaticSparseBackend(CGraphBackend): # Ignore loops, if ``other`` does not allow them. continue - l = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) + label = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) # Will return ``0``, if ``other`` does not support edge labels. - l_int_other = other.new_edge_label(l) + l_int_other = other.new_edge_label(label) cg_other.add_arc_label_unsafe(vertices_translation[v_int], vertices_translation[u_int], l_int_other) @@ -1175,7 +1175,7 @@ cdef class StaticSparseBackend(CGraphBackend): if len(all_arc_labels) > len(all_arc_labels_other): return 0 else: - for l in all_arc_labels: + for label in all_arc_labels: try: all_arc_labels_other.remove(l) except ValueError: @@ -1184,17 +1184,16 @@ cdef class StaticSparseBackend(CGraphBackend): continue prev_u_int = u_int - l = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) + label = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) if modus == 1: - if not other._has_labeled_edge_unsafe(vertices_translation[v_int], vertices_translation[u_int], l): + if not other._has_labeled_edge_unsafe(vertices_translation[v_int], vertices_translation[u_int], label): return 0 else: # Ignore the label. if not cg_other.has_arc_unsafe(vertices_translation[v_int], vertices_translation[u_int]): return 0 - finally: sig_free(vertices_translation) @@ -1422,7 +1421,7 @@ cdef class StaticSparseBackend(CGraphBackend): yield self._vertex_to_labels[u] seen.add(u) - def add_vertex(self,v): + def add_vertex(self, v): r""" Addition of vertices is not available on an immutable graph. @@ -1440,7 +1439,7 @@ cdef class StaticSparseBackend(CGraphBackend): """ ( self._cg).add_vertex(v) - def del_vertex(self,v): + def del_vertex(self, v): r""" Removal of vertices is not available on an immutable graph. @@ -1458,6 +1457,7 @@ cdef class StaticSparseBackend(CGraphBackend): """ ( self._cg).del_vertex(v) + def _run_it_on_static_instead(f): r""" A decorator function to force the (Di)Graph functions to compute from a From 25fdcdd211d9baaac1e6bd610ecda8fb684a6d95 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 17:44:53 +0200 Subject: [PATCH 114/416] trac #34063: static_dense_graph.pyx --- src/sage/graphs/base/static_dense_graph.pyx | 50 ++++++++++--------- .../graphs/base/static_sparse_backend.pyx | 2 +- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/sage/graphs/base/static_dense_graph.pyx b/src/sage/graphs/base/static_dense_graph.pyx index a26212d0d1c..3b5c3a5f0cc 100644 --- a/src/sage/graphs/base/static_dense_graph.pyx +++ b/src/sage/graphs/base/static_dense_graph.pyx @@ -111,7 +111,7 @@ cdef dict dense_graph_init(binary_matrix_t m, g, translation=None, force_undirec if not d_translation: d_translation = {v: i for i, v in enumerate(g.vertices())} - for u,v in g.edge_iterator(labels=False): + for u, v in g.edge_iterator(labels=False): binary_matrix_set1(m, d_translation[u], d_translation[v]) if is_undirected: binary_matrix_set1(m, d_translation[v], d_translation[u]) @@ -119,6 +119,7 @@ cdef dict dense_graph_init(binary_matrix_t m, g, translation=None, force_undirec if translation is True: return d_translation + def is_strongly_regular(g, parameters=False): r""" Check whether the graph is strongly regular. @@ -214,7 +215,7 @@ def is_strongly_regular(g, parameters=False): cdef int inter cdef int i, j, l, k - if not g.order() or not g.size(): # no vertices or no edges + if not g.order() or not g.size(): # no vertices or no edges return False if g.is_clique(): @@ -265,6 +266,7 @@ def is_strongly_regular(g, parameters=False): else: return True + def is_triangle_free(G, certificate=False): r""" Check whether `G` is triangle free. @@ -325,6 +327,7 @@ def is_triangle_free(G, certificate=False): binary_matrix_free(g) return (True, []) if certificate else True + def triangles_count(G): r""" Return the number of triangles containing `v`, for every `v`. @@ -354,7 +357,7 @@ def triangles_count(G): cdef bitset_t b_tmp bitset_init(b_tmp, n) - cdef int i,j + cdef int i, j cdef uint64_t tmp_count = 0 for i in range(n): @@ -374,6 +377,7 @@ def triangles_count(G): return ans + def connected_subgraph_iterator(G, k=None, bint vertices_only=False): r""" Iterator over the induced connected subgraphs of order at most `k`. @@ -497,12 +501,12 @@ def connected_subgraph_iterator(G, k=None, bint vertices_only=False): cdef bitset_t current # current subset of vertices cdef bitset_t left # remaining vertices to consider - cdef bitset_t boundary # neighbors of the current subset + cdef bitset_t boundary # neighbors of the current subset # candidate vertices for extending the current subset, i.e., vertices that # are both in left and in boundary cdef bitset_t candidates = stack.rows[3 * n + 3] - cdef Py_ssize_t l = 0 + cdef Py_ssize_t level cdef Py_ssize_t u, v, a # We first generate subsets containing vertex 0, then the subsets containing @@ -520,54 +524,54 @@ def connected_subgraph_iterator(G, k=None, bint vertices_only=False): # in left, and N(u) in boundary bitset_clear(stack.rows[0]) bitset_add(stack.rows[0], u) - bitset_set_first_n(stack.rows[1], u+1) + bitset_set_first_n(stack.rows[1], u + 1) bitset_complement(stack.rows[1], stack.rows[1]) bitset_copy(stack.rows[2], DG.rows[u]) - l = 0 + level = 0 - while l >= 0: + while level >= 0: sig_check() # We take the values at the top of the stack - current = stack.rows[l] - left = stack.rows[l + 1] - boundary = stack.rows[l + 2] + current = stack.rows[level] + left = stack.rows[level + 1] + boundary = stack.rows[level + 2] bitset_and(candidates, left, boundary) # Search for a candidate vertex v - v = bitset_next(candidates, u+1) + v = bitset_next(candidates, u + 1) if v >= 0 and bitset_len(current) < mk: # We select vertex v bitset_discard(left, v) - # Since we have not modified l, the bitsets for iterating without - # v are already at the top of the stack, with correct values + # Since we have not modified 'level', the bitsets for iterating + # without v are already at the top of the stack, with correct + # values # We also build the subset with v and so we add values at the # top of the stack - l += 3 - bitset_copy(stack.rows[l], current) - bitset_add(stack.rows[l], v) - bitset_copy(stack.rows[l + 1], left) - bitset_union(stack.rows[l + 2], boundary, DG.rows[v]) + level += 3 + bitset_copy(stack.rows[level], current) + bitset_add(stack.rows[level], v) + bitset_copy(stack.rows[level + 1], left) + bitset_union(stack.rows[level + 2], boundary, DG.rows[v]) # We yield that new subset if vertices_only: yield [int_to_vertex[a] for a in range(u, n) - if bitset_in(stack.rows[l], a)] + if bitset_in(stack.rows[level], a)] else: yield G.subgraph([int_to_vertex[a] for a in range(u, n) - if bitset_in(stack.rows[l], a)]) + if bitset_in(stack.rows[level], a)]) else: # We cannot extend the current subset, either due to a lack of # candidate (v == -1), or because the current subset has maximum # size. We pop - l -= 3 + level -= 3 sig_on() binary_matrix_free(stack) binary_matrix_free(DG) sig_off() - diff --git a/src/sage/graphs/base/static_sparse_backend.pyx b/src/sage/graphs/base/static_sparse_backend.pyx index 952f7e9c28f..1392dae2fba 100644 --- a/src/sage/graphs/base/static_sparse_backend.pyx +++ b/src/sage/graphs/base/static_sparse_backend.pyx @@ -1177,7 +1177,7 @@ cdef class StaticSparseBackend(CGraphBackend): else: for label in all_arc_labels: try: - all_arc_labels_other.remove(l) + all_arc_labels_other.remove(label) except ValueError: return 0 From 5bf6932a7b44ca0f0fc4a11e2f8c1e0abe55a08d Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 17:55:53 +0200 Subject: [PATCH 115/416] trac #34063: sparse_graph.pyx --- src/sage/graphs/base/sparse_graph.pyx | 58 +++++++++++++++------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/sage/graphs/base/sparse_graph.pyx b/src/sage/graphs/base/sparse_graph.pyx index b606a9aa0d1..e923fff3673 100644 --- a/src/sage/graphs/base/sparse_graph.pyx +++ b/src/sage/graphs/base/sparse_graph.pyx @@ -179,15 +179,15 @@ working on a general-purpose Cython-based red black tree, which would be optimal for both of these uses. """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008-9 Robert L. Miller # # 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 libc.string cimport memset @@ -196,6 +196,7 @@ from cysignals.memory cimport check_malloc, check_allocarray, sig_free from sage.data_structures.bitset_base cimport * from sage.data_structures.bitset cimport * + cdef enum: BT_REORDERING_CONSTANT = 145533211 # Since the binary tree will often see vertices coming in already sorted, @@ -205,16 +206,18 @@ cdef enum: # things, but it may just be on binary trees that are never bigger than two # or three nodes. + cdef inline int compare(int a, int b): # Here we rely on the fact that C performs arithmetic on unsigned # ints modulo 2^wordsize. - cdef unsigned int aa = a, bb = b # signed ints lead to badness like a>b>c>a... + cdef unsigned int aa = a, bb = b # signed ints lead to badness like a>b>c>a... if aa*BT_REORDERING_CONSTANT > bb*BT_REORDERING_CONSTANT: return 1 elif aa*BT_REORDERING_CONSTANT < bb*BT_REORDERING_CONSTANT: return -1 return 0 + cdef class SparseGraph(CGraph): """ Compiled sparse graphs. @@ -248,7 +251,8 @@ cdef class SparseGraph(CGraph): """ - def __cinit__(self, int nverts, int expected_degree = 16, int extra_vertices = 10, verts=None, arcs=None, directed=True): + def __cinit__(self, int nverts, int expected_degree=16, int extra_vertices=10, + verts=None, arcs=None, directed=True): """ Allocation and initialization happen in one place. @@ -304,7 +308,7 @@ cdef class SparseGraph(CGraph): if arcs is not None: for u,v,l in arcs: - self.add_arc_label(u,v,l) + self.add_arc_label(u, v, l) def __dealloc__(self): """ @@ -446,11 +450,11 @@ cdef class SparseGraph(CGraph): # self.in_degrees memset(self.in_degrees + self.active_vertices.size, 0, - new_vertices * sizeof(int)) + new_vertices * sizeof(int)) # self.out_degrees memset(self.out_degrees + self.active_vertices.size, 0, - new_vertices * sizeof(int)) + new_vertices * sizeof(int)) # self.active_vertices bitset_realloc(self.active_vertices, s_total) @@ -499,7 +503,7 @@ cdef class SparseGraph(CGraph): parent = &(parent[0].left) elif compared < 0: parent = &(parent[0].right) - else:# if parent[0].vertex == v: + else: # if parent[0].vertex == v: break # If not found, there is no arc to delete ! @@ -689,7 +693,7 @@ cdef class SparseGraph(CGraph): # We fall back to it, if we do not find anything smaller. last_larger = temp temp = temp.left - else: # note compare < 0 + else: # note compare < 0 temp = temp.right if last_larger: return last_larger @@ -876,7 +880,6 @@ cdef class SparseGraph(CGraph): self.out_degrees[v] += 1 self.num_arcs += 1 - self.in_degrees[v] += 1 self.out_degrees[u] += 1 self.num_arcs += 1 @@ -907,13 +910,12 @@ cdef class SparseGraph(CGraph): sage: G.add_arc_label(1,2,2) sage: G.arc_label(1,2) 2 - """ self.check_vertex(u) self.check_vertex(v) if l < 0: raise ValueError("Label ({0}) must be a nonnegative integer.".format(l)) - self.add_arc_label_unsafe(u,v,l) + self.add_arc_label_unsafe(u, v, l) cdef int arc_label_unsafe(self, int u, int v) except -1: """ @@ -973,7 +975,7 @@ cdef class SparseGraph(CGraph): temp = temp.left elif compared < 0: temp = temp.right - else: # temp.vertex == v: + else: # temp.vertex == v: break if not temp: return 0 @@ -1017,7 +1019,7 @@ cdef class SparseGraph(CGraph): temp = temp.left elif compared < 0: temp = temp.right - else: # temp.vertex == v: + else: # temp.vertex == v: break if not temp: return NULL @@ -1047,18 +1049,21 @@ cdef class SparseGraph(CGraph): parent = &(parent[0].left) elif compared < 0: parent = &(parent[0].right) - else: # if parent[0].vertex == v: + else: # if parent[0].vertex == v: break if not parent[0]: - return 1 # indicate an error + return 1 # indicate an error if l == 0: - if parent[0].number > 1: parent[0].number -= 1 + if parent[0].number > 1: + parent[0].number -= 1 elif parent[0].number == 1: if not parent[0].labels: self._del_arc_unsafe(u, v, old_parent) return 0 - else: parent[0].number -= 1 - else: return 1 # indicate an error + else: + parent[0].number -= 1 + else: + return 1 # indicate an error else: labels = &(parent[0].labels) while labels[0] and labels[0].label != l: @@ -1092,7 +1097,7 @@ cdef class SparseGraph(CGraph): - ``1`` -- No arc with label ``l`` """ if self._del_arc_label_unsafe(u, v, l, self.vertices): - return 1 # indicate an error + return 1 # indicate an error if u != v or self.is_directed(): # We remove the reverse copy only if u != v or graph is directed. @@ -1133,7 +1138,7 @@ cdef class SparseGraph(CGraph): temp = temp.left elif compared < 0: temp = temp.right - else:# if temp.vertex == v: + else: # if temp.vertex == v: break if not temp: return 0 @@ -1148,6 +1153,7 @@ cdef class SparseGraph(CGraph): label = label.next return 0 + ############################## # Further tests. Unit tests for methods, functions, classes defined with cdef. ############################## @@ -1200,6 +1206,7 @@ def _test_adjacency_sequence_out(): sig_free(seq) sig_free(V) + ########################################### # Sparse Graph Backend ########################################### @@ -1305,7 +1312,6 @@ cdef class SparseGraphBackend(CGraphBackend): [(0, 1, 1), (2, 3, 2), (4, 5, 3), (5, 6, 2)] sage: D.get_edge_label(3,2) 2 - """ cdef int l_int if not self.has_vertex(u): @@ -1315,10 +1321,10 @@ cdef class SparseGraphBackend(CGraphBackend): cdef int u_int = self.get_vertex(u) cdef int v_int = self.get_vertex(v) if not self._cg.has_arc_unsafe(u_int, v_int): - raise LookupError("({0}, {1}) is not an edge of the graph.".format(repr(u),repr(v))) + raise LookupError("({0}, {1}) is not an edge of the graph.".format(repr(u), repr(v))) if self.multiple_edges(None): return [self.edge_labels[l_int] if l_int != 0 else None - for l_int in self._cg.all_arcs(u_int, v_int)] + for l_int in self._cg.all_arcs(u_int, v_int)] l_int = self._cg.arc_label(u_int, v_int) return self.edge_labels[l_int] if l_int else None @@ -1421,7 +1427,7 @@ cdef class SparseGraphBackend(CGraphBackend): return if self.multiple_edges(None): if len(self.get_edge_label(u, v)) > 1: - raise RuntimeError("Cannot set edge label, since there are multiple edges from %s to %s."%(u,v)) + raise RuntimeError("Cannot set edge label, since there are multiple edges from %s to %s." % (u, v)) # now we know there is exactly one edge from u to v cdef int l_int, ll_int if l is None: From 2e0c5a2a955d7a2f8dbaf1b45c16e56b666ab5c2 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 17:58:19 +0200 Subject: [PATCH 116/416] trac #34063: graph_backends.pyx --- src/sage/graphs/base/graph_backends.pyx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sage/graphs/base/graph_backends.pyx b/src/sage/graphs/base/graph_backends.pyx index 79705778590..9daf0702185 100644 --- a/src/sage/graphs/base/graph_backends.pyx +++ b/src/sage/graphs/base/graph_backends.pyx @@ -740,23 +740,24 @@ cdef class GenericGraphBackend(SageObject): else: raise Exception multiedges = ( self)._multiple_edges - directed = ( self)._directed - loops = ( self)._loops + directed = ( self)._directed + loops = ( self)._loops else: raise Exception # Vertices and edges vertices = list(self.iterator_verts(None)) if directed: - edges = list(self.iterator_out_edges(vertices, True)) + edges = list(self.iterator_out_edges(vertices, True)) else: - edges = list(self.iterator_edges(vertices, True)) + edges = list(self.iterator_edges(vertices, True)) return (unpickle_graph_backend, (directed, vertices, edges, {'loops': loops, 'multiedges': multiedges})) + def unpickle_graph_backend(directed, vertices, edges, kwds): r""" Return a backend from its pickled data From 654d9f73a3dddd72cc9d275efd3940c1962145c0 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 18:05:10 +0200 Subject: [PATCH 117/416] trac #34063: dense_graph.pyx --- src/sage/graphs/base/dense_graph.pyx | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/sage/graphs/base/dense_graph.pyx b/src/sage/graphs/base/dense_graph.pyx index 008b26685fb..14d9172f3c7 100644 --- a/src/sage/graphs/base/dense_graph.pyx +++ b/src/sage/graphs/base/dense_graph.pyx @@ -99,15 +99,15 @@ It also contains the following variables:: cdef binary_matrix_t edges """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008-9 Robert L. Miller # # 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.data_structures.bitset_base cimport * @@ -115,9 +115,11 @@ from cysignals.memory cimport sig_calloc, sig_realloc, sig_free from sage.data_structures.binary_matrix cimport * from libc.string cimport memcpy + cdef extern from "Python.h": int unlikely(int) nogil # Defined by Cython + cdef class DenseGraph(CGraph): """ Compiled dense graphs. @@ -160,12 +162,12 @@ cdef class DenseGraph(CGraph): raise RuntimeError('dense graphs must allocate space for vertices') self.num_verts = nverts - self.num_arcs = 0 + self.num_arcs = 0 cdef int total_verts = nverts + extra_vertices self._directed = directed binary_matrix_init(self.edges, total_verts, total_verts) - self.in_degrees = sig_calloc(total_verts, sizeof(int)) + self.in_degrees = sig_calloc(total_verts, sizeof(int)) self.out_degrees = sig_calloc(total_verts, sizeof(int)) if not self.in_degrees or not self.out_degrees: @@ -257,11 +259,11 @@ cdef class DenseGraph(CGraph): # Resize of self.edges binary_matrix_realloc(self.edges, total_verts, total_verts) - self.in_degrees = sig_realloc(self.in_degrees , total_verts * sizeof(int)) + self.in_degrees = sig_realloc(self.in_degrees, total_verts * sizeof(int)) self.out_degrees = sig_realloc(self.out_degrees, total_verts * sizeof(int)) for i in range(self.active_vertices.size, total_verts): - self.in_degrees[i] = 0 + self.in_degrees[i] = 0 self.out_degrees[i] = 0 bitset_realloc(self.active_vertices, total_verts) @@ -405,9 +407,9 @@ cdef class DenseGraph(CGraph): while i != -1: self.add_arc_unsafe(i, i) bitset_xor(self.edges.rows[i], self.edges.rows[i], self.active_vertices) - self.in_degrees[i] = self.num_verts-self.in_degrees[i] + self.in_degrees[i] = self.num_verts-self.in_degrees[i] self.out_degrees[i] = self.num_verts-self.out_degrees[i] - i = bitset_next(self.active_vertices, i+1) + i = bitset_next(self.active_vertices, i + 1) self.num_arcs = self.num_verts*(self.num_verts - 1) - num_arcs_old @@ -426,7 +428,7 @@ cdef class DenseGraph(CGraph): Set ``l`` to be the label of the first arc. """ l[0] = 0 - return bitset_next(self.edges.rows[u], v+1) + return bitset_next(self.edges.rows[u], v + 1) cdef inline int next_in_neighbor_unsafe(self, int v, int u, int* l) except -2: """ @@ -440,13 +442,14 @@ cdef class DenseGraph(CGraph): """ l[0] = 0 cdef size_t i - i = bitset_next(self.active_vertices, u+1) + i = bitset_next(self.active_vertices, u + 1) while i != -1: if binary_matrix_get(self.edges, i, v): return i - i = bitset_next(self.active_vertices, i+1) + i = bitset_next(self.active_vertices, i + 1) return -1 + cdef int copy_dense_graph(DenseGraph dest, DenseGraph src) except -1: r""" Unsafely copy ``dest`` over ``src``. @@ -464,7 +467,8 @@ cdef int copy_dense_graph(DenseGraph dest, DenseGraph src) except -1: binary_matrix_copy(dest.edges, src.edges) bitset_copy(dest.active_vertices, src.active_vertices) dest.num_verts = src.num_verts - dest.num_arcs = src.num_arcs + dest.num_arcs = src.num_arcs + ############################## # Further tests. Unit tests for methods, functions, classes defined with cdef. @@ -518,6 +522,7 @@ def _test_adjacency_sequence_out(): sig_free(seq) sig_free(V) + ########################################### # Dense Graph Backend ########################################### From aafe606a8902cf21dd16233a5e04d49e9964d857 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 18:18:07 +0200 Subject: [PATCH 118/416] trac #34063: c_graph.pyx --- src/sage/graphs/base/c_graph.pyx | 51 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index 2bf83ab294e..4c4e8cac665 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -53,9 +53,11 @@ from sage.rings.integer_ring import ZZ from cysignals.memory cimport check_allocarray, sig_free from sage.data_structures.bitset cimport FrozenBitset + cdef extern from "Python.h": int unlikely(int) nogil # Defined by Cython + cdef class CGraph: """ Compiled sparse and dense graphs. @@ -327,7 +329,7 @@ cdef class CGraph: "requested vertex is past twice the allocated range: " "use realloc") if (k >= self.active_vertices.size or - (k == -1 and self.active_vertices.size == self.num_verts)): + (k == -1 and self.active_vertices.size == self.num_verts)): self.realloc(2 * self.active_vertices.size) return self.add_vertex_unsafe(k) @@ -521,7 +523,6 @@ cdef class CGraph: if self.has_vertex(v): self.del_vertex_unsafe(v) - cpdef int current_allocation(self): r""" Report the number of vertices allocated. @@ -1003,7 +1004,7 @@ cdef class CGraph: self.check_vertex(v) if l < 0: raise ValueError("Label ({0}) must be a nonnegative integer.".format(l)) - self.del_arc_label_unsafe(u,v,l) + self.del_arc_label_unsafe(u, v, l) cpdef bint has_arc_label(self, int u, int v, int l): """ @@ -1035,7 +1036,7 @@ cdef class CGraph: self.check_vertex(v) if l < 0: raise ValueError("Label ({0}) must be a nonnegative integer.".format(l)) - return self.has_arc_label_unsafe(u,v,l) == 1 + return self.has_arc_label_unsafe(u, v, l) == 1 ################################### # Neighbor Functions @@ -1603,9 +1604,8 @@ cdef class CGraphBackend(GenericGraphBackend): sage: G.add_vertices(A) sage: Set(G.vertices()) == A True - """ - cdef dict vertex_ints = self.vertex_ints + cdef dict vertex_ints = self.vertex_ints cdef dict vertex_labels = self.vertex_labels cdef CGraph G = self.cg() cdef long u_long @@ -1735,9 +1735,9 @@ cdef class CGraphBackend(GenericGraphBackend): retval = None if name is None: name = 0 - while name in self.vertex_ints or ( - name not in self.vertex_labels and - bitset_in(self.cg().active_vertices, name)): + while (name in self.vertex_ints or + (name not in self.vertex_labels and + bitset_in(self.cg().active_vertices, name))): name += 1 retval = name @@ -1921,8 +1921,8 @@ cdef class CGraphBackend(GenericGraphBackend): i = bitset_first(self.cg().active_vertices) while i != -1: if (i not in self.vertex_labels - and i not in self.vertex_ints): - yield i + and i not in self.vertex_ints): + yield i i = bitset_next(self.cg().active_vertices, i + 1) return @@ -2345,16 +2345,16 @@ cdef class CGraphBackend(GenericGraphBackend): (5, 6, None)] """ - cdef object u,v,l,e + cdef object u, v, l, e for e in edges: if len(e) == 3: - u,v,l = e + u, v, l = e else: - u,v = e + u, v = e l = None if unlikely(remove_loops and u == v): continue - self.add_edge(u,v,l,directed) + self.add_edge(u, v, l, directed) cpdef add_edge(self, object u, object v, object l, bint directed): """ @@ -2477,14 +2477,14 @@ cdef class CGraphBackend(GenericGraphBackend): [] """ - cdef object u,v,l,e + cdef object u, v, l, e for e in edges: if len(e) == 3: - u,v,l = e + u, v, l = e else: - u,v = e + u, v = e l = None - self.del_edge(u,v,l,directed) + self.del_edge(u, v, l, directed) cpdef del_edge(self, object u, object v, object l, bint directed): """ @@ -2870,7 +2870,7 @@ cdef class CGraphBackend(GenericGraphBackend): # Yield the arc/arcs. v_copy = v if _reorganize_edge(v, u, modus): - u,v = v,u + u, v = v, u if not self._multiple_edges: if labels: @@ -3199,7 +3199,6 @@ cdef class CGraphBackend(GenericGraphBackend): # in this case there is nothing to do return 1 - cdef int length = len(b_vertices) cdef int i cdef int* vertices_translation = sig_malloc(b_vertices.capacity() * sizeof(int)) @@ -3657,9 +3656,9 @@ cdef class CGraphBackend(GenericGraphBackend): return [] def bidirectional_dijkstra_special(self, x, y, weight_function=None, - exclude_vertices=None, exclude_edges=None, - include_vertices=None, distance_flag=False, - reduced_weight=None): + exclude_vertices=None, exclude_edges=None, + include_vertices=None, distance_flag=False, + reduced_weight=None): r""" Return the shortest path or distance from ``x`` to ``y`` using a bidirectional version of Dijkstra's algorithm. @@ -4206,7 +4205,7 @@ cdef class CGraphBackend(GenericGraphBackend): # If the graph is not connected, vertices which have not been # seen should be associated to the empty path - #for 0 <= v_int < (self._cg).active_vertices.size: + # for 0 <= v_int < (self._cg).active_vertices.size: # if bitset_in((self._cg).active_vertices, v_int) and not bitset_in(seen, v_int): # distances[vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg)] = [] @@ -4688,7 +4687,7 @@ cdef class CGraphBackend(GenericGraphBackend): tmp = u while u != uu: - u = parent.get(u,uu) + u = parent.get(u, uu) cycle.append(self.vertex_label(u)) cycle.reverse() From c8951f97d7f6f7a693aa49494375faeb35b131d3 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 18:36:54 +0200 Subject: [PATCH 119/416] trac #34063: missing changes --- src/sage/graphs/base/c_graph.pyx | 6 ++++-- src/sage/graphs/base/sparse_graph.pyx | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index 4c4e8cac665..b99fc36241e 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -2428,8 +2428,10 @@ cdef class CGraphBackend(GenericGraphBackend): sage: D.shortest_path(1, 2) [] """ - if u is None: u = self.add_vertex(None) - if v is None: v = self.add_vertex(None) + if u is None: + u = self.add_vertex(None) + if v is None: + v = self.add_vertex(None) cdef int u_int = self.check_labelled_vertex(u, False) cdef int v_int = self.check_labelled_vertex(v, False) diff --git a/src/sage/graphs/base/sparse_graph.pyx b/src/sage/graphs/base/sparse_graph.pyx index e923fff3673..d46b374f86e 100644 --- a/src/sage/graphs/base/sparse_graph.pyx +++ b/src/sage/graphs/base/sparse_graph.pyx @@ -307,7 +307,7 @@ cdef class SparseGraph(CGraph): self.add_vertices(verts) if arcs is not None: - for u,v,l in arcs: + for u, v, l in arcs: self.add_arc_label(u, v, l) def __dealloc__(self): From 8f7574169b6743890bc32b58d9d2afcb4a5d6375 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Fri, 24 Jun 2022 18:55:44 +0200 Subject: [PATCH 120/416] trac #34065: clean bliss.pyx --- src/sage/graphs/bliss.pyx | 62 +++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/sage/graphs/bliss.pyx b/src/sage/graphs/bliss.pyx index 140b83b4e3b..65a27d3f12d 100644 --- a/src/sage/graphs/bliss.pyx +++ b/src/sage/graphs/bliss.pyx @@ -29,7 +29,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/ # **************************************************************************** from libc.limits cimport LONG_MAX @@ -47,20 +47,20 @@ cdef extern from "bliss/graph.hh" namespace "bliss": cdef cppclass Graph(AbstractGraph): Graph(const unsigned int) void add_edge(const unsigned int, const unsigned int) - void find_automorphisms(Stats&, void (*)(void* , unsigned int, - const unsigned int*), void*) + void find_automorphisms(Stats&, void (*)(void*, unsigned int, + const unsigned int*), void*) void change_color(const unsigned int, const unsigned int) - const unsigned int* canonical_form(Stats&, void (*)(void*,unsigned int, - const unsigned int*), void*) + const unsigned int* canonical_form(Stats&, void (*)(void*, unsigned int, + const unsigned int*), void*) cdef cppclass Digraph(AbstractGraph): Digraph(const unsigned int) void add_edge(const unsigned int, const unsigned int) - void find_automorphisms(Stats&, void (*)(void* , unsigned int, - const unsigned int*), void*) + void find_automorphisms(Stats&, void (*)(void*, unsigned int, + const unsigned int*), void*) void change_color(const unsigned int, const unsigned int) - const unsigned int* canonical_form(Stats&, void (*)(void*,unsigned int, - const unsigned int*), void*) + const unsigned int* canonical_form(Stats&, void (*)(void*, unsigned int, + const unsigned int*), void*) unsigned int get_hash() @@ -97,9 +97,9 @@ cdef void add_gen(void *user_param, unsigned int n, const unsigned int *aut): - ``aut`` -- ``int *``; an automorphism of the graph """ cdef int N - cdef int tmp = 0 - cdef int cur = 0 - cdef list perm = [] + cdef int tmp = 0 + cdef int cur = 0 + cdef list perm = [] cdef bint* done = check_calloc(n, sizeof(bint)) cdef int i @@ -124,7 +124,8 @@ cdef void add_gen(void *user_param, unsigned int n, const unsigned int *aut): sig_free(done) -cdef void empty_hook(void *user_param , unsigned int n, const unsigned int *aut): + +cdef void empty_hook(void *user_param, unsigned int n, const unsigned int *aut): return ##################################################### @@ -303,7 +304,7 @@ cdef Digraph *bliss_digraph_from_labelled_edges(int Vnr, int Lnr, Vout, Vin, lab ##################################################### cdef canonical_form_from_edge_list(int Vnr, list Vout, list Vin, int Lnr=1, list labels=[], - list partition=None, bint directed=False, bint certificate=False): + list partition=None, bint directed=False, bint certificate=False): r""" Return an unsorted list of labelled edges of a canonical form. @@ -380,6 +381,7 @@ cdef canonical_form_from_edge_list(int Vnr, list Vout, list Vin, int Lnr=1, list else: return new_edges + cpdef canonical_form(G, partition=None, return_graph=False, use_edge_labels=True, certificate=False): r""" Return a canonical label for the given (di)graph. @@ -512,8 +514,8 @@ cpdef canonical_form(G, partition=None, return_graph=False, use_edge_labels=True cdef bint directed = G.is_directed() cdef int labInd - cdef list Vout = [] - cdef list Vin = [] + cdef list Vout = [] + cdef list Vin = [] cdef list labels = [] cdef list int2vert @@ -554,15 +556,15 @@ cpdef canonical_form(G, partition=None, return_graph=False, use_edge_labels=True # NOTE: use edge labels might not be hashable or sortable... # rely loosely on string representation edge_labels = sorted(set(map(str, G.edge_labels()))) - lab_to_index = {lab: i for i,lab in enumerate(edge_labels)} - for x,y,lab in G.edge_iterator(labels=True): + lab_to_index = {lab: i for i, lab in enumerate(edge_labels)} + for x, y, lab in G.edge_iterator(labels=True): Vout.append(vert2int[x]) Vin.append(vert2int[y]) labels.append(lab_to_index[str(lab)]) else: - lab_to_index = {lab:i for i,lab in enumerate(edge_labels)} - for x,y,lab in G.edge_iterator(labels=True): + lab_to_index = {lab: i for i, lab in enumerate(edge_labels)} + for x, y, lab in G.edge_iterator(labels=True): Vout.append(vert2int[x]) Vin.append(vert2int[y]) labels.append(lab_to_index[lab]) @@ -570,7 +572,7 @@ cpdef canonical_form(G, partition=None, return_graph=False, use_edge_labels=True Lnr = len(lab_to_index) else: - for x,y in G.edge_iterator(labels=False): + for x, y in G.edge_iterator(labels=False): Vout.append(vert2int[x]) Vin.append(vert2int[y]) @@ -593,12 +595,13 @@ cpdef canonical_form(G, partition=None, return_graph=False, use_edge_labels=True # Warning: this may break badly in Python 3 if the graph is not simple return (sorted(new_edges), relabel) if certificate else sorted(new_edges) + ##################################################### # automorphism group from graphs ##################################################### cdef automorphism_group_gens_from_edge_list(int Vnr, Vout, Vin, int Lnr=1, labels=[], - int2vert=[], partition=None, bint directed=False): + int2vert=[], partition=None, bint directed=False): r""" Return an unsorted list of labelled edges of a canonical form. @@ -757,7 +760,8 @@ cpdef automorphism_group(G, partition=None, use_edge_labels=True): sage: G.add_edges((i,j,"D") for i in range(9,14) for j in range(14,20)) # optional - bliss sage: A = automorphism_group(G) # optional - bliss sage: print(A.gens()) # random, optional - bliss - [(9,13), (18,19), (17,18), (16,17), (15,16), (14,15), (12,9), (11,12), (10,11), (7,8), (6,7), (5,6), (3,4), (2,3), (0,1)] + [(9,13), (18,19), (17,18), (16,17), (15,16), (14,15), (12,9), (11,12), + (10,11), (7,8), (6,7), (5,6), (3,4), (2,3), (0,1)] sage: A.cardinality() == prod(factorial(n) for n in [2,3,4,5,6]) # optional - bliss True @@ -770,7 +774,9 @@ cpdef automorphism_group(G, partition=None, use_edge_labels=True): sage: G.add_edges((alpha[i],alpha[j],"D") for i in range(9,14) for j in range(14,20)) # optional - bliss sage: A = automorphism_group(G) # optional - bliss sage: print(A.gens()) # random, optional - bliss - [('r','t'), ('s','r'), ('p','s'), ('q','p'), ('o','q'), ('l','n'), ('m','l'), ('j','m'), ('k','j'), ('i','h'), ('f','i'), ('g','f'), ('e','d'), ('c','e'), ('a','b')] + [('r','t'), ('s','r'), ('p','s'), ('q','p'), ('o','q'), ('l','n'), + ('m','l'), ('j','m'), ('k','j'), ('i','h'), ('f','i'), ('g','f'), + ('e','d'), ('c','e'), ('a','b')] sage: A.cardinality() == prod(factorial(n) for n in [2,3,4,5,6]) # optional - bliss True @@ -791,8 +797,8 @@ cpdef automorphism_group(G, partition=None, use_edge_labels=True): cdef bint directed = G.is_directed() cdef int labInd - cdef list Vout = [] - cdef list Vin = [] + cdef list Vout = [] + cdef list Vin = [] cdef list labels = [] cdef list int2vert @@ -814,7 +820,7 @@ cpdef automorphism_group(G, partition=None, use_edge_labels=True): # - Vin[i] : destination of the ith edge # - labels[i] : label of the ith edge if use_edge_labels is True # On the way, assign a unique integer to each distinct label - for x,y,lab in G.edge_iterator(labels=True): + for x, y, lab in G.edge_iterator(labels=True): Vout.append(vert2int[x]) Vin.append(vert2int[y]) if use_edge_labels: @@ -894,7 +900,7 @@ cdef Digraph *bliss_digraph(G, partition, vert2int, int2vert): vert2int[v] = i int2vert[i] = v - for x,y in G.edge_iterator(labels=False): + for x, y in G.edge_iterator(labels=False): g.add_edge(vert2int[x], vert2int[y]) if partition: From ff8f46dc54ce0b8c29a695f4e8d5d33d9680660a Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Fri, 24 Jun 2022 11:45:23 -0700 Subject: [PATCH 121/416] trac 34066: fix issues with Tachyon documentation/help --- src/sage/interfaces/tachyon.py | 1357 ++++++++++++++++---------------- 1 file changed, 675 insertions(+), 682 deletions(-) diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index a5b11f4cfab..23671e50892 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -4,6 +4,673 @@ AUTHOR: - John E. Stone + +This documentation, 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 ``#`` keyword is used anywhere after the camera +description, and will cause RAY to ignore all characters from the +``#`` to the end of the input line. The ``#`` +character must be surrounded by whitespace in order to be recognized. A +sequence such as ``###`` 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. """ #***************************************************************************** @@ -19,6 +686,7 @@ from sage.cpython.string import bytes_to_str from sage.misc.pager import pager +from sage.misc.superseded import deprecation from sage.misc.temporary_file import tmp_filename from sage.structure.sage_object import SageObject @@ -27,12 +695,13 @@ class TachyonRT(SageObject): r""" The Tachyon Ray Tracer - tachyon_rt(model, outfile='sage.png', verbose=1, block=True, extra_opts='') + Usage: + ``tachyon_rt(model, outfile='sage.png', verbose=1, block=True, extra_opts='')`` INPUT: - ``model`` - a string that describes a 3d model in - the Tachyon modeling format. Type tachyon_rt.help() for a + the Tachyon modeling format. Type ``sage.interfaces.tachyon?`` for a description of this format. - ``outfile`` - (default: 'sage.png') output filename; @@ -63,684 +732,14 @@ class TachyonRT(SageObject): - ``extra_opts`` - passed directly to tachyon command line. Use tachyon_rt.usage() to see some of the possibilities. - OUTPUT: - Some text may be displayed onscreen. - 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 ``#`` keyword is used anywhere after the camera - description, and will cause RAY to ignore all characters from the - ``#`` to the end of the input line. The ``#`` - character must be surrounded by whitespace in order to be recognized. A - sequence such as ``###`` 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: - .. automethod:: __call__ """ def _repr_(self): @@ -854,22 +853,16 @@ def usage(self, use_pager=True): def help(self, use_pager=True): """ - Prints (pages) the help file written by John Stone describing scene files for Tachyon. The output is paged unless use_pager=False. + Deprecated: type 'sage.interfaces.tachyon?' for help TESTS:: sage: from sage.interfaces.tachyon import TachyonRT sage: t = TachyonRT() sage: t.help(use_pager=False) - The Tachyon Ray Tracer... This help, which was written by John Stone, describes ... + doctest:...: DeprecationWarning: type 'sage.interfaces.tachyon?' for help + See https://trac.sagemath.org/34066 for details. """ - from sage.misc.sagedoc import format - f = format(self.__doc__) - if use_pager: - pager()(f) - else: - print(f) + deprecation(34066, "type 'sage.interfaces.tachyon?' for help") tachyon_rt = TachyonRT() - - From 989defddf6445ae9204cb9cccbe2d77a611e07e6 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 10:11:24 +0200 Subject: [PATCH 122/416] trac #34068: clean src/sage/graphs/connectivity.pyx --- src/sage/graphs/connectivity.pyx | 204 ++++++++++++++++--------------- 1 file changed, 106 insertions(+), 98 deletions(-) diff --git a/src/sage/graphs/connectivity.pyx b/src/sage/graphs/connectivity.pyx index 2a17674bf4e..be214ac7ec3 100644 --- a/src/sage/graphs/connectivity.pyx +++ b/src/sage/graphs/connectivity.pyx @@ -496,13 +496,13 @@ 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 w not in number: - edge_stack.append((v,w)) + edge_stack.append((v, w)) stack.append(w) # If w is an ancestor of v in the DFS tree, we remember the # direction of edge vw - elif number[w]= number[v]: new_block = set() nw = number[w] - u1,u2 = edge_stack.pop() + u1, u2 = edge_stack.pop() while number[u1] >= nw: new_block.add(u1) - u1,u2 = edge_stack.pop() + u1, u2 = edge_stack.pop() new_block.add(u1) if sort: this_block = sorted(new_block) @@ -543,7 +543,7 @@ def blocks_and_cut_vertices(G, algorithm="Tarjan_Boost", sort=False): # # If v is start, then we add it only if it belongs to # several blocks. - if (not v is start) or start_already_seen: + if (v is not start) or start_already_seen: cut_vertices.add(v) else: start_already_seen = True @@ -637,6 +637,7 @@ def blocks_and_cuts_tree(G): g.add_edge(('B', bloc), ('C', c)) return g + def is_cut_edge(G, u, v=None, label=None): """ Returns True if the input edge is a cut-edge or a bridge. @@ -714,7 +715,7 @@ def is_cut_edge(G, u, v=None, label=None): u, v = u label = None - if not G.has_edge(u,v): + if not G.has_edge(u, v): raise ValueError('edge not in graph') # If edge (u,v) is a pending edge, it is also a cut-edge @@ -722,11 +723,11 @@ def is_cut_edge(G, u, v=None, label=None): return True elif G.allows_multiple_edges(): # If we have two or more edges between u and v, it is not a cut-edge - if len([(uu,vv) for uu,vv,ll in G.edges_incident(u) if uu == v or vv == v]) > 1: + if len([(uu, vv) for uu, vv, ll in G.edges_incident(u) if uu == v or vv == v]) > 1: return False g = G.copy(immutable=False) if G.is_immutable() else G - g.delete_edge(u,v,label) + g.delete_edge(u, v, label) if g.is_directed(): # (u,v) is a cut-edge if u is not in the connected # component containing v of self-(u,v) @@ -734,9 +735,9 @@ def is_cut_edge(G, u, v=None, label=None): else: # (u,v) is a cut-edge if there is no path from u to v in # self-(u,v) - sol = not g.distance(u,v) < g.order() + sol = not g.distance(u, v) < g.order() - g.add_edge(u,v,label) + g.add_edge(u, v, label) return sol @@ -1099,7 +1100,7 @@ def edge_connectivity(G, H.delete_edges(edges) if H.is_directed(): - a = set(H.breadth_first_search([x for x,y in edges])) + a = set(H.breadth_first_search([x for x, y in edges])) b = set(H).difference(a) val.append([a, b]) else: @@ -1111,10 +1112,12 @@ def edge_connectivity(G, if use_edge_labels: from sage.rings.real_mpfr import RR - weight = lambda x: x if x in RR else 1 - else: - weight = lambda x: 1 + def weight(x): + return x if x in RR else 1 + else: + def weight(x): + return 1 # Better methods for small connectivity tests, when one is not interested in # cuts... @@ -1141,28 +1144,28 @@ def edge_connectivity(G, # A vertex has to be in some set for v in g: - p.add_constraint(in_set[0,v] + in_set[1,v], max=1, min=1) + p.add_constraint(in_set[0, v] + in_set[1, v], max=1, min=1) # There is no empty set - p.add_constraint(p.sum(in_set[1,v] for v in g), min=1) - p.add_constraint(p.sum(in_set[0,v] for v in g), min=1) + p.add_constraint(p.sum(in_set[1, v] for v in g), min=1) + p.add_constraint(p.sum(in_set[0, v] for v in g), min=1) if g.is_directed(): # There is no edge from set 0 to set 1 which is not in the cut - for u,v in g.edge_iterator(labels=None): - p.add_constraint(in_set[0,u] + in_set[1,v] - in_cut[u,v], max=1) + for u, v in g.edge_iterator(labels=None): + p.add_constraint(in_set[0, u] + in_set[1, v] - in_cut[u, v], max=1) - p.set_objective(p.sum(weight(l) * in_cut[u,v] for u,v,l in g.edge_iterator())) + p.set_objective(p.sum(weight(l) * in_cut[u, v] for u, v, l in g.edge_iterator())) else: # Two adjacent vertices are in different sets if and only if # the edge between them is in the cut - for u,v in g.edge_iterator(labels=None): - p.add_constraint(in_set[0,u] + in_set[1,v] - in_cut[frozenset((u,v))], max=1) - p.add_constraint(in_set[1,u] + in_set[0,v] - in_cut[frozenset((u,v))], max=1) + for u, v in g.edge_iterator(labels=None): + p.add_constraint(in_set[0, u] + in_set[1, v] - in_cut[frozenset((u, v))], max=1) + p.add_constraint(in_set[1, u] + in_set[0, v] - in_cut[frozenset((u, v))], max=1) - p.set_objective(p.sum(weight(l) * in_cut[frozenset((u,v))] for u,v,l in g.edge_iterator())) + p.set_objective(p.sum(weight(l) * in_cut[frozenset((u, v))] for u, v, l in g.edge_iterator())) obj = p.solve(log=verbose) @@ -1183,9 +1186,9 @@ def edge_connectivity(G, in_set = p.get_values(in_set, convert=bool, tolerance=integrality_tolerance) if g.is_directed(): - edges = [(u,v,l) for u,v,l in g.edge_iterator() if in_cut[u,v]] + edges = [(u, v, l) for u, v, l in g.edge_iterator() if in_cut[u, v]] else: - edges = [(u,v,l) for u,v,l in g.edge_iterator() if in_cut[frozenset((u,v))]] + edges = [(u, v, l) for u, v, l in g.edge_iterator() if in_cut[frozenset((u, v))]] val.append(edges) @@ -1193,14 +1196,15 @@ def edge_connectivity(G, a = [] b = [] for v in g: - if in_set[0,v]: + if in_set[0, v]: a.append(v) else: b.append(v) - val.append([a,b]) + val.append([a, b]) return val + def vertex_connectivity(G, value_only=True, sets=False, k=None, solver=None, verbose=0, *, integrality_tolerance=1e-3): r""" @@ -1397,7 +1401,7 @@ def vertex_connectivity(G, value_only=True, sets=False, k=None, solver=None, ver # When the graph is complete, the MILP below is infeasible. if (g.is_clique(directed_clique=g.is_directed()) - or (not g.is_directed() and g.to_simple().is_clique())): + or (not g.is_directed() and g.to_simple().is_clique())): if k is not None: return g.order() > k if value_only: @@ -1628,7 +1632,7 @@ def strongly_connected_components_digraph(G, keep_labels=False): if keep_labels: g = DiGraph(len(scc), multiedges=True, loops=True) - g.add_edges(set((d[u], d[v], label) for u,v,label in G.edge_iterator())) + g.add_edges(set((d[u], d[v], label) for u, v, label in G.edge_iterator())) else: g = DiGraph(len(scc), multiedges=False, loops=False) @@ -1832,7 +1836,7 @@ def strong_articulation_points(G): if is_strongly_connected(G): # Make a mutable copy of self L = [DiGraph([(u, v) for u, v in G.edge_iterator(labels=0) if u != v], - data_structure='sparse', immutable=False)] + data_structure='sparse', immutable=False)] else: # Get the list of strongly connected components of self as mutable # subgraphs @@ -1865,6 +1869,7 @@ def strong_articulation_points(G): return SAP + def bridges(G, labels=True): r""" Return an iterator over the bridges (or cut edges). @@ -1942,7 +1947,7 @@ def bridges(G, labels=True): if G.order() < 2 or not is_connected(G): return - B,C = G.blocks_and_cut_vertices() + B, C = G.blocks_and_cut_vertices() # A block of size 2 is a bridge, unless the vertices are connected with # multiple edges. @@ -2110,8 +2115,8 @@ def cleave(G, cut_vertices=None, virtual_edges=True, solver=None, verbose=0, # If a vertex cut is given, we check that it is valid. Otherwise, we compute # a small vertex cut if cut_vertices is None: - cut_size,cut_vertices = G.vertex_connectivity(value_only=False, solver=solver, verbose=verbose, - integrality_tolerance=integrality_tolerance) + cut_size, cut_vertices = G.vertex_connectivity(value_only=False, solver=solver, verbose=verbose, + integrality_tolerance=integrality_tolerance) if not cut_vertices: # Typical example is a clique raise ValueError("the input graph has no vertex cut") @@ -2161,6 +2166,7 @@ def cleave(G, cut_vertices=None, virtual_edges=True, solver=None, verbose=0, return cut_sides, cocycles, virtual_cut_graph + def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, *, integrality_tolerance=1e-3): r""" @@ -2358,7 +2364,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, if G.order() == 2 and G.size(): return Graph({('Q' if G.size() == 1 else 'P', Graph(G, immutable=True, multiedges=True)): []}, - name='SPQR-tree of {}'.format(G.name())) + name='SPQR-tree of {}'.format(G.name())) cut_size, cut_vertices = G.vertex_connectivity(value_only=False, solver=solver, verbose=verbose, integrality_tolerance=integrality_tolerance) @@ -2384,7 +2390,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, T = Graph(name='SPQR-tree of {}'.format(G.name())) S_node = ('S', Graph(SG, immutable=True)) T.add_vertex(S_node) - for e,num in counter_multiedges.items(): + for e, num in counter_multiedges.items(): P_node = ('P', Graph([e] * (num + 1), multiedges=True, immutable=True)) T.add_edge(S_node, P_node) return T @@ -2398,7 +2404,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, virtual_edge_to_cycles = dict() while two_blocks: - B,B_cut = two_blocks.pop() + B, B_cut = two_blocks.pop() # B will be always simple graph. S, C, f = cleave(B, cut_vertices=B_cut) # Store the number of edges of the cocycle (P block) @@ -2412,8 +2418,8 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, # Add this cycle to the list of cycles cycles_list.append(K) else: - K_cut_size,K_cut_vertices = K.vertex_connectivity(value_only=False, solver=solver, verbose=verbose, - integrality_tolerance=integrality_tolerance) + K_cut_size, K_cut_vertices = K.vertex_connectivity(value_only=False, solver=solver, verbose=verbose, + integrality_tolerance=integrality_tolerance) if K_cut_size == 2: # The graph has a 2-vertex cut. We add it to the stack two_blocks.append((K, K_cut_vertices)) @@ -2426,7 +2432,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, # that is not shared by any other block, i.e., cocycles_count[e] == 2. We # first associate cycles to virtual edges. Then, we use a DisjointSet to # form the groups of cycles to be merged. - for K_index,K in enumerate(cycles_list): + for K_index, K in enumerate(cycles_list): for e in K.edge_iterator(labels=False): fe = frozenset(e) if fe in virtual_edge_to_cycles: @@ -2444,7 +2450,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, # We finalize the creation of S_blocks. S_blocks = [] - for root,indexes in DS.root_to_elements_dict().items(): + for root, indexes in DS.root_to_elements_dict().items(): E = [] for i in indexes: E.extend(cycles_list[i].edge_iterator(labels=False)) @@ -2455,7 +2461,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, SR_blocks = S_blocks + R_blocks Tree.add_vertices(SR_blocks) P2 = [] - for e,num in cocycles_count.items(): + for e, num in cocycles_count.items(): if num: P_block = ('P', Graph([e] * (num + max(0, counter_multiedges[e] - 1)), multiedges=True, immutable=True)) for block in SR_blocks: @@ -2481,7 +2487,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, # We finally add P blocks to account for multiple edges of the input graph # that are not involved in any separator of the graph - for e,num in counter_multiedges.items(): + for e, num in counter_multiedges.items(): if not cocycles_count[e]: P_block = ('P', Graph([e] * (num + 1), multiedges=True, immutable=True)) for block in SR_blocks: @@ -2494,6 +2500,7 @@ def spqr_tree(G, algorithm="Hopcroft_Tarjan", solver=None, verbose=0, return Tree + def spqr_tree_to_graph(T): r""" Return the graph represented by the SPQR-tree `T`. @@ -2543,14 +2550,14 @@ def spqr_tree_to_graph(T): count_G = Counter() count_P = Counter() - for t,g in T: + for t, g in T: if t in ['P', 'Q']: count_P.update(g.edge_iterator()) else: count_G.update(g.edge_iterator()) G = Graph(multiedges=True) - for e,num in count_G.items(): + for e, num in count_G.items(): if e in count_P: num = abs(count_P[e] - count_G[e]) elif num == 2: @@ -2562,7 +2569,7 @@ def spqr_tree_to_graph(T): # Some edges might only be in P_blocks. Such edges are true edges of the # graph. This happen when virtual edges have distinct labels. - for e,num in count_P.items(): + for e, num in count_P.items(): if e not in count_G: for _ in range(num): G.add_edge(e) @@ -2629,10 +2636,10 @@ cdef _LinkedList_remove(_LinkedList * ll, _LinkedListNode * node): if not node.prev and not node.next: ll.head = NULL ll.tail = NULL - elif not node.prev: # node is head + elif not node.prev: # node is head ll.head = node.next node.next.prev = NULL - elif not node.next: #node is tail + elif not node.next: # node is tail node.prev.next = NULL ll.tail = node.prev else: @@ -2999,10 +3006,10 @@ cdef class TriconnectivitySPQR: # edge label in appropriate arrays # - The status of an edge is: unseen=0, tree=1, frond=2, inactive=-1 self.int_to_vertex = list(G) - self.vertex_to_int = {u: i for i,u in enumerate(self.int_to_vertex)} + self.vertex_to_int = {u: i for i, u in enumerate(self.int_to_vertex)} self.edge_extremity_first = self.mem.allocarray(self.max_number_of_edges, sizeof(int)) self.edge_extremity_second = self.mem.allocarray(self.max_number_of_edges, sizeof(int)) - self.int_to_original_edge_label = [] # to associate original edge label + self.int_to_original_edge_label = [] # to associate original edge label self.edge_status = self.mem.allocarray(self.max_number_of_edges, sizeof(int)) for e_index, (u, v, l) in enumerate(G.edge_iterator()): self.int_to_original_edge_label.append(l) @@ -3080,8 +3087,8 @@ cdef class TriconnectivitySPQR: self.vertex_at[i] = 1 self.dfs_counter = 0 - self.components_list = [] # list of components of `graph_copy` - self.graph_copy_adjacency = [[] for i in range(self.n)] # Stores adjacency list + self.components_list = [] # list of components of `graph_copy` + self.graph_copy_adjacency = [[] for i in range(self.n)] # Stores adjacency list # Dictionary of (e, True/False) to denote if edge e starts a path self.starts_path = self.mem.allocarray(self.max_number_of_edges, sizeof(bint)) @@ -3095,12 +3102,12 @@ cdef class TriconnectivitySPQR: self.t_stack_a[self.t_stack_top] = -1 # The final triconnected components are stored - self.comp_final_edge_list = [] # i^th entry is list of edges in i^th component - self.comp_type = [] # i^th entry is type of i^th component + self.comp_final_edge_list = [] # i^th entry is list of edges in i^th component + self.comp_type = [] # i^th entry is type of i^th component # associate final edge e to its internal index self.final_edge_to_edge_index = {} # The final SPQR tree is stored - self.spqr_tree = None # Graph + self.spqr_tree = None # Graph # Arrays used in different methods. We allocate them only once self.tmp_array_n_int_1 = self.mem.allocarray(self.n, sizeof(int)) @@ -3126,8 +3133,8 @@ cdef class TriconnectivitySPQR: self.degree[i] += 1 self.degree[j] += 1 - self.dfs_counter = 0 # Initialisation for dfs1() - self.start_vertex = 0 # Initialisation for dfs1() + self.dfs_counter = 0 # Initialisation for dfs1() + self.start_vertex = 0 # Initialisation for dfs1() cdef int cut_vertex = self.__dfs1(self.start_vertex, check=check) if check: @@ -3234,7 +3241,7 @@ cdef class TriconnectivitySPQR: # We split each bucket into sub-buckets with same max(e[0], e[1]) thus # identifying groups of multiple edges - for u,b in enumerate(bucket): + for u, b in enumerate(bucket): if not b or len(b) == 1: # Nothing to do continue @@ -3246,7 +3253,7 @@ cdef class TriconnectivitySPQR: else: sub_bucket[v] = [e_index] - for v,sb in sub_bucket.items(): + for v, sb in sub_bucket.items(): if len(sb) == 1: continue @@ -3286,7 +3293,7 @@ cdef class TriconnectivitySPQR: """ cdef Py_ssize_t v, w cdef Py_ssize_t e_index - cdef int cut_vertex = -1 # Storing the cut vertex, if any + cdef int cut_vertex = -1 # Storing the cut vertex, if any cdef int* adjacency = self.tmp_array_n_int_3 cdef list cur_adj cdef Py_ssize_t len_cur_adj @@ -3331,7 +3338,7 @@ cdef class TriconnectivitySPQR: # Opposite vertex of edge e w = self.__edge_other_extremity(e_index, v) if not self.dfs_number[w]: - self.edge_status[e_index] = 1 # tree edge + self.edge_status[e_index] = 1 # tree edge if first_son[v] == -1: first_son[v] = w self.tree_arc[w] = e_index @@ -3341,7 +3348,7 @@ cdef class TriconnectivitySPQR: self.parent[w] = v else: - self.edge_status[e_index] = 2 # frond + self.edge_status[e_index] = 2 # frond if self.dfs_number[w] < self.lowpt1[v]: self.lowpt2[v] = self.lowpt1[v] self.lowpt1[v] = self.dfs_number[w] @@ -3363,7 +3370,8 @@ cdef class TriconnectivitySPQR: # Check for cut vertex. # The situation in which there is no path from w to an # ancestor of v : we have identified a cut vertex - if (self.lowpt1[w] >= self.dfs_number[v]) and (w != first_son[v] or self.parent[v] != -1): + if ((self.lowpt1[w] >= self.dfs_number[v]) + and (w != first_son[v] or self.parent[v] != -1)): cut_vertex = v # Calculate the `lowpt1` and `lowpt2` values. @@ -3382,7 +3390,7 @@ cdef class TriconnectivitySPQR: self.nd[v] += self.nd[w] - return cut_vertex # cut_vertex is -1 if graph does not have a cut vertex + return cut_vertex # cut_vertex is -1 if graph does not have a cut vertex cdef __build_acceptable_adj_struct(self): """ @@ -3411,20 +3419,20 @@ cdef class TriconnectivitySPQR: # Compute phi value # bucket sort adjacency list by phi values if self.reverse_edges[e_index]: - if edge_type == 1: # tree arc + if edge_type == 1: # tree arc if self.lowpt2[u] < self.dfs_number[v]: phi = 3 * self.lowpt1[u] else: phi = 3 * self.lowpt1[u] + 2 - else: # tree frond + else: # tree frond phi = 3 * self.dfs_number[u] + 1 else: - if edge_type == 1: # tree arc + if edge_type == 1: # tree arc if self.lowpt2[v] < self.dfs_number[u]: phi = 3 * self.lowpt1[v] else: phi = 3 * self.lowpt1[v] + 2 - else: # tree frond + else: # tree frond phi = 3 * self.dfs_number[v] + 1 bucket[phi].append(e_index) @@ -3483,7 +3491,7 @@ cdef class TriconnectivitySPQR: if new_path: new_path = False self.starts_path[e_index] = True - if self.edge_status[e_index] == 1: # tree arc + if self.edge_status[e_index] == 1: # tree arc stack_top += 1 stack[stack_top] = w else: @@ -3578,13 +3586,13 @@ cdef class TriconnectivitySPQR: e_index = e_node.data it = e_node if self.reverse_edges[e_index]: - w = self.edge_extremity_first[e_index] # target + w = self.edge_extremity_first[e_index] # target else: w = self.edge_extremity_second[e_index] wnum = self.newnum[w] - if self.edge_status[e_index] == 1: # e is a tree arc - if self.starts_path[e_index]: # if a new path starts at edge e + if self.edge_status[e_index] == 1: # e is a tree arc + if self.starts_path[e_index]: # if a new path starts at edge e # Pop all (h,a,b) from tstack where a > lowpt1[w] if self.t_stack_a[self.t_stack_top] > self.lowpt1[w]: while self.t_stack_a[self.t_stack_top] > self.lowpt1[w]: @@ -3606,7 +3614,7 @@ cdef class TriconnectivitySPQR: y_dict[v] = y continue - else: # e is a frond + else: # e is a frond if self.starts_path[e_index]: # pop all (h,a,b) from tstack where a > w if self.t_stack_a[self.t_stack_top] > wnum: @@ -3618,7 +3626,7 @@ cdef class TriconnectivitySPQR: else: self.__tstack_push(vnum, wnum, vnum) - self.e_stack.append(e_index) # add edge (v,w) to ESTACK + self.e_stack.append(e_index) # add edge (v,w) to ESTACK else: # We are done with v, so we trackback @@ -3637,7 +3645,7 @@ cdef class TriconnectivitySPQR: e_index = e_node.data it = e_node if self.reverse_edges[e_index]: - w = self.edge_extremity_first[e_index] # target + w = self.edge_extremity_first[e_index] # target else: w = self.edge_extremity_second[e_index] wnum = self.newnum[w] @@ -3670,16 +3678,16 @@ cdef class TriconnectivitySPQR: _LinkedList_remove(self.adj[w], self.in_adj[e2_index]) if self.reverse_edges[e2_index]: - x = self.edge_extremity_first[e2_index] # target + x = self.edge_extremity_first[e2_index] # target else: - x = self.edge_extremity_second[e2_index] # target + x = self.edge_extremity_second[e2_index] # target e_virt_index = self.__new_virtual_edge(v, x) self.degree[v] -= 1 self.degree[x] -= 1 if self.reverse_edges[e2_index]: - e2_source = self.edge_extremity_second[e2_index] # target + e2_source = self.edge_extremity_second[e2_index] # target else: e2_source = self.edge_extremity_first[e2_index] if e2_source != w: @@ -3691,18 +3699,18 @@ cdef class TriconnectivitySPQR: e1_index = self.e_stack[-1] if self.reverse_edges[e1_index]: if (self.edge_extremity_first[e1_index] == v - and self.edge_extremity_second[e1_index] == x): + and self.edge_extremity_second[e1_index] == x): e_ab_index = self.__estack_pop() _LinkedList_remove(self.adj[x], self.in_adj[e_ab_index]) self.__del_high(e_ab_index) else: if (self.edge_extremity_first[e1_index] == x - and self.edge_extremity_second[e1_index] == v): + and self.edge_extremity_second[e1_index] == v): e_ab_index = self.__estack_pop() _LinkedList_remove(self.adj[x], self.in_adj[e_ab_index]) self.__del_high(e_ab_index) - else: # found type-2 separation pair - (self.node_at[a], self.node_at[b]) + else: # found type-2 separation pair - (self.node_at[a], self.node_at[b]) h = self.t_stack_h[self.t_stack_top] self.t_stack_top -= 1 @@ -3719,12 +3727,12 @@ cdef class TriconnectivitySPQR: and a <= self.newnum[xy_target] and self.newnum[xy_target] <= h): break if ((self.newnum[x] == a and self.newnum[xy_target] == b) - or (self.newnum[xy_target] == a and self.newnum[x] == b)): + or (self.newnum[xy_target] == a and self.newnum[x] == b)): e_ab_index = self.__estack_pop() if self.reverse_edges[e_ab_index]: - e_ab_source = self.edge_extremity_second[e_ab_index] # source + e_ab_source = self.edge_extremity_second[e_ab_index] # source else: - e_ab_source = self.edge_extremity_first[e_ab_index] # source + e_ab_source = self.edge_extremity_first[e_ab_index] # source _LinkedList_remove(self.adj[e_ab_source], self.in_adj[e_ab_index]) self.__del_high(e_ab_index) @@ -3780,7 +3788,7 @@ cdef class TriconnectivitySPQR: # start type-1 check if (self.lowpt2[w] >= vnum and self.lowpt1[w] < vnum - and (self.parent[v] != self.start_vertex or outv >= 2)): + and (self.parent[v] != self.start_vertex or outv >= 2)): # type-1 separation pair - (self.node_at[self.lowpt1[w]], v) # Create a new component and add edges to it comp = _Component([], 0) @@ -3789,13 +3797,13 @@ cdef class TriconnectivitySPQR: while self.e_stack: xy_index = self.e_stack[-1] if self.reverse_edges[xy_index]: - xx = self.newnum[self.edge_extremity_second[xy_index]] #source - y = self.newnum[self.edge_extremity_first[xy_index]] #target + xx = self.newnum[self.edge_extremity_second[xy_index]] # source + y = self.newnum[self.edge_extremity_first[xy_index]] # target else: - xx = self.newnum[self.edge_extremity_first[xy_index]] #source - y = self.newnum[self.edge_extremity_second[xy_index]] #target + xx = self.newnum[self.edge_extremity_first[xy_index]] # source + y = self.newnum[self.edge_extremity_second[xy_index]] # target - if not ((wnum <= xx and xx < wnum + self.nd[w]) + if not ((wnum <= xx and xx < wnum + self.nd[w]) or (wnum <= y and y < wnum + self.nd[w])): break @@ -3805,13 +3813,13 @@ cdef class TriconnectivitySPQR: self.degree[self.node_at[y]] -= 1 e_virt_index = self.__new_virtual_edge(v, self.node_at[self.lowpt1[w]]) - comp.finish_tric_or_poly(e_virt_index) # Add virtual edge to component + comp.finish_tric_or_poly(e_virt_index) # Add virtual edge to component self.components_list.append(comp) comp = None if ((xx == vnum and y == self.lowpt1[w]) - or (y == vnum and xx == self.lowpt1[w])): - comp_bond = _Component([], 0) # new triple bond + or (y == vnum and xx == self.lowpt1[w])): + comp_bond = _Component([], 0) # new triple bond eh_index = self.__estack_pop() if self.in_adj[eh_index] != it: if self.reverse_edges[eh_index]: @@ -3917,9 +3925,9 @@ cdef class TriconnectivitySPQR: item2[i] = NULL # For each edge, we populate the comp1, comp2, item1 and item2 values - for i in range(num_components): # for each component + for i in range(num_components): # for each component e_node = _LinkedList_get_head((<_Component> self.components_list[i]).edge_list) - while e_node: # for each edge + while e_node: # for each edge e_index = e_node.data if not item1[e_index]: comp1[e_index] = i @@ -3965,7 +3973,7 @@ cdef class TriconnectivitySPQR: # If the two components are not the same type, do not merge if c1_type != c2.component_type: - e_node = e_node_next # Go to next edge + e_node = e_node_next # Go to next edge continue visited[j] = True @@ -3979,7 +3987,7 @@ cdef class TriconnectivitySPQR: # if `e_node_next` was empty, after merging two components, # more edges are added to the component. if not e_node_next: - e_node_next = e_node.next # Go to next edge + e_node_next = e_node.next # Go to next edge _LinkedList_remove(l1, e_node) From f48f5355041daeacbf85ee9a40f686f54857c601 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 10:34:06 +0200 Subject: [PATCH 123/416] trac #34069: cleanup src/sage/graphs/comparability.pyx --- src/sage/graphs/comparability.pyx | 105 +++++++++++++++--------------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/src/sage/graphs/comparability.pyx b/src/sage/graphs/comparability.pyx index d81887a2b12..3957e425cc9 100644 --- a/src/sage/graphs/comparability.pyx +++ b/src/sage/graphs/comparability.pyx @@ -189,25 +189,26 @@ Methods ------- """ -#***************************************************************************** -# Copyright (C) 2012 Nathann Cohen +# **************************************************************************** +# Copyright (C) 2012 Nathann Cohen # # 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 sig_free - +from sage.graphs.distances_all_pairs cimport c_distances_all_pairs from copy import copy + ##################### # Greedy Algorithms # ##################### -def greedy_is_comparability(g, no_certificate = False, equivalence_class = False): +def greedy_is_comparability(g, no_certificate=False, equivalence_class=False): r""" Tests whether the graph is a comparability graph (greedy algorithm) @@ -251,37 +252,37 @@ def greedy_is_comparability(g, no_certificate = False, equivalence_class = False sage: is_comparability(g) True """ - cdef int i,j + cdef int i, j # Each vertex can partition its neighbors into equivalence classes equivalence_classes = {} for v in g: - equivalence_classes[v] = g.subgraph(vertices = g.neighbors(v)).complement().connected_components() + equivalence_classes[v] = g.subgraph(vertices=g.neighbors(v)).complement().connected_components() # We build a graph h with one vertex per (vertex of g + equivalence class) from sage.graphs.graph import Graph h = Graph() - h.add_vertices([(v,i) for v in g for i in range(len(equivalence_classes[v]))]) + h.add_vertices([(v, i) for v in g for i in range(len(equivalence_classes[v]))]) # We add an edge between two vertices of h if they represent # opposed equivalence classes - for u,v in g.edge_iterator(labels=False): + for u, v in g.edge_iterator(labels=False): - for i,s in enumerate(equivalence_classes[v]): + for i, s in enumerate(equivalence_classes[v]): if u in s: break - for j,s in enumerate(equivalence_classes[u]): + for j, s in enumerate(equivalence_classes[u]): if v in s: break - h.add_edge((v,i),(u,j)) + h.add_edge((v, i), (u, j)) # Is it a comparability graph ? cdef int isit - isit, certif = h.is_bipartite(certificate = True) + isit, certif = h.is_bipartite(certificate=True) if isit: if equivalence_class: @@ -290,16 +291,16 @@ def greedy_is_comparability(g, no_certificate = False, equivalence_class = False cc = sorted(h.connected_components(), key=len)[-1] edges = [] - for v,sid in cc: + for v, sid in cc: s = equivalence_classes[v][sid] # For each edge we pick the good orientations - if certif[v,sid] == 1: + if certif[v, sid] == 1: for vv in s: - edges.append((v,vv)) + edges.append((v, vv)) else: for vv in s: - edges.append((vv,v)) + edges.append((vv, v)) # We return the value but take care of removing edges that were # added twice. @@ -310,12 +311,13 @@ def greedy_is_comparability(g, no_certificate = False, equivalence_class = False else: if no_certificate: certif.append(certif[0]) - cycle = [v for v,_ in certif] + cycle = [v for v, _ in certif] return False, cycle else: return False -def greedy_is_comparability_with_certificate(g, certificate = False): + +def greedy_is_comparability_with_certificate(g, certificate=False): r""" Tests whether the graph is a comparability graph and returns certificates(greedy algorithm). @@ -370,9 +372,9 @@ def greedy_is_comparability_with_certificate(g, certificate = False): h = DiGraph() h.add_vertices(gg) - for u,v in certif: - gg.delete_edge(u,v) - h.add_edge(u,v) + for u, v in certif: + gg.delete_edge(u, v) + h.add_edge(u, v) # While there are some edges left to be oriented while gg.size(): @@ -381,12 +383,13 @@ def greedy_is_comparability_with_certificate(g, certificate = False): isit, certif = greedy_is_comparability(gg, no_certificate=True, equivalence_class=True) # Then remove it from the former graph - for u,v in certif: - gg.delete_edge(u,v) - h.add_edge(u,v) + for u, v in certif: + gg.delete_edge(u, v) + h.add_edge(u, v) return True, h + ################### # Integer Program # ################### @@ -436,30 +439,30 @@ def is_comparability_MILP(g, certificate=False, solver=None, verbose=0): p = MixedIntegerLinearProgram(solver=solver) o = p.new_variable(binary=True) - for u,v in g.edge_iterator(labels=False): - p.add_constraint( o[u,v] + o[v,u] == 1) + for u, v in g.edge_iterator(labels=False): + p.add_constraint(o[u, v] + o[v, u] == 1) for u in g: neighbors = g.neighbors(u) for i in range(len(neighbors)): v = neighbors[i] - for j in range(i+1,len(neighbors)): + for j in range(i + 1, len(neighbors)): vv = neighbors[j] # If there is an edge between v and vv, we must be # sure it is in the good direction when v-u-vv is a # directed path - if g.has_edge(v,vv): - p.add_constraint(o[u,v] + o[vv,u] - o[vv,v] <= 1) - p.add_constraint(o[u,vv] + o[v,u] - o[v,vv] <= 1) + if g.has_edge(v, vv): + p.add_constraint(o[u, v] + o[vv, u] - o[vv, v] <= 1) + p.add_constraint(o[u, vv] + o[v, u] - o[v, vv] <= 1) # If there is no edge, there are only two # orientations possible (see the module's documentation # about edges which imply each other) else: - p.add_constraint(o[u,v] + o[vv,u] <= 1) - p.add_constraint(o[u,vv] + o[v,u] <= 1) + p.add_constraint(o[u, v] + o[vv, u] <= 1) + p.add_constraint(o[u, vv] + o[v, u] <= 1) try: p.solve(log=verbose) @@ -473,11 +476,11 @@ def is_comparability_MILP(g, certificate=False, solver=None, verbose=0): tol = 0 if p.base_ring().is_exact() else 1e-6 o = p.get_values(o, convert=True, tolerance=tol) - for u,v in g.edge_iterator(labels=False): - if o[u,v]: - d.add_edge(u,v) + for u, v in g.edge_iterator(labels=False): + if o[u, v]: + d.add_edge(u, v) else: - d.add_edge(v,u) + d.add_edge(v, u) return True, d @@ -486,6 +489,7 @@ def is_comparability_MILP(g, certificate=False, solver=None, verbose=0): return False, None return False + ############### # Empty shell # ############### @@ -566,16 +570,17 @@ def is_comparability(g, algorithm="greedy", certificate=False, check=True, isit, certif = comparability_test if check and isit and (not certif.is_transitive()): - raise ValueError("Looks like there is a bug somewhere. The "+ - "algorithm thinks that the orientation is "+ - "transitive, but we just checked and it is not."+ - "Please report the bug on sage-devel, and give"+ + raise ValueError("Looks like there is a bug somewhere. The " + "algorithm thinks that the orientation is " + "transitive, but we just checked and it is not." + "Please report the bug on sage-devel, and give" "us the graph that made this method fail !") return isit, certif + def is_permutation(g, algorithm="greedy", certificate=False, check=True, - solver=None, verbose=0): + solver=None, verbose=0): r""" Tests whether the graph is a permutation graph. @@ -689,8 +694,8 @@ def is_permutation(g, algorithm="greedy", certificate=False, check=True, # Building the two orderings tmp = list(co_certif.edges(labels=False, sort=False)) - for u,v in certif.edge_iterator(labels=False): - co_certif.add_edge(v,u) + for u, v in certif.edge_iterator(labels=False): + co_certif.add_edge(v, u) certif.add_edges(tmp) ordering = certif.topological_sort() @@ -702,18 +707,17 @@ def is_permutation(g, algorithm="greedy", certificate=False, check=True, from sage.graphs.graph_generators import GraphGenerators pg = GraphGenerators().PermutationGraph(ordering, co_ordering) if not pg.is_isomorphic(g): - raise ValueError("There is a mistake somewhere ! It looks like "+ - "the Permutation Graph model computed does "+ + raise ValueError("There is a mistake somewhere ! It looks like " + "the Permutation Graph model computed does " "not match the input graph !") return True, (ordering, co_ordering) # No certificate... A piece of cake else: - return (is_comparability(g, algorithm=algorithm, solver=solver, verbose=verbose) and \ + return (is_comparability(g, algorithm=algorithm, solver=solver, verbose=verbose) and is_comparability(g.complement(), algorithm=algorithm, solver=solver, verbose=verbose)) -from sage.graphs.distances_all_pairs cimport c_distances_all_pairs def is_transitive(g, certificate=False): r""" @@ -768,8 +772,7 @@ def is_transitive(g, certificate=False): for j in range(n): for i in range(n): - if ((c_distances[i] != -1) and - (c_distances[i] > 1)): + if c_distances[i] != -1 and c_distances[i] > 1: sig_free(distances) if certificate: From a286dd59cc2bdc3d9f91ac9db533f7b7ee6ad57e Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 10:56:56 +0200 Subject: [PATCH 124/416] trac #34070: cleanup src/sage/graphs/centrality.pyx --- src/sage/graphs/centrality.pyx | 52 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/sage/graphs/centrality.pyx b/src/sage/graphs/centrality.pyx index d73787a4b10..852b86c34e8 100755 --- a/src/sage/graphs/centrality.pyx +++ b/src/sage/graphs/centrality.pyx @@ -35,6 +35,7 @@ ctypedef fused numerical_type: cimport cython + def centrality_betweenness(G, bint exact=False, bint normalize=True): r""" Return the centrality betweenness of `G` @@ -120,6 +121,7 @@ def centrality_betweenness(G, bint exact=False, bint normalize=True): else: return centrality_betweenness_C(G, 0, normalize=normalize) + @cython.cdivision(True) cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): r""" @@ -154,11 +156,11 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): cdef int n = G.order() - cdef bitset_t seen # Vertices whose neighbors have been explored - cdef bitset_t next_layer # Unexplored neighbors of vertices in 'seen' + cdef bitset_t seen # Vertices whose neighbors have been explored + cdef bitset_t next_layer # Unexplored neighbors of vertices in 'seen' - cdef uint32_t* queue = NULL # BFS queue - cdef uint32_t* degrees = NULL # degree[v] = nb of vertices which discovered v + cdef uint32_t* queue = NULL # BFS queue + cdef uint32_t* degrees = NULL # degree[v] = nb of vertices which discovered v cdef numerical_type* n_paths_from_source = NULL cdef numerical_type* betweenness_source = NULL @@ -180,11 +182,11 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): init_short_digraph(g, G, edge_labelled=False, vertex_list=int_to_vertex) init_reverse(bfs_dag, g) - queue = check_allocarray(n, sizeof(uint32_t)) - degrees = check_allocarray(n, sizeof(uint32_t)) + queue = check_allocarray(n, sizeof(uint32_t)) + degrees = check_allocarray(n, sizeof(uint32_t)) n_paths_from_source = check_allocarray(n, sizeof(numerical_type)) - betweenness_source = check_allocarray(n, sizeof(numerical_type)) - betweenness = check_allocarray(n, sizeof(numerical_type)) + betweenness_source = check_allocarray(n, sizeof(numerical_type)) + betweenness = check_allocarray(n, sizeof(numerical_type)) bitset_init(seen, n) bitset_init(next_layer, n) @@ -219,8 +221,8 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): queue[0] = source layer_current_beginning = 0 - layer_current_end = 1 - layer_next_end = 1 + layer_current_end = 1 + layer_next_end = 1 # The number of shortest paths from 'source' to every other vertex. # @@ -261,7 +263,7 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): bitset_add(seen, queue[j]) layer_current_beginning = layer_current_end - layer_current_end = layer_next_end + layer_current_end = layer_next_end # Compute the betweenness from the number of paths # @@ -270,7 +272,7 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): u = queue[i] for j in range(degrees[u]): v = bfs_dag.neighbors[u][j] - if v != source: # better to not 'if' but set it to 0 afterwards? + if v != source: # better to not 'if' but set it to 0 afterwards? if numerical_type is double: betweenness_source[v] += (betweenness_source[u] + 1) * (n_paths_from_source[v] / n_paths_from_source[u]) else: @@ -287,7 +289,7 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): else: mpq_add(betweenness[i], betweenness[i], betweenness_source[i]) - sig_check() # check for KeyboardInterrupt + sig_check() # check for KeyboardInterrupt if numerical_type is double: betweenness_list = [betweenness[i] for i in range(n)] @@ -324,6 +326,7 @@ cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): return {vv: betweenness_list[i] for i, vv in enumerate(int_to_vertex)} + cdef void _estimate_reachable_vertices_dir(short_digraph g, int* reachL, int* reachU): r""" For each vertex ``v``, bounds the number of vertices reachable from ``v``. @@ -456,6 +459,7 @@ cdef void _estimate_reachable_vertices_dir(short_digraph g, int* reachL, int* re reachL[i] = reachL_scc[scc[i]] reachU[i] = min(reachU_scc[scc[i]], g.n) + cdef void _compute_reachable_vertices_undir(short_digraph g, int* reachable): r""" For each vertex ``v``, compute the number of vertices reachable from ``v``. @@ -508,6 +512,7 @@ cdef void _compute_reachable_vertices_undir(short_digraph g, int* reachable): for v in currentcc: reachable[v] = len(currentcc) + cdef void _sort_vertices_degree(short_digraph g, int* sorted_verts): r""" Sort vertices in decreasing order of degree. @@ -730,8 +735,8 @@ def centrality_closeness_top_k(G, int k=1, int verbose=0): pred[v] = -1 layer_current_beginning = 0 - layer_current_end = 1 - layer_next_end = 1 + layer_current_end = 1 + layer_next_end = 1 d = 0 f = 0 # We are at level 0, and gamma is the number of arcs exiting level 0 @@ -794,7 +799,7 @@ def centrality_closeness_top_k(G, int k=1, int verbose=0): break # 'next_layer' becomes 'current_layer' layer_current_beginning = layer_current_end - layer_current_end = layer_next_end + layer_current_end = layer_next_end if not stopped: farness[x] = (( f) * (n - 1)) / ((nd - 1) * (nd - 1)) @@ -827,6 +832,7 @@ def centrality_closeness_top_k(G, int k=1, int verbose=0): res = sorted(res, reverse=True, key=lambda vv: vv[0]) return res + def centrality_closeness_random_k(G, int k=1): r""" Return an estimation of the closeness centrality of `G`. @@ -914,20 +920,20 @@ def centrality_closeness_random_k(G, int k=1): partial_farness[i] = 0 # Shuffle the vertices - cdef list l = list(range(n)) - random.shuffle(l) + cdef list V = list(range(n)) + random.shuffle(V) if G.weighted(): # For all random nodes take as a source then run Dijstra and # calculate closeness centrality for k random vertices from l. for i in range(k): farness = 0 - distances = boost_shortest_paths(G, int_to_vertex[l[i]], algorithm='Dijkstra')[0] + distances = boost_shortest_paths(G, int_to_vertex[V[i]], algorithm='Dijkstra')[0] for vertex in distances: farness += float(distances[vertex]) partial_farness[vertex_to_int[vertex]] += float(distances[vertex]) - closeness_centrality_array[int_to_vertex[l[i]]] = (n - 1) / farness + closeness_centrality_array[int_to_vertex[V[i]]] = (n - 1) / farness # G is unweighted graph else: @@ -943,18 +949,18 @@ def centrality_closeness_random_k(G, int k=1): # Run BFS for random k vertices for i in range(k): farness = 0 - simple_BFS(sd, l[i], distance, NULL, waiting_list, seen) + simple_BFS(sd, V[i], distance, NULL, waiting_list, seen) for j in range(n): farness += distance[j] partial_farness[j] += distance[j] - closeness_centrality_array[int_to_vertex[l[i]]] = (n - 1) / farness + closeness_centrality_array[int_to_vertex[V[i]]] = (n - 1) / farness bitset_free(seen) free_short_digraph(sd) # Estimate the closeness centrality for remaining n-k vertices. for i in range(k, n): - closeness_centrality_array[int_to_vertex[l[i]]] = k / partial_farness[l[i]] + closeness_centrality_array[int_to_vertex[V[i]]] = k / partial_farness[V[i]] return closeness_centrality_array From 211d0b1e728486001ed78492ecd7ee8a7ca9c88b Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 11:05:04 +0200 Subject: [PATCH 125/416] trac #34071: cleanup src/sage/graphs/asteroidal_triples.pyx --- src/sage/graphs/asteroidal_triples.pyx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/sage/graphs/asteroidal_triples.pyx b/src/sage/graphs/asteroidal_triples.pyx index d9836672922..d2423c912e3 100644 --- a/src/sage/graphs/asteroidal_triples.pyx +++ b/src/sage/graphs/asteroidal_triples.pyx @@ -50,15 +50,15 @@ Functions --------- """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2015 David Coudert # # 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 libc.stdint cimport uint32_t from cysignals.signals cimport sig_on, sig_off @@ -67,6 +67,7 @@ from memory_allocator cimport MemoryAllocator from sage.data_structures.bitset_base cimport * from sage.graphs.base.static_sparse_graph cimport short_digraph, init_short_digraph, free_short_digraph + def is_asteroidal_triple_free(G, certificate=False): """ Test if the input graph is asteroidal triple-free @@ -137,8 +138,8 @@ def is_asteroidal_triple_free(G, certificate=False): # ==> Initialize some data structures for is_asteroidal_triple_free_C cdef MemoryAllocator mem = MemoryAllocator() - cdef uint32_t* waiting_list = mem.allocarray(n, sizeof(uint32_t)) - cdef uint32_t* _connected_structure = mem.calloc(n * n, sizeof(uint32_t)) + cdef uint32_t* waiting_list = mem.allocarray(n, sizeof(uint32_t)) + cdef uint32_t* _connected_structure = mem.calloc(n * n, sizeof(uint32_t)) cdef uint32_t** connected_structure = mem.allocarray(n, sizeof(uint32_t*)) # Copying the whole graph to obtain the list of neighbors quicker than by @@ -182,7 +183,7 @@ def is_asteroidal_triple_free(G, certificate=False): cdef list is_asteroidal_triple_free_C(uint32_t n, short_digraph sd, uint32_t** connected_structure, - uint32_t* waiting_list, + uint32_t* waiting_list, bitset_t seen): """ INPUT: @@ -206,8 +207,8 @@ cdef list is_asteroidal_triple_free_C(uint32_t n, See the module's documentation. """ cdef uint32_t waiting_beginning = 0 - cdef uint32_t waiting_end = 0 - cdef uint32_t idx_cc = 0 + cdef uint32_t waiting_end = 0 + cdef uint32_t idx_cc = 0 cdef uint32_t source, u, v, w cdef uint32_t* p_tmp cdef uint32_t* end @@ -288,8 +289,8 @@ cdef list is_asteroidal_triple_free_C(uint32_t n, if connected_structure[u][v]: for w in range(v + 1, n): if (connected_structure[u][v] == connected_structure[u][w] and - connected_structure[v][u] == connected_structure[v][w] and - connected_structure[w][u] == connected_structure[w][v]): + connected_structure[v][u] == connected_structure[v][w] and + connected_structure[w][u] == connected_structure[w][v]): # We have found an asteroidal triple return [u, v, w] From 91e69e4ec30515c7dd99b95c132a0252e847999c Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 11:10:59 +0200 Subject: [PATCH 126/416] trac #34071: cleanup src/sage/graphs/chrompoly.pyx --- src/sage/graphs/chrompoly.pyx | 47 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/sage/graphs/chrompoly.pyx b/src/sage/graphs/chrompoly.pyx index 4fb9f382894..d3afec0e278 100644 --- a/src/sage/graphs/chrompoly.pyx +++ b/src/sage/graphs/chrompoly.pyx @@ -13,7 +13,7 @@ REFERENCE: sparse graphs. """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008 Robert Miller # Copyright (C) 2008 Gordon Royle # @@ -21,8 +21,8 @@ REFERENCE: # 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.signals cimport sig_check from memory_allocator cimport MemoryAllocator @@ -34,6 +34,7 @@ from sage.rings.ring cimport Algebra from sage.rings.polynomial.polynomial_integer_dense_flint cimport Polynomial_integer_dense_flint from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing + def chromatic_polynomial(G, return_tree_basis=False, algorithm='C', cache=None): """ Compute the chromatic polynomial of the graph G. @@ -172,22 +173,22 @@ def chromatic_polynomial(G, return_tree_basis=False, algorithm='C', cache=None): nedges = G.num_edges() cdef MemoryAllocator mem = MemoryAllocator() - queue = mem.allocarray(nverts, sizeof(int)) - chords1 = mem.allocarray((nedges - nverts + 1), sizeof(int)) - chords2 = mem.allocarray((nedges - nverts + 1), sizeof(int)) - parent = mem.allocarray(nverts, sizeof(int)) - bfs_reorder = mem.allocarray(nverts, sizeof(int)) - tot = mem.allocarray((nverts+1), sizeof(mpz_t)) - coeffs = mem.allocarray((nverts+1), sizeof(mpz_t)) + queue = mem.allocarray(nverts, sizeof(int)) + chords1 = mem.allocarray((nedges - nverts + 1), sizeof(int)) + chords2 = mem.allocarray((nedges - nverts + 1), sizeof(int)) + parent = mem.allocarray(nverts, sizeof(int)) + bfs_reorder = mem.allocarray(nverts, sizeof(int)) + tot = mem.allocarray((nverts+1), sizeof(mpz_t)) + coeffs = mem.allocarray((nverts+1), sizeof(mpz_t)) num_chords = 0 # Breadth first search from 0: bfs_reorder[0] = 0 - mpz_init(tot[0]) # sets to 0 + mpz_init(tot[0]) # sets to 0 for i from 0 < i < nverts: bfs_reorder[i] = -1 - mpz_init(tot[i]) # sets to 0 - mpz_init(tot[nverts]) # sets to 0 + mpz_init(tot[i]) # sets to 0 + mpz_init(tot[nverts]) # sets to 0 queue[0] = 0 top = 1 bot = 0 @@ -196,7 +197,7 @@ def chromatic_polynomial(G, return_tree_basis=False, algorithm='C', cache=None): v = queue[bot] bot += 1 for u in G.neighbor_iterator(v): - if bfs_reorder[u] == -1: # if u is not yet in tree + if bfs_reorder[u] == -1: # if u is not yet in tree bfs_reorder[u] = next_v next_v += 1 queue[top] = u @@ -230,7 +231,7 @@ def chromatic_polynomial(G, return_tree_basis=False, algorithm='C', cache=None): mpz_clear(tot[i]) raise for i from 0 <= i <= nverts: - mpz_init(coeffs[i]) # also sets them to 0 + mpz_init(coeffs[i]) # also sets them to 0 mpz_init(coeff) mpz_init_set_si(m, -1) # start with the zero polynomial: f(x) = 0 @@ -270,15 +271,15 @@ def chromatic_polynomial(G, return_tree_basis=False, algorithm='C', cache=None): cdef int contract_and_count(int *chords1, int *chords2, int num_chords, int nverts, - mpz_t *tot, int *parent) except -1: + mpz_t *tot, int *parent) except -1: if num_chords == 0: mpz_add_ui(tot[nverts], tot[nverts], 1) return 0 cdef MemoryAllocator mem = MemoryAllocator() cdef int *new_chords1 = mem.allocarray(num_chords, sizeof(int)) cdef int *new_chords2 = mem.allocarray(num_chords, sizeof(int)) - cdef int *ins_list1 = mem.allocarray(num_chords, sizeof(int)) - cdef int *ins_list2 = mem.allocarray(num_chords, sizeof(int)) + cdef int *ins_list1 = mem.allocarray(num_chords, sizeof(int)) + cdef int *ins_list2 = mem.allocarray(num_chords, sizeof(int)) cdef int i, j, k, x1, xj, z, num, insnum, parent_checked for i in range(num_chords): sig_check() @@ -302,7 +303,7 @@ cdef int contract_and_count(int *chords1, int *chords2, int num_chords, int nver ins_list1[insnum] = parent[z] ins_list2[insnum] = x1 insnum += 1 - if not parent[x1] == xj: # then {x1, xj} isn't already a tree edge + if not parent[x1] == xj: # then {x1, xj} isn't already a tree edge ins_list1[insnum] = x1 ins_list2[insnum] = xj insnum += 1 @@ -321,14 +322,14 @@ cdef int contract_and_count(int *chords1, int *chords2, int num_chords, int nver num = 0 k = 0 while k < insnum and j < num_chords: - if chords1[j] > ins_list1[k] or \ - (chords1[j] == ins_list1[k] and chords2[j] > ins_list2[k]): + if (chords1[j] > ins_list1[k] or + (chords1[j] == ins_list1[k] and chords2[j] > ins_list2[k])): new_chords1[num] = chords1[j] new_chords2[num] = chords2[j] num += 1 j += 1 - elif chords1[j] < ins_list1[k] or \ - (chords1[j] == ins_list1[k] and chords2[j] < ins_list2[k]): + elif (chords1[j] < ins_list1[k] or + (chords1[j] == ins_list1[k] and chords2[j] < ins_list2[k])): new_chords1[num] = ins_list1[k] new_chords2[num] = ins_list2[k] num += 1 From 29ac43771fb0eeaff92138ce20f8e9f4c934fa74 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 11:14:04 +0200 Subject: [PATCH 127/416] trac #34071: cleanup src/sage/graphs/cliquer.pyx --- src/sage/graphs/cliquer.pyx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/graphs/cliquer.pyx b/src/sage/graphs/cliquer.pyx index cd82d00ef4f..e53d90d2dbc 100644 --- a/src/sage/graphs/cliquer.pyx +++ b/src/sage/graphs/cliquer.pyx @@ -39,7 +39,7 @@ cdef extern from "sage/graphs/cliquer/cl.c": cdef int sage_clique_max(graph_t *g, int ** list_of_vertices) cdef int sage_all_clique_max(graph_t *g, int ** list_of_vertices) cdef int sage_clique_number(graph_t *g) - cdef int sage_find_all_clique(graph_t *g,int ** list_of_vertices, int min_size, int max_size) + cdef int sage_find_all_clique(graph_t *g, int ** list_of_vertices, int min_size, int max_size) def max_clique(graph): @@ -73,7 +73,7 @@ def max_clique(graph): cdef dict vertex_to_int = {v: i for i, v in enumerate(int_to_vertex)} cdef graph_t* g = graph_new(graph.order()) - for u,v in graph.edge_iterator(labels=None): + for u, v in graph.edge_iterator(labels=None): GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v]) cdef int* list_of_vertices @@ -140,7 +140,7 @@ def all_max_clique(graph): cdef dict vertex_to_int = {v: i for i, v in enumerate(int_to_vertex)} cdef graph_t* g = graph_new(graph.order()) - for u,v in graph.edge_iterator(labels=None): + for u, v in graph.edge_iterator(labels=None): GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v]) cdef int* list_of_vertices @@ -256,7 +256,7 @@ def all_cliques(graph, min_size=0, max_size=0): cdef dict vertex_to_int = {v: i for i, v in enumerate(int_to_vertex)} cdef graph_t* g = graph_new(graph.order()) - for u,v in graph.edge_iterator(labels=None): + for u, v in graph.edge_iterator(labels=None): GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v]) cdef int* list_of_vertices @@ -284,7 +284,7 @@ def all_cliques(graph, min_size=0, max_size=0): sig_free(list_of_vertices) -#computes the clique number of a graph +# computes the clique number of a graph def clique_number(graph): """ @@ -319,7 +319,7 @@ def clique_number(graph): cdef dict vertex_to_int = {v: i for i, v in enumerate(graph)} cdef graph_t* g = graph_new(graph.order()) - for u,v in graph.edge_iterator(labels=None): + for u, v in graph.edge_iterator(labels=None): GRAPH_ADD_EDGE(g, vertex_to_int[u], vertex_to_int[v]) cdef int c From f7303ab27a820a43569a10ca8b3dee2a5fdfcbf8 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 11:16:57 +0200 Subject: [PATCH 128/416] trac #34071: cleanup src/sage/graphs/convexity_properties.pyx --- src/sage/graphs/convexity_properties.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/graphs/convexity_properties.pyx b/src/sage/graphs/convexity_properties.pyx index c260daff32e..a7243cc8d7a 100644 --- a/src/sage/graphs/convexity_properties.pyx +++ b/src/sage/graphs/convexity_properties.pyx @@ -50,6 +50,7 @@ from sage.graphs.base.static_sparse_graph cimport (short_digraph, out_degree, simple_BFS) + cdef class ConvexityProperties: r""" This class gathers the algorithms related to convexity in a graph. @@ -251,7 +252,7 @@ cdef class ConvexityProperties: """ cdef int count cdef int tmp_count - cdef int i,j + cdef int i, j cdef bitset_t * p_bitset @@ -283,7 +284,6 @@ cdef class ConvexityProperties: # Next bitset ! p_bitset = p_bitset + 1 - tmp_count = bitset_len(hull) # If we added nothing new during the previous loop, our set is @@ -418,7 +418,7 @@ cdef class ConvexityProperties: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] """ cdef int i - cdef list constraint # temporary variable to add constraints to the LP + cdef list constraint # temporary variable to add constraints to the LP if self._n <= 2: if value_only: From 36ffb23508f51bcfb4b60cc237a6fc269d7ebf8c Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 12:12:04 +0200 Subject: [PATCH 129/416] 33760: simplify handling of _pos, _pos3d, _embedding --- src/sage/graphs/generic_graph.py | 219 ++++++++++++++++++------------- 1 file changed, 129 insertions(+), 90 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 5cc9122c7f0..08d39c08c70 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2663,12 +2663,7 @@ def set_embedding(self, embedding): def get_embedding(self): """ - Return the attribute ``_embedding`` if it exists. - - ``_embedding`` is a dictionary organized with vertex labels as keys and - a list of each vertex's neighbors in clockwise order. - - Error-checked to insure valid embedding is returned. + Return the stored embedding. EXAMPLES:: @@ -2678,10 +2673,34 @@ def get_embedding(self): sage: G.get_embedding() {0: [1, 4, 5], 1: [0, 2, 6], 2: [1, 3, 7], 3: [2, 4, 8], 4: [0, 3, 9], 5: [0, 7, 8], 6: [1, 9, 8], 7: [2, 5, 9], 8: [3, 6, 5], 9: [4, 6, 7]} """ - if self._check_embedding_validity(): - return self._embedding - else: - raise ValueError('%s has been modified and the embedding is no longer valid'%self) + try: + embedding = self._embedding + except AttributeError: + embedding = None + if embedding is not None: + # remove vertices not anymore in the graph + to_remove = set(v for v in embedding if v not in self) + if to_remove: + for v in to_remove: + del embedding[v] + for v in embedding: + embedding[v] = [w for w in embedding[v] if w not in to_remove] + + # remove edges not anymore in the graph + for u in embedding: + i = 0 + while i < len(embedding[u]): + if not self.has_edge(u, embedding[u][i]): + del embedding[u][i] + else: + i += 1 + + if self._check_embedding_validity(): + return embedding + else: + self._embedding = None + + return None def _check_embedding_validity(self, embedding=None, boolean=True): """ @@ -3493,12 +3512,32 @@ def get_pos(self, dim=2): 9: (0.475..., 0.154...)} """ if dim == 2: - return self._pos + pos = self._pos elif dim == 3: - return getattr(self, "_pos3d", None) + try: + pos = self._pos3d + except AttributeError: + pos = None else: raise ValueError("dim must be 2 or 3") + if pos is not None: + # take care of possible vertex removal + for v in list(pos): + if v not in self: + del pos[v] + + # take care of possible vertex addition + for v in self: + if v not in pos: + if dim == 2: + self._pos = None + else: + self._pos3d = None + break + + return pos + def _check_pos_validity(self, pos=None, dim=2): r""" Check whether ``pos`` specifies two (resp. 3) coordinates for every @@ -3550,10 +3589,7 @@ def set_pos(self, pos, dim=2): - ``dim`` -- integer (default: 2); the number of coordinates per vertex - EXAMPLES: - - Note that :meth:`~GenericGraph.set_pos` will allow you to do ridiculous - things, which will not blow up until plotting:: + EXAMPLES:: sage: G = graphs.PetersenGraph() sage: G.get_pos() @@ -3561,14 +3597,17 @@ def set_pos(self, pos, dim=2): ... 9: (..., ...)} - :: - - sage: G.set_pos('spam') + sage: G.set_pos(dict(enumerate('abcdefghi'))) sage: P = G.plot() Traceback (most recent call last): ... - TypeError: string indices must be integers... + IndexError: string index out of range """ + if pos is None: + return + + if not isinstance(pos, dict): + raise ValueError('pos must be a dictionary whose keys are vertices and values the positions') if dim == 2: self._pos = pos elif dim == 3: @@ -10389,19 +10428,17 @@ def delete_vertex(self, vertex, in_order=False): if vertex not in self: raise ValueError("vertex (%s) not in the graph"%str(vertex)) - attributes_to_update = ('_pos', '_assoc') - for attr in attributes_to_update: - if hasattr(self, attr) and getattr(self, attr) is not None: - getattr(self, attr).pop(vertex, None) + # TODO: remove this update from this method which should be as fast + # as possible + try: + assoc = self._assoc + except AttributeError: + assoc = None + if assoc is not None: + assoc.pop(vertex, None) - if hasattr(self, '_embedding'): - embedding = self._embedding - if embedding is not None: - neighbors = set(self.neighbor_iterator(vertex)) - neighbors.discard(vertex) - for w in neighbors: - embedding[w] = [x for x in embedding[w] if x != vertex] - embedding.pop(vertex, None) + # NOTE: we do not update _embedding, _pos or _pos3d as this is done in + # the get_embedding and get_pos methods self._backend.del_vertex(vertex) @@ -10442,21 +10479,18 @@ def delete_vertices(self, vertices): if v not in self: raise ValueError("vertex (%s) not in the graph"%str(v)) - for attr in ('_pos', '_assoc'): - if hasattr(self, attr) and getattr(self, attr) is not None: - attr_dict = getattr(self, attr) - for v in vertices: - attr_dict.pop(v, None) + # TODO: remove this update from this method which should be as fast + # as possible + try: + assoc = self._assoc + except AttributeError: + assoc = None + if assoc is not None: + for v in vertices: + assoc.pop(v, None) - if hasattr(self, '_embedding'): - embedding = self._embedding - if embedding is not None: - neighbors = set().union(*[self.neighbor_iterator(v) for v in vertices]) - neighbors.difference_update(vertices) - for w in neighbors: - embedding[w] = [x for x in embedding[w] if x not in vertices] - for v in vertices: - embedding.pop(v, None) + # NOTE: the _embedding, _pos and _pos3d attributes are modified directly + # in get_embedding and get_pos methods self._backend.del_vertices(vertices) @@ -10762,12 +10796,14 @@ def set_vertex(self, vertex, object): ... ValueError: vertex (4) not in the graph """ - if hasattr(self, '_assoc') is False: - self._assoc = {} - if not self.has_vertex(vertex): raise ValueError('vertex (%s) not in the graph' % str(vertex)) + try: + assoc = self._assoc + except AttributeError: + assoc = self._assoc = {} + self._assoc[vertex] = object def get_vertex(self, vertex): @@ -10817,7 +10853,7 @@ def get_vertices(self, verts=None): if verts is None: verts = list(self) - if hasattr(self, '_assoc') is False: + if not hasattr(self, '_assoc'): return dict.fromkeys(verts, None) return {v: self._assoc.get(v, None) for v in verts} @@ -12492,33 +12528,25 @@ def clear(self): EXAMPLES:: - sage: G=graphs.CycleGraph(4); G.set_vertices({0:'vertex0'}) - sage: G.order(); G.size() - 4 - 4 - sage: len(G._pos) - 4 + sage: G = graphs.CycleGraph(4) + sage: G.set_vertices({0:'vertex0'}) + sage: print(G.order(), G.size()) + 4 4 sage: G.name() 'Cycle graph' sage: G.get_vertex(0) 'vertex0' sage: H = G.copy(sparse=True) sage: H.clear() - sage: H.order(); H.size() - 0 - 0 - sage: len(H._pos) - 0 + sage: print(H.order(), H.size()) + 0 0 sage: H.name() '' sage: H.get_vertex(0) sage: H = G.copy(sparse=False) sage: H.clear() - sage: H.order(); H.size() - 0 - 0 - sage: len(H._pos) - 0 + sage: print(H.order(), H.size()) + 0 0 sage: H.name() '' sage: H.get_vertex(0) @@ -13139,11 +13167,22 @@ def _subgraph_by_adding(self, vertices=None, edges=None, edge_property=None, imm edges_to_keep = [e for e in edges_to_keep if edge_property(e)] G.add_edges(edges_to_keep) - attributes_to_update = ('_pos', '_assoc') - for attr in attributes_to_update: - if hasattr(self, attr) and getattr(self, attr) is not None: - value = {v: getattr(self, attr).get(v, None) for v in G} - setattr(G, attr, value) + # copy _assoc, _pos, _pos3d and _embedding to the subgraph + try: + assoc = self._assoc + except AttributeError: + assoc = None + if assoc is not None: + G._assoc = {v: assoc[v] for v in G if v in assoc} + pos = self.get_pos() + if pos is not None: + G._pos = {v: pos[v] for v in G if v in pos} + pos3d = self.get_pos(dim=3) + if pos3d is not None: + G._pos3d = {v: pos3d[v] for v in G if v in pos3d} + embedding = self.get_embedding() + if embedding is not None: + G._embedding = {u: [v for v in embedding[u] if u in G] for u in G} if immutable is None: immutable = self.is_immutable() @@ -19647,11 +19686,7 @@ def layout_tree(self, tree_orientation="down", tree_root=None, raise RuntimeError("cannot use tree layout on this graph: " "self.is_tree() returns False") - try: - emb = self.get_embedding() - use_embedding = True - except ValueError: - use_embedding = False + emb = self.get_embedding() if tree_root is None: root = self.center()[0] @@ -19661,7 +19696,7 @@ def layout_tree(self, tree_orientation="down", tree_root=None, pos = {} # The children and parent of each vertex - if not use_embedding: + if emb is None: children = {root: self.neighbors(root)} else: children = {root: emb[root]} @@ -19739,7 +19774,7 @@ def slide(v, dx): pt = parent[t] - if not use_embedding: + if emb is None: ct = [u for u in self.neighbor_iterator(t) if u != pt] else: ct = emb[t] @@ -22152,19 +22187,23 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input=True, c for t in perm.values(): hash(t) - self._backend.relabel(perm, self._directed) - - attributes_to_update = ('_pos', '_assoc', '_embedding') - for attr in attributes_to_update: - if hasattr(self, attr) and getattr(self, attr) is not None: - new_attr = {} - for v, value in getattr(self, attr).items(): - if attr != '_embedding': - new_attr[perm[v]] = value - else: - new_attr[perm[v]] = [perm[w] for w in value] + embedding = self.get_embedding() + if embedding is not None: + self._embedding = {perm[u]: [perm[v] for v in neighbors] for u, neighbors in embedding.items()} + pos = self.get_pos() + if pos is not None: + self._pos = {perm[u]: x for u, x in pos.items()} + pos3d = self.get_pos(dim=3) + if pos3d is not None: + self._pos3d = {perm[u]: x for u, x in pos3d.items()} + try: + assoc = self._assoc + except AttributeError: + assoc = None + if assoc is not None: + self._assoc = {perm[v]: value for v, value in assoc.items()} - setattr(self, attr, new_attr) + self._backend.relabel(perm, self._directed) if return_map: return perm From 07cb8786a8a5d32fc78ecb3c5a1f21c9601bd960 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 12:21:31 +0200 Subject: [PATCH 130/416] trac #34073: cleanup src/sage/graphs/graph_coloring.pyx --- src/sage/graphs/graph_coloring.pyx | 139 +++++++++++++++-------------- 1 file changed, 73 insertions(+), 66 deletions(-) diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index 785cf1804ce..05f95b74107 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -156,7 +156,6 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d sage: print("G has %s 3-colorings." % n) G has 12 3-colorings. - TESTS:: sage: G = Graph({0: [1, 2, 3], 1: [2]}) @@ -275,6 +274,7 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, vertex_color_d except RuntimeError: raise RuntimeError("too much recursion, Graph coloring failed") + cpdef first_coloring(G, n=0, hex_colors=False): r""" Return the first vertex coloring found. @@ -315,6 +315,7 @@ cpdef first_coloring(G, n=0, hex_colors=False): else: return list(C.values()) + cpdef number_of_n_colorings(G, n): r""" Compute the number of `n`-colorings of a graph @@ -346,6 +347,7 @@ cpdef number_of_n_colorings(G, n): m += 1 return m + cpdef numbers_of_colorings(G): r""" Compute the number of colorings of a graph. @@ -364,6 +366,7 @@ cpdef numbers_of_colorings(G): cdef list answer = [number_of_n_colorings(G, n) for n in range(o + 1)] return answer + cpdef chromatic_number(G): r""" Return the chromatic number of the graph. @@ -384,16 +387,18 @@ cpdef chromatic_number(G): """ G._scream_if_not_simple(allow_multiple_edges=True) cdef int o = G.order() - cdef int m if not o: return 0 if not G.size(): return 1 - elif G.is_bipartite(): # can we do it in linear time? + elif G.is_bipartite(): # can we do it in linear time? return 2 - else: # counting cliques is faster than our brute-force method... - m = G.clique_number() - if m >= o - 1: # marginal improvement... if there's an o-1 clique and not an o clique, don't waste our time coloring. + + # counting cliques is faster than our brute-force method... + cdef int m = G.clique_number() + if m >= o - 1: + # marginal improvement... if there is an o-1 clique and not an o clique, + # don't waste our time coloring. return m for n in range(m, o + 1): for C in all_graph_colorings(G, n): @@ -627,16 +632,16 @@ def vertex_coloring(g, k=None, value_only=False, hex_colors=False, solver=None, # a vertex has exactly one color for v in g: - p.add_constraint(p.sum(color[v,i] for i in range(k)), min=1, max=1) + p.add_constraint(p.sum(color[v, i] for i in range(k)), min=1, max=1) # adjacent vertices have different colors for u, v in g.edge_iterator(labels=None): for i in range(k): - p.add_constraint(color[u,i] + color[v,i], max=1) + p.add_constraint(color[u, i] + color[v, i], max=1) # The first vertex is colored with 1. It costs nothing to say # it, and it can help. - p.add_constraint(color[next(g.vertex_iterator()),0], max=1, min=1) + p.add_constraint(color[next(g.vertex_iterator()), 0], max=1, min=1) try: if value_only: @@ -653,7 +658,7 @@ def vertex_coloring(g, k=None, value_only=False, hex_colors=False, solver=None, for v in g: for i in range(k): - if color[v,i]: + if color[v, i]: classes[i].append(v) break @@ -662,6 +667,7 @@ def vertex_coloring(g, k=None, value_only=False, hex_colors=False, solver=None, else: return classes + # Fractional relaxations def fractional_chromatic_number(G, solver='PPL', verbose=0, check_components=True, check_bipartite=True): @@ -760,7 +766,7 @@ def fractional_chromatic_number(G, solver='PPL', verbose=0, check_bipartite=check_bipartite) for b in G.blocks_and_cut_vertices()[0]) - Is = [frozenset(I) for I in IndependentSets(G, maximal=True)] + Is = [frozenset(S) for S in IndependentSets(G, maximal=True)] # Initialize LP for fractional chromatic number, we want to minimize the # total weight @@ -770,16 +776,17 @@ def fractional_chromatic_number(G, solver='PPL', verbose=0, w = p.new_variable(nonnegative=True) # the objective is the sum of weights of the independent sets - p.set_objective(p.sum(w[I] for I in Is)) + p.set_objective(p.sum(w[S] for S in Is)) # such that each vertex gets total weight at least 1 for v in G: - p.add_constraint(p.sum(w[I] for I in Is if v in I), min=1) + p.add_constraint(p.sum(w[S] for S in Is if v in S), min=1) obj = p.solve(log=verbose) return obj + def fractional_chromatic_index(G, solver="PPL", verbose_constraints=False, verbose=0): r""" Return the fractional chromatic index of the graph. @@ -909,6 +916,7 @@ def fractional_chromatic_index(G, solver="PPL", verbose_constraints=False, verbo # Accomplished ! return obj + def grundy_coloring(g, k, value_only=True, solver=None, verbose=0, *, integrality_tolerance=1e-3): r""" @@ -1003,12 +1011,12 @@ def grundy_coloring(g, k, value_only=True, solver=None, verbose=0, # Each vertex is in exactly one color class for v in g: - p.add_constraint(p.sum(b[v,i] for i in range(k)), max=1, min=1) + p.add_constraint(p.sum(b[v, i] for i in range(k)), max=1, min=1) # Two adjacent vertices have different colors - for u,v in g.edge_iterator(labels=None): + for u, v in g.edge_iterator(labels=None): for i in range(k): - p.add_constraint(b[v,i] + b[u,i], max=1) + p.add_constraint(b[v, i] + b[u, i], max=1) # The following constraints ensure that if v is colored with i, then it has # a neighbor colored with j for every j m: k = m - p = MixedIntegerLinearProgram(solver=solver) # color[v,i] is set to 1 if and only if v is colored i @@ -1181,12 +1187,12 @@ def b_coloring(g, k, value_only=True, solver=None, verbose=0, # Each vertex is in exactly one class for v in g: - p.add_constraint(p.sum(color[v,i] for i in range(k)), min=1, max=1) + p.add_constraint(p.sum(color[v, i] for i in range(k)), min=1, max=1) # Adjacent vertices have distinct colors for u, v in g.edge_iterator(labels=None): for i in range(k): - p.add_constraint(color[u,i] + color[v,i], max=1) + p.add_constraint(color[u, i] + color[v, i], max=1) # The following constraints ensure that if v is a b-vertex of color i # then it has a neighbor colored j for every j != i @@ -1202,28 +1208,25 @@ def b_coloring(g, k, value_only=True, solver=None, verbose=0, # then we MUST have sum(color[w,j] for w in g.neighbors(v)) # valued at least 1, which means that v has a neighbour in # color j, as desired. - p.add_constraint(p.sum(color[w,j] for w in g.neighbor_iterator(v)) - - b[v,i] + 1 - is_used[j], min=0) + p.add_constraint(p.sum(color[w, j] for w in g.neighbor_iterator(v)) + - b[v, i] + 1 - is_used[j], min=0) # if color i is used, there is a vertex colored i for i in range(k): - p.add_constraint(p.sum(color[v,i] for v in g) - is_used[i], min=0) + p.add_constraint(p.sum(color[v, i] for v in g) - is_used[i], min=0) # if there is a vertex colored with color i, then i is used for v in g: for i in range(k): - p.add_constraint(color[v,i] - is_used[i], max=0) - + p.add_constraint(color[v, i] - is_used[i], max=0) # a color class is used if and only if it has one b-vertex for i in range(k): - p.add_constraint(p.sum(b[w,i] for w in g) - is_used[i], min=0, max=0) - + p.add_constraint(p.sum(b[w, i] for w in g) - is_used[i], min=0, max=0) # We want to maximize the number of used colors p.set_objective(p.sum(is_used[i] for i in range(k))) - try: p.solve(log=verbose) except MIPSolverException: @@ -1242,12 +1245,13 @@ def b_coloring(g, k, value_only=True, solver=None, verbose=0, for v in g: for i in range(k): - if c[v,i]: + if c[v, i]: coloring[v] = i break return obj, coloring + def edge_coloring(g, value_only=False, vizing=False, hex_colors=False, solver=None, verbose=0, *, integrality_tolerance=1e-3): r""" @@ -1395,7 +1399,7 @@ def edge_coloring(g, value_only=False, vizing=False, hex_colors=False, solver=No continue # We get the vertex of maximum degree and its degree - Delta,X = max([(d, v) for v,d in h.degree_iterator(labels=True)], key=lambda x: x[0]) + Delta, X = max([(d, v) for v, d in h.degree_iterator(labels=True)], key=lambda x: x[0]) if value_only: if Delta + 1 <= chi: @@ -1428,20 +1432,20 @@ def edge_coloring(g, value_only=False, vizing=False, hex_colors=False, solver=No # A vertex cannot have two incident edges with the same color. for v in h: for i in range(k): - p.add_constraint(p.sum(color[frozenset((u,v)),i] for u in h.neighbor_iterator(v)) <= 1) + p.add_constraint(p.sum(color[frozenset((u, v)), i] for u in h.neighbor_iterator(v)) <= 1) # An edge must have a color - for u,v in h.edge_iterator(labels=False): - p.add_constraint(p.sum(color[frozenset((u,v)),i] for i in range(k)) == 1) + for u, v in h.edge_iterator(labels=False): + p.add_constraint(p.sum(color[frozenset((u, v)), i] for i in range(k)) == 1) # We color the edges of the vertex of maximum degree - for i,v in enumerate(h.neighbor_iterator(X)): - p.add_constraint( color[frozenset((v,X)),i] == 1 ) + for i, v in enumerate(h.neighbor_iterator(X)): + p.add_constraint(color[frozenset((v, X)), i] == 1) try: p.solve(objective_only=value_only, log=verbose) break except MIPSolverException: if k == Delta + 1: raise RuntimeError("Something is wrong! Certainly a problem in the" - " algorithm... please contact sage-devel@googlegroups.com") + " algorithm... please contact sage-devel@googlegroups.com") # The coloring fails with Delta colors if value_only: k = k + 1 @@ -1458,7 +1462,7 @@ def edge_coloring(g, value_only=False, vizing=False, hex_colors=False, solver=No for e in h.edge_iterator(labels=False): fe = frozenset(e) for i in range(k): - if color[fe,i]: + if color[fe, i]: classes[i].append(e) break @@ -1470,6 +1474,7 @@ def edge_coloring(g, value_only=False, vizing=False, hex_colors=False, solver=No else: return classes + def round_robin(n): r""" Compute a round-robin coloring of the complete graph on `n` vertices. @@ -1538,6 +1543,7 @@ def round_robin(n): g.delete_vertex(n) return g + def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False, solver=None, verbose=0, *, integrality_tolerance=1e-3): r""" @@ -1689,22 +1695,21 @@ def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False, MAD = 1 - 1 / (Integer(g.order()) * 2) # Partition of the edges - for u,v in g.edge_iterator(labels=None): - p.add_constraint(p.sum(c[i,frozenset((u,v))] for i in range(k)), max=1, min=1) + for u, v in g.edge_iterator(labels=None): + p.add_constraint(p.sum(c[i, frozenset((u, v))] for i in range(k)), max=1, min=1) for i in range(k): # r greater than c - for u,v in g.edge_iterator(labels=None): - p.add_constraint(r[i,(u,v)] + r[i,(v,u)] - c[i,frozenset((u,v))], max=0, min=0) - + for u, v in g.edge_iterator(labels=None): + p.add_constraint(r[i, (u, v)] + r[i, (v, u)] - c[i, frozenset((u, v))], max=0, min=0) # Maximum degree 2 for u in g: - p.add_constraint(p.sum(c[i,frozenset((u,v))] for v in g.neighbor_iterator(u)), max=2) + p.add_constraint(p.sum(c[i, frozenset((u, v))] for v in g.neighbor_iterator(u)), max=2) # no cycles - p.add_constraint(p.sum(r[i,(u,v)] for v in g.neighbor_iterator(u)),max=MAD) + p.add_constraint(p.sum(r[i, (u, v)] for v in g.neighbor_iterator(u)), max=MAD) try: p.solve(objective_only=value_only, log=verbose) @@ -1713,7 +1718,10 @@ def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False, except MIPSolverException: if plus_one: - raise RuntimeError("It looks like you have found a counterexample to a very old conjecture. Please do not loose it ! Please publish it, and send a post to sage-devel to warn us. We implore you!") + raise RuntimeError("It looks like you have found a counterexample " + "to a very old conjecture. Please do not loose " + "it ! Please publish it, and send a post to " + "sage-devel to warn us. We implore you!") else: raise ValueError("this graph cannot be colored with the given number of colors") @@ -1735,9 +1743,9 @@ def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False, return answer[i].add_edge(uv) for i in range(k): - for u,v in g.edge_iterator(labels=None): - if c[i,frozenset((u,v))]: - add((u,v),i) + for u, v in g.edge_iterator(labels=None): + if c[i, frozenset((u, v))]: + add((u, v), i) if hex_colors: return dict(zip(rainbow(len(answer)), answer)) @@ -1932,29 +1940,28 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, r = p.new_variable(nonnegative=True) def E(x, y): - return frozenset((x,y)) + return frozenset((x, y)) MAD = 1 - 1/(Integer(g.order()) * 2) # Partition of the edges: each edge is assigned a unique color - for u,v in g.edge_iterator(labels=None): - p.add_constraint(p.sum(c[i,E(u,v)] for i in range(k)), max=1, min=1) - + for u, v in g.edge_iterator(labels=None): + p.add_constraint(p.sum(c[i, E(u, v)] for i in range(k)), max=1, min=1) for i in range(k): # Maximum degree 1 for u in g: - p.add_constraint(p.sum(c[i,E(u,v)] for v in g.neighbor_iterator(u)), max=1) + p.add_constraint(p.sum(c[i, E(u, v)] for v in g.neighbor_iterator(u)), max=1) - for i,j in Subsets(range(k), 2): + for i, j in Subsets(range(k), 2): # r is greater than c for u in g: - p.add_constraint(p.sum(r[(i,j),(u,v)] for v in g.neighbor_iterator(u)), max=MAD) + p.add_constraint(p.sum(r[(i, j), (u, v)] for v in g.neighbor_iterator(u)), max=MAD) # r greater than c - for u,v in g.edge_iterator(labels=None): - p.add_constraint(r[(i,j),(u,v)] + r[(i,j),(v,u)] - c[i,E(u,v)] - c[j,E(u,v)], max=0, min=0) + for u, v in g.edge_iterator(labels=None): + p.add_constraint(r[(i, j), (u, v)] + r[(i, j), (v, u)] - c[i, E(u, v)] - c[j, E(u, v)], max=0, min=0) p.set_objective(None) @@ -1988,9 +1995,9 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, return answer[i].add_edge(uv) for i in range(k): - for u,v in g.edge_iterator(labels=None): - if c[i,E(u,v)]: - add((u,v), i) + for u, v in g.edge_iterator(labels=None): + if c[i, E(u, v)]: + add((u, v), i) if hex_colors: return dict(zip(rainbow(len(answer)), answer)) @@ -2051,9 +2058,9 @@ cdef class Test: for C in all_graph_colorings(G, chi): parts = [C[k] for k in C] for P in parts: - l = len(P) - for i in range(l): - for j in range(i+1, l): + lenP = len(P) + for i in range(lenP): + for j in range(i + 1, lenP): if G.has_edge(P[i], P[j]): raise RuntimeError("coloring failed") From d8e2556b4d30138b13ea8e85a2a9707896ccd6ea Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 15:45:55 +0200 Subject: [PATCH 131/416] trac #34076: cleanup src/sage/graphs/genus.pyx --- src/sage/graphs/genus.pyx | 45 +++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/sage/graphs/genus.pyx b/src/sage/graphs/genus.pyx index a4fe3776eaa..d56c1ba8461 100644 --- a/src/sage/graphs/genus.pyx +++ b/src/sage/graphs/genus.pyx @@ -27,21 +27,21 @@ described throughout the file. """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2010 Tom Boothby # # 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 libc.string cimport memcpy from memory_allocator cimport MemoryAllocator from cysignals.signals cimport sig_on, sig_off -cimport sage.combinat.permutation_cython +# cimport sage.combinat.permutation_cython from sage.combinat.permutation_cython cimport next_swap, reset_swap @@ -55,7 +55,8 @@ cdef inline int edge_map(int i): slippery. This is the fastest way I could find to establish the correspondence `i <-> i + 1` if `i` is even. """ - return i - 2 * ( i & 1) + 1 + return i - 2 * (i & 1) + 1 + cdef class simple_connected_genus_backtracker: r""" @@ -101,7 +102,6 @@ cdef class simple_connected_genus_backtracker: sage: bt = sage.graphs.genus.simple_connected_genus_backtracker(G._backend.c_graph()[0]) sage: bt.genus() 2 - """ cdef MemoryAllocator mem cdef int **vertex_darts @@ -125,7 +125,6 @@ cdef class simple_connected_genus_backtracker: sage: gb = sage.graphs.genus.simple_connected_genus_backtracker(G._backend.c_graph()[0]) sage: gb.genus() 0 - """ self.num_darts = G.num_arcs self.num_verts = G.num_verts @@ -135,14 +134,14 @@ cdef class simple_connected_genus_backtracker: # Allocate arrays self.mem = MemoryAllocator() - self.degree = self.mem.malloc(self.num_verts * sizeof(int)) - self.face_map = self.mem.malloc(self.num_darts * sizeof(int)) - self.visited = self.mem.malloc(self.num_darts * sizeof(int)) - self.face_freeze = self.mem.malloc(self.num_darts * sizeof(int)) + self.degree = self.mem.malloc(self.num_verts * sizeof(int)) + self.face_map = self.mem.malloc(self.num_darts * sizeof(int)) + self.visited = self.mem.malloc(self.num_darts * sizeof(int)) + self.face_freeze = self.mem.malloc(self.num_darts * sizeof(int)) self.vertex_darts = self.mem.malloc(self.num_verts * sizeof(int *)) - self.swappers = self.mem.malloc(self.num_verts * sizeof(int *)) - cdef int *w = self.mem.malloc((self.num_verts + self.num_darts) * sizeof(int)) - cdef int *s = self.mem.malloc(2 * (self.num_darts - self.num_verts) * sizeof(int)) + self.swappers = self.mem.malloc(self.num_verts * sizeof(int *)) + cdef int *w = self.mem.malloc((self.num_verts + self.num_darts) * sizeof(int)) + cdef int *s = self.mem.malloc(2 * (self.num_darts - self.num_verts) * sizeof(int)) cdef int i, j, du, dv, u, v @@ -173,7 +172,7 @@ cdef class simple_connected_genus_backtracker: self.vertex_darts[v][dv] = i + 1 self.degree[u] += 1 dv += 1 - i += 2 + i += 2 self.degree[v] = dv @@ -203,7 +202,6 @@ cdef class simple_connected_genus_backtracker: # print(self.face_map[v], end="") # print(']') - cdef inline void freeze_face(self): """ Quickly store the current face_map so we can recover @@ -300,7 +298,7 @@ cdef class simple_connected_genus_backtracker: return 1 cdef void flip(self, int v, int i): - """ + r""" This is where the real work happens. Once cycles have been counted for the initial face_map, we make small local changes, and look at their effect on the number of cycles. @@ -384,7 +382,6 @@ cdef class simple_connected_genus_backtracker: self.num_cycles += (2 * k + 1 - j) % 4 - face_map[e0] = v2 face_map[e1] = f2 face_map[e2] = v1 @@ -392,7 +389,6 @@ cdef class simple_connected_genus_backtracker: w[i] = v2 w[i + 1] = v1 - cdef int count_cycles(self): """ Count all cycles. @@ -432,7 +428,6 @@ cdef class simple_connected_genus_backtracker: the minimal or maximal genus for self's graph. - EXAMPLES:: sage: import sage.graphs.genus @@ -481,10 +476,9 @@ cdef class simple_connected_genus_backtracker: return next_swap(d, self.swappers[v], self.swappers[v] + d) cdef int genus_backtrack(self, - int cutoff, - bint record_embedding, - (int (*)(simple_connected_genus_backtracker,int,bint,int))check_embedding - ): + int cutoff, + bint record_embedding, + (int (*)(simple_connected_genus_backtracker, int, bint, int))check_embedding): """ Here's the main backtracking routine. @@ -621,7 +615,7 @@ def simple_connected_graph_genus(G, set_embedding=False, check=True, minimal=Tru cutoff = 1 else: style = 2 - cutoff = 1 + (G.num_edges() - G.num_verts()) / 2 # rounding here is ok + cutoff = 1 + (G.num_edges() - G.num_verts()) / 2 # rounding here is ok g = GG.genus(style=style, cutoff=cutoff, record_embedding=set_embedding) if set_embedding: @@ -631,4 +625,3 @@ def simple_connected_graph_genus(G, set_embedding=False, check=True, minimal=Tru oE[backmap[v]] = [backmap[x] for x in E[v]] oG.set_embedding(oE) return g - From 186431d9ec08dcb7595a1968c6e6d6093edddae3 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 16:00:38 +0200 Subject: [PATCH 132/416] trac #34077: cleanup src/sage/graphs/graph_input.py --- src/sage/graphs/graph_input.py | 72 +++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/src/sage/graphs/graph_input.py b/src/sage/graphs/graph_input.py index 82545956b36..fe95ecbb541 100644 --- a/src/sage/graphs/graph_input.py +++ b/src/sage/graphs/graph_input.py @@ -19,6 +19,8 @@ """ from sage.cpython.string import bytes_to_str +from sage.misc.rest_index_of_methods import gen_rest_table_index +import sys def from_graph6(G, g6_string): @@ -51,11 +53,11 @@ def from_graph6(G, g6_string): ss = g6_string[:n] n, s = length_and_string_from_graph6(ss) m = binary_string_from_graph6(s, n) - expected = n*(n-1)//2 + (6 - n*(n-1)//2)%6 + expected = n * (n - 1) // 2 + (6 - n * (n - 1) // 2) % 6 if len(m) > expected: - raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too long"%(ss, n)) + raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too long" % (ss, n)) elif len(m) < expected: - raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too short"%(ss, n)) + raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too short" % (ss, n)) G.add_vertices(range(n)) k = 0 for i in range(n): @@ -64,6 +66,7 @@ def from_graph6(G, g6_string): G._backend.add_edge(i, j, None, False) k += 1 + def from_sparse6(G, g6_string): r""" Fill ``G`` with the data of a sparse6 string. @@ -101,7 +104,7 @@ def from_sparse6(G, g6_string): k = int((ZZ(n) - 1).nbits()) ords = [ord(i) for i in s] if any(o > 126 or o < 63 for o in ords): - raise RuntimeError("the string seems corrupt: valid characters are \n" + ''.join([chr(i) for i in range(63,127)])) + raise RuntimeError("the string seems corrupt: valid characters are \n" + ''.join([chr(i) for i in range(63, 127)])) bits = ''.join([int_to_binary_string(o-63).zfill(6) for o in ords]) if not k: b = [int(x) for x in bits] @@ -115,7 +118,7 @@ def from_sparse6(G, g6_string): v = 0 edges = [] for i in range(len(b)): - v += b[i] # +1 if b[i] == 1 else 0 + v += b[i] # +1 if b[i] == 1 else 0 if x[i] > v: v = x[i] else: @@ -156,9 +159,9 @@ def from_dig6(G, dig6_string): m = binary_string_from_dig6(s, n) expected = n**2 if len(m) > expected: - raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too long"%(ss, n)) + raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too long" % (ss, n)) elif len(m) < expected: - raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too short"%(ss, n)) + raise RuntimeError("the string (%s) seems corrupt: for n = %d, the string is too short" % (ss, n)) G.add_vertices(range(n)) k = 0 for i in range(n): @@ -167,6 +170,7 @@ def from_dig6(G, dig6_string): G._backend.add_edge(i, j, None, True) k += 1 + def from_seidel_adjacency_matrix(G, M): r""" Fill ``G`` with the data of a Seidel adjacency matrix. @@ -197,11 +201,11 @@ def from_seidel_adjacency_matrix(G, M): " have only 0,1,-1 integer entries") if M.is_sparse(): - entries = set(M[i,j] for i,j in M.nonzero_positions()) + entries = set(M[i, j] for i, j in M.nonzero_positions()) else: entries = set(M.list()) - if any(e < -1 or e > 1 for e in entries): + if any(e < -1 or e > 1 for e in entries): raise ValueError("the adjacency matrix of a Seidel graph must" + " have only 0,1,-1 integer entries") if any(i == j for i, j in M.nonzero_positions()): @@ -211,7 +215,8 @@ def from_seidel_adjacency_matrix(G, M): raise ValueError("the adjacency matrix of a Seidel graph must be symmetric") G.add_vertices(range(M.nrows())) - G.add_edges((i, j) for i, j in M.nonzero_positions() if i <= j and M[i,j] < 0) + G.add_edges((i, j) for i, j in M.nonzero_positions() if i <= j and M[i, j] < 0) + def from_adjacency_matrix(G, M, loops=False, multiedges=False, weighted=False): r""" @@ -249,7 +254,7 @@ def from_adjacency_matrix(G, M, loops=False, multiedges=False, weighted=False): weighted = True if M.is_sparse(): - entries = set(M[i,j] for i,j in M.nonzero_positions()) + entries = set(M[i, j] for i, j in M.nonzero_positions()) else: entries = set(M.list()) @@ -266,7 +271,7 @@ def from_adjacency_matrix(G, M, loops=False, multiedges=False, weighted=False): if multiedges is None: multiedges = ((not weighted) and any(e != 0 and e != 1 for e in entries)) - if not loops and any(M[i,i] for i in range(M.nrows())): + if not loops and any(M[i, i] for i in range(M.nrows())): if loops is False: raise ValueError("the adjacency matrix of a non-weighted graph" + " must have zeroes on the diagonal") @@ -288,6 +293,7 @@ def from_adjacency_matrix(G, M, loops=False, multiedges=False, weighted=False): G.add_edges((i, j) for i, j in pairs) G._weighted = weighted + def from_incidence_matrix(G, M, loops=False, multiedges=False, weighted=False): r""" Fill ``G`` with the data of an incidence matrix. @@ -321,7 +327,7 @@ def from_incidence_matrix(G, M, loops=False, multiedges=False, weighted=False): if oriented: raise ValueError("column {} of the (oriented) incidence " "matrix contains only one nonzero value".format(i)) - elif M[NZ[0],i] != 2: + elif M[NZ[0], i] != 2: raise ValueError("each column of a non-oriented incidence " "matrix must sum to 2, but column {} does not".format(i)) if loops is None: @@ -331,14 +337,14 @@ def from_incidence_matrix(G, M, loops=False, multiedges=False, weighted=False): (oriented and not ((M[NZ[0], i] == +1 and M[NZ[1], i] == -1) or (M[NZ[0], i] == -1 and M[NZ[1], i] == +1))) or (not oriented and (M[NZ[0], i] != 1 or M[NZ[1], i] != 1))): - msg = "there must be one or two nonzero entries per column in an incidence matrix, " + msg = "there must be one or two nonzero entries per column in an incidence matrix, " msg += "got entries {} in column {}".format([M[j, i] for j in NZ], i) raise ValueError(msg) else: positions.append(tuple(NZ)) if weighted is None: - G._weighted = False + G._weighted = False if multiedges is None: total = len(positions) multiedges = len(set(positions)) < total @@ -347,6 +353,7 @@ def from_incidence_matrix(G, M, loops=False, multiedges=False, weighted=False): G.add_vertices(range(M.nrows())) G.add_edges(positions) + def from_oriented_incidence_matrix(G, M, loops=False, multiedges=False, weighted=False): r""" Fill ``G`` with the data of an *oriented* incidence matrix. @@ -380,7 +387,7 @@ def from_oriented_incidence_matrix(G, M, loops=False, multiedges=False, weighted Traceback (most recent call last): ... ValueError: each column represents an edge: -1 goes to 1 - + Handle incidence matrix containing a column with only zeros (:trac:`29275`):: sage: m = Matrix([[0,1],[0,-1],[0,0]]) @@ -466,9 +473,9 @@ def from_dict_of_dicts(G, M, loops=False, multiedges=False, weighted=False, conv raise ValueError("input dict must be a consistent format") if not loops: - if any(u in neighb for u,neighb in M.items()): + if any(u in neighb for u, neighb in M.items()): if loops is False: - u = next(u for u,neighb in M.items() if u in neighb) + u = next(u for u, neighb in M.items() if u in neighb) raise ValueError("the graph was built with loops=False but input M has a loop at {}".format(u)) loops = True if loops is None: @@ -489,9 +496,11 @@ def from_dict_of_dicts(G, M, loops=False, multiedges=False, weighted=False, conv verts = set().union(M.keys(), *M.values()) G.add_vertices(verts) if convert_empty_dict_labels_to_None: - relabel = lambda x: x if x != {} else None + def relabel(x): + return x if x != {} else None else: - relabel = lambda x: x + def relabel(x): + return x is_directed = G.is_directed() if not is_directed and multiedges: @@ -499,13 +508,13 @@ def from_dict_of_dicts(G, M, loops=False, multiedges=False, weighted=False, conv for u in M: for v in M[u]: if v_to_id[u] <= v_to_id[v] or v not in M or u not in M[v] or u == v: - for l in M[u][v]: - G._backend.add_edge(u, v, relabel(l), False) + for label in M[u][v]: + G._backend.add_edge(u, v, relabel(label), False) elif multiedges: for u in M: for v in M[u]: - for l in M[u][v]: - G._backend.add_edge(u, v, relabel(l), is_directed) + for label in M[u][v]: + G._backend.add_edge(u, v, relabel(label), is_directed) else: for u in M: for v in M[u]: @@ -513,6 +522,7 @@ def from_dict_of_dicts(G, M, loops=False, multiedges=False, weighted=False, conv if not G.size() and input_multiedges is not True: G.allow_multiple_edges(False, check=False) + def from_dict_of_lists(G, D, loops=False, multiedges=False, weighted=False): r""" Fill ``G`` with the data of a dictionary of lists. @@ -550,7 +560,7 @@ def from_dict_of_lists(G, D, loops=False, multiedges=False, weighted=False): if len(set(D[u])) != len(D[u]): if multiedges is False: v = next((v for v in D[u] if D[u].count(v) > 1)) - raise ValueError("non-multigraph got several edges (%s, %s)"%(u, v)) + raise ValueError("non-multigraph got several edges (%s, %s)" % (u, v)) multiedges = True break if multiedges is None: @@ -565,13 +575,14 @@ def from_dict_of_lists(G, D, loops=False, multiedges=False, weighted=False): for u in D: for v in D[u]: if (v_to_id[u] <= v_to_id[v] or - v not in D or u not in D[v] or u == v): + v not in D or u not in D[v] or u == v): G._backend.add_edge(u, v, None, False) else: for u in D: for v in D[u]: G._backend.add_edge(u, v, None, is_directed) + def from_networkx_graph(G, gnx, weighted=None, loops=None, multiedges=None, convert_empty_dict_labels_to_None=None): r""" @@ -755,12 +766,11 @@ def from_networkx_graph(G, gnx, weighted=None, loops=None, multiedges=None, G.add_vertices(gnx.nodes()) G.set_vertices(gnx.nodes(data=True)) if convert_empty_dict_labels_to_None is not False: - def r(l): - return None if l == {} else l - G.add_edges((u, v, r(l)) for u, v, l in gnx.edges(data=True)) + def r(label): + return None if label == {} else label + G.add_edges((u, v, r(ll)) for u, v, ll in gnx.edges(data=True)) else: G.add_edges(gnx.edges(data=True)) -from sage.misc.rest_index_of_methods import gen_rest_table_index -import sys + __doc__ = __doc__.format(INDEX_OF_FUNCTIONS=gen_rest_table_index(sys.modules[__name__])) From d98cb16a7ba7a6355542d1a29e54016e53051cd7 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 16:34:37 +0200 Subject: [PATCH 133/416] trac #34078: cleanup src/sage/graphs/graph_plot.py --- src/sage/graphs/graph_list.py | 9 ++++- src/sage/graphs/graph_plot.py | 67 +++++++++++++++++++++----------- src/sage/graphs/graph_plot_js.py | 8 ++-- 3 files changed, 55 insertions(+), 29 deletions(-) diff --git a/src/sage/graphs/graph_list.py b/src/sage/graphs/graph_list.py index 845e27705c0..d22a639adb9 100644 --- a/src/sage/graphs/graph_list.py +++ b/src/sage/graphs/graph_list.py @@ -144,8 +144,13 @@ def from_sparse6(data): EXAMPLES:: - sage: l = [':P_`cBaC_ACd`C_@BC`ABDHaEH_@BF_@CHIK_@BCEHKL_BIKM_BFGHI', ':f`??KO?B_OOSCGE_?OWONDBO?GOJBDO?_SSJdApcOIG`?og_UKEbg?_SKFq@[CCBA`p?oYMFp@gw]Qaa@xEMHDb@hMCBCbQ@ECHEcAKKQKFPOwo[PIDQ{KIHEcQPOkVKEW_WMNKqPWwcRKOOWSKIGCqhWt??___WMJFCahWzEBa`xOu[MpPPKqYNoOOOKHHDBPs|??__gWMKEcAHKgTLErqA?A@a@G{kVLErs?GDBA@XCs\\NggWSOJIDbHh@?A@aF'] - sage: graphs_list.from_sparse6(l) + sage: g1 = ':P_`cBaC_ACd`C_@BC`ABDHaEH_@BF_@CHIK_@BCEHKL_BIKM_BFGHI' + sage: g2 = ':f`??KO?B_OOSCGE_?OWONDBO?GOJBDO?_SSJdApcOIG`?og_UKEbg?_SKF' + sage: g2 += 'q@[CCBA`p?oYMFp@gw]Qaa@xEMHDb@hMCBCbQ@ECHEcAKKQKFPOwo[PIDQ' + sage: g2 += '{KIHEcQPOkVKEW_WMNKqPWwcRKOOWSKIGCqhWt??___WMJFCahWzEBa`xO' + sage: g2 += 'u[MpPPKqYNoOOOKHHDBPs|??__gWMKEcAHKgTLErqA?A@a@G{kVLErs?GD' + sage: g2 += 'BA@XCs\\NggWSOJIDbHh@?A@aF' + sage: graphs_list.from_sparse6([g1, g2]) [Looped multi-graph on 17 vertices, Looped multi-graph on 39 vertices] """ return _from_whatever(data, fmt='sparse6') diff --git a/src/sage/graphs/graph_plot.py b/src/sage/graphs/graph_plot.py index 59b1d15b94c..d7f683ad1c3 100644 --- a/src/sage/graphs/graph_plot.py +++ b/src/sage/graphs/graph_plot.py @@ -261,6 +261,7 @@ 'edge_labels_background' : 'white' } + class GraphPlot(SageObject): def __init__(self, graph, options): """ @@ -303,7 +304,7 @@ def __init__(self, graph, options): self._plot_components = {} self._nodelist = list(graph) self._graph = graph - self._options = options # contains both plot and show options + self._options = options # contains both plot and show options self._arcs = self._graph.has_multiple_edges(to_undirected=True) self._loops = self._graph.has_loops() self._arcdigraph = self._graph.is_directed() and self._arcs @@ -388,7 +389,7 @@ def set_pos(self): self._pos = self._graph.layout(**self._options) # Make sure the positions are floats (trac #10124) self._pos = {k: (float(v[0]), float(v[1])) - for k, v in self._pos.items()} + for k, v in self._pos.items()} def set_vertices(self, **vertex_options): """ @@ -510,9 +511,9 @@ def set_vertices(self, **vertex_options): if self._options['partition'] is not None: from sage.plot.colors import rainbow partition = self._options['partition'] - l = len(partition) - R = rainbow(l) - vertex_colors = {R[i]: partition[i] for i in range(l)} + length = len(partition) + R = rainbow(length) + vertex_colors = {R[i]: partition[i] for i in range(length)} elif not vertex_colors: vertex_colors = vertex_color else: @@ -535,7 +536,7 @@ def set_vertices(self, **vertex_options): if self._arcdigraph: self._plot_components['vertices'] = [ circle(p, self._vertex_radius, fill=True, clip=False, - edgecolor='black', facecolor=vertex_colors) + edgecolor='black', facecolor=vertex_colors) for p in pos] else: self._plot_components['vertices'] = ( @@ -557,7 +558,7 @@ def set_vertices(self, **vertex_options): if self._arcdigraph: self._plot_components['vertices'] = [ circle(p, self._vertex_radius, fill=True, clip=False, - facecolor=colors[i], edgecolor='black') + facecolor=colors[i], edgecolor='black') for i, p in enumerate(pos)] else: self._plot_components['vertices'] = scatter_plot( @@ -574,7 +575,7 @@ def vfun(x): vfun = vlabels # TODO: allow text options self._plot_components['vertex_labels'] = [text(vfun(v), self._pos[v], color='black', zorder=8) - for v in self._nodelist] + for v in self._nodelist] def set_edges(self, **edge_options): """ @@ -826,7 +827,7 @@ def set_edges(self, **edge_options): loop_size += loop_size_increment elif len(edges_to_draw[a, b]) > 1: # Multi-edge - local_labels = edges_to_draw.pop((a,b)) + local_labels = edges_to_draw.pop((a, b)) # Compute perpendicular bisector p1 = self._pos[a] @@ -834,28 +835,48 @@ def set_edges(self, **edge_options): m = ((p1[0] + p2[0])/2., (p1[1] + p2[1])/2.) # midpoint if not p1[1] == p2[1]: s = (p1[0] - p2[0])/(p2[1] - p1[1]) # perp slope - y = lambda x: s*(x - m[0]) + m[1] # perp bisector line + + def y(x): + return s*(x - m[0]) + m[1] # perp bisector line # f, g are functions to determine x-values of point # on line y at distance d from point m (on each side) - f = lambda d: sqrt(d**2/(1. + s**2)) + m[0] - g = lambda d: -sqrt(d**2/(1. + s**2)) + m[0] + def f(d): + return sqrt(d**2/(1. + s**2)) + m[0] + + def g(d): + return -sqrt(d**2/(1. + s**2)) + m[0] odd_x = f even_x = g if p1[0] == p2[0]: - odd_y = lambda d: m[1] + def odd_y(d): + return m[1] + even_y = odd_y else: - odd_y = lambda x: y(f(x)) - even_y = lambda x: y(g(x)) + def odd_y(x): + return y(f(x)) + + def even_y(x): + return y(g(x)) else: - odd_x = lambda d: m[0] + def odd_x(d): + return m[0] + even_x = odd_x - odd_y = lambda d: m[1] + d - even_y = lambda d: m[1] - d - odd_xy = lambda d: (odd_x(d), odd_y(d)) - even_xy = lambda d: (even_x(d), even_y(d)) + + def odd_y(d): + return m[1] + d + + def even_y(d): + return m[1] - d + + def odd_xy(d): + return (odd_x(d), odd_y(d)) + + def even_xy(d): + return (even_x(d), even_y(d)) # We now have the control points for each Bezier curve # in terms of distance parameter d. @@ -907,7 +928,7 @@ def set_edges(self, **edge_options): edges_to_draw[a, b] = [local_labels[-1]] is_directed = self._graph.is_directed() - for a,b in edges_to_draw: + for a, b in edges_to_draw: if self._arcdigraph: ph = self._polar_hack_for_multidigraph C, D = ph(self._pos[a], self._pos[b], self._vertex_radius) @@ -946,7 +967,7 @@ def _polar_hack_for_multidigraph(self, A, B, VR): """ Helper function to quickly compute the two points of intersection of a line segment from ``A`` to ``B`` (provided as xy pairs) and - circles centered at ``A`` and ``B``, both with radius ``VR``. + circles centered at ``A`` and ``B``, both with radius ``VR``. Returns a pair of xy pairs representing the two points. EXAMPLES:: @@ -1518,7 +1539,7 @@ def slide(v, dx): pos[p] = x, y else: x = sum([pos[c][0] for c in cp]) / float(len(cp)) - pos[p] = x,y + pos[p] = x, y ox = obstruction[y] if x < ox: slide(p, ox - x) diff --git a/src/sage/graphs/graph_plot_js.py b/src/sage/graphs/graph_plot_js.py index c49bbb25d58..3843cafec07 100644 --- a/src/sage/graphs/graph_plot_js.py +++ b/src/sage/graphs/graph_plot_js.py @@ -74,18 +74,18 @@ """ from sage.misc.temporary_file import tmp_filename from sage.misc.lazy_import import lazy_import -lazy_import("sage.plot.colors", "rainbow") import os +lazy_import("sage.plot.colors", "rainbow") -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2013 Nathann Cohen # Brice Onfroy # # 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/ +# **************************************************************************** def gen_html_code(G, From b6db5845aee95d456544f684dd12f54b64b32e67 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 25 Jun 2022 18:58:48 +0200 Subject: [PATCH 134/416] trac #34079: pycodestyle cleanup --- src/sage/graphs/hypergraph_generators.py | 3 +- src/sage/graphs/independent_sets.pyx | 9 +- src/sage/graphs/isgci.py | 89 +++++++++++-------- .../graphs/isoperimetric_inequalities.pyx | 47 +++++----- src/sage/graphs/line_graph.pyx | 13 ++- src/sage/graphs/lovasz_theta.py | 3 +- 6 files changed, 90 insertions(+), 74 deletions(-) diff --git a/src/sage/graphs/hypergraph_generators.py b/src/sage/graphs/hypergraph_generators.py index 03b4c4343e0..e90beaee76d 100644 --- a/src/sage/graphs/hypergraph_generators.py +++ b/src/sage/graphs/hypergraph_generators.py @@ -31,6 +31,7 @@ --------------------- """ + class HypergraphGenerators(): r""" A class consisting of constructors for common hypergraphs. @@ -181,7 +182,7 @@ def nauty(self, number_of_sets, number_of_vertices, nauty_input += " -d" + str(vertex_min_degree) + ":" + str(set_min_size) nauty_input += " -D" + str(vertex_max_degree) + ":" + str(set_max_size) - nauty_input += " " + str(number_of_vertices) + " " + str(number_of_sets) + " " + nauty_input += " " + str(number_of_vertices) + " " + str(number_of_sets) + " " sp = subprocess.Popen(shlex.quote(genbgL_path) + " {0}".format(nauty_input), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, diff --git a/src/sage/graphs/independent_sets.pyx b/src/sage/graphs/independent_sets.pyx index 372a191bf8c..8da6ec22544 100644 --- a/src/sage/graphs/independent_sets.pyx +++ b/src/sage/graphs/independent_sets.pyx @@ -28,6 +28,7 @@ cdef inline int ismaximal(binary_matrix_t g, int n, bitset_t s): return True + cdef class IndependentSets: r""" The set of independent sets of a graph. @@ -256,7 +257,7 @@ cdef class IndependentSets: count += 1 if not self.count_only: - yield [self.vertices[j] for j in range(i + 1) if bitset_in(tmp,j)] + yield [self.vertices[j] for j in range(i + 1) if bitset_in(tmp, j)] continue else: @@ -380,11 +381,11 @@ cdef class IndependentSets: try: bitset_set_first_n(s, 0) - for I in S: + for v in S: try: - i = self.vertex_to_int[I] + i = self.vertex_to_int[v] except KeyError: - raise ValueError(str(I) + " is not a vertex of the graph") + raise ValueError(str(v) + " is not a vertex of the graph") # Adding the new vertex to s bitset_add(s, i) diff --git a/src/sage/graphs/isgci.py b/src/sage/graphs/isgci.py index 811ce322156..fb1e0c2f49f 100644 --- a/src/sage/graphs/isgci.py +++ b/src/sage/graphs/isgci.py @@ -396,22 +396,24 @@ class is defined by the exclusion of subgraphs, one can write a generic from sage.structure.unique_representation import CachedRepresentation, UniqueRepresentation from sage.misc.unknown import Unknown from sage.env import GRAPHS_DATA_DIR +from sage.misc.cachefunc import cached_method import os import zipfile from urllib.request import urlopen from ssl import create_default_context as default_context -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2011 Nathann Cohen # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** _XML_FILE = "isgci_sage.xml" _SMALLGRAPHS_FILE = "smallgraphs.txt" + class GraphClass(SageObject, CachedRepresentation): r""" An instance of this class represents a Graph Class, matching some entry in @@ -437,7 +439,7 @@ class GraphClass(SageObject, CachedRepresentation): """ def __init__(self, name, gc_id, recognition_function=None): r""" - Class constructor + Class constructor. INPUT: @@ -460,7 +462,7 @@ class represented by ``gc_id`` ?* def _repr_(self): r""" - Returns a short description of the class + Return a short description of the class. EXAMPLES:: @@ -471,7 +473,7 @@ def _repr_(self): def __hash__(self): r""" - Returns the class' ID hash + Return the class' ID hash. EXAMPLES:: @@ -482,7 +484,7 @@ def __hash__(self): def __le__(self, other): r""" - <= operator + <= operator. EXAMPLES:: @@ -493,7 +495,7 @@ def __le__(self, other): def __ge__(self, other): r""" - >= operator + >= operator. EXAMPLES:: @@ -501,14 +503,14 @@ def __ge__(self, other): True """ inclusion_digraph = GraphClasses().inclusion_digraph() - if inclusion_digraph.shortest_path(self._gc_id,other._gc_id): + if inclusion_digraph.shortest_path(self._gc_id, other._gc_id): return True else: return Unknown def __eq__(self, other): r""" - == operator + == operator. EXAMPLES:: @@ -519,7 +521,7 @@ def __eq__(self, other): def __lt__(self, other): r""" - >, !=, and < operators + >, !=, and < operators. EXAMPLES:: @@ -542,7 +544,7 @@ def __lt__(self, other): def forbidden_subgraphs(self): r""" - Returns the list of forbidden induced subgraphs defining the class. + Return the list of forbidden induced subgraphs defining the class. If the graph class is not defined by a *finite* list of forbidden induced subgraphs, ``None`` is returned instead. @@ -561,7 +563,7 @@ def forbidden_subgraphs(self): classes = GraphClasses().classes() gc = classes[self._gc_id] - if gc.get("type",None) != "forbidden": + if gc.get("type", None) != "forbidden": return None excluded = gc.get("smallgraph", None) @@ -569,7 +571,7 @@ def forbidden_subgraphs(self): if not excluded: return None - if not isinstance(excluded,list): + if not isinstance(excluded, list): excluded = [excluded] smallgraphs = GraphClasses().smallgraphs() @@ -581,7 +583,7 @@ def forbidden_subgraphs(self): def __contains__(self, g): r""" - Tests if ``g`` belongs to the graph class represented by ``self``. + Check if ``g`` belongs to the graph class represented by ``self``. EXAMPLES:: @@ -615,7 +617,7 @@ def __contains__(self, g): excluded = self.forbidden_subgraphs() if excluded is None: - raise NotImplementedError("No recognition algorithm is available "+ + raise NotImplementedError("No recognition algorithm is available " "for this class.") for gg in excluded: @@ -626,7 +628,7 @@ def __contains__(self, g): def description(self): r""" - Prints the information of ISGCI about the current class. + Print the information of ISGCI about the current class. EXAMPLES:: @@ -673,16 +675,15 @@ def description(self): print("\nProblems :") print("-" * 11) - for pbname,data in sorted(cls["problem"].items()): + for pbname, data in sorted(cls["problem"].items()): if "complexity" in data: print("{:30} : {}".format(pbname, data["complexity"])) -from sage.misc.cachefunc import cached_method class GraphClasses(UniqueRepresentation): def get_class(self, id): r""" - Returns the class corresponding to the given id in the ISGCI database. + Return the class corresponding to the given id in the ISGCI database. INPUT: @@ -718,12 +719,14 @@ def get_class(self, id): return GraphClass(name, id) else: - raise ValueError("The given class id does not exist in the ISGCI database. Is the db too old ? You can update it with graph_classes.update_db().") + raise ValueError("The given class id does not exist in the ISGCI " + "database. Is the db too old ? You can update it " + "with graph_classes.update_db().") @cached_method def classes(self): r""" - Returns the graph classes, as a dictionary. + Return the graph classes, as a dictionary. Upon the first call, this loads the database from the local XML file. Subsequent calls are cached. @@ -746,7 +749,7 @@ def classes(self): @cached_method def inclusions(self): r""" - Returns the graph class inclusions + Return the graph class inclusions. OUTPUT: @@ -769,7 +772,7 @@ def inclusions(self): @cached_method def smallgraphs(self): r""" - Returns a dictionary associating a graph to a graph description string. + Return a dictionary associating a graph to a graph description string. Upon the first call, this loads the database from the local XML files. Subsequent calls are cached. @@ -794,7 +797,7 @@ def smallgraphs(self): @cached_method def inclusion_digraph(self): r""" - Returns the class inclusion digraph + Return the class inclusion digraph. Upon the first call, this loads the database from the local XML file. Subsequent calls are cached. @@ -804,7 +807,7 @@ def inclusion_digraph(self): sage: g = graph_classes.inclusion_digraph(); g Digraph on ... vertices """ - classes = self.classes() + classes = self.classes() inclusions = self.inclusions() from sage.graphs.digraph import DiGraph @@ -812,7 +815,7 @@ def inclusion_digraph(self): inclusion_digraph.add_vertices(classes.keys()) for edge in inclusions: - if edge.get("confidence","") == "unpublished": + if edge.get("confidence", "") == "unpublished": continue inclusion_digraph.add_edge(edge['super'], edge['sub']) @@ -820,7 +823,7 @@ def inclusion_digraph(self): def _download_db(self): r""" - Downloads the current version of the ISGCI db + Download the current version of the ISGCI db. EXAMPLES:: @@ -842,7 +845,7 @@ def _download_db(self): def _parse_db(self, directory): r""" - Parses the ISGCI database and stores its content in ``self``. + Parse the ISGCI database and stores its content in ``self``. INPUT: @@ -873,8 +876,8 @@ def _parse_db(self, directory): smallgraph_file = open(os.path.join(GRAPHS_DATA_DIR, _SMALLGRAPHS_FILE), 'r') smallgraphs = {} - for l in smallgraph_file.readlines(): - key, string = l.split("\t") + for line in smallgraph_file.readlines(): + key, string = line.split("\t") smallgraphs[key] = Graph(string) smallgraph_file.close() @@ -941,7 +944,7 @@ def _get_ISGCI(self): # Which copy is the most recent on the disk ? if (os.path.getmtime(os.path.join(SAGE_DB, _XML_FILE)) > - os.path.getmtime(os.path.join(GRAPHS_DATA_DIR, _XML_FILE))): + os.path.getmtime(os.path.join(GRAPHS_DATA_DIR, _XML_FILE))): directory = os.path.join(SAGE_DB, _XML_FILE) @@ -976,8 +979,8 @@ def show_all(self): # We want to print the different fields, and this dictionary stores the # maximal number of characters of each field. MAX = { - "id" : 0, - "type" : 0, + "id": 0, + "type": 0, "smallgraph": 0, "name": 0 } @@ -1002,20 +1005,29 @@ def sort_key(x): MAX[key] = min(length, MAX_LEN) # Head of the table - print(("{0:"+str(MAX["id"])+"} | {1:"+str(MAX["name"])+"} | {2:"+str(MAX["type"])+"} | {3:"+str(MAX["smallgraph"])+"}").format("id", "name", "type", "smallgraph")) + st = ("{:" + str(MAX["id"]) + "}").format("id") + st += (" | {:" + str(MAX["name"]) + "}").format("name") + st += (" | {:" + str(MAX["type"]) + "}").format("type") + st += (" | {:" + str(MAX["smallgraph"]) + "}").format("smallgraph") + print(st) print("-" * (sum(MAX.values())+9)) # Entries for entry in classes_list: ID = entry.get("id", "") name = entry.get("name", "") - type = entry.get("type", "") + typ = entry.get("type", "") smallgraph = entry.get("smallgraph", "") - print(("{0:"+str(MAX["id"])+"} | {1:"+str(MAX["name"])+"} | {2:"+str(MAX["type"])+"} | ").format(ID, name[:MAX_LEN], type[:MAX_LEN])+str(smallgraph)[:MAX_LEN]) + st = ("{:" + str(MAX["id"]) + "}").format(ID) + st += (" | {:" + str(MAX["name"]) + "}").format(name[:MAX_LEN]) + st += (" | {:" + str(MAX["type"]) + "}").format(typ[:MAX_LEN]) + st += " | " + str(smallgraph)[:MAX_LEN] + print(st) + def _XML_to_dict(root): r""" - Returns the XML data as a dictionary + Return the XML data as a dictionary. INPUT: @@ -1050,6 +1062,7 @@ def _XML_to_dict(root): return root.text return ans + graph_classes = GraphClasses() # Any object added to this list should also appear in the class' documentation, at the top of the file. diff --git a/src/sage/graphs/isoperimetric_inequalities.pyx b/src/sage/graphs/isoperimetric_inequalities.pyx index 513b9b2259f..20c1eda0d6d 100644 --- a/src/sage/graphs/isoperimetric_inequalities.pyx +++ b/src/sage/graphs/isoperimetric_inequalities.pyx @@ -10,14 +10,14 @@ Authors: - Peleg Michaeli - Vincent Delecroix """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2018 Vincent Delecroix <20100.delecroix@gmail.com> # # 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/ +# **************************************************************************** from cysignals.signals cimport sig_on, sig_off @@ -30,6 +30,7 @@ from sage.graphs.base.static_dense_graph cimport dense_graph_init from sage.rings.infinity import Infinity from sage.rings.rational_field import QQ + def cheeger_constant(g): r""" Return the cheeger constant of the graph. @@ -96,7 +97,7 @@ def cheeger_constant(g): elif g.num_verts() == 1: return Infinity elif not g.is_connected(): - return QQ((0,1)) + return QQ((0, 1)) cdef short_digraph sd # a copy of the graph g cdef int * subgraph # vertices of the subgraph (stack) @@ -174,6 +175,7 @@ def cheeger_constant(g): sig_free(bitsubgraph) sig_off() + def edge_isoperimetric_number(g): r""" Return the edge-isoperimetric number of the graph. @@ -231,21 +233,21 @@ def edge_isoperimetric_number(g): elif g.num_verts() == 1: return Infinity elif not g.is_connected(): - return QQ((0,1)) + return QQ((0, 1)) cdef short_digraph sd # a copy of the graph g cdef int * subgraph # vertices of the subgraph (stack) cdef int * bitsubgraph # vertices of the subgraph (bit array of +1 (in) or -1 (not in)) cdef int k = 0 # number of vertices in subgraph cdef unsigned long vol = 0 # number of edges in the subgraph - cdef unsigned long boundary = 0 # number of edges in the boundary + cdef unsigned long boundary = 0 # number of edges in the boundary cdef int u = 0 # current vertex cdef int i init_short_digraph(sd, g) - cdef unsigned long bmin = sd.neighbors[1] - sd.neighbors[0] # value of boundary for the min - cdef unsigned long vmin = 1 # value of the volume for the min + cdef unsigned long bmin = sd.neighbors[1] - sd.neighbors[0] # value of boundary for the min + cdef unsigned long vmin = 1 # value of the volume for the min subgraph = check_malloc(sd.n * sizeof(int)) bitsubgraph = check_malloc(sd.n * sizeof(int)) @@ -312,6 +314,7 @@ def edge_isoperimetric_number(g): sig_free(subgraph) sig_free(bitsubgraph) + def vertex_isoperimetric_number(g): r""" Return the vertex-isoperimetric number of the graph. @@ -386,11 +389,11 @@ def vertex_isoperimetric_number(g): binary_matrix_init(stack, 3 * (n / 2) + 4, n) cdef bitset_t candidates = stack.rows[3 * (n / 2) + 3] - cdef bitset_t left # vertices not yet explored - cdef bitset_t current # vertices in the current subset - cdef bitset_t boundary # union of neighbors of vertices in current subset + cdef bitset_t left # vertices not yet explored + cdef bitset_t current # vertices in the current subset + cdef bitset_t boundary # union of neighbors of vertices in current subset - cdef int l = 0 + cdef int level = 0 cdef int p = n cdef int q = 0 cdef int c, b, v @@ -400,12 +403,12 @@ def vertex_isoperimetric_number(g): bitset_clear(stack.rows[v]) bitset_complement(stack.rows[0], stack.rows[0]) - while l >= 0: + while level >= 0: # We take the values at the top of the stack - left = stack.rows[l] - current = stack.rows[l + 1] - boundary = stack.rows[l + 2] + left = stack.rows[level] + current = stack.rows[level + 1] + boundary = stack.rows[level + 2] if bitset_isempty(current): bitset_copy(candidates, left) @@ -414,7 +417,7 @@ def vertex_isoperimetric_number(g): if bitset_isempty(candidates): # We decrease l to pop the stack - l -= 3 + level -= 3 # If the current set if non empty, we update the lower bound c = bitset_len(current) @@ -436,11 +439,11 @@ def vertex_isoperimetric_number(g): if bitset_len(current) < k: # We continue with v in the subset current - l += 3 - bitset_copy(stack.rows[l], left) - bitset_copy(stack.rows[l + 1], current) - bitset_add(stack.rows[l + 1], v) - bitset_union(stack.rows[l + 2], boundary, DG.rows[v]) + level += 3 + bitset_copy(stack.rows[level], left) + bitset_copy(stack.rows[level + 1], current) + bitset_add(stack.rows[level + 1], v) + bitset_union(stack.rows[level + 2], boundary, DG.rows[v]) binary_matrix_free(stack) binary_matrix_free(DG) diff --git a/src/sage/graphs/line_graph.pyx b/src/sage/graphs/line_graph.pyx index 592b6a50be3..8c15840f469 100644 --- a/src/sage/graphs/line_graph.pyx +++ b/src/sage/graphs/line_graph.pyx @@ -363,7 +363,7 @@ def line_graph(g, labels=True): for v in g: # Connect appropriate incident edges of the vertex v G.add_edges((e, f) for e in g.incoming_edge_iterator(v, labels=labels) - for f in g.outgoing_edge_iterator(v, labels=labels)) + for f in g.outgoing_edge_iterator(v, labels=labels)) return G else: from sage.graphs.graph import Graph @@ -414,9 +414,10 @@ def line_graph(g, labels=True): return G + def root_graph(g, verbose=False): r""" - Return the root graph corresponding to the given graph ``g`` + Return the root graph corresponding to the given graph ``g``. See the documentation of :mod:`sage.graphs.line_graph` to know how it works. @@ -490,7 +491,7 @@ def root_graph(g, verbose=False): # Diamond Graph ? elif g.order() == 4 and g.size() == 5: from sage.graphs.graph import Graph - root = Graph([(0,1),(1,2),(2,0),(0,3)]) + root = Graph([(0, 1), (1, 2), (2, 0), (0, 3)]) return (root, g.is_isomorphic(root.line_graph(labels=False), certificate=True)[1]) @@ -573,7 +574,7 @@ def root_graph(g, verbose=False): # together in any clique we have found so far, we add xy to the list of # cliques describing our covering. - for x,y in [(u, v), (v, w), (w, u)]: + for x, y in [(u, v), (v, w), (w, u)]: # If edge xy does not appear in any of the cliques associated with y if all(x not in C for C in v_cliques[y]): @@ -629,7 +630,3 @@ def root_graph(g, verbose=False): return R, isom else: raise ValueError(not_line_graph) - - - - diff --git a/src/sage/graphs/lovasz_theta.py b/src/sage/graphs/lovasz_theta.py index 7cf6726a34d..bd18dcb944e 100644 --- a/src/sage/graphs/lovasz_theta.py +++ b/src/sage/graphs/lovasz_theta.py @@ -14,9 +14,10 @@ --------- """ + def lovasz_theta(graph): r""" - Return the value of Lovász theta-function of graph + Return the value of Lovász theta-function of graph. For a graph `G` this function is denoted by `\theta(G)`, and it can be computed in polynomial time. Mathematically, its most important property is From 0d0f1b6165d25249458bd43ec320344b141d6825 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 19:33:18 +0200 Subject: [PATCH 135/416] 33760: do not assume that self._pos exists --- src/sage/graphs/generic_graph.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 08d39c08c70..304b42202bb 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -3512,7 +3512,10 @@ def get_pos(self, dim=2): 9: (0.475..., 0.154...)} """ if dim == 2: - pos = self._pos + try: + pos = self._pos + except AttributeError: + pos = None elif dim == 3: try: pos = self._pos3d From 7d1d6ca71da58090384fd2adfb0b596b17e35347 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 19:37:10 +0200 Subject: [PATCH 136/416] 33760: get_pos now automatically correct in WienerArayaGraph --- src/sage/graphs/generators/smallgraphs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index dd4296e37da..d7c1a838be6 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -4581,7 +4581,6 @@ def WienerArayaGraph(): g.add_edge((3, 4), (2, 14)) g.add_edge((3, 1), (3, 4)) - g.get_pos().pop(0) g.relabel() return g From 018ab518463054fec693b84df3daec1246cbb198 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 20:32:37 +0200 Subject: [PATCH 137/416] 33760: document the new behavior --- src/sage/graphs/generic_graph.py | 45 +++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 304b42202bb..60930213198 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2672,6 +2672,27 @@ def get_embedding(self): 1 sage: G.get_embedding() {0: [1, 4, 5], 1: [0, 2, 6], 2: [1, 3, 7], 3: [2, 4, 8], 4: [0, 3, 9], 5: [0, 7, 8], 6: [1, 9, 8], 7: [2, 5, 9], 8: [3, 6, 5], 9: [4, 6, 7]} + + Note that the embeddings gets properly modified on vertex or edge deletion:: + + sage: G.delete_edge(0, 1) + sage: G.delete_vertex(3) + sage: G.get_embedding() + {0: [4, 5], + 1: [2, 6], + 2: [1, 7], + 4: [0, 9], + 5: [0, 7, 8], + 6: [1, 9, 8], + 7: [2, 5, 9], + 8: [6, 5], + 9: [4, 6, 7]} + + But not under edge addition:: + + sage: G.add_edge(0, 7) + sage: G.get_embedding() is None + True """ try: embedding = self._embedding @@ -3510,6 +3531,20 @@ def get_pos(self, dim=2): {0: (0.0, 1.0), ... 9: (0.475..., 0.154...)} + + Note that the position dictionary is modified on vertex removal:: + + sage: G.delete_vertex(0) + sage: G.get_pos() + {1: (-0.9510565163, 0.3090169944), + ... + 9: (0.47552825815, 0.1545084972)} + + But is deleted on vertex addition:: + + sage: G.add_vertex(0) + sage: G.get_pos() is None + True """ if dim == 2: try: @@ -3600,11 +3635,13 @@ def set_pos(self, pos, dim=2): ... 9: (..., ...)} + The method :meth:`get_pos` check the position dictionary so that + invalid positioning are ignored:: + sage: G.set_pos(dict(enumerate('abcdefghi'))) - sage: P = G.plot() - Traceback (most recent call last): - ... - IndexError: string index out of range + sage: P = G.plot() # positions are ignored + sage: G.get_pos() is None + True """ if pos is None: return From 3eec5d25dd47bd03382e94066d4d1ff175f88b1e Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 20:33:21 +0200 Subject: [PATCH 138/416] 33760: use _check_pos_validity in get_pos --- src/sage/graphs/generic_graph.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 60930213198..bd9bfe725ca 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2774,7 +2774,10 @@ def _check_embedding_validity(self, embedding=None, boolean=True): """ if embedding is None: - embedding = getattr(self, '_embedding', None) + try: + embedding = self._embedding + except AttributeError: + pass if embedding is None: if boolean: return False @@ -3565,14 +3568,12 @@ def get_pos(self, dim=2): if v not in self: del pos[v] - # take care of possible vertex addition - for v in self: - if v not in pos: - if dim == 2: - self._pos = None - else: - self._pos3d = None - break + if self._check_pos_validity(dim=dim): + return pos + elif dim == 2: + pos = self._pos = None + else: + pos = self._pos3d = None return pos @@ -3603,7 +3604,16 @@ def _check_pos_validity(self, pos=None, dim=2): True """ if pos is None: - pos = self.get_pos(dim=dim) + if dim == 2: + try: + pos = self._pos + except AttributeError: + pass + elif dim == 3: + try: + pos = self._pos3d + except AttributeError: + pass if pos is None: return False if len(pos) != self.order(): From fc6bf58ce8e1766f6106d47ad22264b913c9a7d4 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 20:33:45 +0200 Subject: [PATCH 139/416] 33760: fix to _circular/_line embeddings and generators --- src/sage/graphs/generators/basic.py | 12 ++++----- src/sage/graphs/generic_graph.py | 39 ++++++++++++++++++----------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py index 21f56b31891..b11d9dc5d2b 100644 --- a/src/sage/graphs/generators/basic.py +++ b/src/sage/graphs/generators/basic.py @@ -730,23 +730,23 @@ def ToroidalGrid2dGraph(p, q): sage: tgrid.is_regular() True """ - g = Grid2dGraph(p, q, set_positions=False) + g = Grid2dGraph(p, q, set_positions=True) g.add_edges([((i, 0), (i, q - 1)) for i in range(p)]) g.add_edges([((0, i), (p - 1, i)) for i in range(q)]) g.name("Toroidal 2D Grid Graph with parameters {},{}".format(p, q)) - d = g.get_pos() + pos = g._pos p += 0. q += 0. uf = (p / 2) * (p / 2) vf = (q / 2) * (q / 2) - for u, v in d: - x, y = d[u, v] + for u, v in g: + x, y = pos[u, v] x += 0.25 * (1.0 + u * (u - p + 1) / uf) - y += 0.25 * (1 + v * (v - q + 1) / vf) - d[u, v] = (x, y) + y += 0.25 * (1.0 + v * (v - q + 1) / vf) + pos[u, v] = (x, y) return g diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index bd9bfe725ca..8a76a7fc6f7 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -20042,9 +20042,16 @@ def _circle_embedding(self, vertices, center=(0, 0), radius=1, shift=0, angle=0, c_x, c_y = center vertices = list(vertices) n = len(vertices) - d = self.get_pos() - if d is None or return_dict: - d = {} + + if return_dict: + pos = {} + else: + try: + pos = self._pos + except AttributeError: + pass + if pos is None: + pos = self._pos = {} from math import sin, cos, pi for i,v in enumerate(vertices): @@ -20053,12 +20060,10 @@ def _circle_embedding(self, vertices, center=(0, 0), radius=1, shift=0, angle=0, # when asking for sin(pi) v_x = c_x + radius * round(cos(angle + 2*i*pi / n), 10) v_y = c_y + radius * round(sin(angle + 2*i*pi / n), 10) - d[v] = (v_x, v_y) + pos[v] = (v_x, v_y) if return_dict: - return d - else: - self.set_pos(d) + return pos def _line_embedding(self, vertices, first=(0, 0), last=(0, 1), return_dict=False): r""" @@ -20109,9 +20114,17 @@ def _line_embedding(self, vertices, first=(0, 0), last=(0, 1), return_dict=False {} """ vertices = list(vertices) - d = self.get_pos() - if d is None or return_dict: - d = {} + + if return_dict: + pos = {} + else: + pos = None + try: + pos = self._pos + except AttributeError: + pass + if pos is None: + pos = self._pos = {} n = len(vertices) - 1. @@ -20124,14 +20137,12 @@ def _line_embedding(self, vertices, first=(0, 0), last=(0, 1), return_dict=False dx = dy = 0 for v in vertices: - d[v] = (fx, fy) + pos[v] = (fx, fy) fx += dx fy += dy if return_dict: - return d - else: - self.set_pos(d) + return pos def graphplot(self, **options): """ From a4c4ef4b111ec585ccd40e6707a6751aa3f81c80 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sat, 25 Jun 2022 21:30:07 +0200 Subject: [PATCH 140/416] 33760: do not call .get_pos() for invalid positionning in families --- src/sage/graphs/generators/families.py | 6 +++--- src/sage/graphs/generators/smallgraphs.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index 4e8ad05527b..d027606487c 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -3064,11 +3064,11 @@ def petersen_family(generate=False): g = Graph('Fs\\zw') g._circle_embedding([1, 2, 3]) g._circle_embedding([4, 5, 6], radius=.7) - g.get_pos()[0] = (0, 0) + g._pos[0] = (0, 0) l.append(g) g = Graph('GYQ[p{') g._circle_embedding([1, 4, 6, 0, 5, 7, 3], shift=0.25) - g.get_pos()[2] = (0, 0) + g._pos[2] = (0, 0) l.append(g) return l @@ -3601,7 +3601,7 @@ def RingedTree(k, vertex_labels = True): g._circle_embedding(vertices, radius = radius, shift = shift) # Specific position for the central vertex - g.get_pos()[0] = (0,0.2) + g._pos[0] = (0,0.2) # Relabel vertices as binary words if not vertex_labels: diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index d7c1a838be6..7ba7c518dcb 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -1213,7 +1213,7 @@ def BlanusaFirstSnarkGraph(): g.add_cycle(list(range(17))) g._circle_embedding(list(range(17)), shift=0.25) - g.get_pos()[17] = (0, 0) + g._pos[17] = (0, 0) return g def BlanusaSecondSnarkGraph(): @@ -1705,7 +1705,7 @@ def KittellGraph(): g._circle_embedding(list(range(3)), shift=.75) g._circle_embedding(list(range(3, 13)), radius=.4) g._circle_embedding(list(range(15, 22)), radius=.2, shift=-.15) - pos = g.get_pos() + pos = g._pos pos[13] = (-.65, -.35) pos[14] = (.65, -.35) pos[22] = (0, 0) @@ -1872,7 +1872,7 @@ def CoxeterGraph(): g._circle_embedding(list(range(24))) g._circle_embedding([24, 25, 26], radius=.5) - g.get_pos()[27] = (0, 0) + g._pos[27] = (0, 0) g.name("Coxeter Graph") @@ -2189,7 +2189,7 @@ def EllinghamHorton54Graph(): g._circle_embedding(list(range(40, 46)), center=(1.5, -1), radius=.5) g._circle_embedding(list(range(46, 52)), center=(1.5, -1), radius=.7) - d = g.get_pos() + d = g._pos d[52] = (-.3, -2.5) d[53] = (.3, -2.5) d[31] = (-2.2, -.9) @@ -2258,7 +2258,7 @@ def EllinghamHorton78Graph(): g._circle_embedding([45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 75, 59], center=(2.5, -1.5)) - d = g.get_pos() + d = g._pos d[76] = (-.2, -.1) d[77] = (.2, .1) @@ -3828,7 +3828,7 @@ def PoussinGraph(): g._circle_embedding(list(range(3)), shift=.75) g._circle_embedding(list(range(3, 9)), radius=.4, shift=0) g._circle_embedding(list(range(9, 14)), radius=.2, shift=.4) - g.get_pos()[14] = (0,0) + g._pos[14] = (0,0) return g @@ -4173,7 +4173,7 @@ def SousselierGraph(): g.add_edges([(15, i) for i in range(15) if i % 3 == 1]) g._circle_embedding(list(range(15)), shift=-.25) - g.get_pos()[15] = (0, 0) + g._pos[15] = (0, 0) return g @@ -4461,7 +4461,7 @@ def TutteGraph(): radius=.2, center=(.6*cos(2*(i+.25)*pi/3), .6*sin(2*(i+.25)*pi/3))) - g.get_pos()[0] = (0,0) + g._pos[0] = (0,0) return g From 5335c9990010669dc17f2bb3f557edfce8e80997 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 22 Jan 2022 19:49:27 -0800 Subject: [PATCH 141/416] build/pkgs/singular: Update to 4.3.0 --- build/pkgs/singular/checksums.ini | 8 ++++---- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index 3c8c447438c..f99493d4429 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=f257a0ef23cedb2c8f9514bbc5f292ca3660a244 -md5=8b9142f42cb73aede3940ef3c5f9586d -cksum=2019987428 -upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-2-1/singular-VERSION.tar.gz +sha1=332a9c0cd34500d791ff548ef0b0370da556bf2c +md5=7d38c3db1a7582ea633ba3ed65491444 +cksum=297542356 +upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-0/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index 370c4b6aa79..80895903a15 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.2.1p3 +4.3.0 From 4751d61477c89f1f3e03a57e9b570e0289a215e2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Jun 2022 17:00:58 -0700 Subject: [PATCH 142/416] build/pkgs/singular: Update to 4.3.0p1 --- build/pkgs/singular/checksums.ini | 6 +++--- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index f99493d4429..2b3d55f8284 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=332a9c0cd34500d791ff548ef0b0370da556bf2c -md5=7d38c3db1a7582ea633ba3ed65491444 -cksum=297542356 +sha1=21b119800a4665fc3395ed1de66ad260d4edba47 +md5=780f3dd480d71e7c0446eec10a84fc1e +cksum=215260754 upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-0/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index 80895903a15..d118bb725f3 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.3.0 +4.3.0p1 From 43e9999620a0c3f99218edd3d00e3c3c340bd28e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Jun 2022 17:06:15 -0700 Subject: [PATCH 143/416] build/pkgs/singular/patches/1128.patch: Remove (upstreamed) --- build/pkgs/singular/patches/1128.patch | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 build/pkgs/singular/patches/1128.patch diff --git a/build/pkgs/singular/patches/1128.patch b/build/pkgs/singular/patches/1128.patch deleted file mode 100644 index f5ebfc69f5c..00000000000 --- a/build/pkgs/singular/patches/1128.patch +++ /dev/null @@ -1,22 +0,0 @@ -From bc7e82b6e8efcdc2a912e66194fc7ecb188de4b2 Mon Sep 17 00:00:00 2001 -From: Matthias Koeppe -Date: Mon, 31 Jan 2022 23:13:55 -0800 -Subject: [PATCH 1/2] kernel/oswrapper/vspace.cc: #include for - offsetof on GCC 12 - ---- - kernel/oswrapper/vspace.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/kernel/oswrapper/vspace.cc b/kernel/oswrapper/vspace.cc -index 2bded23c0d..66eea3f810 100644 ---- a/kernel/oswrapper/vspace.cc -+++ b/kernel/oswrapper/vspace.cc -@@ -5,6 +5,7 @@ - #ifdef HAVE_CPP_THREADS - #include - #endif -+#include - - #if defined(__GNUC__) && (__GNUC__<9) &&!defined(__clang__) - From 55a1033b4ec4ca5cfe2159c4ae97c9b5c50d35da Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 26 Jun 2022 15:50:56 +0200 Subject: [PATCH 144/416] trac #34086: E231 in strongly_regular_db.pyx - part 1 --- src/sage/graphs/strongly_regular_db.pyx | 120 ++++++++++++------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index 16b2506e545..90f2cc42c72 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -48,7 +48,7 @@ cdef dict _brouwer_database = None _small_srg_database = None @cached_function -def is_paley(int v,int k,int l,int mu): +def is_paley(int v, int k, int l, int mu): r""" Test whether some Paley graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -80,7 +80,7 @@ def is_paley(int v,int k,int l,int mu): return (PaleyGraph,v) @cached_function -def is_mathon_PC_srg(int v,int k,int l,int mu): +def is_mathon_PC_srg(int v, int k, int l, int mu): r""" Test whether some Mathon's Pseudocyclic s.r.g. is `(v,k,\lambda,\mu)`-strongly regular. @@ -178,7 +178,7 @@ def is_muzychuk_S6(int v, int k, int l, int mu): d += 1 @cached_function -def is_orthogonal_array_block_graph(int v,int k,int l,int mu): +def is_orthogonal_array_block_graph(int v, int k, int l, int mu): r""" Test whether some (pseudo)Orthogonal Array graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -229,7 +229,7 @@ def is_orthogonal_array_block_graph(int v,int k,int l,int mu): # https://www.win.tue.nl/~aeb/graphs/OA.html from sage.combinat.matrices.hadamard_matrix import skew_hadamard_matrix try: - m, n = latin_squares_graph_parameters(v,k,l,mu) + m, n = latin_squares_graph_parameters(v, k, l, mu) except Exception: return if orthogonal_array(m,n,existence=True) is True: @@ -246,7 +246,7 @@ def is_orthogonal_array_block_graph(int v,int k,int l,int mu): return (G, (n+1)//4) @cached_function -def is_johnson(int v,int k,int l,int mu): +def is_johnson(int v, int k, int l, int mu): r""" Test whether some Johnson graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -282,7 +282,7 @@ def is_johnson(int v,int k,int l,int mu): return (lambda m: JohnsonGraph(m,2), m) @cached_function -def is_steiner(int v,int k,int l,int mu): +def is_steiner(int v, int k, int l, int mu): r""" Test whether some Steiner graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -327,7 +327,7 @@ def is_steiner(int v,int k,int l,int mu): return (lambda n, m: IntersectionGraph([frozenset(b) for b in balanced_incomplete_block_design(n, m)]), n, m) @cached_function -def is_affine_polar(int v,int k,int l,int mu): +def is_affine_polar(int v, int k, int l, int mu): r""" Test whether some Affine Polar graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -382,7 +382,7 @@ def is_affine_polar(int v,int k,int l,int mu): return (lambda d,q : AffineOrthogonalPolarGraph(d,q,sign='-'),2*e,q) @cached_function -def is_orthogonal_polar(int v,int k,int l,int mu): +def is_orthogonal_polar(int v, int k, int l, int mu): r""" Test whether some Orthogonal Polar graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -421,7 +421,7 @@ def is_orthogonal_polar(int v,int k,int l,int mu): (, 6, 3, '+') """ - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is None: return q_pow_m_minus_one = -s-1 if abs(s) > r else r+1 @@ -457,7 +457,7 @@ def is_orthogonal_polar(int v,int k,int l,int mu): return (OrthogonalPolarGraph, 2*m, q, "-") @cached_function -def is_goethals_seidel(int v,int k,int l,int mu): +def is_goethals_seidel(int v, int k, int l, int mu): r""" Test whether some :func:`~sage.graphs.graph_generators.GraphGenerators.GoethalsSeidelGraph` graph is @@ -533,7 +533,7 @@ def is_goethals_seidel(int v,int k,int l,int mu): return [GoethalsSeidelGraph, k_bibd, r_bibd] @cached_function -def is_NOodd(int v,int k,int l,int mu): +def is_NOodd(int v, int k, int l, int mu): r""" Test whether some NO^e(2n+1,q) graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -582,13 +582,13 @@ def is_NOodd(int v,int k,int l,int mu): sage: t = is_NOodd(5,5,5,5); t """ cdef int n, q - r,s = eigenvalues(v,k,l,mu) # -eq^(n-1)-1 and eq^(n-1)(q-2)-1; q=3 is special case + r, s = eigenvalues(v, k, l, mu) # -eq^(n-1)-1 and eq^(n-1)(q-2)-1; q=3 is special case if r is None: return r += 1 s += 1 if abs(r)>abs(s): - (r,s) = (s,r) # r=-eq^(n-1) s= eq^(n-1)(q-2) + (r, s) = (s, r) # r=-eq^(n-1) s= eq^(n-1)(q-2) q = 2 - s//r p, t = is_prime_power(q, get_data=True) pp, kk = is_prime_power(abs(r), get_data=True) @@ -603,7 +603,7 @@ def is_NOodd(int v,int k,int l,int mu): return (NonisotropicOrthogonalPolarGraph, 2*n+1, q, '+' if e==1 else '-') @cached_function -def is_NOperp_F5(int v,int k,int l,int mu): +def is_NOperp_F5(int v, int k, int l, int mu): r""" Test whether some NO^e,perp(2n+1,5) graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -641,11 +641,11 @@ def is_NOperp_F5(int v,int k,int l,int mu): sage: t = is_NOperp_F5(5,5,5,5); t """ cdef int n - r,s = eigenvalues(v,k,l,mu) # 2*e*5**(n-1), -e*5**(n-1); note exceptional case n=1 + r, s = eigenvalues(v, k, l, mu) # 2*e*5**(n-1), -e*5**(n-1); note exceptional case n=1 if r is None: return if abs(r)0 else -1 p, n = is_prime_power(abs(r), get_data=True) if (3 == p and n != 0): @@ -762,7 +762,7 @@ def is_NO_F3(int v,int k,int l,int mu): return (NonisotropicOrthogonalPolarGraph, 2*n, 3, '+' if e==1 else '-') @cached_function -def is_NU(int v,int k,int l,int mu): +def is_NU(int v, int k, int l, int mu): r""" Test whether some NU(n,q)-graph, is `(v,k,\lambda,\mu)`-strongly regular. @@ -800,18 +800,18 @@ def is_NU(int v,int k,int l,int mu): sage: t = is_NU(5,5,5,5); t """ cdef int n, q, e # special cases: n=3 or q=2 - r,s = eigenvalues(v,k,l,mu) #r,s = eq^{n-2} - 1, -e(q^2-q-1)q^{n-3} - 1, e=(-1)^n + r, s = eigenvalues(v, k, l, mu) # r,s = eq^{n-2} - 1, -e(q^2-q-1)q^{n-3} - 1, e=(-1)^n if r is None: return r += 1 s += 1 if abs(r)>abs(s): - (r,s) = (s,r) + (r, s) = (s, r) p, t = is_prime_power(abs(r), get_data=True) if p==2: # it can be that q=2, then we'd have r>s now pp, kk = is_prime_power(abs(s), get_data=True) if pp==2 and kk>0: - (r,s) = (s,r) + (r, s) = (s, r) p, t = is_prime_power(abs(r), get_data=True) if r==1: return @@ -829,7 +829,7 @@ def is_NU(int v,int k,int l,int mu): return (NonisotropicUnitaryPolarGraph, n, q) @cached_function -def is_haemers(int v,int k,int l,int mu): +def is_haemers(int v, int k, int l, int mu): r""" Test whether some HaemersGraph graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -870,7 +870,7 @@ def is_haemers(int v,int k,int l,int mu): return (HaemersGraph, q) @cached_function -def is_cossidente_penttila(int v,int k,int l,int mu): +def is_cossidente_penttila(int v, int k, int l, int mu): r""" Test whether some CossidentePenttilaGraph graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -915,7 +915,7 @@ def is_cossidente_penttila(int v,int k,int l,int mu): return (CossidentePenttilaGraph, q) @cached_function -def is_complete_multipartite(int v,int k,int l,int mu): +def is_complete_multipartite(int v, int k, int l, int mu): r""" Test whether some complete multipartite graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -963,7 +963,7 @@ def is_complete_multipartite(int v,int k,int l,int mu): @cached_function -def is_polhill(int v,int k,int l,int mu): +def is_polhill(int v, int k, int l, int mu): r""" Test whether some graph from [Pol2009]_ is `(1024,k,\lambda,\mu)`-strongly regular. @@ -1004,7 +1004,7 @@ def is_polhill(int v,int k,int l,int mu): sage: t = is_polhill(1024, 462, 206, 210); t [. at ...>] """ - if (v,k,l,mu) not in [(1024, 231, 38, 56), + if (v, k, l, mu) not in [(1024, 231, 38, 56), (1024, 264, 56, 72), (1024, 297, 76, 90), (1024, 330, 98, 110), @@ -1119,7 +1119,7 @@ def is_polhill(int v,int k,int l,int mu): if k == 462: return [lambda :additive_cayley(Dabcd[0]+Dabcd[1])] -def is_RSHCD(int v,int k,int l,int mu): +def is_RSHCD(int v, int k, int l, int mu): r""" Test whether some RSHCD graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -1145,10 +1145,10 @@ def is_RSHCD(int v,int k,int l,int mu): (64, 27, 10, 12) """ - if SRG_from_RSHCD(v,k,l,mu,existence=True) is True: - return [SRG_from_RSHCD,v,k,l,mu] + if SRG_from_RSHCD(v, k, l, mu, existence=True) is True: + return [SRG_from_RSHCD, v, k, l, mu] -def SRG_from_RSHCD(v,k,l,mu, existence=False,check=True): +def SRG_from_RSHCD(v, k, l, mu, existence=False,check=True): r""" Return a `(v,k,l,mu)`-strongly regular graph from a RSHCD @@ -1219,15 +1219,15 @@ def SRG_from_RSHCD(v,k,l,mu, existence=False,check=True): H = -H G = Graph((J(n)-I(n)-H+H[0,0]*I(n))/2,loops=False,multiedges=False,format="adjacency_matrix") if check: - assert G.is_strongly_regular(parameters=True) == (v,k,l,mu) + assert G.is_strongly_regular(parameters=True) == (v, k, l, mu) return G if existence: return False - raise ValueError("I do not know how to build a {}-SRG from a RSHCD".format((v,k,l,mu))) + raise ValueError("I do not know how to build a {}-SRG from a RSHCD".format((v, k, l, mu))) @cached_function -def is_unitary_polar(int v,int k,int l,int mu): +def is_unitary_polar(int v, int k, int l, int mu): r""" Test whether some Unitary Polar graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -1267,7 +1267,7 @@ def is_unitary_polar(int v,int k,int l,int mu): sage: t = is_unitary_polar(1105, 80, 15, 5); t (, 4, 4) """ - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is None: return q = k//mu @@ -1301,7 +1301,7 @@ def is_unitary_polar(int v,int k,int l,int mu): return (UnitaryPolarGraph, 2*d, p**t) @cached_function -def is_unitary_dual_polar(int v,int k,int l,int mu): +def is_unitary_dual_polar(int v, int k, int l, int mu): r""" Test whether some Unitary Dual Polar graph is `(v,k,\lambda,\mu)`-strongly regular. @@ -1333,7 +1333,7 @@ def is_unitary_dual_polar(int v,int k,int l,int mu): sage: is_unitary_dual_polar(6832, 270, 26, 10) (, 5, 3) """ - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is None: return q = mu - 1 @@ -1353,7 +1353,7 @@ def is_unitary_dual_polar(int v,int k,int l,int mu): return (UnitaryDualPolarGraph, 5, p**t) @cached_function -def is_GQqmqp(int v,int k,int l,int mu): +def is_GQqmqp(int v, int k, int l, int mu): r""" Test whether some `GQ(q-1,q+1)` or `GQ(q+1,q-1)`-graph is `(v,k,\lambda,\mu)`-srg. @@ -1501,7 +1501,7 @@ def is_twograph_descendant_of_srg(int v, int k0, int l, int mu): @cached_function -def is_taylor_twograph_srg(int v,int k,int l,int mu): +def is_taylor_twograph_srg(int v, int k, int l, int mu): r""" Test whether some Taylor two-graph SRG is `(v,k,\lambda,\mu)`-strongly regular. @@ -1535,7 +1535,7 @@ def is_taylor_twograph_srg(int v,int k,int l,int mu): (, 9) """ - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is None: return p,t = is_prime_power(v-1, get_data=True) @@ -1581,11 +1581,11 @@ def is_switch_skewhad(int v, int k, int l, int mu): from sage.combinat.matrices.hadamard_matrix import skew_hadamard_matrix from sage.graphs.generators.families import SwitchedSquaredSkewHadamardMatrixGraph cdef int n - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is None: return if r 4 and is_prime_power(q) and 0==r%2 and \ v == r*(q-1)**2 and \ @@ -1701,7 +1701,7 @@ def is_nowhere0_twoweight(int v, int k, int l, int mu): 8*mu == q*(q-3)*(q-4): return (Nowhere0WordsTwoWeightCodeGraph, q) -cdef eigenvalues(int v,int k,int l,int mu): +cdef eigenvalues(int v, int k, int l, int mu): r""" Return the eigenvalues of a (v,k,l,mu)-strongly regular graph. @@ -1805,7 +1805,7 @@ def eigenmatrix(int v, int k, int l, int mu): sage: eigenmatrix(5,5,5,-5) """ from sage.rings.integer_ring import ZZ - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is not None: return Matrix(ZZ, [[1,k,v-k-1],[1,r,-r-1],[1,s,-s-1]]) @@ -1832,7 +1832,7 @@ cpdef latin_squares_graph_parameters(int v,int k, int l,int mu): sage: latin_squares_graph_parameters(5,4,1,2) """ cdef int g, n - r,s = eigenvalues(v,k,l,mu) + r, s = eigenvalues(v, k, l, mu) if r is None: return if r < s: @@ -2669,10 +2669,10 @@ cdef bint seems_feasible(int v, int k, int l, int mu): if (v-1)*(mu-l)-2*k == 0: return two_squares_c(v,tmp) - rr,ss = eigenvalues(v,k,l,mu) + rr, ss = eigenvalues(v, k, l, mu) if rr is None: return False - r,s = rr,ss + r, s = rr, ss # p.87 of [BL1984]_ # "Integrality condition" @@ -2721,7 +2721,7 @@ cdef bint seems_feasible(int v, int k, int l, int mu): return True -def strongly_regular_graph(int v,int k,int l,int mu=-1,bint existence=False,bint check=True): +def strongly_regular_graph(int v, int k, int l, int mu=-1, bint existence=False, bint check=True): r""" Return a `(v,k,\lambda,\mu)`-strongly regular graph. @@ -2852,12 +2852,12 @@ def strongly_regular_graph(int v,int k,int l,int mu=-1,bint existence=False,bint if existence is True: return g G = g[0](*g[1:]) - if check and (v,k,l,mu) != G.is_strongly_regular(parameters=True): - params = (v,k,l,mu) + if check and (v, k, l, mu) != G.is_strongly_regular(parameters=True): + params = (v, k, l, mu) raise RuntimeError(f"Sage built an incorrect {params}-SRG.") return G -def strongly_regular_graph_lazy(int v,int k,int l,int mu=-1,bint existence=False): +def strongly_regular_graph_lazy(int v, int k, int l, int mu=-1, bint existence=False): r""" return a promise to build an `(v,k,l,mu)`-srg @@ -2895,10 +2895,10 @@ def strongly_regular_graph_lazy(int v,int k,int l,int mu=-1,bint existence=False if mu == -1: mu = k*(k-l-1)//(v-k-1) - params = (v,k,l,mu) + params = (v, k, l, mu) params_complement = (v,v-k-1,v-2*k+mu-2,v-2*k+l) - if not seems_feasible(v,k,l,mu): + if not seems_feasible(v, k, l, mu): if existence: return False raise ValueError(f"There exists no {params}-strongly regular graph") @@ -3029,14 +3029,14 @@ def apparently_feasible_parameters(int n): False """ - cdef int v,k,l,mu + cdef int v, k, l, mu feasible = set() for v in range(n): for k in range(1,v-1): for l in range(k-1): mu = k*(k-l-1)//(v-k-1) - if mu>0 and mu 0 and mu < k and seems_feasible(v, k, l, mu): + feasible.add((v, k, l, mu)) return feasible def _build_small_srg_database(): From 7e9dff95c44ed4e190ff53f7e5005f485ba40a8f Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sun, 26 Jun 2022 15:55:02 +0200 Subject: [PATCH 145/416] trac #34086: extra change on a modified line --- src/sage/graphs/strongly_regular_db.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index 90f2cc42c72..d12936fae20 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -1148,7 +1148,7 @@ def is_RSHCD(int v, int k, int l, int mu): if SRG_from_RSHCD(v, k, l, mu, existence=True) is True: return [SRG_from_RSHCD, v, k, l, mu] -def SRG_from_RSHCD(v, k, l, mu, existence=False,check=True): +def SRG_from_RSHCD(v, k, l, mu, existence=False, check=True): r""" Return a `(v,k,l,mu)`-strongly regular graph from a RSHCD From 1a2786d56e847a7fd7c3f9503b5c30b6332574ac Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sun, 26 Jun 2022 18:01:07 +0200 Subject: [PATCH 146/416] 33760: clarify documentation --- src/sage/graphs/generic_graph.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 8a76a7fc6f7..08879d20f8d 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2663,7 +2663,12 @@ def set_embedding(self, embedding): def get_embedding(self): """ - Return the stored embedding. + Return the stored embedding or ``None``. + + If the stored embedding is no longer valid (because of vertex/edge + additions) then the stored embedding is discarded and ``None`` is + returned. In case some vertex/edge has been deleted, the stored + embedding is updated accordingly. EXAMPLES:: From bfcb0311bcb614a0343f3a29807c6b3a79d4bf99 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sun, 26 Jun 2022 18:01:38 +0200 Subject: [PATCH 147/416] 33760: make doctest robust under numerical noise --- src/sage/graphs/generic_graph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 08879d20f8d..df75a68e0f8 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -3544,9 +3544,9 @@ def get_pos(self, dim=2): sage: G.delete_vertex(0) sage: G.get_pos() - {1: (-0.9510565163, 0.3090169944), + {1: (-0.951..., 0.309...), ... - 9: (0.47552825815, 0.1545084972)} + 9: (0.475..., 0.154...)} But is deleted on vertex addition:: From 89cced8b4dc45636dc21b48a4202872d9af54109 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sun, 26 Jun 2022 18:02:00 +0200 Subject: [PATCH 148/416] 33760: initialize pos = None --- src/sage/graphs/generic_graph.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index df75a68e0f8..8fd037e9590 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -20051,6 +20051,7 @@ def _circle_embedding(self, vertices, center=(0, 0), radius=1, shift=0, angle=0, if return_dict: pos = {} else: + pos = None try: pos = self._pos except AttributeError: From cce682e55759e4000ba94d685f049855c37ecb12 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com*> Date: Sun, 26 Jun 2022 18:02:15 +0200 Subject: [PATCH 149/416] 33760: fix get_embedding() for digraphs --- src/sage/graphs/generic_graph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 8fd037e9590..4b937a064e9 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2716,7 +2716,8 @@ def get_embedding(self): for u in embedding: i = 0 while i < len(embedding[u]): - if not self.has_edge(u, embedding[u][i]): + v = embedding[u][i] + if not (self.has_edge(u, v) or self.has_edge(v, u)): del embedding[u][i] else: i += 1 From 7d2438f0b5dbc618bf04c163c96f8a58f5823aee Mon Sep 17 00:00:00 2001 From: Emmanuel Charpentier Date: Sun, 26 Jun 2022 21:39:27 +0200 Subject: [PATCH 150/416] Fix Mathematica (back)translation of trig/hyperbolic functions. --- src/sage/functions/hyperbolic.py | 6 ++++- src/sage/functions/trig.py | 3 +++ src/sage/interfaces/mathematica.py | 35 ++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/sage/functions/hyperbolic.py b/src/sage/functions/hyperbolic.py index 2ca5284f505..4487a3b3641 100644 --- a/src/sage/functions/hyperbolic.py +++ b/src/sage/functions/hyperbolic.py @@ -604,6 +604,7 @@ def __init__(self): GinacFunction.__init__(self, "arccoth", latex_name=r"\operatorname{arcoth}", conversions=dict(maxima='acoth', sympy='acoth', + mathematica='ArcCoth', giac='acoth', fricas='acoth')) def _eval_numpy_(self, x): @@ -649,6 +650,7 @@ def __init__(self): GinacFunction.__init__(self, "arcsech", latex_name=r"\operatorname{arsech}", conversions=dict(maxima='asech', sympy='asech', + mathematica='ArcSech', fricas='asech')) def _eval_numpy_(self, x): @@ -701,7 +703,9 @@ def __init__(self): """ GinacFunction.__init__(self, "arccsch", latex_name=r"\operatorname{arcsch}", - conversions=dict(maxima='acsch', sympy='acsch', fricas='acsch')) + conversions=dict(maxima='acsch', + mathematica='ArcCsch', + sympy='acsch', fricas='acsch')) def _eval_numpy_(self, x): """ diff --git a/src/sage/functions/trig.py b/src/sage/functions/trig.py index a705648a8ce..fb97a5e8c58 100644 --- a/src/sage/functions/trig.py +++ b/src/sage/functions/trig.py @@ -738,6 +738,7 @@ def __init__(self): """ GinacFunction.__init__(self, 'arccot', latex_name=r"\operatorname{arccot}", conversions=dict(maxima='acot', sympy='acot', + mathematica='ArcCot', fricas='acot', giac='acot')) def _eval_numpy_(self, x): @@ -797,6 +798,7 @@ def __init__(self): """ GinacFunction.__init__(self, 'arccsc', latex_name=r"\operatorname{arccsc}", conversions=dict(maxima='acsc', sympy='acsc', + mathematica='ArcCsc', fricas='acsc', giac='acsc')) def _eval_numpy_(self, x): @@ -858,6 +860,7 @@ def __init__(self): """ GinacFunction.__init__(self, 'arcsec', latex_name=r"\operatorname{arcsec}", conversions=dict(maxima='asec', sympy='asec', + mathematica='ArcSec', fricas='asec', giac='asec')) def _eval_numpy_(self, x): diff --git a/src/sage/interfaces/mathematica.py b/src/sage/interfaces/mathematica.py index 78ea78dbacd..d52fee3441e 100644 --- a/src/sage/interfaces/mathematica.py +++ b/src/sage/interfaces/mathematica.py @@ -369,6 +369,41 @@ e^x sage: exp(x)._mathematica_().sage() # optional -- mathematica e^x + +Check that all trig/hypergolic functions and their reciprocals are correctly +translated to Mathematica (:trac:`34087`):: + + sage: x=var('x') + sage: FL=[sin, cos, tan, csc, sec, cot, sinh, cosh, tanh, csch, sech, coth] + sage: IFL=[arcsin, arccos, arctan, arccsc, arcsec, arccot, arcsinh, arccosh, + ....: arctanh, arccsch, arcsech, arccoth] + sage: [mathematica.TrigToExp(u(x)).sage() for u in FL] + [-1/2*I*e^(I*x) + 1/2*I*e^(-I*x), + 1/2*e^(I*x) + 1/2*e^(-I*x), + (-I*e^(I*x) + I*e^(-I*x))/(e^(I*x) + e^(-I*x)), + 2*I/(e^(I*x) - e^(-I*x)), + 2/(e^(I*x) + e^(-I*x)), + -(-I*e^(I*x) - I*e^(-I*x))/(e^(I*x) - e^(-I*x)), + -1/2*e^(-x) + 1/2*e^x, + 1/2*e^(-x) + 1/2*e^x, + -e^(-x)/(e^(-x) + e^x) + e^x/(e^(-x) + e^x), + -2/(e^(-x) - e^x), + 2/(e^(-x) + e^x), + -(e^(-x) + e^x)/(e^(-x) - e^x)] + sage: [mathematica.TrigToExp(u(x)).sage() for u in IFL] + [-I*log(I*x + sqrt(-x^2 + 1)), + 1/2*pi + I*log(I*x + sqrt(-x^2 + 1)), + -1/2*I*log(I*x + 1) + 1/2*I*log(-I*x + 1), + -I*log(sqrt(-1/x^2 + 1) + I/x), + 1/2*pi + I*log(sqrt(-1/x^2 + 1) + I/x), + -1/2*I*log(I/x + 1) + 1/2*I*log(-I/x + 1), + log(x + sqrt(x^2 + 1)), + log(sqrt(x + 1)*sqrt(x - 1) + x), + 1/2*log(x + 1) - 1/2*log(-x + 1), + log(sqrt(1/x^2 + 1) + 1/x), + log(sqrt(1/x + 1)*sqrt(1/x - 1) + 1/x), + 1/2*log(1/x + 1) - 1/2*log(-1/x + 1)] + """ # **************************************************************************** From 6b06c5e5595ead9f8eb0ddc2922bc8f2b782276f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:46:18 -0700 Subject: [PATCH 151/416] build/pkgs/charset_normalizer: Update to 2.1.0 --- build/pkgs/charset_normalizer/checksums.ini | 6 +++--- build/pkgs/charset_normalizer/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/charset_normalizer/checksums.ini b/build/pkgs/charset_normalizer/checksums.ini index 90d2c47aba4..613b6e280c8 100644 --- a/build/pkgs/charset_normalizer/checksums.ini +++ b/build/pkgs/charset_normalizer/checksums.ini @@ -1,5 +1,5 @@ tarball=charset-normalizer-VERSION.tar.gz -sha1=6824bfae6dec62d93887b53468ea36124db5ecc8 -md5=f6664e0e90dbb3cc9cfc154a980f9864 -cksum=2680691552 +sha1=2e8bffe7176b23f79c848af894593a7912c4d2b0 +md5=c1be418ec00773d84d793f23b2bbc3cd +cksum=2118865848 upstream_url=https://pypi.io/packages/source/c/charset_normalizer/charset-normalizer-VERSION.tar.gz diff --git a/build/pkgs/charset_normalizer/package-version.txt b/build/pkgs/charset_normalizer/package-version.txt index 280a1e3368b..7ec1d6db408 100644 --- a/build/pkgs/charset_normalizer/package-version.txt +++ b/build/pkgs/charset_normalizer/package-version.txt @@ -1 +1 @@ -2.0.12 +2.1.0 From 93d56f1406812490d7e47cc466b3ac22641a8642 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:47:29 -0700 Subject: [PATCH 152/416] build/pkgs/ipython: Update to 8.4.0 --- build/pkgs/ipython/checksums.ini | 6 +++--- build/pkgs/ipython/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/ipython/checksums.ini b/build/pkgs/ipython/checksums.ini index d5c70f8f762..ab40792a0a7 100644 --- a/build/pkgs/ipython/checksums.ini +++ b/build/pkgs/ipython/checksums.ini @@ -1,5 +1,5 @@ tarball=ipython-VERSION.tar.gz -sha1=933d31cb657f0adfac7c0f02ec5664a9d64267ea -md5=2c334d241c66551125467b583fc1871e -cksum=362811784 +sha1=98270c68edcfbcd02b3d76d9c1ab6030bbb92171 +md5=dc5d78f3d622b027a0f32f9a545b44ff +cksum=3907293880 upstream_url=https://pypi.io/packages/source/i/ipython/ipython-VERSION.tar.gz diff --git a/build/pkgs/ipython/package-version.txt b/build/pkgs/ipython/package-version.txt index 2bf50aaf17a..a2f28f43be3 100644 --- a/build/pkgs/ipython/package-version.txt +++ b/build/pkgs/ipython/package-version.txt @@ -1 +1 @@ -8.3.0 +8.4.0 From 7e20edbc8af3cd268ad37458b4fb46556617de7b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:48:07 -0700 Subject: [PATCH 153/416] build/pkgs/jupyter_client: Update to 7.3.4 --- build/pkgs/jupyter_client/checksums.ini | 6 +++--- build/pkgs/jupyter_client/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/jupyter_client/checksums.ini b/build/pkgs/jupyter_client/checksums.ini index 71b68d04aff..6f89053ffab 100644 --- a/build/pkgs/jupyter_client/checksums.ini +++ b/build/pkgs/jupyter_client/checksums.ini @@ -1,5 +1,5 @@ tarball=jupyter_client-VERSION.tar.gz -sha1=f620e8854f3ebbfd5a305d6c4831bd9fc94570ab -md5=6eb727d9dc2b7f19252d3ffb0c22bb9b -cksum=713839153 +sha1=99e1ce34f9022acbd3cc301d501ff83099f559ff +md5=3863b317e78ba701f5b844c2221a101f +cksum=1126052456 upstream_url=https://pypi.io/packages/source/j/jupyter_client/jupyter_client-VERSION.tar.gz diff --git a/build/pkgs/jupyter_client/package-version.txt b/build/pkgs/jupyter_client/package-version.txt index 643916c03f1..c968a5762bf 100644 --- a/build/pkgs/jupyter_client/package-version.txt +++ b/build/pkgs/jupyter_client/package-version.txt @@ -1 +1 @@ -7.3.1 +7.3.4 From d3b9e7bbed3aca141365090d291384dfef82cc7a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:48:27 -0700 Subject: [PATCH 154/416] build/pkgs/nbclient: Update to 0.6.4 --- build/pkgs/nbclient/checksums.ini | 6 +++--- build/pkgs/nbclient/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/nbclient/checksums.ini b/build/pkgs/nbclient/checksums.ini index db16b8e3c59..de286fc5e1b 100644 --- a/build/pkgs/nbclient/checksums.ini +++ b/build/pkgs/nbclient/checksums.ini @@ -1,5 +1,5 @@ tarball=nbclient-VERSION.tar.gz -sha1=254e5882b028b1bda5eb4752fffa8e932399da53 -md5=895b6541e27a64eb33728c9387c65327 -cksum=4244298637 +sha1=e20fb7fc1fe8c421f3f7e8f749ee8fdc38c1811a +md5=ad28a33484bbd348ef04f142d32669f5 +cksum=2210542646 upstream_url=https://pypi.io/packages/source/n/nbclient/nbclient-VERSION.tar.gz diff --git a/build/pkgs/nbclient/package-version.txt b/build/pkgs/nbclient/package-version.txt index 844f6a91acb..d2b13eb644d 100644 --- a/build/pkgs/nbclient/package-version.txt +++ b/build/pkgs/nbclient/package-version.txt @@ -1 +1 @@ -0.6.3 +0.6.4 From 11f9e85cdf407ea2c1e555f0484a144b8df4540a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:48:56 -0700 Subject: [PATCH 155/416] build/pkgs/notebook: Update to 6.4.12 --- build/pkgs/notebook/checksums.ini | 6 +++--- build/pkgs/notebook/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/notebook/checksums.ini b/build/pkgs/notebook/checksums.ini index 70400abb964..16bbe6de420 100644 --- a/build/pkgs/notebook/checksums.ini +++ b/build/pkgs/notebook/checksums.ini @@ -1,5 +1,5 @@ tarball=notebook-VERSION.tar.gz -sha1=f639d0ff0e812e4ebf8d642952db2b29a9e2a7ef -md5=d422490d81da301830a07065d3e1f8c9 -cksum=3535534309 +sha1=d715730ac48bca8739ce8faf5329841d147163cd +md5=90a5b998e496ed4c18975d3a42960df0 +cksum=577775576 upstream_url=https://pypi.io/packages/source/n/notebook/notebook-VERSION.tar.gz diff --git a/build/pkgs/notebook/package-version.txt b/build/pkgs/notebook/package-version.txt index e5a66bad386..d613169e889 100644 --- a/build/pkgs/notebook/package-version.txt +++ b/build/pkgs/notebook/package-version.txt @@ -1 +1 @@ -6.4.11 +6.4.12 From a1a97c553e983c05a5cbab9422251a0688e1745d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:50:17 -0700 Subject: [PATCH 156/416] build/pkgs/requests: Update to 2.28.0 --- build/pkgs/requests/checksums.ini | 6 +++--- build/pkgs/requests/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/requests/checksums.ini b/build/pkgs/requests/checksums.ini index 4151d2b2e97..4a2693a8d90 100644 --- a/build/pkgs/requests/checksums.ini +++ b/build/pkgs/requests/checksums.ini @@ -1,5 +1,5 @@ tarball=requests-VERSION.tar.gz -sha1=96c46fc47e75d06fa7ead4d7fb1ae7d58d68989f -md5=bcc01b73974a305cc7c5b092e7d07004 -cksum=3325038591 +sha1=a72bdfba339f5058c051c71954b59bef94c84455 +md5=5c1f6e737e1cb6f86a91d7a1473eda95 +cksum=4021136359 upstream_url=https://pypi.io/packages/source/r/requests/requests-VERSION.tar.gz diff --git a/build/pkgs/requests/package-version.txt b/build/pkgs/requests/package-version.txt index f0465234b5a..90efbd4e31e 100644 --- a/build/pkgs/requests/package-version.txt +++ b/build/pkgs/requests/package-version.txt @@ -1 +1 @@ -2.27.1 +2.28.0 From acae2203a570a0fae45f84d2b406789e2d88addc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:50:37 -0700 Subject: [PATCH 157/416] build/pkgs/stack_data: Update to 0.3.0 --- build/pkgs/stack_data/checksums.ini | 6 +++--- build/pkgs/stack_data/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/stack_data/checksums.ini b/build/pkgs/stack_data/checksums.ini index a94ca505ead..7058412912e 100644 --- a/build/pkgs/stack_data/checksums.ini +++ b/build/pkgs/stack_data/checksums.ini @@ -1,5 +1,5 @@ tarball=stack_data-VERSION.tar.gz -sha1=641fbdc2646ed24005e185a85069fe1fff9b9ce1 -md5=aa4abb89e9a504aa55b57e039c997552 -cksum=1172090398 +sha1=280dc05517f29dd0d450679304a9bb6a0fa41a25 +md5=d39afb043bdb116b8d568c2a82f32227 +cksum=3446203117 upstream_url=https://pypi.io/packages/source/s/stack_data/stack_data-VERSION.tar.gz diff --git a/build/pkgs/stack_data/package-version.txt b/build/pkgs/stack_data/package-version.txt index 0ea3a944b39..0d91a54c7d4 100644 --- a/build/pkgs/stack_data/package-version.txt +++ b/build/pkgs/stack_data/package-version.txt @@ -1 +1 @@ -0.2.0 +0.3.0 From 1e25e8cd448a46a4f10763430ab9dff0a343250d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 11:51:03 -0700 Subject: [PATCH 158/416] build/pkgs/widgetsnbextension: Update to 3.6.1 --- build/pkgs/widgetsnbextension/checksums.ini | 6 +++--- build/pkgs/widgetsnbextension/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/widgetsnbextension/checksums.ini b/build/pkgs/widgetsnbextension/checksums.ini index 81e6d3f9e10..520bd3a6401 100644 --- a/build/pkgs/widgetsnbextension/checksums.ini +++ b/build/pkgs/widgetsnbextension/checksums.ini @@ -1,5 +1,5 @@ tarball=widgetsnbextension-VERSION.tar.gz -sha1=f692865cf1dd4efd77d7d6f1be8ef6a5678ceb67 -md5=60c9ddbc7a04ff3c92c5570ec063f9b0 -cksum=1982133179 +sha1=0dddc23af2ec56d3a666bba070da1518312d1163 +md5=86dd0471c4e376d981d7633224aa0607 +cksum=3308939542 upstream_url=https://pypi.io/packages/source/w/widgetsnbextension/widgetsnbextension-VERSION.tar.gz diff --git a/build/pkgs/widgetsnbextension/package-version.txt b/build/pkgs/widgetsnbextension/package-version.txt index 40c341bdcdb..9575d51bad2 100644 --- a/build/pkgs/widgetsnbextension/package-version.txt +++ b/build/pkgs/widgetsnbextension/package-version.txt @@ -1 +1 @@ -3.6.0 +3.6.1 From 321f027f38772d05c77b17a6c562d86e5173042d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 12:26:56 -0700 Subject: [PATCH 159/416] build/pkgs/pyzmq: Update to 23.2.0 --- build/pkgs/pyzmq/checksums.ini | 6 +++--- build/pkgs/pyzmq/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini index 20509db618b..cd83e8c1a2d 100644 --- a/build/pkgs/pyzmq/checksums.ini +++ b/build/pkgs/pyzmq/checksums.ini @@ -1,5 +1,5 @@ tarball=pyzmq-VERSION.tar.gz -sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6 -md5=ecf13c72fbea05ba5ddc771295409d48 -cksum=1680251717 +sha1=b31a94f504ef3104a28e64d88b7c1feafb124982 +md5=7de9c7bb05cc89d21e4105ec1ac7c270 +cksum=936855776 upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt index 8326e27f9b6..11ebcd0e4f9 100644 --- a/build/pkgs/pyzmq/package-version.txt +++ b/build/pkgs/pyzmq/package-version.txt @@ -1 +1 @@ -22.3.0 +23.2.0 From 96c2123048eff61d43e6534350da34cc0fac6e60 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 26 Jun 2022 12:40:27 -0700 Subject: [PATCH 160/416] build/pkgs/traitlets: Update to 5.3.0 --- build/pkgs/traitlets/checksums.ini | 6 +++--- build/pkgs/traitlets/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/traitlets/checksums.ini b/build/pkgs/traitlets/checksums.ini index dd2af5d21ac..fd4f1d895ed 100644 --- a/build/pkgs/traitlets/checksums.ini +++ b/build/pkgs/traitlets/checksums.ini @@ -1,5 +1,5 @@ tarball=traitlets-VERSION.tar.gz -sha1=86d03557843700d6dd0657371d15f0520c2f392f -md5=31f7fd84518fe08cb40ab18f6dde0d54 -cksum=1147319509 +sha1=80e1e820c169295ca66428e1414cf33c36c61386 +md5=ea9b920bd09fa8fcc44325c4d6a6800d +cksum=1563220888 upstream_url=https://pypi.io/packages/source/t/traitlets/traitlets-VERSION.tar.gz diff --git a/build/pkgs/traitlets/package-version.txt b/build/pkgs/traitlets/package-version.txt index ac14c3dfaa8..03f488b076a 100644 --- a/build/pkgs/traitlets/package-version.txt +++ b/build/pkgs/traitlets/package-version.txt @@ -1 +1 @@ -5.1.1 +5.3.0 From bbfdce69229b86a939588a799189c0d6b7211918 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 17 May 2022 22:33:36 -0700 Subject: [PATCH 161/416] build/pkgs/jupyter_jsmol: Update to 2022.1.0 --- build/pkgs/jupyter_jsmol/checksums.ini | 6 +++--- build/pkgs/jupyter_jsmol/dependencies | 2 +- build/pkgs/jupyter_jsmol/package-version.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/jupyter_jsmol/checksums.ini b/build/pkgs/jupyter_jsmol/checksums.ini index 043ee67ce94..0ac16d6e78c 100644 --- a/build/pkgs/jupyter_jsmol/checksums.ini +++ b/build/pkgs/jupyter_jsmol/checksums.ini @@ -1,5 +1,5 @@ tarball=jupyter_jsmol-VERSION.tar.gz -sha1=5e21072395929a247a520b9e0b6d5fe56d70f5d5 -md5=0549b54006cbf405b26a5fb71b2e6f40 -cksum=285195380 +sha1=6ba59de9d1df15b2a09a57f6bdf10f48f13af9ac +md5=90e9490414e7fbecc6013b4b051b06d7 +cksum=917919116 upstream_url=https://pypi.io/packages/source/j/jupyter-jsmol/jupyter_jsmol-VERSION.tar.gz diff --git a/build/pkgs/jupyter_jsmol/dependencies b/build/pkgs/jupyter_jsmol/dependencies index 52f9cada06b..a6d87526311 100644 --- a/build/pkgs/jupyter_jsmol/dependencies +++ b/build/pkgs/jupyter_jsmol/dependencies @@ -1,4 +1,4 @@ -ipywidgets $(PYTHON) | $(PYTHON_TOOLCHAIN) +ipywidgets jupyter_packaging $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/jupyter_jsmol/package-version.txt b/build/pkgs/jupyter_jsmol/package-version.txt index abd410582de..584e974e24c 100644 --- a/build/pkgs/jupyter_jsmol/package-version.txt +++ b/build/pkgs/jupyter_jsmol/package-version.txt @@ -1 +1 @@ -0.2.4 +2022.1.0 From f007fce900a894380eb3fb5459f8daefcba3c16e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 11:02:43 -0700 Subject: [PATCH 162/416] build/pkgs/charset_normalizer: Downgrade to 2.0.12 --- build/pkgs/charset_normalizer/checksums.ini | 6 +++--- build/pkgs/charset_normalizer/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/charset_normalizer/checksums.ini b/build/pkgs/charset_normalizer/checksums.ini index 613b6e280c8..90d2c47aba4 100644 --- a/build/pkgs/charset_normalizer/checksums.ini +++ b/build/pkgs/charset_normalizer/checksums.ini @@ -1,5 +1,5 @@ tarball=charset-normalizer-VERSION.tar.gz -sha1=2e8bffe7176b23f79c848af894593a7912c4d2b0 -md5=c1be418ec00773d84d793f23b2bbc3cd -cksum=2118865848 +sha1=6824bfae6dec62d93887b53468ea36124db5ecc8 +md5=f6664e0e90dbb3cc9cfc154a980f9864 +cksum=2680691552 upstream_url=https://pypi.io/packages/source/c/charset_normalizer/charset-normalizer-VERSION.tar.gz diff --git a/build/pkgs/charset_normalizer/package-version.txt b/build/pkgs/charset_normalizer/package-version.txt index 7ec1d6db408..280a1e3368b 100644 --- a/build/pkgs/charset_normalizer/package-version.txt +++ b/build/pkgs/charset_normalizer/package-version.txt @@ -1 +1 @@ -2.1.0 +2.0.12 From 25072d36795b4a0c4df49a11514b488af05fe87b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 11:56:08 -0700 Subject: [PATCH 163/416] build/pkgs/tzlocal: Update to 4.2 --- build/pkgs/tzlocal/checksums.ini | 6 +++--- build/pkgs/tzlocal/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/tzlocal/checksums.ini b/build/pkgs/tzlocal/checksums.ini index d595a9d3d16..e0a415cb4fc 100644 --- a/build/pkgs/tzlocal/checksums.ini +++ b/build/pkgs/tzlocal/checksums.ini @@ -1,5 +1,5 @@ tarball=tzlocal-VERSION.tar.gz -sha1=7d2d590f68849e6b6371210bd808b40ec5619faf -md5=c0877603ff9de71cd8ca6ee2b50d2ebd -cksum=950088034 +sha1=76098dc67f43575cda4ab7cf20ebd1c6aef1ceaa +md5=b20f960e77612ff35c5105bb876f0853 +cksum=2281514998 upstream_url=https://pypi.io/packages/source/t/tzlocal/tzlocal-VERSION.tar.gz diff --git a/build/pkgs/tzlocal/package-version.txt b/build/pkgs/tzlocal/package-version.txt index 879b416e609..bf77d549685 100644 --- a/build/pkgs/tzlocal/package-version.txt +++ b/build/pkgs/tzlocal/package-version.txt @@ -1 +1 @@ -2.1 +4.2 From fcb316a45e7e8b74d7a083bf0f8608851a8a1b3e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:02:20 -0700 Subject: [PATCH 164/416] build/pkgs/backports_zoneinfo: New, tzlocal dep --- build/pkgs/backports_zoneinfo/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/backports_zoneinfo/checksums.ini | 5 +++++ build/pkgs/backports_zoneinfo/dependencies | 4 ++++ .../backports_zoneinfo/install-requires.txt | 1 + .../backports_zoneinfo/package-version.txt | 1 + build/pkgs/backports_zoneinfo/spkg-install.in | 2 ++ build/pkgs/backports_zoneinfo/type | 1 + build/pkgs/tzlocal/dependencies | 2 +- 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/backports_zoneinfo/SPKG.rst create mode 100644 build/pkgs/backports_zoneinfo/checksums.ini create mode 100644 build/pkgs/backports_zoneinfo/dependencies create mode 100644 build/pkgs/backports_zoneinfo/install-requires.txt create mode 100644 build/pkgs/backports_zoneinfo/package-version.txt create mode 100644 build/pkgs/backports_zoneinfo/spkg-install.in create mode 100644 build/pkgs/backports_zoneinfo/type diff --git a/build/pkgs/backports_zoneinfo/SPKG.rst b/build/pkgs/backports_zoneinfo/SPKG.rst new file mode 100644 index 00000000000..deaed349122 --- /dev/null +++ b/build/pkgs/backports_zoneinfo/SPKG.rst @@ -0,0 +1,18 @@ +backports_zoneinfo: Backport of the standard library zoneinfo module +==================================================================== + +Description +----------- + +Backport of the standard library zoneinfo module for Python 3.8 + +License +------- + +Apache-2.0 + +Upstream Contact +---------------- + +https://pypi.org/project/backports.zoneinfo/ + diff --git a/build/pkgs/backports_zoneinfo/checksums.ini b/build/pkgs/backports_zoneinfo/checksums.ini new file mode 100644 index 00000000000..1af2250d48c --- /dev/null +++ b/build/pkgs/backports_zoneinfo/checksums.ini @@ -0,0 +1,5 @@ +tarball=backports.zoneinfo-VERSION.tar.gz +sha1=8015a85e499ceda8b526f907a2a60083f7004aa4 +md5=d51faaaed4a1d5158dcfcef90355e805 +cksum=2001250429 +upstream_url=https://pypi.io/packages/source/b/backports.zoneinfo/backports.zoneinfo-VERSION.tar.gz diff --git a/build/pkgs/backports_zoneinfo/dependencies b/build/pkgs/backports_zoneinfo/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/backports_zoneinfo/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/backports_zoneinfo/install-requires.txt b/build/pkgs/backports_zoneinfo/install-requires.txt new file mode 100644 index 00000000000..5a8be642f33 --- /dev/null +++ b/build/pkgs/backports_zoneinfo/install-requires.txt @@ -0,0 +1 @@ +backports.zoneinfo diff --git a/build/pkgs/backports_zoneinfo/package-version.txt b/build/pkgs/backports_zoneinfo/package-version.txt new file mode 100644 index 00000000000..0c62199f16a --- /dev/null +++ b/build/pkgs/backports_zoneinfo/package-version.txt @@ -0,0 +1 @@ +0.2.1 diff --git a/build/pkgs/backports_zoneinfo/spkg-install.in b/build/pkgs/backports_zoneinfo/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/backports_zoneinfo/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/backports_zoneinfo/type b/build/pkgs/backports_zoneinfo/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/backports_zoneinfo/type @@ -0,0 +1 @@ +standard diff --git a/build/pkgs/tzlocal/dependencies b/build/pkgs/tzlocal/dependencies index 0738c2d7777..805f5e3c8a5 100644 --- a/build/pkgs/tzlocal/dependencies +++ b/build/pkgs/tzlocal/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) backports_zoneinfo | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From f180ed35f7e719c70534934007ecbcbb2213d531 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:03:35 -0700 Subject: [PATCH 165/416] build/pkgs/pytz_deprecation_shim: New, tzlocal dep --- build/pkgs/pytz_deprecation_shim/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/pytz_deprecation_shim/checksums.ini | 5 +++++ build/pkgs/pytz_deprecation_shim/dependencies | 4 ++++ .../pytz_deprecation_shim/install-requires.txt | 1 + .../pytz_deprecation_shim/package-version.txt | 1 + .../pkgs/pytz_deprecation_shim/spkg-install.in | 2 ++ build/pkgs/pytz_deprecation_shim/type | 1 + build/pkgs/tzlocal/dependencies | 2 +- 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/pytz_deprecation_shim/SPKG.rst create mode 100644 build/pkgs/pytz_deprecation_shim/checksums.ini create mode 100644 build/pkgs/pytz_deprecation_shim/dependencies create mode 100644 build/pkgs/pytz_deprecation_shim/install-requires.txt create mode 100644 build/pkgs/pytz_deprecation_shim/package-version.txt create mode 100644 build/pkgs/pytz_deprecation_shim/spkg-install.in create mode 100644 build/pkgs/pytz_deprecation_shim/type diff --git a/build/pkgs/pytz_deprecation_shim/SPKG.rst b/build/pkgs/pytz_deprecation_shim/SPKG.rst new file mode 100644 index 00000000000..a7871271a92 --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/SPKG.rst @@ -0,0 +1,18 @@ +pytz_deprecation_shim: Shims to make deprecation of pytz easier +=============================================================== + +Description +----------- + +Shims to make deprecation of pytz easier + +License +------- + +Apache-2.0 + +Upstream Contact +---------------- + +https://pypi.org/project/pytz-deprecation-shim/ + diff --git a/build/pkgs/pytz_deprecation_shim/checksums.ini b/build/pkgs/pytz_deprecation_shim/checksums.ini new file mode 100644 index 00000000000..4c5f6546961 --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/checksums.ini @@ -0,0 +1,5 @@ +tarball=pytz_deprecation_shim-VERSION.tar.gz +sha1=d7900c309c26d48f6499fbda955eb80bd0b437dd +md5=f563b4bdc56f40acb2498fd1caf6dd1b +cksum=2491832159 +upstream_url=https://pypi.io/packages/source/p/pytz_deprecation_shim/pytz_deprecation_shim-VERSION.tar.gz diff --git a/build/pkgs/pytz_deprecation_shim/dependencies b/build/pkgs/pytz_deprecation_shim/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/pytz_deprecation_shim/install-requires.txt b/build/pkgs/pytz_deprecation_shim/install-requires.txt new file mode 100644 index 00000000000..2fd546ce62e --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/install-requires.txt @@ -0,0 +1 @@ +pytz-deprecation-shim diff --git a/build/pkgs/pytz_deprecation_shim/package-version.txt b/build/pkgs/pytz_deprecation_shim/package-version.txt new file mode 100644 index 00000000000..c727475d727 --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/package-version.txt @@ -0,0 +1 @@ +0.1.0.post0 diff --git a/build/pkgs/pytz_deprecation_shim/spkg-install.in b/build/pkgs/pytz_deprecation_shim/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/pytz_deprecation_shim/type b/build/pkgs/pytz_deprecation_shim/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/pytz_deprecation_shim/type @@ -0,0 +1 @@ +standard diff --git a/build/pkgs/tzlocal/dependencies b/build/pkgs/tzlocal/dependencies index 805f5e3c8a5..da4c8ca99cf 100644 --- a/build/pkgs/tzlocal/dependencies +++ b/build/pkgs/tzlocal/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) backports_zoneinfo | $(PYTHON_TOOLCHAIN) +$(PYTHON) backports_zoneinfo pytz_deprecation_shim | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From cc64903a31c1df8d5ad59c9529fff0edcf5c2419 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:08:33 -0700 Subject: [PATCH 166/416] build/pkgs/tzdata: New (pytz_deprecation_shim dep) --- build/pkgs/pytz_deprecation_shim/dependencies | 2 +- build/pkgs/tzdata/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/tzdata/checksums.ini | 5 +++++ build/pkgs/tzdata/dependencies | 4 ++++ build/pkgs/tzdata/install-requires.txt | 1 + build/pkgs/tzdata/package-version.txt | 1 + build/pkgs/tzdata/spkg-install.in | 2 ++ build/pkgs/tzdata/type | 1 + 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/tzdata/SPKG.rst create mode 100644 build/pkgs/tzdata/checksums.ini create mode 100644 build/pkgs/tzdata/dependencies create mode 100644 build/pkgs/tzdata/install-requires.txt create mode 100644 build/pkgs/tzdata/package-version.txt create mode 100644 build/pkgs/tzdata/spkg-install.in create mode 100644 build/pkgs/tzdata/type diff --git a/build/pkgs/pytz_deprecation_shim/dependencies b/build/pkgs/pytz_deprecation_shim/dependencies index 0738c2d7777..232fe6c0554 100644 --- a/build/pkgs/pytz_deprecation_shim/dependencies +++ b/build/pkgs/pytz_deprecation_shim/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) tzdata | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/tzdata/SPKG.rst b/build/pkgs/tzdata/SPKG.rst new file mode 100644 index 00000000000..5e35854aeb2 --- /dev/null +++ b/build/pkgs/tzdata/SPKG.rst @@ -0,0 +1,18 @@ +tzdata: Provider of IANA time zone data +======================================= + +Description +----------- + +Provider of IANA time zone data + +License +------- + +Apache-2.0 + +Upstream Contact +---------------- + +https://pypi.org/project/tzdata/ + diff --git a/build/pkgs/tzdata/checksums.ini b/build/pkgs/tzdata/checksums.ini new file mode 100644 index 00000000000..0f4b1dacf0e --- /dev/null +++ b/build/pkgs/tzdata/checksums.ini @@ -0,0 +1,5 @@ +tarball=tzdata-VERSION.tar.gz +sha1=b63835812a08e453376558df28e05bf30168e4c6 +md5=b458f1ceb9371d9d3051de2fd2c45bb8 +cksum=3348191929 +upstream_url=https://pypi.io/packages/source/t/tzdata/tzdata-VERSION.tar.gz diff --git a/build/pkgs/tzdata/dependencies b/build/pkgs/tzdata/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/tzdata/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/tzdata/install-requires.txt b/build/pkgs/tzdata/install-requires.txt new file mode 100644 index 00000000000..0883ff0705b --- /dev/null +++ b/build/pkgs/tzdata/install-requires.txt @@ -0,0 +1 @@ +tzdata diff --git a/build/pkgs/tzdata/package-version.txt b/build/pkgs/tzdata/package-version.txt new file mode 100644 index 00000000000..7eaecee1e5c --- /dev/null +++ b/build/pkgs/tzdata/package-version.txt @@ -0,0 +1 @@ +2022.1 diff --git a/build/pkgs/tzdata/spkg-install.in b/build/pkgs/tzdata/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/tzdata/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/tzdata/type b/build/pkgs/tzdata/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/tzdata/type @@ -0,0 +1 @@ +standard From 1612bc6a0efe5b17b5c5790e7afdfde230b44a8f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:21:08 -0700 Subject: [PATCH 167/416] build/pkgs/traitlets/dependencies: Add hatchling --- build/pkgs/traitlets/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/traitlets/dependencies b/build/pkgs/traitlets/dependencies index 6598a788ccf..df88de8f64c 100644 --- a/build/pkgs/traitlets/dependencies +++ b/build/pkgs/traitlets/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six +$(PYTHON) | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six hatchling ---------- All lines of this file are ignored except the first. From 62954f5815f595e2d498c6776bbc922884b56d89 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:35:04 -0700 Subject: [PATCH 168/416] build/pkgs/ipympl/dependencies: Make matplotlib etc. normal dependencies --- build/pkgs/ipympl/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/ipympl/dependencies b/build/pkgs/ipympl/dependencies index b217268db20..05d47407b15 100644 --- a/build/pkgs/ipympl/dependencies +++ b/build/pkgs/ipympl/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipywidgets matplotlib ipykernel jupyter_packaging +$(PYTHON) ipywidgets matplotlib ipykernel | $(PYTHON_TOOLCHAIN) jupyter_packaging ---------- All lines of this file are ignored except the first. From 93f67811b316b545fa3e8f82917b727a17b3965f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:37:00 -0700 Subject: [PATCH 169/416] build/pkgs/matplotlib: Update to 3.5.2 --- build/pkgs/matplotlib/checksums.ini | 6 +++--- build/pkgs/matplotlib/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/matplotlib/checksums.ini b/build/pkgs/matplotlib/checksums.ini index b2b3d3c0617..b2055242c4d 100644 --- a/build/pkgs/matplotlib/checksums.ini +++ b/build/pkgs/matplotlib/checksums.ini @@ -1,5 +1,5 @@ tarball=matplotlib-VERSION.tar.gz -sha1=a9bb3b92594d991908a0052384c6abed81227a6f -md5=63adf3126167a54b1d5a506a71ecef46 -cksum=1898324331 +sha1=8db4a2bb5c5a56b4ff9a33b59d134404774d85d5 +md5=5a77336c6c5549bed5f9631c734dedc5 +cksum=602312637 upstream_url=https://pypi.io/packages/source/m/matplotlib/matplotlib-VERSION.tar.gz diff --git a/build/pkgs/matplotlib/package-version.txt b/build/pkgs/matplotlib/package-version.txt index d5c0c991428..87ce492908a 100644 --- a/build/pkgs/matplotlib/package-version.txt +++ b/build/pkgs/matplotlib/package-version.txt @@ -1 +1 @@ -3.5.1 +3.5.2 From 60c4037bfe911ad122a28570d6486fa99baf9ea9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 12:54:03 -0700 Subject: [PATCH 170/416] build/pkgs/backports_zoneinfo/spkg-install.in: Skip install for Python >= 3.9 --- build/pkgs/backports_zoneinfo/spkg-install.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/pkgs/backports_zoneinfo/spkg-install.in b/build/pkgs/backports_zoneinfo/spkg-install.in index 37ac1a53437..83aff6031e8 100644 --- a/build/pkgs/backports_zoneinfo/spkg-install.in +++ b/build/pkgs/backports_zoneinfo/spkg-install.in @@ -1,2 +1,6 @@ cd src -sdh_pip_install . +if python3 -c 'import sys; sys.exit(0 if sys.hexversion < 0x03090000 else 1)'; then + sdh_pip_install . +else + echo >&2 "Skipping install, not needed for Python >= 3.9" +fi From eb586f184423b1e5fa8bd089ac0eb96b13986a59 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 15:09:23 -0700 Subject: [PATCH 171/416] build/pkgs/soupsieve: Update to 2.3.2.post1 --- build/pkgs/soupsieve/checksums.ini | 6 +++--- build/pkgs/soupsieve/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/soupsieve/checksums.ini b/build/pkgs/soupsieve/checksums.ini index 973075eac93..ba75e4f8d72 100644 --- a/build/pkgs/soupsieve/checksums.ini +++ b/build/pkgs/soupsieve/checksums.ini @@ -1,5 +1,5 @@ tarball=soupsieve-VERSION.tar.gz -sha1=164c25b194b83750ddb6cf0085ebfbd8441955d2 -md5=f64640a3b112d3deb1d3469037bed5e3 -cksum=1782838732 +sha1=ca188164fcf08ebb127783c5446e7ab8756c6e4d +md5=4c824620563604cbf783de149c8b8889 +cksum=936386269 upstream_url=https://pypi.io/packages/source/s/soupsieve/soupsieve-VERSION.tar.gz diff --git a/build/pkgs/soupsieve/package-version.txt b/build/pkgs/soupsieve/package-version.txt index 2bf1c1ccf36..b50ef254a93 100644 --- a/build/pkgs/soupsieve/package-version.txt +++ b/build/pkgs/soupsieve/package-version.txt @@ -1 +1 @@ -2.3.1 +2.3.2.post1 From b0258f34cbcf5382dcde5ef32a5b7a1bf51be7e4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 15:09:39 -0700 Subject: [PATCH 172/416] build/pkgs/beautifulsoup4: Update to 4.11.1 --- build/pkgs/beautifulsoup4/checksums.ini | 6 +++--- build/pkgs/beautifulsoup4/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/beautifulsoup4/checksums.ini b/build/pkgs/beautifulsoup4/checksums.ini index ed957d720e1..aa0baa2216c 100644 --- a/build/pkgs/beautifulsoup4/checksums.ini +++ b/build/pkgs/beautifulsoup4/checksums.ini @@ -1,5 +1,5 @@ tarball=beautifulsoup4-VERSION.tar.gz -sha1=4fcafb012dd6dfad556dc144cffa64ee72ebe316 -md5=e754242642253dd31d249d00358d552e -cksum=679040307 +sha1=fbb73ba4221122b56cd4eac2d9e5d3ad2e383ae0 +md5=22f22f89cf9da41b22e1ece9639c66a3 +cksum=2807377018 upstream_url=https://pypi.io/packages/source/b/beautifulsoup4/beautifulsoup4-VERSION.tar.gz diff --git a/build/pkgs/beautifulsoup4/package-version.txt b/build/pkgs/beautifulsoup4/package-version.txt index 2da4316236a..d782fca8f64 100644 --- a/build/pkgs/beautifulsoup4/package-version.txt +++ b/build/pkgs/beautifulsoup4/package-version.txt @@ -1 +1 @@ -4.10.0 +4.11.1 From 7580e327328d200d639baca5ed0d6c11d6b04a31 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 15:09:50 -0700 Subject: [PATCH 173/416] build/pkgs/nbformat: Update to 5.4.0 --- build/pkgs/nbformat/checksums.ini | 6 +++--- build/pkgs/nbformat/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/nbformat/checksums.ini b/build/pkgs/nbformat/checksums.ini index 72924256488..39cbb5ac27b 100644 --- a/build/pkgs/nbformat/checksums.ini +++ b/build/pkgs/nbformat/checksums.ini @@ -1,5 +1,5 @@ tarball=nbformat-VERSION.tar.gz -sha1=84a416c822f6088fef6fd1d8b56b03f0d3c98c0e -md5=70eb6150c6ea49aae042e2ecafb45378 -cksum=992829029 +sha1=77f321311289719867b958f40f58a570f3825c11 +md5=a11ccf44c2d984d1b8325a3463a9ae20 +cksum=3746246082 upstream_url=https://pypi.io/packages/source/n/nbformat/nbformat-VERSION.tar.gz diff --git a/build/pkgs/nbformat/package-version.txt b/build/pkgs/nbformat/package-version.txt index cdb98d26e4e..8a30e8f94a3 100644 --- a/build/pkgs/nbformat/package-version.txt +++ b/build/pkgs/nbformat/package-version.txt @@ -1 +1 @@ -5.1.3 +5.4.0 From 58b432951abf9345b978ba6c5cf9005a86b8ae8a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 17:37:27 -0700 Subject: [PATCH 174/416] build/pkgs/matplotlib/dependencies: Remove pytz --- build/pkgs/matplotlib/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/matplotlib/dependencies b/build/pkgs/matplotlib/dependencies index 1fcb30a9c9d..f13fd3f367a 100644 --- a/build/pkgs/matplotlib/dependencies +++ b/build/pkgs/matplotlib/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull fonttools | $(PYTHON_TOOLCHAIN) pytz kiwisolver certifi setuptools_scm_git_archive +$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull fonttools | $(PYTHON_TOOLCHAIN) kiwisolver certifi setuptools_scm_git_archive ---------- All lines of this file are ignored except the first. From f216a8e74cc306f9bcf0bf27d2c3bff73c7eecac Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Jun 2022 23:47:48 -0700 Subject: [PATCH 175/416] build/pkgs/soupsieve/dependencies: Add hatchling --- build/pkgs/soupsieve/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/soupsieve/dependencies b/build/pkgs/soupsieve/dependencies index 0738c2d7777..8cd44d06682 100644 --- a/build/pkgs/soupsieve/dependencies +++ b/build/pkgs/soupsieve/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) +$(PYTHON) | $(PYTHON_TOOLCHAIN) hatchling ---------- All lines of this file are ignored except the first. From f9cf0577788cd24fc65852e94c10f09ee987dfba Mon Sep 17 00:00:00 2001 From: Marc Mezzarobba Date: Tue, 28 Jun 2022 10:15:10 +0200 Subject: [PATCH 176/416] =?UTF-8?q?#34093=20fix=20p(q)=20for=20p=20?= =?UTF-8?q?=E2=88=88=20CBF[x],=20q=20=E2=88=88=20CBF[y]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sage/rings/polynomial/polynomial_complex_arb.pyx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/polynomial_complex_arb.pyx b/src/sage/rings/polynomial/polynomial_complex_arb.pyx index a9296e20e01..ed4617dd951 100644 --- a/src/sage/rings/polynomial/polynomial_complex_arb.pyx +++ b/src/sage/rings/polynomial/polynomial_complex_arb.pyx @@ -880,6 +880,13 @@ cdef class Polynomial_complex_arb(Polynomial): sage: pol(matrix([[1,2],[3,4]])) [6.000000000000000 10.00000000000000] [15.00000000000000 21.00000000000000] + + TESTS:: + + sage: P. = CBF[] + sage: Q. = CBF[] + sage: x(y) + y """ cdef ComplexBall ball cdef Polynomial_complex_arb poly @@ -895,7 +902,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return ball elif isinstance(point, Polynomial_complex_arb): - poly = self._new() + poly = ( point)._new() sig_on() acb_poly_compose(poly.__poly, self.__poly, ( point).__poly, prec(self)) From 38425b51bcdc7fd556d8bd54f488d4e0a4096b14 Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Tue, 28 Jun 2022 23:46:33 +0800 Subject: [PATCH 177/416] projective_morphism.py: Debug `global_height` fn --- src/sage/schemes/projective/projective_morphism.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 4fe6d715e4f..870795ba520 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -89,6 +89,7 @@ from sage.rings.rational_field import QQ from sage.schemes.generic.morphism import SchemeMorphism_polynomial +from sage.schemes.projective.projective_space import ProjectiveSpace from sage.categories.finite_fields import FiniteFields from sage.categories.number_fields import NumberFields @@ -1346,11 +1347,14 @@ def global_height(self, prec=None): else: raise TypeError("Must be over a Numberfield or a Numberfield Order or QQbar") H = 0 + + coeffs = [] for i in range(self.domain().ambient_space().dimension_relative() + 1): - C = f[i].coefficients() - h = max([c.global_height(prec) for c in C]) - H = max(H, h) - return H + coeffs += f[i].coefficients() + + P = ProjectiveSpace(K, len(coeffs)) + proj_point = P.point(coeffs) + return proj_point.global_height() def local_height(self, v, prec=None): r""" From c7187f42ed44c13ced8458c9bdf8a038f3701f76 Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Wed, 29 Jun 2022 00:14:53 +0800 Subject: [PATCH 178/416] projective_morphism.py: New example and move `import` inside --- src/sage/schemes/projective/projective_morphism.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 870795ba520..c76e397d9df 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -89,7 +89,6 @@ from sage.rings.rational_field import QQ from sage.schemes.generic.morphism import SchemeMorphism_polynomial -from sage.schemes.projective.projective_space import ProjectiveSpace from sage.categories.finite_fields import FiniteFields from sage.categories.number_fields import NumberFields @@ -1338,6 +1337,13 @@ def global_height(self, prec=None): sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) sage: f.global_height() 1.09861228866811 + + :: + + sage: P.=ProjectiveSpace(QQ,1) + sage: f=DynamicalSystem([1/25*x^2 + 25/3*x*y+y^2,1*y^2]) + sage: exp(f.global_height()) + 625.000000000000 """ K = self.domain().base_ring() if K in _NumberFields or is_NumberFieldOrder(K): @@ -1352,6 +1358,8 @@ def global_height(self, prec=None): for i in range(self.domain().ambient_space().dimension_relative() + 1): coeffs += f[i].coefficients() + from sage.schemes.projective.projective_space import ProjectiveSpace + P = ProjectiveSpace(K, len(coeffs)) proj_point = P.point(coeffs) return proj_point.global_height() From 7b64a0fd61c5a8df8cc389cebb1d8cfca835fc09 Mon Sep 17 00:00:00 2001 From: Emmanuel Charpentier Date: Tue, 28 Jun 2022 18:35:08 +0200 Subject: [PATCH 179/416] Trac 34087 : fix typo and thinko... --- src/sage/interfaces/mathematica.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/interfaces/mathematica.py b/src/sage/interfaces/mathematica.py index d52fee3441e..0e87194205e 100644 --- a/src/sage/interfaces/mathematica.py +++ b/src/sage/interfaces/mathematica.py @@ -370,9 +370,10 @@ sage: exp(x)._mathematica_().sage() # optional -- mathematica e^x -Check that all trig/hypergolic functions and their reciprocals are correctly +Check that all trig/hyperbolic functions and their reciprocals are correctly translated to Mathematica (:trac:`34087`):: + # optional - mathematica sage: x=var('x') sage: FL=[sin, cos, tan, csc, sec, cot, sinh, cosh, tanh, csch, sech, coth] sage: IFL=[arcsin, arccos, arctan, arccsc, arcsec, arccot, arcsinh, arccosh, From d16938594455c1b5b2df44e6081cda45a644671a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= Date: Tue, 28 Jun 2022 19:06:48 +0200 Subject: [PATCH 180/416] 34096: Fix typo: enviroment -> environment --- bootstrap-conda | 2 +- build/bin/sage-sdist | 4 ++-- m4/ppl.m4 | 4 ++-- src/bin/sage-env | 8 ++++---- src/bin/sage-update-version | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bootstrap-conda b/bootstrap-conda index 6638afde3d7..596b449e3e0 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -45,7 +45,7 @@ for PKG_BASE in $(sage-package list --has-file distros/conda.txt); do fi fi done -echo >&2 $0:$LINENO: generate conda enviroment files +echo >&2 $0:$LINENO: generate conda environment files echo "name: sage-build" > environment.yml echo "channels:" >> environment.yml echo " - conda-forge" >> environment.yml diff --git a/build/bin/sage-sdist b/build/bin/sage-sdist index 5b7c04c71f9..f2774e6b6bd 100755 --- a/build/bin/sage-sdist +++ b/build/bin/sage-sdist @@ -25,11 +25,11 @@ if [ $# -gt 1 ]; then fi if [ -z "$SAGE_ROOT" ]; then - die "must be run from within a Sage enviroment, or with SAGE_ROOT provided" + die "must be run from within a Sage environment, or with SAGE_ROOT provided" fi if [ -z "$SAGE_SRC" ]; then - die "must be run from within a Sage enviroment, or with SAGE_SRC provided" + die "must be run from within a Sage environment, or with SAGE_SRC provided" fi if [ "$#" -gt 0 ]; then diff --git a/m4/ppl.m4 b/m4/ppl.m4 index 8a23895dc9b..2f4dc127e74 100644 --- a/m4/ppl.m4 +++ b/m4/ppl.m4 @@ -180,7 +180,7 @@ main() { << "\n*** was found! If ppl-config was correct, then it is best" "\n*** to remove the old version of PPL." " You may also be able to fix the error" - "\n*** by modifying your LD_LIBRARY_PATH enviroment variable," + "\n*** by modifying your LD_LIBRARY_PATH environment variable," " or by editing" "\n*** /etc/ld.so.conf." " Make sure you have run ldconfig if that is" @@ -224,7 +224,7 @@ main() { " variable to point" "\n*** to the correct copy of ppl-config. (In this case," " you will have to" - "\n*** modify your LD_LIBRARY_PATH enviroment" + "\n*** modify your LD_LIBRARY_PATH environment" " variable or edit /etc/ld.so.conf" "\n*** so that the correct libraries are found at run-time.)" << endl; diff --git a/src/bin/sage-env b/src/bin/sage-env index 5875e617c32..6459c5aca78 100644 --- a/src/bin/sage-env +++ b/src/bin/sage-env @@ -200,7 +200,7 @@ fi if [ 1 = 2 ]; then - echo "The following enviroment variables can be set by the user" + echo "The following environment variables can be set by the user" echo "AR The archiver (e.g. ar, /usr/ccs/bin/ar or /usr/bin/ar)" echo "AS The assembler (e.g. as, /usr/ccs/bin/as or /usr/bin/as)" echo "CC The C compiler (e.g cc, /opt/SUNWspro/bin/cc or /usr/bin/gcc)" @@ -217,10 +217,10 @@ if [ 1 = 2 ]; then echo "SHAREDFLAGS Flag(s) necessary for building a shared library (e.g. -fPIC or -xcode=pic32)" echo "We attempt to set this to sensible values, but check below to" echo "ensure they are OK. If you wish to override any then please use:" - echo "setenv NAME_OF_ENVIROMENT_VARIABLE value_of_enviroment_variable" + echo "setenv NAME_OF_ENVIRONMENT_VARIABLE value_of_environment_variable" echo "(if you use tcsh, csh or a similar shell) or" - echo "NAME_OF_ENVIROMENT_VARIABLE value_of_enviroment_variable" - echo "export NAME_OF_ENVIROMENT_VARIABLE" + echo "NAME_OF_ENVIRONMENT_VARIABLE value_of_environment_variable" + echo "export NAME_OF_ENVIRONMENT_VARIABLE" echo "if you use sh, bash or a similar shell" fi diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index be312ed5775..25e4c594798 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -22,11 +22,11 @@ if [ $# -ne 1 ]; then fi if [ -z "$SAGE_ROOT" ]; then - die "must be run from within a Sage enviroment, or with SAGE_ROOT provided" + die "must be run from within a Sage environment, or with SAGE_ROOT provided" fi if [ -z "$SAGE_SRC" ]; then - die "must be run from within a Sage enviroment, or with SAGE_SRC provided" + die "must be run from within a Sage environment, or with SAGE_SRC provided" fi set -e From 843d4b33a5d05a7f2e41f099fab7c555bd55c792 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Jun 2022 16:41:50 -0700 Subject: [PATCH 181/416] build/pkgs/fastjsonschema: New, dep of nbformat --- build/pkgs/fastjsonschema/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/fastjsonschema/checksums.ini | 5 +++++ build/pkgs/fastjsonschema/dependencies | 4 ++++ build/pkgs/fastjsonschema/install-requires.txt | 1 + build/pkgs/fastjsonschema/package-version.txt | 1 + build/pkgs/fastjsonschema/spkg-install.in | 2 ++ build/pkgs/fastjsonschema/type | 1 + build/pkgs/nbformat/dependencies | 2 +- 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/fastjsonschema/SPKG.rst create mode 100644 build/pkgs/fastjsonschema/checksums.ini create mode 100644 build/pkgs/fastjsonschema/dependencies create mode 100644 build/pkgs/fastjsonschema/install-requires.txt create mode 100644 build/pkgs/fastjsonschema/package-version.txt create mode 100644 build/pkgs/fastjsonschema/spkg-install.in create mode 100644 build/pkgs/fastjsonschema/type diff --git a/build/pkgs/fastjsonschema/SPKG.rst b/build/pkgs/fastjsonschema/SPKG.rst new file mode 100644 index 00000000000..cd4ab3f51c2 --- /dev/null +++ b/build/pkgs/fastjsonschema/SPKG.rst @@ -0,0 +1,18 @@ +fastjsonschema: Fastest Python implementation of JSON schema +============================================================ + +Description +----------- + +Fastest Python implementation of JSON schema + +License +------- + +BSD + +Upstream Contact +---------------- + +https://pypi.org/project/fastjsonschema/ + diff --git a/build/pkgs/fastjsonschema/checksums.ini b/build/pkgs/fastjsonschema/checksums.ini new file mode 100644 index 00000000000..94301089b1a --- /dev/null +++ b/build/pkgs/fastjsonschema/checksums.ini @@ -0,0 +1,5 @@ +tarball=fastjsonschema-VERSION.tar.gz +sha1=3634374e5004103a3789753f0c145bb798f90874 +md5=c371e5315f66bdd18b62e14c66f89543 +cksum=2483060937 +upstream_url=https://pypi.io/packages/source/f/fastjsonschema/fastjsonschema-VERSION.tar.gz diff --git a/build/pkgs/fastjsonschema/dependencies b/build/pkgs/fastjsonschema/dependencies new file mode 100644 index 00000000000..0738c2d7777 --- /dev/null +++ b/build/pkgs/fastjsonschema/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/fastjsonschema/install-requires.txt b/build/pkgs/fastjsonschema/install-requires.txt new file mode 100644 index 00000000000..f4ffe07938c --- /dev/null +++ b/build/pkgs/fastjsonschema/install-requires.txt @@ -0,0 +1 @@ +fastjsonschema diff --git a/build/pkgs/fastjsonschema/package-version.txt b/build/pkgs/fastjsonschema/package-version.txt new file mode 100644 index 00000000000..6480dd5ed87 --- /dev/null +++ b/build/pkgs/fastjsonschema/package-version.txt @@ -0,0 +1 @@ +2.15.3 diff --git a/build/pkgs/fastjsonschema/spkg-install.in b/build/pkgs/fastjsonschema/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/fastjsonschema/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/fastjsonschema/type b/build/pkgs/fastjsonschema/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/fastjsonschema/type @@ -0,0 +1 @@ +standard diff --git a/build/pkgs/nbformat/dependencies b/build/pkgs/nbformat/dependencies index 252d9165ae1..258e07a9163 100644 --- a/build/pkgs/nbformat/dependencies +++ b/build/pkgs/nbformat/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) jsonschema +$(PYTHON) jsonschema fastjsonschema jupyter_core traitlets | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. From 4e7cc74f61f0d700046486aa3cabd0d667a8de8b Mon Sep 17 00:00:00 2001 From: dcoudert Date: Thu, 30 Jun 2022 13:16:23 +0200 Subject: [PATCH 182/416] trac #34063: review comments --- src/sage/graphs/base/c_graph.pyx | 4 ++-- src/sage/graphs/base/static_sparse_backend.pyx | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index b99fc36241e..4ba55585bc9 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -4208,8 +4208,8 @@ cdef class CGraphBackend(GenericGraphBackend): # seen should be associated to the empty path # for 0 <= v_int < (self._cg).active_vertices.size: - # if bitset_in((self._cg).active_vertices, v_int) and not bitset_in(seen, v_int): - # distances[vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg)] = [] + # if bitset_in((self._cg).active_vertices, v_int) and not bitset_in(seen, v_int): + # distances[vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg)] = [] bitset_free(seen) return distances diff --git a/src/sage/graphs/base/static_sparse_backend.pyx b/src/sage/graphs/base/static_sparse_backend.pyx index 1392dae2fba..9ef4b6c74b1 100644 --- a/src/sage/graphs/base/static_sparse_backend.pyx +++ b/src/sage/graphs/base/static_sparse_backend.pyx @@ -1077,7 +1077,7 @@ cdef class StaticSparseBackend(CGraphBackend): - ``1`` -- test whether subgraph of ``self`` induced by the vertices is a subgraph of ``other`` - ``2`` -- as ``1`` but ignore the labels """ - cdef object v, label + cdef object v, l cdef int u_int, prev_u_int, v_int, l_int, l_int_other, tmp cdef StaticSparseCGraph cg = self._cg cdef CGraph cg_other = other.cg() @@ -1149,10 +1149,10 @@ cdef class StaticSparseBackend(CGraphBackend): # Ignore loops, if ``other`` does not allow them. continue - label = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) + l = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) # Will return ``0``, if ``other`` does not support edge labels. - l_int_other = other.new_edge_label(label) + l_int_other = other.new_edge_label(l) cg_other.add_arc_label_unsafe(vertices_translation[v_int], vertices_translation[u_int], l_int_other) @@ -1175,19 +1175,19 @@ cdef class StaticSparseBackend(CGraphBackend): if len(all_arc_labels) > len(all_arc_labels_other): return 0 else: - for label in all_arc_labels: + for l in all_arc_labels: try: - all_arc_labels_other.remove(label) + all_arc_labels_other.remove(l) except ValueError: return 0 continue prev_u_int = u_int - label = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) + l = edge_label(cg.g, cg.g.neighbors[v_int] + tmp) if modus == 1: - if not other._has_labeled_edge_unsafe(vertices_translation[v_int], vertices_translation[u_int], label): + if not other._has_labeled_edge_unsafe(vertices_translation[v_int], vertices_translation[u_int], l): return 0 else: # Ignore the label. From 7b44c530beb8b8efa94f0572fd31941a7e04af48 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Thu, 30 Jun 2022 14:46:49 +0200 Subject: [PATCH 183/416] trac #34063: remove commented block --- src/sage/graphs/base/c_graph.pyx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index 4ba55585bc9..f2d3a8cfd52 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -4105,8 +4105,8 @@ cdef class CGraphBackend(GenericGraphBackend): def shortest_path_all_vertices(self, v, cutoff=None, distance_flag=False): r""" - Return for each vertex ``u`` a shortest ``v-u`` path or distance from - ``v`` to ``u``. + Return for each reachable vertex ``u`` a shortest ``v-u`` path or + distance from ``v`` to ``u``. INPUT: @@ -4146,7 +4146,7 @@ cdef class CGraphBackend(GenericGraphBackend): sage: g._backend.shortest_path_all_vertices(0, distance_flag=True) {0: 0, 1: 1, 2: 2, 3: 2, 4: 1, 5: 1, 6: 2, 7: 2, 8: 2, 9: 2} - On a disconnected graph :: + On a disconnected graph:: sage: g = 2 * graphs.RandomGNP(20, .3) sage: paths = g._backend.shortest_path_all_vertices(0) @@ -4204,13 +4204,6 @@ cdef class CGraphBackend(GenericGraphBackend): current_layer = next_layer next_layer = [] - # If the graph is not connected, vertices which have not been - # seen should be associated to the empty path - - # for 0 <= v_int < (self._cg).active_vertices.size: - # if bitset_in((self._cg).active_vertices, v_int) and not bitset_in(seen, v_int): - # distances[vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg)] = [] - bitset_free(seen) return distances From 5c52eea9607d9af3556d9e7a9ecbdd72caa3cc9d Mon Sep 17 00:00:00 2001 From: Emmanuel Charpentier Date: Thu, 30 Jun 2022 21:42:42 +0200 Subject: [PATCH 184/416] Trac 34087 : fiddle with doctest formatting. --- src/sage/interfaces/mathematica.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/sage/interfaces/mathematica.py b/src/sage/interfaces/mathematica.py index 0e87194205e..2bbfd373503 100644 --- a/src/sage/interfaces/mathematica.py +++ b/src/sage/interfaces/mathematica.py @@ -373,12 +373,14 @@ Check that all trig/hyperbolic functions and their reciprocals are correctly translated to Mathematica (:trac:`34087`):: - # optional - mathematica - sage: x=var('x') - sage: FL=[sin, cos, tan, csc, sec, cot, sinh, cosh, tanh, csch, sech, coth] - sage: IFL=[arcsin, arccos, arctan, arccsc, arcsec, arccot, arcsinh, arccosh, - ....: arctanh, arccsch, arcsech, arccoth] - sage: [mathematica.TrigToExp(u(x)).sage() for u in FL] + sage: x=var('x') # optional - mathematica + sage: FL=[sin, cos, tan, csc, sec, cot, # optional - mathematica + ....: sinh, cosh, tanh, csch, sech, coth] # optional - mathematica + sage: IFL=[arcsin, arccos, arctan, arccsc, # optional - mathematica + ....: arcsec, arccot, arcsinh, arccosh, # optional - mathematica + ....: arctanh, arccsch, arcsech, arccoth] # optional - mathematica + sage: [mathematica.TrigToExp(u(x)).sage() # optional - mathematica + ....: for u in FL] # optional - mathematica [-1/2*I*e^(I*x) + 1/2*I*e^(-I*x), 1/2*e^(I*x) + 1/2*e^(-I*x), (-I*e^(I*x) + I*e^(-I*x))/(e^(I*x) + e^(-I*x)), @@ -387,11 +389,12 @@ -(-I*e^(I*x) - I*e^(-I*x))/(e^(I*x) - e^(-I*x)), -1/2*e^(-x) + 1/2*e^x, 1/2*e^(-x) + 1/2*e^x, - -e^(-x)/(e^(-x) + e^x) + e^x/(e^(-x) + e^x), + -e^(-x)/(e^(-x) + e^x) + e^x/(e^(-x) + e^x), -2/(e^(-x) - e^x), 2/(e^(-x) + e^x), -(e^(-x) + e^x)/(e^(-x) - e^x)] - sage: [mathematica.TrigToExp(u(x)).sage() for u in IFL] + sage: [mathematica.TrigToExp(u(x)).sage() # optional - mathematica + ....: for u in IFL] # optional - mathematica [-I*log(I*x + sqrt(-x^2 + 1)), 1/2*pi + I*log(I*x + sqrt(-x^2 + 1)), -1/2*I*log(I*x + 1) + 1/2*I*log(-I*x + 1), From 0bce7e39e6fcf1e0963ea38f94e4ad0736044047 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 30 Jun 2022 16:56:28 -0600 Subject: [PATCH 185/416] Fix infinite recursion in mpq_randomize_entry_recip_uniform_nonzero The function calls itself instead of calling mpq_randomize_entry_recip_uniform, then retrying if zero is obtained. --- src/sage/libs/gmp/randomize.pxd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/libs/gmp/randomize.pxd b/src/sage/libs/gmp/randomize.pxd index 51087eaa02e..cdbef70f2c7 100644 --- a/src/sage/libs/gmp/randomize.pxd +++ b/src/sage/libs/gmp/randomize.pxd @@ -53,6 +53,6 @@ cdef inline void mpq_randomize_entry_recip_uniform(mpq_t x): mpq_canonicalize(x) cdef inline void mpq_randomize_entry_recip_uniform_nonzero(mpq_t x): - mpq_randomize_entry_recip_uniform_nonzero(x) + mpq_randomize_entry_recip_uniform(x) while mpq_sgn(x) == 0: - mpq_randomize_entry_recip_uniform_nonzero(x) + mpq_randomize_entry_recip_uniform(x) From 8e640f4b562dfc2868a0ab99e86c5c883fb8783a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Jun 2022 16:56:37 -0700 Subject: [PATCH 186/416] src/sage/matrix/matrix_rational_dense.pyx: Add doctest --- src/sage/matrix/matrix_rational_dense.pyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 6c632bc4d7f..40d1ca0b8cf 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -2358,6 +2358,13 @@ cdef class Matrix_rational_dense(Matrix_dense): False sage: any(b[i,j].is_zero() for i in range(10) for j in range(10)) False + + Check that :trac:`34103` is fixed:: + + sage: a = matrix(QQ, 10, 10, 1) + sage: a.randomize(nonzero=True, distribution='1/n') + sage: bool(a) + True """ density = float(density) if density <= 0.0: From a182698d195cfb07cb24d7d1f48da93fd36aa0ff Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Fri, 1 Jul 2022 13:45:58 +0800 Subject: [PATCH 187/416] Debug `global_height` for proj morphism --- src/sage/schemes/projective/projective_morphism.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index c76e397d9df..a686d94be7a 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1287,8 +1287,7 @@ def is_morphism(self): def global_height(self, prec=None): r""" - Returns the maximum of the absolute logarithmic heights of the coefficients - in any of the coordinate functions of this map. + Return the global height of the coefficients as a projective point. INPUT: @@ -1360,9 +1359,8 @@ def global_height(self, prec=None): from sage.schemes.projective.projective_space import ProjectiveSpace - P = ProjectiveSpace(K, len(coeffs)) - proj_point = P.point(coeffs) - return proj_point.global_height() + P = ProjectiveSpace(K, len(coeffs)-1) + return P.point(coeffs).global_height() def local_height(self, v, prec=None): r""" From eb1d7918cc48c5c111f3031b1460ff09be272de0 Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Fri, 1 Jul 2022 13:55:21 +0800 Subject: [PATCH 188/416] More doc --- .../schemes/projective/projective_morphism.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index a686d94be7a..0cdef5404ad 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1339,10 +1339,23 @@ def global_height(self, prec=None): :: - sage: P.=ProjectiveSpace(QQ,1) - sage: f=DynamicalSystem([1/25*x^2 + 25/3*x*y+y^2,1*y^2]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) sage: exp(f.global_height()) 625.000000000000 + + :: + + Scaling should not change the result: + + sage: P. = ProjectiveSpace(QQ, 1) + sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) + sage: f.global_height() + 6.43775164973640 + sage: c = 10000 + sage: f.scale_by(c) + sage: f.global_height() + 6.43775164973640 """ K = self.domain().base_ring() if K in _NumberFields or is_NumberFieldOrder(K): @@ -1351,7 +1364,6 @@ def global_height(self, prec=None): f = self._number_field_from_algebraics() else: raise TypeError("Must be over a Numberfield or a Numberfield Order or QQbar") - H = 0 coeffs = [] for i in range(self.domain().ambient_space().dimension_relative() + 1): From 71c8807bf1210d8f3c51c855b87306a8c6ef97e7 Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Fri, 1 Jul 2022 14:45:25 +0800 Subject: [PATCH 189/416] Correct impl of `global_height` for affine morphism --- src/sage/schemes/affine/affine_morphism.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index fc24ec0fb65..866720b848e 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -684,8 +684,7 @@ def as_dynamical_system(self): def global_height(self, prec=None): r""" - Returns the maximum of the heights of the coefficients in any - of the coordinate functions of the affine morphism. + Return the global height of the coefficients as a projective point. INPUT: @@ -719,16 +718,17 @@ def global_height(self, prec=None): sage: f = H([7*x^2 + 1513]); sage: f.global_height() 7.32184971378836 + + :: + + sage: A. = AffineSpace(QQ, 1) + sage: B. = AffineSpace(QQ, 2) + sage: H = Hom(A, B) + sage: f = H([1/3 * x^2 + 10, 7 * x^3]) + sage: f.global_height() + 3.40119738166216 """ - H=0 - for i in range(self.domain().ambient_space().dimension_relative()): - C = self[i].coefficients() - if not C: # to deal with the case self[i]=0 - h=0 - else: - h = max([c.global_height(prec) for c in C]) - H = max(H,h) - return H + return self.homogenize(0).global_height() def jacobian(self): r""" From e53971f2f2f657a90c29a0bcdc1d8209bf84a250 Mon Sep 17 00:00:00 2001 From: Emmanuel Charpentier Date: Fri, 1 Jul 2022 23:35:47 +0200 Subject: [PATCH 190/416] Trac#34087 : doubleplus nitpicking doctest formatting. --- src/sage/interfaces/mathematica.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/interfaces/mathematica.py b/src/sage/interfaces/mathematica.py index 2bbfd373503..caf402a4411 100644 --- a/src/sage/interfaces/mathematica.py +++ b/src/sage/interfaces/mathematica.py @@ -375,12 +375,12 @@ sage: x=var('x') # optional - mathematica sage: FL=[sin, cos, tan, csc, sec, cot, # optional - mathematica - ....: sinh, cosh, tanh, csch, sech, coth] # optional - mathematica + ....: sinh, cosh, tanh, csch, sech, coth] sage: IFL=[arcsin, arccos, arctan, arccsc, # optional - mathematica - ....: arcsec, arccot, arcsinh, arccosh, # optional - mathematica - ....: arctanh, arccsch, arcsech, arccoth] # optional - mathematica + ....: arcsec, arccot, arcsinh, arccosh, + ....: arctanh, arccsch, arcsech, arccoth] sage: [mathematica.TrigToExp(u(x)).sage() # optional - mathematica - ....: for u in FL] # optional - mathematica + ....: for u in FL] [-1/2*I*e^(I*x) + 1/2*I*e^(-I*x), 1/2*e^(I*x) + 1/2*e^(-I*x), (-I*e^(I*x) + I*e^(-I*x))/(e^(I*x) + e^(-I*x)), @@ -394,7 +394,7 @@ 2/(e^(-x) + e^x), -(e^(-x) + e^x)/(e^(-x) - e^x)] sage: [mathematica.TrigToExp(u(x)).sage() # optional - mathematica - ....: for u in IFL] # optional - mathematica + ....: for u in IFL] [-I*log(I*x + sqrt(-x^2 + 1)), 1/2*pi + I*log(I*x + sqrt(-x^2 + 1)), -1/2*I*log(I*x + 1) + 1/2*I*log(-I*x + 1), From 30dd5f26d32036b41f7fbbb35e2e6687a9186cdf Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Sat, 2 Jul 2022 15:41:17 +0800 Subject: [PATCH 191/416] local height for affine morphism --- src/sage/schemes/affine/affine_morphism.py | 55 ++++++++++++++++++- .../schemes/projective/projective_morphism.py | 2 +- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 866720b848e..308d34fa909 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -72,6 +72,10 @@ from sage.ext.fast_callable import fast_callable +from sage.categories.number_fields import NumberFields +from sage.rings.number_field.order import is_NumberFieldOrder + +_NumberFields = NumberFields() _Fields = Fields() @@ -699,7 +703,7 @@ def global_height(self, prec=None): sage: H = Hom(A, A) sage: f = H([1/1331*x^2 + 4000]); sage: f.global_height() - 8.29404964010203 + 15.4877354584971 :: @@ -709,7 +713,7 @@ def global_height(self, prec=None): sage: H = Hom(A, A) sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]); sage: f.global_height(prec=100) - 3.3696683136785869233538671082 + 4.17438726989564 :: @@ -730,6 +734,53 @@ def global_height(self, prec=None): """ return self.homogenize(0).global_height() + def local_height(self, v, prec=None): + """ + Return the maximum of the local heights of the coefficients in any + of the coordinate functions of this map. + + INPUT: + + - ``v`` -- a prime or prime ideal of the base ring. + + - ``prec`` -- desired floating point precision (default: + default RealField precision). + + OUTPUT: + + - a real number. + + EXAMPLES:: + + sage: P. = AffineSpace(QQ, 2) + sage: H = Hom(P, P) + sage: f = H([1/1331 * x^2 + 1/4000 * y^2, 210 * x * y]); + sage: f.local_height(1331) + 7.19368581839511 + + :: + + sage: P. = AffineSpace(QQ, 3) + sage: H = Hom(P, P) + sage: f = H([4 * x^2 + 3/100 * y^2, 8/210 * x * y, 1/10000 * z^2]); + sage: f.local_height(2) + 2.77258872223978 + + :: + + sage: R. = PolynomialRing(QQ) + sage: K. = NumberField(z^2 - 2) + sage: P. = AffineSpace(K, 2) + sage: H = Hom(P, P) + sage: f = H([2 * x^2 + w/3 * y^2, 1/w * y^2]) + sage: f.local_height(K.ideal(3)) + 1.09861228866811 + """ + K = FractionField(self.domain().base_ring()) + if K not in _NumberFields or is_NumberFieldOrder(K): + raise TypeError("must be over a number field or a number field order") + return max([K(c).local_height(v, prec) for f in self for c in f.coefficients()]) + def jacobian(self): r""" Return the Jacobian matrix of partial derivative of this map. diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 0cdef5404ad..9ce2ee6b663 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1420,7 +1420,7 @@ def local_height(self, v, prec=None): 1.09861228866811 """ K = FractionField(self.domain().base_ring()) - if K not in _NumberFields: + if K not in _NumberFields or is_NumberFieldOrder(K): raise TypeError("must be over a number field or a number field order") return max([K(c).local_height(v, prec) for f in self for c in f.coefficients()]) From 28369c6885e4cadad8bad7055aaac21bbdb600ec Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Sat, 2 Jul 2022 15:55:05 +0800 Subject: [PATCH 192/416] local_height_arch for affine morphism --- src/sage/schemes/affine/affine_morphism.py | 44 +++++++++++++++++++ .../schemes/projective/projective_morphism.py | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 308d34fa909..925bdff0f68 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -66,6 +66,7 @@ from sage.rings.fraction_field import FractionField from sage.rings.fraction_field_element import FractionFieldElement from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ from sage.rings.finite_rings.finite_field_constructor import is_FiniteField from sage.schemes.generic.morphism import SchemeMorphism_polynomial @@ -781,6 +782,49 @@ def local_height(self, v, prec=None): raise TypeError("must be over a number field or a number field order") return max([K(c).local_height(v, prec) for f in self for c in f.coefficients()]) + def local_height_arch(self, i, prec=None): + """ + Return the maximum of the local height at the ``i``-th infinite place + of the coefficients in any of the coordinate functions of this map. + + INPUT: + + - ``i`` -- an integer. + + - ``prec`` -- desired floating point precision (default: + default RealField precision). + + OUTPUT: + + - a real number. + + EXAMPLES:: + + sage: P. = AffineSpace(QQ, 2) + sage: H = Hom(P, P) + sage: f = H([1/1331 * x^2 + 1/4000 * y^2, 210 * x * y]); + sage: f.local_height_arch(0) + 5.34710753071747 + + :: + + sage: R. = PolynomialRing(QQ) + sage: K. = NumberField(z^2 - 2) + sage: P. = AffineSpace(K, 2) + sage: H = Hom(P, P) + sage: f = H([2 * x^2 + w/3 * y^2, 1/w * y^2]) + sage: f.local_height_arch(1) + 0.6931471805599453094172321214582 + """ + K = FractionField(self.domain().base_ring()) + if K not in _NumberFields or is_NumberFieldOrder(K): + raise TypeError("must be over a number field or a number field order") + + if K == QQ: + return max([K(c).local_height_arch(prec=prec) for f in self for c in f.coefficients()]) + else: + return max([K(c).local_height_arch(i, prec=prec) for f in self for c in f.coefficients()]) + def jacobian(self): r""" Return the Jacobian matrix of partial derivative of this map. diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 9ce2ee6b663..7e6f92ab114 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1459,7 +1459,7 @@ def local_height_arch(self, i, prec=None): 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) - if K not in _NumberFields: + if K not in _NumberFields or is_NumberFieldOrder(K): raise TypeError("must be over a number field or a number field order") if K == QQ: return max([K(c).local_height_arch(prec=prec) for f in self for c in f.coefficients()]) From 2a7342f6f9c00812d47ad90c3b27e2483f1e07ae Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Jul 2022 10:27:01 -0700 Subject: [PATCH 193/416] src/sage/repl/display/jsmol_iframe.py: Update extension name following version 2022.1.0 --- build/pkgs/jupyter_jsmol/install-requires.txt | 2 +- src/sage/repl/display/jsmol_iframe.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/pkgs/jupyter_jsmol/install-requires.txt b/build/pkgs/jupyter_jsmol/install-requires.txt index 9465bfb8e0c..2df501ec9a8 100644 --- a/build/pkgs/jupyter_jsmol/install-requires.txt +++ b/build/pkgs/jupyter_jsmol/install-requires.txt @@ -1 +1 @@ -jupyter-jsmol +jupyter-jsmol >=2022.1.0 diff --git a/src/sage/repl/display/jsmol_iframe.py b/src/sage/repl/display/jsmol_iframe.py index 0917a59d47d..4775d2a02e7 100644 --- a/src/sage/repl/display/jsmol_iframe.py +++ b/src/sage/repl/display/jsmol_iframe.py @@ -98,7 +98,7 @@ def __init__(self, jmol, path_to_jsmol=None, width='100%', height='100%'): instance. The 3-d scene to show. - ``path_to_jsmol`` -- string (optional, default is - ``'/nbextensions/jupyter_jsmol/jsmol'``). The path (relative or absolute) + ``'/nbextensions/jupyter-jsmol/jsmol'``). The path (relative or absolute) where ``JSmol.min.js`` is served on the web server. - ``width`` -- integer or string (optional, default: @@ -121,7 +121,7 @@ def __init__(self, jmol, path_to_jsmol=None, width='100%', height='100%'): self._jmol = jmol self._zip = zipfile.ZipFile(io.BytesIO(self._jmol.scene_zip.get())) if path_to_jsmol is None: - self._path = os.path.join('/', 'nbextensions', 'jupyter_jsmol', 'jsmol') + self._path = os.path.join('/', 'nbextensions', 'jupyter-jsmol', 'jsmol') else: self._path = path_to_jsmol self._width = width From 211f9647f946a428c599a83de0219c55e7eaa293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 3 Jul 2022 11:10:48 +0200 Subject: [PATCH 194/416] pep8 for sagedoc.py --- src/sage/misc/sagedoc.py | 130 +++++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 59 deletions(-) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 197b6c0bb78..df9e153ebf2 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -39,14 +39,13 @@ # the License, or (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** - - import os import re import sys import pydoc from sage.misc.temporary_file import tmp_dir from .viewer import browser +from . import sageinspect import sage.version from sage.env import SAGE_DOC, SAGE_SRC @@ -88,7 +87,7 @@ (r'\\ast', ' *'), (r' \\times', ' x'), (r'\\times', ' x'), - (r'\\backslash','\\'), + (r'\\backslash', '\\'), (r'\\mapsto', ' |--> '), (r'\\longmapsto', ' |---> '), (r'\\lvert', '|'), @@ -98,24 +97,24 @@ (r'\\circ', ' o') ] nonmath_substitutes = [ - ('\\_','_'), + ('\\_', '_'), ('\\item', '* '), - ('',''), + ('', ''), ('\\bf', ''), ('\\sage', 'Sage'), ('\\SAGE', 'Sage'), ('\\Sage', 'Sage'), ('\\rm', ''), - ('backslash','\\'), - ('begin{enumerate}',''), - ('end{enumerate}',''), - ('begin{description}',''), - ('end{description}',''), - ('begin{itemize}',''), - ('end{itemize}',''), - ('begin{verbatim}',''), - ('end{verbatim}',''), - ('note{','NOTE: '), + ('backslash', '\\'), + ('begin{enumerate}', ''), + ('end{enumerate}', ''), + ('begin{description}', ''), + ('end{description}', ''), + ('begin{itemize}', ''), + ('end{itemize}', ''), + ('begin{verbatim}', ''), + ('end{verbatim}', ''), + ('note{', 'NOTE: '), ] @@ -152,7 +151,7 @@ def _rmcmd(s, cmd, left='', right=''): if i == -1: return s nesting = 1 - j = i+len(c)+1 + j = i + len(c) + 1 while j < len(s) and nesting > 0: if s[j] == '{': nesting += 1 @@ -161,7 +160,7 @@ def _rmcmd(s, cmd, left='', right=''): j += 1 j -= 1 # j is position of closing '}' if j < len(s): - s = s[:i] + left + s[i+len(c):j] + right + s[j+1:] + s = s[:i] + left + s[i + len(c):j] + right + s[j + 1:] else: return s @@ -172,16 +171,17 @@ def _rmcmd(s, cmd, left='', right=''): # the above works fine. # -## import re -## def _rmcmd(s, cmd, left='', right=''): -## c = '\\%s{.*}'%cmd -## r = re.compile(c, re.DOTALL) -## while True: -## m = r.search(s) -## if m is None: break -## s = s[:m.start()] + left + s[m.start()+len(cmd)+1:m.end()-1] \ -## + right + s[m.end():] -## return s +# import re +# def _rmcmd(s, cmd, left='', right=''): +# c = '\\%s{.*}'%cmd +# r = re.compile(c, re.DOTALL) +# while True: +# m = r.search(s) +# if m is None: break +# s = s[:m.start()] + left + s[m.start()+len(cmd)+1:m.end()-1] \ +# + right + s[m.end():] +# return s + itempattern = re.compile(r"\\item\[?([^]]*)\]? *(.*)") itemreplace = r"* \1 \2" @@ -236,9 +236,9 @@ def detex(s, embedded=False): s = re.sub(itempattern, itemreplace, s) - for a,b in nonmath_substitutes: - s = s.replace(a,b) - if not embedded: # not in the notebook + for a, b in nonmath_substitutes: + s = s.replace(a, b) + if not embedded: # not in the notebook s = _rmcmd(s, 'mathop') s = _rmcmd(s, 'mathrm') try: @@ -251,10 +251,11 @@ def detex(s, embedded=False): # TeX commands like "\\blah". Do a regular expression # replacement to replace "\\blah" but not "\\blahxyz", etc.: # test to make sure the next character is not a letter. - for a,b in math_substitutes: - s = re.sub(a+'([^a-zA-Z])', b+'\\1', s) + for a, b in math_substitutes: + s = re.sub(a + '([^a-zA-Z])', b + '\\1', s) return s + def skip_TESTS_block(docstring): r""" Remove blocks labeled "TESTS:" from ``docstring``. @@ -395,7 +396,8 @@ def skip_TESTS_block(docstring): s += "\n" s += l previous = l - return s[1:] # Remove empty line from the beginning. + return s[1:] # Remove empty line from the beginning. + def process_dollars(s): r"""nodetex @@ -456,7 +458,7 @@ def process_dollars(s): # 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')) - whitespace = ' ' * (whitespace.end() - 1) # leading whitespace + whitespace = ' ' * (whitespace.end() - 1) # leading whitespace # Indices will be a list of pairs of positions in s, to search between. # If the following search has no matches, then indices will be (0, len(s)). indices = [0] @@ -482,14 +484,14 @@ def process_dollars(s): # except that this doesn't work, so use the equivalent regular # expression without the 're.X' option. Maybe 'whitespace' gets # eaten up by re.X? - regexp = "^" + "(%s)?"%whitespace + r"(\S.*?)?(?>>') + j = s[i_0 + i + 3:].find('>>>') if j == -1: break - obj = s[i_0+i+3 : i_0+i+3+j] + obj = s[i_0 + i + 3:i_0 + i + 3 + j] if obj in docs: t = '' else: try: - x = eval('sage.all.%s'%obj, locals()) + x = eval('sage.all.%s' % obj, locals()) except AttributeError: # A pair <<<...>>> has been found, but the object not. - i_0 += i+6+j + i_0 += i + 6 + j continue except SyntaxError: # This is a simple heuristics to cover the case of # a non-matching set of <<< and >>> - i_0 += i+3 + i_0 += i + 3 continue t0 = sage.misc.sageinspect.sage_getdef(x, obj) t1 = sage.misc.sageinspect.sage_getdoc(x) t = 'Definition: ' + t0 + '\n\n' + t1 docs.add(obj) - s = s[:i_0+i] + '\n' + t + s[i_0+i+6+j:] + s = s[:i_0 + i] + '\n' + t + s[i_0 + i + 6 + j:] i_0 += i if 'nodetex' not in directives: @@ -764,6 +769,7 @@ def format(s, embedded=False): s = detex(s, embedded=embedded) return s + def format_src(s): """ Format Sage source code ``s`` for viewing with IPython. @@ -796,23 +802,24 @@ def format_src(s): i = s.find("<<<") if i == -1: break - j = s[i+3:].find('>>>') + j = s[i + 3:].find('>>>') if j == -1: break - obj = s[i+3:i+3+j] + obj = s[i + 3:i + 3 + j] if obj in docs: t = '' else: - x = eval('sage.all.%s'%obj, locals()) + x = eval('sage.all.%s' % obj, locals()) t = my_getsource(x) docs.add(obj) if t is None: print(x) t = '' - s = s[:i] + '\n' + t + s[i+6+j:] + s = s[:i] + '\n' + t + s[i + 6 + j:] return s + ############################### def _search_src_or_doc(what, string, extra1='', extra2='', extra3='', @@ -956,7 +963,7 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='', for extra in extra_regexps: if extra: match_list = [s for s in match_list - if re.search(extra, s[1], re.MULTILINE | flags)] + if re.search(extra, s[1], re.MULTILINE | flags)] for num, line in match_list: results.append('{}:{}:{}'.format( filename[strip:].lstrip('/'), num + 1, line)) @@ -966,7 +973,7 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='', if not interact: return text_results - html_results = format_search_as_html(title, results, [string] + extras) + # html_results = format_search_as_html(title, results, [string] + extras) # Pass through the IPython pager in a mime bundle from IPython.core.page import page @@ -975,11 +982,12 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='', page({ 'text/plain': text_results, - # 'text/html': html_results # don't return HTML results since - # they currently are not correctly - # formatted for Jupyter use + # 'text/html': html_results + # don't return HTML results since they currently are not + # correctly formatted for Jupyter use }) + def search_src(string, extra1='', extra2='', extra3='', extra4='', extra5='', **kwds): r""" @@ -1156,6 +1164,7 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='', extra3=extra3, extra4=extra4, extra5=extra5, **kwds) + def search_doc(string, extra1='', extra2='', extra3='', extra4='', extra5='', **kwds): r""" @@ -1197,6 +1206,7 @@ def search_doc(string, extra1='', extra2='', extra3='', extra4='', extra3=extra3, extra4=extra4, extra5=extra5, **kwds) + def search_def(name, extra1='', extra2='', extra3='', extra4='', extra5='', **kwds): r""" @@ -1246,6 +1256,7 @@ def search_def(name, extra1='', extra2='', extra3='', extra4='', extra2=extra2, extra3=extra3, extra4=extra4, extra5=extra5, **kwds) + def format_search_as_html(what, results, search): r""" Format the output from ``search_src``, ``search_def``, or @@ -1326,9 +1337,9 @@ def format_search_as_html(what, results, search): ####################################### -## Add detex'ing of documentation +# Add detex'ing of documentation ####################################### -from . import sageinspect + def my_getsource(obj, oname=''): """ @@ -1359,6 +1370,7 @@ def my_getsource(obj, oname=''): print('Error getting source:', msg) return None + class _sage_doc: """ Open Sage documentation in a web browser, from either the @@ -1518,10 +1530,10 @@ def __call__(self, obj, output='html', view=True): """ - html = template % { 'html': html, - 'static_path': static_path, - 'title': title, - 'version': sage.version.version } + html = template % {'html': html, + 'static_path': static_path, + 'title': title, + 'version': sage.version.version} filed.write(html) filed.close() From 9059b4c12536ae08b4fa145ed5ceeab449a95af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 3 Jul 2022 11:12:58 +0200 Subject: [PATCH 195/416] fix --- src/sage/misc/sagedoc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index df9e153ebf2..3ee6611d307 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -973,7 +973,8 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='', if not interact: return text_results - # html_results = format_search_as_html(title, results, [string] + extras) + html_results = format_search_as_html(title, results, [string] + extras) + # potentially used below # Pass through the IPython pager in a mime bundle from IPython.core.page import page From 0d59214ad73587be458b91df22eae2fa1ead8ffc Mon Sep 17 00:00:00 2001 From: ackrue Date: Sun, 3 Jul 2022 21:38:25 -0400 Subject: [PATCH 196/416] As per ticket 34047 Addressed typo in documentation string expression.pyx - extra 'e' in '_repr_Expression' --- src/sage/symbolic/expression.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 0fd0eeea6bd..9d2ca160237 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -13455,7 +13455,7 @@ cdef class Expression(Expression_abc): cpdef _repr_Expression(x): r""" - Return the string representation of the eexpression ``x``. + Return the string representation of the expression ``x``. EXAMPLES:: From 99375cd225563b40062e7adc1289a0a3ea2f1562 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Jul 2022 20:17:09 -0700 Subject: [PATCH 197/416] .github/workflows/build.yml: In workflow_dispatch, make container and base tag selectable --- .github/workflows/build.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6568b35d514..cc87344f3bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,15 @@ on: push: workflow_dispatch: # Allow to run manually + inputs: + platform: + description: 'Platform' + required: true + default: 'ubuntu-focal-standard' + docker_tag: + description: 'Docker tag' + required: true + default: 'dev' concurrency: # Cancel previous runs of this workflow for the same branch @@ -13,7 +22,7 @@ concurrency: jobs: build: runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-docker-ubuntu-focal-standard-with-targets:dev + container: ghcr.io/sagemath/sage/sage-docker-${{ github.event.inputs.platform }}-with-targets:${{ github.event.inputs.docker_tag }} steps: - name: Checkout uses: actions/checkout@v2 @@ -30,10 +39,16 @@ jobs: - name: Prepare run: | # 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 update - apt-get install -y git python3-venv + if apt-get update && apt-get install -y git python3-venv; then + # Debian-specific temporary code: + # Installation of python3-venv can be removed as soon as a + # base image with a release including #33822 is available + : + else + export PATH="build/bin:$PATH" + eval $(sage-print-system-package-command auto update) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git) + fi # 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 From 18bbfda9ad7016234d6408f4b9b8a3b57d585e73 Mon Sep 17 00:00:00 2001 From: Sebastian Oehms Date: Mon, 4 Jul 2022 09:04:35 +0200 Subject: [PATCH 198/416] 33798: use quotient ring of Laurent polynomials --- src/sage/groups/braid.py | 126 +++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 39 deletions(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 907d27fe1cc..cae329b9494 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -763,19 +763,23 @@ def TL_matrix(self, drain_size, variab=None, sparse=True): return M @cached_method - def links_gould_matrix(self, varnames='t0, t1'): + def links_gould_matrix(self, symbolics=False): r""" - Return the representation matrices of ``self`` of the R-matrix - representation beeing attached the quantum superalgebra `sl_q(2|1)`. + Return the representation matrix of ``self`` according to the R-matrix + representation being attached to the quantum superalgebra `sl_q(2|1)`. See [MW2012]_, section 3 and references given there. INPUT: - - ``varnames`` -- string (default ``t0, t1``) + - ``symbolics`` -- boolean (default ``False``). If set to ``True`` the + coefficients will be contained in the symbolic ring. Per default they + are elements of a quotient ring of a three variate Laurent polynomial + ring. OUTPUT: - A representation matrix of ``self`` over the symbolic ring. + The representation matrix of ``self`` over the ring according to the choice + of the keyword ``symbolics`` (see the corresponding explanation). EXAMPLES:: @@ -783,8 +787,14 @@ def links_gould_matrix(self, varnames='t0, t1'): sage: HopfLG = Hopf.links_gould_matrix() sage: HopfLG.dimensions() (16, 16) - """ - rep = self.parent()._links_gould_representation(varnames=varnames) + sage: HopfLG.base_ring() + Quotient of Multivariate Laurent Polynomial Ring in s0r, s1r, Yr + over Integer Ring by the ideal (s0r^2*s1r^2 - s0r^2 - s1r^2 + Yr^2 + 1) + sage: HopfLGs = Hopf.links_gould_matrix(symbolics=True) + sage: HopfLGs.base_ring() + Symbolic Ring + """ + rep = self.parent()._links_gould_representation(symbolics=symbolics) M = rep[0][0].parent().one() for i in self.Tietze(): if i > 0: @@ -794,7 +804,7 @@ def links_gould_matrix(self, varnames='t0, t1'): return M @cached_method - def links_gould_polynomial(self, varnames='t0, t1'): + def links_gould_polynomial(self, varnames='t0, t1', use_symbolics=False): r""" Return the Links-Gould polynomial of the closure of ``self``. See [MW2012]_, section 3 and references given there. @@ -812,15 +822,21 @@ def links_gould_polynomial(self, varnames='t0, t1'): sage: Hopf = BraidGroup(2)([-1, -1]) sage: Hopf.links_gould_polynomial() -1 + t1^-1 + t0^-1 - t0^-1*t1^-1 + sage: _ == Hopf.links_gould_polynomial(use_symbolics=True) + True + sage: Hopf.links_gould_polynomial(varnames='a, b') + -1 + b^-1 + a^-1 - a^-1*b^-1 + sage: _ == Hopf.links_gould_polynomial(varnames='a, b', use_symbolics=True) + True REFERENCES: - [MW2012]_ """ - rep = self.parent()._links_gould_representation(varnames=varnames) + rep = self.parent()._links_gould_representation(symbolics=use_symbolics) l = len(rep) mu = rep[l-1] # quantum trace factor - M = mu * self.links_gould_matrix() + M = mu * self.links_gould_matrix(symbolics=use_symbolics) d1, d2 = M.dimensions() e = d1//4 B = M.base_ring() @@ -829,10 +845,21 @@ def links_gould_polynomial(self, varnames='t0, t1'): # partial quantum trace according to I. Marin section 2.5 part_trace = matrix(B, 4, 4, lambda i, j: sum(M[e*i+ k, e*j+k] for k in range(e))) - psymb = part_trace[0,0] # part_trace == psymb*M.parent().one() - psimp = psymb._sympy_().simplify() - F = R.fraction_field() # to make coercion work - return R(F(str(psimp))) + ptemp = part_trace[0,0] # part_trace == psymb*M.parent().one() + if use_symbolics: + v1, v2 = R.variable_names() + pstr = str(ptemp._sympy_().simplify()) + pstr = pstr.replace('t0', v1).replace('t1', v2) + F = R.fraction_field() # to make coercion work + return R(F(pstr)) + else: + ltemp = ptemp.lift() + # Since the result of the calculation is known to be a Laurent polynomial + # in t0 and t1 all exponents of ltemp must be divisable by 2 + L = ltemp.parent() + lred = L({(k[0]/2, k[1]/2, k[2]/2): v for k, v in ltemp.dict().items()}) + t0, t1 = R.gens() + return lred(t0, t1, (t0-1)*(1-t1)) def tropical_coordinates(self): r""" @@ -2514,19 +2541,24 @@ def _standard_lift_Tietze(self, p): return tuple(l) @cached_method - def _links_gould_representation(self, varnames='t0, t1', sparse=False): + def _links_gould_representation(self, symbolics=False): """ Compute the representation matrices of the generators of the R-matrix - representation beeing attached the quantum superalgebra `sl_q(2|1)`. + representation being attached the quantum superalgebra `sl_q(2|1)`. INPUT: - - ``varnames`` -- string (default ``t0, t1``) + - ``symbolics`` -- boolean (default ``False``). If set to ``True`` the + coefficients will be contained in the symbolic ring. Per default they + are elements of a quotient ring of a three variate Laurent polynomial + ring. OUTPUT: - A tuple of representation matrices over the symbolic ring, one item for - each generator of ``self``. + A tuple of length equal to the number `n` of strands. The first `n-1` + items are pairs of the representation matrices of the generators and + their inverses. The last item is the quantum trace operator of the + `n`-fold tensorproduct of the natural module. TESTS:: @@ -2534,54 +2566,70 @@ def _links_gould_representation(self, varnames='t0, t1', sparse=False): sage: g1, g2, mu3 = B._links_gould_representation() sage: R1, R1I = g1 sage: R2, R2I = g2 - sage: R1*R2*R1 == R2*R1*R2 # long time + sage: (R1*R2*R1 - R2*R1*R2).is_zero() True """ from sage.matrix.constructor import matrix n = self.strands() d = 4 # dimension of the natural module - from sage.symbolic.ring import SR - from sage.calculus.var import var from sage.matrix.special import diagonal_matrix - t0, t1 = var(varnames) + if symbolics: + from sage.symbolic.ring import SR as BR + from sage.calculus.var import var + from sage.misc.functional import sqrt + t0, t1 = var('t0, t1') + s0 = sqrt(t0) + s1 = sqrt(t1) + Y = sqrt(-(t0 - 1)*(t1 - 1)) + sparse = False + else: + from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing + from sage.rings.integer_ring import ZZ + LR = LaurentPolynomialRing(ZZ, 's0r, s1r, Yr') + s0r, s1r, Yr = LR.gens() + pqr = Yr**2 + (s0r**2-1)*(s1r**2 -1) + BR = LR.quotient_ring(pqr) + s0 = BR(s0r) + s1 = BR(s1r) + t0 = BR(s0r**2) + t1 = BR(s1r**2) + Y = BR(Yr) + sparse = True # degree one quantum trace operator as defined in I. Marin mu = diagonal_matrix([t0**(-1), - t1, - t0**(-1), t1]) if n == 2: - from sage.misc.functional import sqrt - # R-Matrix taken from I. Marin - R = matrix(SR, {(0, 0): t0, (1, 4): sqrt(t0), (2, 8): sqrt(t0), (3, 12): 1, - (4, 1): sqrt(t0), (4, 4): t0 - 1, (5, 5): -1, (6, 6): t0*t1 - 1, - (6, 9): -sqrt(t0)*sqrt(t1), (6, 12): -sqrt(-(t0 - 1)*(t1 - 1))*sqrt(t0)*sqrt(t1), - (7, 13): sqrt(t1), (8, 2): sqrt(t0), (8, 8): t0 - 1, (9, 6): -sqrt(t0)*sqrt(t1), - (9, 12): sqrt(-(t0 - 1)*(t1 - 1)), (10, 10): -1, (11, 14): sqrt(t1), - (12, 3): 1, (12, 6): -sqrt(-(t0 - 1)*(t1 - 1))*sqrt(t0)*sqrt(t1), - (12, 9): sqrt(-(t0 - 1)*(t1 - 1)), (12, 12): -(t0 - 1)*(t1 - 1), - (13, 7): sqrt(t1), (13, 13): t1 - 1, (14, 11): sqrt(t1), (14, 14): t1 - 1, - (15, 15): t1}, sparse=sparse) + R = matrix(BR, {(0, 0): t0, (1, 4): s0, (2, 8): s0, (3, 12): 1, + (4, 1): s0, (4, 4): t0 - 1, (5, 5): -1, (6, 6): t0*t1 - 1, + (6, 9): -s0*s1, (6, 12): -Y*s0*s1, (7, 13): s1, (8, 2): s0, + (8, 8): t0 - 1, (9, 6): -s0*s1, (9, 12): Y, (10, 10): -1, + (11, 14): s1, (12, 3): 1, (12, 6): -Y*s0*s1, (12, 9): Y, + (12, 12): -(t0 - 1)*(t1 - 1), (13, 7): s1, (13, 13): t1 - 1, + (14, 11): s1, (14, 14): t1 - 1, (15, 15): t1}, sparse=sparse) RI = R.inverse() # quantum trace operator on two fold tensor space E = mu.parent().one() mu2 = E.tensor_product(mu) return tuple([[R, RI], mu2]) + from sage.matrix.matrix_space import MatrixSpace - Ed = MatrixSpace(SR, d, d, sparse=sparse).one() + Ed = MatrixSpace(BR, d, d, sparse=sparse).one() BGsub = BraidGroup(n-1) if n > 3: BG2 = BraidGroup(2) else: BG2 = BGsub - g1 = list(BG2._links_gould_representation(varnames=varnames,sparse=sparse)) + g1 = list(BG2._links_gould_representation(symbolics=symbolics)) mu2 = g1.pop() R, RI = g1[0] - lg_sub = list(BGsub._links_gould_representation(varnames=varnames,sparse=sparse)) + lg_sub = list(BGsub._links_gould_representation(symbolics=symbolics)) musub = lg_sub.pop() # extend former generators lg = [(g.tensor_product(Ed), gi.tensor_product(Ed)) for g, gi in lg_sub] - En = MatrixSpace(SR, d**(n-2), d**(n-2), sparse=sparse).one() + En = MatrixSpace(BR, d**(n-2), d**(n-2), sparse=sparse).one() # define new generator gn = En.tensor_product(R) @@ -2589,7 +2637,7 @@ def _links_gould_representation(self, varnames='t0, t1', sparse=False): # quantum trace operator on n fold tensor space mun = musub.tensor_product(mu) - return tuple(lg + [[gn, gni], mun]) + return tuple(lg + [(gn, gni), mun]) @cached_method def _LKB_matrix_(self, braid, variab): From 31336e0ce5ff4712f747585760d5de14d4484a4c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Jul 2022 14:02:20 -0700 Subject: [PATCH 199/416] .github/workflows/build.yml: Use defaults for 'push' invocations --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc87344f3bb..cfcd9f6dc6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ concurrency: jobs: build: runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-docker-${{ github.event.inputs.platform }}-with-targets:${{ github.event.inputs.docker_tag }} + container: ghcr.io/sagemath/sage/sage-docker-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} steps: - name: Checkout uses: actions/checkout@v2 From 78eda9b64c5c308b999e5256bba6b60537eaa08f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Jul 2022 14:57:41 -0700 Subject: [PATCH 200/416] src/doc/en/developer/trac.rst: Merge material from https://trac.sagemath.org/wiki/ReleaseTours/sage-9.6\#BuildsandchecksofticketbranchesonGitHubActions --- src/doc/en/developer/ticket_badges.png | Bin 0 -> 47315 bytes src/doc/en/developer/tools.rst | 23 +++++++++++ src/doc/en/developer/trac.rst | 55 +++++++++++++++++++++++-- 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 src/doc/en/developer/ticket_badges.png diff --git a/src/doc/en/developer/ticket_badges.png b/src/doc/en/developer/ticket_badges.png new file mode 100644 index 0000000000000000000000000000000000000000..1da26d4e8674acbde1ed993454c68161f2d11a0c GIT binary patch literal 47315 zcmd?Q1$SIKvNr74j+vPmV`#UTA!epHX6BgPW=tG2J7(sXnb|QjGcz-@-#%yN-aG4? znP2ejwbasAUZw=ly_b4cI$Lof>p>A~Ke6`p~anLrr-1S%kFw z9zJYt(U4RaYmDthG<_K1h@oAX8is@NUJg7?h)$Ms){45T-P zP=so95y9#^s8((a=8kcYs^n)F<~=>1z9BnQ1Xq;uLC}fQMMqHu*C5`C1uD(wl)9qFSmz4AEfp9+n&dTYuOM zA2;?^m_K`=p4);y-MwmP`KfEsNzltNm*5*{L-wS7gB{r|f?f=ZwM@M95m#UwJvRO{ z3Yi3ra6@rHDm3!lbaz2zo1+$*mTZ0f67UFhzs~w_W?6VLz-$s%s)$0d{K~D`Ez)fq zEUtWfew-W5VO+R&k{v_(TGLS?NP4F%q-7LV3AKQK!tH`$)phg%lP{3N0Jn+~fxosn z1F5uJ#O@O6az~hCQs@O)P*a@Rl$nD$ojEh!_|ebuF*Kq-gE5&I+Z6sfneo9HjfKZ3 zjgAAh`Gm7zh=@%5QLUBQt*=-r#LSR9A#`gKz%hIT1t#2cJ#u)Pn{T zEk&2?!M>D$j8>u|2$58YaiT&*r*t%-VI`#(|4M;9fRjh?h|LpDBsoTIGhnkrJ{8g` zBAAUQBkrt>IRiud!y}iG9YJ1RCtsoLfK-T=E%MJC?&ku6M z#s+&yn0pabRT_-Q!##Nm)}_!4-Nlt!rRakDB^rEl0p2|!+{ETv3icl*H>9~yGyTT< z5;w3P6k1V)LiBq{w^kq2AtMar?5Q3wxc#gA8N0rG24;s>rrQVGBb?=D<_mE(Om`FKNJ;oYI>!=78CDlgOraFZ?15zIjJV#D&&JZpCTMam_!M z{)#IHe;zX>6R}&S3757sW8Jh z!#K^KHE6WQI-E?Kyt>!7hrZ`{&9qmx z=Z#a3BaL&-c&D|}kf-6HZKhRTZ(Vg#&ssxZ!!cdlcNEF7xU{Tg(Kh!KehW*eor;wj zzp^`!Wud=c}s?G$vvwV>}JOw3Q@j}niPNTe*OC>gU2 z(_g>ozbV+=+g%d4?v%q@m4=Y^EscbiEiE^FpJ$%0gTRo3!low_-CV-U`O<#Sd2!Ft zHE(QSAm&VZNRaY-9okAYsoecQUTZPZ!G3rf5PIo)c^d0t~5jskfgNs5J<@=pLY! z69vLniTncmgW~*a1CRV^0>1hS!qvbHBb2}&quj$~qOTE&1P6y|pgY7GcWpWp^Q^|` z#nezJN+{=Ik|G-MRFxQ=_b>LzhdkRLImoRf z4FMImCHuz1g<^#jlj15FHocAPx2k(uq+O)1@)Ar&cPHnDKZybf#`b#7&_e%8YIPm#`=PDqadH*VUTjiepwqfP5c{>@m9)GdXb3#fV38# zki5sXKjy_9#$h#VZQ{~*lE9My!WlWFLjWxCB(idupPgUp?3Jb6+xiT>^nIj348`Gp zqkkz#F^Vv-`!TrRi7<0D`(bxwH?jl*dJOM<}AxEjjyl)L^0cG znAh1pHjiU>g&xQMiT9i*tk7?L>xOv?WFY*>IcLkd_@()9+H7)9Tf3`aMs4v+ybZN2 z)54RJ_EkMwhugbK+p2}<;T?dlhi}QX@0?%rR86;S*loU=pjJX}y2#36*S(kJNSf>4LzEtp3B>tCy7sm28kfRIj$KQP)AroxCD*durJX=Wy65w4x*wmnYuFk3S^Ua;v;JM@ zgUBrDo$rawy|vI4%g$!6Bz)AF;GTfbquAXJsNb)kw!n0JBtuQe)q8CQf6o1}w-J{Z zKn-|q4t<|_1HCe|sKdS^JRKX|FPufrPtCvDCA4yQwQQ$9w?W1-WWxJuqc9<*ldbm zRdB~4LKAcMAr{^cGTe1{5a$0-7?8fjm9dJ{DY#%AO2%a!s{hbK_Px0YnInFHbyX)` z=ZhN##m(J)2gir+GjN@_mcG90fp2esWrNCw4;C3Y{69bW!;K@Q{=__^70U$z-c%L=nn)CAHk^);2`*c@PE@1 zALt;U{?3PlfC#dLfc|G41#tY=6Acc3(flKZ`V|NP3x2}@2e&N9|EUcvkp=ZXX$T{5 z8H9+csI)XVRyB4sHMIp<*g4S-FnEA7;O(U}K@bo))PIE!(kfIJ;P&S%zi2pV$jk8> z+u1N1n%EhcGP~K>|J4ozzZ)+&X=CbSNaki^Z42Uc6QKCJ1}`}MS2lox?C&a0Rss|n z@=9c)c8;cGoXjlDEEIwWWMpLgjwWWjDq<4#1ah}^GIV3I1yTN^k^gB&%oJqoXld_cX=h9JSG$HrcFs-$6cm4T z^uNzPzSGpr^8b3W1^tsPFoS@uvE(a`=qB7>rcmJW_Va+@<9@cT|i1_uZEZ&4N+nvobY^nY$Z7;T^u4i5OsP_Ye3 z=RfuESGWFnF;@Sv`@b?-86iK1n=GgTpm6{F`~E>iF0n)KA3px?!XHRs-_a=X?`DQO zKmHdcg@e(XVE*d}bW@P^NCgVqvfBSQ4#Dh~|F@?9f55&}V$Z-&Sk#M+Ki>Raa3(|0 zjZIC{9oo%;srP5A-LKF07CP*7j<&YR8)s)9P*J0t1egz7|MOCcPC%Ce^+t>WFA@J^$q^i%y;#jO{LU0*6U`;<$71qre=;WHbeP zvD#Gh?d9#_axkFP{W@FtgAn$6qasYy@lgCQH%Sxbvpv>C}});*%(A|iumtK{x3N=B>B;=5YF%Q03jJk z)HfL0Z~t)dfkGf>b2mPoojPj(82|u?TbK;~`j{L-W`G>pSSy-DW;oSDreI4+LnDEX zib`UV!+ZXzI$!vQADuQQL~mH4Ux)9XFMRHDM`^sy7|#mj-66}ql#=D8jhpUR8G2^} zXS>L#id<7(K)9IFv$dHDxuYl_G|)NB*{b{ZW3GygyRzp2pB5^9+Xr$oMOmy*U!cW9 zv1IEUq(uKsYX27H&JN@s{Sx6i%}(fshS>`>=6sg!jg+poc2h@m1_kgjY~~694R<_Q zQ5-P_g5>k%x~d`yVWFWa{Y(48CMHy4nL>*Gg92b4k>eTEMTLdYh|Sg9Nqfg*D1$1u zHym}w+X!7jnf?u~C??}+lIWzGD>bp>d2p}V-h!dT{q9C*x{^1qR>dbFpr8%UHgen5 zV2Lmp@8ARa8@gtIGs1r!`1fznD(QG3!HvPXE%oU1)u{=MJ7QHvy>Vv24O~_--)qUj zabFtY(Ae;e1os?yM?7$?^ScS^qp4EJc$|;0%xRH-$u_zHG4{uFh1)#jmGfoProIgR zo>JKgO8ii^EC5?T@`6168J)fFWMD62__JTML~sC-gQ{TAD)wgfHgcvE2H%tzCQYgG zR^UKVEVsiMnHR;k+|c(hIHb}f4BbTD|Gby{K>8_Mj81ufzTW>^{S^|J%VCi5A}YKP2R}T z1BdN{ZGi74W8SG!PLFWFg-QhuDnGnvVO3 z5=M*yY86zT^ZLyn`RGIf;*X_#87H7NAJd^?!trIdUWiM$!6RU7_ECQwPNW1HpC&fy zTH{_}4?qE2DZ~pEQ)ZL|gVHShG`4usB@`bqCa9E$ZCTNI9Fd+;0?8mMa@GdSfsvj)941> zpM-1_eVi+V=y1oegF5%W>{ZI>Zh1Wek;K|n&c|9y@W1m|Q;xt!F=}xl=_t`46hrXt zS1US-{_yy?IY^sH)m``@&-7QXhb_^t2IhfqLDe|lOj37RlysEMa=qdE+v`Gu9VrS4 zf3RA~*BD)NfEx0?`DhF#tpXW8f0|1SPgK1PU$({M)~D6@%w6r@hU2TGN|kPcCJy7- zPX-N)ec!&s2V=yV1yd+sOd(b6%!?t;KR*|$g*qNyeFe=iDLb?BI8xjYq+k<&Hu<8d z-pu6wU&a?Htdo*b;_hTonp6BMW|Oi+463y%6*C`&wdc+-prfZyIrm~lRWbW(nU>gZ zmh9?yy_3w&l_pR;GKRdv*T}76GV4cDuZs`m`W=xO0-nE^V)jhz>qx52 z$IBI3o5E=%$1((DsRlJ`?bg$S2~q>YKB4uGC$nv8T#o~U58K2-Cv4eJ!~$uU7Zl+m zVl2f%sb$YOr5AqYqwc+X0e`uCmq>0&|XG+X&9tG;UH}6L^3n7 zG&U16974ns`u@78Z<$Bb+=>oY7O{@TPUXIj}GTc->96=*lZ?hcobek!mq(lvho!f5nbTv{NS-xP3LnX1zfFaM3 zLa(#$6N^p?#z1s1qLjv1@D98RvLRQ=+ZJ=en~-A4HoWR3Gep`77>q%qkZgYheV-zL zU-rael6|37c2Oz)DYFe*FrL;IlN*Fij2YYKnex`+I(v)}`VqGpd54_1m~a4tdUI#f zP?U2{`NO!MTUUur=|ew$6@U?I)9F0~6Z*{t4vRqx343U9C){`WfpyD`S*P{8s3gi} zUj!k(!vm`sc)d#*LYJFSCUZxd7{&aw8TftU`Mu1ng;M`lh^&B7GPigLc-^B+S0^@^ zFy!S>h_Tam^qdfXmqw7OLhwDOQzd9&Lred+DEozs5UiB&Y(1P zTdU^Dr*dkvxRed?*(|YF_QCUkR?CS%_?kB{{KvM~E2Oa9Nc)D$986;mQau3KD(Q8J(mXXB$WxyspyW z;I9}Z&4y+)D-vw#kGwV&BBSsmdyr15QcD1Mfs z5FYOI7?CZo{RWp_MeO6E4;-Mx(0r^vP{~%Nyb_{Bn z?+u&IAdspdXm!sRd z=g}auhqCmGwo^1x8n7*rUrC|z!fc$htconuO1eM&e<~)4~Hyiu?BB!sT8f zlY+FfpVGBhPokCosx1mOmS(N@i;X$~CbSCSkL&P4dTi@$ad}laOktyHs6mt!-Q6ZfdkKc{OalgJzCuuk}%6YXl z;-WVUwrxAC;DsmOWG$ar~m@_yZ~QN(Hw zZLDt1Vne~Gm&b~Nj6y&bH};p7c~;Nu$1LB`B|d%e$U7=~p6(&7GMYsY4;BbLmOWdS z^n6EXFW=@17n(x@cDXjVJb7+(P^T?zUz`h|3EmPMnvpj7zID0Z_!eXid_>jlI5XA5 zetRp2ozATTMZbPiSIZ2Z79|*x6fgxGYYh`;*Ok3SdPDZ9zKbyE&?_BigVhj2Q(su|<%49hL zN_>NXD6infpPzCLBr^rBT%4d{eKW;mEpQI99{vVFd32C>tUz@p$Mf6-&+U@;)2;64 z^=Uxwm_sNU<^FhPufFeV;J4XN3`RZUQT3&DXcWx_dzFGd@2~fl*W*GZjIB237n|Lu zL&Q9e{zs+1r}RAzsb6lU6^}F$T}wSzo1HhPxlWQ^H0rJKhvMjSyIjxLdI{}Xv+H5@ zf>SuGjCw<{za>XB30?#Drw!)_{=y_E#JnMEZR>kfyIozMD{nk}u|65Gv6gU1;DjUg zLQ;rp-Ij~(43M;PJ!-~Pd>yC`?~{nM_|dhFCnZozI?*YUXHSyr^GQ*X zXz$dcAW|!`!m?#ehGSSG@o=RPH)KLLX!7^UzLTC@ADi?3bjUa#R@=(1_;&loacH~0 z#y&Z`kRv~2DFNl-j^AUV>-C`*Aj@YBr-*eZzC?W^D6=E+S$uv zt_-K>QITftQ_PJl$?;T~WeR5iOoZm3y~;;7uu0%xp^B1O zx7vIitk(=1+LlI=*~-AkW;k{E>2_WpXulymOJ$W<*@j-T?FgPRVEgNxHnxD-2wv;m zl9h|M^H(lhjT$rLuI}+k$Ml>+?S|}P3THTzg0WyJ19(Jo)g2-@9ThR#EBSlOnf#)qX!|aMYafgmI2Lpf7Agp5F02 z0xJYDtg`YI4slsh+QSG_D0*IXZn8&8r%+nw8wJ{d?nhmOdzpBej(1D`ucdklHq@tr z8_$vFJg0oe?CY*xzE(m-r_xP%>9l`FJ5Sk`%GDR~va_DZn0!JvqP2Pk)K~-8w@1&U zGb$bg4Opqj$b?6=$MzT^Q4tYUPlH>d-Q4B&2$Kt9DaVD*j%h2=!7?OAwEmKmVkvS{ zRSDYUQY{@c!K7?u814z#9ypUwW1%-%%SrSs3V}I2&PeT6&WosWn5H>dZa@V?QB^G} zCaqfG>%Gz0?jULK9V@h*LF1ZOL*|NQ!>t_WAcR>^%cwMKw}t>n}ck> z^Y-WRDY402XA)3S0ialnx~dP3Fhs!h3_;Jm*A1vyYs;#z^N8#Y+E;bQiCB*kUqA0& z#!Stz<`6Po3^N@J6Nx{gd3Z~Nc5 zBatdtfxp~v@$iBnn(r}=ch+PXjeZH`qdk-+p;1Qpp&=wS(d8>Bx8AY=-J?3*+veAu-J2Drd%q)gdup&_7|zM5xs41bhM@ z(*PHG#dYx1qr6jUyjr~hv6LrnA;`O?e$BHv_^OF$e!0?6 z)GC8qG;rZ|R&!NH7*McSX~_3U$c%eM|C&kByoDUu9l)bEwG)af|a5Y1E0l^7%dl$2Izwec#S z{!VSd*@UTDsDTo|pVxLFDl z%jEa6iUn7)ZzY5bU1y3Dnyk;oK2&xC4!E;`yr|!PUpZ#7B`;USb)fm+^O-4#Iy8K} zXu}SGJk=8q!BCuF7T|H`KI|j@o$kB#_#J8Omw|++T5%iuhFf<8A(zC5^&ZO*ZYUG| z13~dfs^72vPl*{*P`l(CCsS^WmvZ4w40E(#z}o z`B|mHJ5m;K-cko3cp9R9ozD1o~a8%&?qnEx{ES;dZgyDUNn-dBVsgbeox91 z|14IE$Y&=&muK(6<}65#a$X}5@Gw|wb^p|8@CS0HNYvzmkR{`o*NF1og+DxIr>x0B zKv2*$XI;}Q@ZG+BT5MeKDaKkAOIt#ryTk0$#cbQFuI~wtlmZdkVHniE6v8LiI7>1CXZ<}J zXYnQU9;A8qLn?`QhbLEF=vY|como4U@w^$S-r3nyl-23g;ncJPZo6LQar?Ct65m4P zPPp#{%I%{S!BRq_m?4~kDLBL&oa>DaBaMl?G~b!r{glKZC=p2%Qqle-W4gV4w%T$` zG1tuPH+*xtjN9>gN9YDi&}JRju)CXXuCeToT;+4OXg+u4)#)P3X}b~}CHMpfHthZ2 zkiQp^JgB^LegT{JI{EgXp}!QA`CA!YKGAb$Sg~I10mD65V;tN(q1(Mp<0&My?u)F+ zB^mF8*p+j z?q)o=P`5gLI7a5vpCX~(I4;TEz6Izt3j4{^&0?FVo6Qcz-`qZZZaoF{?!C>F>Bb^m z@AW3v>{r@6E6kSjtODPU1)95thY?%u{S99GM&b8d8QmOd6~GCg>5 z(`MdII(it{@3mfKjEoM#kJOjG&u|%A;wso5PKCWao>5WWdzqXBHu_xCC}i*lTuk?! znd~_+N6*;jhl&)MTY^sRg?=>Po6ql$&QHAM6@0N?+uoyqy6k6?e7~^V4~fUa2Hk z<0KndXvT*`F5BvQee=W5CPODbYCwCN2O3MCQ;F{THGR@;%QLqZdO1))?QsgIFIFLw z7nEX_6p%vc!Z!_eY*${&WOAb$97ox*;pS%t&(?PnE zzzQwCCSU)RH2gjLAmOpp+Qh4Fo0A~xbRDPFm{&N#^UrUr*-uuprIF~FuadjoRia#J z9Z9S$5!9|Ea?-8rf;#4(-K0ET?)7yZumD=nWtmn*3X81)vNIrFrVJr!Og13K{KstA z-`@Qn4%|))e%>_uP+^+WCO?4H{w5XXb>peVATAQZmsIyaFEVnh4Yu8e28z(rYsJHXnFyH;eCHp8!Ljaq4SDq z+MZ>2yjC^ha%%K3xs)4>4Y?{xg-h1rCz=5BjSq7qR^P*Z!euLrHSR>F1_jS>fFIT;ntwf>6vzO#z zc?U0GRa!+U@$k{+<7}dm(8wX8nWE&GPScF6Mo@W0kx$a}sd-Y+Lgf+~nd>Qv$a}-O zEK7&6d;bOaN?v!Owcrbn6|+yKAf@yzkk5w}s%kse$~TB88ASHv!~Rr$E}xXogu4?9 z-ca!vwM9@rx6m4%JOj8JjTl*t!RUIP#zijM|&^wxoYJ&K&%v+OdR_gY;)m2JKM za#g5#ZBL$Xdz<`{(0Y$LQ9p_(OwDReMRbqW`{c6e*W0Liw^G}ZYVovure)Z{fp+oQ z2XBw9{CXQKWtED-8mxV-*P8bvx$*cHZu<)~z4OtQvZk+**WN;VgwP+qDtQCn#bP-{ z=hZ!9J~#-%md|r#ou|4T2F&dh>+tH;n((y0cu?)i3${Dl-mi+hcJ5ri{e0hejS8e` zNe4(rDz{82$(Luv1`I?O`^x16*?qW8()O`Fi{$_`9~z~qbS_;HbNSQP z31_p`g{H5^U5maGD!+BOv3&?&fEd0_5mrdqZqJdrcn{_Bx%6);W2%~+hF4+wO6?El z4P$J5u^1~!B#`(P^rMAZ#?frD3M-8us8_Dvk!BM77yU9@LBjVKMbj1M?W8v35=PG5 z%sHS$W|vLG{bVurJ(Ct_Tqv;Q{sb_|PB2&9a@Z}wWqPq_VDFpvzCH)u1-1n7vBq{* zWYY4_qdvMNsqx7+Bx1dH+^8tEd_`8Pl^)&?!3+7?|LV~ec?W1v>ycXRW6~}6z(J?< z5!(qo75bjxZA}1zSGySNYmd4FRqgH zt@FfnI-MC~j)Z!-$|JV&;%z?keG4G<$=Jb5H`xi&%5tLZ1d=h;iB-4>1w+wMnAFssql}5rgMsUv9!68b(4VPxhKTqPUzJQ{$PeP1gO+%e=x+n3_Ei-L4I->lI zwl}&>?yh;SwzLzZA~#~AHn5s5SQ9g1);bkfONbX+i@Ut23E)!MFrTy&T zNj8i*7oE~lmj>m|9br`_4?Q9#Daj(7_*s9dv(U1E5?Oyh>tY7Cj;A#0eoFMGO>pJr z*Lr1@v|#k~Jq<~n%Ldz36#^Qt5Y&GYtKLO*VQX7PO?0UzOVyly{>;VBnWa9C3X z(}*JJ?`CW5n9O^2%Q=Y!?Y^|Qpk<*{?^>v{q*eu#PDgwY6=?7mxAQlM5w4h}?3u4R`!RF6s zi5DiVSydY;(zrB2XIE*4e@YK)N1bfbsGP4NSM?g=95UWzO#F)hCF(A2rflpfTP5p- z6Ykzt2~1=d(JqQwwOIPEc3=EX`_(cjBv{e-NF2x@f$GN5y?lrW&;(j2I2%*`V2t;x zNIIM`+kvlR?I#0F382)>{v-rxf4)GO#>HcwS$A}{$e55GpRdFCJ%!WOUs1?IG5&a^ z4Ay1x7s_e1$zXT`EV9^s_( zchHxoL4$b5`nyCxa#U9U0y)JN#u1k-34?$(id|*>@4l`oFUM|7U!pM9{7fZTZ2kIQ z0`+gy^=~~Glxn`2;iYdr+_EV!s=TgjDY^P~6fAzA-TFXGP~|0t5Y+b^_IF%zCXLfH zbjp7y5nukE;Opbgm;uvp>+3Ly5qEdWAg0x(QUjVGn@8edkj5|qtwM&_@V;Iap7xvL z?vT+H0CT{;z2Vc+%VK?_!!-;sUuNRyt{Se|zOXPanP%L&u+{DKsF4I4&4Wu4jFy z^4cr&7&Wkj{QS&2O7v9~h>m+Qav5m|N_kvJi?UK~kcGTWUS?0+H+E_E>G!g3@lSjv z;&&smYv&2Bg&o_hn7EH=S&^sUe~`@+Q2`r+o;s=eUK~8Jd9K#-%$atABfuALsP0ai_BcRvFE$u4Z=ZbTeqX*Kv|x zT>;1Q5ATE2D{xzKvaYu$7&Kp}-JlU7=W$Mb z+MLH*|8e(t-(39#auqauum58fy2L6(>?Ta&2Aw--34oDsO(vCzR+vQfczaV{f(P0 z%i5V=&`56lw6YvT;|^|NR-~VAAT47u3NGCygA#-MXQj3LqT}1|%mJDR?pA6+>YH5` zBZ=zXrH!KVqs}S)<73HTLEjjgiF4nqZjdfUGN2j`-!4NMtxqM>vBTo~27q&T_yThT zcEcTsSJ!Oah2st4s*UEipQ#qh>{=V{IxK=4`@T;8Kr!xl=MNfWP^fazd^6KE#%2Vyp9 zGjR@cQ(6UAnGFu9`IbEPSCR6j?=xgH)PiX2O7-hBEW;}!V%{URtVY-38I_5~`B&wb z=37Af%#kE~k)lCS8@c!E%J}*g^VE|Bl+x+2?t-=}m4ct*0AVdRMx)m~Q@aeaX@=`o z&l9m~pR$)!)s*VxEX65E1s#zP4@ug^?n7M&8hSQTekL4n6*Pq<3SO$@wYpzzG?{B{ z3=Uz3j5LRI%-eP%q^#Ek68CdiE1~Wdk|t76&aQMg-fFD|X!y*PYED$UvsKEMeE#?v zU%x^^VfLuQ)7&!@p|dvYejB1ftsKNo6&9_NlDWsJS3N%dAwk)EETf>W;(5E6KZPTV zmLNuFc%e+E2IZbHC8L?-j&Pa;(5XCfr;m)=T+cA-C*Shy02Ao^%Sy4=XS_WbV_9t|0fb%wHjG zVVytM^eLtGzOr6^{1x)JXo9bA_$%bv^J&W~T%6`BF%0B20qf2qZGx~=r7EMkG3JPX}qZ#-@-4=<` zG7pZbEVOJ=(83~c-#KBAac!2he2=XGQym|C>T)_j)E{lis};@0U#*g8SH|m6YXY0v$SCNa)QBK_zW3~+=)S`0tMHw0zi)i{ zsZ6f;9f9v{g%)FvVaSszR6qFpxRp=#0D@0+Ylmf}vzPuH!3QAzhSF4)}%XWOA>&VgG6=P88>7f^aJ~7Hrd}z-AH-*GOz{uk5 z=KenEKH?7%siO?qHAUOD(G>P-3`&7#q^#3=)CoN6SA%S)<0rKvQ@?=CaY-*L`F-ar zYq9wAnm)ybs=nhZYlBL?)upN_SPb~Zv)=u9C37@X3D2q!bZwzf9D2X=j%OG~ZeEa_ z5kXIISz68YpG%=gLTLcwhogXE)%y&phx9CmW@8Sp7x#c#@a4v`RgM$l#_iYkJBJM` z0`{juy?U*>Q(@<&aat0REvPY{{Z`(Pnvh^GM77tzg{a_V#^WeHY{I# z=38lU#J~NjN_v_nqWu=+dT#hmD~jF}0B@uHD)*gEn*tGMYoNhewuk%N0iAM%)co=Y3ms26?WD)J@XrMA*J} z6<%Y^ZBc&>+AWR9>mlrs;`{W?mpG*xn?a4rukx4fElkWXWb3sfysnT#OjAe^_z!$o z%dcZ58_}+?Ir1guvo9(IlhX<2g_G-}R_cY9m6QAHV1v9B(b!b_AR+G>nZ$`rIMTs2 z%u)={Qc`mfsZb<5Eov6k{DH=l#KhrloBW&}a(0E2^m^rL8xYHK*loA>}+ zk5rN<;;G18ZgnPHBX~g<7s}(Ixom`iRqOPxVr=#9Lwe z&uOzJq3Z>wzB}nC<|zL%snI+ew)ZF?=5cVnA3IIBJ?MfH>lhiC zn1TGZfmwN1FgE@cI4e6F^v9bWHX)BE`cx@}Sf7?sDmDeVEoIp9CGGK#JR~--%UqJr zJ3hHvS2r$1^J|+TYgKs#?qJU>Ms!F}tX%0eDD?vs=Dn*j&ECs-v>Xvyl-!6n?~xeI z-WC5^g-%=uZM57;up;rVkd_uY%;UR}ZH{>`rc$9V5Km_`+F5C0OX2~sEdddYV703)gmB^t!!pQizZQd1{}ib=nn1B{3U5$M zzh=yKJ@g{cV{_1Db(Z^PJP_Hpq?^~7;GnSo=)IeO@_a(P;@qG6#kQjL{{ibj6u%Oy zkCP`(bT+TK9AAl+Y4H~(v*Rz}d-l)-97jLYOl68+Ja48!jL?_4cAa}9*zN|hF~aMK z=geC`6ZU9p{u$Gl7%5`y24AC>FJGZABzM(UW__LZc%v`&lSWA}eYqa?$p^|t0T<%k znj$X~!)^&@9MuJ8h`E@y0{BGT2-_y&MF2Q-KKcVt$V`L~@|Ll79 z>W>gITB!R|AYXp`Z^Ur51cSd!wd>do;iQqE(?@(h6!k5{N23<4tnt?L&pt(c`fA0* zi8*~>-(FT*BDEScvzF`M`wet#|B`y4F~?^n(qPrnd8E-{kb6;4QOXt(f8pYtWVB)I zFd_k7?L`_wF5+2@zJ!h*`L(*=m;hosA8lGaqtx)3Sm;dl366)KCgIvk;dq-2g+8G9 z#MS!E`DXnw#Y&7k_dI>6ceqZb{5pYfE~U-`f0^4&L^TWbOe|^R=bsGy0?SveR_zad zX8>Mk{hZ3rOMwoMQB`&&iWet?=Xuoe`yYLZzt?TRtm#vfAxxexc|K%K8|^M#x{TM} zB+MN8lTdg>=_ios7!#yiP&*C0E$l^0k^=wx1-wYZhk(Wd!ud9R?bUAgYj1*grm45a zAOxc6EB!6%-`(gKco!^)?DVCV-9sw3xpiBmk)g{fLW9P1X8uAPCE`M#m^wssu#J&p zbLZjoDBD+jXZh={qTQq{ONUikbnb7_7gi6#KMNTIXZL`f3mc!Nosy^@x}B=OO@x<) zc)v&2_?4r^Qsi7Eio?TVuwD@(&012K_;J$dL32`%80paUWusYr+8q4k%q#I-KYnC@ zwfWOe6DBstT5e01&|K)kb+~x0Nml4WvVy7K&$Mig58r!R5xHAQi>>dV!Eh(CQ`fs? z{Yus7nDG-ZZTd`Wd_w8YwTV&z6Y z&#um^nlxe!B-YU5F)~TcS}g4N+0)`VTJm+{rpxjulSGq#{$7=Tv+p1xMnbLQUq~Mr zdAB)s{9%%x4SuAh$z%#+#(1{t{0dH;I&HmPHxhZH%_nd0RRC1|NH?>#Q*?6 z07*naRP0>^U=_#KJ|Rj%aCfI@5+t~LaVb#TDNv+PyufRb;O@nWyA#}lyHhl{hd>hI zoxOWE_a*@n+V}oDE!mx!Gj{II%$aY_oU!rq`xHfA=$<@zL|eD6q7o&Fl81+f zNiH@vHWvNbIPE(p(E8)@9@jK+rPG#aF3r1l@95&ii?o0LVH!GgER)dn>sQFzzZYf7 zmWFH-IZz_}XJdnZ>eEJj-#Y68ZJB+ZhAwMB1xjX7!$UVlud>vAfIP1X|SgU4Jlnr4Yv{Tw&Z{RF73@< zh8p)BCfdP&e0&a5{rXjef7`Z$RIXel@%~T#`TO=Q>icUi;t!R-swn)&t=Ib7cjy?c zic6O)u}H5^Z^@q_eR`@{yS7Q*FP^`kJ-c_Aly52huC41SWy%!v@ZlqB*1BV?^*MfM zH`&?Q(Z)?%X~NW*D*d_@ODJ2mtfC&rPoARQefv{jV36=vs#uQZ&zU9O_v|}JBmNje zpCTja!+U?adhrZ7I5^P8&0A^cZzB!uh$1H^XL53OQS-M{f97|QY6U5*^gBaZ=D+eg z$N=eYnY|U&$Xinc-+gn3ep~Syz5ei8_|qrPK#RIBA}4z%iue>k-41l2$f!sqE;1v% zf8tNKpWl{Qil@D;J+1D$hElkspbug1srTVtBD`|uD%7q(d+|Pd_iWm9W}|rLKiq%Y zRcudrv*)F`w`MCemFJR+y$gK|{YdpE)T5{9eNN zuDv_)otXAF>F06Z&E4Ik4wo)nq{|mCsqHY=UuAkr{h8xy)~ZeEGo&}kd(W<2^!&wh zi}jKD)v8{VejhPZqzwxXM}PQ)VG$!G#y;*}?D#uq*`@>Cx_yTn9TThd9XEO;RjOE? zf`UF$)mrrtZaUt0jT%9fD^-XV-@9iwYT4ok`t<1&m8n=m%`bYmlHbVR22t&r)kR(A z|G9{!Oq(g*We+=kWIv@&otmy)zd@aU>aFIduaDmU@naxWELWChPM>VZPkG$FbC(7U z`Hk-0zfWb$l%;w2ZQ1o3IE+r5JRRr!wdHMEvy3uj%1E!@yrH^{THtpvj?c_P<|R9? z@snujvK8W;DQsFmj4LdG+w*K1sa{NS;L6{fi zOoNVz;$=!197Q4cjW4|OqkgB3lLOjt_wW(g(5sJ{tYpg6WQ(MMWlPh|z56IUBt)s3 zQXsiCZbY?zS9o)4^jLbe|BxDAZr?6Sgm3izmaX(;I>vQF`Q`R&!l&_gk9whgM*3}_ z$2TPD5A3Ey;Byq}dhxI2w0DZ~dvif`#*CuE_3Mc;uMZnZZ%>>M=`tWJPd~H+?!k$Z zw61$kk>0>aYCL@^<*ibgB16OIc+KxY#SJn%R6Z&7lJ(%|!khQ=D_rr$|)UauDdiwOaD3||yU%LiPoisuC8~xCVp1pXX<`+}@zhoTDgn41( z+U0^TJgzlr+JYh?!cn#jrAU#ScJJ6q$&)9eu&^+U;SDGpa{%*e+^GLx>@F|rIBn)^ znmg}L@y>q|J2{dU`UQ_Ot=o4M^rw#<5b+9MH$-cXx%fhb^3%e(%2*!s@gw#7bqF0k zas>HAVQfoAK8N>VzHt=!-hbdroxAk_AD@Z%lAfNlY>85*?cTd-jMpTjQhM3;O=~Dk zn$+~p-=C`2s!IU@0frc&&K=v)fd0RTJjaZmOxt&`d>TccD>w4@6xVUJV!2YZXYYOr zmSdZtrcIkPqA`Dr6m=Q-$5`48nea6 z+O9o%)0L|?M6S)6G^GB0e-`1(SFWbfW5?rN;Y?8vcUrk@v6$QM+`UJwJ9I-UI5vt- z9NsIwSDup>FI`R(CmYAWaby3WMh)tVJO>ULK}UR!NBezc|C0Ghzgx9J6k6I(lp``w zYa@M1?OJJM;yaLuhsPijcZE#+$siMFfK2Qki%k3;GI5^-l!;eBCVp%|CgxT$_s7Oj zCO!q3crIjO<|Dh$m5Dix><9eLPU|m{qBwQPt*j4}*suF*^EJT8qes59W5-%5Ufd%Z zFe0lZ2Xy(=hqGTBr+tqp&JrDm^TZCG#`IJ!b4IGSWj75jS(Jv9DXxGc zoCg*NpFa50mE@VJz^|jlpyK1BfFgqijTCGcKmK?6H-IAyjP&l`)7TSak1#ybr_VsO zzh@!M)Gb-GNSRS|^lFcaL%2uLqU5dv{a!qOPP=w_Tda>Z|J~a+2w}&UfsvN&W3A7L zBYTCQvSHH}nlO2WO22N^QpyfsqRB0+auRvnRwNUqRhDaaqB9Pwu`jefD134xE zuxM{f&UQ|ef>Kh4avi96t`Y)7>9DuGpl^_)5jD=+SmZNe-3Yq)<^tI}+hOq$Nnt1_ z{9`ydr%p^M^Q02=3#u+8M>|J)6Yz%GENo4Vu8yMqVL{;(@-A4&@9Evrk)5->pdaNq zhO!!fks+rBiFj`B*plNYQ}Rso@XbT&IJ-Ro1tq7X%tIRreIG*G25u*32WPtb?k~ z)u>8;j2tGDS$u|uhSI!07t_i$>(zcRel!cu415Gp<(gPLsy_s>LHoxczKWUnzCZs2 zV5FH?%$KTAO-*Mh+y{#i2YY*Z_~?-kbnWaM$kyJD(0M65B8(1Ufy}@x10x-~K`7MK z!;(K)(xkL*a)e`=a<*SPFj~?&_ zXzN5TU%sNs)oYU-_`~Hz0#ppgILFR4X>#OaM;`+NY5khzDlk$DbI5kD2r|z!UD!$sHWY3Ba5! z=3SfQ$tePWSDO`oiGKfd%Qm_@6=OX&6p7032cUuW-3OTcSOavFXP`rd3lJ?9`h$A} zFmetHiG5z<$pPgjwRgZ+`iVl4xKQ7thXuQQ7cZrU3|gU{CH`7W&e^k31p39K5~U~! z_?V1;GqfcDi_1!*{-A<&zZdbxYe-?lFnqhUYF4LdlNFF=EP#S7 z+cAgXGd%?WiNSFxM{)ga6WL+N{e<}#06G??_Q=P@HL0Mt#5dU7NAA*8Mq{B z+Poze_t(UD#pOgqhSSo8^QlxxPXXE#a)(R~$8}GHJ`)}uMiuS^TehLg$kWlmiEJQ)e2R!f*Nvnr7tV98tY15>lH7l2ix@^E0Heu5AILo8?^5v%Gix&u#v<#WJ`-rqWB zYq43#GI5Pj)kVA`WMW(UL=@~FO0CNpW#VyXyy)gT1qcdy8A$K$`;!CYVSD_ubFjty z;Y2BIOl9JZkcqkcMmZZ%qdZ2L_|n@8Wb0%H06S91-Vwp!38h{!g7u%yKMP zB4p=a$izHcr7fHea~sBfypMrQEH?`WLnao(86vz&DKhaR$i(euwHLC!Bl5DrToe2* zgtiY-Wa4}Ncj@<2zl-)~gG~H~MkZbenb;*&VoHQIeu7LK1etihK_=$S!flX=WqEr3 zO21n?%ftx=jKl;yXydf+;6E70EKpor-kCB!>9l#7%bPVuE?l@k2M!!jHAa|j$I+#9 zFUc}Wn>IDsL2E>-;lTih5!3*bfr(`E%yYDP_F4LE89rwCN4MD^K#?DMmoM{te)W07m)&7%>h(co$toeRk;78SkcU zm-kL$?T(nz>GRS1J&G2K28>*~c!4fnxEQB=cVmZzcYzdOq#e?j)?4pCab%wc7@4lp zuUqw(3XC+uju9j5inF0e47%H}n~*7EM&cca7Ogv|>4eaM$$#s%oiql!w)*no;^#>q z43hv4kV@^1J5}1&2w)_i0*o|W)R>ZFa>b;SNTiF3_(V}piB@!5DXP8l#tPc=XphJ* z0)uz%6uGEb!RC}JS#AMh@Hek@jQ+RV-ByG;hB?xL`U^!ghu?pHpUyr%L+4+er&k|e zVn7ZS6M{?nB!a$gfqvwXRnce*jtHjH&rj2(R~P8&+iTdF3!#ALf#eEW9+y=cIaeg0fR-xi|4$%rv37w=U1zGHTvT}3NSKv{-1RJzArOdEVNy* zC@fs45Y>QIiQKtcw_!6)5{pwC8b9VgMqs1{fDv6g#vxt>Ml|t#duf1?^3~LI=E8aL zfAqjE&=535X3+9g>mZN=1kki=+s4(DK7Bd`80iXNL{|?>{yjT30u)Ihv^XkPtA)kN z3@TT)3>Sq3!2@d5t}~VNEKbuW^R62KfT%-3AA|80osZi3n2X=EZlwZ@ynaJ<8vcMh zjK9mFeLKhn0{%w;w2z_Dp`Tk*03hHUP#@1o@hV z14t1+mp&W|Q&C@{@(1<`VC2H8)#N*C4yEFSqoG|d0ZjdH;+XhN9&Xqq;yGQ}UE2W= zJJX}H=g6mLZ_0#sZTquhL7J^5#&|3~1u&wvSMo_|w~-G@__qZ{nxGPfhMIYP&A1X% zz8*zAAS)C#`FWMG5Q}m%^)UQ^l3^q_QQo|LOXDX@5#cN=Iwf|3T$zTdRIUgR@H>$| zYd}=3RS$gv3qX7bXO15d;R-MUkXKiprFcv7hPm+RQ^rwgEa-!SgQ-}_a^#YP!M{YJ zd@iqSX-{a3j1%=xfDr)Lx_apSUpfvhnm-$3cmaA3&6RQ$t5IU-Bx*gP0CEHYG`)WL ztoXh+0eBoYaT=w@qTL(d6FaZ*6KUPXEf{mLv7s6F7$|4$2AQ8FzR7l&i|2YtV5E7= zw$RY?6^nQ-hr8y8VFLi_d@r_usegP#b7JaJp7MHm5!S z-r3#y`)|YeC%obhFZA=|&V}$qh`&v3J2EXaM!ryPjLWzh1u(2YGqMhsflT< z718#cy8uWqK&AA@*yPcC0H&8Ok-*5$bot5+(T*d~mP?F&a2#4}J^Sq(`=~lh40*t7+acFe8tu;0aYZzqWCW{(T(oEPmhfK_+L_#LEflR#IAQP{+v7Gij z+KXJUHv*YBCuHL0vB<>jArmvbQ}G)PrT>GmwcdLMDCznK%R>MMP*gV&H z4gW$sX&RhfD3X3b5f?fQ4QDCS>+`o1u1{l$j>BWpIAM(u1sFLBU}TIeo?g6oMr$q% zfY!(dN^F-*fFA<55a0&?oC>I+gyAnH6b45&%|0XYX!3Ju`k{9jw2M290-hMtAiW`6 zc`E5;d_>qM^7ZnjCIL>=%;zGN$&iMI6n8@hgbF4G$|(HfBQKyV+-^z8Zh8zDqFUq3W~^vF);E^gCh)#^!lZ{tdi)cvSZ3;r_No}c=_VJa|aet z&sBOE&K+H*(>~3`*QrxC+OG9Q0Am*~oLBRe`I$?z^FS136DH ztT8ff(loW68&)q9z{vgk4{#)>gBmXDzkw$}?DXA#fcRF%cvdB3jgc+ecF>q{42)=p zcT+xyNHg&~377&Srs-rmS^*uenXi^OD${XK`)K?L_79=;KPrNW_g!yVeP@+uN4=c& zscF6+@XoDK9QVP{$WYNw9Bds#pKQCkjiBIsx)<(2RSH#+I*+jd1z18xQ zzD`CHnolHWM+o^kcl+JnH2=zcdj0X0N%_lmdK6 z{_|5z5-Bp%V}HaOfRS#6exh<&%84DRW~+W6XQ1|yU-D@LM%K~xC(sx{UfO*1eg;N5 zpOv-i1@yO4UW>339z(^&42KxNRkNI6J zQh4F6jqls52LxC}W29ucDr!1&;U!BHquBi=v;;;NFlHyq*FR-``f%yz_=$P*0T{U>>MaE|DG!+Qm+{`A0wZ^R8-aQm zd6Bf0R*yXf$g%AnnyTh9vPMnN-D}rD71JLvknju^0F*HMD z`O(5-qd%wsBX`$rpr^Cvs`+y{{C|Z*`vh=uZ~X>(G7Iq-b1NOe(E-RnH@0r0SCcXS z;9b^><8urhOxbGH5Wt8JGE^~= zS#9~9=$|s4L1NaR(>f_DaF{-w^h^5PkQGv46Xk)gFV(2cfNXR(;NjaY&#)<_jhF4!KFy7T+IUW{9|t+!d&_#U7-wy}Ce0xii0{-mZ!)-X z^5_8pe4jpZj(+a@D^;yhNoe~aId$pQlP*FVA-4LRJ8_uF$sAv~9_Hc;7b>V~ceL%; z4Vrp?i#%kz1`qg!nlw_5_mruq%sEUT!gOUZ7Vc&Mte;ZwdML~<*w z4#3EYrOE=o6Xt{~0^lG4{PAzRZo@{JFhw3QSAK8KJXNX`02VikawbfkPU|;r7VYPw zPOLGx8hv6i`UaOL`OFLO(>@2u&O*GT6Paq#ak#r#V8rxN35=}2x{kI%CYIrrp6)42P{(-O zEc_~9vm*xQ$o_FuwrK3kr z07MwYB&xe~={#KsnMV$p-;$Fp?^a7NgvBNKEX!%kiEZpCZDs4YR#j4ez&YgQwmMqzT%tF;)v$OS2gCh)#{LH|J9I4Da>(q@7 zV6e*lP6)0sr333@jPKMXI^e>>4hvCn$#>6AMc84D5#AMztvpusWZtg_Fftyy9Fl$m z&hoQb`u+O~@FBzH(^5RE#4<3#6V#}&n4n^5ueo@4K1x%{Ki1~9%4M7cI__>Cjo#75 ziTsY*v`T@iynCb71= z6ky~N)YzY$eMb2*eMf!k_MvQPv*QRG?;sf6)i+mY!kG!8IUk+|P~fvb>QSpFRV-M6 zQo7)Xjb?me!N1ReUi2>1U(k;(Z2(66pOFbLQbq%e7=RBgJH5=rx5?9%YUHUQD%N^O zD|Ex?njnAGmKq}fMjpoj7y&x|?SPR<g^p4x_L`d>Lc^3RkJFMHUJ~-J9mdluHmQ%^5AcYcbP)5I9*9Y80~ zoK@*%x*Zx|q&)*8X4)y+E1xr`O%S`f5ja9q*xeH<;jR>l9o~?Tk2G`IWT+b}-y-vX z`@j_(q3Hl^6jptWOa8JP`Q*itI7$PJk=peEjA*`-GY~p?2a{F*7cE^Tc&z;sg?`N1 zZv4Ce&?7uN0`plgg+s6&I%E*ltWk~9q)sjJkmTj{jdtlrIx(|SkcUqZl!1*&c zQs+p%J9pAUgN6Wy>j4n?!+dtQ0T_|Mhs;Ml%bSTWe^3ES9v(PIzJH81X%DB%KEw!& z9IsJ3TD-RXvK)RE`If*)OV+|g)hzUvI^RQ9z__J#yn(WF2V{j9(pkz+hMU`*5wgO0 z$O>`DcaH%W@%4R3jheSo>d(zUJ1}BV1OPP$9JS-47VJ)*K7$RTfr9Sb$-^RS>I?uQ ztJg;>PmO2bgpUmx>SIaXFc-cRASl}t;v+Kk0DQ=H%V*ir07fQ{6ZH_lh~}t|EKmRZ z(s59ZJI^r3)NcZy$P9nwBK-J?Q`G0z!BooAIOg{0KM>jnXUwLP?ct}&x6j~f5gjmc z<0gO+P5p)f7-?((MoKdwE3;IRQ%P<<8jT z(R}&x&`Jr6;P@yX8RGo-$P&*btby|TXlOcW_{s6vvt^+TI9ADyff)7Zl+OVp@G)(6 zv~;IpiPx7S{q8lOF;WsoX;2=DxA<(Wk%>D%Cf3s@hD^M`AQP{GOuQR1aWcrnGtJ1v zZy^(N`VNqZ+Zbfxc94m=eC)i@6UfB*ArtqBK_;FEnV9JVAQJ~bCjJ>RaRm!9ac{`P z?;#U2{TPi*YyymEWL^n;X!$YDOnhsNOxy-CF?K(r@nxAtCf){_SkE`TUjQTd;!lhE ztALT0FJI8=)qhf%G9_WKC=bqTCE=gQ#K{GSe9B0zpBo7&O+;zKm0%@2rgv?e$}r@2 z`t)f!d-g0n0;-%ndve=&G zNiLpYP*2@?Y&rS5uAsCTQ;{RU5dm_<0CceC2!9qfHjKXWll>AH!JEM!2Kxzqu*DE@ z?g`G>g;CbCkFYZzMJeBeQZ6S4x|1Y1)!%cB26_~rA;nl*gn3oAp1N8$u3U;{I1^t2)Zo{vTBdnm^3_r zJ-7b83B;dO11-Bcb?Z?E93|1a3mB{~oIj@zj+4J=vEsxFG`-uoV>=do&-B4&{d>K) zh+QDxhY!WhhFKy_pg^!07y;rvZsJrmh7FBn&jyW<`w!@cmhIGV`C=)aHBcBB*$G2l zBmNjG$v^9J-?A}_LdC4z5}h&<6WGR zP>ZrH=!Y`Rhz**uVb}KF%C1Qyz(c=#?%F9(?ePmTvj? zE6^Kg=XPV?)aA#~`-ahd$H zpIdRyGi8gt4O_p5Ll~u_<1_eURI6{r* z^Z0$h+Y-fH{FiGZ46&Rer z9B?1t_@ik!PHD(5*6_`spQ@oh1bYgQ1MaR{4~>vHYW`||`goL6YUftiO-f219z386 zZ97J5caC8Uj3`HGd~i%l@ImIR;fv&tjCb35P*Nr6lQl+u__1M(WmuZm{~KflM;y01 zVK4}K5C(q-3|79m^QVrAHvhSJDa~83I9mHU^^~hzGg`j9xx{T?xAdlt3)clcrvqUfBwR|m7xF9Y0bFRpxO@}TdfDuieLkIO&HAYIYZ6%%C zwh_mo0YEX}(7JsW5!8~s;6^L>j9Z~fXMc@-NVQ?(wFMzst=jCxd>Ba;!AkPTF}mh?40Z& z6Sp(U#NMq{d6Dgs`1`&Gtuhe1z{XaKvOk*2#E{F`7PQDd`kpbyr)2046uxrs)Z_&5MNL%4jJi?5Kf0%T%EW*qMG8$Iy9 zA1&STIxCR{%f!$ad9)>3yv$!d-BWo|r|N3K(Gv;LDfKhsH?JXuyaB7GyQG zeoOC6YbnlBxVbbhUc3Nk(UbP>-7AY%pLL;GFnjiFoNZ2{hJ8-ntTA%s$`ve7pHY`C zz0^G93-e^{VJ`~Ke3sIrPlaPOY>buvlVFFb#)vjtYKLewMi>wYIB=H|?YK#K0F0z} zb-_&qs5=8DtZr-oKX}LQ*vq$6f7ekORJ1Vci@1q635ZBKe)_6!#GPBjOUPH)8Q2XqsDbO(Q`fG&XxummUH^cSz=(03t?YJc{TU&gn_EnA zbr~38p+`&4zqutp8+)>jT}l~gw-Tv{xZF#_+tlm3AOZ7*pcqhtG}9`K7CAnw`zQp#vh!tB>5`g zt#fOD5$|@<=)EdX-T%OHuOue{!}c3vfybrr2*NcwS#d~2j!?2%4?IS z9aIr(iZlWkK~Ku;nwk89{V3q$2MT-{B#cXi!;mW1uWjY_)S+?*yc3P|8BX^w=;lq4 zhi<>S14E}Dg+Zv$4J<-TI#l^xsP;B)NS_Ai__lRVtrgdsQvMr3_{!Q#EO1{jg!!!Nyi zAiRYNm@qvHC+ANe!*H8O2yraTNqU*z9^BB98Y;`Ialu+I`gn8xiC(`$WxTSe`=FsC zVWZ=aT0hp12?_p4XHOjyHb|K0)$7-|<)W3iS-@O=lAqf4%la|>woOK0q-I?lVbF|k ze=V8^qk#oP`9HSl2toh0NxUpCM~>{+ym&0y=k8XRE?vGNcE=f*ii8#!gC#tJUcGcq z2;&bR^a@pRl>g`4=~%3J(1(Bkssyb^ZTT{PZGB^lpMo21=)qlPO`KerU1oq0q~!Uy z;$dZBcK`TsI@;$KN{=I3PKF~(JTI5uuN;~2wFHbvpuwWxxb_EUXp24ltol znIjd0B3$dAj@10(wHLl2B_eCA9UFxD#IInQNn zJL1+HLw?%ytnHl=Hx|8o^-{!Jk_%;hEXBt(uJSrXYSJ9@IZoYRyxS3D8@EmQmq-}7 ziW^LtgqcT0a|4`W`owu%-xuAB8c=|BXTJ z=~Jkd8C;DTHE8qZ&1&7W>6H&(8NjsRGA(P2aNd4?AE|Zg&NA5K=?81g2hVPx2T7oM zm@TaV95DhT0wytNg6K6wq@OiKUOs+LVSinu(%0Tn4h+I}81(pfj8Hui&qN9^!hC_C z#absmul!(q^&kx@R)mIlx(mRAZH$-zB*@$A^M&EG8(i^iWM(mQOHr!o->F4(jw^KY8XMuS_ zSqFo7UP8TEA>9lkhuO1d6UGypLTJ)EOYwX@H*@Ap!q69=!DnHGHAwgjE2I5!aURu+ zz|fQi7?CrJT)-RrZF0AvTKScQ;^Hfd=SLf=!Sq?xHz!PaUTo&;L&Xo=J|^s~p$>WX4UDT%5bR;F zD_Kz*RD%HysLVb&OH(gS5&3&DI&RPy8E_0>iJ^TH${WyezsEF~(Q#e-&BccXgp*fg zFUpf44;Mo(gI>_J*Vo9^At~iem6wu3ZBn{*m)FwPM_bkM^!ZCa10!AX|00tm=yNiT zW-u@kljFWq7k!VN>|-1z7Yj1%`Ln0=41H7Y6xvMqCXH$IH0)n6PZ2iF#p%Ns7?DEy zfWg1fwHr5u_Fb}MNd?$Yu|hejgX<;P_#eCZ3l`G6g-gXdYnzN6^&jzm?)*jS)>GMu zs8GHv4TSxU3>ngkIMx`^?p89OA^{NA){xFzIDgM`V85kI=~9Ah1Fq+uIAt0@fGDA@ zGN6ASF>Y`qFF^RLdR$!9$`x?i%UD4g3Sgl(j_I5^cV76DB}*n$-Q94!gUgq5?VGoL z#A8EXU|?K|Frks-3u}zjsG}^{BmvtC;p=p{9F`US7&9J*eD{fH9^-h&m%*fLS+h{_ z(iKJc1%O3-^)Bx+o;BEo;bTv1>~<=&UDzEt>Vxasm43^&Q#5W^UxW`FGMxBE26nvj z$i@pl*G&~Kskps8YMI5h;m*5m~6IYl^}}3ajdr|Pf_TbH{=S9VAuTLDKY|L1u#;r zrpydaW4o0=Q@`6b<#*8}NRU@Hj^Ct(@;$^eQ)IVN)b4vY z{KOg=Y}@FgFgy*7K^UYSHt1JqTR2no+R8WdC44PXxDYWY%#ICR^A*cl_uJrKsR_U> zHlXWSwz4)#yzkh&PSF@ax|T@Kjy32wPY(}w;XifyEDahuLIA=Xz_z}c|Ik=m7thB{ zc&ue-NiGzTF~r9OX>GPZ5mwp}^;Vkl6~ z7uVi!D6I;AWsCyAIvD6sR$$?T%W4V!!Qk%-ehs6y&F7`>NXVIU@ zEv-f-zPngxgfz(3KqnK=rw?HPlqpF@YE`I>P9|pXFN%IH+M7HxdKzTnRTL5tN>P!Y z=u=P>Wa1ebnYb%t;y}p6t28q4b>v|qE)Xc1yqHlYehiuT(o~VZSK09znHU-)Jl>;y z6DmwnHAV&>1BimLLECy!G;7u@YTv#+M++fv z`SRt|qel>_iQQ#2H)Tq&qYJU0`?zG1)ZKih-_sK8S zQJ}b~a0O{{d`@xG77hxhl{46qpT6nV(}mFH34$5dzGG8$675)H+9eWvx@?M=6GyHSaO zW5j*z`Zgz&Kd!)teu2gSh&h4B5-=hccb3}03p{gaEzxth1V&<_;kXA6e5rBs*6|LE zv}xIl`t|Lt7S9tB3qmYJv~1f+4Ug%?9l%IfNq>;=0zotI>HLgj^CX~ke5A!zfx1QT zhu{y?bW#&aQzQ+t!jTz&TUy*|3EA7)tI4#BHW|oat+y+{NKcQRR3=MV86}Lg@^yQO z?Uc!wBYbWiqgmHylC6Ust*8&RJW+3DEC>R~m)I7!!!WoA$5#z@U-1(KCFg~q4SAK* z03$~SAWUiZgbEs9#76^+#1PM#DRz%+X@2)V%^H6V{}c|jdZq1aF0H2Rj~IlAna=_k zDe&(BMo?jr3k`nXfrSP;eSfmlfAoD+B-Z`0lvYQkdbPla8ff9g=lBWg2qBDbSzyOP z=t&5ES_7cwzR9lvM!1~hI8JjASMqA-9}d^M&jCilaAaorl0UJFjd9=Lc;UchNDzp3 z-8y#eMwKg7q;_q2$BD?_|2=GUv`__YL(*6uQqVOAjIegfVC*utYonCGnQ_^?dBHoI z(s7ssk{B3~{NV5afHi!x4UbvuBCrsw+pr0CMBfNM@1$aK{?rVS% zzG8dM%&AnNd^yfaI7{Wk6&T@6zGNKaYi(OKZ%RW3^NzOScs%C5FUJ=YPA$#ehCsv65Hjs&z#!)6#fRUaay&w}~liT3<;sWzB@hr&1i69g6#Rn|Q$0QSX zgG~I9DIgPTfRUpHUiwbVN)?TB>3HIIGzD7$=Gx)CEr z(3B}tL>2gb@ZiDXU7KD8$aL~4!!KRBL?=(4q};jPVOzzxD=6dj&xa2m(7vnlDM?Zn zdf|K!R-Dse@U|fbTW4}e>X07sA+mLKnP|IHT}_t07Vw9pdr;N($E?ZE|dMmqaTerX# z$WwqLo>aU<2@%G?#@RDxjNMF=zFz%?#Hz8D+&O3poj-Rb#`5*`V_}C42*&2_-n$PQ zB(0&MsHl3bS-XL}CbDX)(q2}1%#|}IG)C^@TFTbZ>d%(US))YegJgm~A;Cd3XV!G= zqEs@e0weM5I(1X?m*uEWLwfeBz=#RMH3Z^^f!b)^c2wH{j0A=SQWA$GYME@{^wRx{ zG+@~PT;uCP&S{-R1w-D4QqE5~X>_YGu>E zq|T+fQnu9DjKqewh{y=qdUh+#@}5EI-P4OBIqkD|fYH^8;u>Imf=6#2(dc!f>4ohx zN|FxsMgF79j-i~XbJEjyPiX*80*3aDFF%2@K$GOL-y<5t=(vs_6Dv%H1@27r2=M|v zH^jex=ueUUpJ-sCK~yMvA#!zcCBKh;bmPeln!0HUc@N(usx|rWBs%~8yjq?L{_R;LF`!ZO*V2|>fQ4v>e#-mSiBc6RbJ(f zNqA|5gK^wH*?NDW{P}3*@}*+;O{dM*EDyIH$}g~+j^ ze}~$8BeaK0QXJQxZ!GBAy(itfd!Ig`hC>GaN?ozr%g+D(d$GG3iJc}+WiEeNj*RDP z!n0+~3L7J@saov@CciHO8$p4%PP1HDnl^cYdVEI|X87|SWwL=jRz>G_{pYvAR13GB z@J&H_cmMta`sLSwbobfoR);YAV0jG@DOnJW)z8Tjd{j6ME?VU)z&fwBB^xm4qgrbWv!AsM}}Jz2wWMC(v*3-O_KiTMR4n z`ES}+@nT+x=NdJbUE$W|a#L$vp2bCLrSt6y^SNl7>gI95;Z}aK zMd3Xw))p?U68@03rJ&}Y-bv}o{K!+O*MjdCYR1p4<;E zbkuhu0~qZcY}V4$egew05qc^TSv8}t65sgi6QdaLt!8=vDbs-gjlOxAYSC?6wZFA*HwR)Rzt$Ys3 zNAe&lb{DJ6cv&xSzeA>wwfpbZugN3eSTw^nZ>7fI8k7BvZ!-aJl0tGqH5?q*kq)`$ zn^`rx$$NDeK*SiWY9j?7{g}7sot;YiV2j7Gg)ueaU78-Y#79_^?;BXgjiJQfy}Lit zIw!&x6E=<#K%>?GoR{h&1G))uF1GgX9sPTYhy)l2V!jeW-#5e-W=Xl@qI_Uxu z%W#|=Y4f78!)cb=w{a0){%7D@^owjNv0YL`>jF)}=|-=C7>{iw zmxZjCt-22jL{J+4`uHSObi|E_9qtF_ka_=By`CZuWzaw80KAi$Yr->7-31_a7j2x> z7oy@0zgNN2{G?s&w5 zL;6saS^+BXRgxa)xSzYKzWtv7@EQad7aarvf4b4h_IU{hip!jzc0w}qj2{FbvCRNUA}SJ(CT1JrT>qXDx~Or4)_v$h zMoy^{KtkX5$@Mkq{TA3wr+gX&W26SzZA5pxkYYT#dDM+OsBe2$IjLDI?k5j+IPQBz z+I@aNagU3E0{>qc{bGq`fR|7lW?FU@JTR+NumH74AqQMvG>r&n^TG9XmIvl5KdoEg zFE2tu?W=8K1|viN7$%$Wga8>K0D!gTA1;8%eP$>$=imn)OwG~hnaj;S+)oVfvrK3K z>IKmaWB3bs_wYexxO4Hi^kc(;te=|ebstMRvy{P?kCotQV($c%*dh%XyVzs zE74mCy&IA*CE+SJcVKdK!|!tHw?{d{*~KlnA6`WG+)F%~)9lTiqQU-lCe$g65r^A4 z8lM1HF3;mCBHnt;LC@^>d(%!nt8%I);#mp&1>_f!`X@<^YP-4x{QFI7KbJ{!ORQ$3 z1oaKVSeq32qdho+KRjHLY-jv>@YO-J&I|HjC**czQipHZ@kE7*4J6WvNS%Uli?TD` ztUwGR%tV#wuDb^1{bK!ci zLpOvl{Z61NHQ z@#V((+NPISOLK@r7E$71WabjL*j(Riq!C@?6WybY9GPWRI{>XSaf9r75{`J2#x&_U z@ElHX-$jxHZqLrk5b)lXbh<{;1$LuMSov1qQcv%!Lz7mk)l_ajxw9S*;*c8ALj)A? zec}%Y;sT(cW*Dq64ZM$uDZg1o0)POi{W!$uChHNmo*FIL(%E>kZ8ZHn_!79opA zOMP9bM_4K}68GYhl6Cd)AOIj$@N$wG*FYKHh{r-#g$fgoR;GhAwNAg*5p!9gzg|T- zEoshOCL&Q(8B_O?`{&INuo)F9q*ni^p3M7TuG=AAJS(PKYeh^=F8Y9$e=!lq@ir<;gR7w88bEJdj{7E@QF0V6A1B^XB6dvbd0 z_%%aMqjFQ~orS51CKT^cb48_*E4IhPt9OSxdVNmf;TjpUxNQ$PeHAZFTVc82e@1U7 zy?A~YL6b}uEq-E11gPAsu@=fguqN>$3dv=1fTU~z`Zl%nuYP7MsE=6Xb6kgU)Lm$8 zR+|yy+`dwd{9SORSXS)sX|6rwqDCiH0$<2GaW|#C?_DW-!m&; z<+y0`2g;}qgRf`uo{_~r=8EAYDiBqF##x3n(ey3yt=z&6=VrA51X!q;f@&}TxB#kF z3|W*^*qFLk9|h%^lTFa2ax<7;=#ezL)7?M^=0M;16lYb<83@T*v43CWuFL}8M83pJ zaF%>_@N~2~?05f*#*x5Bj7BgJqMXI~j)+R1r-^ zy1l#I6#%>!LkhY=7uS$tTvwJ>u@xBLmZAP$M_@6^K0Pn$@FO9DQPw(w;{~=*dnCm~ zKtuw$(ah2hRj}If-qV%ilsNJI1VFtW9q2{)ANDObC#{pQKexRN(d7oI~M+01w+C)0X@ckk}XXU1;#oxp)C zzK_B(g4_2v+GxaP0zKi#jrcBNXuX{NR3Q8=QH~}Dy}%#~TXQLvPo0M@9YnpopWrQr zVJWBruzg=}eduCm+>iMGU~d@lmIjE)JjnW#v{5uFn1t*Q0#N$yQ;GEy^-OkQ;b@Vk zEolwrO5kF5mj-W0a*(2guX~Y)3@(^!J{T1%>~AU8K=HrUwNdyX%})MuK@RIxa^}v& zyi(kIKMMwL{4Uj@L<=`(T2$z4e}%w@!8ilcL{u35rNN!IJoTqbQ_sRy3_Hn6(K}%G zta;u6dL|uKmHb$;>E9^m)EQAKNh8Y9Ol#9g7>S2R{Xg+`#(v*)j#zsI?xDW@B~(=d z8`2-aUB1?*=$ZwDUwwitX`v2tGynp`q;uko(PK&90ToCGXwm0eX_Y<55RnfbUzdg~i_#i}vM%dm<43Sf)(uKD``v7A=yfjH9uHn`blSYh?w!#miq#>I~c z-B%RAs64Dk`JXJ z*un=-E@FEQ!GXwiUXfRO4=*&%=1>fbKwHB2o*-9vpLr{G;p{JRr%IZ_J-XNvVKzDO z(AC5N_+RRC*FJ+iE$&9Cn(fd1pxFeJV{Vx->tsxmGDC&&Ktj7mYy=;ve0?e`$I@qKwO&aT;MLYa8kt$aU!M z4KiStRvZse0r;TP>iB_F$X&5;z1vp^y;lqG{K;7=ZwoV+5x>@@|F435^uyB=bP`}}eF)z-q{=hl>?HwtKa7c55*!~l;N#O+_yo|eTAa*jxd*gwEzRxhSjZ!YwlfS%` z{&YY{NP!V$H5t^(;+Xe@gS_zYD*X=0Sc6Uio#Lh!)S}~$TDP%GDpJ0+Kx?WUREoh@ zq4u3gl=lg3)0|k8(FtfDSOlxkw>p!%`+M;B``8@kYy0}4XnnWs9m3FNcypNH(9&#G zHadXwWjtFf4obXA`j^a6n3fOH;&#;NnR4+uAp*s6O78&9E8qK4`pZ$188Q)(Bdf?Z z@PIaBy(0&0)7j6HF-{Of-N0vzSg3X#$zzt+TLXWn^D-}iilz?>DjK zaL}lK6?H;B52QN6$*Re{q@s7*=7?Q=@#0*!#tS|ly=rBAoHCE+^ceJA!++csdNS}z zI;r-f6OO$ozTk5w)plK2`O;xjG| zXQ#%*$#Fd_+(n6N{xv8oXXMWi1uj>Wmp7}flQDs@piBC6TtvDGN9sZRzA<7nyadY^ zC~O-*BL6X%g0HRp3Y<7Q3iDaia-!O>1GG|a2_*>gBc$e5mQQ6>a@n82HucFwuh{UG z9NFjUx4-#EN|X}Zmmv8aHNt~6RRYsJ!M9%cahD(Q^V8iK(_FSNOche;hI~oU4*Su; z%jQERYmQSQS4;G#(0LiFbjsC~7{6Ha58EGv=-Wz@V|6D-|(6rK8pR zp~w3Pl-U=M7biQEvmy+%<%Dv#iowI6tW7)q5kyIJ5GAn-^gP94tdY`vKA9u1ZYC=7?N)84bt7BASN>Mt zxRT^SizH307E2liXsV_tX!QPt?TMwSVxpO4H;t%1jF2FJ3e~RTzHqlzAOZF_+WrIO zb+XFTkne#SSKFXJRKV+(gZgt6=VGijN6be(y^6{U>CJm)@$H0eob7+>LLhc8eLF{8_UI++zDSTcDdnqo8Mi zmZ96kMHz?ywl29H_dpaKOVOPAc$Lnzh`f~vco;$Lz+27-a)Yo~bZP@=71P8GJKXWN zIDH$eCPC9VBCv64f!LGP2~h2K^va7_;_haTgQ;wdHfPIt0?6!~&Bm=0dSsT6$2(cj z6@{-GkFQV9TGzKs*v_ZKZ=1x2>yjecXpyA=WGNi{8Pz`sq`^SMjP}+0&uxlF-!C-@ zhg4|95GBzY1@kOUP06o!K3f=0W zKpBGbh#$Iyrn_nZqyQ0(61npu6r!wE?)=$-O!NTGU1Y&Tn8Tf^3J85}b4@UUG!8M5 z%v?)9RlPh?zD@L6DJaU?Q0qfdb5#;)i*7U-)fOcYMiDZ(e7>A#3V9r|R{Op^_rf?2 zhN_$1B8#u_UseTRivg%Gh~R+nui}uTg@rH$v2BDy7=2f36}Y_Qop{=uhD{8-KaOga z2!=09No?ix*Yjf1)NhCVMH@slj^bAzA&pnVW90h*Zyj-O{C?!pc0>W#at>QI$q|!W zwB43wi@+m2>bJ(y9cZAf_YFnmx^W3qk+ZBf+#(E~X!kQQ8M5Z&=}JRX9#kD~9;(iz zBpwM}^r*t0JxOXwED&*GC>Nt6-v~r(LoKURzL|%6kDBo4t0+M7{*MFuGVTk z`P`g9tn3(U-tBS(lOZxe86zZcf=A0c4bfOwuurFVx-zYtY+L&qYQ>6fTGhtDdZ$-* zyQ_l(y@FWKQH4nipP{awh(Ej_8B$FAW=r2st#DHCWFboyukxpwK@|D7Xb9Z&MV_O# zFD^w1;qdVH2m9jMhysK+Gf)c>9M#uWmILC}%ful7aMm_@BvO}gjfi~XbvkKY>y4J$ z-x`lq(e)f0zn8H7R8lw-rU2>T5q)?2MC_bSehS?}fd~FhMkVUBR~Zc4Lvq zO`gbs@?>FB==USTYHS9=?u`Rw;Jjnnk=K~^IBL1t81p{^hrh7yUT@s`;#D0M`!pyodviKl|9Ls9t^dDL>V z&5xFZ_mWp_tO*&{=~o*F*sis5uo$*$0N1%>haYYFo1k&JIzRRXBDlCsde12_!7B8_ zM63k7%s(v9hWj1O8J*+!e$}RgqRg27dWj>Va_hp3z_gVO&Y(33!&cl9wm(`373JsSXIy7pmG# zRsukObRKObg~^ss{b9b7dowSchC56{2)!0uFEX)l%%HBN85;Ue5}aI4r)(0XGNZp% z?@^y$Ha(#y+sg=O#r^cQ-XvwCW(7QyfryVunil@{y(67o*YGAkZH#*SzL@c>LiNLk zxAbB#7X=wU7o+cuB}XlPs^F^ZQxLo~d%*qdr|5h*^I`jk7$MhwQMu;i*(Z=oRIUdv zyX(oKn|Hk#Ytj9RQo7?`KALES--VybNE~Ku{lr10#2k71#%6#4hP=(&i@s85<@ZrJc#0vX`?yvhxn*04#h%wcsF%(1?iOhXJ zB$E2))q4{-f7D7>t3E`G6v-htC2P|NTQ{-(6IMb-KTC}!kf)2mm`2QOa~d$MmL&Ap z!r}AMdoS8#`y5;ub8EBL3*knx+IAOS1jeKJo_vN0>JG&WAr=*GCVjHnm;}~9W~K~R zdvv`PgDOdCoi`x_NRbQ7wnpYs^%7%FPbEA?TLC$2bCB;ZggVaLd-6Fd#c#*foiJ3L zpf2|_W^nf|es4GpRi%MBisS%dbS?JchTpRi_Z4(pW89>iA78Y4{q50>Q?6B|XLcX( zC7#;43N3hkPS@L79h^7}f)c~3OlC9%r$jm1%kC%7Oq&=iJiR<}dDoe}Lnwe^w?qm{ zJC+!1G8&T>|KzCCsL1om8Q82@B1#+0gWDH0RHeQN%h*Q$GHl5nvzi=;`Qap5Vq=|Y zrNLar)z#(pIi$-~Nt*oUPlir)Qh7KbHey!8V%-MX9opRBna;ALnMs~ZNZ`k3(8EZd z)lOv~%6MRb_;CM@i8-~Yo#|w@KpdOphhuHCT|Ud9y!_WAC?L#1uegbw3F!^x-2^PV zS--4JVV;$52GUotU^YUb+d@|*zZWa91ALOl*D~v22d$hY3MM4zj0G|XBPx$;B<#*| z3^6u%wAOnz9Q%2r5P^NE=Lxl@&*W*R*JqgMU7S17tNl@`_bc_ydKZEH%jCrDKeg|h zL9>z;vrsG!k&t`kgffCQzsWF|R0C`2^fHF0o@A=y%W5;gu6h;*h^~;yTSYW%lLl^5 zohuAn&<{2iZ6cym9R5xDPXw^VD5rY1AO^y#*lpP3>G||w~cIr71BAe(YL^O5R2s&zjtJdxnL5JLRLn(-r(u09+>t3} zVGt9EWUlasq{3o^ZbOXalI1ZHQ9x#_idvZ zr-PeBmuJcqr?-Y<$xGbNe&?TFOHzgGJRr+Mr)dazeR;?mDgDZs;Mir23ayxGgEmQb z4ujS4-;^y58?=k>p-Rt8-~_F=);B^UO>l3PS_EJZ$_3q=L|@O7Z5zeu7eh22>k$C`w33 za4tV7QoQRdIMApR?WU=CE+z>NDp#^vve#gbA-0rznr3Fb!LT}uPb>j{4F2oh$njal z?p9ymVq++0XD&=(S(P3QTrdm);d#6k<^Y2I9X|S;t*Myd5jFK?C>~zv4VoqgumT|EY=uH zd`I2GmbIm3&qpBJeQy4;T52x4#|%oKmODINsNkE&ue=ibN zlKfs_83U-KhmE?6y@lS*T)pvpu}Ma%lAK*0n_jg))r$-cOY>~Puc zRkHoJ_Wa)#4sapizyr4g$%NdIdxyOk^%|iZX`EKve|9M)pqyddCs2NHKWlMlMT7=^ z)A(q}3W{X6T`XUv*!=17XKVZnRU(JSNYQ6+{vC3)Kgsq3(lotPV>}xSLt3gq1X=^4 z*LY|5Fg^$sYN+u{fIJ3L{;c;XXpi&daaMI?G)4ttyW86@9RK4-z5lDH{`=y=cwamS zhH9b_DiSs~Uvdw_yxWUGCwIxM2aZu;4<1i=y!@=Ey%>5eB*c=9Q}D9q$a{B;)+wAs^pS)3g745%#_TL}wcn8MM`-Dq${?)D?>SyuoP=Kl$b} zE2j!&u&|zy_Y&Xm-+BPmTg@Xfm>S-1C|JRvbrkyr30aO!BB`Udb zvD2o@C@4W6=JArCJl2{nAsCJFbTDXl!+Wm^N6VqeaFnNHVt$IyP{KjAT*;q@pzVPv z%9oxq74cpq!RybT%Tt6oRxX;L$N;Gy(pUF?*73M~U;QW5@~;mt!*hS=)RjN1e^qOD z)jfQDZfR{^LD`64K|n%Mjl?@Te7r_V68Q!bV4%&QkkWbcbo&|L$Z)a#UERV0{_BRE zjKhX#nA)a6tJ9%iZ@c6J@40HZ2BFjK`M3I}CIWFa@qm9Qz~u%wFy@_!lux!3@VulW zg$2%+YI5@`eF_v=Gf#TmwgguIA3 zGqJ773>aNLk66&yvv!a3NY8GcN93(CdTwr=8IIQuj~bH>I;5+%K&BeB9pbmlxx!IN z7#P3O9;)A_QFrjFV@VT<&zo`*zs`w{(`EY;*&C_W&{a?i*6({0(TQ^SDb79Usc^^I zgE`UiPftoeDzA~;;&`>%dM4ml3cvN-P3`kl-JtH&kWv7N;dnP=`N3ak5?vGMldaTZ z+K-3JA&RNV?S}#Wqw zZ*2kBXVGU!3?J&)&V8rPv+hNv1q@n0rWJl4jjy j#~gDp0%-=JWWdbB5LsP8PO< z8Z}j^;+5taVycmL`j}RE;=|#PDyMrEFr+;>MtXqr>oZ_4`Fbz)vN+SWf9*$`X{#@m7{m#*P@m!dnG?Q) zEo6P^xJWwX26;Z(-FI?R3bSUyw0f z6(k9*kjuCf<^1u9hOOL72g8oxQtJ?ri0Ic+uRaqUb9OQnJH^TAnnUk?!Lo(1?cliT zI;{#;4xsj5AkuaJlZY^LDf#a+^IL>%RME`zbiPL)nFFK^6_sh|sd*-oHf-@MKTe00 zYuEH7%eW_D3~?n}^z4zV>zSgWA_hCddk>nF?PHGzCM@JGi=bEJ?gqsM@F2{DE7T?L0vc}E93CrTsYfG{TyE+Z@)JIXfO1uwBiNm z+{Ee?>)XkC;ZN`}Pgh?Rb51fsjj7^Ght#w;zf1Belh7{9qJCdfrJV&C+%t!v+_gEc z^h@2{RhSafH8flwe;Wwshp!W5CD%m2tsFeE;Zx4isnKG=9S}6bbb_U2Fs-k!8;-fv zvg5|xP4N^ig64Uml`WX7Gyjb;u5%CNlK5Jwh55ZK2AAE*yo>P~Gm?~7xflNK(OiTi zCyC$T^)?Q(3@+p3l!f-gdL^0X2$MS&{X~oQXM8Y zR07%MoliK=n53G-)kz$|Ugk2SHBvfdFSGqaYLRdY+Qyw^(RudG;AhIvxuUz{=ydu$ zZSm2~rH2+VvDul-VtZ*oo7y;J!GAe8-_VejX`8%;w%QI1{54>bpkZZV&2!les!0yK z#hm19SH7^@o<9!3h(Yns-dq@9O*Gtl@^+KdG+$mA_?iuXP~PQ7YrqZS9&GPX)`5QO(@_{Au~k|#rhDMw;9fdeK&fe=GZX2o z8BXVs$wKkJU+>xNknK(Z7~x4^rwrsQ8VgKfAFK%c$yAhmB_0;+33iNIc7lk7<^oYF zKl;jigolKNuO^-2uB?oX7q`-5#OErgRvvL2Jk~&7&J?&V57;Kop07CajHm`SD9Xg3 zByyjsGIC$`F}LCF??w&=zjD)2$ixe)h4tz;8!smylB)U0duw6Xbj0Eq-QzjTL20jZ7lO%R& z>lQdn%2sKxg*1Q*9zMD7_UH_sA~@)KbTo<%OAA7-+ff>GF+7O!GG7nixI+u~!RzCv zyCdpE?Ea}IK4FSk%NroKTZF-uUW!q|;biZLpBS2R@Fm?uR3|Z|uAiDh(d47{;4?dI zEjdYVzv=dEMXp?r@pC%*{YfqVB`1eS&%3C^7W3^Vx44KCZFZE>nrwb2^Vi$7##N<= zrhuWf%t67l5ZM92Z3{fy;hON<`99uR9~pX@B;*DzXkqMaFkP@YUv#OVTx79_vT zqf(%kS9QExpCo(pP;7u{QN%gqOXEi&-E38?GdzMx5OEGD`XgN<4V{$t@6iQ+klxKn zNM5ydMYi%h3iMXcpJo^1=DE#i+?~LSCC+o#K?m%tFL}kGAT#bjxD2Y^Vcy?iHfG#I zD%{2-?~@pxl29UqkCh4jry=6|&IFa7mP+GX|yyj>S3ygZPqPGJp=hqswtoapOL>XWm^__Sil3yew`B+9Ermgs&h)V#@eWQi3*~2YZubRay#y zu{>UMt&}lw2`?Qq=Wk7ub8~LjMSJ-xZqS^QG;PB&;*nu6udvs7&{+x*<@YpQT*^(`U-IWk)K^i`XMJY%eN$+-YcL-5 zC|heQwVG$ep@8|%F%?Dih<8?gwVGs9FFwen|R6&8lR6$oZJoobd0zKqSy*7U=cu`a%9bANs$l z0aOZziJ!H9ApUQ~foRImQnbG&8M6Or$A2u#o&g}H`mu7s_ir;pa|p7ar37nz+_CVV z0{)duxM6r@WE!>{{!3W^JS%_T{UWeTBhve1O`HOBd`rb8B4TdTxy*5NZNK2-Y z@%s9Oi?4-wXV0QjS3pJcs~B<8>MeNu%;&_)meDG5&^J-ukn8a!B|Y0P?(&^QryOAo z%TD%4l@Fa_ku%83YR*|v>%haY)~;YS#D?3}J9FdmG9cQ6dWS~w(qy`DPQm$ar5yFX zVw2t+hhR21tEb@L{&%DREe=C^gSnly0~bkz;_XVLK#Dv9mjEG8mDYGPN^;(st!Gjd z6vDrZuvf}K2$k-!?DVzdU0Vd#qK$io{ba4W4r4?7(luvJK;Uj>XWLrUs^rX1g6%GC z%2(s##Jqg{-yHoQxmSosru+4dxaqlJ+An_+6>pS&Xg2zj0@sH`T|PUz`-$rVm5G-Z zD5c3=Q|nOFOi1`(g1U+I#MKq)_018LuS_t!m;Ph$J`q!ZmMt2Hou@jynT>*%3K#^o$N`8iTN;WkO!abeVLp6 z3MMhRZ5+Fm4=j4MmSMh`5D*F1;@)XhSbm}0b0!{xGw5tCU!1) zH3iyXQWtNzv;Ngv{;5I?_Rzn&_dn0?Eu!fi8YyxU!Jzxszyj^#4`K#67+E(sgxdh< OM^0K`_ (formerly known as pep8) @@ -195,6 +203,8 @@ or a few related issues:: *Documentation:* https://pycodestyle.pycqa.org/en/latest/index.html +.. _section-tools-relint: + Relint ====== @@ -210,6 +220,8 @@ documentation markup, and modularization anti-patterns. *Documentation:* https://pypi.org/project/relint/ +.. _section-tools-codespell: + Codespell ========= `Codespell `_ uses a dictionary to check for @@ -241,6 +253,8 @@ Sage defines a configuration for codespell:: - ``SAGE_ROOT/src/.codespell-dictionary.txt`` and ``SAGE_ROOT/src/.codespell-ignore.txt`` +.. _section-tools-pytest: + Pytest ====== `Pytest `_ is a testing framework. @@ -271,6 +285,9 @@ package :mod:`sage.numerical.backends` and some modules in *Documentation:* https://docs.pytest.org/en/stable/index.html + +.. _section-tools-pyright: + Pyright ======= `Pyright `_ is static type checker. @@ -291,10 +308,16 @@ Pyright *Documentation:* https://github.com/microsoft/pyright#documentation + +.. _section-tools-pyflakes: + Pyflakes ======== `Pyflakes `_ checks for common coding errors. + +.. _section-tools-lgtm: + LGTM ==== The website ``lgtm.com`` offers a detailed diagnostic about the global code quality and its evolution. diff --git a/src/doc/en/developer/trac.rst b/src/doc/en/developer/trac.rst index ef6bfe8693f..6b8d1b2d871 100644 --- a/src/doc/en/developer/trac.rst +++ b/src/doc/en/developer/trac.rst @@ -280,15 +280,64 @@ Working on Tickets If you manage to fix a bug or enhance Sage you are our hero. See :ref:`chapter-walkthrough` for making changes to the Sage source code, uploading them to the Sage trac server, and finally putting your -new branch on the trac ticket. The following are some other relevant -issues: +new branch on the trac ticket. + +.. image:: ticket_badges.png + +After pushing a branch to a ticket, the ticket will show badges +linking to results of automated tests that run on the patchbot and +other ​tests that run on GitHub Actions. * The Patch buildbot will automatically test your ticket. See `the - patchbot wiki `_ for more + patchbot wiki `_ for more information about its features and limitations. Make sure that you look at the log, especially if the patch buildbot did not give you the green blob. +* A `linting workflow + `_ + runs on all pushes to a branch on Trac. It checks that the code of + the current branch adheres to the style guidelines using + :ref:`section-tools-pycodestyle` (in the ``pycodestyle-minimal`` + configuration) and :ref:`section-tools-relint`. + + In order to see details when it fails, you can click on the badge + and then select the most recent workflow run. + +* The `incremental build and test workflow + `_ + on GitHub Actions builds Sage for the current branch (incrementally + on top of an installation of the ``develop`` branch) and runs the + test. Note that in contrast to the patchbot, the ticket branch is + not merged into the current beta version. + + Details are again available by clicking on the badge. + + The automatic workflow runs on a container based on + ``ubuntu-focal-standard``. To request a run of the workflow on a + different platform, you can issue a `workflow_dispatch + `_. + You can select any of the platforms for which a `prebuilt container + image + `_ + exists. + +* The `build documentation workflow + `_ + on GitHub Actions builds the HTML documentation for the current + branch. + + If you click on the badge, you get the HTML output of the successful + run. The idea is to use this to easily inspect changes to the + documentation without the need to locally rebuild the docs + yourself. If the doc build fails, you can go to `the Actions tab of + sagemath/sagetrac-mirror repo + `_ + and choose the particular branch to see what went wrong. + + +The following are some other relevant issues: + * Every bug fixed should result in a doctest. * This is not an issue with defects, but there are many enhancements From eb13b3a7edb46359b812fed370a2796735ade8de Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Jul 2022 21:51:09 -0700 Subject: [PATCH 201/416] .github/workflows/docker.yml: Reusable workflow, factored out from tox.yml --- .github/workflows/docker.yml | 155 +++++++++++++++++++++++++++++++++++ .github/workflows/tox.yml | 91 ++------------------ 2 files changed, 162 insertions(+), 84 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000000..09f09d7d744 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,155 @@ +name: Reusable workflow for Docker-based portability CI + +on: + workflow_call: + inputs: + targets_pre: + default: build/make/Makefile + type: string + targets: + type: string + targets_optional: + default: build/make/Makefile + type: string + tox_system_factors: + description: 'Stringified JSON object listing tox system factors' + type: string + default: >- + ["ubuntu-trusty-toolchain-gcc_9", + "ubuntu-xenial-toolchain-gcc_9", + "ubuntu-bionic", + "ubuntu-focal", + "ubuntu-hirsute", + "ubuntu-impish", + "ubuntu-jammy", + "ubuntu-kinetic", + "debian-stretch", + "debian-buster", + "debian-bullseye", + "debian-bookworm", + "debian-sid", + "linuxmint-19", + "linuxmint-19.3", + "linuxmint-20.1", + "linuxmint-20.2", + "linuxmint-20.3", + "linuxmint-21", + "fedora-26", + "fedora-27", + "fedora-28", + "fedora-29", + "fedora-30", + "fedora-31", + "fedora-32", + "fedora-33", + "fedora-34", + "fedora-35", + "fedora-36", + "fedora-37", + "centos-7-devtoolset-gcc_11", + "centos-stream-8", + "gentoo-python3.9", + "gentoo-python3.10", + "archlinux-latest", + "opensuse-15.3", + "opensuse-tumbleweed", + "conda-forge", + "ubuntu-bionic-i386", + "manylinux-2_24-i686", + "debian-buster-i386", + ] + tox_packages_factors: + description: 'Stringified JSON object listing tox packages factors' + type: string + default: >- + ["minimal", + "standard", + ] + +jobs: + docker: + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 20 + matrix: + tox_system_factor: ${{ fromJson(inputs.tox_system_factors) }} + tox_packages_factor: ${{ fromJson(inputs.tox_packages_factors) }} + env: + TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} + LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} + DOCKER_TARGETS: with-system-packages configured with-targets-pre with-targets with-targets-optional + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 500 + - name: fetch tags + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: free disk space + run: | + df -h + sudo swapoff -a + sudo rm -f /swapfile + sudo apt-get clean + docker rmi $(docker image ls -aq) + echo "Largest packages:" + dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 50 + sudo apt-get --fix-broken --yes remove $(dpkg-query -f '${Package}\n' -W | grep -E '^(ghc-|google-cloud-sdk|google-chrome|firefox|mysql-server|dotnet-sdk|hhvm|mono)') || echo "(error ignored)" + df -h + - name: Install test prerequisites + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install tox + sudo apt-get clean + df -h + - name: Try to login to docker.pkg.github.com + # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + run: | + TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" + if [ -z "$TOKEN" ]; then + TOKEN="${{ secrets.GITHUB_TOKEN }}" + fi + if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then + echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV + echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV + fi + # From the docker documentation via .ci/update-env.sh: + # "A tag name must be valid ASCII and may + # contain lowercase and uppercase letters, digits, underscores, periods and + # dashes. A tag name may not start with a period or a dash and may contain a + # maximum of 128 characters." + EXTRA_DOCKER_TAGS=`echo $GITHUB_REF_NAME | tr -d '[:space:]' | tr -c '[:alnum:]_.-' '-' | sed 's/^[-.]*//' | cut -c1-128` + shopt -s extglob + case "$GITHUB_REF_NAME" in + +([0-9]).+([0-9])?(.+([0-9])) ) + EXTRA_DOCKER_TAGS="latest dev $EXTRA_DOCKER_TAGS";; + +([0-9]).+([0-9])?(.+([0-9])).@(beta|rc)+([0-9]) ) + EXTRA_DOCKER_TAGS="dev $EXTRA_DOCKER_TAGS";; + esac + echo "EXTRA_DOCKER_TAGS=$EXTRA_DOCKER_TAGS" >> $GITHUB_ENV + - name: Build and test + run: | + set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;" + - name: Copy logs from the docker image or build container + run: | + mkdir -p "artifacts/$LOGS_ARTIFACT_NAME" + cp -r .tox/$TOX_ENV/Dockerfile .tox/$TOX_ENV/log "artifacts/$LOGS_ARTIFACT_NAME" + if [ -f .tox/$TOX_ENV/Dockertags ]; then CONTAINERS=$(docker create $(tail -1 .tox/$TOX_ENV/Dockertags) /bin/bash || true); fi + if [ -n "$CONTAINERS" ]; then for CONTAINER in $CONTAINERS; do for ARTIFACT in /sage/logs; do docker cp $CONTAINER:$ARTIFACT artifacts/$LOGS_ARTIFACT_NAME && HAVE_LOG=1; done; if [ -n "$HAVE_LOG" ]; then break; fi; done; fi + if: always() + - uses: actions/upload-artifact@v1 + with: + path: artifacts + name: ${{ env.LOGS_ARTIFACT_NAME }} + if: always() + - name: Print out logs for immediate inspection + # and markup the output with GitHub Actions logging commands + run: | + .github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME" + if: always() + - name: List docker images + run: | + if [ -f .tox/$TOX_ENV/Dockertags ]; then + cat .tox/$TOX_ENV/Dockertags + fi + if: always() diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 48fdc6ce38c..c98a912e86e 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -32,91 +32,14 @@ env: TARGETS_OPTIONAL: ptest jobs: + docker: - runs-on: ubuntu-latest - strategy: - fail-fast: false - max-parallel: 20 - matrix: - tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] - tox_packages_factor: [minimal, standard] - env: - TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} - LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} - DOCKER_TARGETS: with-system-packages configured with-targets-pre with-targets with-targets-optional - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 500 - - name: fetch tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - name: free disk space - run: | - df -h - sudo swapoff -a - sudo rm -f /swapfile - sudo apt-get clean - docker rmi $(docker image ls -aq) - echo "Largest packages:" - dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 50 - sudo apt-get --fix-broken --yes remove $(dpkg-query -f '${Package}\n' -W | grep -E '^(ghc-|google-cloud-sdk|google-chrome|firefox|mysql-server|dotnet-sdk|hhvm|mono)') || echo "(error ignored)" - df -h - - name: Install test prerequisites - run: | - sudo DEBIAN_FRONTEND=noninteractive apt-get update - sudo DEBIAN_FRONTEND=noninteractive apt-get install tox - sudo apt-get clean - df -h - - name: Try to login to docker.pkg.github.com - # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable - run: | - TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" - if [ -z "$TOKEN" ]; then - TOKEN="${{ secrets.GITHUB_TOKEN }}" - fi - if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then - echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV - echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV - fi - # From the docker documentation via .ci/update-env.sh: - # "A tag name must be valid ASCII and may - # contain lowercase and uppercase letters, digits, underscores, periods and - # dashes. A tag name may not start with a period or a dash and may contain a - # maximum of 128 characters." - EXTRA_DOCKER_TAGS=`echo $GITHUB_REF_NAME | tr -d '[:space:]' | tr -c '[:alnum:]_.-' '-' | sed 's/^[-.]*//' | cut -c1-128` - shopt -s extglob - case "$GITHUB_REF_NAME" in - +([0-9]).+([0-9])?(.+([0-9])) ) - EXTRA_DOCKER_TAGS="latest dev $EXTRA_DOCKER_TAGS";; - +([0-9]).+([0-9])?(.+([0-9])).@(beta|rc)+([0-9]) ) - EXTRA_DOCKER_TAGS="dev $EXTRA_DOCKER_TAGS";; - esac - echo "EXTRA_DOCKER_TAGS=$EXTRA_DOCKER_TAGS" >> $GITHUB_ENV - - run: | - set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;" - - name: Copy logs from the docker image or build container - run: | - mkdir -p "artifacts/$LOGS_ARTIFACT_NAME" - cp -r .tox/$TOX_ENV/Dockerfile .tox/$TOX_ENV/log "artifacts/$LOGS_ARTIFACT_NAME" - if [ -f .tox/$TOX_ENV/Dockertags ]; then CONTAINERS=$(docker create $(tail -1 .tox/$TOX_ENV/Dockertags) /bin/bash || true); fi - if [ -n "$CONTAINERS" ]; then for CONTAINER in $CONTAINERS; do for ARTIFACT in /sage/logs; do docker cp $CONTAINER:$ARTIFACT artifacts/$LOGS_ARTIFACT_NAME && HAVE_LOG=1; done; if [ -n "$HAVE_LOG" ]; then break; fi; done; fi - if: always() - - uses: actions/upload-artifact@v1 - with: - path: artifacts - name: ${{ env.LOGS_ARTIFACT_NAME }} - if: always() - - name: Print out logs for immediate inspection - # and markup the output with GitHub Actions logging commands - run: | - .github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME" - if: always() - - name: List docker images - run: | - if [ -f .tox/$TOX_ENV/Dockertags ]; then - cat .tox/$TOX_ENV/Dockertags - fi - if: always() + uses: ./.github/workflows/docker.yml + with: + # FIXME: duplicated from env.TARGETS + targets_pre: all-sage-local + targets: build doc-html + targets_optional: ptest local-macos: From bc99ea98bb4fc7009aeeca602c261c1a39a16d0a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Jul 2022 22:02:50 -0700 Subject: [PATCH 202/416] .github/workflows/ci-linux.yml: Rename from .github/workflows/tox.yml --- .github/workflows/{tox.yml => ci-linux.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{tox.yml => ci-linux.yml} (100%) diff --git a/.github/workflows/tox.yml b/.github/workflows/ci-linux.yml similarity index 100% rename from .github/workflows/tox.yml rename to .github/workflows/ci-linux.yml From 19a8b35637fac58eb7a645416403f2511308f618 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 30 Jan 2022 09:54:24 -0800 Subject: [PATCH 203/416] .github/workflows, src/doc/en/developer/portability_testing.rst: Switch from docker.pkg.github.com to ghcr.io --- .github/workflows/docker.yml | 8 ++++---- .github/workflows/tox-experimental.yml | 6 +++--- .github/workflows/tox-optional.yml | 6 +++--- src/doc/en/developer/portability_testing.rst | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 09f09d7d744..4518143f152 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -67,7 +67,7 @@ on: ] jobs: - docker: + linux: runs-on: ubuntu-latest strategy: fail-fast: false @@ -102,15 +102,15 @@ jobs: sudo DEBIAN_FRONTEND=noninteractive apt-get install tox sudo apt-get clean df -h - - name: Try to login to docker.pkg.github.com + - name: Try to login to ghcr.io # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable run: | TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" if [ -z "$TOKEN" ]; then TOKEN="${{ secrets.GITHUB_TOKEN }}" fi - if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then - echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV + if echo "$TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin; then + echo "DOCKER_PUSH_REPOSITORY=ghcr.io/${{ github.repository }}/" >> $GITHUB_ENV echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV fi # From the docker documentation via .ci/update-env.sh: diff --git a/.github/workflows/tox-experimental.yml b/.github/workflows/tox-experimental.yml index 080d578c5d7..51084a446ad 100644 --- a/.github/workflows/tox-experimental.yml +++ b/.github/workflows/tox-experimental.yml @@ -71,15 +71,15 @@ jobs: sudo DEBIAN_FRONTEND=noninteractive apt-get install tox sudo apt-get clean df -h - - name: Try to login to docker.pkg.github.com + - name: Try to login to ghcr.io # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable run: | TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" if [ -z "$TOKEN" ]; then TOKEN="${{ secrets.GITHUB_TOKEN }}" fi - if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then - echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV + if echo "$TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin; then + echo "DOCKER_PUSH_REPOSITORY=ghcr.io/${{ github.repository }}/" >> $GITHUB_ENV echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV fi # From the docker documentation via .ci/update-env.sh: diff --git a/.github/workflows/tox-optional.yml b/.github/workflows/tox-optional.yml index 3a451faa0b4..46785279581 100644 --- a/.github/workflows/tox-optional.yml +++ b/.github/workflows/tox-optional.yml @@ -71,15 +71,15 @@ jobs: sudo DEBIAN_FRONTEND=noninteractive apt-get install tox sudo apt-get clean df -h - - name: Try to login to docker.pkg.github.com + - name: Try to login to ghcr.io # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable run: | TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" if [ -z "$TOKEN" ]; then TOKEN="${{ secrets.GITHUB_TOKEN }}" fi - if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then - echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV + if echo "$TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin; then + echo "DOCKER_PUSH_REPOSITORY=ghcr.io/${{ github.repository }}/" >> $GITHUB_ENV echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV fi # From the docker documentation via .ci/update-env.sh: diff --git a/src/doc/en/developer/portability_testing.rst b/src/doc/en/developer/portability_testing.rst index a0a7cbf40b8..9a126126d74 100644 --- a/src/doc/en/developer/portability_testing.rst +++ b/src/doc/en/developer/portability_testing.rst @@ -1057,25 +1057,25 @@ place. To view details, click on one of the items in the pane. This changes the right pane to a log viewer. The ``docker`` workflows automatically push images to -``docker.pkg.github.com``. You find them in the Packages tab of your +``ghcr.io``. You find them in the Packages tab of your GitHub repository. In order to pull them for use on your computer, you need to first generate a Personal Access Token providing the ``read:packages`` scope as follows. Visit https://github.com/settings/tokens/new (this may prompt you for your GitHub password). As "Note", type "Access -docker.pkg.github.com"; then in "Select scopes", select the checkbox +ghcr.io"; then in "Select scopes", select the checkbox for ``read:packages``. Finally, push the "Generate token" button at the bottom. This will lead to a page showing your token, such as ``de1ec7ab1ec0ffee5ca1dedbaff1ed0ddba11``. Copy this token and paste it to the command line:: - $ echo de1ec7ab1ec0ffee5ca1dedbaff1ed0ddba11 | docker login docker.pkg.github.com --username YOUR-GITHUB-USERNAME + $ echo de1ec7ab1ec0ffee5ca1dedbaff1ed0ddba11 | docker login ghcr.io --username YOUR-GITHUB-USERNAME where you replace the token by your token, of course, and ``YOUR-GITHUB-USERNAME`` by your GitHub username. Now you can pull the image and run it:: - $ docker pull docker.pkg.github.com/YOUR-GITHUB-USERNAME/sage/sage-docker-fedora-31-standard-configured:f4bd671 - $ docker run -it docker.pkg.github.com/YOUR-GITHUB-USERNAME/sage/sage-docker-fedora-31-standard-configured:f4bd671 bash + $ docker pull ghcr.io/YOUR-GITHUB-USERNAME/sage/sage-docker-fedora-31-standard-configured:f4bd671 + $ docker run -it ghcr.io/YOUR-GITHUB-USERNAME/sage/sage-docker-fedora-31-standard-configured:f4bd671 bash From 9fe25175ad58b86f65186747b16f34052d7db5ea Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Jul 2022 23:02:26 -0700 Subject: [PATCH 204/416] .github/workflows/docker.yml: Add input parameter max_parallel --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4518143f152..0d7efbb6ec3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -65,13 +65,16 @@ on: ["minimal", "standard", ] + max_parallel: + type: string + default: 20 jobs: linux: runs-on: ubuntu-latest strategy: fail-fast: false - max-parallel: 20 + max-parallel: ${{ inputs.max_parallel }} matrix: tox_system_factor: ${{ fromJson(inputs.tox_system_factors) }} tox_packages_factor: ${{ fromJson(inputs.tox_packages_factors) }} From 175569bc1b1558080d64398a7dec17603f7eb816 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Jul 2022 14:01:05 -0700 Subject: [PATCH 205/416] build/pkgs/singular: Update to 4.3.1 --- build/pkgs/singular/checksums.ini | 8 ++++---- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index 2b3d55f8284..b9cbfc70d39 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=21b119800a4665fc3395ed1de66ad260d4edba47 -md5=780f3dd480d71e7c0446eec10a84fc1e -cksum=215260754 -upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-0/singular-VERSION.tar.gz +sha1=e18819861bd6f4e2d179d2111a9e9ad2c8dfaf5b +md5=b542a676e69cb0dac16bb2e7713c89a2 +cksum=2620794242 +upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index d118bb725f3..f77856a6f1a 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.3.0p1 +4.3.1 From 12ce3d4d7953e065b5cf00052ffcb81226860fcf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Jul 2022 19:22:11 -0700 Subject: [PATCH 206/416] .github/workflows/docker.yml: Default to building nothing --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0d7efbb6ec3..5535f9b9531 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,6 +7,7 @@ on: default: build/make/Makefile type: string targets: + default: build/make/Makefile type: string targets_optional: default: build/make/Makefile From 1e1a45937fb457009de610b1acd9d64f13d52f24 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Jul 2022 19:52:29 -0700 Subject: [PATCH 207/416] .github/workflows/docker.yml: Add trac-merge, upstream artifact code from https://github.com/sagemath/cysignals/tree/main/.github/workflows and https://trac.sagemath.org/ticket/33791 cygwin.yml --- .github/workflows/ci-linux.yml | 1 + .github/workflows/docker.yml | 66 ++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index c8f60831ac7..16e6b013495 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -40,6 +40,7 @@ jobs: targets_pre: all-sage-local targets: build doc-html targets_optional: ptest + docker_push_repository: ghcr.io/${{ github.repository }}/ local-ubuntu: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5535f9b9531..1ec1e5fa0d1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -69,6 +69,30 @@ on: max_parallel: type: string default: 20 + # + # Publishing to GitHub Packages + # + docker_push_repository: + required: false + type: string + # + # For use in upstream CIs + # + upstream_artifact: + required: false + type: string + sage_repo: + required: false + type: string + sage_trac_git: + required: false + type: string + sage_trac_ticket: + required: false + type: string + sage_ref: + required: false + type: string jobs: linux: @@ -84,9 +108,12 @@ jobs: LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} DOCKER_TARGETS: with-system-packages configured with-targets-pre with-targets with-targets-optional steps: - - uses: actions/checkout@v2 + - name: Check out SageMath + uses: actions/checkout@v2 with: - fetch-depth: 500 + repository: ${{ inputs.sage_repo }} + ref: ${{ inputs.sage_ref }} + fetch-depth: 2000 - name: fetch tags run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: free disk space @@ -100,13 +127,38 @@ jobs: dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 50 sudo apt-get --fix-broken --yes remove $(dpkg-query -f '${Package}\n' -W | grep -E '^(ghc-|google-cloud-sdk|google-chrome|firefox|mysql-server|dotnet-sdk|hhvm|mono)') || echo "(error ignored)" df -h + - name: Check out git-trac-command + uses: actions/checkout@v2 + with: + repository: sagemath/git-trac-command + path: git-trac-command + if: inputs.sage_trac_git != '' + - name: Check out SageMath from trac.sagemath.org + shell: bash {0} + # Random sleep and retry to limit the load on trac.sagemath.org + run: | + git config --global user.email "ci-sage@example.com" + git config --global user.name "ci-sage workflow" + if [ ! -d .git ]; then git init; fi; git remote add trac ${{ inputs.sage_trac_git }} && x=1 && while [ $x -le 5 ]; do x=$(( $x + 1 )); sleep $(( $RANDOM % 60 + 1 )); if git-trac-command/git-trac fetch ${{ inputs.sage_trac_ticket }}; then git merge FETCH_HEAD || echo "(ignored)"; exit 0; fi; sleep 40; done; exit 1 + if: inputs.sage_trac_git != '' + + - name: Download upstream artifact + uses: actions/download-artifact@v2 + with: + path: upstream + name: ${{ inputs.upstream_artifact }} + if: inputs.upstream_artifact - name: Install test prerequisites run: | sudo DEBIAN_FRONTEND=noninteractive apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get install tox sudo apt-get clean df -h + - name: Update Sage packages from upstream artifact + run: | + (export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && sed -i.bak '/upstream/d' .dockerignore && echo "/:toolchain:/i ADD upstream upstream" | sed -i.bak -f - build/bin/write-dockerfile.sh && git diff) - name: Try to login to ghcr.io + if: inputs.docker_push_repository != '' # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable run: | TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}" @@ -114,7 +166,7 @@ jobs: TOKEN="${{ secrets.GITHUB_TOKEN }}" fi if echo "$TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin; then - echo "DOCKER_PUSH_REPOSITORY=ghcr.io/${{ github.repository }}/" >> $GITHUB_ENV + echo "DOCKER_PUSH_REPOSITORY=${{ inputs.docker_push_repository }}" >> $GITHUB_ENV echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV fi # From the docker documentation via .ci/update-env.sh: @@ -127,21 +179,21 @@ jobs: case "$GITHUB_REF_NAME" in +([0-9]).+([0-9])?(.+([0-9])) ) EXTRA_DOCKER_TAGS="latest dev $EXTRA_DOCKER_TAGS";; - +([0-9]).+([0-9])?(.+([0-9])).@(beta|rc)+([0-9]) ) + +([0-9]).+([0-9])?(.+([0-9]))?(.)@(a|alpha|b|beta|rc)+([0-9]) ) EXTRA_DOCKER_TAGS="dev $EXTRA_DOCKER_TAGS";; esac echo "EXTRA_DOCKER_TAGS=$EXTRA_DOCKER_TAGS" >> $GITHUB_ENV - - name: Build and test + - name: Configure and build Sage distribution within a Docker container run: | set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;" - - name: Copy logs from the docker image or build container + - name: Copy logs from the Docker image or build container run: | mkdir -p "artifacts/$LOGS_ARTIFACT_NAME" cp -r .tox/$TOX_ENV/Dockerfile .tox/$TOX_ENV/log "artifacts/$LOGS_ARTIFACT_NAME" if [ -f .tox/$TOX_ENV/Dockertags ]; then CONTAINERS=$(docker create $(tail -1 .tox/$TOX_ENV/Dockertags) /bin/bash || true); fi if [ -n "$CONTAINERS" ]; then for CONTAINER in $CONTAINERS; do for ARTIFACT in /sage/logs; do docker cp $CONTAINER:$ARTIFACT artifacts/$LOGS_ARTIFACT_NAME && HAVE_LOG=1; done; if [ -n "$HAVE_LOG" ]; then break; fi; done; fi if: always() - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v2 with: path: artifacts name: ${{ env.LOGS_ARTIFACT_NAME }} From 0a617700847eff2c4f3afb99adf80541bc4cb100 Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Wed, 6 Jul 2022 13:16:09 +0800 Subject: [PATCH 208/416] Correct doc --- src/sage/schemes/affine/affine_morphism.py | 20 +++++++++---------- .../schemes/projective/projective_morphism.py | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 925bdff0f68..87e4507449c 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -688,8 +688,9 @@ def as_dynamical_system(self): return DynamicalSystem_affine_field(list(self), self.domain()) def global_height(self, prec=None): - r""" - Return the global height of the coefficients as a projective point. + """ + Take the height of the homogenization, and return the global height of + the coefficients as a projective point. INPUT: @@ -729,7 +730,7 @@ def global_height(self, prec=None): sage: A. = AffineSpace(QQ, 1) sage: B. = AffineSpace(QQ, 2) sage: H = Hom(A, B) - sage: f = H([1/3 * x^2 + 10, 7 * x^3]) + sage: f = H([1/3*x^2 + 10, 7*x^3]) sage: f.global_height() 3.40119738166216 """ @@ -755,7 +756,7 @@ def local_height(self, v, prec=None): sage: P. = AffineSpace(QQ, 2) sage: H = Hom(P, P) - sage: f = H([1/1331 * x^2 + 1/4000 * y^2, 210 * x * y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.local_height(1331) 7.19368581839511 @@ -763,7 +764,7 @@ def local_height(self, v, prec=None): sage: P. = AffineSpace(QQ, 3) sage: H = Hom(P, P) - sage: f = H([4 * x^2 + 3/100 * y^2, 8/210 * x * y, 1/10000 * z^2]); + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); sage: f.local_height(2) 2.77258872223978 @@ -773,7 +774,7 @@ def local_height(self, v, prec=None): sage: K. = NumberField(z^2 - 2) sage: P. = AffineSpace(K, 2) sage: H = Hom(P, P) - sage: f = H([2 * x^2 + w/3 * y^2, 1/w * y^2]) + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) sage: f.local_height(K.ideal(3)) 1.09861228866811 """ @@ -802,7 +803,7 @@ def local_height_arch(self, i, prec=None): sage: P. = AffineSpace(QQ, 2) sage: H = Hom(P, P) - sage: f = H([1/1331 * x^2 + 1/4000 * y^2, 210 * x * y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.local_height_arch(0) 5.34710753071747 @@ -812,7 +813,7 @@ def local_height_arch(self, i, prec=None): sage: K. = NumberField(z^2 - 2) sage: P. = AffineSpace(K, 2) sage: H = Hom(P, P) - sage: f = H([2 * x^2 + w/3 * y^2, 1/w * y^2]) + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) sage: f.local_height_arch(1) 0.6931471805599453094172321214582 """ @@ -822,8 +823,7 @@ def local_height_arch(self, i, prec=None): if K == QQ: return max([K(c).local_height_arch(prec=prec) for f in self for c in f.coefficients()]) - else: - return max([K(c).local_height_arch(i, prec=prec) for f in self for c in f.coefficients()]) + return max([K(c).local_height_arch(i, prec=prec) for f in self for c in f.coefficients()]) def jacobian(self): r""" diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 7e6f92ab114..04f9ed09c09 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1304,7 +1304,7 @@ def global_height(self, prec=None): sage: H = Hom(P,P) sage: f = H([1/1331*x^2+1/4000*y^2, 210*x*y]); sage: f.global_height() - 8.29404964010203 + 20.8348429892146 This function does not automatically normalize:: @@ -1312,7 +1312,7 @@ def global_height(self, prec=None): sage: H = Hom(P,P) sage: f = H([4*x^2+100*y^2, 210*x*y, 10000*z^2]); sage: f.global_height() - 9.21034037197618 + 8.51719319141624 sage: f.normalize_coordinates() sage: f.global_height() 8.51719319141624 @@ -1326,7 +1326,7 @@ def global_height(self, prec=None): sage: H = Hom(P,P) sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) sage: f.global_height() - 1.44518587894808 + 1.09861228866811 :: From 83f257a61102a5e3b6e8112577bada497513278a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Jul 2022 16:43:58 -0700 Subject: [PATCH 209/416] .github/workflows/tox-{optional,experimental}.yml: Remove gitpod (toxenv no longer exists) --- .github/workflows/tox-experimental.yml | 2 +- .github/workflows/tox-optional.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox-experimental.yml b/.github/workflows/tox-experimental.yml index 51084a446ad..848e4f6653a 100644 --- a/.github/workflows/tox-experimental.yml +++ b/.github/workflows/tox-experimental.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false max-parallel: 6 matrix: - tox_system_factor: [gitpod, ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] + tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] tox_packages_factor: [maximal] targets_pattern: [0-g, h-o, p, q-z] env: diff --git a/.github/workflows/tox-optional.yml b/.github/workflows/tox-optional.yml index 46785279581..17cb90a8984 100644 --- a/.github/workflows/tox-optional.yml +++ b/.github/workflows/tox-optional.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false max-parallel: 6 matrix: - tox_system_factor: [gitpod, ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] + tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] tox_packages_factor: [maximal] targets_pattern: [0-g, h-o, p, q-z] env: From 30f577bfaebf3a0b092e09fee76b26560358b906 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Jul 2022 18:13:14 -0700 Subject: [PATCH 210/416] tox.ini (manylinux-2_28): Set ACLOCAL_PATH --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index ba54e7a72c7..9847d9ee2d0 100644 --- a/tox.ini +++ b/tox.ini @@ -425,8 +425,8 @@ setenv = manylinux-2014: BASE_IMAGE=quay.io/pypa/manylinux2014 manylinux-2_24: SYSTEM=debian manylinux-2_24: BASE_IMAGE=quay.io/pypa/manylinux_2_24 - manylinux-2_24: BOOTSTRAP=ACLOCAL_PATH=/usr/share/aclocal ./bootstrap manylinux-2_28: BASE_IMAGE=quay.io/pypa/manylinux_2_28 + manylinux-{2_24,2_28}: BOOTSTRAP=ACLOCAL_PATH=/usr/share/aclocal ./bootstrap manylinux: ARCH_IMAGE_PREFIX= manylinux: ARCH_IMAGE_SUFFIX=_x86_64 manylinux-i686: ARCH_IMAGE_SUFFIX=_i686 From 95c172d1335b91249f79141422f8a8740589031a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Jul 2022 18:13:40 -0700 Subject: [PATCH 211/416] tox.ini (opensuse): Update comment --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 9847d9ee2d0..f5ee211eb59 100644 --- a/tox.ini +++ b/tox.ini @@ -335,8 +335,7 @@ setenv = # # https://hub.docker.com/r/opensuse/leap # - OpenSUSE Leap 42 was superseded by the Leap 15 series. - # - As of 2022-02, latest = 15 = 15.3 - # - OpenSUSE Leap 15.4 planned to be released 2022-06 + # - As of 2022-07, latest = 15 = 15.4 # https://hub.docker.com/r/opensuse/tumbleweed # - Rolling distribution # From 71948ba773a84b465691e99a73abb24513c09dcf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Jul 2022 20:11:05 -0700 Subject: [PATCH 212/416] .github/workflows/docker.yml: Add opensuse-15.4, centos-stream-9 --- .github/workflows/docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1ec1e5fa0d1..0a68539c4f4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -49,10 +49,12 @@ on: "fedora-37", "centos-7-devtoolset-gcc_11", "centos-stream-8", + "centos-stream-9", "gentoo-python3.9", "gentoo-python3.10", "archlinux-latest", "opensuse-15.3", + "opensuse-15.4", "opensuse-tumbleweed", "conda-forge", "ubuntu-bionic-i386", From 5b5c76e7ddd2f581187fed4ee022bdc45f6ced03 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Jul 2022 20:13:43 -0700 Subject: [PATCH 213/416] .github/workflows/ci-linux.yml: Change name to CI Linux --- .github/workflows/ci-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 16e6b013495..b405d335ab5 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -1,4 +1,4 @@ -name: Run SAGE_ROOT/tox.ini +name: CI Linux ## This GitHub Actions workflow runs SAGE_ROOT/tox.ini with select environments, ## whenever a GitHub pull request is opened or synchronized in a repository From 70042b344f706b4df710f8a35649dfd37ce6cd40 Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Wed, 6 Jul 2022 22:19:07 -0600 Subject: [PATCH 214/416] trac 34122 fix is_planar bug --- src/sage/graphs/generic_graph.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 5faec37f769..ae1b03cf753 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -5124,6 +5124,13 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se ....: assert (hasattr(G, '_embedding') and G._embedding is not None) == set_embedding, (set_embedding, set_pos) ....: assert (hasattr(G, '_pos') and G._pos is not None) == set_pos, (set_embedding, set_pos) + :trac:`34122`:: + + sage: G = DiGraph([[1, 2], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], + ....: [3, 4], [3, 5], [4, 5], [5, 1]]) + sage: G.is_planar() + True + Corner cases:: sage: graphs.EmptyGraph().is_planar() @@ -5133,7 +5140,8 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se """ # Quick check first if (on_embedding is None and not kuratowski and not set_embedding and not set_pos - and not self.allows_loops() and not self.allows_multiple_edges()): + and not self.allows_loops() and not self.allows_multiple_edges() + and not self.is_directed()): if self.order() > 4 and self.size() > 3 * self.order() - 6: return False @@ -5151,7 +5159,7 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se G = self.to_undirected() if hasattr(G, '_immutable'): G = copy(G) - planar = is_planar(G,kuratowski=kuratowski, set_pos=set_pos, set_embedding=set_embedding) + planar = is_planar(G, kuratowski=kuratowski, set_pos=set_pos, set_embedding=set_embedding) if kuratowski: bool_result = planar[0] else: From c2233687203fbc9d9b9261f1bdcd3a4996e1eaee Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Jul 2022 21:33:44 -0700 Subject: [PATCH 215/416] src/doc/en/developer/trac.rst: Fix markup --- src/doc/en/developer/trac.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/doc/en/developer/trac.rst b/src/doc/en/developer/trac.rst index 6b8d1b2d871..eb858a2e75a 100644 --- a/src/doc/en/developer/trac.rst +++ b/src/doc/en/developer/trac.rst @@ -288,9 +288,8 @@ After pushing a branch to a ticket, the ticket will show badges linking to results of automated tests that run on the patchbot and other ​tests that run on GitHub Actions. -* The Patch buildbot will automatically test your ticket. See `the - patchbot wiki `_ for more - information about its features and limitations. Make sure that you +* The Patch buildbot will automatically test your ticket. See :trac:`wiki/patchbot` + for more information about its features and limitations. Make sure that you look at the log, especially if the patch buildbot did not give you the green blob. From 960a74ed08f2d55cae3376cbefdd060d41efe9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 7 Jul 2022 14:39:18 +0200 Subject: [PATCH 216/416] a little bit of doc polishing in combinat --- src/sage/combinat/alternating_sign_matrix.py | 2 +- .../cluster_algebra_quiver/cluster_seed.py | 20 +++--- src/sage/combinat/core.py | 10 ++- src/sage/combinat/debruijn_sequence.pyx | 10 +-- src/sage/combinat/gelfand_tsetlin_patterns.py | 2 +- src/sage/combinat/growth.py | 4 +- src/sage/combinat/integer_lists/invlex.pyx | 2 +- src/sage/combinat/matrices/hadamard_matrix.py | 34 +++++------ .../combinat/ncsf_qsym/generic_basis_code.py | 16 ++--- src/sage/combinat/ncsf_qsym/ncsf.py | 22 +++---- src/sage/combinat/ncsf_qsym/qsym.py | 8 +-- src/sage/combinat/ncsf_qsym/tutorial.py | 2 +- src/sage/combinat/partition.py | 18 +++--- src/sage/combinat/posets/lattices.py | 8 +-- src/sage/combinat/sf/sfa.py | 2 +- src/sage/combinat/skew_partition.py | 17 +++--- src/sage/combinat/skew_tableau.py | 61 +++++++++---------- src/sage/combinat/tableau.py | 20 +++--- src/sage/combinat/tableau_tuple.py | 15 ++--- src/sage/combinat/words/finite_word.py | 2 +- src/sage/combinat/words/suffix_trees.py | 2 +- 21 files changed, 136 insertions(+), 141 deletions(-) diff --git a/src/sage/combinat/alternating_sign_matrix.py b/src/sage/combinat/alternating_sign_matrix.py index 146ff0cdfce..c7c7317811c 100644 --- a/src/sage/combinat/alternating_sign_matrix.py +++ b/src/sage/combinat/alternating_sign_matrix.py @@ -313,7 +313,7 @@ def inversion_number(self): sage: asm = A([[0, 1, 0],[1, -1, 1],[0, 1, 0]]) sage: asm.inversion_number() 2 - sage: P=Permutations(5) + sage: P = Permutations(5) sage: all(p.number_of_inversions()==AlternatingSignMatrix(p.to_matrix()).inversion_number() for p in P) True """ diff --git a/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py b/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py index a1efaf152b0..9149424964c 100644 --- a/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py +++ b/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py @@ -2387,7 +2387,7 @@ def mutate(self, sequence, inplace=True, input_type=None): sage: S.cluster() [(b + 1)/a, (a*c*d + b + 1)/(a*b), c, (a*c*d + b^2 + 2*b + 1)/(a*b*d)] - sage: S=ClusterSeed(DiGraph([[5, 'b']])) + sage: S = ClusterSeed(DiGraph([[5, 'b']])) sage: S.mutate(5) sage: S.cluster() [(b + 1)/x5, b] @@ -2398,7 +2398,7 @@ def mutate(self, sequence, inplace=True, input_type=None): sage: S.cluster() [(b + 1)/x5, b] - sage: S=ClusterSeed(DiGraph([[1, 2]])) + sage: S = ClusterSeed(DiGraph([[1, 2]])) sage: S.cluster() [x1, x2] sage: S.mutate(1) @@ -4351,27 +4351,27 @@ def get_upper_cluster_algebra_element(self,a): EXAMPLES:: - sage: B=matrix([[0,3,-3],[-3,0,3],[3,-3,0],[1,0,0],[0,1,0],[0,0,1]]) - sage: C=ClusterSeed(B) + sage: B = matrix([[0,3,-3],[-3,0,3],[3,-3,0],[1,0,0],[0,1,0],[0,0,1]]) + sage: C = ClusterSeed(B) sage: C.get_upper_cluster_algebra_element([1,1,0]) (x0^3*x2^3*x3*x4 + x2^6*x3 + x1^3*x2^3)/(x0*x1) sage: C.get_upper_cluster_algebra_element([1,1,1]) x0^2*x1^2*x2^2*x3*x4*x5 + x0^2*x1^2*x2^2 - sage: B=matrix([[0,3,0],[-3,0,3],[0,-3,0]]) - sage: C=ClusterSeed(B) + sage: B = matrix([[0,3,0],[-3,0,3],[0,-3,0]]) + sage: C = ClusterSeed(B) sage: C.get_upper_cluster_algebra_element([1,1,0]) (x1^3*x2^3 + x0^3 + x2^3)/(x0*x1) sage: C.get_upper_cluster_algebra_element([1,1,1]) (x0^3*x1^3 + x1^3*x2^3 + x0^3 + x2^3)/(x0*x1*x2) - sage: B=matrix([[0,2],[-3,0],[4,-5]]) - sage: C=ClusterSeed(B) + sage: B = matrix([[0,2],[-3,0],[4,-5]]) + sage: C = ClusterSeed(B) sage: C.get_upper_cluster_algebra_element([1,1]) (x2^9 + x1^3*x2^5 + x0^2*x2^4)/(x0*x1) - sage: B=matrix([[0,3,-5],[-3,0,4],[5,-4,0]]) - sage: C=ClusterSeed(B) + sage: B = matrix([[0,3,-5],[-3,0,4],[5,-4,0]]) + sage: C = ClusterSeed(B) sage: C.get_upper_cluster_algebra_element([1,1,1]) x0^4*x1^2*x2^3 + x0^2*x1^3*x2^4 """ diff --git a/src/sage/combinat/core.py b/src/sage/combinat/core.py index 3e699ee4295..362c169a913 100644 --- a/src/sage/combinat/core.py +++ b/src/sage/combinat/core.py @@ -316,20 +316,18 @@ def affine_symmetric_group_simple_action(self, i): sage: c = Core([4,2],3) sage: W = c.to_grassmannian().parent() - sage: i=0 + sage: i = 0 sage: c.affine_symmetric_group_simple_action(i).to_grassmannian() == W.simple_reflection(i)*c.to_grassmannian() True - sage: i=1 + sage: i = 1 sage: c.affine_symmetric_group_simple_action(i).to_grassmannian() == W.simple_reflection(i)*c.to_grassmannian() True """ mu = self.to_partition() - corners = mu.outside_corners() - corners = [p for p in corners + corners = [p for p in mu.outside_corners() if mu.content(p[0], p[1]) % self.k() == i] if not corners: - corners = mu.corners() - corners = [p for p in corners + corners = [p for p in mu.corners() if mu.content(p[0], p[1]) % self.k() == i] if not corners: return self diff --git a/src/sage/combinat/debruijn_sequence.pyx b/src/sage/combinat/debruijn_sequence.pyx index 6b96c2f6a8b..d98a3e66c87 100644 --- a/src/sage/combinat/debruijn_sequence.pyx +++ b/src/sage/combinat/debruijn_sequence.pyx @@ -242,18 +242,14 @@ class DeBruijnSequences(UniqueRepresentation, Parent): sage: DeBruijnSequences(1, 3).an_element() [0] - Setting ``n`` to 1 will return the alphabet: - - :: + Setting ``n`` to 1 will return the alphabet:: sage: DeBruijnSequences(3, 1).an_element() [0, 1, 2] - The test suite: - - :: + The test suite:: - sage: d=DeBruijnSequences(2, 3) + sage: d = DeBruijnSequences(2, 3) sage: TestSuite(d).run() """ def __init__(self, k, n): diff --git a/src/sage/combinat/gelfand_tsetlin_patterns.py b/src/sage/combinat/gelfand_tsetlin_patterns.py index 08615c0eae7..b50ae00fa8e 100644 --- a/src/sage/combinat/gelfand_tsetlin_patterns.py +++ b/src/sage/combinat/gelfand_tsetlin_patterns.py @@ -1032,7 +1032,7 @@ def _toggle_markov_chain(self, chain_state, row, col, direction): TESTS: - sage: G=GelfandTsetlinPatterns(3,4) + sage: G = GelfandTsetlinPatterns(3,4) sage: state = [[3,2,1],[3,1],[2]] sage: G._toggle_markov_chain(state, 0, 0, 1) sage: state diff --git a/src/sage/combinat/growth.py b/src/sage/combinat/growth.py index 6d584f6dea6..91f76b6e845 100644 --- a/src/sage/combinat/growth.py +++ b/src/sage/combinat/growth.py @@ -3735,11 +3735,11 @@ class RuleRSK(RulePartitions): sage: [G.P_symbol(), G.Q_symbol()] == RSK(m.transpose()) True - sage: n=5; l=[(pi, RuleRSK(pi)) for pi in Permutations(n)] + sage: n = 5; l = [(pi, RuleRSK(pi)) for pi in Permutations(n)] sage: all([G.P_symbol(), G.Q_symbol()] == RSK(pi) for pi, G in l) True - sage: n=5; l=[(w, RuleRSK(w)) for w in Words([1,2,3], 5)] + sage: n = 5; l = [(w, RuleRSK(w)) for w in Words([1,2,3], 5)] sage: all([G.P_symbol(), G.Q_symbol()] == RSK(pi) for pi, G in l) True """ diff --git a/src/sage/combinat/integer_lists/invlex.pyx b/src/sage/combinat/integer_lists/invlex.pyx index 93ee9e6422c..2f12ada7438 100644 --- a/src/sage/combinat/integer_lists/invlex.pyx +++ b/src/sage/combinat/integer_lists/invlex.pyx @@ -670,7 +670,7 @@ class IntegerListsLex(IntegerLists, metaclass=ClasscallMetaclass): [[3], [2, 1], [1, 2]] sage: [1,1,1] in I False - sage: I=IntegerListsLex(10, ceiling=[4], max_length=1, min_part=1) + sage: I = IntegerListsLex(10, ceiling=[4], max_length=1, min_part=1) sage: I.list() [] sage: [4,6] in I diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index ea2d5160622..2716dbfe669 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -116,12 +116,12 @@ def hadamard_matrix_paleyI(n, normalize=True): Otherwise, it returns a skew Hadamard matrix `H`, i.e. `H=S+I`, with `S=-S^\top` :: - sage: M=hadamard_matrix_paleyI(4, normalize=False); M + sage: M = hadamard_matrix_paleyI(4, normalize=False); M [ 1 1 1 1] [-1 1 1 -1] [-1 -1 1 1] [-1 1 -1 1] - sage: S=M-identity_matrix(4); -S==S.T + sage: S = M - identity_matrix(4); -S == S.T True TESTS:: @@ -247,7 +247,7 @@ def is_hadamard_matrix(M, normalized=False, skew=False, verbose=False): sage: is_hadamard_matrix(h) True sage: from sage.combinat.matrices.hadamard_matrix import skew_hadamard_matrix - sage: h=skew_hadamard_matrix(12) + sage: h = skew_hadamard_matrix(12) sage: is_hadamard_matrix(h, skew=True) True sage: h = matrix.hadamard(12) @@ -270,12 +270,12 @@ def is_hadamard_matrix(M, normalized=False, skew=False, verbose=False): sage: is_hadamard_matrix(h, skew=True, verbose=True) The matrix is not skew False - sage: h=skew_hadamard_matrix(12) + sage: h = skew_hadamard_matrix(12) sage: is_hadamard_matrix(h, skew=True, verbose=True) True sage: is_hadamard_matrix(h, skew=False, verbose=True) True - sage: h=-h + sage: h = -h sage: is_hadamard_matrix(h, skew=True, verbose=True) The matrix is not skew - diagonal entries must be all 1 False @@ -899,24 +899,24 @@ def williamson_goethals_seidel_skew_hadamard_matrix(a, b, c, d, check=True): EXAMPLES:: sage: from sage.combinat.matrices.hadamard_matrix import williamson_goethals_seidel_skew_hadamard_matrix as WGS - sage: a=[ 1, 1, 1, -1, 1, -1, 1, -1, -1] - sage: b=[ 1, -1, 1, 1, -1, -1, 1, 1, -1] - sage: c=[-1, -1]+[1]*6+[-1] - sage: d=[ 1, 1, 1, -1, 1, 1, -1, 1, 1] - sage: M=WGS(a,b,c,d,check=True) + sage: a = [ 1, 1, 1, -1, 1, -1, 1, -1, -1] + sage: b = [ 1, -1, 1, 1, -1, -1, 1, 1, -1] + sage: c = [-1, -1]+[1]*6+[-1] + sage: d = [ 1, 1, 1, -1, 1, 1, -1, 1, 1] + sage: M = WGS(a,b,c,d,check=True) REFERENCES: .. [GS70s] \J.M. Goethals and J. J. Seidel, - A skew Hadamard matrix of order 36, + *A skew Hadamard matrix of order 36*, J. Aust. Math. Soc. 11(1970), 343-344 .. [Wall71] \J. Wallis, - A skew-Hadamard matrix of order 92, + *A skew-Hadamard matrix of order 92*, Bull. Aust. Math. Soc. 5(1971), 203-204 .. [KoSt08] \C. Koukouvinos, S. Stylianou - On skew-Hadamard matrices, + *On skew-Hadamard matrices*, Discrete Math. 308(2008) 2723-2731 """ n = len(a) @@ -1173,7 +1173,7 @@ def symmetric_conference_matrix(n, check=True): EXAMPLES:: sage: from sage.combinat.matrices.hadamard_matrix import symmetric_conference_matrix - sage: C=symmetric_conference_matrix(10); C + sage: C = symmetric_conference_matrix(10); C [ 0 1 1 1 1 1 1 1 1 1] [ 1 0 -1 -1 1 -1 1 1 1 -1] [ 1 -1 0 -1 1 1 -1 -1 1 1] @@ -1184,7 +1184,7 @@ def symmetric_conference_matrix(n, check=True): [ 1 1 -1 1 1 1 -1 0 -1 -1] [ 1 1 1 -1 -1 1 1 -1 0 -1] [ 1 -1 1 1 1 -1 1 -1 -1 0] - sage: C^2==9*identity_matrix(10) and C==C.T + sage: C^2 == 9*identity_matrix(10) and C == C.T True """ from sage.graphs.strongly_regular_db import strongly_regular_graph as srg @@ -1301,7 +1301,7 @@ def rshcd_from_prime_power_and_conference_matrix(n): sage: from sage.combinat.matrices.hadamard_matrix import is_hadamard_matrix sage: H = rshcd_from_prime_power_and_conference_matrix(7); H 36 x 36 dense matrix over Integer Ring (use the '.str()' method to see the entries) - sage: H==H.T and is_hadamard_matrix(H) and H.diagonal()==[1]*36 and list(sum(H))==[6]*36 + sage: H == H.T and is_hadamard_matrix(H) and H.diagonal() == [1]*36 and list(sum(H)) == [6]*36 True Bigger examples, only provided by this construction :: @@ -1309,7 +1309,7 @@ def rshcd_from_prime_power_and_conference_matrix(n): sage: H = rshcd_from_prime_power_and_conference_matrix(27) # long time sage: H == H.T and is_hadamard_matrix(H) # long time True - sage: H.diagonal()==[1]*676 and list(sum(H))==[26]*676 # long time + sage: H.diagonal() == [1]*676 and list(sum(H)) == [26]*676 # long time True In this example the conference matrix is not Paley, as 45 is not a prime power :: diff --git a/src/sage/combinat/ncsf_qsym/generic_basis_code.py b/src/sage/combinat/ncsf_qsym/generic_basis_code.py index 3457b4cdd03..6f153c232bf 100644 --- a/src/sage/combinat/ncsf_qsym/generic_basis_code.py +++ b/src/sage/combinat/ncsf_qsym/generic_basis_code.py @@ -136,7 +136,7 @@ def one_basis(self): EXAMPLES:: - sage: L=NonCommutativeSymmetricFunctions(QQ).L() + sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: parent(L) sage: parent(L).one_basis() @@ -161,10 +161,10 @@ def sum_of_finer_compositions(self, composition): EXAMPLES:: - sage: L=NonCommutativeSymmetricFunctions(QQ).L() + sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: L.sum_of_finer_compositions(Composition([2,1])) L[1, 1, 1] + L[2, 1] - sage: R=NonCommutativeSymmetricFunctions(QQ).R() + sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: R.sum_of_finer_compositions(Composition([1,3])) R[1, 1, 1, 1] + R[1, 1, 2] + R[1, 2, 1] + R[1, 3] """ @@ -186,10 +186,10 @@ def sum_of_fatter_compositions(self, composition): EXAMPLES:: - sage: L=NonCommutativeSymmetricFunctions(QQ).L() + sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: L.sum_of_fatter_compositions(Composition([2,1])) L[2, 1] + L[3] - sage: R=NonCommutativeSymmetricFunctions(QQ).R() + sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: R.sum_of_fatter_compositions(Composition([1,3])) R[1, 3] + R[4] """ @@ -216,7 +216,7 @@ def alternating_sum_of_compositions(self, n): EXAMPLES:: - sage: L=NonCommutativeSymmetricFunctions(QQ).L() + sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: L.alternating_sum_of_compositions(0) L[] sage: L.alternating_sum_of_compositions(1) @@ -225,7 +225,7 @@ def alternating_sum_of_compositions(self, n): L[1, 1] - L[2] sage: L.alternating_sum_of_compositions(3) L[1, 1, 1] - L[1, 2] - L[2, 1] + L[3] - sage: S=NonCommutativeSymmetricFunctions(QQ).S() + sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.alternating_sum_of_compositions(3) S[1, 1, 1] - S[1, 2] - S[2, 1] + S[3] """ @@ -1424,7 +1424,7 @@ def internal_product_by_coercion(self, left, right): EXAMPLES:: - sage: S=NonCommutativeSymmetricFunctions(QQ).S() + sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.internal_product_by_coercion(S[2,1], S[3]) S[2, 1] sage: S.internal_product_by_coercion(S[2,1], S[4]) diff --git a/src/sage/combinat/ncsf_qsym/ncsf.py b/src/sage/combinat/ncsf_qsym/ncsf.py index a746239b155..7a53a902b94 100644 --- a/src/sage/combinat/ncsf_qsym/ncsf.py +++ b/src/sage/combinat/ncsf_qsym/ncsf.py @@ -1644,7 +1644,7 @@ def to_symmetric_group_algebra(self): EXAMPLES:: - sage: R=NonCommutativeSymmetricFunctions(QQ).R() + sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: R[2,1].to_symmetric_group_algebra() [1, 3, 2] + [2, 3, 1] sage: R([]).to_symmetric_group_algebra() @@ -2224,7 +2224,7 @@ def antipode(self): EXAMPLES:: - sage: S=NonCommutativeSymmetricFunctions(QQ).S() + sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.antipode Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis """ @@ -2245,7 +2245,7 @@ def coproduct(self): EXAMPLES:: - sage: S=NonCommutativeSymmetricFunctions(QQ).S() + sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.coproduct Generic morphism: From: Non-Commutative Symmetric Functions over the Rational Field in the Complete basis @@ -2585,7 +2585,7 @@ def dual(self): EXAMPLES:: - sage: R=NonCommutativeSymmetricFunctions(QQ).ribbon() + sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() sage: R.dual() Quasisymmetric functions over the Rational Field in the Fundamental basis """ @@ -2683,7 +2683,7 @@ def to_symmetric_function_on_basis(self, I): EXAMPLES:: - sage: R=NonCommutativeSymmetricFunctions(QQ).R() + sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: R.to_symmetric_function_on_basis(Composition([3,1,1])) s[3, 1, 1] sage: R.to_symmetric_function_on_basis(Composition([4,2,1])) @@ -3039,7 +3039,7 @@ def to_symmetric_function_on_basis(self, I): EXAMPLES:: - sage: S=NonCommutativeSymmetricFunctions(QQ).complete() + sage: S = NonCommutativeSymmetricFunctions(QQ).complete() sage: S.to_symmetric_function_on_basis([2,1,3]) h[3, 2, 1] sage: S.to_symmetric_function_on_basis([]) @@ -3097,7 +3097,7 @@ def _to_symmetric_group_algebra_on_basis(self, I): EXAMPLES:: - sage: S=NonCommutativeSymmetricFunctions(QQ).S() + sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S._to_symmetric_group_algebra_on_basis(Composition([1,2])) [1, 2, 3] + [2, 1, 3] + [3, 1, 2] sage: S._to_symmetric_group_algebra_on_basis(Composition([])) @@ -4710,7 +4710,7 @@ def _H(self, alpha): EXAMPLES:: - sage: I=NonCommutativeSymmetricFunctions(QQ).I() + sage: I = NonCommutativeSymmetricFunctions(QQ).I() sage: I._H([2,0,1]) S[2, 1] sage: I._H([2,0,1,-1]) @@ -4741,7 +4741,7 @@ def _to_complete_on_basis(self, alpha): EXAMPLES:: - sage: I=NonCommutativeSymmetricFunctions(QQ).I() + sage: I = NonCommutativeSymmetricFunctions(QQ).I() sage: I._to_complete_on_basis(Composition([])) S[] sage: I._to_complete_on_basis(Composition([2,1,3])) @@ -4775,7 +4775,7 @@ def _from_complete_on_basis(self, comp_content): EXAMPLES:: - sage: I=NonCommutativeSymmetricFunctions(QQ).I() + sage: I = NonCommutativeSymmetricFunctions(QQ).I() sage: I._from_complete_on_basis(Composition([])) I[] sage: I._from_complete_on_basis(Composition([2,1,3])) @@ -4800,7 +4800,7 @@ def dual(self): EXAMPLES:: - sage: I=NonCommutativeSymmetricFunctions(QQ).Immaculate() + sage: I = NonCommutativeSymmetricFunctions(QQ).Immaculate() sage: I.dual() Quasisymmetric functions over the Rational Field in the dualImmaculate basis diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index dc9c7dcbc63..d68530cf431 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -1581,7 +1581,7 @@ def expand(self, n, alphabet='x'): EXAMPLES:: - sage: F=QuasiSymmetricFunctions(QQ).Fundamental() + sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: F[3].expand(3) x0^3 + x0^2*x1 + x0*x1^2 + x1^3 + x0^2*x2 + x0*x1*x2 + x1^2*x2 + x0*x2^2 + x1*x2^2 + x2^3 sage: F[2,1].expand(3) @@ -1590,7 +1590,7 @@ def expand(self, n, alphabet='x'): One can use a different set of variable by adding an optional argument ``alphabet=...`` :: - sage: F=QuasiSymmetricFunctions(QQ).Fundamental() + sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: F[3].expand(2,alphabet='y') y0^3 + y0^2*y1 + y0*y1^2 + y1^3 @@ -1798,7 +1798,7 @@ def coproduct_on_basis(self, compo): EXAMPLES:: - sage: M=QuasiSymmetricFunctions(QQ).Monomial() + sage: M = QuasiSymmetricFunctions(QQ).Monomial() sage: M[4,2,3].coproduct() M[] # M[4, 2, 3] + M[4] # M[2, 3] + M[4, 2] # M[3] + M[4, 2, 3] # M[] sage: M.coproduct_on_basis(Composition([])) @@ -2022,7 +2022,7 @@ def expand(self, n, alphabet='x'): One can use a different set of variables by using the optional argument ``alphabet``:: - sage: M=QuasiSymmetricFunctions(QQ).Monomial() + sage: M = QuasiSymmetricFunctions(QQ).Monomial() sage: M[2,1,1].expand(4,alphabet='y') y0^2*y1*y2 + y0^2*y1*y3 + y0^2*y2*y3 + y1^2*y2*y3 diff --git a/src/sage/combinat/ncsf_qsym/tutorial.py b/src/sage/combinat/ncsf_qsym/tutorial.py index 6236a3ba2af..5efc8d43728 100644 --- a/src/sage/combinat/ncsf_qsym/tutorial.py +++ b/src/sage/combinat/ncsf_qsym/tutorial.py @@ -99,7 +99,7 @@ The usual methods on free modules are available such as coefficients, degrees, and the support:: - sage: z=3*M[1,2]+M[3]^2; z + sage: z = 3*M[1,2]+M[3]^2; z 3*M[1, 2] + 2*M[3, 3] + M[6] sage: z.coefficient([1,2]) diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 769d38b13ed..3ac4e06ee4f 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -4578,21 +4578,21 @@ def from_kbounded_to_reduced_word(self, k): EXAMPLES:: - sage: p=Partition([2,1,1]) + sage: p = Partition([2,1,1]) sage: p.from_kbounded_to_reduced_word(2) [2, 1, 2, 0] - sage: p=Partition([3,1]) + sage: p = Partition([3,1]) sage: p.from_kbounded_to_reduced_word(3) [3, 2, 1, 0] sage: p.from_kbounded_to_reduced_word(2) Traceback (most recent call last): ... ValueError: the partition must be 2-bounded - sage: p=Partition([]) + sage: p = Partition([]) sage: p.from_kbounded_to_reduced_word(2) [] """ - p=self.k_skew(k)[0] + p = self.k_skew(k)[0] result = [] while not p.is_empty(): corners = p.corners() @@ -4613,18 +4613,18 @@ def from_kbounded_to_grassmannian(self, k): EXAMPLES:: - sage: p=Partition([2,1,1]) + sage: p = Partition([2,1,1]) sage: p.from_kbounded_to_grassmannian(2) [-1 1 1] [-2 2 1] [-2 1 2] - sage: p=Partition([]) + sage: p = Partition([]) sage: p.from_kbounded_to_grassmannian(2) [1 0 0] [0 1 0] [0 0 1] """ - return WeylGroup(['A',k,1]).from_reduced_word(self.from_kbounded_to_reduced_word(k)) + return WeylGroup(['A', k,1 ]).from_reduced_word(self.from_kbounded_to_reduced_word(k)) def to_list(self): r""" @@ -5049,7 +5049,7 @@ def dimension(self, smaller=None, k=1): A check coming from the theory of `k`-differentiable posets:: - sage: k=2; core = Partition([2,1]) + sage: k = 2; core = Partition([2,1]) sage: all(sum(mu.dimension(core,k=2)^2 ....: for mu in Partitions(3+i*2) if mu.core(2) == core) ....: == 2^i*factorial(i) for i in range(10)) @@ -5170,7 +5170,7 @@ def outline(self, variable=None): sage: Partition([1]).outline() abs(x + 1) + abs(x - 1) - abs(x) - sage: y=sage.symbolic.ring.var("y") + sage: y = SR.var("y") sage: Partition([6,5,1]).outline(variable=y) abs(y + 6) - abs(y + 5) + abs(y + 4) - abs(y + 3) + abs(y - 1) - abs(y - 2) + abs(y - 3) diff --git a/src/sage/combinat/posets/lattices.py b/src/sage/combinat/posets/lattices.py index 67f92ba7bfc..952111c2de2 100644 --- a/src/sage/combinat/posets/lattices.py +++ b/src/sage/combinat/posets/lattices.py @@ -2022,7 +2022,7 @@ def complements(self, element=None): EXAMPLES:: - sage: L=LatticePoset({0:['a','b','c'], 'a':[1], 'b':[1], 'c':[1]}) + sage: L = LatticePoset({0:['a','b','c'],'a':[1],'b':[1],'c':[1]}) sage: C = L.complements() Let us check that 'a' and 'b' are complements of each other:: @@ -2037,7 +2037,7 @@ def complements(self, element=None): sage: L.complements() # random order {0: [1], 1: [0], 'a': ['b', 'c'], 'b': ['c', 'a'], 'c': ['b', 'a']} - sage: L=LatticePoset({0:[1,2],1:[3],2:[3],3:[4]}) + sage: L = LatticePoset({0:[1,2],1:[3],2:[3],3:[4]}) sage: L.complements() # random order {0: [4], 4: [0]} sage: L.complements(1) @@ -2047,7 +2047,7 @@ def complements(self, element=None): TESTS:: - sage: L=LatticePoset({0:['a','b','c'], 'a':[1], 'b':[1], 'c':[1]}) + sage: L = LatticePoset({0:['a','b','c'], 'a':[1], 'b':[1], 'c':[1]}) sage: for v,v_complements in L.complements().items(): ....: for v_c in v_complements: ....: assert L.meet(v,v_c) == L.bottom() @@ -3163,7 +3163,7 @@ def sublattice(self, elms): EXAMPLES:: - sage: L=LatticePoset(( [], [[1,2],[1,17],[1,8],[2,3],[2,22],[2,5],[2,7],[17,22],[17,13],[8,7],[8,13],[3,16],[3,9],[22,16],[22,18],[22,10],[5,18],[5,14],[7,9],[7,14],[7,10],[13,10],[16,6],[16,19],[9,19],[18,6],[18,33],[14,33],[10,19],[10,33],[6,4],[19,4],[33,4]] )) + sage: L = LatticePoset(([], [[1,2],[1,17],[1,8],[2,3],[2,22],[2,5],[2,7],[17,22],[17,13],[8,7],[8,13],[3,16],[3,9],[22,16],[22,18],[22,10],[5,18],[5,14],[7,9],[7,14],[7,10],[13,10],[16,6],[16,19],[9,19],[18,6],[18,33],[14,33],[10,19],[10,33],[6,4],[19,4],[33,4]])) sage: L.sublattice([14, 13, 22]).list() [1, 2, 8, 7, 14, 17, 13, 22, 10, 33] diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 6e4f2ebe044..03d50478b52 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -5447,7 +5447,7 @@ def skew_by(self, x): TESTS:: - sage: f=s[3,2] + sage: f = s[3,2] sage: f.skew_by([1]) Traceback (most recent call last): ... diff --git a/src/sage/combinat/skew_partition.py b/src/sage/combinat/skew_partition.py index 80c6871d235..eba4e0deecf 100644 --- a/src/sage/combinat/skew_partition.py +++ b/src/sage/combinat/skew_partition.py @@ -636,13 +636,14 @@ def is_overlap(self, n): def is_ribbon(self): r""" - Return ``True`` if and only if ``self`` is a ribbon, that is, - if it has exactly one cell in each of `q` consecutive - diagonals for some nonnegative integer `q`. + Return ``True`` if and only if ``self`` is a ribbon. + + This means that if it has exactly one cell in each of `q` + consecutive diagonals for some nonnegative integer `q`. EXAMPLES:: - sage: P=SkewPartition([[4,4,3,3],[3,2,2]]) + sage: P = SkewPartition([[4,4,3,3],[3,2,2]]) sage: P.pp() * ** @@ -651,7 +652,7 @@ def is_ribbon(self): sage: P.is_ribbon() True - sage: P=SkewPartition([[4,3,3],[1,1]]) + sage: P = SkewPartition([[4,3,3],[1,1]]) sage: P.pp() *** ** @@ -659,7 +660,7 @@ def is_ribbon(self): sage: P.is_ribbon() False - sage: P=SkewPartition([[4,4,3,2],[3,2,2]]) + sage: P = SkewPartition([[4,4,3,2],[3,2,2]]) sage: P.pp() * ** @@ -668,7 +669,7 @@ def is_ribbon(self): sage: P.is_ribbon() False - sage: P=SkewPartition([[4,4,3,3],[4,2,2,1]]) + sage: P = SkewPartition([[4,4,3,3],[4,2,2,1]]) sage: P.pp() ** @@ -677,7 +678,7 @@ def is_ribbon(self): sage: P.is_ribbon() True - sage: P=SkewPartition([[4,4,3,3],[4,2,2]]) + sage: P = SkewPartition([[4,4,3,3],[4,2,2]]) sage: P.pp() ** diff --git a/src/sage/combinat/skew_tableau.py b/src/sage/combinat/skew_tableau.py index 906b86f2930..532e3967ff0 100644 --- a/src/sage/combinat/skew_tableau.py +++ b/src/sage/combinat/skew_tableau.py @@ -1366,7 +1366,7 @@ def is_ribbon(self): EXAMPLES:: - sage: S=SkewTableau([[None, None, 1, 2],[None, None, 3],[1, 3, 4]]) + sage: S = SkewTableau([[None, None, 1, 2],[None, None, 3],[1, 3, 4]]) sage: S.pp() . . 1 2 . . 3 @@ -1374,7 +1374,7 @@ def is_ribbon(self): sage: S.is_ribbon() True - sage: S=SkewTableau([[None, 1, 1, 2],[None, 2, 3],[1, 3, 4]]) + sage: S = SkewTableau([[None, 1, 1, 2],[None, 2, 3],[1, 3, 4]]) sage: S.pp() . 1 1 2 . 2 3 @@ -1382,7 +1382,7 @@ def is_ribbon(self): sage: S.is_ribbon() False - sage: S=SkewTableau([[None, None, 1, 2],[None, None, 3],[1]]) + sage: S = SkewTableau([[None, None, 1, 2],[None, None, 3],[1]]) sage: S.pp() . . 1 2 . . 3 @@ -1390,7 +1390,7 @@ def is_ribbon(self): sage: S.is_ribbon() False - sage: S=SkewTableau([[None, None, None, None],[None, None, 3],[1, 2, 4]]) + sage: S = SkewTableau([[None, None, None, None],[None, None, 3],[1, 2, 4]]) sage: S.pp() . . . . . . 3 @@ -1398,7 +1398,7 @@ def is_ribbon(self): sage: S.is_ribbon() True - sage: S=SkewTableau([[None, None, None, None],[None, None, 3],[None, 2, 4]]) + sage: S = SkewTableau([[None, None, None, None],[None, None, 3],[None, 2, 4]]) sage: S.pp() . . . . . . 3 @@ -1406,13 +1406,12 @@ def is_ribbon(self): sage: S.is_ribbon() True - sage: S=SkewTableau([[None, None],[None]]) + sage: S = SkewTableau([[None, None],[None]]) sage: S.pp() . . . sage: S.is_ribbon() True - """ lam = list(self.outer_shape()) mu = list(self.inner_shape()) @@ -1422,31 +1421,31 @@ def is_ribbon(self): if l_out == 0: return True - else: - # Find the least u for which lam[u]>mu[u], if it exists. - # If it does not exist then u will equal l_out. - u = 0 - u_test = True - while u_test: - if u >= l_out or lam[u] > mu[u]: - u_test = False - else: - u += 1 - - # Find the least v strictly greater than u for which - # lam[v] != mu[v-1]+1 - v = u + 1 - v_test = True - while v_test: - if v >= l_out or lam[v] != mu[v - 1] + 1: - v_test = False - else: - v += 1 - # Check if lam[i]==mu[i] for all i >= v - for i in range(v, l_out): - if lam[i] != mu[i]: - return False + # Find the least u for which lam[u]>mu[u], if it exists. + # If it does not exist then u will equal l_out. + u = 0 + u_test = True + while u_test: + if u >= l_out or lam[u] > mu[u]: + u_test = False + else: + u += 1 + + # Find the least v strictly greater than u for which + # lam[v] != mu[v-1]+1 + v = u + 1 + v_test = True + while v_test: + if v >= l_out or lam[v] != mu[v - 1] + 1: + v_test = False + else: + v += 1 + + # Check if lam[i]==mu[i] for all i >= v + for i in range(v, l_out): + if lam[i] != mu[i]: + return False return True diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 834cfabe51d..4feabaacce0 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -220,7 +220,7 @@ def __init__(self, parent, t, check=True): sage: t = Tableaux()([[1,1],[1]]) sage: s = Tableaux(3)([[1,1],[1]]) - sage: s==t + sage: s == t True sage: t.parent() Tableaux @@ -1113,13 +1113,13 @@ def to_sign_matrix(self, max_entry=None): [ 0 0 0 1 0 0 0] [ 0 1 0 -1 1 0 0] [ 1 -1 1 0 -1 0 0] - sage: t=Tableau([(4,5,4,3),(2,1,3)]) + sage: t = Tableau([(4,5,4,3),(2,1,3)]) sage: t.to_sign_matrix(5) [ 0 0 1 0 0] [ 0 0 0 1 0] [ 1 0 -1 -1 1] [-1 1 0 1 -1] - sage: s=Tableau([(1,0,-2,4),(3,4,5)]) + sage: s = Tableau([(1,0,-2,4),(3,4,5)]) sage: s.to_sign_matrix(6) Traceback (most recent call last): ... @@ -1952,7 +1952,7 @@ def restrict(self, n): If possible the restricted tableau will belong to the same category as the original tableau:: - sage: S=StandardTableau([[1,2,4,7],[3,5],[6]]); S.category() + sage: S = StandardTableau([[1,2,4,7],[3,5],[6]]); S.category() Category of elements of Standard tableaux sage: S.restrict(4).category() Category of elements of Standard tableaux @@ -3938,15 +3938,15 @@ def first_row_descent(self): EXAMPLES:: - sage: t=Tableau([[1,3,2],[4]]); t.first_row_descent() + sage: t = Tableau([[1,3,2],[4]]); t.first_row_descent() (0, 1) sage: Tableau([[1,2,3],[4]]).first_row_descent() is None True """ for row in range(len(self)): for col in range(len(self[row])-1): - if self[row][col]>self[row][col+1]: - return (row,col) + if self[row][col] > self[row][col+1]: + return (row, col) return None def first_column_descent(self): @@ -4614,8 +4614,8 @@ def dominates(self, t): EXAMPLES:: - sage: s=StandardTableau([[1,2,3],[4,5]]) - sage: t=StandardTableau([[1,2],[3,5],[4]]) + sage: s = StandardTableau([[1,2,3],[4,5]]) + sage: t = StandardTableau([[1,2],[3,5],[4]]) sage: s.dominates(t) True sage: t.dominates(s) @@ -6112,7 +6112,7 @@ def __init__(self, max_entry=None): sage: T = sage.combinat.tableau.SemistandardTableaux_all() sage: TestSuite(T).run() - sage: T=sage.combinat.tableau.SemistandardTableaux_all(max_entry=3) + sage: T = sage.combinat.tableau.SemistandardTableaux_all(max_entry=3) sage: TestSuite(T).run() # long time """ if max_entry is not PlusInfinity(): diff --git a/src/sage/combinat/tableau_tuple.py b/src/sage/combinat/tableau_tuple.py index 4425dcb4f27..34565ecb642 100644 --- a/src/sage/combinat/tableau_tuple.py +++ b/src/sage/combinat/tableau_tuple.py @@ -363,7 +363,7 @@ def __classcall_private__(self, t): EXAMPLES:: - sage: t=TableauTuple([[[1,1],[1]],[[1,1,1]],[[1],[1],[1]],[[1]]]) + sage: t = TableauTuple([[[1,1],[1]],[[1,1,1]],[[1],[1],[1]],[[1]]]) sage: t.parent() Tableau tuples sage: t.category() @@ -526,7 +526,7 @@ def _latex_(self): EXAMPLES:: - sage: t=TableauTuple([ [[1,2],[3]], [], [[4,5],[6,7]] ]) + sage: t = TableauTuple([ [[1,2],[3]], [], [[4,5],[6,7]] ]) sage: latex(t) # indirect doctest \Bigg( {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2} @@ -1498,7 +1498,7 @@ def __classcall_private__(self, t): EXAMPLES:: - sage: t=RowStandardTableauTuple([[[3,4,6],[1]],[[2],[5]]]) + sage: t = RowStandardTableauTuple([[[3,4,6],[1]],[[2],[5]]]) sage: t.parent() Row standard tableau tuples sage: t.category() @@ -1769,8 +1769,8 @@ class StandardTableauTuple(RowStandardTableauTuple): is the size of the underlying partition tuple, such that the entries increase along rows and down columns in each component of the tuple. - sage: s=StandardTableauTuple([[1,2,3],[4,5]]) - sage: t=StandardTableauTuple([[1,2],[3,5],[4]]) + sage: s = StandardTableauTuple([[1,2,3],[4,5]]) + sage: t = StandardTableauTuple([[1,2],[3,5],[4]]) sage: s.dominates(t) True sage: t.dominates(s) @@ -1804,7 +1804,8 @@ class StandardTableauTuple(RowStandardTableauTuple): EXAMPLES:: - sage: t=TableauTuple([ [[1,3,4],[7,9]], [[2,8,11],[6]], [[5,10]] ]); t + sage: t = TableauTuple([ [[1,3,4],[7,9]], [[2,8,11],[6]], [[5,10]] ]) + sage: t ([[1, 3, 4], [7, 9]], [[2, 8, 11], [6]], [[5, 10]]) sage: t[0][0][0] 1 @@ -1884,7 +1885,7 @@ def __classcall_private__(self, t): EXAMPLES:: - sage: t=StandardTableauTuple([[[1,3,4],[6]],[[2],[5]]]) + sage: t = StandardTableauTuple([[[1,3,4],[6]],[[2],[5]]]) sage: t.parent() Standard tableau tuples sage: t.category() diff --git a/src/sage/combinat/words/finite_word.py b/src/sage/combinat/words/finite_word.py index 3f5de242bf4..cc290129080 100644 --- a/src/sage/combinat/words/finite_word.py +++ b/src/sage/combinat/words/finite_word.py @@ -2373,7 +2373,7 @@ def longest_common_suffix(self, other): With an infinite word:: - sage: t=words.ThueMorseWord('ab') + sage: t = words.ThueMorseWord('ab') sage: w.longest_common_suffix(t) Traceback (most recent call last): ... diff --git a/src/sage/combinat/words/suffix_trees.py b/src/sage/combinat/words/suffix_trees.py index 1cfdb629213..fe36d4187cc 100644 --- a/src/sage/combinat/words/suffix_trees.py +++ b/src/sage/combinat/words/suffix_trees.py @@ -1729,7 +1729,7 @@ def _complete_labeling(self): EXAMPLES:: sage: from sage.combinat.words.suffix_trees import DecoratedSuffixTree - sage: w=Word('aabbaaba') + sage: w = Word('aabbaaba') sage: DecoratedSuffixTree(w)._complete_labeling() {(2, 7): [1], (5, 4): [1]} """ From 83eb8b2d36dd03825b768fd9348d930f6c896008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 7 Jul 2022 14:57:34 +0200 Subject: [PATCH 217/416] some doc polishing in modular/ folder --- src/sage/modular/abvar/abvar.py | 29 ++++++++++--------- src/sage/modular/btquotients/btquotient.py | 4 +-- .../modular/btquotients/pautomorphicform.py | 4 +-- src/sage/modular/cusps.py | 6 ++-- src/sage/modular/dirichlet.py | 2 +- src/sage/modular/hecke/ambient_module.py | 6 ++-- .../modular/modform/cuspidal_submodule.py | 2 +- src/sage/modular/modform/element.py | 2 +- src/sage/modular/modform/space.py | 6 ++-- .../graded_ring_element.py | 6 ++-- src/sage/modular/modsym/modsym.py | 7 ++--- src/sage/modular/modsym/modular_symbols.py | 8 ++--- src/sage/modular/modsym/p1list.pyx | 14 ++++----- src/sage/modular/modsym/space.py | 3 +- src/sage/modular/overconvergent/genus0.py | 16 +++++----- .../elliptic_curves/ell_modular_symbols.py | 26 ++++++++--------- 16 files changed, 69 insertions(+), 72 deletions(-) diff --git a/src/sage/modular/abvar/abvar.py b/src/sage/modular/abvar/abvar.py index 80467d9b5b0..885b029d938 100644 --- a/src/sage/modular/abvar/abvar.py +++ b/src/sage/modular/abvar/abvar.py @@ -2345,11 +2345,11 @@ def frobenius_polynomial(self, p, var='x'): EXAMPLES:: sage: f = Newform('39b','a') - sage: A=AbelianVariety(f) + sage: A = AbelianVariety(f) sage: A.frobenius_polynomial(5) x^4 + 2*x^2 + 25 - sage: J=J0(23) + sage: J = J0(23) sage: J.frobenius_polynomial(997) x^4 + 20*x^3 + 1374*x^2 + 19940*x + 994009 @@ -2870,28 +2870,31 @@ 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. - 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 - two degeneracy maps. + 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. + + 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 two degeneracy maps. EXAMPLES:: - sage: J=J0(11) + sage: J = J0(11) sage: J.shimura_subgroup() Finite subgroup with invariants [5] over QQ of Abelian variety J0(11) of dimension 1 - sage: J=J0(17) - sage: G=J.cuspidal_subgroup(); G + sage: J = J0(17) + sage: G = J.cuspidal_subgroup(); G Finite subgroup with invariants [4] over QQ of Abelian variety J0(17) of dimension 1 - sage: S=J.shimura_subgroup(); S + sage: S = J.shimura_subgroup(); S Finite subgroup with invariants [4] over QQ of Abelian variety J0(17) of dimension 1 sage: G.intersection(S) Finite subgroup with invariants [2] over QQ of Abelian variety J0(17) of dimension 1 - sage: J=J0(33) - sage: A=J.decomposition()[0] + sage: J = J0(33) + sage: A = J.decomposition()[0] sage: A.shimura_subgroup() Finite subgroup with invariants [5] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) sage: J.shimura_subgroup() diff --git a/src/sage/modular/btquotients/btquotient.py b/src/sage/modular/btquotients/btquotient.py index cb95caf420d..8fe32fd1ac6 100644 --- a/src/sage/modular/btquotients/btquotient.py +++ b/src/sage/modular/btquotients/btquotient.py @@ -2598,7 +2598,7 @@ def get_edge_stabilizers(self): EXAMPLES:: - sage: X=BruhatTitsQuotient(3,2) + sage: X = BruhatTitsQuotient(3,2) sage: s = X.get_edge_stabilizers() sage: len(s) == X.get_num_ordered_edges()/2 True @@ -2632,7 +2632,7 @@ def get_stabilizers(self): EXAMPLES:: - sage: X=BruhatTitsQuotient(3,5) + sage: X = BruhatTitsQuotient(3,5) sage: s = X.get_stabilizers() sage: len(s) == X.get_num_ordered_edges() True diff --git a/src/sage/modular/btquotients/pautomorphicform.py b/src/sage/modular/btquotients/pautomorphicform.py index 9546955a31a..30342a56ab1 100644 --- a/src/sage/modular/btquotients/pautomorphicform.py +++ b/src/sage/modular/btquotients/pautomorphicform.py @@ -2464,14 +2464,14 @@ def _element_constructor_(self, data): sage: X = BruhatTitsQuotient(13,5) sage: H = X.harmonic_cocycles(2,prec=10) - sage: h=H.an_element() # indirect doctest + sage: h = H.an_element() # indirect doctest sage: A = X.padic_automorphic_forms(2,prec=10) sage: A(h) p-adic automorphic form of cohomological weight 0 """ # Code how to coerce x into the space # Admissible values of x? - if type(data) is list: + if isinstance(data, list): return self.element_class(self, [self._U(o, normalize=False) for o in data]) if isinstance(data, pAdicAutomorphicFormElement): diff --git a/src/sage/modular/cusps.py b/src/sage/modular/cusps.py index 0a40b57294c..b7cd341e800 100644 --- a/src/sage/modular/cusps.py +++ b/src/sage/modular/cusps.py @@ -332,7 +332,7 @@ def numerator(self): EXAMPLES:: - sage: x=Cusp(6,9); x + sage: x = Cusp(6,9); x 2/3 sage: x.numerator() 2 @@ -349,7 +349,7 @@ def denominator(self): EXAMPLES:: - sage: x=Cusp(6,9); x + sage: x = Cusp(6,9); x 2/3 sage: x.denominator() 3 @@ -900,7 +900,7 @@ def galois_action(self, t, N): 1/170 sage: Cusp(oo).galois_action(3, 50) Infinity - sage: c=Cusp(0).galois_action(3, 50); c + sage: c = Cusp(0).galois_action(3, 50); c 50/17 sage: Gamma0(50).reduce_cusp(c) 0 diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py index 25565d0eeab..a5e07288080 100644 --- a/src/sage/modular/dirichlet.py +++ b/src/sage/modular/dirichlet.py @@ -1637,7 +1637,7 @@ def kloosterman_sum_numerical(self, prec=53, a=1, b=0): The real component of the numerical value of e is near zero:: - sage: v=e.kloosterman_sum_numerical() + sage: v = e.kloosterman_sum_numerical() sage: v.real() < 1.0e15 True sage: v.imag() diff --git a/src/sage/modular/hecke/ambient_module.py b/src/sage/modular/hecke/ambient_module.py index e0b0a1772d1..03f1f27da08 100644 --- a/src/sage/modular/hecke/ambient_module.py +++ b/src/sage/modular/hecke/ambient_module.py @@ -198,13 +198,11 @@ def complement(self): EXAMPLES:: - sage: M=ModularSymbols(11,2,1) - sage: M + sage: M = ModularSymbols(11,2,1); M Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field sage: M.complement() Modular Symbols subspace of dimension 0 of Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field - sage: C=M.cuspidal_subspace() - sage: C + sage: C = M.cuspidal_subspace(); C Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field sage: C.complement() Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field diff --git a/src/sage/modular/modform/cuspidal_submodule.py b/src/sage/modular/modform/cuspidal_submodule.py index fcf3ee51df6..decc402a839 100644 --- a/src/sage/modular/modform/cuspidal_submodule.py +++ b/src/sage/modular/modform/cuspidal_submodule.py @@ -242,7 +242,7 @@ def _compute_hecke_matrix_prime(self, p): EXAMPLES:: - sage: C=CuspForms(38, 2) + sage: C = CuspForms(38, 2) sage: C._compute_hecke_matrix_prime(7) [-1 0 0 0] [ 0 -1 0 0] diff --git a/src/sage/modular/modform/element.py b/src/sage/modular/modform/element.py index c8dc792e139..b50b8535d9e 100644 --- a/src/sage/modular/modform/element.py +++ b/src/sage/modular/modform/element.py @@ -1668,7 +1668,7 @@ def modsym_eigenspace(self, sign=0): [ 0 1 -1 1 0] sage: V.0 in M.free_module() True - sage: V=N.modsym_eigenspace(-1); V + sage: V = N.modsym_eigenspace(-1); V Vector space of degree 5 and dimension 1 over Rational Field Basis matrix: [ 0 0 0 1 -1/2] diff --git a/src/sage/modular/modform/space.py b/src/sage/modular/modform/space.py index 5674a03e4be..42ed9a9072e 100644 --- a/src/sage/modular/modform/space.py +++ b/src/sage/modular/modform/space.py @@ -1057,9 +1057,9 @@ def _element_constructor_(self, x, check=True): ... TypeError: unable to create modular form from exact non-zero polynomial - sage: E=ModularForms(3,12).cuspidal_subspace() - sage: f=E.gens()[0] - sage: g=f-f + sage: E = ModularForms(3,12).cuspidal_subspace() + sage: f = E.gens()[0] + sage: g = f - f sage: g.is_old() True diff --git a/src/sage/modular/modform_hecketriangle/graded_ring_element.py b/src/sage/modular/modform_hecketriangle/graded_ring_element.py index 4ec4b6e258b..f3328f28177 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring_element.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring_element.py @@ -1046,7 +1046,7 @@ def diff_op(self, op, new_parent=None): sage: from sage.modular.modform_hecketriangle.graded_ring import QuasiMeromorphicModularFormsRing sage: MR = QuasiMeromorphicModularFormsRing(n=8, red_hom=True) sage: (X,Y,Z,dX,dY,dZ) = MR.diff_alg().gens() - sage: n=MR.hecke_n() + sage: n = MR.hecke_n() sage: mul_op = 4/(n-2)*X*dX + 2*n/(n-2)*Y*dY + 2*Z*dZ sage: der_op = MR._derivative_op() sage: ser_op = MR._serre_derivative_op() @@ -1462,7 +1462,7 @@ def reduce(self, force=False): sage: ModularFormsRing(n=7)(x+1).reduce(force=True).parent() ModularFormsRing(n=7) over Integer Ring - sage: y=var("y") + sage: y = var("y") sage: ModularFormsRing(n=infinity)(x-y^2).reduce(force=True) 64*q - 512*q^2 + 1792*q^3 - 4096*q^4 + O(q^5) """ @@ -1493,7 +1493,7 @@ def reduced_parent(self): sage: el.reduced_parent() ModularFormsRing(n=3) over Integer Ring - sage: y=var("y") + sage: y = var("y") sage: QuasiMeromorphicModularFormsRing(n=infinity)(x-y^2).reduced_parent() ModularForms(n=+Infinity, k=4, ep=1) over Integer Ring sage: QuasiMeromorphicModularFormsRing(n=infinity)(x*(x-y^2)).reduced_parent() diff --git a/src/sage/modular/modsym/modsym.py b/src/sage/modular/modsym/modsym.py index 8b98ea11303..a30f53a8a9e 100644 --- a/src/sage/modular/modsym/modsym.py +++ b/src/sage/modular/modsym/modsym.py @@ -167,15 +167,14 @@ def ModularSymbols_clear_cache(): Make sure :trac:`10548` is fixed:: sage: import gc - sage: m=ModularSymbols(Gamma1(29)) - sage: m=[] + sage: m = ModularSymbols(Gamma1(29)) + sage: m = [] sage: ModularSymbols_clear_cache() sage: gc.collect() # random 3422 - sage: a=[x for x in gc.get_objects() if isinstance(x,sage.modular.modsym.ambient.ModularSymbolsAmbient_wtk_g1)] + sage: a = [x for x in gc.get_objects() if isinstance(x,sage.modular.modsym.ambient.ModularSymbolsAmbient_wtk_g1)] sage: a [] - """ global _cache _cache = {} diff --git a/src/sage/modular/modsym/modular_symbols.py b/src/sage/modular/modsym/modular_symbols.py index cd629a3f18d..c832cb8be05 100644 --- a/src/sage/modular/modsym/modular_symbols.py +++ b/src/sage/modular/modsym/modular_symbols.py @@ -292,7 +292,7 @@ def apply(self, g): sage: s = ModularSymbols(11,2).1.modular_symbol_rep()[0][1]; s {-1/8, 0} - sage: a=1;b=2;c=3;d=4; s.apply([a,b,c,d]) + sage: a = 1; b = 2; c = 3; d = 4; s.apply([a,b,c,d]) {15/29, 1/2} sage: x = -1/8; (a*x+b)/(c*x+d) 15/29 @@ -303,12 +303,12 @@ def apply(self, g): sage: s.apply([a,b,c,d]) 16*X^2*{11/21, 1/2} - 16*X*Y*{11/21, 1/2} + 4*Y^2*{11/21, 1/2} sage: P = s.polynomial_part() - sage: X,Y = P.parent().gens() + sage: X, Y = P.parent().gens() sage: P(d*X-b*Y, -c*X+a*Y) 16*X^2 - 16*X*Y + 4*Y^2 - sage: x=-1/6; (a*x+b)/(c*x+d) + sage: x = -1/6; (a*x+b)/(c*x+d) 11/21 - sage: x=0; (a*x+b)/(c*x+d) + sage: x = 0; (a*x+b)/(c*x+d) 1/2 sage: type(s.apply([a,b,c,d])) diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index 05ef4951f8c..880462748cf 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -515,10 +515,9 @@ def p1list(N): sage: from sage.modular.modsym.p1list import p1list sage: list(p1list(7)) [(0, 1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6)] - sage: N=23456 + sage: N = 23456 sage: len(p1list(N)) == N*prod([1+1/p for p,e in N.factor()]) True - """ if N <= 0: raise ValueError("N must be a positive integer") @@ -526,8 +525,8 @@ def p1list(N): return p1list_int(N) if N <= 2147483647: return p1list_llong(N) - else: - raise OverflowError("p1list not defined for such large N.") + raise OverflowError("p1list not defined for such large N") + def p1_normalize(int N, int u, int v): r""" @@ -1231,8 +1230,7 @@ def lift_to_sl2z_int(int c, int d, int N): sage: from sage.modular.modsym.p1list import lift_to_sl2z_int sage: lift_to_sl2z_int(2,6,11) [1, 8, 2, 17] - sage: m=Matrix(Integers(),2,2,lift_to_sl2z_int(2,6,11)) - sage: m + sage: m = Matrix(Integers(),2,2,lift_to_sl2z_int(2,6,11)); m [ 1 8] [ 2 17] @@ -1282,6 +1280,7 @@ def lift_to_sl2z_int(int c, int d, int N): return [z2, -z1, c, d] + def lift_to_sl2z_llong(llong c, llong d, int N): r""" Lift a pair `(c, d)` (modulo `N`) to an element of `SL(2, \ZZ)`. @@ -1301,8 +1300,7 @@ def lift_to_sl2z_llong(llong c, llong d, int N): sage: from sage.modular.modsym.p1list import lift_to_sl2z_llong sage: lift_to_sl2z_llong(2,6,11) [1, 8, 2, 17] - sage: m=Matrix(Integers(),2,2,lift_to_sl2z_llong(2,6,11)) - sage: m + sage: m = Matrix(Integers(),2,2,lift_to_sl2z_llong(2,6,11)); m [ 1 8] [ 2 17] diff --git a/src/sage/modular/modsym/space.py b/src/sage/modular/modsym/space.py index 4d818262a1c..cd9ed42cf91 100644 --- a/src/sage/modular/modsym/space.py +++ b/src/sage/modular/modsym/space.py @@ -449,8 +449,7 @@ def is_simple(self): Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 6 for Gamma_0(33) of weight 2 with sign 1 over Rational Field, Modular Symbols subspace of dimension 3 of Modular Symbols space of dimension 6 for Gamma_0(33) of weight 2 with sign 1 over Rational Field ] - sage: C=ModularSymbols(1,14,0,GF(5)).cuspidal_submodule() - sage: C + sage: C = ModularSymbols(1,14,0,GF(5)).cuspidal_submodule(); C Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(1) of weight 14 with sign 0 over Finite Field of size 5 sage: C.is_simple() True diff --git a/src/sage/modular/overconvergent/genus0.py b/src/sage/modular/overconvergent/genus0.py index 8c5f36fa933..5031d38377c 100644 --- a/src/sage/modular/overconvergent/genus0.py +++ b/src/sage/modular/overconvergent/genus0.py @@ -687,7 +687,7 @@ def _element_constructor_(self, input): sage: M = OverconvergentModularForms(3, 0, 1/2, prec=5) sage: R. = QQ[[]] - sage: f=M(q + q^2 - q^3 + O(q^16)); f + sage: f = M(q + q^2 - q^3 + O(q^16)); f 3-adic overconvergent modular form of weight-character 0 with q-expansion q + q^2 - q^3 + O(q^5) sage: M.coordinate_vector(f) (0, 1/27, -11/729, 173/19683, -3172/531441) @@ -1535,11 +1535,11 @@ def is_integral(self): def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: - sage: o=OverconvergentModularForms(3, 0, 1/2) + sage: o = OverconvergentModularForms(3, 0, 1/2) sage: o([1, 0, 1, 3])._repr_() '3-adic overconvergent modular form of weight-character 0 with q-expansion 1 + 729*q^2 + 76545*q^3 + O(q^4)' """ @@ -1565,7 +1565,7 @@ def r_ord(self, r): EXAMPLES:: - sage: o=OverconvergentModularForms(3, 0, 1/2) + sage: o = OverconvergentModularForms(3, 0, 1/2) sage: t = o([1, 1, 1/3]) sage: t.r_ord(1/2) 1 @@ -1610,8 +1610,8 @@ def governing_term(self, r): EXAMPLES:: - sage: o=OverconvergentModularForms(3, 0, 1/2) - sage: f=o.eigenfunctions(10)[1] + sage: o = OverconvergentModularForms(3, 0, 1/2) + sage: f = o.eigenfunctions(10)[1] sage: f.governing_term(1/2) 1 """ @@ -1635,8 +1635,8 @@ def valuation_plot(self, rmax = None): EXAMPLES:: - sage: o=OverconvergentModularForms(3, 0, 1/2) - sage: f=o.eigenfunctions(4)[1] + sage: o = OverconvergentModularForms(3, 0, 1/2) + sage: f = o.eigenfunctions(4)[1] sage: f.valuation_plot() Graphics object consisting of 1 graphics primitive """ diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index a9fcd8705e2..72489b121f9 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -123,8 +123,8 @@ def modular_symbol_space(E, sign, base_ring, bound=None): EXAMPLES:: sage: import sage.schemes.elliptic_curves.ell_modular_symbols - sage: E=EllipticCurve('11a1') - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.modular_symbol_space(E,-1,GF(37)) + sage: E = EllipticCurve('11a1') + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.modular_symbol_space(E,-1,GF(37)) sage: M Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Finite Field of size 37 """ @@ -244,15 +244,15 @@ def __init__(self, E, sign, nap=1000): 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 sage: M(0) 1/5 - sage: E=EllipticCurve('11a2') - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) + sage: E = EllipticCurve('11a2') + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) sage: M(0) 1 This is a rank 1 case with vanishing positive twists:: - sage: E=EllipticCurve('121b1') - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) + sage: E = EllipticCurve('121b1') + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) sage: M(0) 0 sage: M(1/7) @@ -389,26 +389,26 @@ def __init__(self, E, sign, normalize="L_ratio"): EXAMPLES:: - sage: E=EllipticCurve('11a1') + sage: E = EllipticCurve('11a1') sage: import sage.schemes.elliptic_curves.ell_modular_symbols - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1) + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1) sage: 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 sage: M(0) 1/5 - sage: E=EllipticCurve('11a2') - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1) + sage: E = EllipticCurve('11a2') + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1) sage: M(0) 1 - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,-1) + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,-1) sage: M(1/3) 1/2 This is a rank 1 case with vanishing positive twists. The modular symbol is adjusted by -2:: - sage: E=EllipticCurve('121b1') - sage: M=sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,-1,normalize='L_ratio') + sage: E = EllipticCurve('121b1') + sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,-1,normalize='L_ratio') sage: M(1/3) 1 sage: M._scaling From 52791341e7ec188e3183a7e4f007436d84b82a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 7 Jul 2022 15:10:52 +0200 Subject: [PATCH 218/416] some doc polishing for categories --- src/sage/categories/additive_magmas.py | 20 ++++++------ ...eflection_or_generalized_coxeter_groups.py | 9 +++--- .../categories/filtered_modules_with_basis.py | 6 ++-- src/sage/categories/group_algebras.py | 4 +-- src/sage/categories/groups.py | 14 ++++---- src/sage/categories/magmas.py | 6 ++-- src/sage/categories/primer.py | 6 ++-- src/sage/categories/quotient_fields.py | 6 ++-- src/sage/categories/regular_crystals.py | 32 +++++++++---------- src/sage/categories/semigroups.py | 2 +- src/sage/categories/weyl_groups.py | 18 ++++------- 11 files changed, 60 insertions(+), 63 deletions(-) diff --git a/src/sage/categories/additive_magmas.py b/src/sage/categories/additive_magmas.py index 35fcfeb9d21..e81dcf9d4b9 100644 --- a/src/sage/categories/additive_magmas.py +++ b/src/sage/categories/additive_magmas.py @@ -278,7 +278,7 @@ def addition_table(self, names='letters', elements=None): has an addition defined.The default is to represent elements as lowercase ASCII letters. :: - sage: R=IntegerModRing(5) + sage: R = IntegerModRing(5) sage: R.addition_table() + a b c d e +---------- @@ -293,8 +293,8 @@ def addition_table(self, names='letters', elements=None): representation of the elements of the set. Requesting ``digits`` will include leading zeros as padding. :: - sage: R=IntegerModRing(11) - sage: P=R.addition_table(names='elements') + sage: R = IntegerModRing(11) + sage: P = R.addition_table(names='elements') sage: P + 0 1 2 3 4 5 6 7 8 9 10 +--------------------------------- @@ -310,7 +310,7 @@ def addition_table(self, names='letters', elements=None): 9| 9 10 0 1 2 3 4 5 6 7 8 10| 10 0 1 2 3 4 5 6 7 8 9 - sage: T=R.addition_table(names='digits') + sage: T = R.addition_table(names='digits') sage: T + 00 01 02 03 04 05 06 07 08 09 10 +--------------------------------- @@ -329,7 +329,7 @@ def addition_table(self, names='letters', elements=None): Specifying the elements in an alternative order can provide more insight into how the operation behaves. :: - sage: S=IntegerModRing(7) + sage: S = IntegerModRing(7) sage: elts = [0, 3, 6, 2, 5, 1, 4] sage: S.addition_table(elements=elts) + a b c d e f g @@ -350,7 +350,7 @@ def addition_table(self, names='letters', elements=None): the elements be represented with their usual string representation. :: - sage: T=IntegerModRing(12) + sage: T = IntegerModRing(12) sage: elts=[0, 3, 6, 9] sage: T.addition_table(names='elements', elements=elts) + 0 3 6 9 @@ -365,8 +365,8 @@ def addition_table(self, names='letters', elements=None): :class:`~sage.matrix.operation_table.OperationTable` for more comprehensive documentation. :: - sage: R=IntegerModRing(3) - sage: T=R.addition_table() + sage: R = IntegerModRing(3) + sage: T = R.addition_table() sage: T.column_keys() (0, 1, 2) sage: sorted(T.translation().items()) @@ -476,8 +476,8 @@ def _add_(self, right): (1, x) sage: e+e (2, 0) - sage: e=groups.misc.AdditiveCyclic(8) - sage: x=e.cartesian_product(e)((e(1),e(2))) + sage: e = groups.misc.AdditiveCyclic(8) + sage: x = e.cartesian_product(e)((e(1),e(2))) sage: x (1, 2) sage: 4*x diff --git a/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py b/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py index bb58d78cbde..497f29a433b 100644 --- a/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py +++ b/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py @@ -19,6 +19,7 @@ from sage.categories.category_with_axiom import CategoryWithAxiom from sage.categories.groups import Groups + class ComplexReflectionOrGeneralizedCoxeterGroups(Category_singleton): r""" The category of complex reflection groups or generalized Coxeter groups. @@ -402,9 +403,9 @@ def some_elements(self): """ return list(self.simple_reflections()) + [self.one(), self.an_element()] - ########################################################################## + ###################################################################### # Reflections - ########################################################################## + ###################################################################### @abstract_method(optional=True) def reflection_index_set(self): @@ -719,7 +720,7 @@ def from_reduced_word(self, word, word_type='simple'): TESTS:: - sage: W=WeylGroup(['E',6]) + sage: W = WeylGroup(['E',6]) sage: W.from_reduced_word([2,3,4,2]) [ 0 1 0 0 0 0 0 0] [ 0 0 -1 0 0 0 0 0] @@ -896,7 +897,7 @@ def apply_simple_reflection_right(self, i): EXAMPLES:: - sage: W=CoxeterGroups().example() + sage: W = CoxeterGroups().example() sage: w = W.an_element(); w (1, 2, 3, 0) sage: w.apply_simple_reflection_right(0) diff --git a/src/sage/categories/filtered_modules_with_basis.py b/src/sage/categories/filtered_modules_with_basis.py index 5ded1be95e2..060045bd15c 100644 --- a/src/sage/categories/filtered_modules_with_basis.py +++ b/src/sage/categories/filtered_modules_with_basis.py @@ -643,9 +643,9 @@ def is_homogeneous(self): EXAMPLES:: sage: A = ModulesWithBasis(ZZ).Filtered().example() - sage: x=A(Partition((3,2,1))) - sage: y=A(Partition((4,4,1))) - sage: z=A(Partition((2,2,2))) + sage: x = A(Partition((3,2,1))) + sage: y = A(Partition((4,4,1))) + sage: z = A(Partition((2,2,2))) sage: (3*x).is_homogeneous() True sage: (x - y).is_homogeneous() diff --git a/src/sage/categories/group_algebras.py b/src/sage/categories/group_algebras.py index 0d7c42d22fe..0df6bf44165 100644 --- a/src/sage/categories/group_algebras.py +++ b/src/sage/categories/group_algebras.py @@ -265,9 +265,9 @@ def counit_on_basis(self,g): EXAMPLES:: - sage: A=CyclicPermutationGroup(6).algebra(ZZ);A + sage: A = CyclicPermutationGroup(6).algebra(ZZ);A Algebra of Cyclic group of order 6 as a permutation group over Integer Ring - sage: g=CyclicPermutationGroup(6).an_element();g + sage: g = CyclicPermutationGroup(6).an_element();g (1,2,3,4,5,6) sage: A.counit_on_basis(g) 1 diff --git a/src/sage/categories/groups.py b/src/sage/categories/groups.py index 335cb4af368..b0f4804e865 100644 --- a/src/sage/categories/groups.py +++ b/src/sage/categories/groups.py @@ -298,7 +298,7 @@ def cayley_table(self, names='letters', elements=None): you can choose to just use the string representations of the elements themselves. :: - sage: C=CyclicPermutationGroup(11) + sage: C = CyclicPermutationGroup(11) sage: C.cayley_table(names='digits') * 00 01 02 03 04 05 06 07 08 09 10 +--------------------------------- @@ -316,8 +316,8 @@ def cayley_table(self, names='letters', elements=None): :: - sage: G=QuaternionGroup() - sage: names=['1', 'I', '-1', '-I', 'J', '-K', '-J', 'K'] + sage: G = QuaternionGroup() + sage: names = ['1', 'I', '-1', '-I', 'J', '-K', '-J', 'K'] sage: G.cayley_table(names=names) * 1 I -1 -I J -K -J K +------------------------ @@ -332,7 +332,7 @@ def cayley_table(self, names='letters', elements=None): :: - sage: A=AbelianGroup([2,2]) + sage: A = AbelianGroup([2,2]) sage: A.cayley_table(names='elements') * 1 f1 f0 f0*f1 +------------------------ @@ -345,8 +345,8 @@ def cayley_table(self, names='letters', elements=None): routine behaves similarly, but changes an existing table "in-place." :: - sage: G=AlternatingGroup(3) - sage: T=G.cayley_table() + sage: G = AlternatingGroup(3) + sage: T = G.cayley_table() sage: T.change_names('digits') sage: T * 0 1 2 @@ -360,7 +360,7 @@ def cayley_table(self, names='letters', elements=None): Elements will be coerced into the group as part of setting up the table. :: - sage: G=SL(2,ZZ) + sage: G = SL(2,ZZ) sage: G Special Linear Group of degree 2 over Integer Ring sage: identity = matrix(ZZ, [[1,0], [0,1]]) diff --git a/src/sage/categories/magmas.py b/src/sage/categories/magmas.py index e00ebb91353..c4a35fe6f1a 100644 --- a/src/sage/categories/magmas.py +++ b/src/sage/categories/magmas.py @@ -931,7 +931,7 @@ def multiplication_table(self, names='letters', elements=None): the elements be represented with their usual string representation. :: - sage: L=LeftRegularBand(('a','b','c')) + sage: L = LeftRegularBand(('a','b','c')) sage: elts=['a', 'c', 'ac', 'ca'] sage: L.multiplication_table(names='elements', elements=elts) * 'a' 'c' 'ac' 'ca' @@ -946,8 +946,8 @@ def multiplication_table(self, names='letters', elements=None): :class:`~sage.matrix.operation_table.OperationTable` for more comprehensive documentation. :: - sage: G=AlternatingGroup(3) - sage: T=G.multiplication_table() + sage: G = AlternatingGroup(3) + sage: T = G.multiplication_table() sage: T.column_keys() ((), (1,2,3), (1,3,2)) sage: T.translation() diff --git a/src/sage/categories/primer.py b/src/sage/categories/primer.py index f49c7e5396f..1663a30d9ab 100644 --- a/src/sage/categories/primer.py +++ b/src/sage/categories/primer.py @@ -80,8 +80,8 @@ sage: GL(2,2).cardinality() 6 - sage: A=random_matrix(ZZ,6,3,x=7) - sage: L=LatticePolytope(A.rows()) + sage: A = random_matrix(ZZ,6,3,x=7) + sage: L = LatticePolytope(A.rows()) sage: L.npoints() # oops! # random 37 @@ -97,7 +97,7 @@ :: - sage: m=random_matrix(QQ, 4, algorithm='echelonizable', rank=3, upper_bound=60) + sage: m = random_matrix(QQ, 4, algorithm='echelonizable', rank=3, upper_bound=60) sage: m^8 == m*m*m*m*m*m*m*m == ((m^2)^2)^2 True diff --git a/src/sage/categories/quotient_fields.py b/src/sage/categories/quotient_fields.py index 033c1499d05..5e4cf0c7edc 100644 --- a/src/sage/categories/quotient_fields.py +++ b/src/sage/categories/quotient_fields.py @@ -518,15 +518,15 @@ def partial_fraction_decomposition(self, decompose_powers=True): This was fixed in :trac:`16240`:: sage: R. = QQ['x'] - sage: p=1/(-x + 1) + sage: p = 1/(-x + 1) sage: whole,parts = p.partial_fraction_decomposition() sage: p == sum(parts) True - sage: p=3/(-x^4 + 1) + sage: p = 3/(-x^4 + 1) sage: whole,parts = p.partial_fraction_decomposition() sage: p == sum(parts) True - sage: p=(6*x^2 - 9*x + 5)/(-x^3 + 3*x^2 - 3*x + 1) + sage: p = (6*x^2 - 9*x + 5)/(-x^3 + 3*x^2 - 3*x + 1) sage: whole,parts = p.partial_fraction_decomposition() sage: p == sum(parts) True diff --git a/src/sage/categories/regular_crystals.py b/src/sage/categories/regular_crystals.py index ead1a1dc198..739a5ecc598 100644 --- a/src/sage/categories/regular_crystals.py +++ b/src/sage/categories/regular_crystals.py @@ -299,7 +299,7 @@ def _test_stembridge_local_axioms(self, index_set=None, verbose=False, complete= sage: T._test_stembridge_local_axioms(index_set=[1,3]) True - sage: B=Crystals().example(choice='naive') + sage: B = Crystals().example(choice='naive') sage: B._test_stembridge_local_axioms() Traceback (most recent call last): ... @@ -597,10 +597,10 @@ def stembridgeDelta_depth(self,i,j): EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: t=T(rows=[[1,2],[2]]) + sage: t = T(rows=[[1,2],[2]]) sage: t.stembridgeDelta_depth(1,2) 0 - sage: s=T(rows=[[2,3],[3]]) + sage: s = T(rows=[[2,3],[3]]) sage: s.stembridgeDelta_depth(1,2) -1 """ @@ -620,10 +620,10 @@ def stembridgeDelta_rise(self,i,j): EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: t=T(rows=[[1,2],[2]]) + sage: t = T(rows=[[1,2],[2]]) sage: t.stembridgeDelta_rise(1,2) -1 - sage: s=T(rows=[[2,3],[3]]) + sage: s = T(rows=[[2,3],[3]]) sage: s.stembridgeDelta_rise(1,2) 0 """ @@ -643,10 +643,10 @@ def stembridgeDel_depth(self,i,j): EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: t=T(rows=[[1,1],[2]]) + sage: t = T(rows=[[1,1],[2]]) sage: t.stembridgeDel_depth(1,2) 0 - sage: s=T(rows=[[1,3],[3]]) + sage: s = T(rows=[[1,3],[3]]) sage: s.stembridgeDel_depth(1,2) -1 """ @@ -666,10 +666,10 @@ def stembridgeDel_rise(self,i,j): EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: t=T(rows=[[1,1],[2]]) + sage: t = T(rows=[[1,1],[2]]) sage: t.stembridgeDel_rise(1,2) -1 - sage: s=T(rows=[[1,3],[3]]) + sage: s = T(rows=[[1,3],[3]]) sage: s.stembridgeDel_rise(1,2) 0 """ @@ -692,20 +692,20 @@ def stembridgeTriple(self,i,j): EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: t=T(rows=[[1,1],[2]]) + sage: t = T(rows=[[1,1],[2]]) sage: t.stembridgeTriple(1,2) - sage: s=T(rows=[[1,2],[2]]) + sage: s = T(rows=[[1,2],[2]]) sage: s.stembridgeTriple(1,2) (-1, 0, -1) sage: T = crystals.Tableaux(['B',2], shape=[2,1]) - sage: t=T(rows=[[1,2],[2]]) + sage: t = T(rows=[[1,2],[2]]) sage: t.stembridgeTriple(1,2) (-2, 0, -2) - sage: s=T(rows=[[-1,-1],[0]]) + sage: s = T(rows=[[-1,-1],[0]]) sage: s.stembridgeTriple(1,2) (-2, -2, 0) - sage: u=T(rows=[[0,2],[1]]) + sage: u = T(rows=[[0,2],[1]]) sage: u.stembridgeTriple(1,2) (-2, -1, -1) """ @@ -739,7 +739,7 @@ def _test_stembridge_local_axioms(self, index_set=None, verbose=False, **options EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: t=T(rows=[[1,1],[2]]) + sage: t = T(rows=[[1,1],[2]]) sage: t._test_stembridge_local_axioms() True sage: t._test_stembridge_local_axioms(index_set=[1,3]) @@ -748,7 +748,7 @@ def _test_stembridge_local_axioms(self, index_set=None, verbose=False, **options True """ tester = self._tester(**options) - goodness=True + goodness = True if index_set is None: index_set=self.index_set() diff --git a/src/sage/categories/semigroups.py b/src/sage/categories/semigroups.py index 9a04c3e3e9e..689b2979601 100644 --- a/src/sage/categories/semigroups.py +++ b/src/sage/categories/semigroups.py @@ -217,7 +217,7 @@ def cayley_graph(self, side="right", simple=False, elements = None, generators = sage: G = A5.cayley_graph(generators=[A5.gens()[0]]) sage: G.num_edges() 60 - sage: g=PermutationGroup([(i+1,j+1) for i in range(5) for j in range(5) if j!=i]) + sage: g = PermutationGroup([(i+1,j+1) for i in range(5) for j in range(5) if j!=i]) sage: g.cayley_graph(generators=[(1,2),(2,3)]) Digraph on 120 vertices diff --git a/src/sage/categories/weyl_groups.py b/src/sage/categories/weyl_groups.py index cdaeefc0826..3cb0aa47c68 100644 --- a/src/sage/categories/weyl_groups.py +++ b/src/sage/categories/weyl_groups.py @@ -572,11 +572,11 @@ def stanley_symmetric_function(self): @cached_in_parent_method def reflection_to_root(self): r""" - Returns the root associated with the reflection ``self``. + Return the root associated with the reflection ``self``. EXAMPLES:: - sage: W=WeylGroup(['C',2],prefix="s") + sage: W = WeylGroup(['C',2],prefix="s") sage: W.from_reduced_word([1,2,1]).reflection_to_root() 2*alpha[1] + alpha[2] sage: W.from_reduced_word([1,2]).reflection_to_root() @@ -588,7 +588,6 @@ def reflection_to_root(self): ... ValueError: s2*s1*s2*s1 is not a reflection """ - i = self.first_descent() if i is None: raise ValueError("{} is not a reflection".format(self)) @@ -602,11 +601,11 @@ def reflection_to_root(self): @cached_in_parent_method def reflection_to_coroot(self): r""" - Returns the coroot associated with the reflection ``self``. + Return the coroot associated with the reflection ``self``. EXAMPLES:: - sage: W=WeylGroup(['C',2],prefix="s") + sage: W = WeylGroup(['C',2],prefix="s") sage: W.from_reduced_word([1,2,1]).reflection_to_coroot() alphacheck[1] + alphacheck[2] sage: W.from_reduced_word([1,2]).reflection_to_coroot() @@ -618,7 +617,6 @@ def reflection_to_coroot(self): ... ValueError: s2*s1*s2*s1 is not a reflection """ - i = self.first_descent() if i is None: raise ValueError("{} is not a reflection".format(self)) @@ -648,8 +646,8 @@ def inversions(self, side = 'right', inversion_type = 'reflections'): EXAMPLES:: - sage: W=WeylGroup(['C',2], prefix="s") - sage: w=W.from_reduced_word([1,2]) + sage: W = WeylGroup(['C',2], prefix="s") + sage: w = W.from_reduced_word([1,2]) sage: w.inversions() [s2, s2*s1*s2] sage: w.inversions(inversion_type = 'reflections') @@ -664,9 +662,7 @@ def inversions(self, side = 'right', inversion_type = 'reflections'): [alpha[1], 2*alpha[1] + alpha[2]] sage: w.inversions(side = 'left', inversion_type = 'coroots') [alphacheck[1], alphacheck[1] + alphacheck[2]] - """ - if side == 'left': self = self.inverse() reflections = self.inversions_as_reflections() @@ -676,7 +672,7 @@ def inversions(self, side = 'right', inversion_type = 'reflections'): return [r.reflection_to_root() for r in reflections] if inversion_type == 'coroots': return [r.reflection_to_coroot() for r in reflections] - raise ValueError("inversion_type {} is invalid".format(inversion_type)) + raise ValueError(f"inversion_type {inversion_type} is invalid") def inversion_arrangement(self, side='right'): r""" From 367a0d8791ca283a2de3aef7bb9a95401810e522 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 11:04:45 -0700 Subject: [PATCH 219/416] src/sage/rings/polynomial/hilbert.pyx: Restrict a doctest to 64 bit --- src/sage/rings/polynomial/hilbert.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/polynomial/hilbert.pyx b/src/sage/rings/polynomial/hilbert.pyx index 4cd91d0a464..13d0cbea11c 100644 --- a/src/sage/rings/polynomial/hilbert.pyx +++ b/src/sage/rings/polynomial/hilbert.pyx @@ -576,10 +576,12 @@ def hilbert_poincare_series(I, grading=None): sage: hilbert_poincare_series(J).denominator().factor() (t - 1)^14 - This example exceeded the capabilities of Singular before version 4.2.1p2:: + This example exceeded the capabilities of Singular before version 4.2.1p2. + In Singular 4.3.1 on 32-bit, it prints overflow warnings and omits some terms. + On 64-bit:: sage: J.hilbert_numerator(algorithm='singular') - 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 + 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 # 64-bit """ cdef Polynomial_integer_dense_flint HP From 7ddad626da82afca05e380dde8cf9fcc977bdae5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 15:00:45 -0700 Subject: [PATCH 220/416] .github/workflows/docker.yml: Fix input type --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0a68539c4f4..c1e00f5c370 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -69,7 +69,7 @@ on: "standard", ] max_parallel: - type: string + type: number default: 20 # # Publishing to GitHub Packages From 0ee5b2e6ad7f6aabba24768c5fa3b59f76ea9f19 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 16:13:32 -0700 Subject: [PATCH 221/416] .github/workflows/docker.yml: Pass inputs.target* to tox --- .github/workflows/docker.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c1e00f5c370..7106d525ebf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -106,9 +106,12 @@ jobs: tox_system_factor: ${{ fromJson(inputs.tox_system_factors) }} tox_packages_factor: ${{ fromJson(inputs.tox_packages_factors) }} env: - TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} + TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} - DOCKER_TARGETS: with-system-packages configured with-targets-pre with-targets with-targets-optional + DOCKER_TARGETS: with-system-packages configured with-targets-pre with-targets with-targets-optional + TARGETS_PRE: ${{ inputs.targets_pre }} + TARGETS: ${{ inputs.targets }} + TARGETS_OPTIONAL: ${{ inputs.targets_optional }} steps: - name: Check out SageMath uses: actions/checkout@v2 From 277abdeaa47a1e415dc549be4098b3f41a6a87ba Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 17:39:06 -0700 Subject: [PATCH 222/416] build/make/Makefile.in: Run dummy script error message through sage-logger --- build/make/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 6b168c12e1f..604ad4cfd04 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -625,7 +625,7 @@ $(1)-$(4)-no-deps: SAGE_INST_LOCAL=$$($(4)) \ sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' '$$(SAGE_LOGS)/$(1)-$(2).log' && \ touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"; \ - else \ + else ( \ echo; \ echo "Error: $(1) is a dummy script package that the Sage distribution uses"; \ echo "to provide information about equivalent system packages."; \ @@ -634,7 +634,7 @@ $(1)-$(4)-no-deps: echo "recommended at the end of a run of './configure'"; \ echo "See below for package-specific information."; \ echo; \ - $$(SAGE_ROOT)/build/bin/sage-spkg-info $(1); \ + $$(SAGE_ROOT)/build/bin/sage-spkg-info $(1) ) | sage-logger -p cat '$$(SAGE_LOGS)/$(1)-$(2).log'; \ exit 1; \ fi From 3fe54fceb1e80e098f153d63067fdb315707a079 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 17:44:31 -0700 Subject: [PATCH 223/416] build/make/Makefile.in: Restructure dummy script error message so that look_for_errors finds it --- build/make/Makefile.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 604ad4cfd04..81b15c99b89 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -627,14 +627,17 @@ $(1)-$(4)-no-deps: touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"; \ else ( \ echo; \ - echo "Error: $(1) is a dummy script package that the Sage distribution uses"; \ + echo "Note: $(1) is a dummy script package that the Sage distribution uses"; \ echo "to provide information about equivalent system packages."; \ echo "It cannot be installed using the Sage distribution."; \ echo "Please install it manually, for example using the system packages"; \ echo "recommended at the end of a run of './configure'"; \ echo "See below for package-specific information."; \ echo; \ - $$(SAGE_ROOT)/build/bin/sage-spkg-info $(1) ) | sage-logger -p cat '$$(SAGE_LOGS)/$(1)-$(2).log'; \ + $$(SAGE_ROOT)/build/bin/sage-spkg-info $(1); \ + echo; \ + echo "Error: $(1) is a dummy script package and "; \ + echo "cannot be installed using the Sage distribution." ) | sage-logger -p cat '$$(SAGE_LOGS)/$(1)-$(2).log'; \ exit 1; \ fi From b3ff8f70df399b39bd4536b6de92e573ee8db57f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 17:50:19 -0700 Subject: [PATCH 224/416] build/make/Makefile.in: Run dummy script error message through sage-logger (fixup) --- build/make/Makefile.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 81b15c99b89..d8ea784cf02 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -637,8 +637,7 @@ $(1)-$(4)-no-deps: $$(SAGE_ROOT)/build/bin/sage-spkg-info $(1); \ echo; \ echo "Error: $(1) is a dummy script package and "; \ - echo "cannot be installed using the Sage distribution." ) | sage-logger -p cat '$$(SAGE_LOGS)/$(1)-$(2).log'; \ - exit 1; \ + echo "cannot be installed using the Sage distribution." ) | sage-logger -p 'cat; exit 1' '$$(SAGE_LOGS)/$(1)-$(2).log'; \ fi $(1)-no-deps: $(1)-$(4)-no-deps From 20e0832c2a5c8d400b89a4df9270c3e9880a7fd2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 17:51:31 -0700 Subject: [PATCH 225/416] build/bin/sage-logger: Show longer tail when V=0 --- build/bin/sage-logger | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/sage-logger b/build/bin/sage-logger index 14ab1297022..1682ccbc079 100755 --- a/build/bin/sage-logger +++ b/build/bin/sage-logger @@ -79,7 +79,7 @@ if [ -n "$SAGE_SILENT_BUILD" -a ${use_prefix} = true ]; then status=$? if [[ $status != 0 ]]; then echo " [$logname] error installing, exit status $status. End of log file:" - tail -n 40 "$logfile" | sed "/Please email sage-devel/,$ d;s;^; [$logname] ;" >&2 + tail -n 72 "$logfile" | sed "/Please email sage-devel/,$ d;s;^; [$logname] ;" >&2 echo " [$logname] Full log file: $logfile" else echo " [$logname] successfully installed." From 83c0b03ff7d406b5656d11cca4bebc669aa71b56 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 18:05:31 -0700 Subject: [PATCH 226/416] build/pkgs/singular: Update to 4.3.1p1 --- build/pkgs/singular/checksums.ini | 6 +++--- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index b9cbfc70d39..2e33a405d36 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=e18819861bd6f4e2d179d2111a9e9ad2c8dfaf5b -md5=b542a676e69cb0dac16bb2e7713c89a2 -cksum=2620794242 +sha1=6c2b622d3681e2de3d58d30c654d43d3e32b720c +md5=abb1e37c794472e7760655358ab66054 +cksum=17455733 upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index f77856a6f1a..11300c77e7d 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.3.1 +4.3.1p1 From 7d4dd6955edcd3cfd79e1d4897816106991c0c2c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 19:56:24 -0700 Subject: [PATCH 227/416] .github/workflows/docker.yml: Use upstream artifact only if: inputs.upstream_artifact --- .github/workflows/docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7106d525ebf..38f9bbffcc7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -162,6 +162,8 @@ jobs: - name: Update Sage packages from upstream artifact run: | (export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && sed -i.bak '/upstream/d' .dockerignore && echo "/:toolchain:/i ADD upstream upstream" | sed -i.bak -f - build/bin/write-dockerfile.sh && git diff) + if: inputs.upstream_artifact + - name: Try to login to ghcr.io if: inputs.docker_push_repository != '' # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable From 39d156b01f1a2eb376f8c94f6233e468553494f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 8 Jul 2022 10:22:46 +0200 Subject: [PATCH 228/416] some doc polishing in groups --- .../additive_abelian_group.py | 42 +++++------ src/sage/groups/braid.py | 13 ++-- src/sage/groups/finitely_presented.py | 10 +-- src/sage/groups/free_group.py | 22 +++--- src/sage/groups/generic.py | 71 +++++++++---------- src/sage/groups/libgap_mixin.py | 2 +- .../groups/matrix_gps/finitely_generated.py | 8 +-- src/sage/groups/matrix_gps/orthogonal.py | 4 +- src/sage/groups/matrix_gps/unitary.py | 6 +- .../perm_gps/partn_ref/refinement_binary.pyx | 4 +- .../perm_gps/partn_ref/refinement_graphs.pyx | 2 +- src/sage/groups/perm_gps/permgroup.py | 25 ++++--- .../groups/perm_gps/permgroup_element.pyx | 2 +- src/sage/groups/perm_gps/permgroup_named.py | 7 +- 14 files changed, 107 insertions(+), 111 deletions(-) diff --git a/src/sage/groups/additive_abelian/additive_abelian_group.py b/src/sage/groups/additive_abelian/additive_abelian_group.py index ca76bff7633..0a326d42c60 100644 --- a/src/sage/groups/additive_abelian/additive_abelian_group.py +++ b/src/sage/groups/additive_abelian/additive_abelian_group.py @@ -56,55 +56,55 @@ def AdditiveAbelianGroup(invs, remember_generators = True): that pair up naturally with the invariants. We create the same element repeatedly. :: - sage: H=AdditiveAbelianGroup([3,2,0], remember_generators=True) + sage: H = AdditiveAbelianGroup([3,2,0], remember_generators=True) sage: H.gens() ((1, 0, 0), (0, 1, 0), (0, 0, 1)) sage: [H.0, H.1, H.2] [(1, 0, 0), (0, 1, 0), (0, 0, 1)] - sage: p=H.0+H.1+6*H.2; p + sage: p = H.0+H.1+6*H.2; p (1, 1, 6) sage: H.smith_form_gens() ((2, 1, 0), (0, 0, 1)) - sage: q=H.linear_combination_of_smith_form_gens([5,6]); q + sage: q = H.linear_combination_of_smith_form_gens([5,6]); q (1, 1, 6) - sage: p==q + sage: p == q True - sage: r=H(vector([1,1,6])); r + sage: r = H(vector([1,1,6])); r (1, 1, 6) - sage: p==r + sage: p == r True - sage: s=H(p) - sage: p==s + sage: s = H(p) + sage: p == s True Again, but now where the generators are the minimal set. Coercing a list or a vector works as before, but the default generators are different. :: - sage: G=AdditiveAbelianGroup([3,2,0], remember_generators=False) + sage: G = AdditiveAbelianGroup([3,2,0], remember_generators=False) sage: G.gens() ((2, 1, 0), (0, 0, 1)) sage: [G.0, G.1] [(2, 1, 0), (0, 0, 1)] - sage: p=5*G.0+6*G.1; p + sage: p = 5*G.0+6*G.1; p (1, 1, 6) sage: H.smith_form_gens() ((2, 1, 0), (0, 0, 1)) - sage: q=G.linear_combination_of_smith_form_gens([5,6]); q + sage: q = G.linear_combination_of_smith_form_gens([5,6]); q (1, 1, 6) - sage: p==q + sage: p == q True - sage: r=G(vector([1,1,6])); r + sage: r = G(vector([1,1,6])); r (1, 1, 6) - sage: p==r + sage: p == r True - sage: s=H(p) - sage: p==s + sage: s = H(p) + sage: p == s True """ invs = [ZZ(x) for x in invs] @@ -246,13 +246,13 @@ def _latex_(self): EXAMPLES:: - sage: G=AdditiveAbelianGroup([66, 77, 0, 0]) + sage: G = AdditiveAbelianGroup([66, 77, 0, 0]) sage: G._latex_() '\\frac{\\ZZ}{11\\ZZ} \\oplus \\frac{\\ZZ}{462\\ZZ} \\oplus \\ZZ \\oplus \\ZZ' A trivial group is represented as zero, rather than Z/1Z. :: - sage: G=AdditiveAbelianGroup([1]) + sage: G = AdditiveAbelianGroup([1]) sage: G._latex_() '0' """ @@ -378,19 +378,19 @@ def is_cyclic(self): With no common factors between the orders of the generators, the group will be cyclic. :: - sage: G=AdditiveAbelianGroup([6, 7, 55]) + sage: G = AdditiveAbelianGroup([6, 7, 55]) sage: G.is_cyclic() True Repeating primes in the orders will create a non-cyclic group. :: - sage: G=AdditiveAbelianGroup([6, 15, 21, 33]) + sage: G = AdditiveAbelianGroup([6, 15, 21, 33]) sage: G.is_cyclic() False A trivial group is trivially cyclic. :: - sage: T=AdditiveAbelianGroup([1]) + sage: T = AdditiveAbelianGroup([1]) sage: T.is_cyclic() True """ diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 34c7deaba9c..27269f779fe 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -1241,9 +1241,9 @@ def annular_khovanov_complex(self, qagrad=None, ring=IntegerRing()): EXAMPLES:: - sage: B=BraidGroup(3) - sage: b=B([1,-2,1,-2]) - sage: C=b.annular_khovanov_complex() + sage: B = BraidGroup(3) + sage: b = B([1,-2,1,-2]) + sage: C = b.annular_khovanov_complex() sage: C {(-5, -1): Chain complex with at most 1 nonzero terms over Integer Ring, (-3, -3): Chain complex with at most 1 nonzero terms over Integer Ring, @@ -1262,7 +1262,7 @@ def annular_khovanov_complex(self, qagrad=None, ring=IntegerRing()): TESTS:: - sage: C=BraidGroup(2)([]).annular_khovanov_complex() + sage: C = BraidGroup(2)([]).annular_khovanov_complex() sage: {qa: C[qa].homology() for qa in C} {(-2, -2): {0: Z}, (0, 0): {0: Z x Z}, (2, 2): {0: Z}} @@ -1272,11 +1272,10 @@ def annular_khovanov_complex(self, qagrad=None, ring=IntegerRing()): [1] [1], 0: []} - """ if qagrad is None: - return {qa: self._annular_khovanov_complex_cached(qa,ring) for qa in self._enhanced_states()} - return self._annular_khovanov_complex_cached(qagrad,ring) + return {qa: self._annular_khovanov_complex_cached(qa, ring) for qa in self._enhanced_states()} + return self._annular_khovanov_complex_cached(qagrad, ring) def annular_khovanov_homology(self, qagrad=None, ring=IntegerRing()): r""" diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py index 0a824d09cd1..a4eb94fa170 100644 --- a/src/sage/groups/finitely_presented.py +++ b/src/sage/groups/finitely_presented.py @@ -591,9 +591,9 @@ def gap(self): EXAMPLES:: - sage: F.=FreeGroup() - sage: G=F/[a*a,b*b] - sage: k=G.rewriting_system() + sage: F. = FreeGroup() + sage: G = F/[a*a,b*b] + sage: k = G.rewriting_system() sage: k.gap() Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules [ [ a^2, ], [ a*A, ], @@ -839,10 +839,10 @@ def _latex_(self): TESTS:: - sage: F=FreeGroup(4) + sage: F = FreeGroup(4) sage: F.inject_variables() Defining x0, x1, x2, x3 - sage: G=F.quotient([x0*x2, x3*x1*x3, x2*x1*x2]) + sage: G = F.quotient([x0*x2, x3*x1*x3, x2*x1*x2]) sage: G._latex_() '\\langle x_{0}, x_{1}, x_{2}, x_{3} \\mid x_{0}\\cdot x_{2} , x_{3}\\cdot x_{1}\\cdot x_{3} , x_{2}\\cdot x_{1}\\cdot x_{2}\\rangle' """ diff --git a/src/sage/groups/free_group.py b/src/sage/groups/free_group.py index 68c0f909bf0..2846028b5e7 100644 --- a/src/sage/groups/free_group.py +++ b/src/sage/groups/free_group.py @@ -404,17 +404,17 @@ def fox_derivative(self, gen, im_gens=None, ring=None): If ``im_gens`` is given, the images of the generators are mapped to them:: - sage: F=FreeGroup(3) - sage: a=F([2,1,3,-1,2]) + sage: F = FreeGroup(3) + sage: a = F([2,1,3,-1,2]) sage: a.fox_derivative(F([1])) x1 - x1*x0*x2*x0^-1 - sage: R.=LaurentPolynomialRing(ZZ) + sage: R. = LaurentPolynomialRing(ZZ) sage: a.fox_derivative(F([1]),[t,t,t]) t - t^2 - sage: S.=LaurentPolynomialRing(ZZ) + sage: S. = LaurentPolynomialRing(ZZ) sage: a.fox_derivative(F([1]),[t1,t2,t3]) -t2*t3 + t2 - sage: R.=QQ[] + sage: R. = QQ[] sage: a.fox_derivative(F([1]),[x,y,z]) -y*z + y sage: a.inverse().fox_derivative(F([1]),[x,y,z]) @@ -435,11 +435,11 @@ def fox_derivative(self, gen, im_gens=None, ring=None): TESTS:: - sage: F=FreeGroup(3) - sage: a=F([]) + sage: F = FreeGroup(3) + sage: a = F([]) sage: a.fox_derivative(F([1])) 0 - sage: R.=LaurentPolynomialRing(ZZ) + sage: R. = LaurentPolynomialRing(ZZ) sage: a.fox_derivative(F([1]),[t,t,t]) 0 """ @@ -943,9 +943,9 @@ def quotient(self, relations, **kwds): Relations are converted to the free group, even if they are not elements of it (if possible) :: - sage: F1.=FreeGroup() - sage: F2.=FreeGroup() - sage: r=a*b/a + sage: F1. = FreeGroup() + sage: F2. = FreeGroup() + sage: r = a*b/a sage: r.parent() Free Group on generators {a, b} sage: F1/[r] diff --git a/src/sage/groups/generic.py b/src/sage/groups/generic.py index e1f13a2994c..de015974697 100644 --- a/src/sage/groups/generic.py +++ b/src/sage/groups/generic.py @@ -159,14 +159,12 @@ def multiple(a, n, operation='*', identity=None, inverse=None, op=None): sage: multiple(1,10^1000) 1 - sage: E=EllipticCurve('389a1') - sage: P=E(-1,1) + sage: E = EllipticCurve('389a1') + sage: P = E(-1,1) sage: multiple(P,10,'+') (645656132358737542773209599489/22817025904944891235367494656 : 525532176124281192881231818644174845702936831/3446581505217248068297884384990762467229696 : 1) sage: multiple(P,-10,'+') (645656132358737542773209599489/22817025904944891235367494656 : -528978757629498440949529703029165608170166527/3446581505217248068297884384990762467229696 : 1) - - """ from operator import inv, mul, neg, add @@ -254,8 +252,8 @@ class multiples: sage: list(multiples(1,10,100)) [100, 101, 102, 103, 104, 105, 106, 107, 108, 109] - sage: E=EllipticCurve('389a1') - sage: P=E(-1,1) + sage: E = EllipticCurve('389a1') + sage: P = E(-1,1) sage: for Q in multiples(P,5): print((Q, Q.height()/P.height())) ((0 : 1 : 0), 0.000000000000000) ((-1 : 1 : 1), 1.00000000000000) @@ -263,7 +261,7 @@ class multiples: ((26/361 : -5720/6859 : 1), 9.00000000000000) ((47503/16641 : 9862190/2146689 : 1), 16.0000000000000) - sage: R.=ZZ[] + sage: R. = ZZ[] sage: list(multiples(x,5)) [0, x, 2*x, 3*x, 4*x] sage: list(multiples(x,5,operation='*')) @@ -408,8 +406,8 @@ def bsgs(a, b, bounds, operation='*', identity=None, inverse=None, op=None): sage: bsgs(b, a, (0,36)) 20 - sage: p=next_prime(10^20) - sage: a=Mod(2,p); b=a^(10^25) + sage: p = next_prime(10^20) + sage: a = Mod(2,p); b = a^(10^25) sage: bsgs(a, b, (10^25-10^6,10^25+10^6)) == 10^25 True @@ -419,8 +417,8 @@ def bsgs(a, b, bounds, operation='*', identity=None, inverse=None, op=None): sage: bsgs(a, b, (0,K.order()-1)) 210 - sage: K.=CyclotomicField(230) - sage: w=z^500 + sage: K. = CyclotomicField(230) + sage: w = z^500 sage: bsgs(z,w,(0,229)) 40 @@ -735,8 +733,8 @@ def discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, i sage: v.log(w) 0 - sage: K.=CyclotomicField(230) - sage: w=z^50 + sage: K. = CyclotomicField(230) + sage: w = z^50 sage: discrete_log(w,z) 50 @@ -766,14 +764,14 @@ def discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, i An additive example: elliptic curve DLOG:: - sage: F=GF(37^2,'a') - sage: E=EllipticCurve(F,[1,1]) - sage: F.=GF(37^2,'a') - sage: E=EllipticCurve(F,[1,1]) - sage: P=E(25*a + 16 , 15*a + 7 ) + sage: F = GF(37^2,'a') + sage: E = EllipticCurve(F,[1,1]) + sage: F. = GF(37^2,'a') + sage: E = EllipticCurve(F,[1,1]) + sage: P = E(25*a + 16 , 15*a + 7 ) sage: P.order() 672 - sage: Q=39*P; Q + sage: Q = 39*P; Q (36*a + 32 : 5*a + 12 : 1) sage: discrete_log(Q,P,P.order(),operation='+') 39 @@ -975,10 +973,10 @@ def linear_relation(P, Q, operation='+', identity=None, inverse=None, op=None): An additive example (in an elliptic curve group):: - sage: F.=GF(3^6,'a') - sage: E=EllipticCurve([a^5 + 2*a^3 + 2*a^2 + 2*a, a^4 + a^3 + 2*a + 1]) - sage: P=E(a^5 + a^4 + a^3 + a^2 + a + 2 , 0) - sage: Q=E(2*a^3 + 2*a^2 + 2*a , a^3 + 2*a^2 + 1) + sage: F. = GF(3^6,'a') + sage: E = EllipticCurve([a^5 + 2*a^3 + 2*a^2 + 2*a,a^4 + a^3 + 2*a + 1]) + sage: P = E(a^5 + a^4 + a^3 + a^2 + a + 2 , 0) + sage: Q = E(2*a^3 + 2*a^2 + 2*a , a^3 + 2*a^2 + 1) sage: linear_relation(P,Q,'+') (1, 2) sage: P == 2*Q @@ -986,11 +984,11 @@ def linear_relation(P, Q, operation='+', identity=None, inverse=None, op=None): A multiplicative example (in a finite field's multiplicative group):: - sage: F.=GF(3^6,'a') + sage: F. = GF(3^6,'a') sage: a.multiplicative_order().factor() 2^3 * 7 * 13 - sage: b=a^7 - sage: c=a^13 + sage: b = a^7 + sage: c = a^13 sage: linear_relation(b,c,'*') (13, 7) sage: b^13==c^7 @@ -1091,14 +1089,14 @@ def order_from_multiple(P, m, plist=None, factorization=None, check=True, sage: order_from_multiple(Q, M, factorization=F, operation='+') 7 - sage: K.=CyclotomicField(230) - sage: w=z^50 + sage: K. = CyclotomicField(230) + sage: w = z^50 sage: order_from_multiple(w,230,operation='*') 23 - sage: F=GF(2^1279,'a') - sage: n=F.cardinality()-1 # Mersenne prime - sage: order_from_multiple(F.random_element(),n,factorization=[(n,1)],operation='*')==n + sage: F = GF(2^1279,'a') + sage: n = F.cardinality()-1 # Mersenne prime + sage: order_from_multiple(F.random_element(),n,factorization=[(n,1)],operation='*') == n True sage: K. = GF(3^60) @@ -1228,10 +1226,9 @@ def order_from_bounds(P, bounds, d=None, operation='+', 3227 sage: K.=CyclotomicField(230) - sage: w=z^50 + sage: w = z^50 sage: order_from_bounds(w,(200,250),operation='*') 23 - """ from operator import mul, add @@ -1302,11 +1299,11 @@ def merge_points(P1, P2, operation='+', sage: od == lcm(ob,oc) True - sage: E=EllipticCurve([a^5 + 2*a^3 + 2*a^2 + 2*a, a^4 + a^3 + 2*a + 1]) - sage: P=E(2*a^5 + 2*a^4 + a^3 + 2 , a^4 + a^3 + a^2 + 2*a + 2) + sage: E = EllipticCurve([a^5 + 2*a^3 + 2*a^2 + 2*a,a^4 + a^3 + 2*a + 1]) + sage: P = E(2*a^5 + 2*a^4 + a^3 + 2 , a^4 + a^3 + a^2 + 2*a + 2) sage: P.order() 7 - sage: Q=E(2*a^5 + 2*a^4 + 1 , a^5 + 2*a^3 + 2*a + 2 ) + sage: Q = E(2*a^5 + 2*a^4 + 1 , a^5 + 2*a^3 + 2*a + 2 ) sage: Q.order() 4 sage: R,m = merge_points((P,7),(Q,4), operation='+') @@ -1402,7 +1399,7 @@ def structure_description(G, latex=False): Works for finitely presented groups (:trac:`17573`):: sage: F. = FreeGroup() - sage: G=F / [x^2*y^-1, x^3*y^2, x*y*x^-1*y^-1] + sage: G = F / [x^2*y^-1, x^3*y^2, x*y*x^-1*y^-1] sage: G.structure_description() 'C7' diff --git a/src/sage/groups/libgap_mixin.py b/src/sage/groups/libgap_mixin.py index 018d438fffe..b51679410e1 100644 --- a/src/sage/groups/libgap_mixin.py +++ b/src/sage/groups/libgap_mixin.py @@ -752,7 +752,7 @@ def is_isomorphic(self, H): True sage: F.is_isomorphic(H) True - sage: F==G, G==H, F==H + sage: F == G, G == H, F == H (False, False, False) """ return self.gap().IsomorphismGroups(H.gap()) != libgap.fail diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py index a87658e746d..a6d3dc02513 100644 --- a/src/sage/groups/matrix_gps/finitely_generated.py +++ b/src/sage/groups/matrix_gps/finitely_generated.py @@ -600,9 +600,9 @@ def as_permutation_group(self, algorithm=None, seed=None): TESTS:: - sage: A= matrix(QQ, 2, [0, 1, 1, 0]) - sage: B= matrix(QQ, 2, [1, 0, 0, 1]) - sage: a, b= MatrixGroup([A, B]).as_permutation_group().gens() + sage: A = matrix(QQ, 2, [0, 1, 1, 0]) + sage: B = matrix(QQ, 2, [1, 0, 0, 1]) + sage: a, b = MatrixGroup([A, B]).as_permutation_group().gens() sage: a.order(), b.order() (2, 1) @@ -737,7 +737,7 @@ def invariant_generators(self): sage: MS = MatrixSpace(F,2,2) sage: g1 = MS([[1/a, 1/a], [1/a, -1/a]]) sage: g2 = MS([[-b, 0], [0, b]]) - sage: G=MatrixGroup([g1,g2]) + sage: G = MatrixGroup([g1,g2]) sage: G.invariant_generators() [x1^4 + 2*x1^2*x2^2 + x2^4, x1^5*x2 - x1*x2^5, diff --git a/src/sage/groups/matrix_gps/orthogonal.py b/src/sage/groups/matrix_gps/orthogonal.py index d457890eeda..f6721afaacd 100644 --- a/src/sage/groups/matrix_gps/orthogonal.py +++ b/src/sage/groups/matrix_gps/orthogonal.py @@ -389,7 +389,7 @@ def SO(n, R, e=None, var='a', invariant_form=None): Using the ``invariant_form`` option:: sage: CF3 = CyclotomicField(3); e3 = CF3.gen() - sage: m=matrix(CF3, 3,3, [[1,e3,0],[e3,2,0],[0,0,1]]) + sage: m = matrix(CF3, 3,3, [[1,e3,0],[e3,2,0],[0,0,1]]) sage: SO3 = SO(3, CF3) sage: SO3m = SO(3, CF3, invariant_form=m) sage: SO3 == SO3m @@ -454,7 +454,7 @@ class OrthogonalMatrixGroup_generic(NamedMatrixGroup_generic): \text{SO}_{3}(\Bold{F}_{5}) sage: CF3 = CyclotomicField(3); e3 = CF3.gen() - sage: m=matrix(CF3, 3,3, [[1,e3,0],[e3,2,0],[0,0,1]]) + sage: m = matrix(CF3, 3,3, [[1,e3,0],[e3,2,0],[0,0,1]]) sage: G = SO(3, CF3, invariant_form=m) sage: latex(G) \text{SO}_{3}(\Bold{Q}(\zeta_{3}))\text{ with respect to non positive definite symmetric form }\left(\begin{array}{rrr} diff --git a/src/sage/groups/matrix_gps/unitary.py b/src/sage/groups/matrix_gps/unitary.py index d51b92e8976..5b86998a460 100644 --- a/src/sage/groups/matrix_gps/unitary.py +++ b/src/sage/groups/matrix_gps/unitary.py @@ -211,7 +211,7 @@ def GU(n, R, var='a', invariant_form=None): Using the ``invariant_form`` option:: sage: UCF = UniversalCyclotomicField(); e5=UCF.gen(5) - sage: m=matrix(UCF, 3,3, [[1,e5,0],[e5.conjugate(),2,0],[0,0,1]]) + sage: m = matrix(UCF, 3,3, [[1,e5,0],[e5.conjugate(),2,0],[0,0,1]]) sage: G = GU(3, UCF) sage: Gm = GU(3, UCF, invariant_form=m) sage: G == Gm @@ -311,7 +311,7 @@ def SU(n, R, var='a', invariant_form=None): Using the ``invariant_form`` option:: sage: CF3 = CyclotomicField(3); e3 = CF3.gen() - sage: m=matrix(CF3, 3,3, [[1,e3,0],[e3.conjugate(),2,0],[0,0,1]]) + sage: m = matrix(CF3, 3,3, [[1,e3,0],[e3.conjugate(),2,0],[0,0,1]]) sage: G = SU(3, CF3) sage: Gm = SU(3, CF3, invariant_form=m) sage: G == Gm @@ -373,7 +373,7 @@ class UnitaryMatrixGroup_generic(NamedMatrixGroup_generic): \text{SU}_{3}(\Bold{F}_{5^{2}}) sage: CF3 = CyclotomicField(3); e3 = CF3.gen() - sage: m=matrix(CF3, 3,3, [[1,e3,0],[e3.conjugate(),2,0],[0,0,1]]) + sage: m = matrix(CF3, 3,3, [[1,e3,0],[e3.conjugate(),2,0],[0,0,1]]) sage: G = SU(3, CF3, invariant_form=m) sage: latex(G) \text{SU}_{3}(\Bold{Q}(\zeta_{3}))\text{ with respect to positive definite hermitian form }\left(\begin{array}{rrr} diff --git a/src/sage/groups/perm_gps/partn_ref/refinement_binary.pyx b/src/sage/groups/perm_gps/partn_ref/refinement_binary.pyx index 541cf8ddd23..5f54d4f8ac2 100644 --- a/src/sage/groups/perm_gps/partn_ref/refinement_binary.pyx +++ b/src/sage/groups/perm_gps/partn_ref/refinement_binary.pyx @@ -153,7 +153,7 @@ cdef class LinearBinaryCodeStruct(BinaryCodeStruct): sage: B.automorphism_group()[1] 2304 - sage: M=Matrix(GF(2),[\ + sage: M = Matrix(GF(2),[\ ....: [1,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0],\ ....: [0,1,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0],\ ....: [0,0,1,0,0,1,1,1,1,0,0,1,0,0,0,0,0],\ @@ -177,7 +177,7 @@ cdef class LinearBinaryCodeStruct(BinaryCodeStruct): sage: B.automorphism_group()[1] 2160 - sage: M=Matrix(GF(2),[\ + sage: M = Matrix(GF(2),[\ ....: [0,1,0,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,0,1],\ ....: [1,0,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,0,1,0],\ ....: [0,1,1,1,0,0,0,1,0,0,1,1,0,0,0,1,1,1,0,1,0,0],\ diff --git a/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx b/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx index bf87e5bde7a..c7607a1b153 100644 --- a/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +++ b/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx @@ -338,7 +338,7 @@ def search_tree(G_in, partition, lab=True, dig=False, dict_rep=False, certificat sage: D2 = DiGraph({1:[2],2:[1],0:[0]}, loops=True) sage: a,b = st(D1, [D1.vertices()], dig=True, use_indicator_function=False) sage: c,d = st(D2, [D2.vertices()], dig=True, use_indicator_function=False) - sage: b==d + sage: b == d True This example is due to Chris Godsil:: diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index 89b451be9ae..c94accc1360 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -215,7 +215,7 @@ def direct_product_permgroups(P): sage: D.order() 1728 sage: D = direct_product_permgroups([G1]) - sage: D==G1 + sage: D == G1 True sage: direct_product_permgroups([]) Symmetric group of order 0! as a permutation group @@ -911,7 +911,7 @@ def _coerce_map_from_(self, G): sage: MG = GU(3,2).as_matrix_group() sage: PG = MG.as_permutation_group() - sage: f=PG._coerce_map_from_(MG) + sage: f = PG._coerce_map_from_(MG) sage: mg = MG.an_element() sage: p = f(mg); p (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60) @@ -2307,7 +2307,7 @@ def socle(self): EXAMPLES:: - sage: G=SymmetricGroup(4) + sage: G = SymmetricGroup(4) sage: G.socle() Subgroup generated by [(1,2)(3,4), (1,4)(2,3)] of (Symmetric group of order 4! as a permutation group) sage: G.socle().socle() @@ -2324,10 +2324,10 @@ def frattini_subgroup(self): EXAMPLES:: - sage: G=PermutationGroup([[(1,2,3,4)],[(2,4)]]) + sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]]) sage: G.frattini_subgroup() Subgroup generated by [(1,3)(2,4)] of (Permutation Group with generators [(2,4), (1,2,3,4)]) - sage: G=SymmetricGroup(4) + sage: G = SymmetricGroup(4) sage: G.frattini_subgroup() Subgroup generated by [()] of (Symmetric group of order 4! as a permutation group) @@ -2343,10 +2343,10 @@ def fitting_subgroup(self): EXAMPLES:: - sage: G=PermutationGroup([[(1,2,3,4)],[(2,4)]]) + sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]]) sage: G.fitting_subgroup() Subgroup generated by [(2,4), (1,2,3,4), (1,3)] of (Permutation Group with generators [(2,4), (1,2,3,4)]) - sage: G=PermutationGroup([[(1,2,3,4)],[(1,2)]]) + sage: G = PermutationGroup([[(1,2,3,4)],[(1,2)]]) sage: G.fitting_subgroup() Subgroup generated by [(1,2)(3,4), (1,3)(2,4)] of (Permutation Group with generators [(1,2), (1,2,3,4)]) @@ -2362,13 +2362,12 @@ def solvable_radical(self): EXAMPLES:: - sage: G=SymmetricGroup(4) + sage: G = SymmetricGroup(4) sage: G.solvable_radical() Subgroup generated by [(1,2), (1,2,3,4)] of (Symmetric group of order 4! as a permutation group) - sage: G=SymmetricGroup(5) + sage: G = SymmetricGroup(5) sage: G.solvable_radical() Subgroup generated by [()] of (Symmetric group of order 5! as a permutation group) - """ return self.subgroup(gap_group=self._libgap_().RadicalGroup()) @@ -2610,9 +2609,9 @@ def direct_product(self, other, maps=True): From: Permutation Group with generators [(5,6,7,8), (1,2,3,4)] To: Cyclic group of order 4 as a permutation group Defn: Projection( Group( [ (1,2,3,4), (5,6,7,8) ] ), 2 ) - sage: g=D([(1,3),(2,4)]); g + sage: g = D([(1,3),(2,4)]); g (1,3)(2,4) - sage: d=D([(1,4,3,2),(5,7),(6,8)]); d + sage: d = D([(1,4,3,2),(5,7),(6,8)]); d (1,4,3,2)(5,7)(6,8) sage: iota1(g); iota2(g); pr1(d); pr2(d) (1,3)(2,4) @@ -3863,7 +3862,7 @@ def cosets(self, S, side='right'): The subgroup argument is checked to see if it is a permutation group. Even a legitimate GAP object can be rejected. :: - sage: G=SymmetricGroup(3) + sage: G = SymmetricGroup(3) sage: G.cosets(gap(3)) Traceback (most recent call last): ... diff --git a/src/sage/groups/perm_gps/permgroup_element.pyx b/src/sage/groups/perm_gps/permgroup_element.pyx index 2c4977a8a84..037884f55da 100644 --- a/src/sage/groups/perm_gps/permgroup_element.pyx +++ b/src/sage/groups/perm_gps/permgroup_element.pyx @@ -1557,7 +1557,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): sage: prod(primes(150)) 1492182350939279320058875736615841068547583863326864530410 sage: L = [tuple(range(sum(primes(p))+1, sum(primes(p))+1+p)) for p in primes(150)] - sage: t=PermutationGroupElement(L).multiplicative_order(); t + sage: t = PermutationGroupElement(L).multiplicative_order(); t 1492182350939279320058875736615841068547583863326864530410 sage: type(t) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index deb7e9c4657..ec6582c585b 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -837,7 +837,7 @@ class DiCyclicGroup(PermutationGroup_unique): A large generalized quaternion group (order is a power of 2):: sage: n = 2^10 - sage: G=DiCyclicGroup(n) + sage: G = DiCyclicGroup(n) sage: G.order() 4096 sage: a = G.gen(0) @@ -857,7 +857,7 @@ class DiCyclicGroup(PermutationGroup_unique): subgroup of order 2 (thus has the unique element of order 2 as its non-identity element). :: - sage: G=DiCyclicGroup(3*5*4) + sage: G = DiCyclicGroup(3*5*4) sage: G.order() 240 sage: two = [g for g in G if g.order()==2]; two @@ -1141,11 +1141,12 @@ def _repr_(self): r""" EXAMPLES:: - sage: Q=QuaternionGroup(); Q + sage: Q = QuaternionGroup(); Q Quaternion group of order 8 as a permutation group """ return "Quaternion group of order 8 as a permutation group" + class GeneralDihedralGroup(PermutationGroup_generic): r""" The Generalized Dihedral Group generated by the abelian group with From 2e393518fd9d5a510c0585bb7a49ee7eca6f73cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 8 Jul 2022 10:38:51 +0200 Subject: [PATCH 229/416] some doc polishing in symbolic/ --- src/sage/symbolic/assumptions.py | 9 ++-- src/sage/symbolic/benchmark.py | 14 ++--- src/sage/symbolic/expression.pyx | 58 ++++++++++----------- src/sage/symbolic/expression_conversions.py | 8 +-- src/sage/symbolic/operators.py | 17 +++--- src/sage/symbolic/relation.py | 16 +++--- src/sage/symbolic/ring.pyx | 2 +- src/sage/symbolic/series_impl.pxi | 17 +++--- 8 files changed, 67 insertions(+), 74 deletions(-) diff --git a/src/sage/symbolic/assumptions.py b/src/sage/symbolic/assumptions.py index 522edd5ecd3..706de96005d 100644 --- a/src/sage/symbolic/assumptions.py +++ b/src/sage/symbolic/assumptions.py @@ -939,12 +939,11 @@ def __init__(self, *args, **kwds): EXAMPLES:: sage: forget() - sage: foo=assuming(x>0) + sage: foo = assuming(x>0) sage: foo.Ass (x > 0,) sage: bool(x>-1) False - """ self.replace=kwds.pop("replace",False) self.Ass=args @@ -954,7 +953,7 @@ def __enter__(self): EXAMPLES:: sage: forget() - sage: foo=assuming(x>0) + sage: foo = assuming(x>0) sage: bool(x>-1) False sage: foo.__enter__() @@ -963,7 +962,6 @@ def __enter__(self): sage: foo.__exit__() sage: bool(x>-1) False - """ if self.replace: self.OldAss=assumptions() @@ -975,7 +973,7 @@ def __exit__(self, *args, **kwds): EXAMPLES:: sage: forget() - sage: foo=assuming(x>0) + sage: foo = assuming(x>0) sage: bool(x>-1) False sage: foo.__enter__() @@ -985,7 +983,6 @@ def __exit__(self, *args, **kwds): sage: bool(x>-1) False sage: forget() - """ if self.replace: forget(assumptions()) diff --git a/src/sage/symbolic/benchmark.py b/src/sage/symbolic/benchmark.py index 720b700255f..66d8217e315 100644 --- a/src/sage/symbolic/benchmark.py +++ b/src/sage/symbolic/benchmark.py @@ -32,7 +32,7 @@ Problem R4:: - sage: u=[e,pi,sqrt(2)]; Tuples(u,3).cardinality() + sage: u = [e,pi,sqrt(2)]; Tuples(u,3).cardinality() 27 Problem R5:: @@ -64,7 +64,6 @@ sage: a = [random() + random()*I for w in [0..100]] sage: a.sort() - Problem W3:: sage: acos(cos(x)) @@ -72,26 +71,23 @@ PROBLEM S1:: - sage: _=var('x,y,z') + sage: _ = var('x,y,z') sage: f = (x+y+z+1)^10 sage: g = expand(f*(f+1)) - PROBLEM S2:: - sage: _=var('x,y') + sage: _ = var('x,y') sage: a = expand((x^sin(x) + y^cos(y) - z^(x+y))^100) PROBLEM S3:: - sage: _=var('x,y,z') + sage: _ = var('x,y,z') sage: f = expand((x^y + y^z + z^x)^50) sage: g = f.diff(x) PROBLEM S4:: - w = (sin(x)*cos(x)).series(x,400) - - + sage: w = (sin(x)*cos(x)).series(x,400) """ diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index eecf2951e0b..87fdb75d106 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -122,11 +122,11 @@ Test if comparison bugs from :trac:`6256` are fixed:: Test if :trac:`9947` is fixed:: - sage: r=real_part(1+2*(sqrt(2)+1)*(sqrt(2)-1)); r + sage: r = real_part(1+2*(sqrt(2)+1)*(sqrt(2)-1)); r 2*(sqrt(2) + 1)*(sqrt(2) - 1) + 1 sage: r.expand() 3 - sage: a=(sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/ (sqrt(3) + 5) + sage: a = (sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/ (sqrt(3) + 5) sage: a.real_part() 4*sqrt(3)/(sqrt(3) + 5) sage: a.imag_part() @@ -890,7 +890,7 @@ cdef class Expression(Expression_abc): Check that user-defined functions get the same treatment (:trac:`19194`):: - sage: f=function('f')(x) + sage: f = function('f')(x) sage: f._dbgprinttree() function f ... x (symbol) ... @@ -2127,7 +2127,7 @@ cdef class Expression(Expression_abc): sage: num_vars = 10; max_order=7 sage: X = var(' '.join('x' + str(i) for i in range(num_vars))) sage: f = function('f')(*X) - sage: hashes=set() + sage: hashes = set() sage: for length in range(1,max_order+1): # long time (4s on sage.math, 2012) ....: for s in UnorderedTuples(X, length): ....: deriv = f.diff(*s) @@ -2406,7 +2406,7 @@ cdef class Expression(Expression_abc): sage: forget() sage: n = var('n') - sage: foo=sin((-1)*n*pi) + sage: foo = sin((-1)*n*pi) sage: foo.simplify() -sin(pi*n) sage: assume(n, 'odd') @@ -3590,11 +3590,11 @@ cdef class Expression(Expression_abc): Check that :trac:`18896` is fixed:: - sage: m=540579833922455191419978421211010409605356811833049025*sqrt(1/2) - sage: m1=382247666339265723780973363167714496025733124557617743 - sage: (m==m1).test_relation(domain=QQbar) + sage: m = 540579833922455191419978421211010409605356811833049025*sqrt(1/2) + sage: m1 = 382247666339265723780973363167714496025733124557617743 + sage: (m == m1).test_relation(domain=QQbar) False - sage: (m==m1).test_relation() + sage: (m == m1).test_relation() False Try the examples from :trac:`31424` and :trac:`31665`:: @@ -4467,7 +4467,7 @@ cdef class Expression(Expression_abc): True sage: float((24*sqrt(3))^(100/51)) 1493.0092154... - sage: t=((1/10)*I/pi)^(3/2) + sage: t = ((1/10)*I/pi)^(3/2) sage: t^2 -1/1000*I/pi^3 sage: (2*pi)^QQ(2) @@ -5039,11 +5039,10 @@ cdef class Expression(Expression_abc): Check that ticket :trac:`7472` is fixed (Taylor polynomial in more variables):: - sage: x,y=var('x y'); taylor(x*y^3,(x,1),(y,1),4) + sage: x,y = var('x y'); taylor(x*y^3,(x,1),(y,1),4) (x - 1)*(y - 1)^3 + 3*(x - 1)*(y - 1)^2 + (y - 1)^3 + 3*(x - 1)*(y - 1) + 3*(y - 1)^2 + x + 3*y - 3 sage: expand(_) x*y^3 - """ from sage.rings.integer import Integer from sage.symbolic.ring import SR @@ -5326,8 +5325,8 @@ cdef class Expression(Expression_abc): EXAMPLES:: - sage: y=var('y') - sage: f=sin(x)*cos(x)^3+sin(y)^2 + sage: y = var('y') + sage: f = sin(x)*cos(x)^3+sin(y)^2 sage: f.reduce_trig() -1/2*cos(2*y) + 1/8*sin(4*x) + 1/4*sin(2*x) + 1/2 @@ -7056,14 +7055,14 @@ cdef class Expression(Expression_abc): Series coefficients are now handled correctly (:trac:`17399`):: - sage: s=(1/(1-x)).series(x,6); s + sage: s = (1/(1-x)).series(x,6); s 1 + 1*x + 1*x^2 + 1*x^3 + 1*x^4 + 1*x^5 + Order(x^6) sage: s.coefficients() [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5]] sage: s.coefficients(x, sparse=False) [1, 1, 1, 1, 1, 1] sage: x,y = var("x,y") - sage: s=(1/(1-y*x-x)).series(x,3); s + sage: s = (1/(1-y*x-x)).series(x,3); s 1 + (y + 1)*x + ((y + 1)^2)*x^2 + Order(x^3) sage: s.coefficients(x, sparse=False) [1, y + 1, (y + 1)^2] @@ -7151,7 +7150,7 @@ cdef class Expression(Expression_abc): -2*sqrt(2)*a*x + 2*a^2 + x^2 + x + 1 sage: p.list(a) [x^2 + x + 1, -2*sqrt(2)*x, 2] - sage: s=(1/(1-x)).series(x,6); s + sage: s = (1/(1-x)).series(x,6); s 1 + 1*x + 1*x^2 + 1*x^3 + 1*x^4 + 1*x^5 + Order(x^6) sage: s.list() [1, 1, 1, 1, 1, 1] @@ -7160,7 +7159,7 @@ cdef class Expression(Expression_abc): def leading_coefficient(self, s): """ - Return the leading coefficient of s in self. + Return the leading coefficient of ``s`` in ``self``. EXAMPLES:: @@ -7739,8 +7738,8 @@ cdef class Expression(Expression_abc): Fraction Field of Univariate Polynomial Ring in x over Symbolic Ring sage: parent(((pi+sqrt(2))/x).fraction(SR)) Fraction Field of Univariate Polynomial Ring in x over Symbolic Ring - sage: y=var('y') - sage: fr=((3*x^5 - 5*y^5)^7/(x*y)).fraction(GF(7)); fr + sage: y = var('y') + sage: fr = ((3*x^5 - 5*y^5)^7/(x*y)).fraction(GF(7)); fr (3*x^35 + 2*y^35)/(x*y) sage: parent(fr) Fraction Field of Multivariate Polynomial Ring in x, y over Finite Field of size 7 @@ -10997,12 +10996,11 @@ cdef class Expression(Expression_abc): In some cases we do not want to expand:: - sage: f=tan(3*x) + sage: f = tan(3*x) sage: f.simplify_trig() -(4*cos(x)^2 - 1)*sin(x)/(4*cos(x)*sin(x)^2 - cos(x)) sage: f.simplify_trig(False) sin(3*x)/cos(3*x) - """ # much better to expand first, since it often doesn't work # right otherwise! @@ -11066,7 +11064,7 @@ cdef class Expression(Expression_abc): combine logarithm and the rational function into one fraction:: - sage: f=(x^2-1)/(x+1)-ln(x)/(x+2) + sage: f = (x^2-1)/(x+1)-ln(x)/(x+2) sage: f.simplify_rational() (x^2 + x - log(x) - 2)/(x + 2) sage: f.simplify_rational(map=True) @@ -11086,7 +11084,7 @@ cdef class Expression(Expression_abc): With option ``algorithm='noexpand'`` we only convert to common denominators and add. No expansion of products is performed:: - sage: f=1/(x+1)+x/(x+2)^2 + sage: f = 1/(x+1)+x/(x+2)^2 sage: f.simplify_rational() (2*x^2 + 5*x + 4)/(x^3 + 5*x^2 + 8*x + 4) sage: f.simplify_rational(algorithm='noexpand') @@ -11487,7 +11485,7 @@ cdef class Expression(Expression_abc): EXAMPLES:: - sage: x,y,t=var('x y t') + sage: x,y,t = var('x y t') Only two first terms are contracted in the following example; the logarithm with coefficient `\frac{1}{2}` is not contracted:: @@ -11741,7 +11739,7 @@ cdef class Expression(Expression_abc): sage: var("j,k,p,q", domain="integer") (j, k, p, q) - sage: X,Y,Z,f,g=function("X,Y,Z,f,g") + sage: X,Y,Z,f,g = function("X,Y,Z,f,g") sage: var("x,a,b") (x, a, b) sage: sum(X(j)+Y(j),j,1,p) @@ -12225,7 +12223,7 @@ cdef class Expression(Expression_abc): sage: var('f6,f5,f4,x') (f6, f5, f4, x) - sage: e=15*f6*x^2 + 5*f5*x + f4 + sage: e = 15*f6*x^2 + 5*f5*x + f4 sage: res = e.roots(x); res [(-1/30*(5*f5 + sqrt(25*f5^2 - 60*f4*f6))/f6, 1), (-1/30*(5*f5 - sqrt(25*f5^2 - 60*f4*f6))/f6, 1)] sage: e.subs(x=res[0][0]).is_zero() @@ -12353,7 +12351,7 @@ cdef class Expression(Expression_abc): but you can substitute them with specific integer values:: sage: x,y,z = var('x,y,z') - sage: sol=solve_diophantine(x^2-y==0); sol + sage: sol = solve_diophantine(x^2-y==0); sol (t, t^2) sage: [(sol[0].subs(t=t),sol[1].subs(t=t)) for t in range(-3,4)] [(-3, 9), (-2, 4), (-1, 1), (0, 0), (1, 1), (2, 4), (3, 9)] @@ -13114,7 +13112,7 @@ cdef class Expression(Expression_abc): x^4 + 20*x^3 + 127*x^2 + 288*x + 180 sage: (i^2).prod(i,1,7) 25401600 - sage: f=function('f') + sage: f = function('f') sage: f(i).prod(i,1,7) f(7)*f(6)*f(5)*f(4)*f(3)*f(2)*f(1) sage: f(i).prod(i,1,n) @@ -13668,7 +13666,7 @@ cpdef new_Expression(parent, x): sage: K. = QuadraticField(-3) sage: a + sin(x) I*sqrt(3) + sin(x) - sage: x=var('x'); y0,y1=PolynomialRing(ZZ,2,'y').gens() + sage: x = var('x'); y0,y1 = PolynomialRing(ZZ,2,'y').gens() sage: x+y0/y1 x + y0/y1 sage: x.subs(x=y0/y1) diff --git a/src/sage/symbolic/expression_conversions.py b/src/sage/symbolic/expression_conversions.py index 678347e42a5..5f5eb36134b 100644 --- a/src/sage/symbolic/expression_conversions.py +++ b/src/sage/symbolic/expression_conversions.py @@ -1590,8 +1590,8 @@ def polynomial(ex, base_ring=None, ring=None): sage: _.parent() Multivariate Polynomial Ring in x, y over Rational Field - sage: s,t=var('s,t') - sage: expr=t^2-2*s*t+1 + sage: s,t = var('s,t') + sage: expr = t^2-2*s*t+1 sage: expr.polynomial(None,ring=SR['t']) t^2 - 2*s*t + 1 sage: _.parent() @@ -2218,7 +2218,7 @@ def __init__(self, ex): EXAMPLES:: sage: from sage.symbolic.expression_conversions import Exponentialize - sage: d=Exponentialize(sin(x)) + sage: d = Exponentialize(sin(x)) sage: d(sin(x)) -1/2*I*e^(I*x) + 1/2*I*e^(-I*x) sage: d(cosh(x)) @@ -2261,7 +2261,7 @@ def __init__(self, ex, force=False): sage: a, b = SR.var("a, b") sage: from sage.symbolic.expression_conversions import DeMoivre - sage: d=DeMoivre(e^a) + sage: d = DeMoivre(e^a) sage: d(e^(a+I*b)) (cos(b) + I*sin(b))*e^a """ diff --git a/src/sage/symbolic/operators.py b/src/sage/symbolic/operators.py index 986ad38ad6c..52351f0867b 100644 --- a/src/sage/symbolic/operators.py +++ b/src/sage/symbolic/operators.py @@ -3,13 +3,14 @@ import operator from sage.symbolic.ring import is_SymbolicVariable, SR -def add_vararg(first,*rest): + +def add_vararg(first, *rest): r""" Addition of a variable number of arguments. INPUT: - - ``first``, ``rest`` - arguments to add + - ``first``, ``rest`` -- arguments to add OUTPUT: sum of arguments @@ -18,22 +19,22 @@ def add_vararg(first,*rest): sage: from sage.symbolic.operators import add_vararg sage: add_vararg(1,2,3,4,5,6,7) 28 - sage: F=(1+x+x^2) + sage: F = (1+x+x^2) sage: bool(F.operator()(*F.operands()) == F) True """ - for r in rest: first = first + r return first -def mul_vararg(first,*rest): + +def mul_vararg(first, *rest): r""" Multiplication of a variable number of arguments. INPUT: - - ``args`` - arguments to multiply + - ``args`` -- arguments to multiply OUTPUT: product of arguments @@ -42,15 +43,15 @@ def mul_vararg(first,*rest): sage: from sage.symbolic.operators import mul_vararg sage: mul_vararg(9,8,7,6,5,4) 60480 - sage: G=x*cos(x)*sin(x) + sage: G = x*cos(x)*sin(x) sage: bool(G.operator()(*G.operands())==G) True """ - for r in rest: first = first * r return first + arithmetic_operators = {add_vararg: '+', mul_vararg: '*', operator.add: '+', diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py index 24ded86bdf7..037d22a89f2 100644 --- a/src/sage/symbolic/relation.py +++ b/src/sage/symbolic/relation.py @@ -644,7 +644,7 @@ def solve(f, *args, **kwds): [x == 0, y == 1]] sage: solve([sqrt(x) + sqrt(y) == 5, x + y == 10], x, y) [[x == -5/2*I*sqrt(5) + 5, y == 5/2*I*sqrt(5) + 5], [x == 5/2*I*sqrt(5) + 5, y == -5/2*I*sqrt(5) + 5]] - sage: solutions=solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, solution_dict=True) + sage: solutions = solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, solution_dict=True) sage: for solution in solutions: print("{} , {}".format(solution[x].n(digits=3), solution[y].n(digits=3))) -0.500 - 0.866*I , -1.27 + 0.341*I -0.500 - 0.866*I , 1.27 - 0.341*I @@ -779,9 +779,9 @@ def solve(f, *args, **kwds): sage: solve(x^2>8,x) [[x < -2*sqrt(2)], [x > 2*sqrt(2)]] - sage: x,y=var('x,y'); (ln(x)-ln(y)>0).solve(x) + sage: x,y = var('x,y'); (ln(x)-ln(y)>0).solve(x) [[log(x) - log(y) > 0]] - sage: x,y=var('x,y'); (ln(x)>ln(y)).solve(x) # random + sage: x,y = var('x,y'); (ln(x)>ln(y)).solve(x) # random [[0 < y, y < x, 0 < x]] [[y < x, 0 < y]] @@ -871,7 +871,9 @@ def solve(f, *args, **kwds): We use ``use_grobner`` in Maxima if no solution is obtained from Maxima's ``to_poly_solve``:: - sage: x,y=var('x y'); c1(x,y)=(x-5)^2+y^2-16; c2(x,y)=(y-3)^2+x^2-9 + sage: x,y = var('x y') + sage: c1(x,y) = (x-5)^2+y^2-16 + sage: c2(x,y) = (y-3)^2+x^2-9 sage: solve([c1(x,y),c2(x,y)],[x,y]) [[x == -9/68*sqrt(55) + 135/68, y == -15/68*sqrt(55) + 123/68], [x == 9/68*sqrt(55) + 135/68, y == 15/68*sqrt(55) + 123/68]] @@ -1204,7 +1206,7 @@ def _solve_expression(f, x, explicit_solutions, multiplicities, :trac:`7491` fixed:: - sage: y=var('y') + sage: y = var('y') sage: solve(y==y,y) [y == r1] sage: solve(y==y,y,multiplicities=True) @@ -1781,7 +1783,7 @@ def solve_ineq_fourier(ineq, vars=None): EXAMPLES:: sage: from sage.symbolic.relation import solve_ineq_fourier - sage: y=var('y') + sage: y = var('y') sage: solve_ineq_fourier([x+y<9,x-y>4],[x,y]) [[y + 4 < x, x < -y + 9, y < (5/2)]] sage: solve_ineq_fourier([x+y<9,x-y>4],[y,x]) @@ -1879,7 +1881,7 @@ def solve_ineq(ineq, vars=None): System of inequalities with automatically detected inequalities:: - sage: y=var('y') + sage: y = var('y') sage: solve_ineq([x-y<0,x+y-3<0],[y,x]) [[x < y, y < -x + 3, x < (3/2)]] sage: solve_ineq([x-y<0,x+y-3<0],[x,y]) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index 0985a2217fe..bd0b89f9374 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -257,7 +257,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): sage: K. = QuadraticField(-3) sage: a + sin(x) I*sqrt(3) + sin(x) - sage: x=var('x'); y0,y1=PolynomialRing(ZZ,2,'y').gens() + sage: x = var('x'); y0,y1 = PolynomialRing(ZZ,2,'y').gens() sage: x+y0/y1 x + y0/y1 sage: x.subs(x=y0/y1) diff --git a/src/sage/symbolic/series_impl.pxi b/src/sage/symbolic/series_impl.pxi index 2aa2011265c..cb68f8fe893 100644 --- a/src/sage/symbolic/series_impl.pxi +++ b/src/sage/symbolic/series_impl.pxi @@ -194,7 +194,7 @@ cdef class SymbolicSeries(Expression): EXAMPLES:: - sage: s=(1/(1-x)).series(x,3); s + sage: s = (1/(1-x)).series(x,3); s 1 + 1*x + 1*x^2 + Order(x^3) sage: s.default_variable() x @@ -226,18 +226,17 @@ cdef class SymbolicSeries(Expression): EXAMPLES:: - sage: s=(1/(1-x)).series(x,6); s + sage: s = (1/(1-x)).series(x,6); s 1 + 1*x + 1*x^2 + 1*x^3 + 1*x^4 + 1*x^5 + Order(x^6) sage: s.coefficients() [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5]] sage: s.coefficients(x, sparse=False) [1, 1, 1, 1, 1, 1] sage: x,y = var("x,y") - sage: s=(1/(1-y*x-x)).series(x,3); s + sage: s = (1/(1-y*x-x)).series(x,3); s 1 + (y + 1)*x + ((y + 1)^2)*x^2 + Order(x^3) sage: s.coefficients(x, sparse=False) [1, y + 1, (y + 1)^2] - """ if x is None: x = self.default_variable() @@ -259,14 +258,15 @@ cdef class SymbolicSeries(Expression): def power_series(self, base_ring): """ - Return algebraic power series associated to this symbolic - series. The coefficients must be coercible to the base ring. + Return the algebraic power series associated to this symbolic series. + + The coefficients must be coercible to the base ring. EXAMPLES:: - sage: ex=(gamma(1-x)).series(x,3); ex + sage: ex = (gamma(1-x)).series(x,3); ex 1 + euler_gamma*x + (1/2*euler_gamma^2 + 1/12*pi^2)*x^2 + Order(x^3) - sage: g=ex.power_series(SR); g + sage: g = ex.power_series(SR); g 1 + euler_gamma*x + (1/2*euler_gamma^2 + 1/12*pi^2)*x^2 + O(x^3) sage: g.parent() Power Series Ring in x over Symbolic Ring @@ -274,4 +274,3 @@ cdef class SymbolicSeries(Expression): from sage.rings.all import PowerSeriesRing R = PowerSeriesRing(base_ring, names=str(self.default_variable())) return R(self.list(), self.degree(self.default_variable())) - From 40b5e2a6d862fa3ebe05771256e993244d5a631d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 8 Jul 2022 10:41:29 +0200 Subject: [PATCH 230/416] more fixes --- src/sage/groups/abelian_gps/abelian_group_element.py | 2 +- src/sage/groups/matrix_gps/unitary.py | 4 ++-- src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/groups/abelian_gps/abelian_group_element.py b/src/sage/groups/abelian_gps/abelian_group_element.py index 2ddbf16203f..1b0c9cd590c 100644 --- a/src/sage/groups/abelian_gps/abelian_group_element.py +++ b/src/sage/groups/abelian_gps/abelian_group_element.py @@ -99,7 +99,7 @@ def as_permutation(self): sage: G = AbelianGroup(3,[2,3,4],names="abc"); G Multiplicative Abelian group isomorphic to C2 x C3 x C4 - sage: a,b,c=G.gens() + sage: a,b,c = G.gens() sage: Gp = G.permutation_group(); Gp Permutation Group with generators [(6,7,8,9), (3,4,5), (1,2)] sage: a.as_permutation() diff --git a/src/sage/groups/matrix_gps/unitary.py b/src/sage/groups/matrix_gps/unitary.py index 5b86998a460..f4d8df525be 100644 --- a/src/sage/groups/matrix_gps/unitary.py +++ b/src/sage/groups/matrix_gps/unitary.py @@ -224,7 +224,7 @@ def GU(n, R, var='a', invariant_form=None): [ 1 E(5) 0] [E(5)^4 2 0] [ 0 0 1] - sage: pm=Permutation((1,2,3)).to_matrix() + sage: pm = Permutation((1,2,3)).to_matrix() sage: g = G(pm); g in G; g True [0 0 1] @@ -324,7 +324,7 @@ def SU(n, R, var='a', invariant_form=None): [ 1 zeta3 0] [-zeta3 - 1 2 0] [ 0 0 1] - sage: pm=Permutation((1,2,3)).to_matrix() + sage: pm = Permutation((1,2,3)).to_matrix() sage: G(pm) [0 0 1] [1 0 0] diff --git a/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx b/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx index c7607a1b153..dafa6e007c7 100644 --- a/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +++ b/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx @@ -288,7 +288,7 @@ def search_tree(G_in, partition, lab=True, dig=False, dict_rep=False, certificat sage: for i,j,_ in G.edge_iterator(): ....: GD.add_arc(i,j); GD.add_arc(j,i) ....: GS.add_arc(i,j); GS.add_arc(j,i) - sage: Pi=[range(20)] + sage: Pi = [range(20)] sage: a,b = st(G, Pi) sage: asp,bsp = st(GS, Pi) sage: ade,bde = st(GD, Pi) From 94a28058512d44978f57d228b7d1c56f1563e493 Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Sat, 9 Jul 2022 10:24:40 +0800 Subject: [PATCH 231/416] 33971: Correct doc --- src/sage/schemes/projective/projective_morphism.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 04f9ed09c09..8574a0a4d74 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1344,9 +1344,7 @@ def global_height(self, prec=None): sage: exp(f.global_height()) 625.000000000000 - :: - - Scaling should not change the result: + Scaling should not change the result:: sage: P. = ProjectiveSpace(QQ, 1) sage: f = DynamicalSystem([1/25*x^2 + 25/3*x*y + y^2, 1*y^2]) From ab35cbc1fbda7fa4c05c67d63c949440bf0c1aef Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Sat, 9 Jul 2022 12:44:27 +0800 Subject: [PATCH 232/416] 33971: Correct `prec` and relevent examples --- src/sage/schemes/affine/affine_morphism.py | 24 ++++++++-- .../schemes/projective/projective_morphism.py | 44 ++++++++++++++----- 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 87e4507449c..f3938e7e773 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -714,8 +714,8 @@ def global_height(self, prec=None): sage: A. = AffineSpace(k, 2) sage: H = Hom(A, A) sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]); - sage: f.global_height(prec=100) - 4.17438726989564 + sage: f.global_height(prec=2) + 4.0 :: @@ -734,7 +734,7 @@ def global_height(self, prec=None): sage: f.global_height() 3.40119738166216 """ - return self.homogenize(0).global_height() + return self.homogenize(0).global_height(prec=prec) def local_height(self, v, prec=None): """ @@ -768,6 +768,14 @@ def local_height(self, v, prec=None): sage: f.local_height(2) 2.77258872223978 + :: + + sage: P. = AffineSpace(QQ, 3) + sage: H = Hom(P, P) + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); + sage: f.local_height(2, prec=2) + 3.0 + :: sage: R. = PolynomialRing(QQ) @@ -781,7 +789,7 @@ def local_height(self, v, prec=None): K = FractionField(self.domain().base_ring()) if K not in _NumberFields or is_NumberFieldOrder(K): raise TypeError("must be over a number field or a number field order") - return max([K(c).local_height(v, prec) for f in self for c in f.coefficients()]) + return max([K(c).local_height(v, prec=prec) for f in self for c in f.coefficients()]) def local_height_arch(self, i, prec=None): """ @@ -807,6 +815,14 @@ def local_height_arch(self, i, prec=None): sage: f.local_height_arch(0) 5.34710753071747 + :: + + sage: P. = AffineSpace(QQ, 2) + sage: H = Hom(P, P) + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f.local_height_arch(0, prec=5) + 5.2 + :: sage: R. = PolynomialRing(QQ) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 8574a0a4d74..04fddebf9be 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1302,15 +1302,23 @@ def global_height(self, prec=None): sage: P. = ProjectiveSpace(QQ,1) sage: H = Hom(P,P) - sage: f = H([1/1331*x^2+1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.global_height() 20.8348429892146 + :: + + sage: P. = ProjectiveSpace(QQ,1) + sage: H = Hom(P,P) + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f.global_height(prec=11) + 20.8 + This function does not automatically normalize:: sage: P. = ProjectiveSpace(ZZ,2) sage: H = Hom(P,P) - sage: f = H([4*x^2+100*y^2, 210*x*y, 10000*z^2]); + sage: f = H([4*x^2 + 100*y^2, 210*x*y, 10000*z^2]); sage: f.global_height() 8.51719319141624 sage: f.normalize_coordinates() @@ -1370,7 +1378,7 @@ def global_height(self, prec=None): from sage.schemes.projective.projective_space import ProjectiveSpace P = ProjectiveSpace(K, len(coeffs)-1) - return P.point(coeffs).global_height() + return P.point(coeffs).global_height(prec=prec) def local_height(self, v, prec=None): r""" @@ -1392,15 +1400,23 @@ def local_height(self, v, prec=None): sage: P. = ProjectiveSpace(QQ,1) sage: H = Hom(P,P) - sage: f = H([1/1331*x^2+1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.local_height(1331) 7.19368581839511 + :: + + sage: P. = ProjectiveSpace(QQ,1) + sage: H = Hom(P,P) + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f.local_height(1331, prec=2) + 8.0 + This function does not automatically normalize:: sage: P. = ProjectiveSpace(QQ,2) sage: H = Hom(P,P) - sage: f = H([4*x^2+3/100*y^2, 8/210*x*y, 1/10000*z^2]); + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); sage: f.local_height(2) 2.77258872223978 sage: f.normalize_coordinates() @@ -1420,7 +1436,7 @@ def local_height(self, v, prec=None): K = FractionField(self.domain().base_ring()) if K not in _NumberFields or is_NumberFieldOrder(K): raise TypeError("must be over a number field or a number field order") - return max([K(c).local_height(v, prec) for f in self for c in f.coefficients()]) + return max([K(c).local_height(v, prec=prec) for f in self for c in f.coefficients()]) def local_height_arch(self, i, prec=None): r""" @@ -1440,18 +1456,26 @@ def local_height_arch(self, i, prec=None): EXAMPLES:: + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f.local_height_arch(0) + 5.34710753071747 + + :: + sage: P. = ProjectiveSpace(QQ,1) sage: H = Hom(P,P) sage: f = H([1/1331*x^2+1/4000*y^2, 210*x*y]); - sage: f.local_height_arch(0) - 5.34710753071747 + sage: f.local_height_arch(0, prec=5) + 5.2 :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2-2) + sage: K. = NumberField(z^2 - 2) sage: P. = ProjectiveSpace(K,1) - sage: H = Hom(P,P) + sage: H = Hom(P, P) sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) sage: f.local_height_arch(1) 0.6931471805599453094172321214582 From 493c74b3ee300c66cca6d9a87b15c555f2f3391e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 Jul 2022 01:08:39 -0700 Subject: [PATCH 233/416] build/pkgs/giac: Use 1.9.0.15 --- build/pkgs/giac/checksums.ini | 6 +++--- build/pkgs/giac/package-version.txt | 2 +- build/pkgs/giac/spkg-src | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index 8b43e42303c..e6a0828e508 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -1,5 +1,5 @@ tarball=giac-VERSION.tar.bz2 -sha1=cb897dcdf6447719b4855ef93a3c8be88e514b16 -md5=1ca9060a6072e393313087d1e0290f0e -cksum=2786003060 +sha1=35e17ce3ec253c6fe208c000e97b3e0781b4cf08 +md5=7c1bf3b6c40105b1874c37e8f5f77973 +cksum=2352857744 upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31563/giac-VERSION.tar.bz2 diff --git a/build/pkgs/giac/package-version.txt b/build/pkgs/giac/package-version.txt index 942caae4a8a..ff6a74aad02 100644 --- a/build/pkgs/giac/package-version.txt +++ b/build/pkgs/giac/package-version.txt @@ -1 +1 @@ -1.9.0.5p0 +1.9.0.15p0 diff --git a/build/pkgs/giac/spkg-src b/build/pkgs/giac/spkg-src index 7b9737f9e27..ef6d2481d0e 100755 --- a/build/pkgs/giac/spkg-src +++ b/build/pkgs/giac/spkg-src @@ -14,7 +14,7 @@ fi set -e VERSION="1.9.0" -VERSIONREV="5" +VERSIONREV="15" PATCHSUFFIX="p0" # The upstream tarball name is: giac"$SOURCEORIG".tar.gz From bd9b013b9a284fc6853bbf04d899a587fc27bf0b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 Jul 2022 01:33:59 -0700 Subject: [PATCH 234/416] build/pkgs/giac/spkg-src: Get rid of *.js, *.wasm --- build/pkgs/giac/checksums.ini | 6 +++--- build/pkgs/giac/spkg-src | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index e6a0828e508..2fb1d3fdf31 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -1,5 +1,5 @@ tarball=giac-VERSION.tar.bz2 -sha1=35e17ce3ec253c6fe208c000e97b3e0781b4cf08 -md5=7c1bf3b6c40105b1874c37e8f5f77973 -cksum=2352857744 +sha1=78c15badd19b49b7d111ac204b611a4378ce3d15 +md5=8fbd43a5c60848b6813b7fc8698a0199 +cksum=1923149665 upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31563/giac-VERSION.tar.bz2 diff --git a/build/pkgs/giac/spkg-src b/build/pkgs/giac/spkg-src index ef6d2481d0e..830c4a47c65 100755 --- a/build/pkgs/giac/spkg-src +++ b/build/pkgs/giac/spkg-src @@ -49,6 +49,9 @@ mv giac-"$VERSION" src # remove unnecessary files rm -rf src/doc/pari/*.html +rm -f src/doc/*.wasm src/doc/*.js +sed -E -i.bak '/XCASHTML/s/[^ ]*[.](wasm|js)//g' src/doc/Makefile.am + # removing french html doc, but keep keywords, and working makefiles. # NB: the french html doc is huge and not GPL. # it is freely redistributable only for non commercial purposes. From 4160a645141d4b72e6b81ef438fe6f7d3cd38ed2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 Jul 2022 01:46:21 -0700 Subject: [PATCH 235/416] build/pkgs/giac/patches/0001-src-global.cc-Do-not-send-SIGINT-to-process-1.patch: Update --- .../0001-src-global.cc-Do-not-send-SIGINT-to-process-1.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pkgs/giac/patches/0001-src-global.cc-Do-not-send-SIGINT-to-process-1.patch b/build/pkgs/giac/patches/0001-src-global.cc-Do-not-send-SIGINT-to-process-1.patch index 5ab40921c98..ca33e850d2e 100644 --- a/build/pkgs/giac/patches/0001-src-global.cc-Do-not-send-SIGINT-to-process-1.patch +++ b/build/pkgs/giac/patches/0001-src-global.cc-Do-not-send-SIGINT-to-process-1.patch @@ -11,10 +11,10 @@ diff --git a/src/global.cc b/src/global.cc index c343aea..87e4575 100755 --- a/src/global.cc +++ b/src/global.cc -@@ -1978,7 +1978,7 @@ extern "C" void Sleep(unsigned int miliSecond); +@@ -3762,7 +3762,7 @@ extern "C" void Sleep(unsigned int miliSecond); void ctrl_c_signal_handler(int signum){ ctrl_c=true; - #if !defined KHICAS && !defined NSPIRE_NEWLIB && !defined WIN32 && !defined BESTA_OS && !defined NSPIRE && !defined FXCG && !defined POCKETCAS + #if !defined KHICAS && !defined NSPIRE_NEWLIB && !defined WIN32 && !defined BESTA_OS && !defined NSPIRE && !defined FXCG && !defined POCKETCAS && !defined __MINGW_H - if (child_id) + if (child_id && child_id != 1) kill(child_id,SIGINT); From 1030c3d78234d40c515e1cd7bbc19d3b9247a383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 9 Jul 2022 11:31:34 +0200 Subject: [PATCH 236/416] modernize many super() in rings/ --- src/sage/rings/complex_arb.pyx | 2 +- src/sage/rings/continued_fraction.py | 2 +- src/sage/rings/derivation.py | 2 +- .../rings/finite_rings/finite_field_base.pyx | 2 +- .../rings/finite_rings/finite_field_givaro.py | 2 +- .../rings/finite_rings/hom_finite_field.pyx | 2 +- .../rings/finite_rings/integer_mod_ring.py | 2 +- src/sage/rings/fraction_field.py | 2 +- src/sage/rings/fraction_field_element.pyx | 3 ++- src/sage/rings/integer_ring.pyx | 2 +- src/sage/rings/invariants/invariant_theory.py | 18 +++++++----------- src/sage/rings/localization.py | 2 +- src/sage/rings/multi_power_series_ring.py | 6 +++--- src/sage/rings/number_field/galois_group.py | 2 +- src/sage/rings/number_field/number_field.py | 4 ++-- .../rings/number_field/number_field_rel.py | 2 +- src/sage/rings/number_field/splitting_field.py | 7 ++++--- .../rings/padics/padic_extension_leaves.py | 2 +- src/sage/rings/padics/padic_valuation.py | 2 +- .../rings/polynomial/laurent_polynomial.pyx | 2 +- .../polynomial/polynomial_quotient_ring.py | 4 ++-- src/sage/rings/puiseux_series_ring.py | 2 +- src/sage/rings/qqbar.py | 2 +- src/sage/rings/quotient_ring.py | 2 +- src/sage/rings/rational_field.py | 4 ++-- src/sage/rings/real_arb.pyx | 4 ++-- src/sage/rings/real_double.pyx | 2 +- src/sage/rings/real_mpfi.pyx | 2 +- src/sage/rings/real_mpfr.pyx | 2 +- src/sage/rings/universal_cyclotomic_field.py | 2 +- .../rings/valuation/augmented_valuation.py | 10 +++++----- src/sage/rings/valuation/gauss_valuation.py | 10 +++++----- .../rings/valuation/inductive_valuation.py | 4 ++-- src/sage/rings/valuation/limit_valuation.py | 6 +++--- src/sage/rings/valuation/mapped_valuation.py | 4 ++-- src/sage/rings/valuation/scaled_valuation.py | 2 +- src/sage/rings/valuation/valuation.py | 2 +- src/sage/rings/valuation/valuation_space.py | 2 +- src/sage/rings/valuation/value_group.py | 7 +++---- 39 files changed, 69 insertions(+), 72 deletions(-) diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 07dad97e48e..93183cf1d6c 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -350,7 +350,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): sage: ComplexBallField(53) is ComplexBallField() True """ - return super(ComplexBallField, cls).__classcall__(cls, precision) + return super().__classcall__(cls, precision) def __init__(self, long precision=53): r""" diff --git a/src/sage/rings/continued_fraction.py b/src/sage/rings/continued_fraction.py index a0cc3bba82a..f4c10b009ad 100644 --- a/src/sage/rings/continued_fraction.py +++ b/src/sage/rings/continued_fraction.py @@ -1673,7 +1673,7 @@ def _latex_(self): + \frac{\displaystyle 1}{\displaystyle \dots}}}}}}}}}} """ if self._x2[0] is not Infinity: - return super(ContinuedFraction_periodic, self)._latex_() + return super()._latex_() v = self._x1 if len(v) == 0: return '0' diff --git a/src/sage/rings/derivation.py b/src/sage/rings/derivation.py index 8ac75e718d9..11d8a76d3a8 100644 --- a/src/sage/rings/derivation.py +++ b/src/sage/rings/derivation.py @@ -487,7 +487,7 @@ def _coerce_map_from_(self, R): return True except (AttributeError, NotImplementedError): pass - return super(RingDerivationModule, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def _repr_(self): """ diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 5c3d7492c7a..ffad0442389 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -523,7 +523,7 @@ cdef class FiniteField(Field): from sage.rings.finite_rings.homset import FiniteFieldHomset if category.is_subcategory(FiniteFields()): return FiniteFieldHomset(self, codomain, category) - return super(FiniteField, self)._Hom_(codomain, category) + return super()._Hom_(codomain, category) def _squarefree_decomposition_univariate_polynomial(self, f): """ diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py index dbeddd8705e..6b34b7e66be 100644 --- a/src/sage/rings/finite_rings/finite_field_givaro.py +++ b/src/sage/rings/finite_rings/finite_field_givaro.py @@ -205,7 +205,7 @@ def _repr_option(self, key): """ if key == 'element_is_atomic': return self._cache.repr != 0 # 0 means repr='poly' - return super(FiniteField_givaro, self)._repr_option(key) + return super()._repr_option(key) def random_element(self, *args, **kwds): """ diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index 62f42e6a451..81c7620d42d 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -271,7 +271,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): To: Finite Field in z2 of size 2^2 Defn: 1 |--> 1 """ - cdef FiniteFieldHomomorphism_generic out = super(FiniteFieldHomomorphism_generic, self).__copy__() + cdef FiniteFieldHomomorphism_generic out = super().__copy__() out._section_class = self._section_class return out diff --git a/src/sage/rings/finite_rings/integer_mod_ring.py b/src/sage/rings/finite_rings/integer_mod_ring.py index 40eb6413ff4..12c3c71c5ba 100644 --- a/src/sage/rings/finite_rings/integer_mod_ring.py +++ b/src/sage/rings/finite_rings/integer_mod_ring.py @@ -195,7 +195,7 @@ class IntegerModFactory(UniqueFactory): """ def get_object(self, version, key, extra_args): - out = super(IntegerModFactory, self).get_object(version, key, extra_args) + out = super().get_object(version, key, extra_args) category = extra_args.get('category', None) if category is not None: out._refine_category_(category) diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index eba5c22d8bf..7edef3616bc 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -1063,7 +1063,7 @@ def _coerce_map_from_(self, R): from sage.rings.function_field.maps import FunctionFieldToFractionField return parent.__make_element_class__(FunctionFieldToFractionField)(parent) - return super(FractionField_1poly_field, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) class FractionFieldEmbedding(DefaultConvertMap_unique): diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 122c07c091f..c464ba5cd47 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -1236,9 +1236,10 @@ cdef class FractionFieldElement_1poly_field(FractionFieldElement): """ if self._is_reduced: return - super(self.__class__, self).reduce() + super().reduce() self.normalize_leading_coefficients() + def make_element(parent, numerator, denominator): """ Used for unpickling :class:`FractionFieldElement` objects (and subclasses). diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index 75dd6836069..889a16295a7 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -867,7 +867,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): """ if key == 'element_is_atomic': return True - return super(IntegerRing_class, self)._repr_option(key) + return super()._repr_option(key) def is_field(self, proof = True): """ diff --git a/src/sage/rings/invariants/invariant_theory.py b/src/sage/rings/invariants/invariant_theory.py index c37af37cc7c..bb249b60560 100644 --- a/src/sage/rings/invariants/invariant_theory.py +++ b/src/sage/rings/invariants/invariant_theory.py @@ -541,7 +541,7 @@ def __init__(self, n, d, polynomial, *args, **kwds): str(n-1)+' variables, got '+str(variables)) ring = polynomial.parent() homogeneous = variables[-1] is not None - super(AlgebraicForm, self).__init__(n, homogeneous, ring, variables) + super().__init__(n, homogeneous, ring, variables) self._check() def _check(self): @@ -989,8 +989,7 @@ def __init__(self, n, d, polynomial, *args): Ternary quadratic with coefficients (1, 1, 0, 0, 0, 0) """ assert d == 2 - super(QuadraticForm, self).__init__(n, 2, polynomial, *args) - + super().__init__(n, 2, polynomial, *args) @classmethod def from_invariants(cls, discriminant, x, z, *args, **kwargs): @@ -1363,11 +1362,10 @@ def __init__(self, n, d, polynomial, *args): Binary quartic with coefficients (1, 0, 0, 0, 1) """ assert n == 2 and d == 4 - super(BinaryQuartic, self).__init__(2, 4, polynomial, *args) + super().__init__(2, 4, polynomial, *args) self._x = self._variables[0] self._y = self._variables[1] - @cached_method def monomials(self): """ @@ -1689,7 +1687,7 @@ def __init__(self, n, d, polynomial, *args): Binary quintic with coefficients (0, 3, 0, 2, 0, 1) """ assert n == 2 and d == 5 - super(BinaryQuintic, self).__init__(2, 5, polynomial, *args) + super().__init__(2, 5, polynomial, *args) self._x = self._variables[0] self._y = self._variables[1] @@ -2587,12 +2585,11 @@ def __init__(self, n, d, polynomial, *args): Ternary quadratic with coefficients (1, 1, 1, 0, 0, 0) """ assert n == 3 and d == 2 - super(QuadraticForm, self).__init__(3, 2, polynomial, *args) + super().__init__(3, 2, polynomial, *args) self._x = self._variables[0] self._y = self._variables[1] self._z = self._variables[2] - @cached_method def monomials(self): """ @@ -2765,12 +2762,11 @@ def __init__(self, n, d, polynomial, *args): sage: cubic._check_covariant('J_covariant') """ assert n == d == 3 - super(TernaryCubic, self).__init__(3, 3, polynomial, *args) + super().__init__(3, 3, polynomial, *args) self._x = self._variables[0] self._y = self._variables[1] self._z = self._variables[2] - @cached_method def monomials(self): """ @@ -3170,7 +3166,7 @@ def __init__(self, forms): """ forms = tuple(forms) f = forms[0] - super(SeveralAlgebraicForms, self).__init__(f._n, f._homogeneous, f._ring, f._variables) + super().__init__(f._n, f._homogeneous, f._ring, f._variables) s = set(f._variables) if not all(set(f._variables) == s for f in forms): raise ValueError('all forms must be in the same variables') diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 3ffe60192e6..829485d7cee 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -1018,4 +1018,4 @@ def is_field(self, proof=True): return False except NotImplementedError: pass - return super(Localization, self).is_field(proof=proof) + return super().is_field(proof=proof) diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index c6a6a0893d1..7f0d5d1bfb8 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -296,9 +296,9 @@ def __classcall__(cls, base_ring, num_gens, name_list, True """ - order = TermOrder(order,num_gens) - return super(MPowerSeriesRing_generic,cls).__classcall__(cls, base_ring, num_gens, name_list, - order, default_prec, sparse) + order = TermOrder(order, num_gens) + return super().__classcall__(cls, base_ring, num_gens, name_list, + order, default_prec, sparse) def __init__(self, base_ring, num_gens, name_list, order='negdeglex', default_prec=10, sparse=False): diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py index 23301495062..79acd053bbc 100644 --- a/src/sage/rings/number_field/galois_group.py +++ b/src/sage/rings/number_field/galois_group.py @@ -290,7 +290,7 @@ def __init__(self, number_field, algorithm='pari', names=None, gc_numbering=None gc_numbering = algorithm != 'magma' # For the deprecated group() method of GaloisGroup_v1 self._type = _type - super(GaloisGroup_v2, self).__init__(number_field, algorithm, names, gc_numbering) + super().__init__(number_field, algorithm, names, gc_numbering) @cached_method(key=GaloisGroup_perm._get_algorithm) def _pol_galgp(self, algorithm=None): diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index e00dbe9b7d2..520e12b9047 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -8918,7 +8918,7 @@ def free_module(self, base=None, basis=None, map=True): if base is None: base = QQ elif base is self: - return super(NumberField_absolute, self).free_module(base=base, basis=basis, map=map) + return super().free_module(base=base, basis=basis, map=map) if basis is not None or base is not QQ: raise NotImplementedError V = QQ**self.degree() @@ -11413,7 +11413,7 @@ def embeddings(self, K): v = [] except AttributeError: # zeta not defined - return super(NumberField_cyclotomic, self).embeddings(K) + return super().embeddings(K) else: X = [m for m in range(n) if arith.gcd(m,n) == 1] v = [self.hom([z**i], check=False) for i in X] diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index 0a022049f02..83368f287c1 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -933,7 +933,7 @@ def _convert_non_number_field_element(self, x): return self._element_class(self, f(self.gen()).polynomial() ) # Anything else: use the code for generic number fields - return super(NumberField_relative, self)._convert_non_number_field_element(x) + return super()._convert_non_number_field_element(x) def _coerce_map_from_(self, R): """ diff --git a/src/sage/rings/number_field/splitting_field.py b/src/sage/rings/number_field/splitting_field.py index 8818e5d1bad..6dc15cc6bc9 100644 --- a/src/sage/rings/number_field/splitting_field.py +++ b/src/sage/rings/number_field/splitting_field.py @@ -46,10 +46,11 @@ def __init__(self, div, mult): self.degree_divisor = div self.degree_multiple = mult if div == mult: - msg = "degree of splitting field equals %s"%div + msg = "degree of splitting field equals %s" % div else: - msg = "degree of splitting field is a multiple of %s"%div - super(SplittingFieldAbort, self).__init__(msg) + msg = "degree of splitting field is a multiple of %s" % div + super().__init__(msg) + class SplittingData: """ diff --git a/src/sage/rings/padics/padic_extension_leaves.py b/src/sage/rings/padics/padic_extension_leaves.py index 48359ef12ab..14fe737b0a1 100644 --- a/src/sage/rings/padics/padic_extension_leaves.py +++ b/src/sage/rings/padics/padic_extension_leaves.py @@ -226,7 +226,7 @@ def _coerce_map_from_(self, R): from sage.rings.padics.qadic_flint_CA import pAdicCoercion_CA_frac_field return pAdicCoercion_CA_frac_field(R, self) - return super(UnramifiedExtensionFieldCappedRelative, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) class UnramifiedExtensionRingCappedAbsolute(UnramifiedExtensionGeneric, pAdicCappedAbsoluteRingGeneric): diff --git a/src/sage/rings/padics/padic_valuation.py b/src/sage/rings/padics/padic_valuation.py index cc6c6a1e658..830d88a1a3e 100644 --- a/src/sage/rings/padics/padic_valuation.py +++ b/src/sage/rings/padics/padic_valuation.py @@ -810,7 +810,7 @@ def extensions(self, ring): return [pAdicValuation(ring, approximant, approximants) for approximant in approximants] if ring.base_ring() is not ring and self.domain().is_subring(ring.base_ring()): return sum([w.extensions(ring) for w in self.extensions(ring.base_ring())], []) - return super(pAdicValuation_base, self).extensions(ring) + return super().extensions(ring) def restriction(self, ring): r""" diff --git a/src/sage/rings/polynomial/laurent_polynomial.pyx b/src/sage/rings/polynomial/laurent_polynomial.pyx index 3b2cf903df2..ae56110610d 100644 --- a/src/sage/rings/polynomial/laurent_polynomial.pyx +++ b/src/sage/rings/polynomial/laurent_polynomial.pyx @@ -2358,7 +2358,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): if c.parent() is not P.base_ring(): P = P.change_ring(c.parent()) return P({e: c}) - return super(LaurentPolynomial_mpair, self).__invert__() + return super().__invert__() def __pow__(LaurentPolynomial_mpair self, n, m): """ diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index feb7483f5a7..19d0aa29a68 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -2135,7 +2135,7 @@ def is_injective(self): return True else: return self.domain().modulus().degree() == 0 # domain and codomain are the zero ring - return super(PolynomialQuotientRing_coercion, self).is_injective() + return super().is_injective() def is_surjective(self): r""" @@ -2168,7 +2168,7 @@ def is_surjective(self): return True if self.domain().modulus().change_ring(self.codomain().base_ring()) == self.codomain().modulus(): return constant_map_is_surjective - return super(PolynomialQuotientRing_coercion, self).is_surjective() + return super().is_surjective() def _richcmp_(self, other, op): r""" diff --git a/src/sage/rings/puiseux_series_ring.py b/src/sage/rings/puiseux_series_ring.py index bf7edc8224e..27a91d6a187 100644 --- a/src/sage/rings/puiseux_series_ring.py +++ b/src/sage/rings/puiseux_series_ring.py @@ -78,7 +78,7 @@ def __classcall__(cls, *args, **kwds): else: laurent_series = LaurentSeriesRing(*args, **kwds) - return super(PuiseuxSeriesRing, cls).__classcall__(cls, laurent_series) + return super().__classcall__(cls, laurent_series) def __init__(self, laurent_series): """ diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index 72e87d0ff79..7db32272b26 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -1136,7 +1136,7 @@ def _repr_option(self, key): """ if key == 'element_is_atomic': return True - return super(AlgebraicRealField, self)._repr_option(key) + return super()._repr_option(key) # Is there a standard representation for this? def _latex_(self): diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 90f177f9694..3a085cd4e47 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -959,7 +959,7 @@ def ideal(self, *gens, **kwds): if not isinstance(self.__R, MPolynomialRing_libsingular) and \ (not hasattr(self.__R, '_has_singular') or not self.__R._has_singular): # pass through - return super(QuotientRing_nc, self).ideal(gens, **kwds) + return super().ideal(gens, **kwds) if is_SingularElement(gens): gens = list(gens) elif not isinstance(gens, (list, tuple)): diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 50710e0c13d..db34813ffe1 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -263,7 +263,7 @@ def _repr_option(self, key): """ if key == 'element_is_atomic': return True - return super(RationalField, self)._repr_option(key) + return super()._repr_option(key) def _latex_(self): r""" @@ -452,7 +452,7 @@ def __truediv__(self, I): elif isinstance(I, Ideal_generic) and I.base_ring() is ZZ: return QmodnZ(I.gen()) else: - return super(RationalField, self).__truediv__(I) + return super().__truediv__(I) def range_by_height(self, start, end=None): r""" diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index cf395208ff9..4fc1de6cce8 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -386,7 +386,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): sage: RealBallField(53) is RealBallField() is RBF True """ - return super(RealBallField, cls).__classcall__(cls, precision) + return super().__classcall__(cls, precision) def __init__(self, long precision=53): r""" @@ -576,7 +576,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): if key == 'element_is_atomic': return True - return super(RealBallField, self)._repr_option(key) + return super()._repr_option(key) def gens(self): r""" diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 1e53565ea4b..f937ba63dd1 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -237,7 +237,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): """ if key == 'element_is_atomic': return True - return super(RealDoubleField_class, self)._repr_option(key) + return super()._repr_option(key) def __richcmp__(self, x, op): """ diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 9eada6a2bc0..a9e4b1eed16 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -977,7 +977,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): """ if key == 'element_is_atomic': return True - return super(RealIntervalField_class, self)._repr_option(key) + return super()._repr_option(key) def characteristic(self): """ diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 3ea8c1dee1f..c9214785c3c 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -943,7 +943,7 @@ cdef class RealField_class(sage.rings.abc.RealField): """ if key == 'element_is_atomic': return True - return super(RealField_class, self)._repr_option(key) + return super()._repr_option(key) def characteristic(self): """ diff --git a/src/sage/rings/universal_cyclotomic_field.py b/src/sage/rings/universal_cyclotomic_field.py index 2a4e6d39958..2291f0ed393 100644 --- a/src/sage/rings/universal_cyclotomic_field.py +++ b/src/sage/rings/universal_cyclotomic_field.py @@ -1305,7 +1305,7 @@ def __classcall__(cls, names=None): sage: E(3,2) E(3)^2 """ - return super(UniversalCyclotomicField, cls).__classcall__(cls, None) + return super().__classcall__(cls, None) def __init__(self, names=None): r""" diff --git a/src/sage/rings/valuation/augmented_valuation.py b/src/sage/rings/valuation/augmented_valuation.py index fbad8a0a39d..4ede1f1d734 100644 --- a/src/sage/rings/valuation/augmented_valuation.py +++ b/src/sage/rings/valuation/augmented_valuation.py @@ -576,7 +576,7 @@ def extensions(self, ring): ret.append(AugmentedValuation(v, f, mu)) return ret - return super(AugmentedValuation_base, self).extensions(ring) + return super().extensions(ring) def restriction(self, ring): r""" @@ -599,7 +599,7 @@ def restriction(self, ring): from sage.rings.polynomial.polynomial_ring import is_PolynomialRing if is_PolynomialRing(ring): # univariate return base.augmentation(self.phi().change_ring(ring.base_ring()), self._mu) - return super(AugmentedValuation_base, self).restriction(ring) + return super().restriction(ring) def uniformizer(self): r""" @@ -689,7 +689,7 @@ def _ge_(self, other): else: return False - return super(AugmentedValuation_base, self)._ge_(other) + return super()._ge_(other) def is_trivial(self): r""" @@ -724,7 +724,7 @@ def scale(self, scalar): """ if scalar in QQ and scalar > 0 and scalar != 1: return self._base_valuation.scale(scalar).augmentation(self.phi(), scalar * self._mu) - return super(AugmentedValuation_base, self).scale(scalar) + return super().scale(scalar) def _residue_ring_generator_name(self): r""" @@ -820,7 +820,7 @@ def change_domain(self, ring): from sage.rings.polynomial.polynomial_ring import is_PolynomialRing if is_PolynomialRing(ring) and ring.variable_name() == self.domain().variable_name(): return self._base_valuation.change_domain(ring).augmentation(self.phi().change_ring(ring.base_ring()), self._mu, check=False) - return super(AugmentedValuation_base, self).change_domain(ring) + return super().change_domain(ring) class FinalAugmentedValuation(AugmentedValuation_base, FinalInductiveValuation): diff --git a/src/sage/rings/valuation/gauss_valuation.py b/src/sage/rings/valuation/gauss_valuation.py index 2431b5982ad..fce282aa0c7 100644 --- a/src/sage/rings/valuation/gauss_valuation.py +++ b/src/sage/rings/valuation/gauss_valuation.py @@ -528,7 +528,7 @@ def change_domain(self, ring): if is_PolynomialRing(ring) and ring.ngens() == 1: base_valuation = self._base_valuation.change_domain(ring.base_ring()) return GaussValuation(self.domain().change_ring(ring.base_ring()), base_valuation) - return super(GaussValuation_generic, self).change_domain(ring) + return super().change_domain(ring) def extensions(self, ring): r""" @@ -547,7 +547,7 @@ def extensions(self, ring): if is_PolynomialRing(ring) and ring.ngens() == 1: if self.domain().is_subring(ring): return [GaussValuation(ring, w) for w in self._base_valuation.extensions(ring.base_ring())] - return super(GaussValuation_generic, self).extensions(ring) + return super().extensions(ring) def restriction(self, ring): r""" @@ -568,7 +568,7 @@ def restriction(self, ring): if is_PolynomialRing(ring) and ring.ngens() == 1: if ring.base().is_subring(self.domain().base()): return GaussValuation(ring, self._base_valuation.restriction(ring.base())) - return super(GaussValuation_generic, self).restriction(ring) + return super().restriction(ring) def is_gauss_valuation(self): r""" @@ -676,7 +676,7 @@ def _ge_(self, other): return False if other.is_trivial(): return other.is_discrete_valuation() - return super(GaussValuation_generic, self)._ge_(other) + return super()._ge_(other) def scale(self, scalar): r""" @@ -693,7 +693,7 @@ def scale(self, scalar): from sage.rings.rational_field import QQ if scalar in QQ and scalar > 0 and scalar != 1: return GaussValuation(self.domain(), self._base_valuation.scale(scalar)) - return super(GaussValuation_generic, self).scale(scalar) + return super().scale(scalar) def _relative_size(self, f): r""" diff --git a/src/sage/rings/valuation/inductive_valuation.py b/src/sage/rings/valuation/inductive_valuation.py index e98ce1b2573..8cc999d5bbd 100644 --- a/src/sage/rings/valuation/inductive_valuation.py +++ b/src/sage/rings/valuation/inductive_valuation.py @@ -578,7 +578,7 @@ def extensions(self, other): # extend to K[x] and from there to K(x) v = self.extension(self.domain().change_ring(self.domain().base().fraction_field())) return [other.valuation(v)] - return super(FiniteInductiveValuation, self).extensions(other) + return super().extensions(other) class NonFinalInductiveValuation(FiniteInductiveValuation, DiscreteValuation): @@ -1677,7 +1677,7 @@ def change_domain(self, ring): from sage.rings.polynomial.polynomial_quotient_ring import is_PolynomialQuotientRing if is_PolynomialQuotientRing(ring) and ring.base() is self.domain() and ring.modulus() == self.phi(): return self.restriction(self.domain().base())._extensions_to_quotient(ring, approximants=[self])[0] - return super(InfiniteInductiveValuation, self).change_domain(ring) + return super().change_domain(ring) def _lift_to_maximal_precision(c): diff --git a/src/sage/rings/valuation/limit_valuation.py b/src/sage/rings/valuation/limit_valuation.py index a64bc844a75..2820c7123a9 100644 --- a/src/sage/rings/valuation/limit_valuation.py +++ b/src/sage/rings/valuation/limit_valuation.py @@ -420,7 +420,7 @@ def extensions(self, ring): # we need to recompute the mac lane approximants over this base # ring because it could split differently pass - return super(MacLaneLimitValuation, self).extensions(ring) + return super().extensions(ring) def lift(self, F): r""" @@ -714,7 +714,7 @@ def _ge_(self, other): return (self._initial_approximation >= other._initial_approximation or self._initial_approximation <= other._initial_approximation) - return super(MacLaneLimitValuation, self)._ge_(other) + return super()._ge_(other) def restriction(self, ring): r""" @@ -733,7 +733,7 @@ def restriction(self, ring): """ if ring.is_subring(self.domain().base()): return self._initial_approximation.restriction(ring) - return super(MacLaneLimitValuation, self).restriction(ring) + return super().restriction(ring) def _weakly_separating_element(self, other): r""" diff --git a/src/sage/rings/valuation/mapped_valuation.py b/src/sage/rings/valuation/mapped_valuation.py index 87799bc9b20..e2ec88ae306 100644 --- a/src/sage/rings/valuation/mapped_valuation.py +++ b/src/sage/rings/valuation/mapped_valuation.py @@ -472,7 +472,7 @@ def restriction(self, ring): """ if ring.is_subring(self._base_valuation.domain().base()): return self._base_valuation.restriction(ring) - return super(FiniteExtensionFromInfiniteValuation, self).restriction(ring) + return super().restriction(ring) def _weakly_separating_element(self, other): r""" @@ -496,7 +496,7 @@ def _weakly_separating_element(self, other): """ if isinstance(other, FiniteExtensionFromInfiniteValuation): return self.domain()(self._base_valuation._weakly_separating_element(other._base_valuation)) - super(FiniteExtensionFromInfiniteValuation, self)._weakly_separating_element(other) + super()._weakly_separating_element(other) def _relative_size(self, x): r""" diff --git a/src/sage/rings/valuation/scaled_valuation.py b/src/sage/rings/valuation/scaled_valuation.py index 214e209ff26..31e06ddb483 100644 --- a/src/sage/rings/valuation/scaled_valuation.py +++ b/src/sage/rings/valuation/scaled_valuation.py @@ -298,7 +298,7 @@ def _ge_(self, other): assert not self.is_trivial() if self._base_valuation <= other: return False - return super(ScaledValuation_generic, self)._ge_(other) + return super()._ge_(other) def _le_(self, other): r""" diff --git a/src/sage/rings/valuation/valuation.py b/src/sage/rings/valuation/valuation.py index 4cbe63fe2f9..28fd8c05e70 100644 --- a/src/sage/rings/valuation/valuation.py +++ b/src/sage/rings/valuation/valuation.py @@ -1013,7 +1013,7 @@ def _ge_(self, other): """ if other.is_trivial(): return other.is_discrete_valuation() - return super(DiscreteValuation, self)._ge_(other) + return super()._ge_(other) class MacLaneApproximantNode(): diff --git a/src/sage/rings/valuation/valuation_space.py b/src/sage/rings/valuation/valuation_space.py index 332fede825d..182e3a80639 100644 --- a/src/sage/rings/valuation/valuation_space.py +++ b/src/sage/rings/valuation/valuation_space.py @@ -146,7 +146,7 @@ def _abstract_element_class(self): """ class_name = "%s._abstract_element_class" % self.__class__.__name__ from sage.structure.dynamic_class import dynamic_class - return dynamic_class(class_name, (super(DiscretePseudoValuationSpace, self)._abstract_element_class, self.__class__.ElementMethods)) + return dynamic_class(class_name, (super()._abstract_element_class, self.__class__.ElementMethods)) def _get_action_(self, S, op, self_on_left): r""" diff --git a/src/sage/rings/valuation/value_group.py b/src/sage/rings/valuation/value_group.py index 4ef2038f70f..ca4ea2ba83b 100644 --- a/src/sage/rings/valuation/value_group.py +++ b/src/sage/rings/valuation/value_group.py @@ -154,9 +154,8 @@ def __classcall__(cls, generator): True """ - generator = QQ.coerce(generator) - generator = generator.abs() - return super(DiscreteValueGroup, cls).__classcall__(cls, generator) + generator = QQ.coerce(generator).abs() + return super().__classcall__(cls, generator) def __init__(self, generator): r""" @@ -476,7 +475,7 @@ def __classcall__(cls, generators): simplified_generators.remove(h) break - return super(DiscreteValueSemigroup, cls).__classcall__(cls, tuple(simplified_generators)) + return super().__classcall__(cls, tuple(simplified_generators)) def __init__(self, generators): r""" From 778d53d1fb0a86983cd6cf8180e2fae36c8d903f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 9 Jul 2022 11:56:05 +0200 Subject: [PATCH 237/416] modernize super() in categories --- src/sage/categories/algebras.py | 2 +- src/sage/categories/cartesian_product.py | 4 ++-- src/sage/categories/category.py | 4 ++-- src/sage/categories/category_singleton.pyx | 2 +- src/sage/categories/category_types.py | 8 +++----- src/sage/categories/category_with_axiom.py | 2 +- src/sage/categories/commutative_algebras.py | 2 +- src/sage/categories/covariant_functorial_construction.py | 7 ++++--- src/sage/categories/crystals.py | 2 +- .../finite_dimensional_lie_algebras_with_basis.py | 5 ++--- src/sage/categories/examples/lie_algebras.py | 2 +- src/sage/categories/examples/sets_cat.py | 2 +- src/sage/categories/filtered_modules.py | 2 +- src/sage/categories/graded_modules.py | 5 +++-- src/sage/categories/isomorphic_objects.py | 2 +- src/sage/categories/lambda_bracket_algebras.py | 2 +- src/sage/categories/metric_spaces.py | 2 +- src/sage/categories/modules.py | 2 +- src/sage/categories/pushout.py | 8 ++++---- src/sage/categories/quotients.py | 2 +- src/sage/categories/schemes.py | 3 +-- src/sage/categories/subobjects.py | 2 +- src/sage/categories/super_modules.py | 4 ++-- src/sage/categories/vector_spaces.py | 2 +- 24 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/sage/categories/algebras.py b/src/sage/categories/algebras.py index dc14daf4c08..253d64a2819 100644 --- a/src/sage/categories/algebras.py +++ b/src/sage/categories/algebras.py @@ -73,7 +73,7 @@ def __contains__(self, x): sage: QQ['x'] in Algebras(CDF) False """ - if super(Algebras, self).__contains__(x): + if super().__contains__(x): return True from sage.rings.ring import Algebra return isinstance(x, Algebra) and x.base_ring() == self.base_ring() diff --git a/src/sage/categories/cartesian_product.py b/src/sage/categories/cartesian_product.py index e2d415d6c74..33f5c5b9b02 100644 --- a/src/sage/categories/cartesian_product.py +++ b/src/sage/categories/cartesian_product.py @@ -188,9 +188,9 @@ def __call__(self, args, **kwds): from sage.sets.cartesian_product import CartesianProduct return CartesianProduct((), cat) elif self._forced_category is not None: - return super(CartesianProductFunctor, self).__call__(args, category=self._forced_category, **kwds) + return super().__call__(args, category=self._forced_category, **kwds) - return super(CartesianProductFunctor, self).__call__(args, **kwds) + return super().__call__(args, **kwds) def __eq__(self, other): r""" diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index a52b95dda00..09547c3b4c2 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -444,7 +444,7 @@ class of ``C`` is a dynamic subclass ``Cs_with_category`` of """ if isinstance(cls, DynamicMetaclass): cls = cls.__base__ - return super(Category, cls).__classcall__(cls, *args, **options) + return super().__classcall__(cls, *args, **options) def __init__(self, s=None): """ @@ -3257,7 +3257,7 @@ def _repr_(self, as_join = False): """ if not as_join: try: - return super(JoinCategory, self)._repr_() + return super()._repr_() except ValueError: pass return "Join of " + " and ".join(str(cat) for cat in self._super_categories) diff --git a/src/sage/categories/category_singleton.pyx b/src/sage/categories/category_singleton.pyx index 7c02aad63e3..1a5095e6017 100644 --- a/src/sage/categories/category_singleton.pyx +++ b/src/sage/categories/category_singleton.pyx @@ -320,7 +320,7 @@ class Category_singleton(Category): from sage.categories.category_with_axiom import CategoryWithAxiom_singleton assert (cls.__mro__[1] is Category_singleton or cls.__mro__[1] is CategoryWithAxiom_singleton), \ "{} is not a direct subclass of {}".format(cls, Category_singleton) - obj = super(Category_singleton, cls).__classcall__(cls, *args) + obj = super().__classcall__(cls, *args) cls._set_classcall(ConstantFunction(obj)) obj.__class__._set_classcall(ConstantFunction(obj)) return obj diff --git a/src/sage/categories/category_types.py b/src/sage/categories/category_types.py index 67bc36fc19a..4469a57a996 100644 --- a/src/sage/categories/category_types.py +++ b/src/sage/categories/category_types.py @@ -508,7 +508,7 @@ def __contains__(self, x): else: return x.base_ring() is self.base_ring() else: - return super(Category_over_base_ring, self).__contains__(x) + return super().__contains__(x) except AttributeError: return False @@ -592,12 +592,10 @@ def __contains__(self, x): sage: IntegerRing().zero_ideal() in C True """ - if super(Category_ideal, self).__contains__(x): + if super().__contains__(x): return True from sage.rings.ideal import is_Ideal - if is_Ideal(x) and x.ring() == self.ring(): - return True - return False + return is_Ideal(x) and x.ring() == self.ring() def __call__(self, v): """ diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index dd01c69a050..b9cb2aa2722 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -1993,7 +1993,7 @@ def __classcall__(cls, *args, **options): """ (base_category_class, axiom) = cls._base_category_class_and_axiom if len(args) == 1 and not options and isinstance(args[0], base_category_class): - return super(CategoryWithAxiom, cls).__classcall__(cls, args[0]) + return super().__classcall__(cls, args[0]) else: # The "obvious" idiom ## return cls(base_category_class(*args, **options)) diff --git a/src/sage/categories/commutative_algebras.py b/src/sage/categories/commutative_algebras.py index 14ab0084d42..ec4037f9a84 100644 --- a/src/sage/categories/commutative_algebras.py +++ b/src/sage/categories/commutative_algebras.py @@ -56,5 +56,5 @@ def __contains__(self, A): TODO: get rid of this method once all commutative algebras in Sage declare themselves in this category """ - return super(CommutativeAlgebras, self).__contains__(A) or \ + return super().__contains__(A) or \ (A in Algebras(self.base_ring()) and hasattr(A, "is_commutative") and A.is_commutative()) diff --git a/src/sage/categories/covariant_functorial_construction.py b/src/sage/categories/covariant_functorial_construction.py index b6389c69725..96dbf891bc9 100644 --- a/src/sage/categories/covariant_functorial_construction.py +++ b/src/sage/categories/covariant_functorial_construction.py @@ -315,7 +315,7 @@ def __classcall__(cls, category=None, *args): """ base_category_class = cls._base_category_class[0] if isinstance(category, base_category_class): - return super(FunctorialConstructionCategory, cls).__classcall__(cls, category, *args) + return super().__classcall__(cls, category, *args) else: return cls.category_of(base_category_class(category, *args)) @@ -435,7 +435,7 @@ def __init__(self, category, *args): assert isinstance(category, Category) self._base_category = category self._args = args - super(FunctorialConstructionCategory, self).__init__(*args) + super().__init__(*args) def base_category(self): """ @@ -684,4 +684,5 @@ def default_super_categories(cls, category, *args): sage: C.__class__.default_super_categories(C.base_category(), *C._args) Category of unital subquotients of semigroups """ - return Category.join([category, super(RegressiveCovariantConstructionCategory, cls).default_super_categories(category, *args)]) + return Category.join([category, + super().default_super_categories(category, *args)]) diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index d595a854ad2..68c2edd7a29 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -1977,7 +1977,7 @@ def __call__(self, x, *args, **kwds): """ if x is None: return None - return super(CrystalMorphism, self).__call__(x, *args, **kwds) + return super().__call__(x, *args, **kwds) def virtualization(self): r""" diff --git a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py index 7f0fc4433c7..306e0091e12 100644 --- a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py @@ -76,8 +76,7 @@ def __classcall_private__(cls, R, n=None, M=None, ambient=None): else: M = M.change_ring(R) n = M.dimension() - return super(AbelianLieAlgebra, cls).__classcall__(cls, R, n=n, M=M, - ambient=ambient) + return super().__classcall__(cls, R, n=n, M=M, ambient=ambient) def __init__(self, R, n=None, M=None, ambient=None): """ @@ -219,7 +218,7 @@ def is_ideal(self, A): False """ if not isinstance(A, AbelianLieAlgebra): - return super(AbelianLieAlgebra, self).is_ideal(A) + return super().is_ideal(A) if A == self or A == self._ambient: return True if self._ambient != A._ambient: diff --git a/src/sage/categories/examples/lie_algebras.py b/src/sage/categories/examples/lie_algebras.py index 1b435a5e4ee..cdde62e6760 100644 --- a/src/sage/categories/examples/lie_algebras.py +++ b/src/sage/categories/examples/lie_algebras.py @@ -75,7 +75,7 @@ def __classcall_private__(cls, gens): sage: L1 is L2 True """ - return super(LieAlgebraFromAssociative, cls).__classcall__(cls, tuple(gens)) + return super().__classcall__(cls, tuple(gens)) def __init__(self, gens): """ diff --git a/src/sage/categories/examples/sets_cat.py b/src/sage/categories/examples/sets_cat.py index 6cc88bc551b..a9e8933901d 100644 --- a/src/sage/categories/examples/sets_cat.py +++ b/src/sage/categories/examples/sets_cat.py @@ -390,7 +390,7 @@ def __init__(self): sage: type(P(2)+P(3)) """ - super(PrimeNumbers_Inherits, self).__init__() + super().__init__() self._populate_coercion_lists_(embedding=IntegerRing()) def __contains__(self, p): diff --git a/src/sage/categories/filtered_modules.py b/src/sage/categories/filtered_modules.py index 9a4b7d360d0..780ef974956 100644 --- a/src/sage/categories/filtered_modules.py +++ b/src/sage/categories/filtered_modules.py @@ -53,7 +53,7 @@ def __init__(self, base_category): sage: HopfAlgebrasWithBasis(QQ).Filtered().base_ring() Rational Field """ - super(FilteredModulesCategory, self).__init__(base_category, base_category.base_ring()) + super().__init__(base_category, base_category.base_ring()) _functor_category = "Filtered" diff --git a/src/sage/categories/graded_modules.py b/src/sage/categories/graded_modules.py index 137c503c562..ff66b885913 100644 --- a/src/sage/categories/graded_modules.py +++ b/src/sage/categories/graded_modules.py @@ -42,7 +42,7 @@ def __init__(self, base_category): sage: GradedModules(ZZ) is Modules(ZZ).Graded() True """ - super(GradedModulesCategory, self).__init__(base_category, base_category.base_ring()) + super().__init__(base_category, base_category.base_ring()) _functor_category = "Graded" @@ -93,9 +93,10 @@ def default_super_categories(cls, category, *args): Join of Category of filtered algebras over Rational Field and Category of graded vector spaces over Rational Field """ - cat = super(GradedModulesCategory, cls).default_super_categories(category, *args) + cat = super().default_super_categories(category, *args) return Category.join([category.Filtered(), cat]) + class GradedModules(GradedModulesCategory): r""" The category of graded modules. diff --git a/src/sage/categories/isomorphic_objects.py b/src/sage/categories/isomorphic_objects.py index fe3569cd3cd..f1473997c14 100644 --- a/src/sage/categories/isomorphic_objects.py +++ b/src/sage/categories/isomorphic_objects.py @@ -68,4 +68,4 @@ def default_super_categories(cls, category): Category of isomorphic objects of sets """ return Category.join([category.Subobjects(), category.Quotients(), - super(IsomorphicObjectsCategory, cls).default_super_categories(category)]) + super().default_super_categories(category)]) diff --git a/src/sage/categories/lambda_bracket_algebras.py b/src/sage/categories/lambda_bracket_algebras.py index c0f8a00c661..531cfb826b1 100644 --- a/src/sage/categories/lambda_bracket_algebras.py +++ b/src/sage/categories/lambda_bracket_algebras.py @@ -54,7 +54,7 @@ def __classcall_private__(cls, R, check=True): if check: if not (R in _CommutativeRings): raise ValueError("base must be a commutative ring got {}".format(R)) - return super(LambdaBracketAlgebras, cls).__classcall__(cls, R) + return super().__classcall__(cls, R) @cached_method def super_categories(self): diff --git a/src/sage/categories/metric_spaces.py b/src/sage/categories/metric_spaces.py index 0791c95d29c..6608ca7d4e5 100644 --- a/src/sage/categories/metric_spaces.py +++ b/src/sage/categories/metric_spaces.py @@ -60,7 +60,7 @@ def default_super_categories(cls, category): Join of Category of topological groups and Category of metric spaces """ return Category.join([category.Topological(), - super(MetricSpacesCategory, cls).default_super_categories(category)]) + super().default_super_categories(category)]) # We currently don't have a use for this, but we probably will def _repr_object_names(self): diff --git a/src/sage/categories/modules.py b/src/sage/categories/modules.py index 2dafd6ec4ee..d37b4812209 100644 --- a/src/sage/categories/modules.py +++ b/src/sage/categories/modules.py @@ -152,7 +152,7 @@ def __classcall_private__(cls, base_ring, dispatch=True): and base_ring.is_subcategory(_Fields)): from .vector_spaces import VectorSpaces return VectorSpaces(base_ring, check=False) - result = super(Modules, cls).__classcall__(cls, base_ring) + result = super().__classcall__(cls, base_ring) result._reduction[2]['dispatch'] = False return result diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index 5fbc590fb8e..c48ec6ec672 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -3800,10 +3800,10 @@ def pushout(R, S): sage: from sage.categories.pushout import ConstructionFunctor sage: class EvenPolynomialRing(type(QQ['x'])): ....: def __init__(self, base, var): - ....: super(EvenPolynomialRing, self).__init__(base, var) + ....: super().__init__(base, var) ....: self.register_embedding(base[var]) ....: def __repr__(self): - ....: return "Even Power " + super(EvenPolynomialRing, self).__repr__() + ....: return "Even Power " + super().__repr__() ....: def construction(self): ....: return EvenPolynomialFunctor(), self.base()[self.variable_name()] ....: def _coerce_map_from_(self, R): @@ -3857,7 +3857,7 @@ def pushout(R, S): ....: self.coefficients = coefficients ....: self.var = var ....: self.exponents = exponents - ....: super(GPolynomialRing, self).__init__(category=Rings()) + ....: super().__init__(category=Rings()) ....: def _repr_(self): ....: return 'Generalized Polynomial Ring in %s^(%s) over %s' % ( ....: self.var, self.exponents, self.coefficients) @@ -3979,7 +3979,7 @@ def pushout(R, S): sage: class CartesianProductPoly(CartesianProduct): ....: def __init__(self, polynomial_rings): ....: sort = sorted(polynomial_rings, key=lambda P: P.variable_name()) - ....: super(CartesianProductPoly, self).__init__(sort, Sets().CartesianProducts()) + ....: super().__init__(sort, Sets().CartesianProducts()) ....: def vars(self): ....: return tuple(P.variable_name() for P in self.cartesian_factors()) ....: def _pushout_(self, other): diff --git a/src/sage/categories/quotients.py b/src/sage/categories/quotients.py index d444c7455e9..bda06208d80 100644 --- a/src/sage/categories/quotients.py +++ b/src/sage/categories/quotients.py @@ -59,4 +59,4 @@ def default_super_categories(cls, category): sage: sage.categories.quotients.QuotientsCategory.default_super_categories(Groups()) Join of Category of groups and Category of subquotients of monoids and Category of quotients of semigroups """ - return Category.join([category.Subquotients(), super(QuotientsCategory, cls).default_super_categories(category)]) + return Category.join([category.Subquotients(), super().default_super_categories(category)]) diff --git a/src/sage/categories/schemes.py b/src/sage/categories/schemes.py index 73eef1d15d4..45ef3943239 100644 --- a/src/sage/categories/schemes.py +++ b/src/sage/categories/schemes.py @@ -72,8 +72,7 @@ def __classcall_private__(cls, X = None): if not is_Scheme(X): X = Schemes()(X) return Schemes_over_base(X) - else: - return super(Schemes, cls).__classcall__(cls) + return super().__classcall__(cls) def super_categories(self): """ diff --git a/src/sage/categories/subobjects.py b/src/sage/categories/subobjects.py index c8eef3852cb..53ad660d75a 100644 --- a/src/sage/categories/subobjects.py +++ b/src/sage/categories/subobjects.py @@ -59,4 +59,4 @@ def default_super_categories(cls, category): sage: sage.categories.subobjects.SubobjectsCategory.default_super_categories(Groups()) Join of Category of groups and Category of subquotients of monoids and Category of subobjects of sets """ - return Category.join([category.Subquotients(), super(SubobjectsCategory, cls).default_super_categories(category)]) + return Category.join([category.Subquotients(), super().default_super_categories(category)]) diff --git a/src/sage/categories/super_modules.py b/src/sage/categories/super_modules.py index 5eb8db949bc..091b808408e 100644 --- a/src/sage/categories/super_modules.py +++ b/src/sage/categories/super_modules.py @@ -49,7 +49,7 @@ def default_super_categories(cls, category, *args): Category of finite dimensional super hopf algebras with basis over Integer Ring """ axioms = axiom_whitelist.intersection(category.axioms()) - C = super(SuperModulesCategory, cls).default_super_categories(category, *args) + C = super().default_super_categories(category, *args) return C._with_axioms(axioms) def __init__(self, base_category): @@ -70,7 +70,7 @@ def __init__(self, base_category): sage: HopfAlgebrasWithBasis(QQ).Super().base_ring() Rational Field """ - super(SuperModulesCategory, self).__init__(base_category, base_category.base_ring()) + super().__init__(base_category, base_category.base_ring()) _functor_category = "Super" diff --git a/src/sage/categories/vector_spaces.py b/src/sage/categories/vector_spaces.py index 2f70c93bc61..7568c705326 100644 --- a/src/sage/categories/vector_spaces.py +++ b/src/sage/categories/vector_spaces.py @@ -67,7 +67,7 @@ def __classcall_private__(cls, K, check=True): (isinstance(K, Category) and K.is_subcategory(_Fields))): raise ValueError("base must be a field or a subcategory of Fields();" + " got {}".format(K)) - return super(VectorSpaces, cls).__classcall__(cls, K) + return super().__classcall__(cls, K) def __init__(self, K): """ From d2ade90f4fb2f813ad46652c8d6c777ed3fe0b50 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 Jul 2022 09:52:29 -0700 Subject: [PATCH 238/416] build/pkgs/giac/spkg-install.in: Work around xcas::localisation error --- build/pkgs/giac/spkg-install.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/pkgs/giac/spkg-install.in b/build/pkgs/giac/spkg-install.in index d7ecb5a4cef..c20671a7b88 100644 --- a/build/pkgs/giac/spkg-install.in +++ b/build/pkgs/giac/spkg-install.in @@ -16,6 +16,9 @@ if [ `uname -m` = "ppc64" ]; then CPPFLAGS="-Dx86_64 $CPPFLAGS" fi +# #31563: Kick the can down the road +CPPFLAGS="-DUSE_OBJET_BIDON=1 $CPPFLAGS" + # Using pari in a C++17 file with "using namespace std doesn't # work due to a conflict between std::rank and pari's rank # -std=c++17 is in the default flags on conda; From f752ab77139e4b61dc68c42263040f0032dea9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 9 Jul 2022 20:03:06 +0200 Subject: [PATCH 239/416] fix the linter + pep8 for expect.py --- src/sage/interfaces/cleaner.py | 11 +++--- src/sage/interfaces/expect.py | 64 ++++++++++++++++------------------ 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/sage/interfaces/cleaner.py b/src/sage/interfaces/cleaner.py index 7e67a478f25..54bfac779ac 100644 --- a/src/sage/interfaces/cleaner.py +++ b/src/sage/interfaces/cleaner.py @@ -5,19 +5,18 @@ "The Cleaner" from Pulp Fiction: http://www.frankjankowski.de/quiz/illus/keitel.jpg """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2007 William Stein # # 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 os +import atexit +import tempfile -import atexit, tempfile _spd = tempfile.TemporaryDirectory() SAGE_SPAWNED_PROCESS_FILE = os.path.join(_spd.name, "spawned_processes") atexit.register(lambda: _spd.cleanup()) diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py index 69d8d1295fd..c4dc2d4f27a 100644 --- a/src/sage/interfaces/expect.py +++ b/src/sage/interfaces/expect.py @@ -165,7 +165,7 @@ def __init__(self, name, prompt, command=None, env={}, server=None, self._session_number = 0 self.__init_code = init_code - #Handle the log file + # Handle the log file if isinstance(logfile, str): self.__logfile = None self.__logfilename = logfile @@ -198,9 +198,9 @@ def set_server_and_command(self, server=None, command=None, server_tmpdir=None, self._server = server if server is not None: if ulimit: - command = "ssh -t %s 'ulimit %s; %s'"%(server, ulimit, command) + command = "ssh -t %s 'ulimit %s; %s'" % (server, ulimit, command) else: - command = "ssh -t %s '%s'"%(server, command) + command = "ssh -t %s '%s'" % (server, command) self.__is_remote = True self._eval_using_file_cutoff = 0 # don't allow this! if self.__verbose_start: @@ -208,7 +208,7 @@ def set_server_and_command(self, server=None, command=None, server_tmpdir=None, print(command) if server_tmpdir is None: # TO DO: Why default to /tmp/? Might be better to use the expect process itself to get a tmp folder - print("No remote temporary directory (option server_tmpdir) specified, using /tmp/ on "+server) + print("No remote temporary directory (option server_tmpdir) specified, using /tmp/ on " + server) self.__remote_tmpdir = "/tmp/" else: self.__remote_tmpdir = server_tmpdir @@ -277,7 +277,7 @@ def is_running(self): if self._expect is None: return False try: - os.kill(self._expect.pid,0) + os.kill(self._expect.pid, 0) except OSError: # This means the process is not running return False @@ -291,11 +291,11 @@ def _so_far(self, wait=0.1, alternate_prompt=None): done, new = self._get(wait=wait, alternate_prompt=alternate_prompt) try: if done: - #if new is not None: + # if new is not None: X = self.__so_far + new del self.__so_far return True, X, new - #new = self._expect.before + # new = self._expect.before try: self.__so_far += new except (AttributeError, TypeError): @@ -430,7 +430,6 @@ def _install_hints_ssh_through_gate(self): """ - def _do_cleaner(self): try: return self.__do_cleaner @@ -456,8 +455,8 @@ def _start(self, alt_message=None, block_during_init=True): os.makedirs(logs, exist_ok=True) filename = '{name}-{pid}-{id}-{session}'.format( - name=self.name(), pid=os.getpid(), id=id(self), - session=self._session_number) + name=self.name(), pid=os.getpid(), id=id(self), + session=self._session_number) self.__logfilename = os.path.join(logs, filename) if self.__logfilename is not None: self.__logfile = open(self.__logfilename, 'wb') @@ -737,14 +736,13 @@ def _local_tmpfile(self): AUTHOR: - Simon King (2010-09): Making the tmp-file unique for the interface instance - """ try: return self.__local_tmpfile except AttributeError: pass - import atexit, os + import atexit from tempfile import NamedTemporaryFile # FriCAS uses the ".input" suffix, and the other # interfaces are suffix-agnostic, so using ".input" here @@ -761,7 +759,7 @@ def _remote_tmpfile(self): try: return self.__remote_tmpfile except AttributeError: - self.__remote_tmpfile = self._remote_tmpdir()+"/interface_%s:%s"%(LOCAL_IDENTIFIER,self.pid()) + self.__remote_tmpfile = self._remote_tmpdir() + "/interface_%s:%s" % (LOCAL_IDENTIFIER, self.pid()) return self.__remote_tmpfile def _send_tmpfile_to_server(self, local_file=None, remote_file=None): @@ -769,15 +767,15 @@ def _send_tmpfile_to_server(self, local_file=None, remote_file=None): local_file = self._local_tmpfile() if remote_file is None: remote_file = self._remote_tmpfile() - cmd = 'scp "%s" %s:"%s" 1>&2 2>/dev/null'%(local_file, self._server, remote_file) + cmd = 'scp "%s" %s:"%s" 1>&2 2>/dev/null' % (local_file, self._server, remote_file) os.system(cmd) - def _get_tmpfile_from_server(self, local_file=None,remote_file=None): + def _get_tmpfile_from_server(self, local_file=None, remote_file=None): if local_file is None: local_file = self._local_tmpfile() if remote_file is None: remote_file = self._remote_tmpfile() - cmd = 'scp %s:"%s" "%s" 1>&2 2>/dev/null'%( self._server, remote_file, local_file) + cmd = 'scp %s:"%s" "%s" 1>&2 2>/dev/null' % (self._server, remote_file, local_file) os.system(cmd) def _remove_tmpfile_from_server(self): @@ -847,7 +845,7 @@ def _eval_line_using_file(self, line, restart_if_needed=True): if self._quit_string() in line: # we expect to get an EOF if we're quitting. return '' - elif restart_if_needed: # the subprocess might have crashed + elif restart_if_needed: # the subprocess might have crashed try: self._synchronize() return self._post_process_from_file(self._eval_line_using_file(line, restart_if_needed=False)) @@ -997,7 +995,7 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if self._synchronize() except (TypeError, RuntimeError): pass - return self._eval_line(line,allow_use_file=allow_use_file, wait_for_prompt=wait_for_prompt, restart_if_needed=False) + return self._eval_line(line, allow_use_file=allow_use_file, wait_for_prompt=wait_for_prompt, restart_if_needed=False) raise RuntimeError("%s\nError evaluating %s in %s" % (msg, line, self)) if line: @@ -1019,13 +1017,13 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if if self._quit_string() in line: # we expect to get an EOF if we're quitting. return '' - elif restart_if_needed: # the subprocess might have crashed + elif restart_if_needed: # the subprocess might have crashed try: self._synchronize() - return self._eval_line(line,allow_use_file=allow_use_file, wait_for_prompt=wait_for_prompt, restart_if_needed=False) + return self._eval_line(line, allow_use_file=allow_use_file, wait_for_prompt=wait_for_prompt, restart_if_needed=False) except (TypeError, RuntimeError): pass - raise RuntimeError("%s\n%s crashed executing %s"%(msg,self, line)) + raise RuntimeError("%s\n%s crashed executing %s" % (msg, self, line)) if self._terminal_echo: out = self._before() else: @@ -1041,9 +1039,9 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if if self._terminal_echo: i = out.find("\n") j = out.rfind("\r") - return out[i+1:j].replace('\r\n','\n') + return out[i + 1:j].replace('\r\n', '\n') else: - return out.replace('\r\n','\n') + return out.replace('\r\n', '\n') def _keyboard_interrupt(self): print("Interrupting %s..." % self) @@ -1051,7 +1049,7 @@ def _keyboard_interrupt(self): try: self._close() except pexpect.ExceptionPexpect as msg: - raise pexpect.ExceptionPexpect( "THIS IS A BUG -- PLEASE REPORT. This should never happen.\n" + msg) + raise pexpect.ExceptionPexpect("THIS IS A BUG -- PLEASE REPORT. This should never happen.\n" + msg) self._start() raise KeyboardInterrupt("Restarting %s (WARNING: all variables defined in previous session are now invalid)" % self) else: @@ -1147,7 +1145,7 @@ def _readline(self, size=-1, encoding=None, errors=None): def _interrupt(self): for i in range(15): try: - self._sendstr('quit;\n'+chr(3)) + self._sendstr('quit;\n' + chr(3)) self._expect_expr(timeout=2) except pexpect.TIMEOUT: pass @@ -1394,7 +1392,7 @@ def eval(self, code, strip=True, synchronize=False, locals=None, allow_use_file= if not isinstance(code, str): raise TypeError('input code must be a string.') - #Remove extra whitespace + # Remove extra whitespace code = code.strip() try: @@ -1404,14 +1402,14 @@ def eval(self, code, strip=True, synchronize=False, locals=None, allow_use_file= return self._eval_line_using_file(code) elif split_lines: return '\n'.join([self._eval_line(L, allow_use_file=allow_use_file, **kwds) - for L in code.split('\n') if L != '']) + for L in code.split('\n') if L != '']) else: return self._eval_line(code, allow_use_file=allow_use_file, **kwds) # DO NOT CATCH KeyboardInterrupt, as it is being caught # by _eval_line # In particular, do NOT call self._keyboard_interrupt() except TypeError as s: - raise TypeError('error evaluating "%s":\n%s'%(code,s)) + raise TypeError('error evaluating "%s":\n%s' % (code, s)) ############################################################ # Functions for working with variables. @@ -1458,6 +1456,7 @@ class ExpectFunction(InterfaceFunction): """ pass + @instancedoc class FunctionElement(InterfaceFunctionElement): """ @@ -1507,8 +1506,7 @@ def __hash__(self): Returns the hash of self. This is a default implementation of hash which just takes the hash of the string of self. """ - return hash('%s%s'%(self, self._session_number)) - + return hash('%s%s' % (self, self._session_number)) def _check_valid(self): """ @@ -1520,8 +1518,8 @@ def _check_valid(self): try: P = self.parent() if P is None or P._session_number == BAD_SESSION or self._session_number == -1 or \ - P._session_number != self._session_number: - raise ValueError("The %s session in which this object was defined is no longer running."%P.name()) + P._session_number != self._session_number: + raise ValueError("The %s session in which this object was defined is no longer running." % P.name()) except AttributeError: raise ValueError("The session in which this object was defined is no longer running.") return P @@ -1541,7 +1539,7 @@ def __del__(self): pass # def _sage_repr(self): -#TO DO: this could use file transfers when self.is_remote() +# TO DO: this could use file transfers when self.is_remote() class StdOutContext: From fd615a47b1bf789404e6e51e4d31e3f3f6f9265c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 10 Jul 2022 07:49:44 +0200 Subject: [PATCH 240/416] undo change in fraction_field_element --- src/sage/rings/fraction_field_element.pyx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index c464ba5cd47..122c07c091f 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -1236,10 +1236,9 @@ cdef class FractionFieldElement_1poly_field(FractionFieldElement): """ if self._is_reduced: return - super().reduce() + super(self.__class__, self).reduce() self.normalize_leading_coefficients() - def make_element(parent, numerator, denominator): """ Used for unpickling :class:`FractionFieldElement` objects (and subclasses). From b4bd68a383ce1c54956ac674ff34c9b9b000cb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 10 Jul 2022 09:16:33 +0200 Subject: [PATCH 241/416] modernize super() in algebras/ --- src/sage/algebras/askey_wilson.py | 4 ++-- src/sage/algebras/associated_graded.py | 2 +- src/sage/algebras/clifford_algebra.py | 12 ++++++------ src/sage/algebras/cluster_algebra.py | 2 +- src/sage/algebras/commutative_dga.py | 14 +++++++------- .../finite_dimensional_algebra.py | 6 +++--- src/sage/algebras/free_algebra.py | 8 ++++---- src/sage/algebras/free_algebra_element.py | 6 +++--- src/sage/algebras/free_algebra_quotient.py | 5 +++-- src/sage/algebras/free_zinbiel_algebra.py | 7 +++---- .../hecke_algebras/ariki_koike_algebra.py | 2 +- src/sage/algebras/iwahori_hecke_algebra.py | 8 ++++---- src/sage/algebras/lie_algebras/abelian.py | 2 +- .../algebras/lie_algebras/affine_lie_algebra.py | 6 +++--- .../lie_algebras/classical_lie_algebra.py | 3 +-- .../algebras/lie_algebras/free_lie_algebra.py | 10 +++++----- src/sage/algebras/lie_algebras/heisenberg.py | 11 ++++++----- src/sage/algebras/lie_algebras/lie_algebra.py | 8 ++++---- .../lie_algebras/nilpotent_lie_algebra.py | 10 +++++----- .../lie_algebras/poincare_birkhoff_witt.py | 9 +++++---- src/sage/algebras/lie_algebras/quotient.py | 8 +++----- .../lie_algebras/structure_coefficients.py | 3 +-- src/sage/algebras/lie_algebras/verma_module.py | 12 ++++++------ src/sage/algebras/lie_algebras/virasoro.py | 4 ++-- .../bosonic_ghosts_lie_conformal_algebra.py | 14 +++++++------- .../fermionic_ghosts_lie_conformal_algebra.py | 16 ++++++++-------- .../finitely_freely_generated_lca.py | 12 ++++++------ .../freely_generated_lie_conformal_algebra.py | 9 ++++----- .../lie_conformal_algebra_with_basis.py | 8 +++----- .../weyl_lie_conformal_algebra.py | 10 +++++----- src/sage/algebras/orlik_solomon.py | 2 +- src/sage/algebras/orlik_terao.py | 2 +- src/sage/algebras/q_system.py | 2 +- src/sage/algebras/quantum_clifford.py | 2 +- .../quantum_groups/ace_quantum_onsager.py | 2 +- src/sage/algebras/quantum_groups/fock_space.py | 4 ++-- .../quantum_groups/quantum_group_gap.py | 6 +++--- .../algebras/quantum_groups/representations.py | 2 +- .../quantum_matrix_coordinate_algebra.py | 15 +++++++-------- src/sage/algebras/rational_cherednik_algebra.py | 2 +- src/sage/algebras/schur_algebra.py | 2 +- src/sage/algebras/shuffle_algebra.py | 8 ++++---- src/sage/algebras/splitting_algebra.py | 17 ++++++++--------- src/sage/algebras/steenrod/steenrod_algebra.py | 7 ++++--- src/sage/algebras/tensor_algebra.py | 2 +- src/sage/algebras/weyl_algebra.py | 4 ++-- src/sage/algebras/yangian.py | 10 +++++----- src/sage/algebras/yokonuma_hecke_algebra.py | 4 ++-- 48 files changed, 159 insertions(+), 165 deletions(-) diff --git a/src/sage/algebras/askey_wilson.py b/src/sage/algebras/askey_wilson.py index 33014835bf0..37303e030c3 100644 --- a/src/sage/algebras/askey_wilson.py +++ b/src/sage/algebras/askey_wilson.py @@ -237,7 +237,7 @@ def __classcall_private__(cls, R, q=None): raise ValueError("q={} is not invertible in {}".format(q, R)) if R not in Rings().Commutative(): raise ValueError("{} is not a commutative ring".format(R)) - return super(AskeyWilsonAlgebra, cls).__classcall__(cls, R, q) + return super().__classcall__(cls, R, q) def __init__(self, R, q): r""" @@ -932,4 +932,4 @@ def _composition_(self, right, homset): return AlgebraMorphism(homset.domain(), [right(g) for g in self._on_generators], codomain=homset.codomain(), category=cat) - return super(self, AlgebraMorphism)._composition_(right, homset) + return super()._composition_(right, homset) diff --git a/src/sage/algebras/associated_graded.py b/src/sage/algebras/associated_graded.py index 499dd790c88..5e9d7b1f6b9 100644 --- a/src/sage/algebras/associated_graded.py +++ b/src/sage/algebras/associated_graded.py @@ -249,7 +249,7 @@ def _element_constructor_(self, x): if isinstance(x, CombinatorialFreeModule.Element): if x.parent() is self._A: return self._from_dict(dict(x)) - return super(AssociatedGradedAlgebra, self)._element_constructor_(x) + return super()._element_constructor_(x) def gen(self, *args, **kwds): """ diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index ece1c6e73a6..0c583b04f6c 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -463,7 +463,7 @@ def __classcall_private__(cls, Q, names=None): names = tuple( '{}{}'.format(names[0], i) for i in range(Q.dim()) ) else: raise ValueError("the number of variables does not match the number of generators") - return super(CliffordAlgebra, cls).__classcall__(cls, Q, names) + return super().__classcall__(cls, Q, names) def __init__(self, Q, names, category=None): r""" @@ -637,7 +637,7 @@ def _coerce_map_from_(self, V): if self.free_module().has_coerce_map_from(V): return True - return super(CliffordAlgebra, self)._coerce_map_from_(V) + return super()._coerce_map_from_(V) def _element_constructor_(self, x): """ @@ -682,7 +682,7 @@ def _element_constructor_(self, x): R = self.base_ring() return self.element_class(self, {i: R(c) for i,c in x if R(c) != R.zero()}) - return super(CliffordAlgebra, self)._element_constructor_(x) + return super()._element_constructor_(x) def gen(self, i): """ @@ -1369,7 +1369,7 @@ def __classcall_private__(cls, R, names=None, n=None): names = tuple( '{}{}'.format(names[0], i) for i in range(n) ) else: raise ValueError("the number of variables does not match the number of generators") - return super(ExteriorAlgebra, cls).__classcall__(cls, R, names) + return super().__classcall__(cls, R, names) def __init__(self, R, names): """ @@ -2211,7 +2211,7 @@ def __classcall__(cls, E, s_coeff): if isinstance(v, dict): R = E.base_ring() - v = E._from_dict({(i,): R(c) for i,c in v.items()}) + v = E._from_dict({(i,): R(c) for i, c in v.items()}) else: # Make sure v is in ``E`` v = E(v) @@ -2227,7 +2227,7 @@ def __classcall__(cls, E, s_coeff): d[(k[1], k[0])] = -v from sage.sets.family import Family - return super(ExteriorAlgebraDifferential, cls).__classcall__(cls, E, Family(d)) + return super().__classcall__(cls, E, Family(d)) def __init__(self, E, s_coeff): """ diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index b2ba26176b7..81615828b56 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -1338,7 +1338,7 @@ def __classcall__(self, data, **kwargs): # Determine scalars kwargs.setdefault('scalars', ZZ) - return super(ClusterAlgebra, self).__classcall__(self, B0, **kwargs) + return super().__classcall__(self, B0, **kwargs) def __init__(self, B, **kwargs): """ diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index ff80254caf9..af3434661f0 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -211,7 +211,7 @@ def __classcall__(cls, A, im_gens): raise ValueError("The given dictionary does not determine a degree 1 map") im_gens = tuple(im_gens.get(x, A.zero()) for x in A.gens()) - return super(Differential, cls).__classcall__(cls, A, im_gens) + return super().__classcall__(cls, A, im_gens) def __init__(self, A, im_gens): r""" @@ -998,9 +998,9 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= for i in range(n) if is_odd(tot_degs[i])], side='twosided') - return super(GCAlgebra, cls).__classcall__(cls, base=base, names=names, - degrees=degrees, R=R, I=I, - category=category) + return super().__classcall__(cls, base=base, names=names, + degrees=degrees, R=R, I=I, + category=category) def __init__(self, base, R=None, I=None, names=None, degrees=None, category=None): """ @@ -1236,7 +1236,7 @@ def _coerce_map_from_(self, other): .gens()): return False return self.cover_ring().has_coerce_map_from(other.cover_ring()) - return super(GCAlgebra, self)._coerce_map_from_(other) + return super()._coerce_map_from_(other) def _element_constructor_(self, x, coerce=True): r""" @@ -1755,7 +1755,7 @@ def _coerce_map_from_(self, other): return False elif isinstance(other, GCAlgebra): # Not multigraded return False - return super(GCAlgebra_multigraded, self)._coerce_map_from_(other) + return super()._coerce_map_from_(other) def basis(self, n, total=False): """ @@ -1971,7 +1971,7 @@ def __classcall__(cls, A, differential): differential = A.differential(differential) elif differential.parent() != A: differential = Differential(A, differential._dic_) - return super(GCAlgebra, cls).__classcall__(cls, A, differential) + return super().__classcall__(cls, A, differential) def __init__(self, A, differential): """ diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index d14a3bde46a..1b466d157b7 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -140,8 +140,8 @@ def __classcall_private__(cls, k, table, names='e', assume_associative=False, names = normalize_names(n, names) - return super(FiniteDimensionalAlgebra, cls).__classcall__(cls, k, table, - names, category=cat) + return super().__classcall__(cls, k, table, + names, category=cat) def __init__(self, k, table, names='e', category=None): """ @@ -249,7 +249,7 @@ def _Hom_(self, B, category): if category.is_subcategory(cat): from sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_morphism import FiniteDimensionalAlgebraHomset return FiniteDimensionalAlgebraHomset(self, B, category=category) - return super(FiniteDimensionalAlgebra, self)._Hom_(B, category) + return super()._Hom_(B, category) def ngens(self): """ diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 0b4c4ba8dbc..c53ab5da0e2 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -783,7 +783,7 @@ def quotient(self, mons, mats=None, names=None, **args): Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 over Rational Field """ if mats is None: - return super(FreeAlgebra_generic, self).quotient(mons, names) + return super().quotient(mons, names) from . import free_algebra_quotient return free_algebra_quotient.FreeAlgebraQuotient(self, mons, mats, names) @@ -1088,7 +1088,7 @@ def __classcall_private__(cls, R, n=None, names=None): if n is None: n = len(names) alg = FreeAlgebra(R, n, names) - return super(PBWBasisOfFreeAlgebra, cls).__classcall__(cls, alg) + return super().__classcall__(cls, alg) def __init__(self, alg): """ @@ -1137,7 +1137,7 @@ def _repr_term(self, w): 3*PBW[1] """ if len(w) == 0: - return super(PBWBasisOfFreeAlgebra, self)._repr_term(w) + return super()._repr_term(w) ret = '' p = 1 cur = None @@ -1149,7 +1149,7 @@ def _repr_term(self, w): if p != 1: ret += "^{}".format(p) ret += "*" - ret += super(PBWBasisOfFreeAlgebra, self)._repr_term(x.to_monoid_element()) + ret += super()._repr_term(x.to_monoid_element()) cur = x p = 1 if p != 1: diff --git a/src/sage/algebras/free_algebra_element.py b/src/sage/algebras/free_algebra_element.py index 8b7c39873c6..378f06479db 100644 --- a/src/sage/algebras/free_algebra_element.py +++ b/src/sage/algebras/free_algebra_element.py @@ -224,11 +224,11 @@ def _acted_upon_(self, scalar, self_on_left=False): if self_on_left: return Factorization([(self, 1)]) * scalar return scalar * Factorization([(self, 1)]) - return super(FreeAlgebraElement, self)._acted_upon_(scalar, self_on_left) + return super()._acted_upon_(scalar, self_on_left) # For backward compatibility - #_lmul_ = _acted_upon_ - #_rmul_ = _acted_upon_ + # _lmul_ = _acted_upon_ + # _rmul_ = _acted_upon_ def variables(self): """ diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index e3b325c4e57..d5f8050a1c9 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -83,10 +83,11 @@ def __classcall__(cls, A, mons, mats, names): M = M.parent()(M) M.set_immutable() new_mats.append(M) - return super(FreeAlgebraQuotient, cls).__classcall__(cls, A, tuple(mons), - tuple(new_mats), tuple(names)) + return super().__classcall__(cls, A, tuple(mons), + tuple(new_mats), tuple(names)) Element = FreeAlgebraQuotientElement + def __init__(self, A, mons, mats, names): """ Return a quotient algebra defined via the action of a free algebra diff --git a/src/sage/algebras/free_zinbiel_algebra.py b/src/sage/algebras/free_zinbiel_algebra.py index c87c48b6c9a..39ac9091618 100644 --- a/src/sage/algebras/free_zinbiel_algebra.py +++ b/src/sage/algebras/free_zinbiel_algebra.py @@ -211,10 +211,9 @@ def __classcall_private__(cls, R, n=None, names=None, side = '<' if side not in ['<', '>']: raise ValueError("side must be either '<' or '>'") - superclass = super(FreeZinbielAlgebra, cls) if names is None: - return superclass.__classcall__(cls, R, n, None, prefix, side) - return superclass.__classcall__(cls, R, n, tuple(names), prefix, side) + return super().__classcall__(cls, R, n, None, prefix, side) + return super().__classcall__(cls, R, n, tuple(names), prefix, side) def __init__(self, R, n, names, prefix, side): """ @@ -603,7 +602,7 @@ def _coerce_map_from_(self, R): return (all(x in self.variable_names() for x in R.variable_names()) and self.base_ring().has_coerce_map_from(R.base_ring())) - return super(FreeZinbielAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def construction(self): """ diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index 3cfb9c2c1d6..42a8de981b3 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -311,7 +311,7 @@ def __classcall_private__(cls, r, n, q=None, u=None, R=None): raise TypeError("base ring must be a commutative ring") q = R(q) u = tuple(u) - return super(ArikiKoikeAlgebra, cls).__classcall__(cls, r, n, q, u, R) + return super().__classcall__(cls, r, n, q, u, R) def __init__(self, r, n, q, u, R): r""" diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 5dde1e17330..ebbeb565341 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -449,7 +449,7 @@ def __classcall_private__(cls, W, q1, q2=-1, base_ring=None): else: q1 = base_ring(q1) q2 = base_ring(q2) - return super(IwahoriHeckeAlgebra, cls).__classcall__(cls, W, q1, q2, base_ring) + return super().__classcall__(cls, W, q1, q2, base_ring) def __init__(self, W, q1, q2, base_ring): r""" @@ -2498,7 +2498,7 @@ def __init__(self, IHAlgebra, prefix=None): except (TypeError, ZeroDivisionError): raise TypeError('the A-basis is defined only when 2 is invertible') - super(IwahoriHeckeAlgebra.A, self).__init__(IHAlgebra, prefix) + super().__init__(IHAlgebra, prefix) # Define and register coercions from the A basis to the T basis and back again from_A_to_T = self.module_morphism(self.to_T_basis, codomain=IHAlgebra.T(), @@ -2630,7 +2630,7 @@ def __init__(self, IHAlgebra, prefix=None): except (TypeError, ZeroDivisionError): raise TypeError('the B-basis is defined only when 2 is invertible') - super(IwahoriHeckeAlgebra.B, self).__init__(IHAlgebra, prefix) + super().__init__(IHAlgebra, prefix) # Define and register coercions from the B basis to the T basis and back again from_B_to_T = self.module_morphism(self.to_T_basis, codomain=IHAlgebra.T(), @@ -2745,7 +2745,7 @@ def __classcall_private__(cls, W): """ if W not in CoxeterGroups(): W = CoxeterGroup(W) - return super(IwahoriHeckeAlgebra_nonstandard, cls).__classcall__(cls, W) + return super().__classcall__(cls, W) def __init__(self, W): r""" diff --git a/src/sage/algebras/lie_algebras/abelian.py b/src/sage/algebras/lie_algebras/abelian.py index 3627c97b6ad..b0f3f685ee1 100644 --- a/src/sage/algebras/lie_algebras/abelian.py +++ b/src/sage/algebras/lie_algebras/abelian.py @@ -54,7 +54,7 @@ def __classcall_private__(cls, R, names=None, index_set=None, category=None, **k names, index_set = standardize_names_index_set(names, index_set) if index_set.cardinality() == infinity: return InfiniteDimensionalAbelianLieAlgebra(R, index_set, **kwds) - return super(AbelianLieAlgebra, cls).__classcall__(cls, R, names, index_set, category=category, **kwds) + return super().__classcall__(cls, R, names, index_set, category=category, **kwds) def __init__(self, R, names, index_set, category, **kwds): """ diff --git a/src/sage/algebras/lie_algebras/affine_lie_algebra.py b/src/sage/algebras/lie_algebras/affine_lie_algebra.py index 2464030edd9..90ecf56a5f0 100644 --- a/src/sage/algebras/lie_algebras/affine_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/affine_lie_algebra.py @@ -174,7 +174,7 @@ def __classcall_private__(cls, arg0, cartan_type=None, kac_moody=True): if not cartan_type.is_untwisted_affine(): raise NotImplementedError("only currently implemented for untwisted affine types") - return super(AffineLieAlgebra, cls).__classcall__(cls, g, kac_moody) + return super().__classcall__(cls, g, kac_moody) def __init__(self, g, kac_moody): """ @@ -273,7 +273,7 @@ def _element_constructor_(self, x): if P == self._g: zero = self.base_ring().zero() return self.element_class(self, {0: x}, zero, zero) - return super(AffineLieAlgebra, self)._element_constructor_(x) + return super()._element_constructor_(x) def _coerce_map_from_(self, R): """ @@ -292,7 +292,7 @@ def _coerce_map_from_(self, R): """ if R is self.derived_subalgebra() or R is self._g: return True - return super(AffineLieAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def derived_subalgebra(self): """ diff --git a/src/sage/algebras/lie_algebras/classical_lie_algebra.py b/src/sage/algebras/lie_algebras/classical_lie_algebra.py index e157153e905..1ae47fa7a31 100644 --- a/src/sage/algebras/lie_algebras/classical_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/classical_lie_algebra.py @@ -1568,8 +1568,7 @@ def __classcall_private__(cls, R, cartan_type): cartan_type = cartan_type.cartan_type() else: cartan_type = CartanType(cartan_type) - return super(LieAlgebraChevalleyBasis, cls).__classcall__( - cls, R, cartan_type) + return super().__classcall__(cls, R, cartan_type) def __init__(self, R, cartan_type): r""" diff --git a/src/sage/algebras/lie_algebras/free_lie_algebra.py b/src/sage/algebras/lie_algebras/free_lie_algebra.py index 4604328fbe7..8a02e5265c6 100644 --- a/src/sage/algebras/lie_algebras/free_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/free_lie_algebra.py @@ -19,8 +19,8 @@ # 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.misc.abstract_method import abstract_method from sage.misc.cachefunc import cached_method @@ -169,7 +169,7 @@ def _element_constructor_(self, x): """ if not isinstance(x, list) and x in self._indices: return self.monomial(x) - return super(FreeLieBasis_abstract, self)._element_constructor_(x) + return super()._element_constructor_(x) def monomial(self, x): """ @@ -185,7 +185,7 @@ def monomial(self, x): """ if not isinstance(x, (LieGenerator, GradedLieBracket)): if isinstance(x, list): - return super(FreeLieBasis_abstract, self)._element_constructor_(x) + return super()._element_constructor_(x) else: i = self._indices.index(x) x = LieGenerator(x, i) @@ -363,7 +363,7 @@ def __classcall_private__(cls, R, names=None, index_set=None): True """ names, index_set = standardize_names_index_set(names, index_set) - return super(FreeLieAlgebra, cls).__classcall__(cls, R, names, index_set) + return super().__classcall__(cls, R, names, index_set) def __init__(self, R, names, index_set): """ diff --git a/src/sage/algebras/lie_algebras/heisenberg.py b/src/sage/algebras/lie_algebras/heisenberg.py index b2f81946a32..4662a3e313f 100644 --- a/src/sage/algebras/lie_algebras/heisenberg.py +++ b/src/sage/algebras/lie_algebras/heisenberg.py @@ -328,7 +328,7 @@ def _coerce_map_from_(self, H): if H._n <= self._n and self.base_ring().has_coerce_map_from(H.base_ring()): return H.module_morphism(lambda i: self.basis()[i], codomain=self) return None # Otherwise no coercion - return super(HeisenbergAlgebra_fd, self)._coerce_map_from_(H) + return super()._coerce_map_from_(H) class HeisenbergAlgebra(HeisenbergAlgebra_fd, HeisenbergAlgebra_abstract, @@ -547,15 +547,16 @@ def _coerce_map_from_(self, H): if isinstance(H, HeisenbergAlgebra_fd): if self.base_ring().has_coerce_map_from(H.base_ring()): return H.module_morphism(self._from_fd_on_basis, codomain=self) - return None # Otherwise no coercion + return None # Otherwise no coercion if isinstance(H, InfiniteHeisenbergAlgebra): if self.base_ring().has_coerce_map_from(H.base_ring()): return lambda C,x: self._from_dict(x._monomial_coefficients, coerce=True) - return None # Otherwise no coercion - return super(InfiniteHeisenbergAlgebra, self)._coerce_map_from_(H) + return None # Otherwise no coercion + return super()._coerce_map_from_(H) + ####################################################### -## Finite rank Heisenberg algebra using matrices +# Finite rank Heisenberg algebra using matrices class HeisenbergAlgebra_matrix(HeisenbergAlgebra_fd, LieAlgebraFromAssociative): r""" diff --git a/src/sage/algebras/lie_algebras/lie_algebra.py b/src/sage/algebras/lie_algebras/lie_algebra.py index 6a13a314175..0aa08d2a823 100644 --- a/src/sage/algebras/lie_algebras/lie_algebra.py +++ b/src/sage/algebras/lie_algebras/lie_algebra.py @@ -599,7 +599,7 @@ def __getitem__(self, x): return x[1].ideal(x[0]) # Otherwise it is the bracket of two elements return self(x[0])._bracket_(self(x[1])) - return super(LieAlgebra, self).__getitem__(x) + return super().__getitem__(x) def _coerce_map_from_(self, R): """ @@ -1132,8 +1132,8 @@ def __classcall_private__(cls, A, gens=None, names=None, index_set=None, index_set=index_set, category=category) - return super(LieAlgebraFromAssociative, cls).__classcall__(cls, - A, gens, names=names, index_set=index_set, category=category) + return super().__classcall__(cls, A, gens, names=names, + index_set=index_set, category=category) def __init__(self, A, gens=None, names=None, index_set=None, category=None): """ @@ -1352,7 +1352,7 @@ def is_abelian(self): """ if self._assoc.is_commutative(): return True - return super(LieAlgebraFromAssociative, self).is_abelian() + return super().is_abelian() def _an_element_(self): """ diff --git a/src/sage/algebras/lie_algebras/nilpotent_lie_algebra.py b/src/sage/algebras/lie_algebras/nilpotent_lie_algebra.py index e22c1a0fd25..a97e422e54b 100644 --- a/src/sage/algebras/lie_algebras/nilpotent_lie_algebra.py +++ b/src/sage/algebras/lie_algebras/nilpotent_lie_algebra.py @@ -129,8 +129,8 @@ def __classcall_private__(cls, R, s_coeff, names=None, index_set=None, cat = LieAlgebras(R).FiniteDimensional().WithBasis().Nilpotent() category = cat.or_subcategory(category) - return super(NilpotentLieAlgebra_dense, cls).__classcall__( - cls, R, s_coeff, names, index_set, category=category, **kwds) + return super().__classcall__(cls, R, s_coeff, names, + index_set, category=category, **kwds) def __init__(self, R, s_coeff, names, index_set, step=None, **kwds): r""" @@ -158,7 +158,7 @@ def _repr_(self): sage: L Nilpotent Lie algebra on 4 generators (X, Y, Z, W) over Rational Field """ - return "Nilpotent %s" % (super(NilpotentLieAlgebra_dense, self)._repr_()) + return "Nilpotent %s" % (super()._repr_()) class FreeNilpotentLieAlgebra(NilpotentLieAlgebra_dense): @@ -334,7 +334,7 @@ def __classcall_private__(cls, R, r, s, names=None, naming=None, category=None, cat = LieAlgebras(R).FiniteDimensional().WithBasis() category = cat.Graded().Stratified().or_subcategory(category) - return super(FreeNilpotentLieAlgebra, cls).__classcall__( + return super().__classcall__( cls, R, r, s, names=tuple(names), naming=naming, category=category, **kwds) @@ -452,4 +452,4 @@ def _repr_(self): sage: L Free Nilpotent Lie algebra on 5 generators (X_1, X_2, X_12, X_112, X_122) over Rational Field """ - return "Free %s" % (super(FreeNilpotentLieAlgebra, self)._repr_()) + return "Free %s" % (super()._repr_()) diff --git a/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py b/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py index 34df1d3281f..dbfc3d3d5ec 100644 --- a/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py +++ b/src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py @@ -111,8 +111,8 @@ def __classcall_private__(cls, g, basis_key=None, prefix='PBW', **kwds): sage: P1 is P2 True """ - return super(PoincareBirkhoffWittBasis, cls).__classcall__(cls, - g, basis_key, prefix, **kwds) + return super().__classcall__(cls, + g, basis_key, prefix, **kwds) def __init__(self, g, basis_key, prefix, **kwds): """ @@ -345,7 +345,8 @@ def inv_supp(m): I = self._indices def basis_function(x): - return self.prod(self.monomial(I.gen(g)**e) for g,e in x._sorted_items()) + 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... return R.module_morphism(basis_function, codomain=self) coerce_map = self._g.coerce_map_from(R._g) @@ -359,7 +360,7 @@ def basis_function(x): # TODO: this diagonal, but with a smaller indexing set... return R.module_morphism(basis_function, codomain=self) - return super(PoincareBirkhoffWittBasis, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def lie_algebra(self): """ diff --git a/src/sage/algebras/lie_algebras/quotient.py b/src/sage/algebras/lie_algebras/quotient.py index d3c5c226bb9..7fe6b29677f 100644 --- a/src/sage/algebras/lie_algebras/quotient.py +++ b/src/sage/algebras/lie_algebras/quotient.py @@ -233,9 +233,8 @@ def __classcall_private__(cls, I, ambient=None, names=None, cat = cat.Nilpotent() category = cat.Subquotients().or_subcategory(category) - sup = super(LieQuotient_finite_dimensional_with_basis, cls) - return sup.__classcall__(cls, I, ambient, names, index_set, - category=category) + return super().__classcall__(cls, I, ambient, names, index_set, + category=category) def __init__(self, I, L, names, index_set, category=None): r""" @@ -416,5 +415,4 @@ 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(LieQuotient_finite_dimensional_with_basis, self) - return sup.from_vector(v) + return super().from_vector(v) diff --git a/src/sage/algebras/lie_algebras/structure_coefficients.py b/src/sage/algebras/lie_algebras/structure_coefficients.py index 3f8cd1fd5e6..8eb6033c4c4 100644 --- a/src/sage/algebras/lie_algebras/structure_coefficients.py +++ b/src/sage/algebras/lie_algebras/structure_coefficients.py @@ -137,8 +137,7 @@ def __classcall_private__(cls, R, s_coeff, names=None, index_set=None, **kwds): from sage.algebras.lie_algebras.abelian import AbelianLieAlgebra return AbelianLieAlgebra(R, names, index_set, **kwds) - return super(LieAlgebraWithStructureCoefficients, cls).__classcall__( - cls, R, s_coeff, names, index_set, **kwds) + return super().__classcall__(cls, R, s_coeff, names, index_set, **kwds) @staticmethod def _standardize_s_coeff(s_coeff, index_set): diff --git a/src/sage/algebras/lie_algebras/verma_module.py b/src/sage/algebras/lie_algebras/verma_module.py index 2ba5da72c2c..5a9d5956557 100644 --- a/src/sage/algebras/lie_algebras/verma_module.py +++ b/src/sage/algebras/lie_algebras/verma_module.py @@ -253,7 +253,7 @@ def _repr_generator(self, m): sage: 2 * M.highest_weight_vector() 2*v[(-1/14, 3/7)] """ - ret = super(VermaModule, self)._repr_generator(m) + ret = super()._repr_generator(m) if ret == '1': ret = '' else: @@ -280,7 +280,7 @@ def _latex_generator(self, m): sage: latex(M.highest_weight_vector()) v_{-\frac{1}{14} e_{0} + \frac{3}{7} e_{1}} """ - ret = super(VermaModule, self)._latex_generator(m) + ret = super()._latex_generator(m) if ret == '1': ret = '' from sage.misc.latex import latex @@ -421,7 +421,7 @@ def _coerce_map_from_(self, R): H = Hom(R, self) if H.dimension() == 1: return H.natural_map() - return super(VermaModule, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def _element_constructor_(self, x): r""" @@ -449,7 +449,7 @@ def _element_constructor_(self, x): return self._from_dict({self._indices.one(): x}) if isinstance(x, self._pbw.element_class): return self.highest_weight_vector()._acted_upon_(x, False) - return super(VermaModule, self)._element_constructor_(self, x) + return super()._element_constructor_(self, x) @lazy_attribute def _dominant_data(self): @@ -929,7 +929,7 @@ def _composition_(self, right, homset): if (isinstance(right, VermaModuleMorphism) and right.domain()._g is self.codomain()._g): return homset.element_class(homset, right._scalar * self._scalar) - return super(VermaModuleMorphism, self)._composition_(right, homset) + return super()._composition_(right, homset) def is_injective(self): r""" @@ -1051,7 +1051,7 @@ def __call__(self, x, **options): return self.zero() return self.element_class(self, self.base_ring()(x)) - return super(VermaModuleHomset, self).__call__(x, **options) + return super().__call__(x, **options) def _an_element_(self): """ diff --git a/src/sage/algebras/lie_algebras/virasoro.py b/src/sage/algebras/lie_algebras/virasoro.py index c6bb515600a..16589b60391 100644 --- a/src/sage/algebras/lie_algebras/virasoro.py +++ b/src/sage/algebras/lie_algebras/virasoro.py @@ -877,7 +877,7 @@ def __classcall_private__(cls, V, c, h): True """ R = V.base_ring() - return super(VermaModule, cls).__classcall__(cls, V, R(c), R(h)) + return super().__classcall__(cls, V, R(c), R(h)) @staticmethod def _partition_to_neg_tuple(x): @@ -978,7 +978,7 @@ def _monomial(self, index): if index >= 0: raise ValueError("sequence must have non-positive entries") index = (index,) - return super(VermaModule, self)._monomial(index) + return super()._monomial(index) def central_charge(self): """ diff --git a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py index a2c4d607cb6..e5cddaed759 100644 --- a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py @@ -102,18 +102,18 @@ def __init__(self, R, ngens=2, names=None, index_set=None): names,index_set = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens) - A = identity_matrix(R,ngens/2) + A = identity_matrix(R, ngens // 2) from sage.matrix.special import block_matrix gram_matrix = block_matrix([[R.zero(),A],[-A,R.zero()]]) ghostsdict = { (i,j): {0: {('K',0): gram_matrix[index_set.rank(i), index_set.rank(j)]}} for i in index_set for j in index_set} weights = (1,)*(ngens//2) + (0,)*(ngens//2) - super(BosonicGhostsLieConformalAlgebra,self).__init__(R, - ghostsdict,names=names, - latex_names=latex_names, - index_set=index_set, - weights=weights, - central_elements=('K',)) + super().__init__(R, + ghostsdict,names=names, + latex_names=latex_names, + index_set=index_set, + weights=weights, + central_elements=('K',)) def _repr_(self): """ diff --git a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py index 1615ae1bdca..4a74d9f9357 100644 --- a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py @@ -98,20 +98,20 @@ def __init__(self,R,ngens=2,names=None,index_set=None): index_set=index_set, ngens=ngens) from sage.matrix.special import identity_matrix - A = identity_matrix(R,ngens/2) + A = identity_matrix(R, ngens // 2) from sage.matrix.special import block_matrix gram_matrix = block_matrix([[R.zero(),A],[A,R.zero()]]) ghostsdict = { (i,j): {0: {('K',0): gram_matrix[index_set.rank(i), index_set.rank(j)]}} for i in index_set for j in index_set} weights = (1,)*(ngens//2) + (0,)*(ngens//2) parity = (1,)*ngens - super(FermionicGhostsLieConformalAlgebra,self).__init__(R, - ghostsdict,names=names, - latex_names=latex_names, - index_set=index_set, - weights=weights, - parity=parity, - central_elements=('K',)) + super().__init__(R, + ghostsdict,names=names, + latex_names=latex_names, + index_set=index_set, + weights=weights, + parity=parity, + central_elements=('K',)) def _repr_(self): """ diff --git a/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py b/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py index b204c4a89b7..96f6c99defe 100644 --- a/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +++ b/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py @@ -30,8 +30,8 @@ class FinitelyFreelyGeneratedLCA(FreelyGeneratedLieConformalAlgebra): number of generators. """ def __init__(self, R, index_set=None, central_elements=None, category=None, - element_class=None, prefix=None, names=None, latex_names=None, - **kwds): + element_class=None, prefix=None, names=None, latex_names=None, + **kwds): """ Initialize self. @@ -50,10 +50,10 @@ def __init__(self, R, index_set=None, central_elements=None, category=None, if index_set not in Sets().Finite(): raise TypeError("index_set must be a finite set") - super(FinitelyFreelyGeneratedLCA,self).__init__(R, - index_set=index_set, central_elements=central_elements, - category=category, element_class=element_class, - prefix=prefix, **kwds) + super().__init__(R, + index_set=index_set, central_elements=central_elements, + category=category, element_class=element_class, + prefix=prefix, **kwds) self._ngens = len(self._generators) self._names = names self._latex_names = latex_names diff --git a/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py index d936fcb9f8a..f462a933a38 100644 --- a/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py @@ -36,7 +36,7 @@ class FreelyGeneratedLieConformalAlgebra(LieConformalAlgebraWithBasis): We now only accept direct sums of free modules plus some central generators `C_i` such that `TC_i = 0`. """ - def __init__(self,R, index_set=None, central_elements=None, category=None, + def __init__(self, R, index_set=None, central_elements=None, category=None, element_class=None, prefix=None, **kwds): """ Initialize self. @@ -52,11 +52,10 @@ def __init__(self,R, index_set=None, central_elements=None, category=None, self._generators = DisjointUnionEnumeratedSets([index_set, Family(central_elements)]) E = DisjointUnionEnumeratedSets((cartesian_product([ - Family(central_elements), {Integer(0)}]),E)) + Family(central_elements), {Integer(0)}]), E)) - super(FreelyGeneratedLieConformalAlgebra,self).__init__(R, basis_keys=E, - element_class=element_class, category=category, prefix=prefix, - **kwds) + super().__init__(R, basis_keys=E, element_class=element_class, + category=category, prefix=prefix, **kwds) if central_elements is not None: self._central_elements = Family(central_elements) diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py index e56785601fe..ae4882dbad0 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py @@ -50,7 +50,7 @@ class LieConformalAlgebraWithBasis(CombinatorialFreeModule): sage: R._repr_generator(R.0) 'e' """ - def __init__(self,R, basis_keys=None, element_class=None, category=None, + def __init__(self, R, basis_keys=None, element_class=None, category=None, prefix=None, **kwds): """ Initialize self. @@ -60,7 +60,6 @@ def __init__(self,R, basis_keys=None, element_class=None, category=None, sage: V = lie_conformal_algebras.Affine(QQ,'A1') sage: TestSuite(V).run() """ - if prefix is None: prefix = '' kwds['bracket'] = '' @@ -72,6 +71,5 @@ def __init__(self,R, basis_keys=None, element_class=None, category=None, except ValueError: category = default_category.Super().or_subcategory(category) - super(LieConformalAlgebraWithBasis,self).__init__(R, - basis_keys=basis_keys, element_class=element_class, - category=category, prefix=prefix, names=None, **kwds) + super().__init__(R, basis_keys=basis_keys, element_class=element_class, + category=category, prefix=prefix, names=None, **kwds) diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py index bd2fa01b0a7..ee47970a31f 100644 --- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py @@ -162,16 +162,16 @@ def __init__(self,R,ngens=None, gram_matrix=None, names=None, names = 'alpha' latex_names = tuple(r'\alpha_{%d}' % i for i in range(ngens)) + ('K',) - names,index_set = standardize_names_index_set(names=names, + names, index_set = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens) weyldict = { (i,j): {0: {('K',0): gram_matrix[index_set.rank(i), index_set.rank(j)]}} for i in index_set for j in index_set} - super(WeylLieConformalAlgebra,self).__init__(R,weyldict,names=names, - latex_names=latex_names, - index_set=index_set, - central_elements=('K',)) + super().__init__(R, weyldict, names=names, + latex_names=latex_names, + index_set=index_set, + central_elements=('K',)) self._gram_matrix = gram_matrix def _repr_(self): diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index 5de7269ac14..ffbbbb6a5af 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -99,7 +99,7 @@ def __classcall_private__(cls, R, M, ordering=None): """ if ordering is None: ordering = sorted(M.groundset()) - return super(OrlikSolomonAlgebra, cls).__classcall__(cls, R, M, tuple(ordering)) + return super().__classcall__(cls, R, M, tuple(ordering)) def __init__(self, R, M, ordering=None): """ diff --git a/src/sage/algebras/orlik_terao.py b/src/sage/algebras/orlik_terao.py index 128e6156ba7..458bb07b926 100644 --- a/src/sage/algebras/orlik_terao.py +++ b/src/sage/algebras/orlik_terao.py @@ -118,7 +118,7 @@ def __classcall_private__(cls, R, M, ordering=None): """ if ordering is None: ordering = sorted(M.groundset()) - return super(OrlikTeraoAlgebra, cls).__classcall__(cls, R, M, tuple(ordering)) + return super().__classcall__(cls, R, M, tuple(ordering)) def __init__(self, R, M, ordering=None): """ diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index 1050f148c48..f7d495aac50 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -149,7 +149,7 @@ def __classcall__(cls, base_ring, cartan_type, level=None, twisted=False): raise ValueError("the Cartan type is not tamely-laced") if twisted and not cartan_type.is_affine() and not cartan_type.is_untwisted_affine(): raise ValueError("the Cartan type must be of twisted type") - return super(QSystem, cls).__classcall__(cls, base_ring, cartan_type, level, twisted) + return super().__classcall__(cls, base_ring, cartan_type, level, twisted) def __init__(self, base_ring, cartan_type, level, twisted): """ diff --git a/src/sage/algebras/quantum_clifford.py b/src/sage/algebras/quantum_clifford.py index 35b84838f4c..8d11f400478 100644 --- a/src/sage/algebras/quantum_clifford.py +++ b/src/sage/algebras/quantum_clifford.py @@ -149,7 +149,7 @@ def __classcall_private__(cls, n, k=1, q=None, F=None): q = F(q) if F not in Fields(): raise TypeError("base ring must be a field") - return super(QuantumCliffordAlgebra, cls).__classcall__(cls, n, k, q, F) + return super().__classcall__(cls, n, k, q, F) def __init__(self, n, k, q, F): r""" diff --git a/src/sage/algebras/quantum_groups/ace_quantum_onsager.py b/src/sage/algebras/quantum_groups/ace_quantum_onsager.py index 990f06bd03e..91138258e5a 100644 --- a/src/sage/algebras/quantum_groups/ace_quantum_onsager.py +++ b/src/sage/algebras/quantum_groups/ace_quantum_onsager.py @@ -135,7 +135,7 @@ def __classcall_private__(cls, R=None, q=None): R = q.parent() else: q = R(q) - return super(ACEQuantumOnsagerAlgebra, cls).__classcall__(cls, R, q) + return super().__classcall__(cls, R, q) def __init__(self, R, q): r""" diff --git a/src/sage/algebras/quantum_groups/fock_space.py b/src/sage/algebras/quantum_groups/fock_space.py index 978a996125d..dea28fd1760 100644 --- a/src/sage/algebras/quantum_groups/fock_space.py +++ b/src/sage/algebras/quantum_groups/fock_space.py @@ -336,7 +336,7 @@ def __classcall_private__(cls, n, multicharge=[0], q=None, base_ring=None, trunc multicharge = tuple(M(e) for e in multicharge) if truncated is not None: return FockSpaceTruncated(n, truncated, q, base_ring) - return super(FockSpace, cls).__classcall__(cls, n, multicharge, q, base_ring) + return super().__classcall__(cls, n, multicharge, q, base_ring) def __init__(self, n, multicharge, q, base_ring): r""" @@ -1676,7 +1676,7 @@ def __classcall_private__(cls, n, k, q=None, base_ring=None): base_ring = q.parent() base_ring = FractionField(base_ring) q = base_ring(q) - return super(FockSpace, cls).__classcall__(cls, n, k, q, base_ring) + return super().__classcall__(cls, n, k, q, base_ring) def __init__(self, n, k, q, base_ring): r""" diff --git a/src/sage/algebras/quantum_groups/quantum_group_gap.py b/src/sage/algebras/quantum_groups/quantum_group_gap.py index 3e58d5576e8..0a647ffee17 100644 --- a/src/sage/algebras/quantum_groups/quantum_group_gap.py +++ b/src/sage/algebras/quantum_groups/quantum_group_gap.py @@ -353,7 +353,7 @@ def __classcall_private__(cls, cartan_type, q=None): True """ cartan_type = CartanType(cartan_type) - return super(QuantumGroup, cls).__classcall__(cls, cartan_type, q) + return super().__classcall__(cls, cartan_type, q) def __init__(self, cartan_type, q): """ @@ -1721,7 +1721,7 @@ def __classcall_private__(cls, Q, weight): weight = P.sum(la * weight[i] for i, la in enumerate(La)) else: weight = P(weight) - return super(HighestWeightModule, cls).__classcall__(cls, Q, weight) + return super().__classcall__(cls, Q, weight) def __init__(self, Q, weight): """ @@ -2141,7 +2141,7 @@ def __classcall_private__(cls, Q): from sage.combinat.root_system.cartan_type import CartanType_abstract if isinstance(Q, CartanType_abstract): Q = QuantumGroup(Q) - return super(LowerHalfQuantumGroup, cls).__classcall__(cls, Q) + return super().__classcall__(cls, Q) def __init__(self, Q): """ diff --git a/src/sage/algebras/quantum_groups/representations.py b/src/sage/algebras/quantum_groups/representations.py index efd977f45cf..b874d264669 100644 --- a/src/sage/algebras/quantum_groups/representations.py +++ b/src/sage/algebras/quantum_groups/representations.py @@ -52,7 +52,7 @@ def __classcall__(cls, R, C, q=None): """ if q is None: q = R.gen() - return super(QuantumGroupRepresentation, cls).__classcall__(cls, R, C, q) + return super().__classcall__(cls, R, C, q) def __init__(self, R, C, q): """ diff --git a/src/sage/algebras/quantum_matrix_coordinate_algebra.py b/src/sage/algebras/quantum_matrix_coordinate_algebra.py index 9dfff20cc70..1579896fa86 100644 --- a/src/sage/algebras/quantum_matrix_coordinate_algebra.py +++ b/src/sage/algebras/quantum_matrix_coordinate_algebra.py @@ -58,9 +58,8 @@ def __classcall__(cls, q=None, bar=None, R=None, **kwds): q = R(q) if q is None: q = LaurentPolynomialRing(R, 'q').gen() - return super(QuantumMatrixCoordinateAlgebra_abstract, - cls).__classcall__(cls, - q=q, bar=bar, R=q.parent(), **kwds) + return super().__classcall__(cls, + q=q, bar=bar, R=q.parent(), **kwds) def __init__(self, gp_indices, n, q, bar, R, category, indices_key=None): """ @@ -502,9 +501,9 @@ def __classcall_private__(cls, m, n=None, q=None, bar=None, R=None): """ if n is None: n = m - return super(QuantumMatrixCoordinateAlgebra, cls).__classcall__(cls, m=m, n=n, - q=q, bar=bar, - R=R) + return super().__classcall__(cls, m=m, n=n, + q=q, bar=bar, + R=R) def __init__(self, m, n, q, bar, R): """ @@ -739,7 +738,7 @@ def __classcall_private__(cls, n, q=None, bar=None, R=None): sage: O1 is O4 False """ - return super(QuantumGL, cls).__classcall__(cls, n=n, q=q, bar=bar, R=R) + return super().__classcall__(cls, n=n, q=q, bar=bar, R=R) def __init__(self, n, q, bar, R): """ @@ -878,7 +877,7 @@ def product_on_basis(self, a, b): c_exp += db.pop('c') b = I(db) # a and b contain no powers of c - p = super(QuantumGL, self).product_on_basis(a, b) + p = super().product_on_basis(a, b) if c_exp == 0: return p c = self._indices.monoid_generators()['c'] diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index 204fcfc6020..597954c7249 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -114,7 +114,7 @@ def __classcall_private__(cls, ct, c=1, t=None, base_ring=None, prefix=('a', 's' else: c = (c, c) - return super(RationalCherednikAlgebra, cls).__classcall__(cls, ct, c, t, base_ring, tuple(prefix)) + return super().__classcall__(cls, ct, c, t, base_ring, tuple(prefix)) def __init__(self, ct, c, t, base_ring, prefix): r""" diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index a700b6b8854..ba606ded999 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -528,7 +528,7 @@ def _acted_upon_(self, elt, self_on_left=False): elif elt in P._schur: # self_on_left is False return P._schur_action(elt, self) - return super(SchurTensorModule.Element, self)._acted_upon_(elt, self_on_left) + return super()._acted_upon_(elt, self_on_left) def GL_irreducible_character(n, mu, KK): diff --git a/src/sage/algebras/shuffle_algebra.py b/src/sage/algebras/shuffle_algebra.py index d5e7b524c5f..7ef009fd61f 100644 --- a/src/sage/algebras/shuffle_algebra.py +++ b/src/sage/algebras/shuffle_algebra.py @@ -140,8 +140,8 @@ def __classcall_private__(cls, R, names, prefix=None): """ if prefix is None: prefix = 'B' - return super(ShuffleAlgebra, cls).__classcall__(cls, R, - Alphabet(names), prefix) + return super().__classcall__(cls, R, + Alphabet(names), prefix) def __init__(self, R, names, prefix): r""" @@ -661,7 +661,7 @@ def __classcall_private__(cls, R, names): sage: D1 is D2 True """ - return super(DualPBWBasis, cls).__classcall__(cls, R, Alphabet(names)) + return super().__classcall__(cls, R, Alphabet(names)) def __init__(self, R, names): """ @@ -709,7 +709,7 @@ def _element_constructor_(self, x): x = W(x) elif isinstance(x.parent(), ShuffleAlgebra): return self._alg.to_dual_pbw_element(self._alg(x)) - return super(DualPBWBasis, self)._element_constructor_(x) + return super()._element_constructor_(x) def _coerce_map_from_(self, R): """ diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 0eb2fed7746..e19a2bb6d9a 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -83,8 +83,7 @@ def __invert__(self): if self in inv_elements: return inv_elements[self] - return super(SplittingAlgebraElement, self).__invert__() - + return super().__invert__() def is_unit(self): r""" @@ -101,7 +100,7 @@ def is_unit(self): if self in inv_elements: return True - return super(SplittingAlgebraElement, self).is_unit() + return super().is_unit() def dict(self): r""" @@ -464,7 +463,7 @@ def _element_constructor_(self, x): if isinstance(x, SplittingAlgebraElement): # coercion from covering fixes pickling problems return self(x.lift()) - return super(SplittingAlgebra, self)._element_constructor_(x) + return super()._element_constructor_(x) def hom(self, im_gens, codomain=None, check=True, base_map=None): r""" @@ -492,19 +491,19 @@ def hom(self, im_gens, codomain=None, check=True, base_map=None): """ base_ring = self.base_ring() - if not isinstance(im_gens, (list,tuple)): + if not isinstance(im_gens, (list, tuple)): im_gens = [im_gens] all_gens = self.gens_dict_recursive() if len(im_gens) != len(all_gens): - return super(SplittingAlgebra, self).hom(im_gens, codomain=codomain, check=check, base_map=base_map) + return super().hom(im_gens, codomain=codomain, check=check, base_map=base_map) num_gens = len(self.gens()) - im_gens_start = [img for img in im_gens if im_gens.index(img) < num_gens] - im_gens_end = [img for img in im_gens if im_gens.index(img) >= num_gens] + im_gens_start = [img for img in im_gens if im_gens.index(img) < num_gens] + im_gens_end = [img for img in im_gens if im_gens.index(img) >= num_gens] if not im_gens_end: - return super(SplittingAlgebra, self).hom(im_gens, codomain=codomain, check=check, base_map=base_map) + return super().hom(im_gens, codomain=codomain, check=check, base_map=base_map) verbose('base %s im_gens_end %s codomain %s check %s base_map %s' % (base_ring, im_gens_end, codomain, check, base_map)) hom_on_base_recurs = base_ring.hom(im_gens_end, codomain=codomain, check=check, base_map=base_map) diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index f18797dc0de..9e9ad450358 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -509,9 +509,10 @@ def __classcall__(self, p=2, basis='milnor', **kwds): raise ValueError("option 'generic' is not a boolean") std_basis = get_basis_name(basis, p, generic=std_generic) - std_profile, std_type = normalize_profile(profile, precision=precision, truncation_type=truncation_type, p=p, generic=std_generic) - return super(SteenrodAlgebra_generic, self).__classcall__(self, p=p, basis=std_basis, profile=std_profile, - truncation_type=std_type, generic=std_generic) + std_profile, std_type = normalize_profile(profile, precision=precision, + truncation_type=truncation_type, p=p, generic=std_generic) + return super().__classcall__(self, p=p, basis=std_basis, profile=std_profile, + truncation_type=std_type, generic=std_generic) def __init__(self, p=2, basis='milnor', **kwds): r""" diff --git a/src/sage/algebras/tensor_algebra.py b/src/sage/algebras/tensor_algebra.py index 5d44e1057a9..664027ee6ae 100644 --- a/src/sage/algebras/tensor_algebra.py +++ b/src/sage/algebras/tensor_algebra.py @@ -375,7 +375,7 @@ def _coerce_map_from_(self, R): for i,M in enumerate(modules)]), codomain=self) - return super(TensorAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def construction(self): """ diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index c43cc7839dd..13604578430 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -739,7 +739,7 @@ def __classcall__(cls, R, names=None): raise ValueError("the names must be specified") elif R not in Rings().Commutative(): raise TypeError("argument R must be a commutative ring") - return super(DifferentialWeylAlgebra, cls).__classcall__(cls, R, names) + return super().__classcall__(cls, R, names) def __init__(self, R, names=None): r""" @@ -888,7 +888,7 @@ def _coerce_map_from_(self, R): if isinstance(R, DifferentialWeylAlgebra): return ( R.variable_names() == self.variable_names() and self.base_ring().has_coerce_map_from(R.base_ring()) ) - return super(DifferentialWeylAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def degree_on_basis(self, i): """ diff --git a/src/sage/algebras/yangian.py b/src/sage/algebras/yangian.py index e7d1945ab31..b63648bbb95 100644 --- a/src/sage/algebras/yangian.py +++ b/src/sage/algebras/yangian.py @@ -368,9 +368,9 @@ def __classcall_private__(cls, base_ring, n, level=None, return YangianLevel(base_ring, n, level, variable_name, filtration) # We need to specify the parameter name for pickling, so it doesn't pass # ``variable_name`` as ``level`` - return super(Yangian, cls).__classcall__(cls, base_ring, n, - variable_name=variable_name, - filtration=filtration) + return super().__classcall__(cls, base_ring, n, + variable_name=variable_name, + filtration=filtration) def __init__(self, base_ring, n, variable_name, filtration): r""" @@ -507,7 +507,7 @@ def _element_constructor_(self, x): if isinstance(x.parent(), Yangian) and x.parent()._n <= self._n: R = self.base_ring() return self._from_dict({i: R(c) for i, c in x}, coerce=False) - return super(Yangian, self)._element_constructor_(x) + return super()._element_constructor_(x) def gen(self, r, i=None, j=None): """ @@ -894,7 +894,7 @@ def _coerce_map_from_(self, R): return False on_gens = lambda m: self.prod(self.gen(*a)**exp for a,exp in m._sorted_items()) return R.module_morphism(on_gens, codomain=self) - return super(YangianLevel, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def level(self): """ diff --git a/src/sage/algebras/yokonuma_hecke_algebra.py b/src/sage/algebras/yokonuma_hecke_algebra.py index 7ec49b4b87e..6ccd9c985a6 100644 --- a/src/sage/algebras/yokonuma_hecke_algebra.py +++ b/src/sage/algebras/yokonuma_hecke_algebra.py @@ -136,7 +136,7 @@ def __classcall_private__(cls, d, n, q=None, R=None): q = R(q) if R not in Rings().Commutative(): raise TypeError("base ring must be a commutative ring") - return super(YokonumaHeckeAlgebra, cls).__classcall__(cls, d, n, q, R) + return super().__classcall__(cls, d, n, q, R) def __init__(self, d, n, q, R): """ @@ -154,7 +154,7 @@ def __init__(self, d, n, q, R): self._Pn = Permutations(n) import itertools C = itertools.product(*([range(d)]*n)) - indices = list( itertools.product(C, self._Pn)) + indices = list(itertools.product(C, self._Pn)) cat = Algebras(R).WithBasis() CombinatorialFreeModule.__init__(self, R, indices, prefix='Y', category=cat) From eae7a9a6932af6cfe16c0f29e7b5ef04b5f5913b Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Sun, 10 Jul 2022 15:23:29 +0800 Subject: [PATCH 242/416] make pow(x,e,m) return an element with the same parent as x --- src/sage/rings/integer.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index a4399439015..e6533d80016 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -2180,7 +2180,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): """ if modulus is not None: from sage.rings.finite_rings.integer_mod import Mod - return Mod(left, modulus) ** right + return (Mod(left, modulus) ** right).lift() if type(left) is type(right): return (left)._pow_(right) From 50a85399fbaabe14b55841d4d72b88050fbe231b Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Sun, 10 Jul 2022 16:16:57 +0800 Subject: [PATCH 243/416] update doctests that were relying on the incorrect behaviour --- src/sage/rings/finite_rings/integer_mod.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index ce1018fdb5b..400bf154522 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -674,7 +674,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): An example with a highly composite modulus:: sage: m = 2^99 * 77^7 * 123456789 * 13712923537615486607^2 - sage: pow(5, 5735816763073854953388147237921, m).log(5) + sage: (Mod(5,m)^5735816763073854953388147237921).log(5) 5735816763073854953388147237921 Errors are generated if the logarithm doesn't exist @@ -716,7 +716,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): Examples like this took extremely long before :trac:`32375`:: - sage: pow(5, 10^50-1, 123337052926643**4).log(5) + sage: (Mod(5, 123337052926643**4) ^ (10^50-1)).log(5) 99999999999999999999999999999999999999999999999999 We check that non-existence of solutions is detected: From 22a46ae9849440b9ea680cb368c5deac390304bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 10 Jul 2022 10:31:41 +0200 Subject: [PATCH 244/416] modernize super in combinat (step one) --- src/sage/combinat/abstract_tree.py | 7 +++---- src/sage/combinat/baxter_permutations.py | 2 +- src/sage/combinat/blob_algebra.py | 2 +- src/sage/combinat/chas/fsym.py | 6 +++--- src/sage/combinat/chas/wqsym.py | 2 +- src/sage/combinat/colored_permutations.py | 4 ++-- src/sage/combinat/combinat.py | 2 +- src/sage/combinat/composition.py | 2 +- src/sage/combinat/composition_tableau.py | 14 +++++++------- src/sage/combinat/derangements.py | 4 ++-- src/sage/combinat/designs/twographs.py | 3 ++- src/sage/combinat/dyck_word.py | 2 +- src/sage/combinat/fqsym.py | 8 ++++---- src/sage/combinat/free_dendriform_algebra.py | 3 +-- src/sage/combinat/free_prelie_algebra.py | 2 +- src/sage/combinat/fully_commutative_elements.py | 2 +- src/sage/combinat/gelfand_tsetlin_patterns.py | 2 +- src/sage/combinat/grossman_larson_algebras.py | 2 +- src/sage/combinat/hillman_grassl.py | 4 ++-- src/sage/combinat/integer_vector.py | 2 +- src/sage/combinat/k_regular_sequence.py | 9 ++++----- src/sage/combinat/knutson_tao_puzzles.py | 2 +- src/sage/combinat/lr_tableau.py | 5 +++-- src/sage/combinat/ncsym/bases.py | 2 +- src/sage/combinat/necklace.py | 6 ++---- src/sage/combinat/ordered_tree.py | 2 +- src/sage/combinat/perfect_matching.py | 2 +- src/sage/combinat/plane_partition.py | 2 +- src/sage/combinat/posets/cartesian_product.py | 3 +-- src/sage/combinat/posets/incidence_algebras.py | 2 +- src/sage/combinat/posets/linear_extensions.py | 4 ++-- src/sage/combinat/posets/posets.py | 8 ++++---- src/sage/combinat/rooted_tree.py | 2 +- src/sage/combinat/rsk.py | 13 ++++++------- src/sage/combinat/set_partition.py | 6 +++--- src/sage/combinat/set_partition_ordered.py | 4 ++-- src/sage/combinat/sf/dual.py | 2 +- src/sage/combinat/sf/schur.py | 2 +- src/sage/combinat/sf/sfa.py | 2 +- src/sage/combinat/similarity_class_type.py | 4 ++-- src/sage/combinat/six_vertex_model.py | 3 ++- src/sage/combinat/skew_partition.py | 5 +++-- src/sage/combinat/skew_tableau.py | 8 ++++---- src/sage/combinat/subsets_pairwise.py | 10 +++++----- src/sage/combinat/subword_complex.py | 2 +- src/sage/combinat/super_tableau.py | 9 ++++----- src/sage/combinat/symmetric_group_algebra.py | 6 +++--- src/sage/combinat/tableau_residues.py | 4 ++-- src/sage/combinat/tuple.py | 4 ++-- src/sage/combinat/vector_partition.py | 8 ++++---- src/sage/combinat/words/word_generators.py | 4 ++-- src/sage/combinat/yang_baxter_graph.py | 6 +++--- 52 files changed, 111 insertions(+), 115 deletions(-) diff --git a/src/sage/combinat/abstract_tree.py b/src/sage/combinat/abstract_tree.py index 5d0caa16a48..3054ef00995 100644 --- a/src/sage/combinat/abstract_tree.py +++ b/src/sage/combinat/abstract_tree.py @@ -2085,7 +2085,7 @@ def __init__(self, parent, children, label=None, check=True): """ # We must initialize the label before the subtrees to allows rooted # trees canonization. Indeed it needs that ``self``._hash_() is working - # at the end of the call super(..., self).__init__(...) + # at the end of the call super().__init__(...) if isinstance(children, AbstractLabelledTree): if label is None: self._label = children._label @@ -2093,7 +2093,7 @@ def __init__(self, parent, children, label=None, check=True): self._label = label else: self._label = label - super(AbstractLabelledTree, self).__init__(parent, children, check=check) + super().__init__(parent, children, check=check) def _repr_(self): """ @@ -2211,8 +2211,7 @@ def __eq__(self, other): sage: t1 == t2 False """ - return (super(AbstractLabelledTree, self).__eq__(other) and - self._label == other._label) + return super().__eq__(other) and self._label == other._label def _hash_(self): """ diff --git a/src/sage/combinat/baxter_permutations.py b/src/sage/combinat/baxter_permutations.py index 0e3c722f480..382e4abcdab 100644 --- a/src/sage/combinat/baxter_permutations.py +++ b/src/sage/combinat/baxter_permutations.py @@ -81,7 +81,7 @@ def __init__(self, n): self.element_class = Permutations(n).element_class self._n = ZZ(n) from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets - super(BaxterPermutations_size, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) def _repr_(self): """ diff --git a/src/sage/combinat/blob_algebra.py b/src/sage/combinat/blob_algebra.py index c87888b719d..8619f926d4d 100644 --- a/src/sage/combinat/blob_algebra.py +++ b/src/sage/combinat/blob_algebra.py @@ -429,7 +429,7 @@ def __classcall_private__(cls, k, q1, q2, q3, base_ring=None, prefix='B'): q1 = base_ring(q1) q2 = base_ring(q2) q3 = base_ring(q3) - return super(BlobAlgebra, cls).__classcall__(cls, k, q1, q2, q3, base_ring, prefix) + return super().__classcall__(cls, k, q1, q2, q3, base_ring, prefix) def __init__(self, k, q1, q2, q3, base_ring, prefix): r""" diff --git a/src/sage/combinat/chas/fsym.py b/src/sage/combinat/chas/fsym.py index d618f44d3fd..a2dfd12f621 100644 --- a/src/sage/combinat/chas/fsym.py +++ b/src/sage/combinat/chas/fsym.py @@ -158,7 +158,7 @@ def coerce_base_ring(self, x): # Otherwise lift that basis up and then coerce over target = getattr(FSym, R._realization_name())() return self._coerce_map_via([target], R) - return super(FSymBasis_abstract, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def some_elements(self): r""" @@ -633,7 +633,7 @@ def R_to_G_on_basis(alpha): if descent_composition(t) == alpha) return ribbon.module_morphism(R_to_G_on_basis, codomain=self) return self._coerce_map_via([ribbon], R) - return super(FreeSymmetricFunctions.Fundamental, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def dual_basis(self): r""" @@ -963,7 +963,7 @@ def s_to_F_on_basis(mu): return self.sum_of_monomials(StandardTableaux(mu)) return s.module_morphism(s_to_F_on_basis, codomain=self) return self._coerce_map_via([s], R) - return super(FreeSymmetricFunctions_Dual.FundamentalDual, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def dual_basis(self): r""" diff --git a/src/sage/combinat/chas/wqsym.py b/src/sage/combinat/chas/wqsym.py index 8a8ee533e8e..238d0281030 100644 --- a/src/sage/combinat/chas/wqsym.py +++ b/src/sage/combinat/chas/wqsym.py @@ -233,7 +233,7 @@ def coerce_base_ring(self, x): # Otherwise lift that basis up and then coerce over target = getattr(self.realization_of(), R._basis_name)() return self._coerce_map_via([target], R) - return super(WQSymBasis_abstract, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) @cached_method def an_element(self): diff --git a/src/sage/combinat/colored_permutations.py b/src/sage/combinat/colored_permutations.py index 3a3c8f0ab87..d3bfadcccfd 100644 --- a/src/sage/combinat/colored_permutations.py +++ b/src/sage/combinat/colored_permutations.py @@ -727,13 +727,13 @@ def _coerce_map_from_(self, C): False """ if isinstance(C, Permutations) and C.n == self._n: - return lambda P, x: P.element_class(P, [P._C.zero()]*P._n, x) + return lambda P, x: P.element_class(P, [P._C.zero()] * P._n, x) if self._m == 2 and isinstance(C, SignedPermutations) and C._n == self._n: return lambda P, x: P.element_class(P, [P._C.zero() if v == 1 else P._C.one() for v in x._colors], x._perm) - return super(ColoredPermutations, self)._coerce_map_from_(C) + return super()._coerce_map_from_(C) def __iter__(self): """ diff --git a/src/sage/combinat/combinat.py b/src/sage/combinat/combinat.py index 48475d117dc..e5ad98ea4ab 100644 --- a/src/sage/combinat/combinat.py +++ b/src/sage/combinat/combinat.py @@ -1572,7 +1572,7 @@ def __init__(self, parent, *args, **kwds): L, = kwds.values() else: raise TypeError("__init__() takes exactly 2 arguments ({} given)".format(1 + len(args) + len(kwds))) - super(CombinatorialElement, self).__init__(L) + super().__init__(L) super(CombinatorialObject, self).__init__(parent) diff --git a/src/sage/combinat/composition.py b/src/sage/combinat/composition.py index 46a6be10fad..cc709bc5091 100644 --- a/src/sage/combinat/composition.py +++ b/src/sage/combinat/composition.py @@ -1907,7 +1907,7 @@ def __classcall_private__(cls, n): sage: C is C3 True """ - return super(Compositions_n, cls).__classcall__(cls, Integer(n)) + return super().__classcall__(cls, Integer(n)) def __init__(self, n): """ diff --git a/src/sage/combinat/composition_tableau.py b/src/sage/combinat/composition_tableau.py index 64c98d81bf5..0092a043e8a 100644 --- a/src/sage/combinat/composition_tableau.py +++ b/src/sage/combinat/composition_tableau.py @@ -448,7 +448,7 @@ def __init__(self, **kwds): kwds.pop('max_entry') else: self.max_entry = None - super(CompositionTableaux, self).__init__(**kwds) + super().__init__(**kwds) Element = CompositionTableau @@ -588,11 +588,11 @@ def __init__(self, n, max_entry=None): """ if max_entry is None: max_entry = n - super(CompositionTableaux_size, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.size = n - def __contains__(self,x): + def __contains__(self, x): r""" TESTS:: @@ -677,7 +677,7 @@ class CompositionTableaux_shape(CompositionTableaux): """ def __init__(self, comp, max_entry=None): """ - Initialize ``sefl``. + Initialize ``self``. TESTS:: @@ -689,8 +689,8 @@ def __init__(self, comp, max_entry=None): """ if max_entry is None: max_entry = sum(comp) - super(CompositionTableaux_shape, self).__init__(max_entry = max_entry, - category = FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.shape = comp def __iter__(self): diff --git a/src/sage/combinat/derangements.py b/src/sage/combinat/derangements.py index e8e25e9cd79..00bdeca728c 100644 --- a/src/sage/combinat/derangements.py +++ b/src/sage/combinat/derangements.py @@ -146,8 +146,8 @@ def __classcall_private__(cls, x): True """ if x in ZZ: - x = list(range(1, x + 1)) - return super(Derangements, cls).__classcall__(cls, tuple(x)) + x = tuple(range(1, x + 1)) + return super().__classcall__(cls, tuple(x)) def __init__(self, x): """ diff --git a/src/sage/combinat/designs/twographs.py b/src/sage/combinat/designs/twographs.py index c0e15ed24fe..11211ffbefb 100644 --- a/src/sage/combinat/designs/twographs.py +++ b/src/sage/combinat/designs/twographs.py @@ -169,7 +169,8 @@ def complement(self): sage: is_twograph(pc) True """ - return super(TwoGraph, self).complement(uniform=True) + return super().complement(uniform=True) + def taylor_twograph(q): r""" diff --git a/src/sage/combinat/dyck_word.py b/src/sage/combinat/dyck_word.py index f8a7bd6952c..7c1c5bc5878 100644 --- a/src/sage/combinat/dyck_word.py +++ b/src/sage/combinat/dyck_word.py @@ -491,7 +491,7 @@ def _repr_list(self) -> str: sage: DyckWord('(())') [1, 1, 0, 0] """ - return super(DyckWord, self)._repr_() + return super()._repr_() def _repr_lattice(self, type=None, labelling=None, underpath=True) -> str: r""" diff --git a/src/sage/combinat/fqsym.py b/src/sage/combinat/fqsym.py index 97b8cd6455a..28244d5b684 100644 --- a/src/sage/combinat/fqsym.py +++ b/src/sage/combinat/fqsym.py @@ -160,7 +160,7 @@ def G_to_G_on_basis(t): else: return self.coerce_map_from(G) * phi - return super(FQSymBasis_abstract, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) @cached_method def an_element(self): @@ -476,7 +476,7 @@ def __getitem__(self, r): r = list(r) elif r == 1: r = [1] - return super(FreeQuasisymmetricFunctions.F, self).__getitem__(r) + return super().__getitem__(r) def degree_on_basis(self, t): """ @@ -787,7 +787,7 @@ def __getitem__(self, r): r = list(r) elif r == 1: r = [1] - return super(FreeQuasisymmetricFunctions.G, self).__getitem__(r) + return super().__getitem__(r) def _G_to_F_on_basis(self, w): r""" @@ -1005,7 +1005,7 @@ def __getitem__(self, r): r = list(r) elif r == 1: r = [1] - return super(FreeQuasisymmetricFunctions.M, self).__getitem__(r) + return super().__getitem__(r) def _F_to_M_on_basis(self, w): r""" diff --git a/src/sage/combinat/free_dendriform_algebra.py b/src/sage/combinat/free_dendriform_algebra.py index ffac8fd2452..04b8cf1208e 100644 --- a/src/sage/combinat/free_dendriform_algebra.py +++ b/src/sage/combinat/free_dendriform_algebra.py @@ -139,8 +139,7 @@ def __classcall_private__(cls, R, names=None): if R not in Rings(): raise TypeError("argument R must be a ring") - return super(FreeDendriformAlgebra, cls).__classcall__(cls, R, - names) + return super().__classcall__(cls, R, names) def __init__(self, R, names=None): """ diff --git a/src/sage/combinat/free_prelie_algebra.py b/src/sage/combinat/free_prelie_algebra.py index 8fe464d34bd..2354cbbe576 100644 --- a/src/sage/combinat/free_prelie_algebra.py +++ b/src/sage/combinat/free_prelie_algebra.py @@ -193,7 +193,7 @@ def __classcall_private__(cls, R, names=None): if R not in Rings(): raise TypeError("argument R must be a ring") - return super(FreePreLieAlgebra, cls).__classcall__(cls, R, names) + return super().__classcall__(cls, R, names) def __init__(self, R, names=None): """ diff --git a/src/sage/combinat/fully_commutative_elements.py b/src/sage/combinat/fully_commutative_elements.py index e85f7be7672..b8f26d8ba8b 100644 --- a/src/sage/combinat/fully_commutative_elements.py +++ b/src/sage/combinat/fully_commutative_elements.py @@ -923,7 +923,7 @@ def __classcall_private__(cls, data): group = data else: group = CoxeterGroup(data) - return super(cls, FullyCommutativeElements).__classcall__(cls, group) + return super().__classcall__(cls, group) def __init__(self, coxeter_group): r""" diff --git a/src/sage/combinat/gelfand_tsetlin_patterns.py b/src/sage/combinat/gelfand_tsetlin_patterns.py index 5595dbc5dd3..461d4724491 100644 --- a/src/sage/combinat/gelfand_tsetlin_patterns.py +++ b/src/sage/combinat/gelfand_tsetlin_patterns.py @@ -642,7 +642,7 @@ def __classcall_private__(cls, n=None, k=None, strict=False, top_row=None): if n is not None and n != len(top_row): raise ValueError("n must be the length of the specified top row") return GelfandTsetlinPatternsTopRow(top_row, strict) - return super(GelfandTsetlinPatterns, cls).__classcall__(cls, n, k, strict) + return super().__classcall__(cls, n, k, strict) def __init__(self, n, k, strict): """ diff --git a/src/sage/combinat/grossman_larson_algebras.py b/src/sage/combinat/grossman_larson_algebras.py index 35d49447c64..8fcf8a2e5ec 100644 --- a/src/sage/combinat/grossman_larson_algebras.py +++ b/src/sage/combinat/grossman_larson_algebras.py @@ -161,7 +161,7 @@ def __classcall_private__(cls, R, names=None): if R not in Rings(): raise TypeError("argument R must be a ring") - return super(GrossmanLarsonAlgebra, cls).__classcall__(cls, R, names) + return super().__classcall__(cls, R, names) def __init__(self, R, names=None): """ diff --git a/src/sage/combinat/hillman_grassl.py b/src/sage/combinat/hillman_grassl.py index a942b8072b1..1abbc3d56bd 100644 --- a/src/sage/combinat/hillman_grassl.py +++ b/src/sage/combinat/hillman_grassl.py @@ -198,7 +198,7 @@ def conjugate(self): sage: c.parent() Weak Reverse Plane Partitions """ - C = super(WeakReversePlanePartition, self).conjugate() + C = super().conjugate() return WeakReversePlanePartition(C) def hillman_grassl_inverse(self): @@ -437,7 +437,7 @@ def __classcall_private__(cls, shape=None, **kwds): # from sage.combinat.partition import Partition # return RibbonShapedTableaux_shape(Partition(shape)) - return super(WeakReversePlanePartitions, cls).__classcall__(cls, **kwds) + return super().__classcall__(cls, **kwds) def __init__(self): """ diff --git a/src/sage/combinat/integer_vector.py b/src/sage/combinat/integer_vector.py index ea9be362fdc..ee73284a59c 100644 --- a/src/sage/combinat/integer_vector.py +++ b/src/sage/combinat/integer_vector.py @@ -1096,7 +1096,7 @@ def __classcall_private__(cls, n, comp): sage: IntegerVectors(4, [2,1]) is IntegerVectors(int(4), (2,1)) True """ - return super(IntegerVectors_nnondescents, cls).__classcall__(cls, n, tuple(comp)) + return super().__classcall__(cls, n, tuple(comp)) def __init__(self, n, comp): """ diff --git a/src/sage/combinat/k_regular_sequence.py b/src/sage/combinat/k_regular_sequence.py index c291589244d..11db18c3ce4 100644 --- a/src/sage/combinat/k_regular_sequence.py +++ b/src/sage/combinat/k_regular_sequence.py @@ -152,8 +152,7 @@ def __init__(self, parent, mu, left=None, right=None): :doc:`k-regular sequence `, :class:`kRegularSequenceSpace`. """ - super(kRegularSequence, self).__init__( - parent=parent, mu=mu, left=left, right=right) + super().__init__(parent=parent, mu=mu, left=left, right=right) def _repr_(self): r""" @@ -828,8 +827,8 @@ def __normalize__(cls, k, coefficient_ring, **kwds): {0, 1} """ from sage.arith.srange import srange - nargs = super(kRegularSequenceSpace, cls).__normalize__( - coefficient_ring, alphabet=srange(k), **kwds) + nargs = super().__normalize__(coefficient_ring, + alphabet=srange(k), **kwds) return (k,) + nargs def __init__(self, k, *args, **kwds): @@ -863,7 +862,7 @@ def __init__(self, k, *args, **kwds): :class:`kRegularSequence`. """ self.k = k - super(kRegularSequenceSpace, self).__init__(*args, **kwds) + super().__init__(*args, **kwds) def __reduce__(self): r""" diff --git a/src/sage/combinat/knutson_tao_puzzles.py b/src/sage/combinat/knutson_tao_puzzles.py index bd5ca49fc5b..b29990d51a0 100644 --- a/src/sage/combinat/knutson_tao_puzzles.py +++ b/src/sage/combinat/knutson_tao_puzzles.py @@ -1986,7 +1986,7 @@ def __classcall_private__(cls, puzzle_pieces, max_letter=None): puzzle_pieces = BK_pieces(max_letter) else: raise ValueError("max_letter needs to be specified") - return super(KnutsonTaoPuzzleSolver, cls).__classcall__(cls, puzzle_pieces) + return super().__classcall__(cls, puzzle_pieces) def __call__(self, lamda, mu, algorithm='strips'): r""" diff --git a/src/sage/combinat/lr_tableau.py b/src/sage/combinat/lr_tableau.py index 3a24b1007d3..8e8fefaa1c5 100644 --- a/src/sage/combinat/lr_tableau.py +++ b/src/sage/combinat/lr_tableau.py @@ -97,7 +97,7 @@ def __init__(self, parent, t): """ self._shape = parent._shape self._weight = parent._weight - super(LittlewoodRichardsonTableau, self).__init__(parent, list(t)) + super().__init__(parent, list(t)) def check(self): r""" @@ -127,7 +127,7 @@ def check(self): ... ValueError: weight of the parent does not agree with the weight of the tableau """ - super(LittlewoodRichardsonTableau, self).check() + super().check() if not [i for a in self.parent()._weight for i in a] == self.weight(): raise ValueError("weight of the parent does not agree " "with the weight of the tableau") @@ -135,6 +135,7 @@ def check(self): raise ValueError("shape of the parent does not agree " "with the shape of the tableau") + class LittlewoodRichardsonTableaux(SemistandardTableaux): r""" Littlewood-Richardson tableaux. diff --git a/src/sage/combinat/ncsym/bases.py b/src/sage/combinat/ncsym/bases.py index 398883f1d80..6d8b1b86185 100644 --- a/src/sage/combinat/ncsym/bases.py +++ b/src/sage/combinat/ncsym/bases.py @@ -45,7 +45,7 @@ def _element_constructor_(self, x): """ if isinstance(x, (list, tuple)): x = SetPartition(x) - return super(NCSymBasis_abstract, self)._element_constructor_(x) + return super()._element_constructor_(x) class NCSymOrNCSymDualBases(Category_realization_of_parent): diff --git a/src/sage/combinat/necklace.py b/src/sage/combinat/necklace.py index bbfb5c215d2..a065cabdd2c 100644 --- a/src/sage/combinat/necklace.py +++ b/src/sage/combinat/necklace.py @@ -87,11 +87,9 @@ def __classcall_private__(cls, content): sage: Necklaces([2,1,1]) is Necklaces(Composition([2,1,1])) True """ - if isinstance(content, Composition): - return super(Necklaces_evaluation, cls).__classcall__(cls, content) - else: + if not isinstance(content, Composition): content = Composition(content) - return super(Necklaces_evaluation, cls).__classcall__(cls, content) + return super().__classcall__(cls, content) def __init__(self, content): r""" diff --git a/src/sage/combinat/ordered_tree.py b/src/sage/combinat/ordered_tree.py index acb9eddc652..8157b4a95a3 100644 --- a/src/sage/combinat/ordered_tree.py +++ b/src/sage/combinat/ordered_tree.py @@ -1021,7 +1021,7 @@ def __init__(self, size): sage: TestSuite(OrderedTrees_size(0)).run() sage: for i in range(6): TestSuite(OrderedTrees_size(i)).run() """ - super(OrderedTrees_size, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self._size = size def _repr_(self): diff --git a/src/sage/combinat/perfect_matching.py b/src/sage/combinat/perfect_matching.py index 975a682b233..bde046e0d8b 100644 --- a/src/sage/combinat/perfect_matching.py +++ b/src/sage/combinat/perfect_matching.py @@ -603,7 +603,7 @@ def __classcall_private__(cls, s): except AttributeError: pass s = frozenset(s) - return super(PerfectMatchings, cls).__classcall__(cls, s) + return super().__classcall__(cls, s) def _repr_(self): """ diff --git a/src/sage/combinat/plane_partition.py b/src/sage/combinat/plane_partition.py index 4413916886a..49edf8abdea 100644 --- a/src/sage/combinat/plane_partition.py +++ b/src/sage/combinat/plane_partition.py @@ -806,7 +806,7 @@ def __classcall_private__(cls, box_size): sage: P1 is P2 True """ - return super(PlanePartitions, cls).__classcall__(cls, tuple(box_size)) + return super().__classcall__(cls, tuple(box_size)) def __init__(self, box_size): r""" diff --git a/src/sage/combinat/posets/cartesian_product.py b/src/sage/combinat/posets/cartesian_product.py index 473024e80b9..e8c602895cd 100644 --- a/src/sage/combinat/posets/cartesian_product.py +++ b/src/sage/combinat/posets/cartesian_product.py @@ -111,8 +111,7 @@ def __init__(self, sets, category, order=None, **kwargs): if not isinstance(category, tuple): category = (category,) category = Category.join(category + (Posets(),)) - super(CartesianProductPoset, self).__init__( - sets, category, **kwargs) + super().__init__(sets, category, **kwargs) def le(self, left, right): r""" diff --git a/src/sage/combinat/posets/incidence_algebras.py b/src/sage/combinat/posets/incidence_algebras.py index 65dc086118a..2d621cef967 100644 --- a/src/sage/combinat/posets/incidence_algebras.py +++ b/src/sage/combinat/posets/incidence_algebras.py @@ -117,7 +117,7 @@ def _coerce_map_from_(self, R): """ if isinstance(R, ReducedIncidenceAlgebra) and R._ambient is self: return copy(R.lift) - return super(IncidenceAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def reduced_subalgebra(self, prefix='R'): """ diff --git a/src/sage/combinat/posets/linear_extensions.py b/src/sage/combinat/posets/linear_extensions.py index 8c2a4fa3d0a..d47c4c56179 100644 --- a/src/sage/combinat/posets/linear_extensions.py +++ b/src/sage/combinat/posets/linear_extensions.py @@ -453,7 +453,7 @@ def __classcall_private__(cls, poset, facade=False): sage: L is LinearExtensionsOfPoset(P,facade=False) True """ - return super(LinearExtensionsOfPoset, cls).__classcall__(cls, poset, facade=facade) + return super().__classcall__(cls, poset, facade=facade) def __init__(self, poset, facade): """ @@ -641,7 +641,7 @@ def __contains__(self, obj): """ if not self._is_facade: - return super(LinearExtensionsOfPoset, self).__contains__(obj) + return super().__contains__(obj) return (isinstance(obj, (list, tuple)) and self.poset().is_linear_extension(obj)) diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 096dcd0f807..802667c04b8 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -1000,10 +1000,10 @@ def __classcall__(cls, hasse_diagram, elements=None, category=None, facade=None, if category is not None and category.is_subcategory(Sets().Facade()): category = category._without_axiom("Facade") category = Category.join([FinitePosets().or_subcategory(category), FiniteEnumeratedSets()]) - return super(FinitePoset, cls).__classcall__(cls, hasse_diagram=hasse_diagram, - elements=elements, - category=category, facade=facade, - key=key) + return super().__classcall__(cls, hasse_diagram=hasse_diagram, + elements=elements, + category=category, facade=facade, + key=key) def __init__(self, hasse_diagram, elements, category, facade, key): r""" diff --git a/src/sage/combinat/rooted_tree.py b/src/sage/combinat/rooted_tree.py index ace4009f3ef..b28b1b89b9e 100644 --- a/src/sage/combinat/rooted_tree.py +++ b/src/sage/combinat/rooted_tree.py @@ -633,7 +633,7 @@ def __init__(self, n): sage: for i in range(1, 6): ....: TestSuite(RootedTrees(i)).run() """ - super(RootedTrees_size, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self._n = n def _repr_(self): diff --git a/src/sage/combinat/rsk.py b/src/sage/combinat/rsk.py index f5a3432b208..2400ef86fdd 100644 --- a/src/sage/combinat/rsk.py +++ b/src/sage/combinat/rsk.py @@ -613,9 +613,8 @@ def _backward_format_output(self, lower_row, upper_row, output, raise TypeError("p must be standard to have a valid permutation as output") from sage.combinat.permutation import Permutation return Permutation(reversed(lower_row)) - else: - return super(RuleRSK, self)._backward_format_output(lower_row, upper_row, output, - p_is_standard, q_is_standard) + return super()._backward_format_output(lower_row, upper_row, output, + p_is_standard, q_is_standard) class RuleEG(Rule): @@ -798,8 +797,8 @@ def _backward_format_output(self, lower_row, upper_row, output, from sage.combinat.permutation import Permutations return Permutations(n).from_reduced_word(list(lower_row)) else: - return super(RuleEG, self)._backward_format_output(lower_row, upper_row, output, - p_is_standard, q_is_standard) + return super()._backward_format_output(lower_row, upper_row, output, + p_is_standard, q_is_standard) class RuleHecke(Rule): @@ -1483,8 +1482,8 @@ def _backward_format_output(self, lower_row, upper_row, output, from sage.combinat.permutation import Permutation return Permutation(reversed(lower_row)) else: - return super(RuleDualRSK, self)._backward_format_output(lower_row, upper_row, output, - p_is_standard, q_is_standard) + return super()._backward_format_output(lower_row, upper_row, output, + p_is_standard, q_is_standard) def _forward_format_output(self, p, q, check_standard): r""" diff --git a/src/sage/combinat/set_partition.py b/src/sage/combinat/set_partition.py index 3e426f16e85..fdd394e1369 100644 --- a/src/sage/combinat/set_partition.py +++ b/src/sage/combinat/set_partition.py @@ -2735,7 +2735,7 @@ def __classcall_private__(cls, s): sage: S1 is S2, S1 is S3 (True, True) """ - return super(SetPartitions_set, cls).__classcall__(cls, frozenset(s)) + return super().__classcall__(cls, frozenset(s)) def __init__(self, s): """ @@ -2914,7 +2914,7 @@ def __classcall_private__(cls, s, parts): """ if isinstance(s, (int, Integer)): s = list(range(1, s + 1)) - return super(SetPartitions_setparts, cls).__classcall__(cls, frozenset(s), Partition(parts)) + return super().__classcall__(cls, frozenset(s), Partition(parts)) def __init__(self, s, parts): """ @@ -3170,7 +3170,7 @@ def __classcall_private__(cls, s, k): sage: S1 is S2, S1 is S3 (True, True) """ - return super(SetPartitions_setn, cls).__classcall__(cls, frozenset(s), k) + return super().__classcall__(cls, frozenset(s), k) def __init__(self, s, k): """ diff --git a/src/sage/combinat/set_partition_ordered.py b/src/sage/combinat/set_partition_ordered.py index 9e648ed722e..f2f201eb7f2 100644 --- a/src/sage/combinat/set_partition_ordered.py +++ b/src/sage/combinat/set_partition_ordered.py @@ -1398,8 +1398,8 @@ def _coerce_map_from_(self, X): if X is self: return True if isinstance(X, OrderedSetPartitions): - return X._set == frozenset(range(1,len(X._set)+1)) - return super(OrderedSetPartitions_all, self)._coerce_map_from_(X) + return X._set == frozenset(range(1, len(X._set) + 1)) + return super()._coerce_map_from_(X) def _repr_(self): """ diff --git a/src/sage/combinat/sf/dual.py b/src/sage/combinat/sf/dual.py index 677a8dcfd3f..4ec49461f59 100644 --- a/src/sage/combinat/sf/dual.py +++ b/src/sage/combinat/sf/dual.py @@ -277,7 +277,7 @@ def _repr_(self): Dual basis to Symmetric Functions over Rational Field in the monomial basis with respect to the Hall scalar product """ if hasattr(self, "_basis"): - return super(SymmetricFunctionAlgebra_dual, self)._repr_() + return super()._repr_() if self._scalar_name: return "Dual basis to %s" % self._dual_basis + " with respect to the " + self._scalar_name else: diff --git a/src/sage/combinat/sf/schur.py b/src/sage/combinat/sf/schur.py index b720a39c9d5..5bcec1d298f 100644 --- a/src/sage/combinat/sf/schur.py +++ b/src/sage/combinat/sf/schur.py @@ -185,7 +185,7 @@ def _element_constructor_(self, x): try: return self.skew_schur(x) except ValueError: - return super(SymmetricFunctionAlgebra_schur, self)._element_constructor_(x) + return super()._element_constructor_(x) def _repeated_bernstein_creation_operator_on_basis(self, la, nu): r""" diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 77e9f7b8a9f..7a8d3bfce7b 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -2851,7 +2851,7 @@ def _latex_term(self, m): sage: latex(f) m_{1,1,1} + m_{2,1} + m_{3} """ - return super(SymmetricFunctionAlgebra_generic, self)._latex_term(','.join(str(i) for i in m)) + return super()._latex_term(','.join(str(i) for i in m)) def from_polynomial(self, poly, check=True): r""" diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index 8febf66ec03..234224eafd6 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -614,7 +614,7 @@ def __classcall_private__(cls, n, min=None): min = (min[0], Partition(min[1])) else: raise ValueError("min must be a PrimarySimilarityClassType") - return super(PrimarySimilarityClassTypes, cls).__classcall__(cls, n, min) + return super().__classcall__(cls, n, min) def __init__(self, n, min): r""" @@ -1027,7 +1027,7 @@ def __classcall_private__(cls, n, min=None): min = PrimarySimilarityClassType(min[0], min[1]) if not isinstance(min, PrimarySimilarityClassType): raise ValueError("min must be a PrimarySimilarityClassType") - return super(SimilarityClassTypes, cls).__classcall__(cls, n, min) + return super().__classcall__(cls, n, min) def __init__(self, n, min): r""" diff --git a/src/sage/combinat/six_vertex_model.py b/src/sage/combinat/six_vertex_model.py index 936a7e95b52..a3b28126923 100644 --- a/src/sage/combinat/six_vertex_model.py +++ b/src/sage/combinat/six_vertex_model.py @@ -8,6 +8,7 @@ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets from sage.combinat.combinatorial_map import combinatorial_map + class SixVertexConfiguration(ClonableArray): """ A configuration in the six vertex model. @@ -451,7 +452,7 @@ def __classcall_private__(cls, n, m=None, boundary_conditions=None): boundary_conditions = ((False,)*m, (True,)*n)*2 else: boundary_conditions = tuple(tuple(x) for x in boundary_conditions) - return super(SixVertexModel, cls).__classcall__(cls, n, m, boundary_conditions) + return super().__classcall__(cls, n, m, boundary_conditions) def __init__(self, n, m, boundary_conditions): """ diff --git a/src/sage/combinat/skew_partition.py b/src/sage/combinat/skew_partition.py index 80c6871d235..56d0bf5a1c4 100644 --- a/src/sage/combinat/skew_partition.py +++ b/src/sage/combinat/skew_partition.py @@ -1575,6 +1575,7 @@ def __iter__(self): yield self.element_class(self, p) n += 1 + class SkewPartitions_n(SkewPartitions): """ The set of skew partitions of ``n`` with overlap at least @@ -1612,7 +1613,7 @@ def __classcall_private__(cls, n, overlap=0): """ if overlap == 'connected': overlap = 1 - return super(cls, SkewPartitions_n).__classcall__(cls, n, overlap) + return super().__classcall__(cls, n, overlap) def __init__(self, n, overlap): """ @@ -1823,7 +1824,7 @@ def __classcall_private__(cls, co, overlap=0): co = Compositions()(co) if overlap == 'connected': overlap = 1 - return super(SkewPartitions_rowlengths, cls).__classcall__(cls, co, overlap) + return super().__classcall__(cls, co, overlap) def __init__(self, co, overlap): """ diff --git a/src/sage/combinat/skew_tableau.py b/src/sage/combinat/skew_tableau.py index 906b86f2930..986cc8db8ff 100644 --- a/src/sage/combinat/skew_tableau.py +++ b/src/sage/combinat/skew_tableau.py @@ -1990,7 +1990,7 @@ def __classcall_private__(cls, skp): sage: S is S2 True """ - return super(StandardSkewTableaux_shape, cls).__classcall__(cls, SkewPartition(skp)) + return super().__classcall__(cls, SkewPartition(skp)) def __init__(self, skp): """ @@ -2385,7 +2385,7 @@ def __classcall_private__(cls, n, mu): sage: S is S2 True """ - return super(SemistandardSkewTableaux_size_weight, cls).__classcall__(cls, n, tuple(mu)) + return super().__classcall__(cls, n, tuple(mu)) def __init__(self, n, mu): """ @@ -2465,7 +2465,7 @@ def __classcall_private__(cls, p, max_entry=None): """ if max_entry is None: max_entry = sum(p[0]) - sum(p[1]) - return super(SemistandardSkewTableaux_shape, cls).__classcall__(cls, SkewPartition(p), max_entry) + return super().__classcall__(cls, SkewPartition(p), max_entry) def __init__(self, p, max_entry): """ @@ -2544,7 +2544,7 @@ def __classcall_private__(cls, p, mu): """ p = SkewPartition(p) mu = tuple(mu) - return super(SemistandardSkewTableaux_shape_weight, cls).__classcall__(cls, p, mu) + return super().__classcall__(cls, p, mu) def __init__(self, p, mu): """ diff --git a/src/sage/combinat/subsets_pairwise.py b/src/sage/combinat/subsets_pairwise.py index aeceb704936..fc64df2e48f 100644 --- a/src/sage/combinat/subsets_pairwise.py +++ b/src/sage/combinat/subsets_pairwise.py @@ -79,14 +79,14 @@ class PairwiseCompatibleSubsets(RecursivelyEnumeratedSet_forest): lexicographic order. """ - #@staticmethod - #def __classcall__(cls, ambient, predicate): - # ambient = Set(ambient) - # return super(PairwiseCompatibleSubsets, cls).__classcall__(cls, ambient, predicate) + # @staticmethod + # def __classcall__(cls, ambient, predicate): + # ambient = Set(ambient) + # return super().__classcall__(cls, ambient, predicate) __len__ = None - def __init__(self, ambient, predicate, maximal = False, element_class = Set_object_enumerated): + def __init__(self, ambient, predicate, maximal=False, element_class=Set_object_enumerated): """ TESTS:: diff --git a/src/sage/combinat/subword_complex.py b/src/sage/combinat/subword_complex.py index 95d92c696cd..15af1d67ba0 100644 --- a/src/sage/combinat/subword_complex.py +++ b/src/sage/combinat/subword_complex.py @@ -1059,7 +1059,7 @@ def __classcall__(cls, Q, w, algorithm="inductive"): True """ Q = tuple(Q) - return super(SubwordComplex, cls).__classcall__(cls, Q, w, algorithm=algorithm) + return super().__classcall__(cls, Q, w, algorithm=algorithm) def __init__(self, Q, w, algorithm="inductive"): r""" diff --git a/src/sage/combinat/super_tableau.py b/src/sage/combinat/super_tableau.py index 07ab5e244b6..9be91778022 100644 --- a/src/sage/combinat/super_tableau.py +++ b/src/sage/combinat/super_tableau.py @@ -134,7 +134,7 @@ def __init__(self, parent, t, check=True, preprocessed=False): """ if not preprocessed: t = self._preprocess(t) - super(SemistandardSuperTableau, self).__init__(parent, t, check=check) + super().__init__(parent, t, check=check) @staticmethod def _preprocess(t): @@ -186,7 +186,7 @@ def check(self): ValueError: the entries of a semistandard super tableau must be non-negative primed integers """ - super(SemistandardSuperTableau, self).check() + super().check() for row in self: if not all(isinstance(c, PrimedEntry) and c > 0 for c in row): raise ValueError("the entries of a semistandard super tableau" @@ -299,7 +299,7 @@ def check(self): ValueError: the entries in each row of a semistandard super tableau must be weakly increasing """ - super(StandardSuperTableau, self).check() + super().check() # t is semistandard so we only need to check # that its entries are in bijection with {1',1,2', 2, ..., n} flattened_list = [i for row in self for i in row] @@ -737,8 +737,7 @@ def __init__(self, p): sage: TestSuite( StandardSuperTableaux([2,2,1]) ).run() """ - super(StandardSuperTableaux_shape, self).__init__( - category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) StandardSuperTableaux.__init__(self) self.shape = p diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index 603f4df9f3f..c3d67555a6b 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -368,7 +368,7 @@ def _coerce_map_from_(self, S): phi = S.to_symmetric_group_algebra return phi.codomain().canonical_embedding(self) * phi - return super(SymmetricGroupAlgebra_n, self)._coerce_map_from_(S) + return super()._coerce_map_from_(S) def _element_constructor_(self, x): """ @@ -392,7 +392,7 @@ def _element_constructor_(self, x): return self.monomial_from_smaller_permutation( from_permutation_group_element(x)) - return super(SymmetricGroupAlgebra_n, self)._element_constructor_(x) + return super()._element_constructor_(x) def _sibling(self, n): r""" @@ -757,7 +757,7 @@ def cell_module(self, la, **kwds): """ la = _Partitions(la) kwds['bracket'] = kwds.get('bracket', False) - return super(SymmetricGroupAlgebra_n, self).cell_module(la, **kwds) + return super().cell_module(la, **kwds) def retract_plain(self, f, m): r""" diff --git a/src/sage/combinat/tableau_residues.py b/src/sage/combinat/tableau_residues.py index 021865daaaa..9f2748fa70c 100644 --- a/src/sage/combinat/tableau_residues.py +++ b/src/sage/combinat/tableau_residues.py @@ -265,7 +265,7 @@ def __init__(self, parent, residues, check): sage: TestSuite( ResidueSequence(3, [0,0,1,2])).run(skip='_test_pickling') """ residues = tuple(parent._base_ring(i) for i in residues) - super(ResidueSequence, self).__init__(parent, residues, check) + super().__init__(parent, residues, check) def check(self): r""" @@ -727,7 +727,7 @@ def __init__(self, e, multicharge=(0,)): self._quantum_characteristic = e self._base_ring = IntegerModRing(self._quantum_characteristic) self._multicharge = tuple(self._base_ring(i) for i in multicharge) - super(ResidueSequences, self).__init__(category=Sets()) + super().__init__(category=Sets()) def _repr_(self): r""" diff --git a/src/sage/combinat/tuple.py b/src/sage/combinat/tuple.py index 9b773e0be70..7e7f85c61ef 100644 --- a/src/sage/combinat/tuple.py +++ b/src/sage/combinat/tuple.py @@ -63,7 +63,7 @@ def __classcall_private__(cls, S, k): sage: T = Tuples(['l','i','t'],2); T Tuples of ('l', 'i', 't') of length 2 """ - return super(Tuples, cls).__classcall__(cls, tuple(S), k) + return super().__classcall__(cls, tuple(S), k) def __init__(self, S, k): """ @@ -166,7 +166,7 @@ def __classcall_private__(cls, S, k): sage: T = UnorderedTuples(['l','i','t'],2); T Unordered tuples of ('l', 'i', 't') of length 2 """ - return super(UnorderedTuples, cls).__classcall__(cls, tuple(S), k) + return super().__classcall__(cls, tuple(S), k) def __init__(self, S, k): """ diff --git a/src/sage/combinat/vector_partition.py b/src/sage/combinat/vector_partition.py index 49c9c25c2e4..953e450d8a1 100644 --- a/src/sage/combinat/vector_partition.py +++ b/src/sage/combinat/vector_partition.py @@ -200,7 +200,7 @@ class VectorPartitions(UniqueRepresentation, Parent): [[2, 2]] """ @staticmethod - def __classcall_private__(cls, vec, min = None): + def __classcall_private__(cls, vec, min=None): r""" Create the class of vector partitions of ``vec`` where all parts are greater than or equal to the vector ``min``. @@ -213,10 +213,10 @@ def __classcall_private__(cls, vec, min = None): True """ if min is None: - min = find_min(vec)#tuple([0 for v in vec[:-1]]+[1]) + min = find_min(vec) # tuple([0 for v in vec[:-1]]+[1]) min = tuple(min) vec = tuple(vec) - return super(VectorPartitions, cls).__classcall__(cls, tuple(vec), min) + return super().__classcall__(cls, tuple(vec), min) def __init__(self, vec, min): r""" @@ -227,7 +227,7 @@ def __init__(self, vec, min): sage: VP = VectorPartitions([2, 2]) sage: TestSuite(VP).run() """ - Parent.__init__(self, category = FiniteEnumeratedSets()) + Parent.__init__(self, category=FiniteEnumeratedSets()) self._vec = vec self._min = min diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index 5cb363d248a..142bb643a4d 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -222,13 +222,13 @@ def __init__(self, p, q, alphabet=(0,1), algorithm='cf'): w = u + v else: raise ValueError('Unknown algorithm (=%s)' % algorithm) - super(LowerChristoffelWord, self).__init__(FiniteWords(alphabet), w) + super().__init__(FiniteWords(alphabet), w) self.__p = p self.__q = q def markoff_number(self): r""" - Returns the Markoff number associated to the Christoffel word self. + Returns the Markoff number associated to the Christoffel word ``self``. The *Markoff number* of a Christoffel word `w` is `trace(M(w))/3`, where `M(w)` is the `2\times 2` matrix obtained by applying the diff --git a/src/sage/combinat/yang_baxter_graph.py b/src/sage/combinat/yang_baxter_graph.py index 022ef775148..69fd04cbd04 100644 --- a/src/sage/combinat/yang_baxter_graph.py +++ b/src/sage/combinat/yang_baxter_graph.py @@ -586,7 +586,7 @@ def __init__(self, partition): root = sum([tuple(range(b)) for b in beta], tuple())[::-1] operators = [SwapIncreasingOperator(i) for i in range(sum(partition) - 1)] - super(YangBaxterGraph_partition, self).__init__(root, operators) + super().__init__(root, operators) def __repr__(self): r""" @@ -632,7 +632,7 @@ def _digraph(self): sage: Y.edges() [((0, 1, 0), (1, 0, 0), Swap positions 0 and 1)] """ - digraph = super(YangBaxterGraph_partition, self)._digraph + digraph = super()._digraph for (u, v, op) in digraph.edges(): digraph.set_edge_label(u, v, SwapOperator(op.position())) return digraph @@ -720,7 +720,7 @@ def vertex_relabelling_dict(self, v): (2, 0, 1, 0): (3, 4, 2, 1), (2, 1, 0, 0): (3, 2, 4, 1)} """ - return super(YangBaxterGraph_partition, self).vertex_relabelling_dict(v, self._swap_operator) + return super().vertex_relabelling_dict(v, self._swap_operator) def relabel_vertices(self, v, inplace=True): r""" From b5b15caf1d76b91be5fe1a37b815d00c1adfd3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 10 Jul 2022 10:43:44 +0200 Subject: [PATCH 245/416] modernize super in geometry/ --- src/sage/geometry/cone.py | 7 +++---- src/sage/geometry/fan.py | 9 ++++----- src/sage/geometry/fan_morphism.py | 2 +- .../geometry/hyperbolic_space/hyperbolic_isometry.py | 5 ++--- .../geometry/hyperbolic_space/hyperbolic_model.py | 8 ++++---- .../geometry/hyperplane_arrangement/arrangement.py | 6 +++--- .../geometry/hyperplane_arrangement/hyperplane.py | 2 +- src/sage/geometry/linear_expression.py | 6 +++--- src/sage/geometry/point_collection.pyx | 2 +- src/sage/geometry/polyhedron/backend_field.py | 2 +- src/sage/geometry/polyhedron/backend_normaliz.py | 8 ++++---- src/sage/geometry/polyhedron/backend_polymake.py | 3 +-- src/sage/geometry/polyhedron/backend_ppl.py | 2 +- src/sage/geometry/polyhedron/base_ZZ.py | 3 +-- .../polyhedron/double_description_inhomogeneous.py | 4 ++-- .../polyhedron/modules/formal_polyhedra_module.py | 12 ++++++------ src/sage/geometry/ribbon_graph.py | 2 +- src/sage/geometry/toric_lattice_element.pyx | 4 ++-- src/sage/geometry/toric_plotter.py | 2 +- .../geometry/triangulation/point_configuration.py | 5 ++--- 20 files changed, 44 insertions(+), 50 deletions(-) diff --git a/src/sage/geometry/cone.py b/src/sage/geometry/cone.py index 7201911294b..d9d57b3b12a 100644 --- a/src/sage/geometry/cone.py +++ b/src/sage/geometry/cone.py @@ -1505,7 +1505,7 @@ def __init__(self, rays=None, lattice=None, True sage: TestSuite(sc).run() """ - superinit = super(ConvexRationalPolyhedralCone, self).__init__ + superinit = super().__init__ if ambient is None: superinit(rays, lattice) self._ambient = self @@ -1893,8 +1893,7 @@ def cartesian_product(self, other, lattice=None): in 2-d lattice N+N """ assert is_Cone(other) - rc = super(ConvexRationalPolyhedralCone, self).cartesian_product( - other, lattice) + rc = super().cartesian_product(other, lattice) return ConvexRationalPolyhedralCone(rc.rays(), rc.lattice()) def __neg__(self): @@ -1918,7 +1917,7 @@ def __neg__(self): N( 0, -1) in 2-d lattice N """ - rc = super(ConvexRationalPolyhedralCone, self).__neg__() + rc = super().__neg__() return ConvexRationalPolyhedralCone(rc.rays(), rc.lattice()) def __richcmp__(self, right, op): diff --git a/src/sage/geometry/fan.py b/src/sage/geometry/fan.py index 73d68180c55..0043569b37b 100644 --- a/src/sage/geometry/fan.py +++ b/src/sage/geometry/fan.py @@ -1047,8 +1047,8 @@ def __init__(self, ambient, ambient_ray_indices): 1-d cone of Rational polyhedral fan in 2-d lattice N sage: TestSuite(cone).run() # optional - palp """ - super(Cone_of_fan, self).__init__( - ambient=ambient, ambient_ray_indices=ambient_ray_indices) + super().__init__(ambient=ambient, + ambient_ray_indices=ambient_ray_indices) self._is_strictly_convex = True # Because if not, this cone should not have been constructed @@ -1207,7 +1207,7 @@ def __init__(self, cones, rays, lattice, sage: f = Fan([(0,)], [(0,1)]) sage: TestSuite(f).run() """ - super(RationalPolyhedralFan, self).__init__(rays, lattice) + super().__init__(rays, lattice) self._generating_cones = tuple(Cone_of_fan(self, c) for c in cones) for i, cone in enumerate(self._generating_cones): cone._star_generator_indices = (i,) @@ -1675,8 +1675,7 @@ def cartesian_product(self, other, lattice=None): 6 """ assert is_Fan(other) - rc = super(RationalPolyhedralFan, self).cartesian_product( - other, lattice) + rc = super().cartesian_product(other, lattice) self_cones = [cone.ambient_ray_indices() for cone in self] n = self.nrays() other_cones = [tuple(n + i for i in cone.ambient_ray_indices()) diff --git a/src/sage/geometry/fan_morphism.py b/src/sage/geometry/fan_morphism.py index 966947f0b22..d7ba7ac7ea6 100644 --- a/src/sage/geometry/fan_morphism.py +++ b/src/sage/geometry/fan_morphism.py @@ -287,7 +287,7 @@ def __init__(self, morphism, domain_fan, else: raise TypeError("morphism must be either a FreeModuleMorphism " "or a matrix!\nGot: %s" % morphism) - super(FanMorphism, self).__init__(parent, A) + super().__init__(parent, A) self._domain_fan = domain_fan self._image_cone = dict() self._preimage_cones = dict() diff --git a/src/sage/geometry/hyperbolic_space/hyperbolic_isometry.py b/src/sage/geometry/hyperbolic_space/hyperbolic_isometry.py index a524407fc4c..f6365aa90c5 100644 --- a/src/sage/geometry/hyperbolic_space/hyperbolic_isometry.py +++ b/src/sage/geometry/hyperbolic_space/hyperbolic_isometry.py @@ -939,12 +939,11 @@ def __mul__(self, other): #PD Isometry in PD [ 5/8 3/8*I] [-3/8*I 5/8] - """ if isinstance(other, HyperbolicIsometry): - M = self._cached_isometry*other._cached_isometry + M = self._cached_isometry * other._cached_isometry return M.to_model('PD') - return super(HyperbolicIsometryPD, self).__mul__(other) + return super().__mul__(other) def __pow__(self, n): #PD r""" diff --git a/src/sage/geometry/hyperbolic_space/hyperbolic_model.py b/src/sage/geometry/hyperbolic_space/hyperbolic_model.py index 46e911e9a58..7890b222f37 100644 --- a/src/sage/geometry/hyperbolic_space/hyperbolic_model.py +++ b/src/sage/geometry/hyperbolic_space/hyperbolic_model.py @@ -822,7 +822,7 @@ def _coerce_map_from_(self, X): return CoercionKMtoUHP(Hom(X, self)) if isinstance(X, HyperbolicModelHM): return CoercionHMtoUHP(Hom(X, self)) - return super(HyperbolicModelUHP, self)._coerce_map_from_(X) + return super()._coerce_map_from_(X) def point_in_model(self, p): r""" @@ -1200,7 +1200,7 @@ def _coerce_map_from_(self, X): return CoercionKMtoPD(Hom(X, self)) if isinstance(X, HyperbolicModelHM): return CoercionHMtoPD(Hom(X, self)) - return super(HyperbolicModelPD, self)._coerce_map_from_(X) + return super()._coerce_map_from_(X) def point_in_model(self, p): r""" @@ -1325,7 +1325,7 @@ def _coerce_map_from_(self, X): return CoercionPDtoKM(Hom(X, self)) if isinstance(X, HyperbolicModelHM): return CoercionHMtoKM(Hom(X, self)) - return super(HyperbolicModelKM, self)._coerce_map_from_(X) + return super()._coerce_map_from_(X) def point_in_model(self, p): r""" @@ -1448,7 +1448,7 @@ def _coerce_map_from_(self, X): return CoercionPDtoHM(Hom(X, self)) if isinstance(X, HyperbolicModelKM): return CoercionKMtoHM(Hom(X, self)) - return super(HyperbolicModelHM, self)._coerce_map_from_(X) + return super()._coerce_map_from_(X) def point_in_model(self, p): r""" diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index e83b6aeacd7..5b2534677a1 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -403,7 +403,7 @@ def __init__(self, parent, hyperplanes, check=True, backend=None): sage: A.regions()[0].backend() # optional - pynormaliz # optional - sage.rings.number_field 'normaliz' """ - super(HyperplaneArrangementElement, self).__init__(parent) + super().__init__(parent) self._hyperplanes = hyperplanes self._backend = backend if check: @@ -3423,7 +3423,7 @@ def __init__(self, base_ring, names=tuple()): from sage.rings.ring import _Fields if base_ring not in _Fields: raise ValueError('base ring must be a field') - super(HyperplaneArrangements, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._base_ring = base_ring self._names = names @@ -3690,4 +3690,4 @@ def _coerce_map_from_(self, P): return True if isinstance(P, HyperplaneArrangements): return self.base_ring().has_coerce_map_from(P.base_ring()) - return super(HyperplaneArrangements, self)._coerce_map_from_(P) + return super()._coerce_map_from_(P) diff --git a/src/sage/geometry/hyperplane_arrangement/hyperplane.py b/src/sage/geometry/hyperplane_arrangement/hyperplane.py index 146cf2db80a..378ffaf9c5c 100644 --- a/src/sage/geometry/hyperplane_arrangement/hyperplane.py +++ b/src/sage/geometry/hyperplane_arrangement/hyperplane.py @@ -160,7 +160,7 @@ def __init__(self, parent, coefficients, constant): Hyperplane 1.00000000000000*x + 0.000000000000000*y + 0.000000000000000 sage: TestSuite(x+y-1).run() """ - super(Hyperplane, self).__init__(parent, coefficients, constant) + super().__init__(parent, coefficients, constant) def _repr_(self): """ diff --git a/src/sage/geometry/linear_expression.py b/src/sage/geometry/linear_expression.py index dbe09170c4c..7f4a91b3194 100644 --- a/src/sage/geometry/linear_expression.py +++ b/src/sage/geometry/linear_expression.py @@ -88,7 +88,7 @@ def __init__(self, parent, coefficients, constant, check=True): sage: TestSuite(linear).run() """ - super(LinearExpression, self).__init__(parent) + super().__init__(parent) self._coeffs = coefficients self._const = constant if check: @@ -490,7 +490,7 @@ def __init__(self, base_ring, names=tuple()): sage: TestSuite(L).run() """ from sage.categories.modules import Modules - super(LinearExpressionModule, self).__init__(base_ring, category=Modules(base_ring).WithBasis().FiniteDimensional()) + super().__init__(base_ring, category=Modules(base_ring).WithBasis().FiniteDimensional()) self._names = names @cached_method @@ -746,7 +746,7 @@ def _coerce_map_from_(self, P): self.base().has_coerce_map_from(P.base()) except AttributeError: pass - return super(LinearExpressionModule, self)._coerce_map_from_(P) + return super()._coerce_map_from_(P) def _repr_(self): """ diff --git a/src/sage/geometry/point_collection.pyx b/src/sage/geometry/point_collection.pyx index 2769f24e3fc..fcfb45b1d9b 100644 --- a/src/sage/geometry/point_collection.pyx +++ b/src/sage/geometry/point_collection.pyx @@ -166,7 +166,7 @@ cdef class PointCollection(SageObject): over the principal ideal domain Integer Ring sage: TestSuite(c).run() """ - super(PointCollection, self).__init__() + super().__init__() self._points = tuple(points) self._module = self._points[0].parent() if module is None else module diff --git a/src/sage/geometry/polyhedron/backend_field.py b/src/sage/geometry/polyhedron/backend_field.py index 4ddf271143e..6b921d23a68 100644 --- a/src/sage/geometry/polyhedron/backend_field.py +++ b/src/sage/geometry/polyhedron/backend_field.py @@ -330,4 +330,4 @@ def _init_empty_polyhedron(self): The empty polyhedron in QQ^0 sage: Polyhedron(backend='field')._init_empty_polyhedron() """ - super(Polyhedron_field, self)._init_empty_polyhedron() + super()._init_empty_polyhedron() diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py index 9d109238df1..08b4ba72e9f 100644 --- a/src/sage/geometry/polyhedron/backend_normaliz.py +++ b/src/sage/geometry/polyhedron/backend_normaliz.py @@ -1050,7 +1050,7 @@ def _init_empty_polyhedron(self): The empty polyhedron in ZZ^0 sage: Polyhedron(backend='normaliz')._init_empty_polyhedron() # optional - pynormaliz """ - super(Polyhedron_normaliz, self)._init_empty_polyhedron() + super()._init_empty_polyhedron() # Can't seem to set up an empty _normaliz_cone. # For example, PyNormaliz.NmzCone(vertices=[]) gives # error: Some error in the normaliz input data detected: All input matrices empty! @@ -1236,7 +1236,7 @@ def __copy__(self): sage: P._normaliz_cone is Q._normaliz_cone # optional - pynormaliz False """ - other = super(Polyhedron_normaliz, self).__copy__() + other = super().__copy__() # Make a copy of the cone. cone = self._normaliz_cone @@ -1275,7 +1275,7 @@ def __getstate__(self): (0, 1, 0, 0), (1, 0, 0, 0)]}) """ - state = super(Polyhedron_normaliz, self).__getstate__() + state = super().__getstate__() state = (state[0], state[1].copy()) # Remove the unpicklable entries. del state[1]['_normaliz_cone'] @@ -1348,7 +1348,7 @@ def __setstate__(self, state): else: vertices = None - super(Polyhedron_normaliz, self).__setstate__(state) + super().__setstate__(state) if self.is_empty(): # Special case to avoid. diff --git a/src/sage/geometry/polyhedron/backend_polymake.py b/src/sage/geometry/polyhedron/backend_polymake.py index 776cb613074..024ee5da232 100644 --- a/src/sage/geometry/polyhedron/backend_polymake.py +++ b/src/sage/geometry/polyhedron/backend_polymake.py @@ -592,8 +592,7 @@ def _polymake_(self, polymake): if self._polymake_polytope.parent() is polymake: # Same polymake interface, can just return our object return self._polymake_polytope - else: - return super(Polyhedron_polymake, self)._polymake_(polymake) + return super()._polymake_(polymake) def __getstate__(self): r""" diff --git a/src/sage/geometry/polyhedron/backend_ppl.py b/src/sage/geometry/polyhedron/backend_ppl.py index 4315d202c57..1caafb52a93 100644 --- a/src/sage/geometry/polyhedron/backend_ppl.py +++ b/src/sage/geometry/polyhedron/backend_ppl.py @@ -405,7 +405,7 @@ def _init_empty_polyhedron(self): The empty polyhedron in ZZ^0 sage: Polyhedron(backend='ppl')._init_empty_polyhedron() """ - super(Polyhedron_ppl, self)._init_empty_polyhedron() + super()._init_empty_polyhedron() self._ppl_polyhedron = C_Polyhedron(self.ambient_dim(), 'empty') @staticmethod diff --git a/src/sage/geometry/polyhedron/base_ZZ.py b/src/sage/geometry/polyhedron/base_ZZ.py index cfb62d03834..07c7bbd6a4c 100644 --- a/src/sage/geometry/polyhedron/base_ZZ.py +++ b/src/sage/geometry/polyhedron/base_ZZ.py @@ -48,8 +48,7 @@ def __getattribute__(self, name): """ if name in ['ehrhart_quasipolynomial']: raise AttributeError(name) - else: - return super(Polyhedron_ZZ, self).__getattribute__(name) + return super().__getattribute__(name) def __dir__(self): r""" diff --git a/src/sage/geometry/polyhedron/double_description_inhomogeneous.py b/src/sage/geometry/polyhedron/double_description_inhomogeneous.py index 068c3317434..9b7882a5bcd 100644 --- a/src/sage/geometry/polyhedron/double_description_inhomogeneous.py +++ b/src/sage/geometry/polyhedron/double_description_inhomogeneous.py @@ -199,7 +199,7 @@ def __init__(self, base_ring, dim, inequalities, equations): [0||1 0] [0||0 1] """ - super(Hrep2Vrep, self).__init__(base_ring, dim) + super().__init__(base_ring, dim) inequalities = [list(x) for x in inequalities] equations = [list(x) for x in equations] if not inequalities and not equations: @@ -442,7 +442,7 @@ def __init__(self, base_ring, dim, vertices, rays, lines): sage: Vrep2Hrep(QQ, 2, [(-1/2,0)], [], [(1,-2/3), (1,0)]) [] """ - super(Vrep2Hrep, self).__init__(base_ring, dim) + super().__init__(base_ring, dim) if rays or lines: assert len(vertices) > 0 if not vertices and not rays and not lines: diff --git a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py index cd97821a951..6255650b84f 100644 --- a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py +++ b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py @@ -92,11 +92,11 @@ def __classcall__(cls, base_ring, dimension, basis, category=None): 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, - base_ring=base_ring, - dimension=dimension, - basis=basis, - category=category) + return super().__classcall__(cls, + base_ring=base_ring, + dimension=dimension, + basis=basis, + category=category) def __init__(self, base_ring, dimension, basis, category): """ @@ -113,7 +113,7 @@ def __init__(self, base_ring, dimension, basis, category): sage: M = FormalPolyhedraModule(QQ, 1, basis=[I01, I11, I12, I02]) sage: TestSuite(M).run() """ - super(FormalPolyhedraModule, self).__init__(base_ring, basis, prefix="", category=category) + super().__init__(base_ring, basis, prefix="", category=category) def degree_on_basis(self, m): r""" diff --git a/src/sage/geometry/ribbon_graph.py b/src/sage/geometry/ribbon_graph.py index 3d3502d16b8..60375b20ce2 100644 --- a/src/sage/geometry/ribbon_graph.py +++ b/src/sage/geometry/ribbon_graph.py @@ -299,7 +299,7 @@ def __classcall_private__(cls, sigma, rho, bipartite=False): M = sigma.parent() if len(M.domain()) < len(rho.parent().domain()): M = rho.parent() - return super(RibbonGraph, cls).__classcall__(cls, M(sigma), M(rho)) + return super().__classcall__(cls, M(sigma), M(rho)) def __init__(self, sigma, rho): r""" diff --git a/src/sage/geometry/toric_lattice_element.pyx b/src/sage/geometry/toric_lattice_element.pyx index caaf1c2be93..cdb2b6fa58f 100644 --- a/src/sage/geometry/toric_lattice_element.pyx +++ b/src/sage/geometry/toric_lattice_element.pyx @@ -343,7 +343,7 @@ cdef class ToricLatticeElement(Vector_integer_dense): sage: e._latex_() '\\left(1,\\,2,\\,3\\right)_{L^*}' """ - return "%s_{%s}" % (super(ToricLatticeElement, self)._latex_(), + return "%s_{%s}" % (super()._latex_(), self.parent().ambient_module()._latex_name) def _repr_(self): @@ -362,7 +362,7 @@ cdef class ToricLatticeElement(Vector_integer_dense): 'L*(1, 2, 3)' """ return (self.parent().ambient_module()._name - + super(ToricLatticeElement, self)._repr_()) + + super()._repr_()) def __reduce__(self): """ diff --git a/src/sage/geometry/toric_plotter.py b/src/sage/geometry/toric_plotter.py index 923fb43440d..988c180431a 100644 --- a/src/sage/geometry/toric_plotter.py +++ b/src/sage/geometry/toric_plotter.py @@ -198,7 +198,7 @@ def __init__(self, all_options, dimension, generators=None): sage: tp = ToricPlotter(dict(), 2) sage: TestSuite(tp).run() """ - super(ToricPlotter, self).__init__() + super().__init__() sd = self.__dict__ extra_options = dict() self.extra_options = extra_options diff --git a/src/sage/geometry/triangulation/point_configuration.py b/src/sage/geometry/triangulation/point_configuration.py index 855d6dbf4be..0efde128726 100644 --- a/src/sage/geometry/triangulation/point_configuration.py +++ b/src/sage/geometry/triangulation/point_configuration.py @@ -325,9 +325,8 @@ def __classcall__(cls, points, projective=False, connected=True, fine=False, reg if len(star_point) Date: Sun, 10 Jul 2022 11:14:52 +0200 Subject: [PATCH 246/416] modernize super in coding --- src/sage/coding/bch_code.py | 7 +++---- src/sage/coding/channel.py | 8 ++++---- src/sage/coding/cyclic_code.py | 17 ++++++++--------- src/sage/coding/decoder.py | 4 ++-- src/sage/coding/encoder.py | 4 ++-- src/sage/coding/extended_code.py | 9 +++++---- src/sage/coding/gabidulin_code.py | 8 ++++---- src/sage/coding/golay_code.py | 4 ++-- src/sage/coding/goppa_code.py | 4 ++-- src/sage/coding/guruswami_sudan/gs_decoder.py | 2 +- src/sage/coding/hamming_code.py | 2 +- src/sage/coding/information_set_decoder.py | 12 +++++------- src/sage/coding/kasami_codes.pyx | 4 ++-- src/sage/coding/linear_code.py | 18 +++++++++--------- src/sage/coding/linear_code_no_metric.py | 16 ++++++++-------- src/sage/coding/linear_rank_metric.py | 10 +++++----- src/sage/coding/parity_check_code.py | 10 +++++----- src/sage/coding/punctured_code.py | 12 ++++++------ src/sage/coding/reed_muller_code.py | 10 +++++----- src/sage/coding/subfield_subcode.py | 6 +++--- 20 files changed, 82 insertions(+), 85 deletions(-) diff --git a/src/sage/coding/bch_code.py b/src/sage/coding/bch_code.py index f5762c44f92..1666c5c4380 100644 --- a/src/sage/coding/bch_code.py +++ b/src/sage/coding/bch_code.py @@ -130,8 +130,8 @@ def __init__(self, base_field, length, designed_distance, D = [(offset + jump_size * i) % length for i in range(designed_distance - 1)] - super(BCHCode, self).__init__(field=base_field, length=length, - D=D, primitive_root=primitive_root) + super().__init__(field=base_field, length=length, + D=D, primitive_root=primitive_root) self._default_decoder_name = "UnderlyingGRS" self._jump_size = jump_size self._offset = offset @@ -282,8 +282,7 @@ def __init__(self, code, grs_decoder="KeyEquationSyndrome", **kwargs): self._grs_code = code.bch_to_grs() self._grs_decoder = self._grs_code.decoder(grs_decoder, **kwargs) self._decoder_type = copy(self._grs_decoder.decoder_type()) - super(BCHUnderlyingGRSDecoder, self).__init__( - code, code.ambient_space(), "Vector") + super().__init__(code, code.ambient_space(), "Vector") def _repr_(self): r""" diff --git a/src/sage/coding/channel.py b/src/sage/coding/channel.py index 193d60f6660..915982850c9 100644 --- a/src/sage/coding/channel.py +++ b/src/sage/coding/channel.py @@ -173,7 +173,7 @@ def __init__(self, input_space, output_space): sage: from sage.coding.channel import Channel sage: class ChannelExample(Channel): ....: def __init__(self, input_space, output_space): - ....: super(ChannelExample, self).__init__(input_space, output_space) + ....: super().__init__(input_space, output_space) We now create a member of our newly made class:: @@ -344,7 +344,7 @@ def __init__(self, space, number_errors): number_errors = (number_errors, number_errors) if not isinstance(number_errors, (tuple, list)): raise ValueError("number_errors must be a tuple, a list, an Integer or a Python int") - super(StaticErrorRateChannel, self).__init__(space, space) + super().__init__(space, space) if number_errors[1] > space.dimension(): raise ValueError("There might be more errors than the dimension of the input space") self._number_errors = number_errors @@ -514,7 +514,7 @@ def __init__(self, space, number_errors, number_erasures): raise ValueError("number_erasures must be a tuple, a list, an Integer or a Python int") output_space = cartesian_product([space, VectorSpace(GF(2), space.dimension())]) - super(ErrorErasureChannel, self).__init__(space, output_space) + super().__init__(space, output_space) if number_errors[1] + number_erasures[1] > space.dimension(): raise ValueError("The total number of errors and erasures cannot exceed the dimension of the input space") self._number_errors = number_errors @@ -704,7 +704,7 @@ def __init__(self, space, epsilon): if epsilon >= 1 or epsilon <= 0: raise ValueError("Error probability must be between 0 and 1") - super(QarySymmetricChannel, self).__init__(space, space) + super().__init__(space, space) self._epsilon = epsilon try: self.transmit_unsafe(space.random_element()) diff --git a/src/sage/coding/cyclic_code.py b/src/sage/coding/cyclic_code.py index 122a155dfa1..e013f217769 100644 --- a/src/sage/coding/cyclic_code.py +++ b/src/sage/coding/cyclic_code.py @@ -382,7 +382,7 @@ def __init__(self, generator_pol=None, length=None, code=None, check=True, self._generator_polynomial = generator_pol.monic() else: self._generator_polynomial = generator_pol - super(CyclicCode, self).__init__(F, length, "Vector", "Syndrome") + super().__init__(F, length, "Vector", "Syndrome") # Case (2) : a code is provided. elif (code is not None and @@ -400,8 +400,8 @@ def __init__(self, generator_pol=None, length=None, code=None, check=True, self._polynomial_ring = g.parent() self._generator_polynomial = g self._dimension = code.dimension() - super(CyclicCode, self).__init__(code.base_ring(), n, - "Vector", "Syndrome") + super().__init__(code.base_ring(), n, + "Vector", "Syndrome") # Case (3) : a defining set, a length and a field are provided elif (D is not None and length is not None and field is not None and @@ -456,7 +456,7 @@ def __init__(self, generator_pol=None, length=None, code=None, check=True, self._polynomial_ring = R self._generator_polynomial = g self._dimension = n - g.degree() - super(CyclicCode, self).__init__(F, n, "Vector", "SurroundingBCH") + super().__init__(F, n, "Vector", "SurroundingBCH") else: raise AttributeError("You must provide either a code, or a list " @@ -850,7 +850,7 @@ def __init__(self, code): if not isinstance(code, CyclicCode): raise ValueError("code has to be a CyclicCode") self._polynomial_ring = code._polynomial_ring - super(CyclicCodePolynomialEncoder, self).__init__(code) + super().__init__(code) def __eq__(self, other): r""" @@ -1025,7 +1025,7 @@ def __init__(self, code): if not isinstance(code, CyclicCode): raise ValueError("code has to be a CyclicCode") self._polynomial_ring = code._polynomial_ring - super(CyclicCodeVectorEncoder, self).__init__(code) + super().__init__(code) def __eq__(self, other): r""" @@ -1102,7 +1102,7 @@ def encode(self, m): (1, 1, 1, 0, 0, 1, 0) """ if self.generator_matrix.cache is not None: - return super(CyclicCodeVectorEncoder, self).encode(m) + return super().encode(m) k = self.code().dimension() n = self.code().length() @@ -1219,8 +1219,7 @@ def __init__(self, code, **kwargs): self._bch_code = code.surrounding_bch_code() self._bch_decoder = self._bch_code.decoder(**kwargs) self._decoder_type = copy(self._bch_decoder.decoder_type()) - super(CyclicCodeSurroundingBCHDecoder, self).__init__( - code, code.ambient_space(), "Vector") + super().__init__(code, code.ambient_space(), "Vector") def __eq__(self, other): r""" diff --git a/src/sage/coding/decoder.py b/src/sage/coding/decoder.py index 2e0e1d989b0..e12b1bde73f 100644 --- a/src/sage/coding/decoder.py +++ b/src/sage/coding/decoder.py @@ -35,7 +35,7 @@ class Decoder(SageObject): - inherit from :class:`Decoder` - call ``Decoder.__init__`` in the subclass constructor. - Example: ``super(SubclassName, self).__init__(code, input_space, + Example: ``super().__init__(code, input_space, connected_encoder_name)``. By doing that, your subclass will have all the parameters described above initialized. @@ -160,7 +160,7 @@ def __init__(self, code, input_space, connected_encoder_name): ....: def __init__(self, code): ....: in_space = code.ambient_space() ....: connected_enc = "GeneratorMatrix" - ....: super(DecoderExample, self).__init__(code, in_space, connected_enc) + ....: super().__init__(code, in_space, connected_enc) We now create a member of our brand new class:: diff --git a/src/sage/coding/encoder.py b/src/sage/coding/encoder.py index 304e68cce02..56f244e3ab9 100644 --- a/src/sage/coding/encoder.py +++ b/src/sage/coding/encoder.py @@ -35,7 +35,7 @@ class Encoder(SageObject): - inherit from :class:`Encoder`, - call ``Encoder.__init__`` in the subclass constructor. - Example: ``super(SubclassName, self).__init__(code)``. + Example: ``super().__init__(code)``. By doing that, your subclass will have its ``code`` parameter initialized. - Then, if the message space is a vector space, default implementations of :meth:`encode` and @@ -78,7 +78,7 @@ def __init__(self, code): sage: from sage.coding.encoder import Encoder sage: class EncoderExample(Encoder): ....: def __init__(self, code): - ....: super(EncoderExample, self).__init__(code) + ....: super().__init__(code) We now create a member of our newly made class:: diff --git a/src/sage/coding/extended_code.py b/src/sage/coding/extended_code.py index 4dd08f902bb..83c3c0143c4 100644 --- a/src/sage/coding/extended_code.py +++ b/src/sage/coding/extended_code.py @@ -63,7 +63,8 @@ def __init__(self, C): """ if not isinstance(C, AbstractLinearCode): raise ValueError("Provided code must be a linear code") - super(ExtendedCode, self).__init__(C.base_ring(), C.length() + 1, "ExtendedMatrix", "OriginalDecoder") + super().__init__(C.base_ring(), C.length() + 1, + "ExtendedMatrix", "OriginalDecoder") self._original_code = C self._dimension = C.dimension() @@ -208,7 +209,7 @@ def __init__(self, code): if not isinstance(code, ExtendedCode): raise TypeError("code has to be an instance of ExtendedCode class") - super(ExtendedCodeExtendedMatrixEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): r""" @@ -344,8 +345,8 @@ def __init__(self, code, original_decoder = None, **kwargs): self._decoder_type = copy(self._decoder_type) self._decoder_type.remove("dynamic") self._decoder_type = self._original_decoder.decoder_type() - super(ExtendedCodeOriginalCodeDecoder, self).__init__(code, code.ambient_space(),\ - self._original_decoder.connected_encoder()) + super().__init__(code, code.ambient_space(), + self._original_decoder.connected_encoder()) def _repr_(self): r""" diff --git a/src/sage/coding/gabidulin_code.py b/src/sage/coding/gabidulin_code.py index 353f76c6ee4..69a57887671 100644 --- a/src/sage/coding/gabidulin_code.py +++ b/src/sage/coding/gabidulin_code.py @@ -196,7 +196,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, self._twisting_homomorphism = twisting_homomorphism - super(GabidulinCode, self).__init__(base_field, sub_field, length, "VectorEvaluation", "Gao") + super().__init__(base_field, sub_field, length, "VectorEvaluation", "Gao") if length > self.extension_degree(): raise ValueError("'length' can be at most the degree of the extension, {}".format(self.extension_degree())) @@ -427,7 +427,7 @@ def __init__(self, code): """ if not isinstance(code, GabidulinCode): raise ValueError("code has to be a Gabidulin code") - super(GabidulinVectorEvaluationEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): """ @@ -581,7 +581,7 @@ def __init__(self, code): """ if not isinstance(code, GabidulinCode): raise ValueError("code has to be a Gabidulin code") - super(GabidulinPolynomialEvaluationEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): """ @@ -810,7 +810,7 @@ def __init__(self, code): """ if not isinstance(code, GabidulinCode): raise ValueError("code has to be a Gabidulin code") - super(GabidulinGaoDecoder, self).__init__(code, code.ambient_space(), "PolynomialEvaluation") + super().__init__(code, code.ambient_space(), "PolynomialEvaluation") def _repr_(self): """ diff --git a/src/sage/coding/golay_code.py b/src/sage/coding/golay_code.py index b4b6d64f847..029c572209e 100644 --- a/src/sage/coding/golay_code.py +++ b/src/sage/coding/golay_code.py @@ -103,7 +103,7 @@ def __init__(self, base_field, extended=True): self._dimension = 6 if extended: length += 1 - super(GolayCode, self).__init__(base_field, length, "GeneratorMatrix", "Syndrome") + super().__init__(base_field, length, "GeneratorMatrix", "Syndrome") def __eq__(self, other): r""" @@ -174,7 +174,7 @@ def dual_code(self): n = self.length() if n % 2 == 0: return self - return super(GolayCode, self).dual_code() + return super().dual_code() def minimum_distance(self): r""" diff --git a/src/sage/coding/goppa_code.py b/src/sage/coding/goppa_code.py index 152877c062e..fbfa74462c4 100644 --- a/src/sage/coding/goppa_code.py +++ b/src/sage/coding/goppa_code.py @@ -113,7 +113,7 @@ def __init__(self, generating_pol, defining_set): self._generating_pol = generating_pol self._defining_set = defining_set - super(GoppaCode, self).__init__(self._field, self._length, "GoppaEncoder", "Syndrome") + super().__init__(self._field, self._length, "GoppaEncoder", "Syndrome") if not generating_pol.is_monic(): raise ValueError("generating polynomial must be monic") @@ -353,7 +353,7 @@ def __init__(self, code): sage: E = codes.encoders.GoppaCodeEncoder(C) sage: TestSuite(E).run() """ - super(GoppaCodeEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): """ diff --git a/src/sage/coding/guruswami_sudan/gs_decoder.py b/src/sage/coding/guruswami_sudan/gs_decoder.py index a18a6bb710d..bfc04fee8ed 100644 --- a/src/sage/coding/guruswami_sudan/gs_decoder.py +++ b/src/sage/coding/guruswami_sudan/gs_decoder.py @@ -615,7 +615,7 @@ def __init__(self, code, tau = None, parameters = None, interpolation_alg = None self._root_finder = alekhnovich_root_finder else: raise ValueError("Please provide a method or one of the allowed strings for root_finder") - super(GRSGuruswamiSudanDecoder, self).__init__(code, code.ambient_space(), "EvaluationPolynomial") + super().__init__(code, code.ambient_space(), "EvaluationPolynomial") def _repr_(self): r""" diff --git a/src/sage/coding/hamming_code.py b/src/sage/coding/hamming_code.py index 3868c0a662d..cf355c2431f 100644 --- a/src/sage/coding/hamming_code.py +++ b/src/sage/coding/hamming_code.py @@ -70,7 +70,7 @@ def __init__(self, base_field, order): q = base_field.order() length = Integer((q ** order - 1) / (q - 1)) - super(HammingCode, self).__init__(base_field, length, "Systematic", "Syndrome") + super().__init__(base_field, length, "Systematic", "Syndrome") self._dimension = length - order def __eq__(self, other): diff --git a/src/sage/coding/information_set_decoder.py b/src/sage/coding/information_set_decoder.py index 7e28e1a7aac..a2cbf94fc5e 100644 --- a/src/sage/coding/information_set_decoder.py +++ b/src/sage/coding/information_set_decoder.py @@ -100,7 +100,7 @@ class InformationSetAlgorithm(SageObject): sage: from sage.coding.decoder import DecodingError sage: class MinimalISD(InformationSetAlgorithm): ....: def __init__(self, code, decoding_interval): - ....: super(MinimalISD, self).__init__(code, decoding_interval, "MinimalISD") + ....: super().__init__(code, decoding_interval, "MinimalISD") ....: def calibrate(self): ....: self._parameters = { } # calibrate parameters here ....: self._time_estimate = 10.0 # calibrated time estimate @@ -417,13 +417,12 @@ def __init__(self, code, decoding_interval, search_size = None): if search_size > decoding_interval[1]: raise ValueError("The search size parameter has to be at most" " the maximal number of allowed errors") - super(LeeBrickellISDAlgorithm, self).__init__(code, decoding_interval, "Lee-Brickell", - parameters={ 'search_size': search_size }) + super().__init__(code, decoding_interval, "Lee-Brickell", + parameters={'search_size': search_size}) self._parameters_specified = True else: self._parameters_specified = False - super(LeeBrickellISDAlgorithm, self).__init__(code, decoding_interval, "Lee-Brickell") - + super().__init__(code, decoding_interval, "Lee-Brickell") def decode(self, r): r""" @@ -824,8 +823,7 @@ def __init__(self, code, number_errors, algorithm=None, **kwargs): self._number_errors = number_errors - super(LinearCodeInformationSetDecoder, self).__init__( - code, code.ambient_space(), code._default_encoder_name) + super().__init__(code, code.ambient_space(), code._default_encoder_name) if algorithm is None: if kwargs: diff --git a/src/sage/coding/kasami_codes.pyx b/src/sage/coding/kasami_codes.pyx index 2835e19b8de..44a761f3a56 100644 --- a/src/sage/coding/kasami_codes.pyx +++ b/src/sage/coding/kasami_codes.pyx @@ -200,8 +200,8 @@ class KasamiCode(AbstractLinearCode): if extended: length += 1 - super(KasamiCode, self).__init__(GF(2), length, - "GeneratorMatrix", "Syndrome") + super().__init__(GF(2), length, + "GeneratorMatrix", "Syndrome") def parameters(self): r""" diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index cfd84e86e5c..fac96bbac30 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -298,7 +298,7 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric): - inherit from AbstractLinearCode - call AbstractLinearCode ``__init__`` method in the subclass constructor. Example: - ``super(SubclassName, self).__init__(base_field, length, "EncoderName", "DecoderName")``. + ``super().__init__(base_field, length, "EncoderName", "DecoderName")``. By doing that, your subclass will have its ``length`` parameter initialized and will be properly set as a member of the category framework. You need of course to complete the constructor by adding any additional parameter @@ -418,7 +418,7 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam self._registered_decoders['InformationSet'] = LinearCodeInformationSetDecoder self._generic_constructor = LinearCode - super(AbstractLinearCode, self).__init__(base_field, length, default_encoder_name, default_decoder_name) + super().__init__(base_field, length, default_encoder_name, default_decoder_name) def _an_element_(self): r""" @@ -2309,7 +2309,7 @@ def __init__(self, generator, d=None): # Assume input is an AbstractLinearCode, extract its generator matrix generator = generator.generator_matrix() - super(LinearCode, self).__init__(base_ring, generator.ncols(), "GeneratorMatrix", "Syndrome") + super().__init__(base_ring, generator.ncols(), "GeneratorMatrix", "Syndrome") self._generator_matrix = generator self._dimension = generator.rank() self._minimum_distance = d @@ -2376,7 +2376,7 @@ def generator_matrix(self, encoder_name=None, **kwargs): if encoder_name is None or encoder_name == 'GeneratorMatrix': g = self._generator_matrix else: - g = super(LinearCode, self).generator_matrix(encoder_name, **kwargs) + g = super().generator_matrix(encoder_name, **kwargs) g.set_immutable() return g @@ -2405,7 +2405,7 @@ def __init__(self, code): sage: E Generator matrix-based encoder for [7, 4] linear code over GF(2) """ - super(LinearCodeGeneratorMatrixEncoder, self).__init__(code) + super().__init__(code) def __eq__(self, other): r""" @@ -2636,8 +2636,8 @@ def __init__(self, code, maximum_error_weight=None): raise ValueError("maximum_error_weight has to be less than code's length minus its dimension") else: self._maximum_error_weight = maximum_error_weight - super(LinearCodeSyndromeDecoder, self).__init__(code, code.ambient_space(),\ - code._default_encoder_name) + super().__init__(code, code.ambient_space(), + code._default_encoder_name) self._lookup_table = self._build_lookup_table() def __eq__(self, other): @@ -2933,8 +2933,8 @@ def __init__(self, code): sage: D Nearest neighbor decoder for [7, 4] linear code over GF(2) """ - super(LinearCodeNearestNeighborDecoder, self).__init__(code, code.ambient_space(), \ - code._default_encoder_name) + super().__init__(code, code.ambient_space(), + code._default_encoder_name) def __eq__(self, other): r""" diff --git a/src/sage/coding/linear_code_no_metric.py b/src/sage/coding/linear_code_no_metric.py index 305442dd0de..e25add5fe93 100644 --- a/src/sage/coding/linear_code_no_metric.py +++ b/src/sage/coding/linear_code_no_metric.py @@ -33,7 +33,7 @@ class AbstractLinearCodeNoMetric(AbstractCode, Module): - inherit from AbstractLinearCodeNoMetric - call AbstractCode ``__init__`` method in the subclass constructor. - Example: ``super(SubclassName, self).__init__(length, "EncoderName", + Example: ``super().__init__(length, "EncoderName", "DecoderName", "metric")``. - add the following two lines on the class level:: @@ -184,13 +184,13 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam if default_decoder_name not in self._registered_decoders: raise ValueError("You must set a valid decoder as default decoder for this code, by filling in the dictionary of registered decoders") - #if not self.dimension() <= length: - # raise ValueError("The dimension of the code can be at most its length, {}".format(length)) + # if not self.dimension() <= length: + # raise ValueError("The dimension of the code can be at most its length, {}".format(length)) - super(AbstractLinearCodeNoMetric, self).__init__(length, default_encoder_name, default_decoder_name, metric) + super().__init__(length, default_encoder_name, default_decoder_name, metric) cat = Modules(base_field).FiniteDimensional().WithBasis().Finite() facade_for = VectorSpace(base_field, self._length) - self.Element = type(facade_for.an_element()) #for when we made this a non-facade parent + self.Element = type(facade_for.an_element()) # for when we made this a non-facade parent Parent.__init__(self, base=base_field, facade=facade_for, category=cat) def base_field(self): @@ -322,11 +322,11 @@ def dimension(self): ....: _registered_encoders = {} ....: _registered_decoders = {} ....: def __init__(self): - ....: super(MonkeyCode, self).__init__(GF(5), 10, "Monkey", "Syndrome") + ....: super().__init__(GF(5), 10, "Monkey", "Syndrome") ....: sage: class MonkeyEncoder(Encoder): ....: def __init__(self, code): - ....: super(MonkeyEncoder, self).__init__(C) + ....: super().__init__(C) ....: @cached_method ....: def generator_matrix(self): ....: G = identity_matrix(GF(5), 5).augment(matrix(GF(5), 5, 7)) @@ -1134,7 +1134,7 @@ def __init__(self, code, systematic_positions=None): sage: E Systematic encoder for [7, 4] linear code over GF(2) """ - super(LinearCodeSystematicEncoder, self).__init__(code) + super().__init__(code) self._systematic_positions = tuple(systematic_positions) if systematic_positions else None if systematic_positions: # Test that systematic_positions consists of integers in the right diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 68d8cc4edf0..804b68fc890 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -472,7 +472,7 @@ def __init__(self, base_field, sub_field, length, default_encoder_name, self._sub_field = sub_field self._generic_constructor = LinearRankMetricCode - super(AbstractLinearRankMetricCode, self).__init__(base_field, length, default_encoder_name, default_decoder_name, "rank") + super().__init__(base_field, length, default_encoder_name, default_decoder_name, "rank") def sub_field(self): r""" @@ -710,7 +710,7 @@ def __init__(self, generator, sub_field=None, basis=None): self._generator_matrix = generator self._length = generator.ncols() - super(LinearRankMetricCode, self).__init__(base_field, sub_field, self._length, "GeneratorMatrix", "NearestNeighbor", basis) + super().__init__(base_field, sub_field, self._length, "GeneratorMatrix", "NearestNeighbor", basis) def _repr_(self): r""" @@ -768,7 +768,7 @@ def generator_matrix(self, encoder_name=None, **kwargs): if encoder_name is None or encoder_name == 'GeneratorMatrix': g = self._generator_matrix else: - g = super(LinearRankMetricCode, self).generator_matrix(encoder_name, **kwargs) + g = super().generator_matrix(encoder_name, **kwargs) g.set_immutable() return g @@ -796,8 +796,8 @@ def __init__(self, code): sage: D Nearest neighbor decoder for [3, 2] linear rank metric code over GF(64)/GF(4) """ - super(LinearRankMetricCodeNearestNeighborDecoder, self).__init__(code, code.ambient_space(), \ - code._default_encoder_name) + super().__init__(code, code.ambient_space(), + code._default_encoder_name) def __eq__(self, other): r""" diff --git a/src/sage/coding/parity_check_code.py b/src/sage/coding/parity_check_code.py index 9edeb8023e5..880de2c00fd 100644 --- a/src/sage/coding/parity_check_code.py +++ b/src/sage/coding/parity_check_code.py @@ -77,9 +77,9 @@ def __init__(self, base_field=GF(2), dimension=7): raise ValueError("dimension must be an integer") self._dimension = dimension - super(ParityCheckCode, self).__init__( - base_field, dimension + 1, "ParityCheckCodeGeneratorMatrixEncoder", - "Syndrome") + super().__init__(base_field, dimension + 1, + "ParityCheckCodeGeneratorMatrixEncoder", + "Syndrome") def __eq__(self, other): r""" @@ -177,7 +177,7 @@ def __init__(self, code): """ if not isinstance(code, ParityCheckCode): raise ValueError("code has to be a parity-check code") - super(ParityCheckCodeGeneratorMatrixEncoder, self).__init__(code) + super().__init__(code) def generator_matrix(self): r""" @@ -241,7 +241,7 @@ def __init__(self, code): """ if not isinstance(code, ParityCheckCode): raise ValueError("code has to be a parity-check code") - super(ParityCheckCodeStraightforwardEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): r""" diff --git a/src/sage/coding/punctured_code.py b/src/sage/coding/punctured_code.py index 62625929dd2..6ec0dc8e44b 100644 --- a/src/sage/coding/punctured_code.py +++ b/src/sage/coding/punctured_code.py @@ -139,10 +139,10 @@ def __init__(self, C, positions): positions = set(positions) if not isinstance(C, AbstractLinearCode): raise ValueError("Provided code must be a linear code") - if not all (i in range(0, C.length()) for i in positions): + if not all(i in range(C.length()) for i in positions): raise ValueError("Positions to puncture must be positive integers smaller than the length of the provided code") - super(PuncturedCode, self).__init__(C.base_ring(), C.length() - len(positions), \ - "PuncturedMatrix", "OriginalCode") + super().__init__(C.base_ring(), C.length() - len(positions), + "PuncturedMatrix", "OriginalCode") self._original_code = C self._positions = positions @@ -366,7 +366,7 @@ def __init__(self, code): """ if not isinstance(code, PuncturedCode): raise TypeError("code has to be an instance of PuncturedCode class") - super(PuncturedCodePuncturedMatrixEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): r""" @@ -562,8 +562,8 @@ def __init__(self, code, strategy = None, original_decoder = None, **kwargs): self._decoder_type = copy(self._decoder_type) self._decoder_type.remove("dynamic") self._decoder_type = self._original_decoder.decoder_type() - super(PuncturedCodeOriginalCodeDecoder, self).__init__(code, code.ambient_space(),\ - self._original_decoder.connected_encoder()) + super().__init__(code, code.ambient_space(), + self._original_decoder.connected_encoder()) def _repr_(self): r""" diff --git a/src/sage/coding/reed_muller_code.py b/src/sage/coding/reed_muller_code.py index 8eca7c8647f..84d9c561fe0 100644 --- a/src/sage/coding/reed_muller_code.py +++ b/src/sage/coding/reed_muller_code.py @@ -263,7 +263,7 @@ def __init__(self, base_field, order, num_of_var): if (order >= q): raise ValueError("The order must be less than %s" % q) - super(QAryReedMullerCode,self).__init__(base_field, q**num_of_var, "EvaluationVector", "Syndrome") + super().__init__(base_field, q**num_of_var, "EvaluationVector", "Syndrome") self._order = order self._num_of_var = num_of_var self._dimension = binomial(num_of_var + order, order) @@ -428,8 +428,8 @@ def __init__(self, order, num_of_var): "The order must be less than or equal to %s" % num_of_var) - super(BinaryReedMullerCode, self).__init__(GF(2), 2**num_of_var, - "EvaluationVector", "Syndrome") + super().__init__(GF(2), 2**num_of_var, + "EvaluationVector", "Syndrome") self._order = order self._num_of_var = num_of_var self._dimension = _binomial_sum(num_of_var, order) @@ -578,7 +578,7 @@ def __init__(self, code): code, BinaryReedMullerCode)): raise ValueError("the code has to be a Reed-Muller code") - super(ReedMullerVectorEncoder, self).__init__(code) + super().__init__(code) def _repr_(self): r""" @@ -761,7 +761,7 @@ def __init__(self, code, polynomial_ring=None): isinstance(code, QAryReedMullerCode) or isinstance(code, BinaryReedMullerCode)): raise ValueError("the code has to be a Reed-Muller code") - super(ReedMullerPolynomialEncoder, self).__init__(code) + super().__init__(code) if polynomial_ring is None: self._polynomial_ring = PolynomialRing(code.base_field(), code.number_of_variables(), 'x') diff --git a/src/sage/coding/subfield_subcode.py b/src/sage/coding/subfield_subcode.py index cb78477a8b7..b3861707d6b 100644 --- a/src/sage/coding/subfield_subcode.py +++ b/src/sage/coding/subfield_subcode.py @@ -77,7 +77,7 @@ def __init__(self, original_code, subfield, embedding=None): if not subfield.is_finite(): raise ValueError("subfield has to be a finite field") - super(SubfieldSubcode, self).__init__(subfield, original_code.length(), "Systematic", "Syndrome") + super().__init__(subfield, original_code.length(), "Systematic", "Syndrome") F = original_code.base_field() sm = F.degree() @@ -309,8 +309,8 @@ def __init__(self, code, original_decoder = None, **kwargs): else: self._original_decoder = original_code.decoder(**kwargs) - super(SubfieldSubcodeOriginalCodeDecoder, self).__init__(code, code.ambient_space(), - self._original_decoder.connected_encoder()) + super().__init__(code, code.ambient_space(), + self._original_decoder.connected_encoder()) self._decoder_type = copy(self._decoder_type) self._decoder_type.remove("dynamic") From 72f124daeb43f7cfa02a19658d9f13802b0dc323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 10 Jul 2022 16:07:31 +0200 Subject: [PATCH 247/416] undo change in commutative_dga --- src/sage/algebras/commutative_dga.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index af3434661f0..ff80254caf9 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -211,7 +211,7 @@ def __classcall__(cls, A, im_gens): raise ValueError("The given dictionary does not determine a degree 1 map") im_gens = tuple(im_gens.get(x, A.zero()) for x in A.gens()) - return super().__classcall__(cls, A, im_gens) + return super(Differential, cls).__classcall__(cls, A, im_gens) def __init__(self, A, im_gens): r""" @@ -998,9 +998,9 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= for i in range(n) if is_odd(tot_degs[i])], side='twosided') - return super().__classcall__(cls, base=base, names=names, - degrees=degrees, R=R, I=I, - category=category) + return super(GCAlgebra, cls).__classcall__(cls, base=base, names=names, + degrees=degrees, R=R, I=I, + category=category) def __init__(self, base, R=None, I=None, names=None, degrees=None, category=None): """ @@ -1236,7 +1236,7 @@ def _coerce_map_from_(self, other): .gens()): return False return self.cover_ring().has_coerce_map_from(other.cover_ring()) - return super()._coerce_map_from_(other) + return super(GCAlgebra, self)._coerce_map_from_(other) def _element_constructor_(self, x, coerce=True): r""" @@ -1755,7 +1755,7 @@ def _coerce_map_from_(self, other): return False elif isinstance(other, GCAlgebra): # Not multigraded return False - return super()._coerce_map_from_(other) + return super(GCAlgebra_multigraded, self)._coerce_map_from_(other) def basis(self, n, total=False): """ @@ -1971,7 +1971,7 @@ def __classcall__(cls, A, differential): differential = A.differential(differential) elif differential.parent() != A: differential = Differential(A, differential._dic_) - return super().__classcall__(cls, A, differential) + return super(GCAlgebra, cls).__classcall__(cls, A, differential) def __init__(self, A, differential): """ From 1f00ee3c73bbeeeff0670b622537530c0e3aa695 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 10 Jul 2022 08:00:34 -0700 Subject: [PATCH 248/416] src/doc/en/developer/trac.rst: Remove stray unicode --- src/doc/en/developer/trac.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/en/developer/trac.rst b/src/doc/en/developer/trac.rst index eb858a2e75a..d87e1cbc0e9 100644 --- a/src/doc/en/developer/trac.rst +++ b/src/doc/en/developer/trac.rst @@ -286,7 +286,7 @@ new branch on the trac ticket. After pushing a branch to a ticket, the ticket will show badges linking to results of automated tests that run on the patchbot and -other ​tests that run on GitHub Actions. +other tests that run on GitHub Actions. * The Patch buildbot will automatically test your ticket. See :trac:`wiki/patchbot` for more information about its features and limitations. Make sure that you From 87140dbec28767e0540dbea5aa96b1df25d29523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 10 Jul 2022 18:25:59 +0200 Subject: [PATCH 249/416] fix detail --- src/sage/combinat/words/word_generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index 142bb643a4d..e7110609d63 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -228,7 +228,7 @@ def __init__(self, p, q, alphabet=(0,1), algorithm='cf'): def markoff_number(self): r""" - Returns the Markoff number associated to the Christoffel word ``self``. + Return the Markoff number associated to the Christoffel word ``self``. The *Markoff number* of a Christoffel word `w` is `trace(M(w))/3`, where `M(w)` is the `2\times 2` matrix obtained by applying the From 299f26593e2c76b0d515096175ba696f11f50845 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Mon, 11 Jul 2022 11:39:21 +0800 Subject: [PATCH 250/416] add doctest for #34143 --- src/sage/rings/integer.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index e6533d80016..44d39965adc 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -2177,6 +2177,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): ... TypeError: no canonical coercion from Univariate Polynomial Ring in t over Rational Field to Rational Field + + Test for :trac:`34143`:: + + sage: pow(5,7,13).parent() + Integer Ring """ if modulus is not None: from sage.rings.finite_rings.integer_mod import Mod From b73ee74f96dd6f64c109025505edc79e55203ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 11 Jul 2022 10:20:03 +0200 Subject: [PATCH 251/416] fix and activate pycodestyle E306 --- src/sage/combinat/crystals/affine_factorization.py | 1 + src/sage/combinat/crystals/kirillov_reshetikhin.py | 3 ++- src/sage/combinat/crystals/littelmann_path.py | 2 ++ src/sage/combinat/crystals/multisegments.py | 4 ++++ .../combinat/root_system/hecke_algebra_representation.py | 1 + src/sage/combinat/root_system/integrable_representations.py | 2 ++ .../root_system/root_lattice_realization_algebras.py | 1 + src/sage/combinat/root_system/root_lattice_realizations.py | 6 ++++++ src/sage/combinat/root_system/root_space.py | 1 + src/sage/combinat/root_system/type_folded.py | 1 + src/sage/combinat/root_system/weight_space.py | 1 + src/sage/combinat/root_system/weyl_group.py | 2 ++ src/sage/graphs/generic_graph.py | 3 +++ src/sage/graphs/graph.py | 5 +++++ src/sage/graphs/graph_generators.py | 2 ++ src/tox.ini | 3 ++- 16 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/sage/combinat/crystals/affine_factorization.py b/src/sage/combinat/crystals/affine_factorization.py index b88f1e3adb1..1bc568aeb71 100644 --- a/src/sage/combinat/crystals/affine_factorization.py +++ b/src/sage/combinat/crystals/affine_factorization.py @@ -212,6 +212,7 @@ def _tableaux_isomorphism(self): """ # Constructing the tableaux crystal from sage.combinat.crystals.tensor_product import CrystalOfTableaux + def mg_to_shape(mg): l = list(mg.weight().to_vector()) while l and l[-1] == 0: diff --git a/src/sage/combinat/crystals/kirillov_reshetikhin.py b/src/sage/combinat/crystals/kirillov_reshetikhin.py index fe666082fe6..700768dce68 100644 --- a/src/sage/combinat/crystals/kirillov_reshetikhin.py +++ b/src/sage/combinat/crystals/kirillov_reshetikhin.py @@ -3124,8 +3124,9 @@ def promotion_on_highest_weight_vectors(self): hw_dual = [t for t in T_dual if t.is_highest_weight(index_set=ind)] dic_weight = {tuple(t.weight().to_vector()): t for t in hw} dic_weight_dual = {tuple(t.weight().to_vector()): t for t in hw_dual} + def neg(x): - y = list(x) # map a (shallow) copy + y = list(x) # map a (shallow) copy y[0] = -y[0] return tuple(y) return {dic_weight[w]: dic_weight_dual[neg(w)] for w in dic_weight} diff --git a/src/sage/combinat/crystals/littelmann_path.py b/src/sage/combinat/crystals/littelmann_path.py index 3e6db2ce2fe..9eb8ecd6dcd 100644 --- a/src/sage/combinat/crystals/littelmann_path.py +++ b/src/sage/combinat/crystals/littelmann_path.py @@ -805,6 +805,7 @@ def one_dimensional_configuration_sum(self, q=None, group_components=True): #P0 = self.weight_lattice_realization().classical() P0 = RootSystem(self.cartan_type().classical()).weight_lattice() B = P0.algebra(q.parent()) + def weight(x): w = x.weight() return P0.sum(int(c)*P0.basis()[i] for i,c in w if i in P0.index_set()) @@ -1144,6 +1145,7 @@ def energy_function(self): Qd = RootSystem(cartan_dual).root_lattice() dualize = lambda x: Qv.from_vector(x.to_vector()) L = [Wd.from_reduced_word(x.reduced_word()) for x in L] + def stretch_short_root(a): # stretches roots by translation factor if ct.dual().type() == 'BC': diff --git a/src/sage/combinat/crystals/multisegments.py b/src/sage/combinat/crystals/multisegments.py index 81b01f17fcc..38367628485 100644 --- a/src/sage/combinat/crystals/multisegments.py +++ b/src/sage/combinat/crystals/multisegments.py @@ -216,9 +216,11 @@ def _repr_(self): """ if not self.value: return '0' + def sort_key(mc): x = mc[0] return (-x[0], ZZ(x[1])) + def seg(x): m, c = x if c != 1: @@ -243,9 +245,11 @@ def _latex_(self): """ if not self.value: return "0" + def sort_key(mc): x = mc[0] return (-x[0], ZZ(x[1])) + def seg(x): m, c = x if c != 1: diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py index e146784ad98..bde28234214 100644 --- a/src/sage/combinat/root_system/hecke_algebra_representation.py +++ b/src/sage/combinat/root_system/hecke_algebra_representation.py @@ -460,6 +460,7 @@ def _test_relations(self, **options): q1 = self._q1 q2 = self._q2 T = self + def Ti(x,i,c): return T[i](x)+c*x # Check the quadratic relation diff --git a/src/sage/combinat/root_system/integrable_representations.py b/src/sage/combinat/root_system/integrable_representations.py index e17e6b3c7fe..6aedd4aefb2 100644 --- a/src/sage/combinat/root_system/integrable_representations.py +++ b/src/sage/combinat/root_system/integrable_representations.py @@ -919,6 +919,7 @@ def dominant_maximal_weights(self): """ k = self.level() Lambda = self._P.fundamental_weights() + def next_level(wt): return [wt + Lambda[i] for i in self._index_set_classical if (wt + Lambda[i]).level() <= k] @@ -1191,6 +1192,7 @@ def branch(self, i=None, weyl_character_ring=None, sequence=None, depth=5): sequence[j] = j+1 elif j > i: sequence[j] = j + def next_level(x): ret = [] for j in self._index_set: diff --git a/src/sage/combinat/root_system/root_lattice_realization_algebras.py b/src/sage/combinat/root_system/root_lattice_realization_algebras.py index 86b1e561f87..4d26225011a 100644 --- a/src/sage/combinat/root_system/root_lattice_realization_algebras.py +++ b/src/sage/combinat/root_system/root_lattice_realization_algebras.py @@ -848,6 +848,7 @@ def T0_check_on_basis(self, q1, q2, convention="antidominant"): translation = A0.monomial(-L0.simple_root(j)/a0) Tv = T[v] Tinv = T.Tw_inverse(v+(j,)) + def T0_check(weight): return -q1*q2*Tinv( translation * Tv(A0.monomial(weight))) # For debugging purposes diff --git a/src/sage/combinat/root_system/root_lattice_realizations.py b/src/sage/combinat/root_system/root_lattice_realizations.py index 766b7932cdb..f6713d00d33 100644 --- a/src/sage/combinat/root_system/root_lattice_realizations.py +++ b/src/sage/combinat/root_system/root_lattice_realizations.py @@ -804,6 +804,7 @@ def positive_real_roots(self): # Start with the classical positive roots alpha = self.simple_roots() + def lift(x): """ Lift up the classical element into ``self``. @@ -1133,6 +1134,7 @@ def generalized_nonnesting_partition_lattice(self, m, facade=False): for multilist in combinations_with_replacement(list(range(len(chain))), m): if len(set(multilist)) == len(chain): multichains.append(tuple([chain[i] for i in multilist])) + def is_saturated_chain(chain): for i in range(1, m + 1): for j in range(1, m - i + 1): @@ -1710,6 +1712,7 @@ def tau_epsilon_operator_on_almost_positive_roots(self, J): t = W.from_reduced_word(J) simple_roots = self.simple_roots() other_negative_simple_roots = set(-simple_roots[i] for i in self.index_set() if i not in J) + def tau_epsilon(alpha): if alpha in other_negative_simple_roots: return alpha @@ -2702,6 +2705,7 @@ def plot_alcoves(self, alcoves=True, alcove_labels=False, wireframe=False, **opt def alcove_in_bounding_box(w): return any(plot_options.in_bounding_box(w.action(fundamental_alcove_rays[i])) for i in I) + def alcove_facet(w, i): # Alcove facets with degenerate intersection with the # bounding box bring no information; we might as well @@ -2712,6 +2716,7 @@ def alcove_facet(w, i): thickness=plot_options.thickness(i), wireframe=wireframe, draw_degenerate=False) + def alcove_label(w): label = "$1$" if w.is_one() else "$s_{"+"".join(str(j) for j in w.reduced_word())+"}$" position = plot_options.projection(w.action(rho)) @@ -3497,6 +3502,7 @@ def _dot_orbit_iter(self): (2, 0, 1), (0, 1, 2), (0, 2, 1)] """ I = self.parent().index_set() + def apply_action(la): return [la.dot_action([i]) for i in I] R = RecursivelyEnumeratedSet([self], apply_action, structure=None, diff --git a/src/sage/combinat/root_system/root_space.py b/src/sage/combinat/root_system/root_space.py index bf2e2858413..c36a721e02c 100644 --- a/src/sage/combinat/root_system/root_space.py +++ b/src/sage/combinat/root_system/root_space.py @@ -226,6 +226,7 @@ def to_ambient_space_morphism(self): else: L = self.cartan_type().root_system().ambient_space() basis = L.simple_roots() + def basis_value(basis, i): return basis[i] return self.module_morphism(on_basis = functools.partial(basis_value, basis) , codomain=L) diff --git a/src/sage/combinat/root_system/type_folded.py b/src/sage/combinat/root_system/type_folded.py index 9482ec494c4..b8ef07d88e2 100644 --- a/src/sage/combinat/root_system/type_folded.py +++ b/src/sage/combinat/root_system/type_folded.py @@ -284,6 +284,7 @@ def scaling_factors(self): """ if self._cartan_type.is_finite(): L = self._cartan_type.root_system().ambient_space() + def f(i): root = L.simple_root(i) coroot = L.simple_coroot(i) diff --git a/src/sage/combinat/root_system/weight_space.py b/src/sage/combinat/root_system/weight_space.py index 6dd7f347ca9..a532df0b343 100644 --- a/src/sage/combinat/root_system/weight_space.py +++ b/src/sage/combinat/root_system/weight_space.py @@ -451,6 +451,7 @@ def to_ambient_space_morphism(self): raise TypeError("No implemented map from the coweight space to the ambient space") L = self.cartan_type().root_system().ambient_space() basis = L.fundamental_weights() + def basis_value(basis, i): return basis[i] return self.module_morphism(on_basis = functools.partial(basis_value, basis), codomain=L) diff --git a/src/sage/combinat/root_system/weyl_group.py b/src/sage/combinat/root_system/weyl_group.py index 76c4314c463..42aa218115c 100644 --- a/src/sage/combinat/root_system/weyl_group.py +++ b/src/sage/combinat/root_system/weyl_group.py @@ -376,6 +376,7 @@ def reflections(self): NotImplementedError: only implemented for finite and affine Cartan types """ prr = self.domain().positive_real_roots() + def to_elt(alp): ref = self.domain().reflection(alp) m = Matrix([ref(x).to_vector() for x in self.domain().basis()]) @@ -1297,6 +1298,7 @@ def distinguished_reflections(self): Q = self._cartan_type.root_system().root_lattice() pos_roots = list(Q.positive_roots()) Phi = pos_roots + [-x for x in pos_roots] + def build_elt(index): r = pos_roots[index] perm = [Phi.index(x.reflection(r))+1 for x in Phi] diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index c5ef0c06ec5..12f856d341c 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -7342,6 +7342,7 @@ def max_cut(self, value_only=True, use_edge_labels=False, vertices=False, if use_edge_labels: from sage.rings.real_mpfr import RR + def weight(x): return x if x in RR else 1 else: @@ -9097,6 +9098,7 @@ def flow(self, x, y, value_only=True, integer=False, use_edge_labels=True, from sage.rings.real_mpfr import RR if integer: from math import floor + def capacity(z): return floor(z) if z in RR else 1 else: @@ -20790,6 +20792,7 @@ def _keys_for_vertices(self): sage: s = g.graphviz_string() """ label = {v: 'node_{0}'.format(i) for i, v in enumerate(self)} + def get_label(vertex): return label[vertex] return get_label diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 8739f6aee79..00ffa0f2eee 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -3159,6 +3159,7 @@ def minimum_outdegree_orientation(self, use_edge_labels=False, solver=None, verb if use_edge_labels: from sage.rings.real_mpfr import RR + def weight(e): l = self.edge_label(e) return l if l in RR else 1 @@ -3178,6 +3179,7 @@ def weight(e): # Whether an edge adjacent to a vertex u counts positively or # negatively. To do so, we first fix an arbitrary extremity per edge uv. ext = {frozenset(e): e[0] for e in self.edge_iterator(labels=False)} + def outgoing(u, e, variable): if u == ext[frozenset(e)]: return variable @@ -4159,6 +4161,7 @@ def matching(self, value_only=False, algorithm="Edmonds", ValueError: algorithm must be set to either "Edmonds" or "LP" """ from sage.rings.real_mpfr import RR + def weight(x): if x in RR: return x @@ -7949,6 +7952,7 @@ def modular_decomposition(self, algorithm=None, style='tuple'): if style == 'tuple': if D is None: return tuple() + def relabel(x): if x.node_type == NodeType.NORMAL: return x.children[0] @@ -7959,6 +7963,7 @@ def relabel(x): from sage.combinat.rooted_tree import LabelledRootedTree if D is None: return LabelledRootedTree([]) + def to_tree(x): if x.node_type == NodeType.NORMAL: return LabelledRootedTree([], label=x.children[0]) diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 5555b222b1f..94ea1ed6bf3 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -792,12 +792,14 @@ def property(x): def property(x): D = sorted(x.degree()) return all(degree_sequence[i] >= d for i, d in enumerate(D)) + def extra_property(x): return degree_sequence == sorted(x.degree()) else: def property(x): D = sorted(x.degree() + [0] * (vertices - x.num_verts())) return all(degree_sequence[i] >= d for i, d in enumerate(D)) + def extra_property(x): if x.num_verts() != vertices: return False diff --git a/src/tox.ini b/src/tox.ini index 15cc6d181e0..f5ade5edd2d 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -94,6 +94,7 @@ description = check against Sage's minimal style conventions # Check for the following issues: # E111: indentation is not a multiple of four + # E306: expected 1 blank line before a nested definition, found 0 # E401: multiple imports on one line # E701: multiple statements on one line (colon) # E702: multiple statements on one line (semicolon) @@ -106,7 +107,7 @@ description = # W605: invalid escape sequence ‘x’ # 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/} +commands = pycodestyle --select E111,E306,E401,E701,E702,E703,W605,E711,E712,E713,E721,E722 {posargs:{toxinidir}/sage/} pycodestyle --select E111,E401,E703,E712,E713,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/} [pycodestyle] From 3ee509aec951c3bfae59c8da6cf5764f014c51f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Mon, 11 Jul 2022 22:25:34 +1200 Subject: [PATCH 252/416] remove unused, and removed from sphinx 5, imported get_module_members --- src/sage_docbuild/ext/sage_autodoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage_docbuild/ext/sage_autodoc.py b/src/sage_docbuild/ext/sage_autodoc.py index 399ac1532e5..9ff86106590 100644 --- a/src/sage_docbuild/ext/sage_autodoc.py +++ b/src/sage_docbuild/ext/sage_autodoc.py @@ -35,7 +35,7 @@ import sphinx from sphinx.ext.autodoc import mock, ObjectMember -from sphinx.ext.autodoc.importer import import_object, get_object_members, get_module_members +from sphinx.ext.autodoc.importer import import_object, get_object_members from sphinx.locale import _, __ from sphinx.pycode import ModuleAnalyzer from sphinx.errors import PycodeError From 18c92459b336b2b7b641fd544a12b04467822271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Mon, 11 Jul 2022 22:26:56 +1200 Subject: [PATCH 253/416] fix syntax so extlinks stop complaining --- src/sage/misc/sagedoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 644341f36bd..84306be4178 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -502,7 +502,7 @@ def process_dollars(s): # Sage trac ticket shortcuts. For example, :trac:`7549` . pythonversion = sys.version.split(' ')[0] extlinks = { - 'python': ('https://docs.python.org/release/'+pythonversion+'/%s', ''), + 'python': ('https://docs.python.org/release/'+pythonversion+'/%s', None), 'trac': ('https://trac.sagemath.org/%s', 'trac ticket #%s'), 'wikipedia': ('https://en.wikipedia.org/wiki/%s', 'Wikipedia article %s'), 'arxiv': ('https://arxiv.org/abs/%s', 'arXiv %s'), From c27e4e4c979776c7bab8c35a2f8965df07a8c75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= Date: Mon, 11 Jul 2022 22:58:36 +1200 Subject: [PATCH 254/416] migrate from filename_set to record_dependencies as suggested in https://www.sphinx-doc.org/en/master/extdev/deprecated.html --- src/sage_docbuild/ext/sage_autodoc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage_docbuild/ext/sage_autodoc.py b/src/sage_docbuild/ext/sage_autodoc.py index 9ff86106590..39a198e88a6 100644 --- a/src/sage_docbuild/ext/sage_autodoc.py +++ b/src/sage_docbuild/ext/sage_autodoc.py @@ -786,9 +786,9 @@ def generate(self, more_content=None, real_modname=None, except PycodeError: pass if fname is not None: - self.directive.filename_set.add(fname) + self.directive.record_dependencies.add(fname) else: - self.directive.filename_set.add(self.analyzer.srcname) + self.directive.record_dependencies.add(self.analyzer.srcname) # check __module__ of object (for members not given explicitly) if check_module: From 8fe7620e7af842ed610fa9b99f87ccb521c8d636 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 22 Jan 2022 19:49:27 -0800 Subject: [PATCH 255/416] build/pkgs/singular: Update to 4.3.0 --- build/pkgs/singular/checksums.ini | 8 ++++---- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index 3c8c447438c..f99493d4429 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=f257a0ef23cedb2c8f9514bbc5f292ca3660a244 -md5=8b9142f42cb73aede3940ef3c5f9586d -cksum=2019987428 -upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-2-1/singular-VERSION.tar.gz +sha1=332a9c0cd34500d791ff548ef0b0370da556bf2c +md5=7d38c3db1a7582ea633ba3ed65491444 +cksum=297542356 +upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-0/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index 370c4b6aa79..80895903a15 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.2.1p3 +4.3.0 From c36a49b947ac22cbbd1a851b6dfd52f391367afe Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Jun 2022 17:00:58 -0700 Subject: [PATCH 256/416] build/pkgs/singular: Update to 4.3.0p1 --- build/pkgs/singular/checksums.ini | 6 +++--- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index f99493d4429..2b3d55f8284 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=332a9c0cd34500d791ff548ef0b0370da556bf2c -md5=7d38c3db1a7582ea633ba3ed65491444 -cksum=297542356 +sha1=21b119800a4665fc3395ed1de66ad260d4edba47 +md5=780f3dd480d71e7c0446eec10a84fc1e +cksum=215260754 upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-0/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index 80895903a15..d118bb725f3 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.3.0 +4.3.0p1 From 4e6927423bda7911cc524b686e1a19f1159cd984 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Jun 2022 17:06:15 -0700 Subject: [PATCH 257/416] build/pkgs/singular/patches/1128.patch: Remove (upstreamed) --- build/pkgs/singular/patches/1128.patch | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 build/pkgs/singular/patches/1128.patch diff --git a/build/pkgs/singular/patches/1128.patch b/build/pkgs/singular/patches/1128.patch deleted file mode 100644 index f5ebfc69f5c..00000000000 --- a/build/pkgs/singular/patches/1128.patch +++ /dev/null @@ -1,22 +0,0 @@ -From bc7e82b6e8efcdc2a912e66194fc7ecb188de4b2 Mon Sep 17 00:00:00 2001 -From: Matthias Koeppe -Date: Mon, 31 Jan 2022 23:13:55 -0800 -Subject: [PATCH 1/2] kernel/oswrapper/vspace.cc: #include for - offsetof on GCC 12 - ---- - kernel/oswrapper/vspace.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/kernel/oswrapper/vspace.cc b/kernel/oswrapper/vspace.cc -index 2bded23c0d..66eea3f810 100644 ---- a/kernel/oswrapper/vspace.cc -+++ b/kernel/oswrapper/vspace.cc -@@ -5,6 +5,7 @@ - #ifdef HAVE_CPP_THREADS - #include - #endif -+#include - - #if defined(__GNUC__) && (__GNUC__<9) &&!defined(__clang__) - From 192efb25ab349d06e64ea4bd18988ab8f31fdca0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Jul 2022 14:01:05 -0700 Subject: [PATCH 258/416] build/pkgs/singular: Update to 4.3.1 --- build/pkgs/singular/checksums.ini | 8 ++++---- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index 2b3d55f8284..b9cbfc70d39 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=21b119800a4665fc3395ed1de66ad260d4edba47 -md5=780f3dd480d71e7c0446eec10a84fc1e -cksum=215260754 -upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-0/singular-VERSION.tar.gz +sha1=e18819861bd6f4e2d179d2111a9e9ad2c8dfaf5b +md5=b542a676e69cb0dac16bb2e7713c89a2 +cksum=2620794242 +upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index d118bb725f3..f77856a6f1a 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.3.0p1 +4.3.1 From ea08a04c3a8a77b51e7125af231fb79fe3ded21a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 11:04:45 -0700 Subject: [PATCH 259/416] src/sage/rings/polynomial/hilbert.pyx: Restrict a doctest to 64 bit --- src/sage/rings/polynomial/hilbert.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/polynomial/hilbert.pyx b/src/sage/rings/polynomial/hilbert.pyx index 4cd91d0a464..13d0cbea11c 100644 --- a/src/sage/rings/polynomial/hilbert.pyx +++ b/src/sage/rings/polynomial/hilbert.pyx @@ -576,10 +576,12 @@ def hilbert_poincare_series(I, grading=None): sage: hilbert_poincare_series(J).denominator().factor() (t - 1)^14 - This example exceeded the capabilities of Singular before version 4.2.1p2:: + This example exceeded the capabilities of Singular before version 4.2.1p2. + In Singular 4.3.1 on 32-bit, it prints overflow warnings and omits some terms. + On 64-bit:: sage: J.hilbert_numerator(algorithm='singular') - 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 + 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 # 64-bit """ cdef Polynomial_integer_dense_flint HP From 0679154f75f20d2d1929873591e27f5011c4256b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Jul 2022 18:05:31 -0700 Subject: [PATCH 260/416] build/pkgs/singular: Update to 4.3.1p1 --- build/pkgs/singular/checksums.ini | 6 +++--- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini index b9cbfc70d39..2e33a405d36 100644 --- a/build/pkgs/singular/checksums.ini +++ b/build/pkgs/singular/checksums.ini @@ -1,5 +1,5 @@ tarball=singular-VERSION.tar.gz -sha1=e18819861bd6f4e2d179d2111a9e9ad2c8dfaf5b -md5=b542a676e69cb0dac16bb2e7713c89a2 -cksum=2620794242 +sha1=6c2b622d3681e2de3d58d30c654d43d3e32b720c +md5=abb1e37c794472e7760655358ab66054 +cksum=17455733 upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index f77856a6f1a..11300c77e7d 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -4.3.1 +4.3.1p1 From 9b8e7cbcde42e2bd7067456d3c0c370531e56a56 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 5 May 2022 08:44:24 -0400 Subject: [PATCH 261/416] Trac #33134: add random (disabled) test for hilbert_numerator() algorithms. In a previous commit on Trac 33134, a test checking for incorrect hilbert_numerator() output was deleted. To replace it, this commit adds a random test that ensures both algorithms for hilbert_numerator() agree. However, the test is disabled for now, until the bug that caused the incorrect output can be fixed. --- .../rings/polynomial/multi_polynomial_ideal.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index 1b6c33563d7..7e24cd71f54 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -2902,6 +2902,20 @@ def hilbert_numerator(self, grading = None, algorithm = 'sage'): sage: I = Ideal([x^3*y^2 + 3*x^2*y^2*z + y^3*z^2 + z^5]) sage: I.hilbert_numerator() -t^5 + 1 + + Our two algorithms should always agree; not tested until + :trac:`33178` is fixed:: + + sage: m = ZZ.random_element(2,8) # not tested + sage: nvars = m^2 # not tested + sage: R = PolynomialRing(QQ, "x", nvars) # not tested + sage: M = matrix(R, m, R.gens()) # not tested + sage: I = R.ideal(M.minors(2)) # not tested + sage: n1 = I.hilbert_numerator() # not tested + sage: n2 = I.hilbert_numerator(algorithm='singular') # not tested + sage: n1 == n2 # not tested + True + """ if not self.is_homogeneous(): raise TypeError("Ideal must be homogeneous.") From 022b293dc5729a5d2a28596eabe69a61a047145a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 11 Jul 2022 15:21:06 +0200 Subject: [PATCH 262/416] get rid of Ooops messages and other details in quadratic forms --- src/sage/quadratic_forms/all.py | 8 +- src/sage/quadratic_forms/constructions.py | 23 ++- src/sage/quadratic_forms/count_local_2.pyx | 98 +++++----- src/sage/quadratic_forms/extras.py | 69 +++---- src/sage/quadratic_forms/genera/genus.py | 43 ++-- src/sage/quadratic_forms/quadratic_form.py | 184 ++++++++---------- .../quadratic_form__count_local_2.py | 11 +- .../quadratic_form__equivalence_testing.py | 75 ++++--- .../quadratic_form__evaluate.pyx | 14 +- ...uadratic_form__local_density_congruence.py | 13 +- ...uadratic_form__local_density_interfaces.py | 63 +++--- .../quadratic_form__local_field_invariants.py | 107 ++++------ .../quadratic_form__local_normal_form.py | 18 +- ...c_form__local_representation_conditions.py | 88 ++++----- .../quadratic_forms/quadratic_form__mass.py | 20 +- ...dratic_form__mass__Conway_Sloane_masses.py | 144 ++++++-------- .../quadratic_form__mass__Siegel_densities.py | 118 ++++++----- .../quadratic_form__neighbors.py | 3 - .../quadratic_form__reduction_theory.py | 86 ++++---- .../quadratic_form__siegel_product.py | 51 +++-- .../quadratic_form__split_local_covering.py | 94 +++++---- .../quadratic_form__ternary_Tornaria.py | 85 +++----- .../quadratic_forms/quadratic_form__theta.py | 108 +++++----- .../quadratic_form__variable_substitutions.py | 9 +- src/sage/quadratic_forms/special_values.py | 2 +- src/sage/quadratic_forms/ternary_qf.py | 13 +- 26 files changed, 699 insertions(+), 848 deletions(-) diff --git a/src/sage/quadratic_forms/all.py b/src/sage/quadratic_forms/all.py index bf5c6e17d57..3445705978a 100644 --- a/src/sage/quadratic_forms/all.py +++ b/src/sage/quadratic_forms/all.py @@ -4,14 +4,14 @@ from .quadratic_form import QuadraticForm, DiagonalQuadraticForm, quadratic_form_from_invariants -from .random_quadraticform import random_quadraticform, random_quadraticform_with_conditions, random_ternaryqf, random_ternaryqf_with_conditions +from .random_quadraticform import (random_quadraticform, random_quadraticform_with_conditions, + random_ternaryqf, random_ternaryqf_with_conditions) from .extras import least_quadratic_nonresidue, extend_to_primitive, is_triangular_number -from .special_values import gamma__exact, zeta__exact, QuadraticBernoulliNumber, \ - quadratic_L_function__exact, quadratic_L_function__numerical +from .special_values import (gamma__exact, zeta__exact, QuadraticBernoulliNumber, + quadratic_L_function__exact, quadratic_L_function__numerical) from .genera.genus import Genus from .constructions import BezoutianQuadraticForm, HyperbolicPlane_quadratic_form - diff --git a/src/sage/quadratic_forms/constructions.py b/src/sage/quadratic_forms/constructions.py index cf7460c1f88..933a534c49f 100644 --- a/src/sage/quadratic_forms/constructions.py +++ b/src/sage/quadratic_forms/constructions.py @@ -2,7 +2,7 @@ Some Extras """ ## -## Some extra routines to make the QuadraticForm class more useful. +# Some extra routines to make the QuadraticForm class more useful. ## from sage.rings.integer_ring import ZZ @@ -45,21 +45,21 @@ def BezoutianQuadraticForm(f, g): - Fernando Rodriguez-Villegas, Jonathan Hanke -- added on 11/9/2008 """ - ## Check that f and g are polynomials with a common base ring + # Check that f and g are polynomials with a common base ring if not is_Polynomial(f) or not is_Polynomial(g): - raise TypeError("Oops! One of your inputs is not a polynomial. =(") - if f.base_ring() != g.base_ring(): ## TO DO: Change this to allow coercion! - raise TypeError("Oops! These polynomials are not defined over the same coefficient ring.") + raise TypeError("one of your inputs is not a polynomial") + if f.base_ring() != g.base_ring(): # TO DO: Change this to allow coercion! + raise TypeError("these polynomials are not defined over the same coefficient ring") - ## Initialize the quadratic form + # Initialize the quadratic form R = f.base_ring() P = PolynomialRing(R, ['x','y']) a, b = P.gens() n = max(f.degree(), g.degree()) Q = QuadraticForm(R, n) - ## Set the coefficients of Bezoutian - bez_poly = (f(a) * g(b) - f(b) * g(a)) // (b - a) ## Truncated (exact) division here + # Set the coefficients of Bezoutian + bez_poly = (f(a) * g(b) - f(b) * g(a)) // (b - a) # Truncated (exact) division here for i in range(n): for j in range(i, n): if i == j: @@ -86,12 +86,11 @@ def HyperbolicPlane_quadratic_form(R, r=1): Quadratic form in 2 variables over Integer Ring with coefficients: [ 0 1 ] [ * 0 ] - """ r = ZZ(r) - ## Check that the multiplicity is a natural number + # Check that the multiplicity is a natural number if r < 1: - raise TypeError("The multiplicity r must be a natural number.") + raise TypeError("the multiplicity r must be a natural number") H = QuadraticForm(R, 2, [0, 1, 0]) - return sum([H for i in range(r-1)], H) + return sum([H for i in range(r - 1)], H) diff --git a/src/sage/quadratic_forms/count_local_2.pyx b/src/sage/quadratic_forms/count_local_2.pyx index 65ffad5d6d1..21c935c41f6 100644 --- a/src/sage/quadratic_forms/count_local_2.pyx +++ b/src/sage/quadratic_forms/count_local_2.pyx @@ -36,11 +36,11 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): sage: from sage.quadratic_forms.count_local_2 import count_modp__by_gauss_sum - sage: count_modp__by_gauss_sum(3, 3, 0, 1) ## for Q = x^2 + y^2 + z^2 => Gram Det = 1 (mod 3) + sage: count_modp__by_gauss_sum(3, 3, 0, 1) # for Q = x^2 + y^2 + z^2 => Gram Det = 1 (mod 3) 9 - sage: count_modp__by_gauss_sum(3, 3, 1, 1) ## for Q = x^2 + y^2 + z^2 => Gram Det = 1 (mod 3) + sage: count_modp__by_gauss_sum(3, 3, 1, 1) # for Q = x^2 + y^2 + z^2 => Gram Det = 1 (mod 3) 6 - sage: count_modp__by_gauss_sum(3, 3, 2, 1) ## for Q = x^2 + y^2 + z^2 => Gram Det = 1 (mod 3) + sage: count_modp__by_gauss_sum(3, 3, 2, 1) # for Q = x^2 + y^2 + z^2 => Gram Det = 1 (mod 3) 12 sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) @@ -48,11 +48,11 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): [True, True, True] - sage: count_modp__by_gauss_sum(3, 3, 0, 2) ## for Q = x^2 + y^2 + 2*z^2 => Gram Det = 2 (mod 3) + sage: count_modp__by_gauss_sum(3, 3, 0, 2) # for Q = x^2 + y^2 + 2*z^2 => Gram Det = 2 (mod 3) 9 - sage: count_modp__by_gauss_sum(3, 3, 1, 2) ## for Q = x^2 + y^2 + 2*z^2 => Gram Det = 2 (mod 3) + sage: count_modp__by_gauss_sum(3, 3, 1, 2) # for Q = x^2 + y^2 + 2*z^2 => Gram Det = 2 (mod 3) 12 - sage: count_modp__by_gauss_sum(3, 3, 2, 2) ## for Q = x^2 + y^2 + 2*z^2 => Gram Det = 2 (mod 3) + sage: count_modp__by_gauss_sum(3, 3, 2, 2) # for Q = x^2 + y^2 + 2*z^2 => Gram Det = 2 (mod 3) 6 sage: Q = DiagonalQuadraticForm(ZZ, [1,1,2]) @@ -61,19 +61,19 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): """ - ## Check that Qdet is non-degenerate + # Check that Qdet is non-degenerate if Qdet % p == 0: raise RuntimeError("Qdet must be non-zero.") - ## Check that p is prime > 2 + # Check that p is prime > 2 if not is_prime(p) or p == 2: raise RuntimeError("p must be a prime number > 2.") - ## Check that n >= 1 + # Check that n >= 1 if n < 1: raise RuntimeError("the dimension n must be >= 1.") - ## Compute the Gauss sum + # Compute the Gauss sum neg1 = -1 if not (m % p): if n % 2: @@ -86,7 +86,7 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): else: count = (p**(n-1)) - (p**((n-2)/2)) * kronecker_symbol(((neg1**(n/2)) * Qdet) % p, p) - ## Return the result + # Return the result return count @@ -100,56 +100,56 @@ cdef CountAllLocalTypesNaive_cdef(Q, p, k, m, zvec, nzvec): QuadraticForm.count_congruence_solutions_by_type(). """ cdef long n, i - cdef long a, b ## Used to quickly evaluate Q(v) - cdef long ptr ## Used to increment the vector - cdef long solntype ## Used to store the kind of solution we find + cdef long a, b # Used to quickly evaluate Q(v) + cdef long ptr # Used to increment the vector + cdef long solntype # Used to store the kind of solution we find - ## Some shortcuts and definitions + # Some shortcuts and definitions n = Q.dim() R = p ** k Q1 = Q.base_change_to(IntegerModRing(R)) - ## Cython Variables + # Cython Variables cdef IntegerMod_gmp zero, one zero = IntegerMod_gmp(IntegerModRing(R), 0) one = IntegerMod_gmp(IntegerModRing(R), 1) - ## Initialize the counting vector + # Initialize the counting vector count_vector = [0 for i in range(6)] - ## Initialize v = (0, ... , 0) + # Initialize v = (0, ... , 0) v = [Mod(0, R) for i in range(n)] - ## Some declarations to speed up the loop + # Some declarations to speed up the loop R_n = R ** n m1 = Mod(m, R) - ## Count the local solutions + # Count the local solutions for i from 0 <= i < R_n: - ## Perform a carry (when value = R-1) until we can increment freely + # Perform a carry (when value = R-1) until we can increment freely ptr = len(v) while ((ptr > 0) and (v[ptr-1] == R-1)): v[ptr-1] += 1 ptr += -1 - ## Only increment if we're not already at the zero vector =) + # Only increment if we're not already at the zero vector =) if (ptr > 0): v[ptr-1] += 1 - ## Evaluate Q(v) quickly + # Evaluate Q(v) quickly tmp_val = Mod(0, R) for a from 0 <= a < n: for b from a <= b < n: tmp_val += Q1[a,b] * v[a] * v[b] - ## Sort the solution by it's type + # Sort the solution by it's type #if (Q1(v) == m1): if (tmp_val == m1): solntype = local_solution_type_cdef(Q1, p, v, zvec, nzvec) @@ -157,11 +157,11 @@ cdef CountAllLocalTypesNaive_cdef(Q, p, k, m, zvec, nzvec): count_vector[solntype] += 1 - ## Generate the Bad-type and Total counts + # Generate the Bad-type and Total counts count_vector[3] = count_vector[4] + count_vector[5] count_vector[0] = count_vector[1] + count_vector[2] + count_vector[3] - ## Return the solution counts + # Return the solution counts return count_vector @@ -220,50 +220,50 @@ cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): n = Q.dim() - ## Check if the solution satisfies the zvec "zero" congruence conditions - ## (either zvec is empty or its components index the zero vector mod p) + # Check if the solution satisfies the zvec "zero" congruence conditions + # (either zvec is empty or its components index the zero vector mod p) if (zvec is None) or (not zvec): zero_flag = True else: zero_flag = False i = 0 - while ( (i < len(zvec)) and ((w[zvec[i]] % p) == 0) ): ## Increment so long as our entry is zero (mod p) + while ( (i < len(zvec)) and ((w[zvec[i]] % p) == 0) ): # Increment so long as our entry is zero (mod p) i += 1 - if (i == len(zvec)): ## If we make it through all entries then the solution is zero (mod p) + if (i == len(zvec)): # If we make it through all entries then the solution is zero (mod p) zero_flag = True - ## DIAGNOSTIC + # DIAGNOSTIC #print("IsLocalSolutionType: Finished the Zero congruence condition test \n") if not zero_flag: return 0 - ## DIAGNOSTIC + # DIAGNOSTIC #print("IsLocalSolutionType: Passed the Zero congruence condition test \n") - ## Check if the solution satisfies the nzvec "nonzero" congruence conditions - ## (nzvec is non-empty and its components index a non-zero vector mod p) + # Check if the solution satisfies the nzvec "nonzero" congruence conditions + # (nzvec is non-empty and its components index a non-zero vector mod p) if (nzvec is None): nonzero_flag = True elif (len(nzvec) == 0): - nonzero_flag = False ## Trivially no solutions in this case! + nonzero_flag = False # Trivially no solutions in this case! else: nonzero_flag = False i = 0 while ((not nonzero_flag) and (i < len(nzvec))): if ((w[nzvec[i]] % p) != 0): - nonzero_flag = True ## The non-zero condition is satisfied when we find one non-zero entry + nonzero_flag = True # The non-zero condition is satisfied when we find one non-zero entry i += 1 if not nonzero_flag: return 0 - ## Check if the solution has the appropriate (local) type: - ## ------------------------------------------------------- + # Check if the solution has the appropriate (local) type: + # ------------------------------------------------------- - ## 1: Check Good-type + # 1: Check Good-type for i from 0 <= i < n: if (((w[i] % p) != 0) and ((Q[i,i] % p) != 0)): return 1 @@ -273,7 +273,7 @@ cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): return 1 - ## 2: Check Zero-type + # 2: Check Zero-type Zero_flag = True for i from 0 <= i < n: if ((w[i] % p) != 0): @@ -282,34 +282,34 @@ cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): return 2 - ## Check if wS1 is zero or not + # Check if wS1 is zero or not wS1_nonzero_flag = False for i from 0 <= i < n: - ## Compute the valuation of each index, allowing for off-diagonal terms + # Compute the valuation of each index, allowing for off-diagonal terms if (Q[i,i] == 0): if (i == 0): - val = valuation(Q[i,i+1], p) ## Look at the term to the right + val = valuation(Q[i,i+1], p) # Look at the term to the right elif (i == n - 1): - val = valuation(Q[i-1,i], p) ## Look at the term above + val = valuation(Q[i-1,i], p) # Look at the term above else: - val = valuation(Q[i,i+1] + Q[i-1,i], p) ## Finds the valuation of the off-diagonal term since only one isn't zero + val = valuation(Q[i,i+1] + Q[i-1,i], p) # Finds the valuation of the off-diagonal term since only one isn't zero else: val = valuation(Q[i,i], p) - ## Test each index + # Test each index if ((val == 1) and ((w[i] % p) != 0)): wS1_nonzero_flag = True - ## 4: Check Bad-type I + # 4: Check Bad-type I if (wS1_nonzero_flag is True): return 4 - ## 5: Check Bad-type II + # 5: Check Bad-type II if (wS1_nonzero_flag is False): return 5 - ## Error if we get here! =o + # Error if we get here! =o print(" Solution vector is " + str(w)) print(" and Q is \n" + str(Q) + "\n") raise RuntimeError("Error in IsLocalSolutionType: Should not execute this line... =( \n") diff --git a/src/sage/quadratic_forms/extras.py b/src/sage/quadratic_forms/extras.py index ede37f6d77d..04223d76e4f 100644 --- a/src/sage/quadratic_forms/extras.py +++ b/src/sage/quadratic_forms/extras.py @@ -5,6 +5,7 @@ from sage.arith.all import legendre_symbol from sage.rings.integer_ring import ZZ + def is_triangular_number(n, return_value=False): """ Return whether ``n`` is a triangular number. @@ -31,8 +32,6 @@ def is_triangular_number(n, return_value=False): True sage: is_triangular_number(3, return_value=True) (True, 2) - sage: 2*(2+1)/2 - 3 sage: is_triangular_number(2) False @@ -62,16 +61,16 @@ def is_triangular_number(n, return_value=False): if return_value: if n < 0: - return (False,None) + return (False, None) if n == 0: - return (True,ZZ(0)) - s,r = (8*n+1).sqrtrem() + return (True, ZZ.zero()) + s, r = (8 * n + 1).sqrtrem() if r: - return (False,None) - return (True,(s-1)/2) + return (False, None) + return (True, (s - 1) // 2) + + return (8 * n + 1).is_square() - else: - return (8*n+1).is_square() def extend_to_primitive(A_input): """ @@ -102,22 +101,21 @@ def extend_to_primitive(A_input): [(1, 2, 3), (0, 1, 1), (-1, 0, 0)] """ - ## Deal with a list of vectors + # Deal with a list of vectors if not is_Matrix(A_input): - A = matrix(A_input) ## Make a matrix A with the given rows. + A = matrix(A_input) # Make a matrix A with the given rows. vec_output_flag = True else: A = A_input vec_output_flag = False - - ## Arrange for A to have more columns than rows. + # Arrange for A to have more columns than rows. if A.is_square(): return A if A.nrows() > A.ncols(): return extend_to_primitive(A.transpose()).transpose() - ## Setup + # Setup k = A.nrows() n = A.ncols() R = A.base_ring() @@ -125,7 +123,7 @@ def extend_to_primitive(A_input): # Smith normal form transformation, assuming more columns than rows V = A.smith_form()[2] - ## Extend the matrix in new coordinates, then switch back. + # 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): @@ -143,9 +141,10 @@ def extend_to_primitive(A_input): else: return D + def least_quadratic_nonresidue(p): """ - Returns the smallest positive integer quadratic non-residue in Z/pZ for primes p>2. + Return the smallest positive integer quadratic non-residue in Z/pZ for primes p>2. EXAMPLES:: @@ -156,47 +155,41 @@ def least_quadratic_nonresidue(p): TESTS: - Raises an error if input is a positive composite integer. - - :: + This raises an error if input is a positive composite integer. :: sage: least_quadratic_nonresidue(20) Traceback (most recent call last): ... - ValueError: Oops! p must be a prime number > 2. - + ValueError: p must be a prime number > 2 - Raises an error if input is 2. This is because every integer is a - quadratic residue modulo 2. - - :: + This raises an error if input is 2. This is because every integer is a + quadratic residue modulo 2. :: sage: least_quadratic_nonresidue(2) Traceback (most recent call last): ... - ValueError: Oops! There are no quadratic non-residues in Z/2Z. + ValueError: there are no quadratic non-residues in Z/2Z """ p1 = abs(p) - ## Deal with the prime p = 2 and |p| <= 1. + # Deal with the prime p = 2 and |p| <= 1. if p1 == 2: - raise ValueError("Oops! There are no quadratic non-residues in Z/2Z.") + raise ValueError("there are no quadratic non-residues in Z/2Z") if p1 < 2: - raise ValueError("Oops! p must be a prime number > 2.") + raise ValueError("p must be a prime number > 2") - ## Find the smallest non-residue mod p - ## For 7/8 of primes the answer is 2, 3 or 5: - if p%8 in (3,5): + # Find the smallest non-residue mod p + # For 7/8 of primes the answer is 2, 3 or 5: + if p % 8 in (3, 5): return ZZ(2) - if p%12 in (5,7): + if p % 12 in (5, 7): return ZZ(3) - if p%5 in (2,3): + if p % 5 in (2, 3): return ZZ(5) - ## default case (first needed for p=71): + # default case (first needed for p=71): if not p.is_prime(): - raise ValueError("Oops! p must be a prime number > 2.") + raise ValueError("p must be a prime number > 2") from sage.arith.srange import xsrange - for r in xsrange(7,p): + for r in xsrange(7, p): if legendre_symbol(r, p) == -1: return ZZ(r) - diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index a3e6fd7c9e5..4abc8e9cb1f 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -491,7 +491,7 @@ def is_2_adic_genus(genus_symbol_quintuple_list): sage: A = Matrix(ZZ, 2, 2, [1,1,1,2]) sage: G3 = LocalGenusSymbol(A, 3) - sage: is_2_adic_genus(G3.symbol_tuple_list()) ## This raises an error + sage: is_2_adic_genus(G3.symbol_tuple_list()) # This raises an error Traceback (most recent call last): ... TypeError: The genus symbols are not quintuples, so it's not a genus symbol for the prime p=2. @@ -501,15 +501,15 @@ def is_2_adic_genus(genus_symbol_quintuple_list): sage: is_2_adic_genus(G2.symbol_tuple_list()) True """ - ## TO DO: Add explicit checking for the prime p here to ensure it's p=2... not just the quintuple checking below + # TO DO: Add explicit checking for the prime p here to ensure it's p=2... not just the quintuple checking below for s in genus_symbol_quintuple_list: - ## Check that we have a quintuple (i.e. that p=2 and not p >2) + # Check that we have a quintuple (i.e. that p=2 and not p >2) if len(s) != 5: raise TypeError("The genus symbols are not quintuples, so it's not a genus symbol for the prime p=2.") - ## Check the Conway-Sloane conditions + # Check the Conway-Sloane conditions if s[1] == 1: if s[3] == 0 or s[2] != s[4]: return False @@ -571,7 +571,7 @@ def canonical_2_adic_compartments(genus_symbol_quintuple_list): sage: A = Matrix(ZZ, 2, 2, [2,1,1,2]) sage: G2 = LocalGenusSymbol(A, 2); G2.symbol_tuple_list() [[0, 2, 3, 0, 0]] - sage: canonical_2_adic_compartments(G2.symbol_tuple_list()) ## No compartments here! + sage: canonical_2_adic_compartments(G2.symbol_tuple_list()) # No compartments here! [] .. NOTE:: @@ -733,13 +733,13 @@ def canonical_2_adic_reduction(genus_symbol_quintuple_list): sage: A = Matrix(ZZ, 2, 2, [1, 0, 0, 2]) sage: G2 = LocalGenusSymbol(A, 2); G2.symbol_tuple_list() [[0, 1, 1, 1, 1], [1, 1, 1, 1, 1]] - sage: canonical_2_adic_reduction(G2.symbol_tuple_list()) ## Oddity fusion occurred here! + sage: canonical_2_adic_reduction(G2.symbol_tuple_list()) # Oddity fusion occurred here! [[0, 1, 1, 1, 2], [1, 1, 1, 1, 0]] sage: A = DiagonalQuadraticForm(ZZ, [1, 2, 3, 4]).Hessian_matrix() sage: G2 = LocalGenusSymbol(A, 2); G2.symbol_tuple_list() [[1, 2, 3, 1, 4], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1]] - sage: canonical_2_adic_reduction(G2.symbol_tuple_list()) ## Oddity fusion occurred here! + sage: canonical_2_adic_reduction(G2.symbol_tuple_list()) # Oddity fusion occurred here! [[1, 2, -1, 1, 6], [2, 1, 1, 1, 0], [3, 1, 1, 1, 0]] sage: A = Matrix(ZZ, 2, 2, [2, 1, 1, 2]) @@ -1024,13 +1024,13 @@ def split_odd(A): sage: A = Matrix(ZZ, 2, 2, [1, 1, 1, 1]) sage: is_even_matrix(A) (False, 0) - sage: split_odd(A) ## This fails because no such splitting exists. =( + sage: split_odd(A) # This fails because no such splitting exists. =( Traceback (most recent call last): ... RuntimeError: The matrix A does not admit a non-even splitting. sage: A = Matrix(ZZ, 2, 2, [1, 2, 2, 6]) - sage: split_odd(A) ## This fails because no such splitting exists. =( + sage: split_odd(A) # This fails because no such splitting exists. =( Traceback (most recent call last): ... RuntimeError: The matrix A does not admit a non-even splitting. @@ -1168,24 +1168,24 @@ def two_adic_symbol(A, val): K_2 = A_2.kernel() R_8 = ZZ.quotient_ring(Integer(8)) - ## Deal with the matrix being non-degenerate mod 2. + # Deal with the matrix being non-degenerate mod 2. if K_2.dimension() == 0: A_8 = MatrixSpace(R_8, n)(A) n0 = A.nrows() # d0 = ZZ(A_8.determinant()) # no determinant over Z/8Z d0 = ZZ(R_8(MatrixSpace(ZZ, n)(A_8).determinant())) - if d0 == 0: ## SANITY CHECK: The mod 8 determinant shouldn't be zero. + if d0 == 0: # SANITY CHECK: The mod 8 determinant shouldn't be zero. print("A:") print(A) assert False - even, i = is_even_matrix(A_2) ## Determine whether the matrix is even or odd. + even, i = is_even_matrix(A_2) # Determine whether the matrix is even or odd. if even: return [[m0, n0, d0, 0, 0]] else: - tr8 = trace_diag_mod_8(A_8) ## Here we already know that A_8 is odd and diagonalizable mod 8. + tr8 = trace_diag_mod_8(A_8) # Here we already know that A_8 is odd and diagonalizable mod 8. return [[m0, n0, d0, 1, tr8]] - ## Deal with the matrix being degenerate mod 2. + # Deal with the matrix being degenerate mod 2. else: B_2 = K_2.echelonized_basis_matrix() C_2 = basis_complement(B_2) @@ -1524,13 +1524,13 @@ def __ne__(self, other): return not self == other - ## Added these two methods to make this class iterable... + # Added these two methods to make this class iterable... #def __getitem__(self, i): # return self._symbol[i] # #def len(self): # return len(self._symbol) - ## ------------------------------------------------------ + # ------------------------------------------------------ def automorphous_numbers(self): r""" @@ -1723,14 +1723,14 @@ def canonical_symbol(self): sage: p = 2 sage: G2 = Genus_Symbol_p_adic_ring(p, p_adic_symbol(A, p, 2)); G2.symbol_tuple_list() [[0, 1, 1, 1, 1], [1, 1, 1, 1, 1]] - sage: G2.canonical_symbol() ## Oddity fusion occurred here! + sage: G2.canonical_symbol() # Oddity fusion occurred here! [[0, 1, 1, 1, 2], [1, 1, 1, 1, 0]] sage: A = DiagonalQuadraticForm(ZZ, [1,2,3,4]).Hessian_matrix() sage: p = 2 sage: G2 = Genus_Symbol_p_adic_ring(p, p_adic_symbol(A, p, 2)); G2.symbol_tuple_list() [[1, 2, 3, 1, 4], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1]] - sage: G2.canonical_symbol() ## Oddity fusion occurred here! + sage: G2.canonical_symbol() # Oddity fusion occurred here! [[1, 2, -1, 1, 6], [2, 1, 1, 1, 0], [3, 1, 1, 1, 0]] sage: A = Matrix(ZZ, 2, 2, [2, 1, 1, 2]) @@ -1798,7 +1798,7 @@ def gram_matrix(self, check=True): # check calculation if check: symG = p_adic_symbol(G, p, symbol[-1][0]) - assert Genus_Symbol_p_adic_ring(p, symG) == self, "oops" + assert Genus_Symbol_p_adic_ring(p, symG) == self return G def mass(self): @@ -2333,7 +2333,7 @@ def trains(self): [[0, 1, 2]] """ - ## Check that p = 2 + # Check that p = 2 if self._prime != 2: raise TypeError("trains() only makes sense when the prime of the p_adic_Genus_Symbol is p=2") symbol = self._symbol @@ -2363,12 +2363,13 @@ def compartments(self): [[0, 1, 2]] """ - ## Check that p = 2 + # Check that p = 2 if self._prime != 2: raise TypeError("compartments() only makes sense when the prime of the p_adic_Genus_Symbol is p=2") symbol = self._symbol return canonical_2_adic_compartments(symbol) + class GenusSymbol_global_ring(): r""" This represents a collection of local genus symbols (at primes) diff --git a/src/sage/quadratic_forms/quadratic_form.py b/src/sage/quadratic_forms/quadratic_form.py index 8a8a457cc99..f5ac84bf401 100644 --- a/src/sage/quadratic_forms/quadratic_form.py +++ b/src/sage/quadratic_forms/quadratic_form.py @@ -299,17 +299,17 @@ class QuadraticForm(SageObject): [ * 4 ] """ - ## Import specialized methods: - ## --------------------------- + # Import specialized methods: + # --------------------------- - ## Routines to compute the p-adic local normal form + # Routines to compute the p-adic local normal form from sage.quadratic_forms.quadratic_form__local_normal_form import \ find_entry_with_minimal_scale_at_prime, \ local_normal_form, \ jordan_blocks_by_scale_and_unimodular, \ jordan_blocks_in_unimodular_list_by_scale_power - ## Routines to perform elementary variable substitutions + # Routines to perform elementary variable substitutions from sage.quadratic_forms.quadratic_form__variable_substitutions import \ swap_variables, \ multiply_variable, \ @@ -319,7 +319,7 @@ class QuadraticForm(SageObject): elementary_substitution, \ add_symmetric - ## Routines to compute p-adic field invariants + # Routines to compute p-adic field invariants from sage.quadratic_forms.quadratic_form__local_field_invariants import \ rational_diagonal_form, \ _rational_diagonal_form_and_transformation, \ @@ -338,7 +338,7 @@ class QuadraticForm(SageObject): is_indefinite, \ is_definite - ## Routines to compute local densities by the reduction procedure + # Routines to compute local densities by the reduction procedure from sage.quadratic_forms.quadratic_form__local_density_congruence import \ count_modp_solutions__by_Gauss_sum, \ local_good_density_congruence_odd, \ @@ -351,7 +351,7 @@ class QuadraticForm(SageObject): local_density_congruence, \ local_primitive_density_congruence - ## Routines to compute local densities by counting solutions of various types + # Routines to compute local densities by counting solutions of various types from sage.quadratic_forms.quadratic_form__count_local_2 import \ count_congruence_solutions_as_vector, \ count_congruence_solutions, \ @@ -361,12 +361,12 @@ class QuadraticForm(SageObject): count_congruence_solutions__bad_type_I, \ count_congruence_solutions__bad_type_II - ## Routines to be called by the user to compute local densities + # Routines to be called by the user to compute local densities from sage.quadratic_forms.quadratic_form__local_density_interfaces import \ local_density, \ local_primitive_density - ## Routines for computing with ternary forms + # Routines for computing with ternary forms from sage.quadratic_forms.quadratic_form__ternary_Tornaria import \ disc, \ content, \ @@ -392,18 +392,18 @@ class QuadraticForm(SageObject): is_zero_nonsingular, \ is_zero_singular - ## Routines to compute the theta function + # Routines to compute the theta function from sage.quadratic_forms.quadratic_form__theta import \ theta_series, \ theta_series_degree_2, \ theta_by_pari, \ theta_by_cholesky - ## Routines to compute the product of all local densities + # Routines to compute the product of all local densities from sage.quadratic_forms.quadratic_form__siegel_product import \ siegel_product - ## Routines to compute p-neighbors + # Routines to compute p-neighbors from sage.quadratic_forms.quadratic_form__neighbors import \ find_primitive_p_divisible_vector__random, \ find_primitive_p_divisible_vector__next, \ @@ -411,21 +411,21 @@ class QuadraticForm(SageObject): neighbor_iteration, \ orbits_lines_mod_p - ## Routines to reduce a given quadratic form + # Routines to reduce a given quadratic form from sage.quadratic_forms.quadratic_form__reduction_theory import \ reduced_binary_form1, \ reduced_ternary_form__Dickson, \ reduced_binary_form, \ minkowski_reduction, \ minkowski_reduction_for_4vars__SP - ## Wrappers for Conway-Sloane genus routines (in ./genera/) + # Wrappers for Conway-Sloane genus routines (in ./genera/) from sage.quadratic_forms.quadratic_form__genus import \ global_genus_symbol, \ local_genus_symbol, \ CS_genus_symbol_list - ## Routines to compute local masses for ZZ. + # Routines to compute local masses for ZZ. from sage.quadratic_forms.quadratic_form__mass import \ shimura_mass__maximal, \ GHY_mass__maximal @@ -452,7 +452,7 @@ class QuadraticForm(SageObject): # conway_generic_mass, \ # conway_p_mass_adjustment - ## Routines to check local representability of numbers + # Routines to check local representability of numbers from sage.quadratic_forms.quadratic_form__local_representation_conditions import \ local_representation_conditions, \ is_locally_universal_at_prime, \ @@ -461,14 +461,14 @@ class QuadraticForm(SageObject): is_locally_represented_number_at_place, \ is_locally_represented_number - ## Routines to make a split local covering of the given quadratic form. + # Routines to make a split local covering of the given quadratic form. from sage.quadratic_forms.quadratic_form__split_local_covering import \ cholesky_decomposition, \ vectors_by_length, \ complementary_subform_to_vector, \ split_local_cover - ## Routines to make automorphisms of the given quadratic form. + # Routines to make automorphisms of the given quadratic form. from sage.quadratic_forms.quadratic_form__automorphisms import \ basis_of_short_vectors, \ short_vector_list_up_to_length, \ @@ -479,14 +479,14 @@ class QuadraticForm(SageObject): number_of_automorphisms, \ set_number_of_automorphisms - ## Routines to test the local and global equivalence/isometry of two quadratic forms. + # Routines to test the local and global equivalence/isometry of two quadratic forms. from sage.quadratic_forms.quadratic_form__equivalence_testing import \ is_globally_equivalent_to, \ is_locally_equivalent_to, \ has_equivalent_Jordan_decomposition_at_prime, \ is_rationally_isometric - ## Routines for solving equations of the form Q(x) = c. + # Routines for solving equations of the form Q(x) = c. from sage.quadratic_forms.qfsolve import solve @@ -520,7 +520,7 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ if is_Matrix(n): # Test if n is symmetric and has even diagonal if not self._is_even_symmetric_matrix_(n, R): - raise TypeError("Oops! The matrix is not a symmetric with even diagonal defined over R.") + raise TypeError("the matrix is not a symmetric with even diagonal defined over R") # Rename the matrix and ring M = n @@ -534,14 +534,14 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ # Deal with: QuadraticForm(matrix) # Test if R is symmetric and has even diagonal if not self._is_even_symmetric_matrix_(R): - raise TypeError("Oops! The matrix is not a symmetric with even diagonal.") + raise TypeError("the matrix is not a symmetric with even diagonal") # Rename the matrix and ring M = R M_ring = R.base_ring() matrix_init_flag = True - ## Perform the quadratic form initialization + # Perform the quadratic form initialization if matrix_init_flag: self.__n = ZZ(M.nrows()) self.__base_ring = M_ring @@ -555,9 +555,9 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ return - ## ----------------------------------------------------------- + # ----------------------------------------------------------- - ## Verify the size of the matrix is an integer >= 0 + # Verify the size of the matrix is an integer >= 0 n = ZZ(n) if n < 0: raise ValueError("the size must be a non-negative integer, not {}".format(n)) @@ -580,21 +580,21 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ for i in range(N): self.__coeffs[i] = self.__base_ring(entries[i]) else: - raise TypeError("Oops! The entries " + str(entries) + " must be a list of size n(n+1)/2.") + raise TypeError(f"the entries {entries} must be a list of size n(n+1)/2") - ## ----------------------------------------------------------- + # ----------------------------------------------------------- - ## Process possible forced initialization of various fields + # Process possible forced initialization of various fields self._external_initialization_list = [] if unsafe_initialization: - ## Set the number of automorphisms + # Set the number of automorphisms if number_of_automorphisms is not None: self.set_number_of_automorphisms(number_of_automorphisms) #self.__number_of_automorphisms = number_of_automorphisms #self.__external_initialization_list.append('number_of_automorphisms') - ## Set the determinant + # Set the determinant if determinant is not None: self.__det = determinant self._external_initialization_list.append('determinant') @@ -722,12 +722,12 @@ def __getitem__(self, ij): [3 5 6] """ - ## Unpack the list of indices + # Unpack the list of indices i, j = ij i = int(i) j = int(j) - ## Ensure we're using upper-triangular coordinates + # Ensure we're using upper-triangular coordinates if i > j: tmp = i i = j @@ -755,24 +755,24 @@ def __setitem__(self, ij, coeff): [ * * 6 ] """ - ## Unpack the list of indices + # Unpack the list of indices i, j = ij i = int(i) j = int(j) - ## TO DO: Verify that 0 <= i, j <= (n-1) + # TO DO: Verify that 0 <= i, j <= (n-1) - ## Ensure we're using upper-triangular coordinates + # Ensure we're using upper-triangular coordinates if i > j: tmp = i i = j j = tmp - ## Set the entry + # Set the entry try: self.__coeffs[i*self.__n - i*(i-1)//2 + j -i] = self.__base_ring(coeff) except Exception: - raise RuntimeError("Oops! This coefficient can't be coerced to an element of the base ring for the quadratic form.") + raise RuntimeError("this coefficient cannot be coerced to an element of the base ring for the quadratic form") def __hash__(self): r""" @@ -835,9 +835,9 @@ def __add__(self, right): [ * * * -10 ] """ if not isinstance(right, QuadraticForm): - raise TypeError("Oops! Can't add these objects since they're not both quadratic forms. =(") + raise TypeError("cannot add these objects since they are not both quadratic forms") elif (self.base_ring() != right.base_ring()): - raise TypeError("Oops! Can't add these since the quadratic forms don't have the same base rings... =(") + raise TypeError("cannot add these since the quadratic forms do not have the same base rings") Q = QuadraticForm(self.base_ring(), self.dim() + right.dim()) n = self.dim() @@ -878,11 +878,11 @@ def sum_by_coefficients_with(self, right): [ * 0 ] """ if not isinstance(right, QuadraticForm): - raise TypeError("Oops! Can't add these objects since they're not both quadratic forms. =(") + raise TypeError("cannot add these objects since they are not both quadratic forms") elif (self.__n != right.__n): - raise TypeError("Oops! Can't add these since the quadratic forms don't have the same sizes... =(") + raise TypeError("cannot add these since the quadratic forms do not have the same sizes") elif (self.__base_ring != right.__base_ring): - raise TypeError("Oops! Can't add these since the quadratic forms don't have the same base rings... =(") + raise TypeError("cannot add these since the quadratic forms do not have the same base rings") return QuadraticForm(self.__base_ring, self.__n, [self.__coeffs[i] + right.__coeffs[i] for i in range(len(self.__coeffs))]) @@ -992,33 +992,33 @@ def __call__(self, v): [ 14 ] """ - ## If we are passed a matrix A, return the quadratic form Q(A(x)) - ## (In matrix notation: A^t * Q * A) + # If we are passed a matrix A, return the quadratic form Q(A(x)) + # (In matrix notation: A^t * Q * A) n = self.dim() if is_Matrix(v): - ## Check that v has the correct number of rows + # Check that v has the correct number of rows if v.nrows() != n: raise TypeError("the matrix must have {} rows".format(n)) - ## Create the new quadratic form + # Create the new quadratic form m = v.ncols() Q2 = QuadraticForm(self.base_ring(), m) return QFEvaluateMatrix(self, v, Q2) elif (is_Vector(v) or isinstance(v, (list, tuple))): - ## Check the vector/tuple/list has the correct length + # Check the vector/tuple/list has the correct length if not (len(v) == n): raise TypeError("your vector needs to have length {}".format(n)) - ## TO DO: Check that the elements can be coerced into the base ring of Q -- on first elt. + # TO DO: Check that the elements can be coerced into the base ring of Q -- on first elt. if len(v) > 0: try: self.base_ring()(v[0]) except Exception: raise TypeError("your vector is not coercible to the base ring of the quadratic form") - ## Attempt to evaluate Q[v] + # Attempt to evaluate Q[v] return QFEvaluateVector(self, v) else: @@ -1056,7 +1056,7 @@ def _is_even_symmetric_matrix_(self, A, R=None): raise TypeError("A is not a matrix.") ring_coerce_test = True - if R is None: ## This allows us to omit the ring from the variables, and take it from the matrix + if R is None: # This allows us to omit the ring from the variables, and take it from the matrix R = A.base_ring() ring_coerce_test = False @@ -1066,14 +1066,14 @@ def _is_even_symmetric_matrix_(self, A, R=None): if not A.is_square(): return False - ## Test that the matrix is symmetric + # Test that the matrix is symmetric n = A.nrows() for i in range(n): for j in range(i+1, n): if A[i,j] != A[j,i]: return False - ## Test that all entries coerce to R + # Test that all entries coerce to R if not ((A.base_ring() == R) or ring_coerce_test): try: for i in range(n): @@ -1082,7 +1082,7 @@ def _is_even_symmetric_matrix_(self, A, R=None): except Exception: return False - ## Test that the diagonal is even (if 1/2 isn't in R) + # Test that the diagonal is even (if 1/2 isn't in R) if not R(2).is_unit(): for i in range(n): if not is_even(R(A[i,i])): @@ -1183,22 +1183,20 @@ def Gram_matrix(self): [0 0 0 7] sage: A.base_ring() Integer Ring - """ A = (ZZ(1) / ZZ(2)) * self.matrix() n = self.dim() - ## Test to see if it has an integral Gram matrix + # Test to see if it has an integral Gram matrix Int_flag = True for i in range(n): - for j in range(i,n): - Int_flag = Int_flag and A[i,j] in self.base_ring() + for j in range(i, n): + Int_flag &= A[i, j] in self.base_ring() - ## Return the Gram matrix, or an error + # Return the Gram matrix, or an error if Int_flag: return MatrixSpace(self.base_ring(), n, n)(A) - else: - raise TypeError("Oops! This form does not have an integral Gram matrix. =(") + raise TypeError("this form does not have an integral Gram matrix") def has_integral_Gram_matrix(self): """ @@ -1243,18 +1241,14 @@ def gcd(self): sage: Q.gcd() 1 - :: - sage: Q = QuadraticForm(ZZ, 4, range(0, 20, 2)) sage: Q.gcd() 2 """ if self.base_ring() != ZZ: - raise TypeError("Oops! The given quadratic form must be defined over ZZ.") - + raise TypeError("the given quadratic form must be defined over ZZ") return GCD(self.coefficients()) - def polynomial(self,names='x'): r""" Return the polynomial in 'n' variables of the quadratic form in the ring 'R[names].' @@ -1343,13 +1337,12 @@ def primitive(self): Quadratic form in 2 variables over Integer Ring with coefficients: [ 1 2 ] [ * 4 ] - """ if self.base_ring() != ZZ: - raise TypeError("Oops! The given quadratic form must be defined over ZZ.") - + raise TypeError("the given quadratic form must be defined over ZZ") g = self.gcd() - return QuadraticForm(self.base_ring(), self.dim(), [ZZ(x/g) for x in self.coefficients()]) + return QuadraticForm(ZZ, self.dim(), + [x // g for x in self.coefficients()]) def adjoint_primitive(self): """ @@ -1435,13 +1428,13 @@ def det(self): try: return self.__det except AttributeError: - ## Compute the determinant + # Compute the determinant if self.dim() == 0: new_det = self.base_ring()(1) else: new_det = self.matrix().det() - ## Cache and return the determinant + # Cache and return the determinant self.__det = new_det return new_det @@ -1500,16 +1493,14 @@ def base_change_to(self, R): 1 """ - ## Check that a canonical coercion is possible + # Check that a canonical coercion is possible if not is_Ring(R): - raise TypeError("Oops! R is not a ring. =(") + raise TypeError("R is not a ring") if not R.has_coerce_map_from(self.base_ring()): - raise TypeError("Oops! There is no canonical coercion from " + str(self.base_ring()) + " to R.") - - ## Return the coerced form + raise TypeError(f"there is no canonical coercion from {self.base_ring()} to R") + # Return the coerced form return QuadraticForm(R, self.dim(), [R(x) for x in self.coefficients()]) - def level(self): r""" Determines the level of the quadratic form over a PID, which is a @@ -1536,29 +1527,28 @@ def level(self): 420 """ - ## Try to return the cached level + # Try to return the cached level try: return self.__level except AttributeError: - ## Check that the base ring is a PID + # Check that the base ring is a PID if not isinstance(self.base_ring(), PrincipalIdealDomain): - raise TypeError("Oops! The level (as a number) is only defined over a Principal Ideal Domain. Try using level_ideal().") - + raise TypeError("the level (as a number) is only defined over a Principal Ideal Domain ; try using level_ideal()") - ## Warn the user if the form is defined over a field! + # Warn the user if the form is defined over a field! if self.base_ring().is_field(): warn("Warning -- The level of a quadratic form over a field is always 1. Do you really want to do this?!?") #raise RuntimeError, "Warning -- The level of a quadratic form over a field is always 1. Do you really want to do this?!?" - ## Check invertibility and find the inverse + # Check invertibility and find the inverse try: mat_inv = self.matrix()**(-1) except ZeroDivisionError: - raise TypeError("Oops! The quadratic form is degenerate (i.e. det = 0). =(") + raise TypeError("the quadratic form is degenerate") - ## Compute the level + # Compute the level inv_denoms = [] for i in range(self.dim()): for j in range(i, self.dim()): @@ -1569,16 +1559,16 @@ def level(self): lvl = LCM(inv_denoms) lvl = Ideal(self.base_ring()(lvl)).gen() ############################################################## - ## To do this properly, the level should be the inverse of the - ## fractional ideal (over R) generated by the entries whose - ## denominators we take above. =) + # To do this properly, the level should be the inverse of the + # fractional ideal (over R) generated by the entries whose + # denominators we take above. =) ############################################################## - ## Normalize the result over ZZ + # Normalize the result over ZZ if self.base_ring() == IntegerRing(): lvl = abs(lvl) - ## Cache and return the level + # Cache and return the level self.__level = lvl return lvl @@ -1598,25 +1588,19 @@ def level_ideal(self): sage: Q.level_ideal() Principal ideal (8) of Integer Ring - :: - sage: Q1 = QuadraticForm(QQ, 2, range(1,4)) sage: Q1.level_ideal() Principal ideal (1) of Rational Field - :: - sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7]) sage: Q.level_ideal() Principal ideal (420) of Integer Ring - """ ############################################################## - ## To do this properly, the level should be the inverse of the - ## fractional ideal (over R) generated by the entries whose - ## denominators we take above. =) + # To do this properly, the level should be the inverse of the + # fractional ideal (over R) generated by the entries whose + # denominators we take above. ############################################################## - return Ideal(self.base_ring()(self.level())) def bilinear_map(self, v, w): @@ -1682,8 +1666,6 @@ def bilinear_map(self, v, w): genera = staticmethod(genera) -# ============================================================================ - def DiagonalQuadraticForm(R, diag): """ diff --git a/src/sage/quadratic_forms/quadratic_form__count_local_2.py b/src/sage/quadratic_forms/quadratic_form__count_local_2.py index 95b1b73ffea..54b072109f3 100644 --- a/src/sage/quadratic_forms/quadratic_form__count_local_2.py +++ b/src/sage/quadratic_forms/quadratic_form__count_local_2.py @@ -4,16 +4,14 @@ This file provides more user-friendly Python front-ends to the Cython code in :mod:`sage.quadratic_forms.count_local`. """ -################################################################## -## Methods for counting/computing the number of representations ## -## of a number by a quadratic form in Z/(p^k)Z of various types ## -################################################################## - +################################################################ +# Methods for counting/computing the number of representations # +# of a number by a quadratic form in Z/(p^k)Z of various types # +################################################################ from sage.quadratic_forms.count_local_2 import CountAllLocalTypesNaive - def count_congruence_solutions_as_vector(self, p, k, m, zvec, nzvec): """ Gives the number of integer solution vectors `x` satisfying the @@ -131,7 +129,6 @@ def count_congruence_solutions__good_type(self, p, k, m, zvec, nzvec): return CountAllLocalTypesNaive(self, p, k, m, zvec, nzvec)[1] - def count_congruence_solutions__zero_type(self, p, k, m, zvec, nzvec): """ Counts the zero-type solutions of Q(`x`) = `m (mod p^k)` satisfying the diff --git a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py index c9099832364..b69bb6abf9d 100644 --- a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py +++ b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py @@ -5,7 +5,6 @@ - Anna Haensch (2014-12-01): added test for rational isometry """ - from sage.arith.all import hilbert_symbol, prime_divisors, is_prime, valuation, GCD, legendre_symbol from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ @@ -13,10 +12,10 @@ from sage.quadratic_forms.quadratic_form import is_QuadraticForm -################################################################################ -## Routines to test if two quadratic forms over ZZ are globally equivalent. ## -## (For now, we require both forms to be positive definite.) ## -################################################################################ +############################################################################## +# Routines to test if two quadratic forms over ZZ are globally equivalent. # +# (For now, we require both forms to be positive definite.) # +############################################################################## def is_globally_equivalent_to(self, other, return_matrix=False): """ @@ -91,11 +90,11 @@ def is_globally_equivalent_to(self, other, return_matrix=False): sage: P.is_globally_equivalent_to(Q) False """ - ## Check that other is a QuadraticForm + # Check that other is a QuadraticForm if not is_QuadraticForm(other): raise TypeError("you must compare two quadratic forms, but the argument is not a quadratic form") - ## only for definite forms + # only for definite forms if not self.is_definite() or not other.is_definite(): raise ValueError("not a definite form in QuadraticForm.is_globally_equivalent_to()") @@ -136,37 +135,37 @@ def is_locally_equivalent_to(self, other, check_primes_only=False, force_jordan_ True """ - ## TO IMPLEMENT: + # TO IMPLEMENT: if self.det() == 0: raise NotImplementedError("OOps! We need to think about whether this still works for degenerate forms... especially check the signature.") - ## Check that both forms have the same dimension and base ring + # Check that both forms have the same dimension and base ring if (self.dim() != other.dim()) or (self.base_ring() != other.base_ring()): return False - ## Check that the determinant and level agree + # Check that the determinant and level agree if (self.det() != other.det()) or (self.level() != other.level()): return False - ## ----------------------------------------------------- + # ----------------------------------------------------- - ## Test equivalence over the real numbers + # Test equivalence over the real numbers if self.signature() != other.signature(): return False - ## Test equivalence over Z_p for all primes + # Test equivalence over Z_p for all primes if (self.base_ring() == ZZ) and (not force_jordan_equivalence_test): - ## Test equivalence with Conway-Sloane genus symbols (default over ZZ) + # Test equivalence with Conway-Sloane genus symbols (default over ZZ) if self.CS_genus_symbol_list() != other.CS_genus_symbol_list(): return False else: - ## Test equivalence via the O'Meara criterion. + # Test equivalence via the O'Meara criterion. for p in prime_divisors(ZZ(2) * self.det()): if not self.has_equivalent_Jordan_decomposition_at_prime(other, p): return False - ## All tests have passed! + # All tests have passed! return True @@ -204,23 +203,23 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): False """ - ## Sanity Checks + # Sanity Checks #if not isinstance(other, QuadraticForm): if not isinstance(other, type(self)): - raise TypeError("Oops! The first argument must be of type QuadraticForm.") + raise TypeError("the first argument must be of type QuadraticForm") if not is_prime(p): - raise TypeError("Oops! The second argument must be a prime number.") + raise TypeError("the second argument must be a prime number") - ## Get the relevant local normal forms quickly + # Get the relevant local normal forms quickly self_jordan = self.jordan_blocks_by_scale_and_unimodular(p, safe_flag= False) other_jordan = other.jordan_blocks_by_scale_and_unimodular(p, safe_flag=False) - ## Check for the same number of Jordan components + # Check for the same number of Jordan components if len(self_jordan) != len(other_jordan): return False - ## Deal with odd primes: Check that the Jordan component scales, dimensions, and discriminants are the same + # Deal with odd primes: Check that the Jordan component scales, dimensions, and discriminants are the same if p != 2: for i in range(len(self_jordan)): if (self_jordan[i][0] != other_jordan[i][0]) \ @@ -228,35 +227,35 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): or (legendre_symbol(self_jordan[i][1].det() * other_jordan[i][1].det(), p) != 1): return False - ## All tests passed for an odd prime. + # All tests passed for an odd prime. return True - ## For p = 2: Check that all Jordan Invariants are the same. + # For p = 2: Check that all Jordan Invariants are the same. elif p == 2: - ## Useful definition - t = len(self_jordan) ## Define t = Number of Jordan components + # Useful definition + t = len(self_jordan) # Define t = Number of Jordan components - ## Check that all Jordan Invariants are the same (scale, dim, and norm) + # Check that all Jordan Invariants are the same (scale, dim, and norm) for i in range(t): if (self_jordan[i][0] != other_jordan[i][0]) \ or (self_jordan[i][1].dim() != other_jordan[i][1].dim()) \ or (valuation(GCD(self_jordan[i][1].coefficients()), p) != valuation(GCD(other_jordan[i][1].coefficients()), p)): return False - ## Use O'Meara's isometry test 93:29 on p277. - ## ------------------------------------------ + # Use O'Meara's isometry test 93:29 on p277. + # ------------------------------------------ - ## List of norms, scales, and dimensions for each i + # List of norms, scales, and dimensions for each i scale_list = [ZZ(2)**self_jordan[i][0] for i in range(t)] norm_list = [ZZ(2)**(self_jordan[i][0] + valuation(GCD(self_jordan[i][1].coefficients()), 2)) for i in range(t)] dim_list = [(self_jordan[i][1].dim()) for i in range(t)] - ## List of Hessian determinants and Hasse invariants for each Jordan (sub)chain - ## (Note: This is not the same as O'Meara's Gram determinants, but ratios are the same!) -- NOT SO GOOD... - ## But it matters in condition (ii), so we multiply all by 2 (instead of dividing by 2 since only square-factors matter, and it's easier.) + # List of Hessian determinants and Hasse invariants for each Jordan (sub)chain + # (Note: This is not the same as O'Meara's Gram determinants, but ratios are the same!) -- NOT SO GOOD... + # But it matters in condition (ii), so we multiply all by 2 (instead of dividing by 2 since only square-factors matter, and it's easier.) j = 0 self_chain_det_list = [ self_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])] other_chain_det_list = [ other_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])] @@ -273,11 +272,10 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): * hilbert_symbol(other_chain_det_list[j-1], other_jordan[j][1].Gram_det(), 2) \ * other_jordan[j][1].hasse_invariant__OMeara(2)) - # SANITY CHECK -- check that the scale powers are strictly increasing for i in range(1, len(scale_list)): if scale_list[i - 1] >= scale_list[i]: - raise RuntimeError("Oops! There is something wrong with the Jordan Decomposition -- the given scales are not strictly increasing!") + raise RuntimeError("there is something wrong with the Jordan Decomposition ; the given scales are not strictly increasing") # Test O'Meara's two conditions for i in range(t - 1): @@ -292,15 +290,15 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): # Check O'Meara's condition (ii) when appropriate if norm_list[i+1] % (4 * norm_list[i]) == 0: if self_hasse_chain_list[i] * hilbert_symbol(norm_list[i] * other_chain_det_list[i], -self_chain_det_list[i], 2) \ - != other_hasse_chain_list[i] * hilbert_symbol(norm_list[i], -other_chain_det_list[i], 2): ## Nipp conditions + != other_hasse_chain_list[i] * hilbert_symbol(norm_list[i], -other_chain_det_list[i], 2): # Nipp conditions return False - # All tests passed for the prime 2. return True else: - raise TypeError("Oops! This should not have happened.") + raise TypeError("this should not have happened") + def is_rationally_isometric(self, other, return_matrix=False): """ @@ -480,7 +478,6 @@ def is_rationally_isometric(self, other, return_matrix=False): True True """ - if self.Gram_det() == 0 or other.Gram_det() == 0: raise NotImplementedError("This only tests regular forms") diff --git a/src/sage/quadratic_forms/quadratic_form__evaluate.pyx b/src/sage/quadratic_forms/quadratic_form__evaluate.pyx index 01e9094786f..1505e7bd115 100644 --- a/src/sage/quadratic_forms/quadratic_form__evaluate.pyx +++ b/src/sage/quadratic_forms/quadratic_form__evaluate.pyx @@ -1,5 +1,6 @@ "Evaluation" + def QFEvaluateVector(Q, v): """ Evaluate this quadratic form Q on a vector or matrix of elements @@ -50,8 +51,8 @@ cdef QFEvaluateVector_cdef(Q, v): the Python wrapper function QFEvaluate() above for details. """ - ## If we are passed a matrix A, return the quadratic form Q(A(x)) - ## (In matrix notation: A^t * Q * A) + # If we are passed a matrix A, return the quadratic form Q(A(x)) + # (In matrix notation: A^t * Q * A) n = Q.dim() tmp_val = Q.base_ring()(0) @@ -59,7 +60,7 @@ cdef QFEvaluateVector_cdef(Q, v): for j from i <= j < n: tmp_val += Q[i,j] * v[i] * v[j] - ## Return the value (over R) + # Return the value (over R) return Q.base_ring().coerce(tmp_val) @@ -111,20 +112,19 @@ def QFEvaluateMatrix(Q, M, Q2): return QFEvaluateMatrix_cdef(Q, M, Q2) - cdef QFEvaluateMatrix_cdef(Q, M, Q2): """ Routine to quickly evaluate a quadratic form Q on a matrix M. See the Python wrapper function QFEvaluateMatrix() above for details. """ - ## Create the new quadratic form + # Create the new quadratic form n = Q.dim() m = Q2.dim() - ## TO DO: Check the dimensions of M are compatible with those of Q and Q2 + # TODO: Check the dimensions of M are compatible with those of Q and Q2 - ## Evaluate Q(M) into Q2 + # Evaluate Q(M) into Q2 for k from 0 <= k < m: for l from k <= l < m: tmp_sum = Q2.base_ring()(0) diff --git a/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py b/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py index f02417cf4f5..16e91b82509 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py +++ b/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py @@ -598,7 +598,7 @@ def local_badI_density_congruence(self, p, m, Zvec=None, NZvec=None): if not S0: print(" Using Q = " + str(self)) print(" and p = " + str(p)) - raise RuntimeError("Oops! The form is not primitive!") + raise RuntimeError("the form is not primitive") # DIAGNOSTIC verbose(" m = " + str(m) + " p = " + str(p)) @@ -744,11 +744,11 @@ def local_badII_density_congruence(self, p, m, Zvec=None, NZvec=None): if (NZvec is not None) and (len(Set(S2plus).intersection(Set(NZvec))) == 0): return 0 - # Check that the form is primitive... WHY IS THIS NECESSARY? + # Check that the form is primitive... WHY IS THIS NECESSARY? if not S0: print(" Using Q = " + str(self)) print(" and p = " + str(p)) - raise RuntimeError("Oops! The form is not primitive!") + raise RuntimeError("the form is not primitive") # DIAGNOSTIC verbose("\n Entering BII routine ") @@ -837,9 +837,9 @@ def local_bad_density_congruence(self, p, m, Zvec=None, NZvec=None): """ return self.local_badI_density_congruence(p, m, Zvec, NZvec) + self.local_badII_density_congruence(p, m, Zvec, NZvec) -######################################################### -# local_density and local_density_congruence routines ## -######################################################### +######################################################## +# local_density and local_density_congruence routines # +######################################################## def local_density_congruence(self, p, m, Zvec=None, NZvec=None): @@ -982,7 +982,6 @@ def local_primitive_density_congruence(self, p, m, Zvec=None, NZvec=None): 8/27 sage: Q.local_primitive_density_congruence(3, 243, None, None) 8/27 - """ return self.local_good_density_congruence(p, m, Zvec, NZvec) \ + self.local_bad_density_congruence(p, m, Zvec, NZvec) diff --git a/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py b/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py index 9a47626531f..aa4fb04ad63 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py +++ b/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py @@ -1,37 +1,35 @@ """ Local Density Interfaces """ -## // This is needed in the filter for primitivity... -## #include "../max-min.h" - +# // This is needed in the filter for primitivity... +# #include "../max-min.h" from sage.arith.all import valuation from sage.rings.rational_field import QQ - - - def local_density(self, p, m): """ - Gives the local density -- should be called by the user. =) + Return the local density. - NOTE: This screens for imprimitive forms, and puts the quadratic - form in local normal form, which is a *requirement* of the - routines performing the computations! + .. NOTE:: + + This screens for imprimitive forms, and puts the quadratic + form in local normal form, which is a *requirement* of the + routines performing the computations! INPUT: - `p` -- a prime number > 0 - `m` -- an integer + - `p` -- a prime number > 0 + - `m` -- an integer OUTPUT: - a rational number + a rational number EXAMPLES:: - sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1]) ## NOTE: This is already in local normal form for *all* primes p! + sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1]) # NOTE: This is already in local normal form for *all* primes p! sage: Q.local_density(p=2, m=1) 1 sage: Q.local_density(p=3, m=1) @@ -42,36 +40,33 @@ def local_density(self, p, m): 48/49 sage: Q.local_density(p=11, m=1) 120/121 - """ n = self.dim() - if (n == 0): - raise TypeError("Oops! We currently don't handle 0-dim'l forms. =(") + if n == 0: + raise TypeError("we do not currently handle 0-dim'l forms") - ## Find the local normal form and p-scale of Q -- Note: This uses the valuation ordering of local_normal_form. - ## TO DO: Write a separate p-scale and p-norm routines! + # Find the local normal form and p-scale of Q -- Note: This uses the valuation ordering of local_normal_form. + # TO DO: Write a separate p-scale and p-norm routines! Q_local = self.local_normal_form(p) if n == 1: p_valuation = valuation(Q_local[0,0], p) else: p_valuation = min(valuation(Q_local[0,0], p), valuation(Q_local[0,1], p)) - ## If m is less p-divisible than the matrix, return zero - if ((m != 0) and (valuation(m,p) < p_valuation)): ## Note: The (m != 0) condition protects taking the valuation of zero. + # If m is less p-divisible than the matrix, return zero + if ((m != 0) and (valuation(m,p) < p_valuation)): # Note: The (m != 0) condition protects taking the valuation of zero. return QQ(0) - ## If the form is imprimitive, rescale it and call the local density routine + # If the form is imprimitive, rescale it and call the local density routine p_adjustment = QQ(1) / p**p_valuation m_prim = QQ(m) / p**p_valuation Q_prim = Q_local.scale_by_factor(p_adjustment) - ## Return the densities for the reduced problem + # Return the densities for the reduced problem return Q_prim.local_density_congruence(p, m_prim) - - def local_primitive_density(self, p, m): """ Gives the local primitive density -- should be called by the user. =) @@ -123,28 +118,26 @@ def local_primitive_density(self, p, m): """ n = self.dim() - if (n == 0): - raise TypeError("Oops! We currently don't handle 0-dim'l forms. =(") + if n == 0: + raise TypeError("we do not currently handle 0-dim'l forms") - ## Find the local normal form and p-scale of Q -- Note: This uses the valuation ordering of local_normal_form. - ## TO DO: Write a separate p-scale and p-norm routines! + # Find the local normal form and p-scale of Q -- Note: This uses the valuation ordering of local_normal_form. + # TO DO: Write a separate p-scale and p-norm routines! Q_local = self.local_normal_form(p) if n == 1: p_valuation = valuation(Q_local[0,0], p) else: p_valuation = min(valuation(Q_local[0,0], p), valuation(Q_local[0,1], p)) - - ## If m is less p-divisible than the matrix, return zero - if ((m != 0) and (valuation(m,p) < p_valuation)): ## Note: The (m != 0) condition protects taking the valuation of zero. + # If m is less p-divisible than the matrix, return zero + if ((m != 0) and (valuation(m,p) < p_valuation)): # Note: The (m != 0) condition protects taking the valuation of zero. return QQ(0) - ## If the form is imprimitive, rescale it and call the local density routine + # If the form is imprimitive, rescale it and call the local density routine p_adjustment = QQ(1) / p**p_valuation m_prim = QQ(m) / p**p_valuation Q_prim = Q_local.scale_by_factor(p_adjustment) - ## Return the densities for the reduced problem + # Return the densities for the reduced problem return Q_prim.local_primitive_density_congruence(p, m_prim) - 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 a78b99f3068..3556c101705 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py +++ b/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py @@ -17,8 +17,8 @@ #***************************************************************************** ########################################################################### -## TO DO: Add routines for hasse invariants at all places, anisotropic -## places, is_semi_definite, and support for number fields. +# TO DO: Add routines for hasse invariants at all places, anisotropic +# places, is_semi_definite, and support for number fields. ########################################################################### @@ -253,13 +253,13 @@ def _rational_diagonal_form_and_transformation(self): # General case if conversion to/from PARI failed T = MS(1) - ## Clear the entries one row at a time. + # Clear the entries one row at a time. for i in range(n): - ## Deal with rows where the diagonal entry is zero. + # Deal with rows where the diagonal entry is zero. if Q[i,i] == 0: - ## Look for a non-zero entry and use it to make the diagonal non-zero (if it exists) + # Look for a non-zero entry and use it to make the diagonal non-zero (if it exists) for j in range(i+1, n): if Q[i,j] != 0: temp = MS(1) @@ -268,16 +268,16 @@ def _rational_diagonal_form_and_transformation(self): else: temp[j, i] = 1 - ## Apply the transformation + # Apply the transformation Q = Q(temp) T = T * temp break - ## Create a matrix which deals with off-diagonal entries (all at once for each row) + # Create a matrix which deals with off-diagonal entries (all at once for each row) temp = MS(1) for j in range(i+1, n): if Q[i,j] != 0: - temp[i,j] = -Q[i,j] / (Q[i,i] * 2) ## This should only occur when Q[i,i] != 0, which the above step guarantees. + temp[i,j] = -Q[i,j] / (Q[i,i] * 2) # This should only occur when Q[i,i] != 0, which the above step guarantees. Q = Q(temp) T = T * temp @@ -455,7 +455,7 @@ def hasse_invariant(self, p): sage: [Q.hasse_invariant(p) for p in K.primes_above(19)] [-1, 1] """ - ## TO DO: Need to deal with the case n=1 separately somewhere! + # TO DO: Need to deal with the case n=1 separately somewhere! Diag = self.rational_diagonal_form() R = Diag.base_ring() @@ -539,7 +539,7 @@ def hasse_invariant__OMeara(self, p): sage: [Q.hasse_invariant__OMeara(p) for p in K.primes_above(19)] [1, 1] """ - ## TO DO: Need to deal with the case n=1 separately somewhere! + # TO DO: Need to deal with the case n=1 separately somewhere! Diag = self.rational_diagonal_form() R = Diag.base_ring() @@ -588,24 +588,24 @@ def is_hyperbolic(self, p): False sage: Q.is_hyperbolic(3) False - sage: Q.is_hyperbolic(5) ## Here -1 is a square, so it's true. + sage: Q.is_hyperbolic(5) # Here -1 is a square, so it's true. True sage: Q.is_hyperbolic(7) False - sage: Q.is_hyperbolic(13) ## Here -1 is a square, so it's true. + sage: Q.is_hyperbolic(13) # Here -1 is a square, so it's true. True """ - ## False for odd-dim'l forms + # False for odd-dim'l forms if self.dim() % 2: return False - ## True for the zero form + # True for the zero form if not self.dim(): return True - ## Compare local invariants - ## Note: since the dimension is even, the extra powers of 2 in - ## self.det() := Det(2*Q) don't affect the answer! + # Compare local invariants + # Note: since the dimension is even, the extra powers of 2 in + # self.det() := Det(2*Q) don't affect the answer! m = ZZ(self.dim() // 2) if p == -1: return self.signature() == 0 @@ -661,7 +661,7 @@ def is_anisotropic(self, p): sage: [DiagonalQuadraticForm(ZZ, [1, -least_quadratic_nonresidue(p), p, -p*least_quadratic_nonresidue(p)]).is_anisotropic(p) for p in prime_range(3, 30)] [True, True, True, True, True, True, True, True, True] """ - ## TO DO: Should check that p is prime + # TO DO: Should check that p is prime if p == -1: return self.is_definite() @@ -684,7 +684,7 @@ def is_anisotropic(self, p): if n == 1: return self[0, 0] != 0 - raise NotImplementedError("Oops! We haven't established a convention for 0-dim'l quadratic forms... =(") + raise NotImplementedError("we have not established a convention for 0-dim'l quadratic forms") def is_isotropic(self, p): @@ -821,21 +821,21 @@ def compute_definiteness(self): False """ - ## Sanity Check + # Sanity Check if not ((self.base_ring() == ZZ) or (self.base_ring() == QQ) or (self.base_ring() == RR)): - raise NotImplementedError("Oops! We can only check definiteness over ZZ, QQ, and RR for now.") + raise NotImplementedError("we can only check definiteness over ZZ, QQ, and RR for now") - ## Some useful variables + # Some useful variables n = self.dim() - ## Deal with the zero-diml form + # Deal with the zero-diml form if n == 0: self.__definiteness_string = "zero" return sig_pos, sig_neg, sig_zer = self.signature_vector() - ## Determine and cache the definiteness string + # Determine and cache the definiteness string if sig_zer > 0: self.__definiteness_string = "degenerate" return @@ -893,52 +893,39 @@ def compute_definiteness_string_by_determinants(self): sage: Q = DiagonalQuadraticForm(ZZ, [-1,-1]) sage: Q.compute_definiteness_string_by_determinants() 'neg_def' - """ - ## Sanity Check + # Sanity Check if not ((self.base_ring() == ZZ) or (self.base_ring() == QQ) or (self.base_ring() == RR)): - raise NotImplementedError("Oops! We can only check definiteness over ZZ, QQ, and RR for now.") + raise NotImplementedError("we can only check definiteness over ZZ, QQ, and RR for now") - ## Some useful variables + # Some useful variables n = self.dim() M = self.matrix() - - ## Deal with the zero-diml form + # Deal with the zero-diml form if n == 0: return "zero" - - - ## Deal with degenerate forms + # Deal with degenerate forms if self.det() == 0: return "degenerate" - - ## Check the sign of the ratios of consecutive determinants of the upper triangular r x r submatrices + # Check the sign of the ratios of consecutive determinants of the upper triangular r x r submatrices first_coeff = self[0,0] for r in range(1,n+1): I = list(range(r)) new_det = M.matrix_from_rows_and_columns(I, I).det() - ## Check for a (non-degenerate) zero -- so it's indefinite + # Check for a (non-degenerate) zero -- so it's indefinite if new_det == 0: return "indefinite" - - ## Check for a change of signs in the upper r x r submatrix -- so it's indefinite + # Check for a change of signs in the upper r x r submatrix -- so it's indefinite if sgn(first_coeff)**r != sgn(new_det): return "indefinite" - - ## Here all ratios of determinants have the correct sign, so the matrix is (pos or neg) definite. - if first_coeff > 0: - return "pos_def" - else: - return "neg_def" - - - + # Here all ratios of determinants have the correct sign, so the matrix is (pos or neg) definite. + return "pos_def" if first_coeff > 0 else "neg_def" def is_positive_definite(self): @@ -967,21 +954,18 @@ def is_positive_definite(self): sage: Q = DiagonalQuadraticForm(ZZ, [1,-3,5]) sage: Q.is_positive_definite() False - """ - ## Try to use the cached value + # Try to use the cached value try: def_str = self.__definiteness_string except AttributeError: self.compute_definiteness() def_str = self.__definiteness_string - ## Return the answer + # Return the answer return (def_str == "pos_def") or (def_str == "zero") - - def is_negative_definite(self): """ Determines if the given quadratic form is negative-definite. @@ -1008,20 +992,18 @@ def is_negative_definite(self): sage: Q = DiagonalQuadraticForm(ZZ, [1,-3,5]) sage: Q.is_negative_definite() False - """ - ## Try to use the cached value + # Try to use the cached value try: def_str = self.__definiteness_string except AttributeError: self.compute_definiteness() def_str = self.__definiteness_string - ## Return the answer + # Return the answer return (def_str == "neg_def") or (def_str == "zero") - def is_indefinite(self): """ Determines if the given quadratic form is indefinite. @@ -1050,14 +1032,14 @@ def is_indefinite(self): True """ - ## Try to use the cached value + # Try to use the cached value try: def_str = self.__definiteness_string except AttributeError: self.compute_definiteness() def_str = self.__definiteness_string - ## Return the answer + # Return the answer return def_str == "indefinite" @@ -1082,21 +1064,16 @@ def is_definite(self): sage: Q.is_definite() True - :: - sage: Q = DiagonalQuadraticForm(ZZ, [1,-3,5]) sage: Q.is_definite() False - """ - ## Try to use the cached value + # Try to use the cached value try: def_str = self.__definiteness_string except AttributeError: self.compute_definiteness() def_str = self.__definiteness_string - ## Return the answer + # Return the answer return (def_str == "pos_def") or (def_str == "neg_def") or (def_str == "zero") - - diff --git a/src/sage/quadratic_forms/quadratic_form__local_normal_form.py b/src/sage/quadratic_forms/quadratic_form__local_normal_form.py index d2bdb4e2273..429c7c68896 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_normal_form.py +++ b/src/sage/quadratic_forms/quadratic_form__local_normal_form.py @@ -122,9 +122,9 @@ def local_normal_form(self, p): """ # Sanity Checks if (self.base_ring() != IntegerRing()): - raise NotImplementedError("Oops! This currently only works for quadratic forms defined over IntegerRing(). =(") + raise NotImplementedError("this currently only works for quadratic forms defined over ZZ") if not ((p>=2) and is_prime(p)): - raise TypeError("Oops! p is not a positive prime number. =(") + raise TypeError("p is not a positive prime number") # Some useful local variables Q = self.parent()(self.base_ring(), self.dim(), self.coefficients()) @@ -146,7 +146,7 @@ def local_normal_form(self, p): # Error if we still haven't seen non-zero coefficients! if (min_val == Infinity): - raise RuntimeError("Oops! The original matrix is degenerate. =(") + raise RuntimeError("the original matrix is degenerate") # Step 2: Arrange for the upper leftmost entry to have minimal valuation # ---------------------------------------------------------------------- @@ -179,7 +179,7 @@ def local_normal_form(self, p): # Sanity Check: a/g is a p-unit if valuation(g, p) != valuation(a, p): - raise RuntimeError("Oops! We have a problem with our rescaling not preserving p-integrality!") + raise RuntimeError("we have a problem with our rescaling not preserving p-integrality") Q.multiply_variable(ZZ(a/g), j, in_place = True) # Ensures that the new b entry is divisible by a Q.add_symmetric(ZZ(-b/g), j, 0, in_place = True) # Performs the cancellation @@ -224,7 +224,7 @@ def local_normal_form(self, p): for i in range(block_size): for j in range(block_size, n): if Q[i,j] != 0: - raise RuntimeError("Oops! The cancellation didn't work properly at entry (" + str(i) + ", " + str(j) + ").") + raise RuntimeError(f"the cancellation did not work properly at entry ({i},{j})") Q_Jordan = Q_Jordan + Q.extract_variables(range(block_size)) Q = Q.extract_variables(range(block_size, n)) @@ -381,8 +381,7 @@ def jordan_blocks_in_unimodular_list_by_scale_power(self, p): sage: Q.jordan_blocks_in_unimodular_list_by_scale_power(2) Traceback (most recent call last): ... - TypeError: Oops! The given quadratic form has a Jordan component with a negative scale exponent! - This routine requires an integer-matrix quadratic form for the output indexing to work properly! + TypeError: the given quadratic form has a Jordan component with a negative scale exponent sage: Q.scale_by_factor(2).jordan_blocks_in_unimodular_list_by_scale_power(2) [Quadratic form in 2 variables over Integer Ring with coefficients: @@ -399,7 +398,7 @@ def jordan_blocks_in_unimodular_list_by_scale_power(self, p): """ # Sanity Check if self.base_ring() != ZZ: - raise TypeError("Oops! This method only makes sense for integer-valued quadratic forms (i.e. defined over ZZ).") + raise TypeError("this method only makes sense for integer-valued quadratic forms (i.e. defined over ZZ)") # Deal with zero dim'l forms if self.dim() == 0: @@ -410,8 +409,7 @@ def jordan_blocks_in_unimodular_list_by_scale_power(self, p): scale_list = [P[0] for P in list_of_jordan_pairs] s_max = max(scale_list) if min(scale_list) < 0: - raise TypeError("Oops! The given quadratic form has a Jordan component with a negative scale exponent!\n" - + "This routine requires an integer-matrix quadratic form for the output indexing to work properly!") + raise TypeError("the given quadratic form has a Jordan component with a negative scale exponent") # Make the new list of unimodular Jordan components zero_form = self.parent()(ZZ, 0) 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 4ca4a0d0910..52006fc0a21 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py +++ b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py @@ -2,8 +2,8 @@ Local Representation Conditions """ ########################################################################## -## Class for keeping track of the local conditions for representability ## -## of numbers by a quadratic form over ZZ (and eventually QQ also). ## +# Class for keeping track of the local conditions for representability ## +# of numbers by a quadratic form over ZZ (and eventually QQ also). ## ########################################################################## from copy import deepcopy @@ -121,17 +121,17 @@ def __init__(self, Q): """ - ## Check that the form Q is integer-valued (we can relax this later) + # Check that the form Q is integer-valued (we can relax this later) if Q.base_ring() != ZZ: raise TypeError("We require that the quadratic form be defined over ZZ (integer-values) for now.") - ## Basic structure initialization - self.local_repn_array = [] ## List of all local conditions - self.dim = Q.dim() ## We allow this to be any non-negative integer. + # Basic structure initialization + self.local_repn_array = [] # List of all local conditions + self.dim = Q.dim() # We allow this to be any non-negative integer. self.exceptional_primes = [infinity] - ## Deal with the special cases of 0 and 1-dimensional forms + # Deal with the special cases of 0 and 1-dimensional forms if self.dim == 0: self.coeff = None return @@ -142,8 +142,8 @@ def __init__(self, Q): self.coeff = None - ## Compute the local conditions at the real numbers (i.e. "p = infinity") - ## ---------------------------------------------------------------------- + # Compute the local conditions at the real numbers (i.e. "p = infinity") + # ---------------------------------------------------------------------- M = Q.matrix() E = M.eigenspaces_left() M_eigenvalues = [E[i][0] for i in range(len(E))] @@ -161,22 +161,22 @@ def __init__(self, Q): self.local_repn_array.append(real_vec) - ## Compute the local conditions for representability: - ## -------------------------------------------------- + # Compute the local conditions for representability: + # -------------------------------------------------- N = Q.level() level_primes = prime_divisors(N) prime_repn_modulus_list = [p**(valuation(4*N, p) + 2) for p in level_primes] - ## Make a table of local normal forms for each p | N + # Make a table of local normal forms for each p | N local_normal_forms = [Q.local_normal_form(p) for p in level_primes] - ## Check local representability conditions for each prime + # Check local representability conditions for each prime for i in range(len(level_primes)): p = level_primes[i] tmp_local_repn_vec = [p, None, None, None, None, None, None, None, None] sqclass = self.squareclass_vector(p) - ## Check the representability in each Z_p squareclass + # Check the representability in each Z_p squareclass for j in range(len(sqclass)): m = sqclass[j] k = 0 @@ -189,21 +189,21 @@ def __init__(self, Q): k = k + 1 m = m * p * p - ## If we're not represented, write "infinity" to signify - ## that this squareclass is fully obstructed + # If we're not represented, write "infinity" to signify + # that this squareclass is fully obstructed if not repn_flag: tmp_local_repn_vec[j+1] = infinity - ## Test if the conditions at p give exactly Z_p when dim >=3, or - ## if we represent the elements of even valuation >= 2 when dim = 2. + # Test if the conditions at p give exactly Z_p when dim >=3, or + # if we represent the elements of even valuation >= 2 when dim = 2. omit_flag = True if self.dim >= 2: - ## Check that all entries are zero or 'None' + # Check that all entries are zero or 'None' for x in tmp_local_repn_vec[1:]: if not ((x == 0) or (x is None)): omit_flag = False - ## Add the results for this prime if there is a congruence obstruction + # Add the results for this prime if there is a congruence obstruction if not omit_flag: self.local_repn_array.append(tmp_local_repn_vec) self.exceptional_primes.append(p) @@ -290,15 +290,15 @@ def __eq__(self, right): if not isinstance(right, QuadraticFormLocalRepresentationConditions): return False - ## Check the dimensions agree when they affect the kind of representation conditions. + # Check the dimensions agree when they affect the kind of representation conditions. if ((self.dim <= 2) or (right.dim <= 2)) and self.dim != right.dim: return False - ## Check equality by dimension + # Check equality by dimension if self.dim == 0: return True elif self.dim == 1: - return self.coeff == right.coeff ## Compare coefficients in dimension 1 (since ZZ has only one unit square) + return self.coeff == right.coeff # Compare coefficients in dimension 1 (since ZZ has only one unit square) else: return (self.exceptional_primes == right.exceptional_primes) \ and (self.local_repn_array == right.local_repn_array) @@ -360,11 +360,11 @@ def local_conditions_vector_for_prime(self, p): [3, 0, 0, 0, 0, None, None, None, None] """ - ## Check if p is non-generic + # Check if p is non-generic if p in self.exceptional_primes: return deepcopy(self.local_repn_array[self.exceptional_primes.index(p)]) - ## Otherwise, generate a vector at this (finite) prime + # Otherwise, generate a vector at this (finite) prime if self.dim >= 3: if p == 2: return [2, 0, 0, 0, 0, 0, 0, 0, 0] @@ -382,7 +382,7 @@ def local_conditions_vector_for_prime(self, p): sqclass = self.squareclass_vector(p) for i in range(len(sq_class)): - if QQ(self.coeff / sqclass[i]).is_padic_square(p): ## Note:This should happen only once! + if QQ(self.coeff / sqclass[i]).is_padic_square(p): # Note:This should happen only once! nu = valuation(self.coeff / sqclass[i], p) / 2 else: v[i+1] = infinity @@ -422,22 +422,22 @@ def is_universal_at_prime(self, p): False """ - ## Check if the prime behaves generically for n >= 3. + # Check if the prime behaves generically for n >= 3. if (self.dim >= 3) and not (p in self.exceptional_primes): return True - ## Check if the prime behaves generically for n <= 2. + # Check if the prime behaves generically for n <= 2. if (self.dim <= 2) and not (p in self.exceptional_primes): return False - ## Check if the prime is "infinity" (for the reals) + # Check if the prime is "infinity" (for the reals) if p == infinity: v = self.local_repn_array[0] if p != v[0]: raise RuntimeError("Error... The first vector should be for the real numbers!") - return (v[1:3] == [0,0]) ## True iff the form is indefinite + return (v[1:3] == [0,0]) # True iff the form is indefinite - ## Check non-generic "finite" primes + # Check non-generic "finite" primes v = self.local_conditions_vector_for_prime(p) Zp_univ_flag = True for nu in v[1:]: @@ -475,13 +475,13 @@ def is_universal_at_all_finite_primes(self): True """ - ## Check if dim <= 2. + # Check if dim <= 2. if self.dim <= 2: return False - ## Check that all non-generic finite primes are universal + # Check that all non-generic finite primes are universal univ_flag = True - for p in self.exceptional_primes[1:]: ## Omit p = "infinity" here + for p in self.exceptional_primes[1:]: # Omit p = "infinity" here univ_flag = univ_flag and self.is_universal_at_prime(p) return univ_flag @@ -525,11 +525,11 @@ def is_universal_at_all_places(self): True """ - ## Check if dim <= 2. + # Check if dim <= 2. if self.dim <= 2: return False - ## Check that all non-generic finite primes are universal + # Check that all non-generic finite primes are universal for p in self.exceptional_primes: if not self.is_universal_at_prime(p): return False @@ -572,7 +572,7 @@ def is_locally_represented_at_place(self, m, p): """ # Sanity Check if m not in QQ: - raise TypeError("Oops! m = " + str(m) + " is not a rational number!") + raise TypeError(f"m = {m} is not a rational number") # Representing zero if m == 0: @@ -590,16 +590,16 @@ def is_locally_represented_at_place(self, m, p): else: return (valuation(m1, p) >= 0) and m1.is_padic_square(p) - ## >= 2-dim'l forms + # >= 2-dim'l forms local_vec = self.local_conditions_vector_for_prime(p) - ## Check the real place + # Check the real place if p == infinity: if m > 0: return local_vec[1] == 0 elif m < 0: return local_vec[2] == 0 - else: ## m == 0 + else: # m == 0 return True # Check at a finite place @@ -670,7 +670,7 @@ def is_locally_represented(self, m): -## -------------------- End of QuadraticFormLocalRepresentationConditions Class ---------------------- +# -------------------- End of QuadraticFormLocalRepresentationConditions Class ---------------------- @@ -783,16 +783,15 @@ def local_representation_conditions(self, recompute_flag=False, silent_flag=Fals Reals: [0, +Infinity] """ - ## Recompute the local conditions if they don't exist or the recompute_flag is set. + # Recompute the local conditions if they don't exist or the recompute_flag is set. if not hasattr(self, "__local_representability_conditions") or recompute_flag: self.__local_representability_conditions = QuadraticFormLocalRepresentationConditions(self) - ## Return the local conditions if the silent_flag is not set. + # Return the local conditions if the silent_flag is not set. if not silent_flag: return self.__local_representability_conditions - def is_locally_universal_at_prime(self, p): """ Determines if the (integer-valued/rational) quadratic form represents all of `Z_p`. @@ -988,7 +987,6 @@ def is_locally_represented_number(self, m): False sage: Q.is_locally_represented_number(0) True - """ self.local_representation_conditions(silent_flag=True) return self.__local_representability_conditions.is_locally_represented(m) diff --git a/src/sage/quadratic_forms/quadratic_form__mass.py b/src/sage/quadratic_forms/quadratic_form__mass.py index c52ec478d1f..9f7de214b6a 100644 --- a/src/sage/quadratic_forms/quadratic_form__mass.py +++ b/src/sage/quadratic_forms/quadratic_form__mass.py @@ -2,10 +2,10 @@ Shimura Mass """ ###################################################### -## Routines to compute the mass of a quadratic form ## +# Routines to compute the mass of a quadratic form # ###################################################### -## Import all general mass finding routines +# Import all general mass finding routines from sage.quadratic_forms.quadratic_form__mass__Siegel_densities import \ mass__by_Siegel_densities, \ Pall_mass_density_at_odd_prime, \ @@ -32,25 +32,20 @@ ################################################### -def shimura_mass__maximal(self,): +def shimura_mass__maximal(self): """ Use Shimura's exact mass formula to compute the mass of a maximal quadratic lattice. This works for any totally real number field, but has a small technical restriction when `n` is odd. - INPUT: - - none - OUTPUT: - a rational number + a rational number EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) sage: Q.shimura_mass__maximal() - """ pass @@ -63,18 +58,13 @@ def GHY_mass__maximal(self): Reference: See [GHY, Prop 7.4 and 7.5, p121] and [GY, Thrm 10.20, p25]. - INPUT: - - none - OUTPUT: - a rational number + a rational number EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) sage: Q.GHY_mass__maximal() - """ pass 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 e40ba2f9e91..65c524db39a 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 @@ -76,11 +76,11 @@ def parity(self, allow_rescaling_flag=True): 'odd' """ - ## Deal with 0-dim'l forms + # Deal with 0-dim'l forms if self.dim() == 0: return "even" - ## Identify the correct Jordan component to use. + # Identify the correct Jordan component to use. Jordan_list = self.jordan_blocks_by_scale_and_unimodular(2) scale_pow_list = [J[0] for J in Jordan_list] min_scale_pow = min(scale_pow_list) @@ -88,20 +88,19 @@ def parity(self, allow_rescaling_flag=True): ind = scale_pow_list.index(min_scale_pow) else: if min_scale_pow < 0: - raise TypeError("Oops! If rescaling is not allowed, then we require our form to have an integral Gram matrix.") + raise TypeError("if rescaling is not allowed, then we require our form to have an integral Gram matrix") ind = scale_pow_list.index(0) - - ## Find the component of scale (power) zero, and then look for an odd dim'l component. + # Find the component of scale (power) zero, and then look for an odd dim'l component. J0 = Jordan_list[ind] Q0 = J0[1] - ## The lattice is even if there is no component of scale (power) 0 + # The lattice is even if there is no component of scale (power) 0 if J0 is None: return "even" - ## Look for a 1x1 block in the 0-th Jordan component (which by - ## convention of the local_normal_form routine will appear first). + # Look for a 1x1 block in the 0-th Jordan component (which by + # convention of the local_normal_form routine will appear first). if Q0.dim() == 1: return "odd" elif Q0[0,1] == 0: @@ -188,37 +187,37 @@ def conway_species_list_at_odd_prime(self, p): [-6, 1] """ - ## Sanity Check: - if not ((p>2) and is_prime(p)): - raise TypeError("Oops! We are assuming that p is an odd positive prime number.") + # Sanity Check: + if not (p > 2 and is_prime(p)): + raise TypeError("we are assuming that p is an odd positive prime number") - ## Deal with the zero-dim'l form + # Deal with the zero-dim'l form if self.dim() == 0: return [0] - ## List the (unscaled/unimodular) Jordan blocks by their scale power + # List the (unscaled/unimodular) Jordan blocks by their scale power jordan_list = self.jordan_blocks_in_unimodular_list_by_scale_power(p) - ## Make a list of species (including the two zero-dim'l forms missing at either end of the list of Jordan blocks) + # Make a list of species (including the two zero-dim'l forms missing at either end of the list of Jordan blocks) species_list = [] for tmp_Q in jordan_list: - ## Some useful variables + # Some useful variables n = tmp_Q.dim() d = tmp_Q.det() - ## Determine the species - if (n % 2 != 0): ## Deal with odd dim'l forms + # Determine the species + if (n % 2 != 0): # Deal with odd dim'l forms species = n - elif (n % 4 == 2) and (p % 4 == 3): ## Deal with even dim'l forms + elif (n % 4 == 2) and (p % 4 == 3): # Deal with even dim'l forms species = (-1) * legendre_symbol(d, p) * n else: species = legendre_symbol(d, p) * n - ## Append the species to the list + # Append the species to the list species_list.append(species) - ## Return the species list + # Return the species list return species_list @@ -253,33 +252,33 @@ def conway_species_list_at_2(self): [1, 3, 1, 1, 1] """ - ## Some useful variables + # Some useful variables n = self.dim() d = self.det() - ## Deal with the zero-dim'l form + # Deal with the zero-dim'l form if n == 0: return 0 - ## List the (unscaled/unimodular) Jordan blocks by their scale power + # List the (unscaled/unimodular) Jordan blocks by their scale power jordan_list = self.jordan_blocks_in_unimodular_list_by_scale_power(2) - ## Make a list of species (including the two zero-dim'l forms missing at either end of the list of Jordan blocks) + # Make a list of species (including the two zero-dim'l forms missing at either end of the list of Jordan blocks) species_list = [] - if jordan_list[0].parity() == "odd": ## Add an entry for the unlisted "-1" Jordan component as well. + if jordan_list[0].parity() == "odd": # Add an entry for the unlisted "-1" Jordan component as well. species_list.append(1) - for i in range(len(jordan_list)): ## Add an entry for each (listed) Jordan component + for i in range(len(jordan_list)): # Add an entry for each (listed) Jordan component - ## Make the number 2*t in the C-S Table 1. + # Make the number 2*t in the C-S Table 1. d = jordan_list[i].dim() if jordan_list[i].is_even(): two_t = d else: two_t = ZZ(2) * ((d-1) // 2) - ## Determine if the form is bound + # Determine if the form is bound if len(jordan_list) == 1: is_bound = False elif i == 0: @@ -289,7 +288,7 @@ def conway_species_list_at_2(self): else: is_bound = jordan_list[i-1].is_odd() or jordan_list[i+1].is_odd() - ## Determine the species + # Determine the species octane = jordan_list[i].conway_octane_of_this_unimodular_Jordan_block_at_2() if is_bound or (octane == 2) or (octane == 6): species = two_t + 1 @@ -298,14 +297,14 @@ def conway_species_list_at_2(self): else: species = (-1) * two_t - ## Append the species to the list + # Append the species to the list species_list.append(species) - if jordan_list[-1].is_odd(): ## Add an entry for the unlisted "s_max + 1" Jordan component as well. + if jordan_list[-1].is_odd(): # Add an entry for the unlisted "s_max + 1" Jordan component as well. species_list.append(1) - ## Return the species list + # Return the species list return species_list @@ -341,7 +340,7 @@ def conway_octane_of_this_unimodular_Jordan_block_at_2(self): 7 """ - ## Deal with 'even' forms + # Deal with 'even' forms if self.parity() == "even": d = self.Gram_matrix().det() if (d % 8 == 1) or (d % 8 == 7): @@ -349,48 +348,48 @@ def conway_octane_of_this_unimodular_Jordan_block_at_2(self): else: return 4 - ## Deal with 'odd' forms by diagonalizing, and then computing the octane. + # Deal with 'odd' forms by diagonalizing, and then computing the octane. n = self.dim() u = self[0,0] tmp_diag_vec = [None for i in range(n)] - tmp_diag_vec[0] = u ## This should be an odd integer! - ind = 1 ## The next index to diagonalize + tmp_diag_vec[0] = u # This should be an odd integer! + ind = 1 # The next index to diagonalize - ## Use u to diagonalize the form -- WHAT ARE THE POSSIBLE LOCAL NORMAL FORMS? + # Use u to diagonalize the form -- WHAT ARE THE POSSIBLE LOCAL NORMAL FORMS? while ind < n: - ## Check for a 1x1 block and diagonalize it + # Check for a 1x1 block and diagonalize it if (ind == (n-1)) or (self[ind, ind+1] == 0): tmp_diag_vec[ind] = self[ind, ind] ind += 1 - ## Diagonalize the 2x2 block + # Diagonalize the 2x2 block else: B = self[ind, ind+1] if (B % 2 != 0): - raise RuntimeError("Oops, we expected the mixed term to be even! ") + raise RuntimeError("we expected the mixed term to be even") a = self[ind, ind] b = ZZ(B / ZZ(2)) c = self[ind+1, ind+1] tmp_disc = b * b - a * c - ## Perform the diagonalization - if (tmp_disc % 8 == 1): ## 2xy + # Perform the diagonalization + if (tmp_disc % 8 == 1): # 2xy tmp_diag_vec[ind] = 1 tmp_diag_vec[ind+1] = -1 ind += 2 - elif(tmp_disc % 8 == 5): ## 2x^2 + 2xy + 2y^2 + elif(tmp_disc % 8 == 5): # 2x^2 + 2xy + 2y^2 tmp_diag_vec[0] = 3*u tmp_diag_vec[ind] = -u tmp_diag_vec[ind+1] = -u ind += 2 u = tmp_diag_vec[0] else: - raise RuntimeError("Oops! This should not happen -- the odd 2x2 blocks have disc 1 or 5 (mod 8).") + raise RuntimeError("this should not happen -- the odd 2x2 blocks have disc 1 or 5 (mod 8)") - ## Compute the octane + # Compute the octane octane = 0 for a in tmp_diag_vec: if a % 4 == 1: @@ -398,13 +397,12 @@ def conway_octane_of_this_unimodular_Jordan_block_at_2(self): elif a % 4 == 3: octane += -1 else: - raise RuntimeError("Oops! The diagonal elements should all be odd... =(") + raise RuntimeError("the diagonal elements should all be odd") - ## Return its value + # Return its value return octane % 8 - def conway_diagonal_factor(self, p): """ Computes the diagonal factor of Conway's `p`-mass. @@ -424,29 +422,28 @@ def conway_diagonal_factor(self, p): 81/256 """ - ## Get the species list at p + # Get the species list at p if p == 2: species_list = self.conway_species_list_at_2() else: species_list = self.conway_species_list_at_odd_prime(p) - ## Evaluate the diagonal factor + # Evaluate the diagonal factor diag_factor = QQ(1) for s in species_list: if s == 0: pass - elif s % 2 == 1: ## Note: Here always s > 0. + elif s % 2 == 1: # Note: Here always s > 0. diag_factor = diag_factor / (2 * prod([1 - QQ(p)**(-i) for i in range(2, s, 2)])) else: diag_factor = diag_factor / (2 * prod([1 - QQ(p)**(-i) for i in range(2, abs(s), 2)])) s_sign = ZZ(s / abs(s)) diag_factor = diag_factor / (ZZ(1) - s_sign * QQ(p) ** ZZ(-abs(s) / ZZ(2))) - ## Return the diagonal factor + # Return the diagonal factor return diag_factor - def conway_cross_product_doubled_power(self, p): """ Computes twice the power of p which evaluates the 'cross product' @@ -475,7 +472,6 @@ def conway_cross_product_doubled_power(self, p): 0 sage: Q.conway_cross_product_doubled_power(13) 0 - """ doubled_power = 0 dim_list = [J.dim() for J in self.jordan_blocks_in_unimodular_list_by_scale_power(p)] @@ -486,7 +482,6 @@ def conway_cross_product_doubled_power(self, p): return doubled_power - def conway_type_factor(self): """ This is a special factor only present in the mass formula when `p=2`. @@ -513,7 +508,6 @@ def conway_type_factor(self): return ZZ(2)**(n11 - n2) - def conway_p_mass(self, p): """ Computes Conway's `p`-mass. @@ -535,18 +529,17 @@ def conway_p_mass(self, p): 729/256 """ - ## Compute the first two factors of the p-mass + # Compute the first two factors of the p-mass p_mass = self.conway_diagonal_factor(p) * (p ** (self.conway_cross_product_doubled_power(p) / ZZ(2))) - ## Multiply by the 'type factor' when p = 2 + # Multiply by the 'type factor' when p = 2 if p == 2: p_mass *= self.conway_type_factor() - ## Return the result + # Return the result return p_mass - def conway_standard_p_mass(self, p): """ Computes the standard (generic) Conway-Sloane `p`-mass. @@ -566,26 +559,25 @@ def conway_standard_p_mass(self, p): 2/3 """ - ## Some useful variables + # Some useful variables n = self.dim() if n % 2 == 0: s = n // 2 else: s = (n+1) // 2 - ## Compute the inverse of the generic p-mass + # Compute the inverse of the generic p-mass p_mass_inv = 2 * prod([1-p**(-i) for i in range(2, 2*s, 2)]) if n % 2 == 0: - D = (-1)**s * self.det() * (2**n) ## We should have something like D = (-1)**s * self.det() / (2**n), but that's not an integer and here we only care about the square-class. - #d = self.det() ## Note: No normalizing power of 2 is needed since the power is even. + D = (-1)**s * self.det() * (2**n) # We should have something like D = (-1)**s * self.det() / (2**n), but that's not an integer and here we only care about the square-class. + #d = self.det() # Note: No normalizing power of 2 is needed since the power is even. #if not ((p == 2) or (d % p == 0)): p_mass_inv *= (1 - kronecker_symbol(fundamental_discriminant(D), p) * p**(-s)) - ## Return the standard p-mass + # Return the standard p-mass return ZZ(1) / p_mass_inv - def conway_standard_mass(self): """ Returns the infinite product of the standard mass factors. @@ -622,13 +614,12 @@ def conway_standard_mass(self): * prod([zeta__exact(2*k) for k in range(1, s)]) if n % 2 == 0: - D = (-1)**s * self.det() * (2**n) ## We should have something like D = (-1)**s * self.det() / (2**n), but that's not an integer and here we only care about the square-class. + D = (-1)**s * self.det() * (2**n) # We should have something like D = (-1)**s * self.det() / (2**n), but that's not an integer and here we only care about the square-class. generic_mass *= quadratic_L_function__exact(s, D) return generic_mass - def conway_mass(self): """ Compute the mass by using the Conway-Sloane mass formula. @@ -655,7 +646,7 @@ def conway_mass(self): sage: Q.conway_mass() 1/12 """ - ## Try to use the cached result + # Try to use the cached result try: return self.__conway_mass except AttributeError: @@ -698,29 +689,22 @@ def conway_mass(self): # else: # s = (n-1) / 2 # -# ## Form the generic zeta product +# # Form the generic zeta product # ans = 2 * RR(pi)^(-n * (n+1) / 4) # for j in range(1,n+1): # ans *= gamma(RR(j/2)) -# for j in range(2, 2*s, 2): ## j = 2, ..., 2s-2 +# for j in range(2, 2*s, 2): # j = 2, ..., 2s-2 # ans *= zeta(RR(j)) # -# ## Extra L-factor for even dimensional forms -- DO THIS!!! +# # Extra L-factor for even dimensional forms -- DO THIS!!! # raise NotImplementedError, "This routine is not finished yet... =(" # -# ## Return the answer +# # Return the answer # return ans - - - - #def conway_p_mass_adjustment(self, p): # """ # Computes the adjustment to give the p-mass from the generic mass. # """ # pass - - -######################################################################## 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 9301bd2efcc..8e1203debbf 100644 --- a/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +++ b/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py @@ -2,19 +2,18 @@ Local Masses and Siegel Densities """ ######################################################################## -## Computes the local masses (rep'n densities of a form by itself) for a quadratic forms over ZZ -## using the papers of Pall [PSPUM VIII (1965), pp95--105] for p>2, and Watson [Mathematika -## 23, no. 1, (1976), pp 94--106] for p=2. These formulas will also work for any local field -## which is unramified at p=2. +# Computes the local masses (rep'n densities of a form by itself) for a quadratic forms over ZZ +# using the papers of Pall [PSPUM VIII (1965), pp95--105] for p>2, and Watson [Mathematika +# 23, no. 1, (1976), pp 94--106] for p=2. These formulas will also work for any local field +# which is unramified at p=2. ## -## Copyright by Jonathan Hanke 2007 +# Copyright by Jonathan Hanke 2007 ######################################################################## import copy from sage.misc.misc_c import prod from sage.misc.mrange import mrange -from sage.functions.all import floor from sage.rings.integer_ring import ZZ from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.rings.rational_field import QQ @@ -60,18 +59,18 @@ def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson sage: m - (2^Q.dim() * factorial(Q.dim()))^(-1) 0 """ - ## Setup + # Setup n = self.dim() s = (n-1) // 2 if n % 2 != 0: - char_d = squarefree_part(2*self.det()) ## Accounts for the det as a QF + char_d = squarefree_part(2*self.det()) # Accounts for the det as a QF else: char_d = squarefree_part(self.det()) - ## Form the generic zeta product + # Form the generic zeta product generic_prod = ZZ(2) * (pi)**(-ZZ(n) * (n+1) / 4) ########################################## - generic_prod *= (self.det())**(ZZ(n+1)/2) ## ***** This uses the Hessian Determinant ******** + generic_prod *= (self.det())**(ZZ(n+1)/2) # ***** This uses the Hessian Determinant ******** ########################################## generic_prod *= prod([gamma__exact(ZZ(j)/2) for j in range(1,n+1)]) generic_prod *= prod([zeta__exact(ZZ(j)) for j in range(2, 2*s+1, 2)]) @@ -80,7 +79,7 @@ def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson # Determine the adjustment factors adj_prod = ZZ.one() for p in prime_divisors(2 * self.det()): - ## Cancel out the generic factors + # 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)) @@ -105,7 +104,7 @@ def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson #if (n == 2): # generic_prod *= 2 - ## Return the mass + # Return the mass mass = generic_prod * adj_prod return mass @@ -138,16 +137,16 @@ def Pall_mass_density_at_odd_prime(self, p): [ * * 1 ])] [(0, 3, 8)] [8/9] 8/9 8/9 """ - ## Check that p is a positive prime -- unnecessary since it's done implicitly in the next step. =) - if p<=2: - raise TypeError("Oops! We need p to be a prime > 2.") + # Check that p is a positive prime -- unnecessary since it's done implicitly in the next step. =) + if p <= 2: + raise TypeError("we need p to be a prime > 2") - ## Step 1: Obtain a p-adic (diagonal) local normal form, and - ## compute the invariants for each Jordan block. + # Step 1: Obtain a p-adic (diagonal) local normal form, and + # 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) + modified_jordan_list = [(a, Q.dim(), Q.det()) for (a,Q) in jordan_list] # List of pairs (scale, det) - ## Step 2: Compute the list of local masses for each Jordan block + # 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)]) @@ -157,17 +156,17 @@ def Pall_mass_density_at_odd_prime(self, p): jordan_mass_list = jordan_mass_list + [generic_factor] - ## Step 3: Compute the local mass $\al_p$ at p. + # Step 3: Compute the local mass $\al_p$ at 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. + 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. 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 print(jordan_list, MJL, jordan_mass_list, p_mass) - ## Return the result + # Return the result return p_mass @@ -188,34 +187,34 @@ def Watson_mass_at_2(self): EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) - sage: Q.Watson_mass_at_2() ## WARNING: WE NEED TO CHECK THIS CAREFULLY! + sage: Q.Watson_mass_at_2() # WARNING: WE NEED TO CHECK THIS CAREFULLY! 384 """ - ## Make a 0-dim'l quadratic form (for initialization purposes) + # Make a 0-dim'l quadratic form (for initialization purposes) Null_Form = copy.deepcopy(self) Null_Form.__init__(ZZ, 0) - ## Step 0: Compute Jordan blocks and bounds of the scales to keep track of + # Step 0: Compute Jordan blocks and bounds of the scales to keep track of Jordan_Blocks = self.jordan_blocks_by_scale_and_unimodular(2) scale_list = [B[0] for B in Jordan_Blocks] s_min = min(scale_list) s_max = max(scale_list) - ## Step 1: Compute dictionaries of the diagonal block and 2x2 block for each scale - diag_dict = dict((i, Null_Form) for i in range(s_min-2, s_max + 4)) ## Initialize with the zero form - dim2_dict = dict((i, Null_Form) for i in range(s_min, s_max + 4)) ## Initialize with the zero form + # Step 1: Compute dictionaries of the diagonal block and 2x2 block for each scale + diag_dict = dict((i, Null_Form) for i in range(s_min-2, s_max + 4)) # Initialize with the zero form + dim2_dict = dict((i, Null_Form) for i in range(s_min, s_max + 4)) # Initialize with the zero form for (s,L) in Jordan_Blocks: i = 0 - while (i < L.dim()-1) and (L[i,i+1] == 0): ## Find where the 2x2 blocks start + while (i < L.dim()-1) and (L[i,i+1] == 0): # Find where the 2x2 blocks start i = i + 1 if i < (L.dim() - 1): - diag_dict[s] = L.extract_variables(range(i)) ## Diagonal Form - dim2_dict[s+1] = L.extract_variables(range(i, L.dim())) ## Non-diagonal Form + diag_dict[s] = L.extract_variables(range(i)) # Diagonal Form + dim2_dict[s+1] = L.extract_variables(range(i, L.dim())) # Non-diagonal Form else: diag_dict[s] = L - ## Step 2: Compute three dictionaries of invariants (for n_j, m_j, nu_j) + # 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)) for (s,L) in Jordan_Blocks: @@ -223,12 +222,12 @@ def Watson_mass_at_2(self): if diag_dict[s].dim() == 0: m_dict[s+1] = ZZ.one()/ZZ(2) * L.dim() else: - m_dict[s+1] = floor(ZZ(L.dim() - 1) / ZZ(2)) + m_dict[s+1] = 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 - ## Step 3: Compute the e_j dictionary + # Step 3: Compute the e_j dictionary eps_dict = {} for j in range(s_min, s_max+3): two_form = (diag_dict[j-2] + diag_dict[j] + dim2_dict[j]).scale_by_factor(2) @@ -247,14 +246,14 @@ def Watson_mass_at_2(self): else: eps_dict[j] = -1 - ## Step 4: Compute the quantities nu, q, P, E for the local mass at 2 + # 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)]) q = sum([sgn(nu_dict[j-1] * (n_dict[j] + sgn(nu_dict[j]))) for j in range(s_min+1, s_max+2)]) P = prod([prod([1 - QQ(4)**(-k) for k in range(1, m_dict[j]+1)]) for j in range(s_min+1, s_max+2)]) E = prod([ZZ(1)/ZZ(2) * (1 + eps_dict[j] * QQ(2)**(-m_dict[j])) for j in range(s_min, s_max+3)]) - ## Step 5: Compute the local mass for the prime 2. + # Step 5: Compute the local mass for the prime 2. mass_at_2 = QQ(2)**(nu - q) * P / E return mass_at_2 @@ -276,57 +275,57 @@ def Kitaoka_mass_at_2(self): EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) - sage: Q.Kitaoka_mass_at_2() ## WARNING: WE NEED TO CHECK THIS CAREFULLY! + sage: Q.Kitaoka_mass_at_2() # WARNING: WE NEED TO CHECK THIS CAREFULLY! 1/2 """ - ## Make a 0-dim'l quadratic form (for initialization purposes) + # Make a 0-dim'l quadratic form (for initialization purposes) Null_Form = copy.deepcopy(self) Null_Form.__init__(ZZ, 0) - ## Step 0: Compute Jordan blocks and bounds of the scales to keep track of + # Step 0: Compute Jordan blocks and bounds of the scales to keep track of Jordan_Blocks = self.jordan_blocks_by_scale_and_unimodular(2) scale_list = [B[0] for B in Jordan_Blocks] s_min = min(scale_list) s_max = max(scale_list) - ## Step 1: Compute dictionaries of the diagonal block and 2x2 block for each scale - diag_dict = dict((i, Null_Form) for i in range(s_min-2, s_max + 4)) ## Initialize with the zero form - dim2_dict = dict((i, Null_Form) for i in range(s_min, s_max + 4)) ## Initialize with the zero form + # Step 1: Compute dictionaries of the diagonal block and 2x2 block for each scale + diag_dict = dict((i, Null_Form) for i in range(s_min-2, s_max + 4)) # Initialize with the zero form + dim2_dict = dict((i, Null_Form) for i in range(s_min, s_max + 4)) # Initialize with the zero form for (s,L) in Jordan_Blocks: i = 0 - while (i < L.dim()-1) and (L[i,i+1] == 0): ## Find where the 2x2 blocks start + while (i < L.dim()-1) and (L[i,i+1] == 0): # Find where the 2x2 blocks start i = i + 1 if i < (L.dim() - 1): - diag_dict[s] = L.extract_variables(range(i)) ## Diagonal Form - dim2_dict[s+1] = L.extract_variables(range(i, L.dim())) ## Non-diagonal Form + diag_dict[s] = L.extract_variables(range(i)) # Diagonal Form + dim2_dict[s+1] = L.extract_variables(range(i, L.dim())) # Non-diagonal Form else: diag_dict[s] = L - ################## START EDITING HERE ################## + ################# START EDITING HERE ################## - ## Compute q := sum of the q_j + # Compute q := sum of the q_j q = 0 for j in range(s_min, s_max + 1): - if diag_dict[j].dim() > 0: ## Check that N_j is odd (i.e. rep'ns an odd #) + if diag_dict[j].dim() > 0: # Check that N_j is odd (i.e. rep'ns an odd #) if diag_dict[j+1].dim() == 0: - q += Jordan_Blocks[j][1].dim() ## When N_{j+1} is "even", add n_j + q += Jordan_Blocks[j][1].dim() # When N_{j+1} is "even", add n_j else: - q += Jordan_Blocks[j][1].dim() + 1 ## When N_{j+1} is "odd", add n_j + 1 + q += Jordan_Blocks[j][1].dim() + 1 # When N_{j+1} is "odd", add n_j + 1 - ## Compute P = product of the P_j + # Compute P = product of the P_j P = QQ.one() for j in range(s_min, s_max + 1): tmp_m = dim2_dict[j].dim() // 2 P *= prod(QQ.one() - QQ(4**(-k)) for k in range(1, tmp_m + 1)) - ## Compute the product E := prod_j (1 / E_j) + # Compute the product E := prod_j (1 / E_j) E = QQ.one() for j in range(s_min - 1, s_max + 2): if (diag_dict[j-1].dim() == 0) and (diag_dict[j+1].dim() == 0) and \ ((diag_dict[j].dim() != 2) or (((diag_dict[j][0,0] - diag_dict[j][1,1]) % 4) != 0)): - ## Deal with the complicated case: + # Deal with the complicated case: tmp_m = dim2_dict[j].dim() // 2 if dim2_dict[j].is_hyperbolic(2): E *= QQ(2) / (1 + 2**(-tmp_m)) @@ -344,7 +343,7 @@ 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. + # Step 5: Compute the local mass for the prime 2. mass_at_2 = (QQ(2)**(w - q)) * P * E return mass_at_2 @@ -355,30 +354,29 @@ def mass_at_two_by_counting_mod_power(self, k): Note: This is **way** too slow to be useful, even when k=1!!! - TO DO: Remove this routine, or try to compile it! + .. TODO:: + Remove this routine, or try to compile it! INPUT: - k -- an integer >= 1 + - k -- an integer >= 1 OUTPUT: - a rational number + a rational number EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) sage: Q.mass_at_two_by_counting_mod_power(1) 4 - """ R = IntegerModRing(2**k) Q1 = self.base_change_to(R) n = self.dim() MS = MatrixSpace(R, n) - ct = sum([1 for x in mrange([2**k] * (n**2)) if Q1(MS(x)) == Q1]) ## Count the solutions mod 2^k + ct = sum([1 for x in mrange([2**k] * (n**2)) if Q1(MS(x)) == Q1]) # Count the solutions mod 2^k two_mass = ZZ(1)/2 * (ZZ(ct) / ZZ(2)**(k*n*(n-1)/2)) return two_mass - diff --git a/src/sage/quadratic_forms/quadratic_form__neighbors.py b/src/sage/quadratic_forms/quadratic_form__neighbors.py index 140a0767c72..6c38d7784ee 100644 --- a/src/sage/quadratic_forms/quadratic_form__neighbors.py +++ b/src/sage/quadratic_forms/quadratic_form__neighbors.py @@ -397,6 +397,3 @@ def orbits_lines_mod_p(self, p): orbs_reps = orbs(gens, p) M = GF(p)**self.dim() return [M(m.sage()) for m in orbs_reps if not m.IsZero()] - - - diff --git a/src/sage/quadratic_forms/quadratic_form__reduction_theory.py b/src/sage/quadratic_forms/quadratic_form__reduction_theory.py index db92ce8f139..16c89f6edf2 100644 --- a/src/sage/quadratic_forms/quadratic_form__reduction_theory.py +++ b/src/sage/quadratic_forms/quadratic_form__reduction_theory.py @@ -38,14 +38,14 @@ def reduced_binary_form1(self): while not interior_reduced_flag: interior_reduced_flag = True - ## Arrange for a <= c + # Arrange for a <= c if Q[0,0] > Q[1,1]: M_new = matrix(R,2,2,[0, -1, 1, 0]) Q = Q(M_new) M = M * M_new interior_reduced_flag = False - ## Arrange for |b| <= a + # Arrange for |b| <= a if abs(Q[0,1]) > Q[0,0]: r = R(floor(round(Q[0,1]/(2*Q[0,0])))) M_new = matrix(R,2,2,[1, -r, 0, 1]) @@ -56,8 +56,6 @@ def reduced_binary_form1(self): return Q, M - - def reduced_ternary_form__Dickson(self): """ Find the unique reduced ternary form according to the conditions @@ -69,11 +67,9 @@ def reduced_ternary_form__Dickson(self): sage: Q.reduced_ternary_form__Dickson() Traceback (most recent call last): ... - NotImplementedError: TO DO - + NotImplementedError """ - raise NotImplementedError("TO DO") - + raise NotImplementedError def reduced_binary_form(self): @@ -101,11 +97,10 @@ def reduced_binary_form(self): for i in range(n): M[i,i] = 1 - while not interior_reduced_flag: interior_reduced_flag = True - ## Arrange for (weakly) increasing diagonal entries + # Arrange for (weakly) increasing diagonal entries for i in range(n): for j in range(i+1,n): if Q[i,i] > Q[j,j]: @@ -121,7 +116,7 @@ def reduced_binary_form(self): M = M * M_new interior_reduced_flag = False - ## Arrange for |b| <= a + # Arrange for |b| <= a if abs(Q[i,j]) > Q[i,i]: r = R(floor(round(Q[i,j]/(2*Q[i,i])))) @@ -151,6 +146,7 @@ def minkowski_reduction(self): Note: When Q has dim <= 4 we can take all `s_i` in {1, 0, -1}. References: + Schulze-Pillot's paper on "An algorithm for computing genera of ternary and quaternary quadratic forms", p138. Donaldson's 1979 paper "Minkowski Reduction of Integral @@ -181,7 +177,7 @@ def minkowski_reduction(self): :: - sage: Q=QuadraticForm(ZZ,4,[1, -2, 0, 0, 2, 0, 0, 2, 0, 2]) + sage: Q = QuadraticForm(ZZ,4,[1, -2, 0, 0, 2, 0, 0, 2, 0, 2]) sage: Q Quadratic form in 4 variables over Integer Ring with coefficients: [ 1 -2 0 0 ] @@ -202,9 +198,7 @@ def minkowski_reduction(self): [0 0 0 1] ) - :: - - sage: Q=QuadraticForm(ZZ,5,[2,2,0,0,0,2,2,0,0,2,2,0,2,2,2]) + sage: Q = QuadraticForm(ZZ,5,[2,2,0,0,0,2,2,0,0,2,2,0,2,2,2]) sage: Q.Gram_matrix() [2 1 0 0 0] [1 2 1 0 0] @@ -214,14 +208,14 @@ def minkowski_reduction(self): sage: Q.minkowski_reduction() Traceback (most recent call last): ... - NotImplementedError: This algorithm is only for dimensions less than 5 + NotImplementedError: this algorithm is only for dimensions less than 5 """ from sage.quadratic_forms.quadratic_form import QuadraticForm from sage.quadratic_forms.quadratic_form import matrix if not self.is_positive_definite(): raise TypeError("Minkowski reduction only works for positive definite forms") if self.dim() > 4: - raise NotImplementedError("This algorithm is only for dimensions less than 5") + raise NotImplementedError("this algorithm is only for dimensions less than 5") R = self.base_ring() n = self.dim() @@ -230,11 +224,11 @@ def minkowski_reduction(self): for i in range(n): M[i, i] = 1 - ## Begin the reduction + # Begin the reduction done_flag = False while not done_flag: - ## Loop through possible shorted vectors until + # Loop through possible shorted vectors until done_flag = True for j in range(n-1, -1, -1): for a_first in mrange([3 for i in range(j)]): @@ -242,17 +236,17 @@ def minkowski_reduction(self): e_j = [0 for k in range(n)] e_j[j] = 1 - ## Reduce if a shorter vector is found + # Reduce if a shorter vector is found if Q(y) < Q(e_j): - ## Create the transformation matrix + # Create the transformation matrix M_new = matrix(R, n, n) for k in range(n): M_new[k,k] = 1 for k in range(n): M_new[k,j] = y[k] - ## Perform the reduction and restart the loop + # Perform the reduction and restart the loop Q = QuadraticForm(M_new.transpose()*Q.matrix()*M_new) M = M * M_new done_flag = False @@ -263,12 +257,10 @@ def minkowski_reduction(self): if not done_flag: break - ## Return the results + # Return the results return Q, M - - def minkowski_reduction_for_4vars__SP(self): """ Find a Minkowski-reduced form equivalent to the given one. @@ -316,17 +308,15 @@ def minkowski_reduction_for_4vars__SP(self): for i in range(n): M[i, i] = 1 - ## Only allow 4-variable forms + # Only allow 4-variable forms if n != 4: - raise TypeError("Oops! The given quadratic form has " + str(n) + \ - " != 4 variables. =|") + raise TypeError(f"the given quadratic form has {n} != 4 variables") - - ## Step 1: Begin the reduction + # Step 1: Begin the reduction done_flag = False while not done_flag: - ## Loop through possible shorter vectors + # Loop through possible shorter vectors done_flag = True for j in range(n-1, -1, -1): for a_first in mrange([2 for i in range(j)]): @@ -334,14 +324,14 @@ def minkowski_reduction_for_4vars__SP(self): e_j = [0 for k in range(n)] e_j[j] = 1 - ## Reduce if a shorter vector is found + # Reduce if a shorter vector is found if Q(y) < Q(e_j): - ## Further n=4 computations + # Further n=4 computations B_y_vec = Q.matrix() * vector(ZZ, y) - ## SP's B = our self.matrix()/2 - ## SP's A = coeff matrix of his B - ## Here we compute the double of both and compare. + # SP's B = our self.matrix()/2 + # SP's A = coeff matrix of his B + # Here we compute the double of both and compare. B_sum = sum([abs(B_y_vec[i]) for i in range(4) if i != j]) A_sum = sum([abs(Q[i,j]) for i in range(4) if i != j]) B_max = max([abs(B_y_vec[i]) for i in range(4) if i != j]) @@ -349,14 +339,14 @@ def minkowski_reduction_for_4vars__SP(self): if (B_sum < A_sum) or ((B_sum == A_sum) and (B_max < A_max)): - ## Create the transformation matrix + # Create the transformation matrix M_new = matrix(R, n, n) for k in range(n): M_new[k,k] = 1 for k in range(n): M_new[k,j] = y[k] - ## Perform the reduction and restart the loop + # Perform the reduction and restart the loop Q = Q(M_new) M = M * M_new done_flag = False @@ -367,11 +357,11 @@ def minkowski_reduction_for_4vars__SP(self): if not done_flag: break - ## Step 2: Order A by certain criteria + # Step 2: Order A by certain criteria for i in range(4): for j in range(i+1,4): - ## Condition (a) + # Condition (a) if (Q[i,i] > Q[j,j]): Q.swap_variables(i,j,in_place=True) M_new = matrix(R,n,n) @@ -388,7 +378,7 @@ def minkowski_reduction_for_4vars__SP(self): i_sum = sum([abs(Q[i,k]) for k in range(4) if k != i]) j_sum = sum([abs(Q[j,k]) for k in range(4) if k != j]) - ## Condition (b) + # Condition (b) if (i_sum > j_sum): Q.swap_variables(i,j,in_place=True) M_new = matrix(R,n,n) @@ -402,14 +392,14 @@ def minkowski_reduction_for_4vars__SP(self): M = M * M_new elif (i_sum == j_sum): - for k in [2,1,0]: ## TO DO: These steps are a little redundant... + for k in [2,1,0]: # TO DO: These steps are a little redundant... Q1 = Q.matrix() c_flag = True for l in range(k+1,4): c_flag = c_flag and (abs(Q1[i,l]) == abs(Q1[j,l])) - ## Condition (c) + # Condition (c) if c_flag and (abs(Q1[i,k]) > abs(Q1[j,k])): Q.swap_variables(i,j,in_place=True) M_new = matrix(R,n,n) @@ -422,8 +412,7 @@ def minkowski_reduction_for_4vars__SP(self): M_new[r,r] = 1 M = M * M_new - - ## Step 3: Order the signs + # Step 3: Order the signs for i in range(4): if Q[i,3] < 0: Q.multiply_variable(-1, i, in_place=True) @@ -450,7 +439,7 @@ def minkowski_reduction_for_4vars__SP(self): M = M * M_new if Q[1,2] < 0: - ## Test a row 1 sign change + # Test a row 1 sign change if (Q[1,3] <= 0 and \ ((Q[1,3] < 0) or (Q[1,3] == 0 and Q[1,2] < 0) \ or (Q[1,3] == 0 and Q[1,2] == 0 and Q[1,1] < 0))): @@ -475,8 +464,5 @@ def minkowski_reduction_for_4vars__SP(self): M_new[r,r] = 1 M = M * M_new - - ## Return the results + # Return the results return Q, M - - diff --git a/src/sage/quadratic_forms/quadratic_form__siegel_product.py b/src/sage/quadratic_forms/quadratic_form__siegel_product.py index eb2bff7f6cc..1cf72a23745 100644 --- a/src/sage/quadratic_forms/quadratic_form__siegel_product.py +++ b/src/sage/quadratic_forms/quadratic_form__siegel_product.py @@ -45,7 +45,7 @@ def siegel_product(self, u): sage: Q.siegel_product(1) 8 - sage: Q.siegel_product(2) ## This one is wrong -- expect 24, and the higher powers of 2 don't work... =( + sage: Q.siegel_product(2) # This one is wrong -- expect 24, and the higher powers of 2 don't work... =( 24 sage: Q.siegel_product(3) 32 @@ -77,34 +77,34 @@ def siegel_product(self, u): sage: [1] + [Q.siegel_product(ZZ(a)) for a in range(1,11)] == Q.theta_series(11).list() # long time (2s on sage.math, 2014) True """ - ## Protect u (since it fails often if it's an just an int!) + # Protect u (since it fails often if it's an just an int!) u = ZZ(u) n = self.dim() - d = self.det() ## ??? Warning: This is a factor of 2^n larger than it should be! + d = self.det() # ??? Warning: This is a factor of 2^n larger than it should be! # DIAGNOSTIC verbose("n = " + str(n)) verbose("d = " + str(d)) verbose("In siegel_product: d = " + str(d) + "\n") - ## Product of "bad" places to omit + # Product of "bad" places to omit S = 2 * d * u - ## DIAGNOSTIC + # DIAGNOSTIC verbose("siegel_product Break 1. \n") verbose(" u = " + str(u) + "\n") - ## Make the odd generic factors + # Make the odd generic factors if ((n % 2) == 1): m = (n-1) // 2 - d1 = fundamental_discriminant(((-1)**m) * 2*d * u) ## Replaced d by 2d here to compensate for the determinant - f = abs(d1) ## gaining an odd power of 2 by using the matrix of 2Q instead - ## of the matrix of Q. - ## --> Old d1 = CoreDiscriminant((mpz_class(-1)^m) * d * u); + d1 = fundamental_discriminant(((-1)**m) * 2*d * u) # Replaced d by 2d here to compensate for the determinant + f = abs(d1) # gaining an odd power of 2 by using the matrix of 2Q instead + # of the matrix of Q. + # --> Old d1 = CoreDiscriminant((mpz_class(-1)^m) * d * u); - ## Make the ratio of factorials factor: [(2m)! / m!] * prod_{i=1}^m (2*i-1) + # Make the ratio of factorials factor: [(2m)! / m!] * prod_{i=1}^m (2*i-1) factor1 = 1 for i in range(1, m+1): factor1 *= 2*i - 1 @@ -117,17 +117,17 @@ def siegel_product(self, u): - ## DIAGNOSTIC + # DIAGNOSTIC verbose("siegel_product Break 2. \n") - ## Make the even generic factor + # Make the even generic factor if ((n % 2) == 0): m = n // 2 d1 = fundamental_discriminant(((-1)**m) * d) f = abs(d1) - ## DIAGNOSTIC + # DIAGNOSTIC #cout << " mpz_class(-1)^m = " << (mpz_class(-1)^m) << " and d = " << d << endl; #cout << " f = " << f << " and d1 = " << d1 << endl; @@ -135,19 +135,19 @@ def siegel_product(self, u): genericfactor = m / QQ(sqrt(f*d)) \ * ((u/2) ** (m-1)) * (f ** m) \ / abs(QuadraticBernoulliNumber(m, d1)) \ - * (2 ** m) ## This last factor compensates for using the matrix of 2*Q + * (2 ** m) # This last factor compensates for using the matrix of 2*Q ##return genericfactor - ## Omit the generic factors in S and compute them separately + # Omit the generic factors in S and compute them separately omit = 1 include = 1 S_divisors = prime_divisors(S) - ## DIAGNOSTIC + # DIAGNOSTIC #cout << "\n S is " << S << endl; #cout << " The Prime divisors of S are :"; #PrintV(S_divisors); @@ -156,13 +156,13 @@ def siegel_product(self, u): Q_normal = self.local_normal_form(p) - ## DIAGNOSTIC + # DIAGNOSTIC verbose(" p = " + str(p) + " and its Kronecker symbol (d1/p) = (" + str(d1) + "/" + str(p) + ") is " + str(kronecker_symbol(d1, p)) + "\n") omit *= 1 / (1 - (kronecker_symbol(d1, p) / (p**m))) - ## DIAGNOSTIC + # DIAGNOSTIC verbose(" omit = " + str(omit) + "\n") verbose(" Q_normal is \n" + str(Q_normal) + "\n") verbose(" Q_normal = \n" + str(Q_normal)) @@ -172,10 +172,10 @@ def siegel_product(self, u): include *= Q_normal.local_density(p, u) - ## DIAGNOSTIC + # DIAGNOSTIC #cout << " Including the p = " << p << " factor: " << local_density(Q_normal, p, u) << endl; - ## DIAGNOSTIC + # DIAGNOSTIC verbose(" --- Exiting loop \n") #// **************** Important ******************* @@ -188,18 +188,17 @@ def siegel_product(self, u): # genericfactor = 4 * genericfactor; #*/ - ## DIAGNOSTIC + # DIAGNOSTIC #cout << endl; #cout << " generic factor = " << genericfactor << endl; #cout << " omit = " << omit << endl; #cout << " include = " << include << endl; #cout << endl; - ## DIAGNOSTIC + # DIAGNOSTIC #// cout << "siegel_product Break 3. " << endl; - ## Return the final factor (and divide by 2 if n=2) + # Return the final factor (and divide by 2 if n=2) if n == 2: return genericfactor * omit * include / 2 - else: - return genericfactor * omit * include + return genericfactor * omit * include diff --git a/src/sage/quadratic_forms/quadratic_form__split_local_covering.py b/src/sage/quadratic_forms/quadratic_form__split_local_covering.py index 84164d4fa9f..2fc02f60e56 100644 --- a/src/sage/quadratic_forms/quadratic_form__split_local_covering.py +++ b/src/sage/quadratic_forms/quadratic_form__split_local_covering.py @@ -1,10 +1,10 @@ """ Split Local Covering """ -######################################################################### -## Routines that look for a split local covering for a given quadratic ## -## form in 4 variables. ## -######################################################################### +####################################################################### +# Routines that look for a split local covering for a given quadratic # +# form in 4 variables. # +####################################################################### from copy import deepcopy @@ -83,31 +83,30 @@ def cholesky_decomposition(self, bit_prec = 53): [0.000000000000000 3.00000000000000 0.333333333333333] [0.000000000000000 0.000000000000000 3.41666666666667] """ - - ## Check that the precision passed is allowed. + # Check that the precision passed is allowed. if isinstance(self.base_ring(), sage.rings.abc.RealField) and (self.base_ring().prec() < bit_prec): - raise RuntimeError("Oops! The precision requested is greater than that of the given quadratic form!") + raise RuntimeError("the precision requested is greater than that of the given quadratic form") - ## 1. Initialization + # 1. Initialization n = self.dim() R = RealField(bit_prec) MS = MatrixSpace(R, n, n) - Q = MS(R(0.5)) * MS(self.matrix()) ## Initialize the real symmetric matrix A with the matrix for Q(x) = x^t * A * x + Q = MS(R(0.5)) * MS(self.matrix()) # Initialize the real symmetric matrix A with the matrix for Q(x) = x^t * A * x - ## DIAGNOSTIC + # DIAGNOSTIC - ## 2. Loop on i + # 2. Loop on i for i in range(n): for j in range(i+1, n): - Q[j,i] = Q[i,j] ## Is this line redundant? + Q[j,i] = Q[i,j] # Is this line redundant? Q[i,j] = Q[i,j] / Q[i,i] - ## 3. Main Loop + # 3. Main Loop for k in range(i+1, n): for l in range(k, n): Q[k,l] = Q[k,l] - Q[k,i] * Q[i,l] - ## 4. Zero out the strictly lower-triangular entries + # 4. Zero out the strictly lower-triangular entries for i in range(n): for j in range(i): Q[i,j] = 0 @@ -115,7 +114,6 @@ def cholesky_decomposition(self, bit_prec = 53): return Q - def vectors_by_length(self, bound): """ Returns a list of short vectors together with their values. @@ -137,9 +135,11 @@ def vectors_by_length(self, bound): increment step moved around and slightly re-indexed to allow clean looping. - Note: We could speed this up for very skew matrices by using LLL - first, and then changing coordinates back, but for our purposes - the simpler method is efficient enough. =) + .. NOTE:: + + We could speed this up for very skew matrices by using LLL + first, and then changing coordinates back, but for our purposes + the simpler method is efficient enough. EXAMPLES:: @@ -183,8 +183,8 @@ def vectors_by_length(self, bound): Theta_Precision = bound + eps n = self.dim() - ## Make the vector of vectors which have a given value - ## (So theta_vec[i] will have all vectors v with Q(v) = i.) + # Make the vector of vectors which have a given value + # (So theta_vec[i] will have all vectors v with Q(v) = i.) theta_vec = [[] for i in range(bound + 1)] # Initialize Q with zeros and Copy the Cholesky array into Q @@ -192,7 +192,7 @@ def vectors_by_length(self, bound): # 1. Initialize - T = n * [RDF(0)] ## Note: We index the entries as 0 --> n-1 + T = n * [RDF(0)] # Note: We index the entries as 0 --> n-1 U = n * [RDF(0)] i = n-1 T[i] = RDF(Theta_Precision) @@ -207,12 +207,12 @@ def vectors_by_length(self, bound): x[i] = (-Z - U[i]).ceil() done_flag = False - Q_val = 0 ## WARNING: Still need a good way of checking overflow for this value... + Q_val = 0 # WARNING: Still need a good way of checking overflow for this value... # Big loop which runs through all vectors while not done_flag: - ## 3b. Main loop -- try to generate a complete vector x (when i=0) + # 3b. Main loop -- try to generate a complete vector x (when i=0) while (i > 0): T[i-1] = T[i] - Q[i][i] * (x[i] + U[i]) * (x[i] + U[i]) i = i - 1 @@ -220,8 +220,8 @@ def vectors_by_length(self, bound): for j in range(i+1, n): U[i] = U[i] + Q[i][j] * x[j] - ## Now go back and compute the bounds... - ## 2. Compute bounds + # Now go back and compute the bounds... + # 2. Compute bounds Z = (T[i] / Q[i][i]).sqrt(extend=False) L[i] = ( Z - U[i]).floor() x[i] = (-Z - U[i]).ceil() @@ -254,7 +254,7 @@ def vectors_by_length(self, bound): done_flag = False j += 1 - ## 3a. Increment (and carry if we go out of bounds) + # 3a. Increment (and carry if we go out of bounds) x[i] += 1 while (x[i] > L[i]) and (i < n-1): i += 1 @@ -313,39 +313,39 @@ def complementary_subform_to_vector(self, v): """ n = self.dim() - ## Copy the quadratic form + # Copy the quadratic form Q = deepcopy(self) - ## Find the first non-zero component of v, and call it nz (Note: 0 <= nz < n) + # Find the first non-zero component of v, and call it nz (Note: 0 <= nz < n) nz = 0 while (nz < n) and (v[nz] == 0): nz += 1 - ## Abort if v is the zero vector + # Abort if v is the zero vector if nz == n: - raise TypeError("Oops, v cannot be the zero vector! =(") + raise TypeError("v cannot be the zero vector") - ## Make the change of basis matrix + # Make the change of basis matrix new_basis = extend_to_primitive(matrix(ZZ, n, 1, v)) - ## Change Q (to Q1) to have v as its nz-th basis vector + # Change Q (to Q1) to have v as its nz-th basis vector Q1 = Q(new_basis) - ## Pick out the value Q(v) of the vector + # Pick out the value Q(v) of the vector d = Q1[0, 0] - ## For each row/column, perform elementary operations to cancel them out. + # For each row/column, perform elementary operations to cancel them out. for i in range(1,n): - ## Check if the (i,0)-entry is divisible by d, - ## and stretch its row/column if not. + # Check if the (i,0)-entry is divisible by d, + # and stretch its row/column if not. if Q1[i,0] % d != 0: Q1 = Q1.multiply_variable(d / GCD(d, Q1[i, 0]//2), i) - ## Now perform the (symmetric) elementary operations to cancel out the (i,0) entries/ + # Now perform the (symmetric) elementary operations to cancel out the (i,0) entries/ Q1 = Q1.add_symmetric(-(Q1[i,0]/2) / (GCD(d, Q1[i,0]//2)), i, 0) - ## Check that we're done! + # Check that we're done! done_flag = True for i in range(1, n): if Q1[0,i] != 0: @@ -355,11 +355,10 @@ def complementary_subform_to_vector(self, v): raise RuntimeError("There is a problem cancelling out the matrix entries! =O") - ## Return the complementary matrix + # Return the complementary matrix return Q1.extract_variables(range(1,n)) - def split_local_cover(self): """ Tries to find subform of the given (positive definite quaternary) @@ -393,36 +392,35 @@ def split_local_cover(self): [ * * 7 ] """ - ## 0. If a split local cover already exists, then return it. + # 0. If a split local cover already exists, then return it. if hasattr(self, "__split_local_cover"): - if is_QuadraticForm(self.__split_local_cover): ## Here the computation has been done. + if is_QuadraticForm(self.__split_local_cover): # Here the computation has been done. return self.__split_local_cover - elif self.__split_local_cover in ZZ: ## Here it indexes the values already tried! + elif self.__split_local_cover in ZZ: # Here it indexes the values already tried! current_length = self.__split_local_cover + 1 Length_Max = current_length + 5 else: current_length = 1 Length_Max = 6 - ## 1. Find a range of new vectors + # 1. Find a range of new vectors all_vectors = self.vectors_by_length(Length_Max) current_vectors = all_vectors[current_length] - ## Loop until we find a split local cover... + # Loop until we find a split local cover... while True: - ## 2. Check if any of the primitive ones produce a split local cover + # 2. Check if any of the primitive ones produce a split local cover for v in current_vectors: Q = QuadraticForm__constructor(ZZ, 1, [current_length]) + self.complementary_subform_to_vector(v) if Q.local_representation_conditions() == self.local_representation_conditions(): self.__split_local_cover = Q return Q - ## 3. Save what we have checked and get more vectors. + # 3. Save what we have checked and get more vectors. self.__split_local_cover = current_length current_length += 1 if current_length >= len(all_vectors): Length_Max += 5 all_vectors = self.vectors_by_length(Length_Max) current_vectors = all_vectors[current_length] - diff --git a/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py b/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py index cacfc27774e..bbb2d2cd49e 100644 --- a/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +++ b/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py @@ -1,16 +1,15 @@ """ Tornaria Methods for Computing with Quadratic Forms """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2007 Gonzalo Tornaria # # 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.rings.integer_ring import ZZ from sage.misc.functional import is_odd @@ -25,7 +24,7 @@ from sage.modules.free_module_element import vector -## TO DO -- Add second argument +# TO DO -- Add second argument # def __call__(self,v,w=None): # if w is None: # return half(v * self._matrix_() * v) @@ -33,7 +32,6 @@ # return v * self._matrix_() * w - def disc(self): r""" Return the discriminant of the quadratic form, defined as @@ -60,8 +58,7 @@ def disc(self): if is_odd(self.dim()): # This is not so good for characteristic 2. return self.base_ring()(self.det() / 2) - else: - return (-1)**(self.dim() // 2) * self.det() + return (-1)**(self.dim() // 2) * self.det() def content(self): @@ -91,7 +88,7 @@ def content(self): return self.gcd() -## in quadratic_form.py +# in quadratic_form.py #def is_primitive(self): # """ # Checks if the form is a multiple of another form... only over ZZ for now. @@ -99,8 +96,7 @@ def content(self): # return self.content() == 1 - -## in quadratic_form.py +# in quadratic_form.py #def primitive(self): # """ # Return a primitive quadratic forms in the similarity class of the given form. @@ -112,7 +108,6 @@ def content(self): # return QuadraticForm(self.base_ring(), self.dim(), new_coeffs) - def adjoint(self): """ This gives the adjoint (integral) quadratic form associated to the @@ -137,9 +132,8 @@ def adjoint(self): """ if is_odd(self.dim()): - return QuadraticForm(self.matrix().adjoint_classical()*2) - else: - return QuadraticForm(self.matrix().adjoint_classical()) + return QuadraticForm(self.matrix().adjoint_classical() * 2) + return QuadraticForm(self.matrix().adjoint_classical()) def antiadjoint(self): @@ -231,6 +225,7 @@ def omega(self): """ return self.primitive().adjoint().content() + def delta(self): """ This is the omega of the adjoint form, @@ -241,7 +236,6 @@ def delta(self): sage: Q = DiagonalQuadraticForm(ZZ, [1,1,37]) sage: Q.delta() 148 - """ return self.adjoint().omega() @@ -268,7 +262,6 @@ def level__Tornaria(self): 1 sage: DiagonalQuadraticForm(ZZ, [1,1,1,1]).level__Tornaria() 4 - """ return self.base_ring()(abs(self.disc())/self.omega()/self.content()**self.dim()) @@ -286,14 +279,11 @@ def discrec(self): 5476 sage: [4 * 37, 4 * 37^2] [148, 5476] - """ return self.reciprocal().disc() - - -### Rational equivalence +# Rational equivalence def hasse_conductor(self): """ @@ -309,8 +299,6 @@ def hasse_conductor(self): sage: Q.hasse_conductor() 74 - :: - sage: DiagonalQuadraticForm(ZZ, [1, 1, 1]).hasse_conductor() 1 sage: QuadraticForm(ZZ, 3, [2, -2, 0, 2, 0, 5]).hasse_conductor() @@ -341,7 +329,6 @@ def clifford_invariant(self, p): 1 sage: (H + H + H + H).clifford_invariant(2) 1 - """ n = self.dim() % 8 if n == 1 or n == 2: @@ -359,9 +346,11 @@ def clifford_conductor(self): """ This is the product of all primes where the Clifford invariant is -1 - Note: For ternary forms, this is the discriminant of the - quaternion algebra associated to the quadratic space - (i.e. the even Clifford algebra) + ..NOTE:: + + For ternary forms, this is the discriminant of the + quaternion algebra associated to the quadratic space + (i.e. the even Clifford algebra). EXAMPLES:: @@ -373,8 +362,6 @@ def clifford_conductor(self): sage: Q.clifford_conductor() 37 - :: - sage: DiagonalQuadraticForm(ZZ, [1, 1, 1]).clifford_conductor() 2 sage: QuadraticForm(ZZ, 3, [2, -2, 0, 2, 0, 5]).clifford_conductor() @@ -396,11 +383,11 @@ def clifford_conductor(self): if self.clifford_invariant(x[0]) == -1]) -### Genus theory +# Genus theory def basiclemma(self, M): """ - Finds a number represented by self and coprime to M. + Find a number represented by self and coprime to M. EXAMPLES:: @@ -415,7 +402,7 @@ def basiclemma(self, M): def basiclemmavec(self, M): """ - Finds a vector where the value of the quadratic form is coprime to M. + Find a vector where the value of the quadratic form is coprime to M. EXAMPLES:: @@ -454,9 +441,9 @@ def basiclemmavec(self, M): raise ValueError("not primitive form") -### FIXME: get the rules for validity of characters straight... -### p=2 might be bad!!! -def xi(self,p): +# FIXME: get the rules for validity of characters straight... +# p=2 might be bad!!! +def xi(self, p): """ Return the value of the genus characters Xi_p... which may be missing one character. We allow -1 as a prime. @@ -473,7 +460,6 @@ def xi(self,p): [1, 1] sage: [Q1.xi(5), Q2.xi(5)] # not equivalent over Z_5 [1, -1] - """ if self.dim() == 2 and self.disc() % p: raise ValueError("not a valid character") @@ -504,7 +490,6 @@ def xi_rec(self,p): [-1, -1, -1, 1] sage: list(map(Q2.xi_rec, [-1,2,3,5])) [-1, -1, -1, -1] - """ return self.reciprocal().xi(p) @@ -524,7 +509,6 @@ def lll(self): [ * 4 3 3 ] [ * * 6 3 ] [ * * * 6 ] - """ return self(self.matrix().LLL_gram()) @@ -587,11 +571,11 @@ def representation_vector_list(self, B, maxvectors=10**8): return ms -### zeros +# zeros -def is_zero(self, v, p=0): +def is_zero(self, v, p=0) -> bool: """ - Determines if the vector v is on the conic Q(x) = 0 (mod p). + Determine if the vector v is on the conic Q(x) = 0 (mod p). EXAMPLES:: @@ -609,9 +593,10 @@ def is_zero(self, v, p=0): norm = norm % p return norm == 0 -def is_zero_nonsingular(self, v, p=0): + +def is_zero_nonsingular(self, v, p=0) -> bool: """ - Determines if the vector `v` is on the conic Q(`x`) = 0 (mod `p`), + Determine if the vector `v` is on the conic Q(`x`) = 0 (mod `p`), and that this point is non-singular point of the conic. EXAMPLES:: @@ -623,7 +608,6 @@ def is_zero_nonsingular(self, v, p=0): True sage: Q1.is_zero_nonsingular([1, 19, 2], 37) False - """ if not self.is_zero(v, p): return False @@ -632,9 +616,10 @@ def is_zero_nonsingular(self, v, p=0): vm = vm % p return (vm != 0) -def is_zero_singular(self, v, p=0): + +def is_zero_singular(self, v, p=0) -> bool: """ - Determines if the vector `v` is on the conic Q(`x`) = 0 (mod `p`), + Determine if the vector `v` is on the conic Q(`x`) = 0 (mod `p`), and that this point is singular point of the conic. EXAMPLES:: @@ -646,16 +631,10 @@ def is_zero_singular(self, v, p=0): False sage: Q1.is_zero_singular([1, 19, 2], 37) True - """ if not self.is_zero(v, p): return False vm = vector(self.base_ring(), v) * self.matrix() if p != 0: vm = vm % p - return (vm == 0) - - - - - + return bool(vm == 0) diff --git a/src/sage/quadratic_forms/quadratic_form__theta.py b/src/sage/quadratic_forms/quadratic_form__theta.py index 878a92c076a..7763c61a194 100644 --- a/src/sage/quadratic_forms/quadratic_form__theta.py +++ b/src/sage/quadratic_forms/quadratic_form__theta.py @@ -8,9 +8,7 @@ - Gonzalo Tornaria (2009-02-22): fixes and doctests - Gonzalo Tornaria (2010-03-23): theta series of degree 2 - """ - from copy import deepcopy from sage.rings.real_mpfr import RealField @@ -18,9 +16,6 @@ from sage.rings.integer_ring import ZZ from sage.functions.all import floor, ceil from sage.misc.functional import sqrt - - - from sage.misc.misc import cputime @@ -30,8 +25,8 @@ def theta_series(self, Max=10, var_str='q', safe_flag=True): in var_str (which defaults to '`q`'), up to the specified precision `O(q^max)`. - This uses the PARI/GP function qfrep, wrapped by the - theta_by_pari() method. This caches the result for future + This uses the PARI/GP function :pari:`qfrep`, wrapped by the + theta_by_pari() method. This caches the result for future computations. The safe_flag allows us to select whether we want a copy of the @@ -42,10 +37,12 @@ def theta_series(self, Max=10, var_str='q', safe_flag=True): then the routine is much faster but the return values are vulnerable to being corrupted by the user. - TO DO: Allow the option Max='mod_form' to give enough coefficients - to ensure we determine the theta series as a modular form. This - is related to the Sturm bound, but we'll need to be careful about - this (particularly for half-integral weights!). + .. TODO:: + + Allow the option Max='mod_form' to give enough coefficients + to ensure we determine the theta series as a modular form. This + is related to the Sturm bound, but we will need to be careful about + this (particularly for half-integral weights!). EXAMPLES:: @@ -57,25 +54,23 @@ def theta_series(self, Max=10, var_str='q', safe_flag=True): 1 + 2*q + 2*q^3 + 6*q^4 + 2*q^5 + 4*q^6 + 6*q^7 + 8*q^8 + 14*q^9 + 4*q^10 + 12*q^11 + 18*q^12 + 12*q^13 + 12*q^14 + 8*q^15 + 34*q^16 + 12*q^17 + 8*q^18 + 32*q^19 + 10*q^20 + 28*q^21 + 16*q^23 + 44*q^24 + O(q^25) """ - ## Sanity Check: Max is an integer or an allowed string: + # Sanity Check: Max is an integer or an allowed string: try: M = ZZ(Max) except TypeError: M = -1 if (Max not in ['mod_form']) and (not M >= 0): - print(Max) - raise TypeError("Oops! Max is not an integer >= 0 or an allowed string.") + raise TypeError("Max = {Max} is not an integer >= 0 or an allowed string") if Max == 'mod_form': - raise NotImplementedError("Oops! We have to figure out the correct number of Fourier coefficients to use...") + raise NotImplementedError("we have to figure out the correct number of Fourier coefficients to use") #return self.theta_by_pari(sturm_bound(self.level(), self.dim() / ZZ(2)) + 1, var_str, safe_flag) else: return self.theta_by_pari(M, var_str, safe_flag) - -## ------------- Compute the theta function by using the PARI/GP routine qfrep ------------ +# ------------- Compute the theta function by using the PARI/GP routine qfrep ------------ def theta_by_pari(self, Max, var_str='q', safe_flag=True): """ @@ -94,7 +89,6 @@ def theta_by_pari(self, Max, var_str='q', safe_flag=True): then the routine is much faster but the return values are vulnerable to being corrupted by the user. - INPUT: Max -- an integer >=0 @@ -114,18 +108,18 @@ def theta_by_pari(self, Max, var_str='q', safe_flag=True): True """ - ## Try to use the cached result if it's enough precision + # Try to use the cached result if it's enough precision if hasattr(self, '__theta_vec') and len(self.__theta_vec) >= Max: theta_vec = self.__theta_vec[:Max] else: theta_vec = self.representation_number_list(Max) - ## Cache the theta vector + # Cache the theta vector self.__theta_vec = theta_vec - ## Return the answer + # Return the answer if var_str == '': if safe_flag: - return deepcopy(theta_vec) ## We must make a copy here to insure the integrity of the cached version! + return deepcopy(theta_vec) # We must make a copy here to insure the integrity of the cached version! else: return theta_vec else: @@ -133,19 +127,18 @@ def theta_by_pari(self, Max, var_str='q', safe_flag=True): -## ------------- Compute the theta function by using an explicit Cholesky decomposition ------------ +# ------------- Compute the theta function by using an explicit Cholesky decomposition ------------ ########################################################################## -## Routines to compute the Fourier expansion of the theta function of Q ## -## (to a given precision) via a Cholesky decomposition over RR. ## -## ## -## The Cholesky code was taken from: ## -## ~/Documents/290_Project/C/Ver13.2__3-5-2007/Matrix_mpz/Matrix_mpz.cc ## +# Routines to compute the Fourier expansion of the theta function of Q ## +# (to a given precision) via a Cholesky decomposition over RR. ## +# ## +# The Cholesky code was taken from: ## +# ~/Documents/290_Project/C/Ver13.2__3-5-2007/Matrix_mpz/Matrix_mpz.cc ## ########################################################################## - def theta_by_cholesky(self, q_prec): r""" Uses the real Cholesky decomposition to compute (the `q`-expansion of) the @@ -160,7 +153,7 @@ def theta_by_cholesky(self, q_prec): EXAMPLES:: - ## Check the sum of 4 squares form against Jacobi's formula + # Check the sum of 4 squares form against Jacobi's formula sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1]) sage: Theta = Q.theta_by_cholesky(10) sage: Theta @@ -173,7 +166,7 @@ def theta_by_cholesky(self, q_prec): :: - ## Check the form x^2 + 3y^2 + 5z^2 + 7w^2 represents everything except 2 and 22. + # Check the form x^2 + 3y^2 + 5z^2 + 7w^2 represents everything except 2 and 22. sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7]) sage: Theta = Q.theta_by_cholesky(50) sage: Theta_list = Theta.list() @@ -181,17 +174,16 @@ def theta_by_cholesky(self, q_prec): [2, 22] """ - ## RAISE AN ERROR -- This routine is deprecated! + # RAISE AN ERROR -- This routine is deprecated! #raise NotImplementedError, "This routine is deprecated. Try theta_series(), which uses theta_by_pari()." - n = self.dim() theta = [0 for i in range(q_prec+1)] PS = PowerSeriesRing(ZZ, 'q') - bit_prec = 53 ## TO DO: Set this precision to reflect the appropriate roundoff - Cholesky = self.cholesky_decomposition(bit_prec) ## error estimate, to be confident through our desired q-precision. - Q = Cholesky ## <---- REDUNDANT!!! + bit_prec = 53 # TO DO: Set this precision to reflect the appropriate roundoff + Cholesky = self.cholesky_decomposition(bit_prec) # error estimate, to be confident through our desired q-precision. + Q = Cholesky # <---- REDUNDANT!!! R = RealField(bit_prec) half = R(0.5) @@ -204,31 +196,29 @@ def theta_by_cholesky(self, q_prec): L = [0] * n x = [0] * n - ## 2. Compute bounds - #Z = sqrt(T[i] / Q[i,i]) ## IMPORTANT NOTE: sqrt preserves the precision of the real number it's given... which is not so good... =| - #L[i] = floor(Z - U[i]) ## Note: This is a Sage Integer - #x[i] = ceil(-Z - U[i]) - 1 ## Note: This is a Sage Integer too + # 2. Compute bounds + #Z = sqrt(T[i] / Q[i,i]) # IMPORTANT NOTE: sqrt preserves the precision of the real number it's given... which is not so good... =| + #L[i] = floor(Z - U[i]) # Note: This is a Sage Integer + #x[i] = ceil(-Z - U[i]) - 1 # Note: This is a Sage Integer too done_flag = False from_step4_flag = False - from_step3_flag = True ## We start by pretending this, since then we get to run through 2 and 3a once. =) + from_step3_flag = True # We start by pretending this, since then we get to run through 2 and 3a once. =) #double Q_val_double; #unsigned long Q_val; // WARNING: Still need a good way of checking overflow for this value... - - - ## Big loop which runs through all vectors + # Big loop which runs through all vectors while not done_flag: - ## Loop through until we get to i=1 (so we defined a vector x) - while from_step3_flag or from_step4_flag: ## IMPORTANT WARNING: This replaces a do...while loop, so it may have to be adjusted! + # Loop through until we get to i=1 (so we defined a vector x) + while from_step3_flag or from_step4_flag: # IMPORTANT WARNING: This replaces a do...while loop, so it may have to be adjusted! - ## Go to directly to step 3 if we're coming from step 4, otherwise perform step 2. + # Go to directly to step 3 if we're coming from step 4, otherwise perform step 2. if from_step4_flag: from_step4_flag = False else: - ## 2. Compute bounds + # 2. Compute bounds from_step3_flag = False Z = sqrt(T[i] / Q[i,i]) L[i] = floor(Z - U[i]) @@ -236,13 +226,13 @@ def theta_by_cholesky(self, q_prec): - ## 3a. Main loop + # 3a. Main loop x[i] += 1 while (x[i] > L[i]): i += 1 x[i] += 1 - ## 3b. Main loop + # 3b. Main loop if (i > 0): from_step3_flag = True T[i-1] = T[i] - Q[i,i] * (x[i] + U[i]) * (x[i] + U[i]) @@ -251,12 +241,12 @@ def theta_by_cholesky(self, q_prec): for j in range(i+1, n): U[i] += Q[i,j] * x[j] - ## 4. Solution found (This happens when i=0) + # 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. + Q_val = floor(Q_val_double + half) # Note: This rounds the value up, since the "round" function returns a float, but floor returns integer. - ## OPTIONAL SAFETY CHECK: + # OPTIONAL SAFETY CHECK: eps = 0.000000001 if (abs(Q_val_double - Q_val) > eps): raise RuntimeError("Oh No! We have a problem with the floating point precision... \n" \ @@ -267,7 +257,7 @@ def theta_by_cholesky(self, q_prec): if (Q_val <= q_prec): theta[Q_val] += 2 - ## 5. Check if x = 0, for exit condition. =) + # 5. Check if x = 0, for exit condition. =) done_flag = True for j in range(n): if (x[j] != 0): @@ -319,11 +309,11 @@ def theta_series_degree_2(Q, prec): from sage.misc.verbose import verbose if Q.base_ring() != ZZ: - raise TypeError("The quadratic form must be integral") + raise TypeError("the quadratic form must be integral") if not Q.is_positive_definite(): - raise ValueError("The quadratic form must be positive definite") + raise ValueError("the quadratic form must be positive definite") try: - X = ZZ(prec-1) # maximum discriminant + X = ZZ(prec - 1) # maximum discriminant except TypeError: raise TypeError("prec is not an integer") @@ -337,7 +327,7 @@ def theta_series_degree_2(Q, prec): H = Q.Hessian_matrix() t = cputime() - max = int(floor((X+1)/4)) + max = (X + 1) // 4 v_list = (Q.vectors_by_length(max)) # assume a>0 v_list = [[V(_) for _ in vs] for vs in v_list] # coerce vectors into V verbose("Computed vectors_by_length" , t) @@ -367,5 +357,3 @@ def B_v1(v): verbose("done a = %d" % a, t) return coeffs - - diff --git a/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py b/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py index 5901f148c0c..f84dc007c7f 100644 --- a/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py +++ b/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py @@ -211,9 +211,9 @@ def scale_by_factor(self, c, change_value_ring_flag=False): return Q except ValueError: if not change_value_ring_flag: - raise TypeError("Oops! We could not rescale the lattice in this way and preserve its defining ring.") + raise TypeError("we could not rescale the lattice in this way and preserve its defining ring") else: - raise RuntimeError("This code is not tested by current doctests!") + raise RuntimeError("this code is not tested by current doctests") F = R.fraction_field() list2 = [F(x) for x in new_coeff_list] Q = self.parent()(self.dim(), F, list2, R) # DEFINE THIS! IT WANTS TO SET THE EQUIVALENCE RING TO R, BUT WITH COEFFS IN F. @@ -364,10 +364,10 @@ def add_symmetric(self, c, i, j, in_place=False): [ 1 0 3 ] [ * 3 2 ] [ * * 6 ] - sage: Q.add_symmetric(-3/2, 2, 0) ## ERROR: -3/2 isn't in the base ring ZZ + sage: Q.add_symmetric(-3/2, 2, 0) # ERROR: -3/2 isn't in the base ring ZZ Traceback (most recent call last): ... - RuntimeError: Oops! This coefficient can...t be coerced to an element of the base ring for the quadratic form. + RuntimeError: this coefficient cannot be coerced to an element of the base ring for the quadratic form :: @@ -381,6 +381,5 @@ def add_symmetric(self, c, i, j, in_place=False): [ 1 2 0 ] [ * 4 2 ] [ * * 15/4 ] - """ return self.elementary_substitution(c, j, i, in_place) diff --git a/src/sage/quadratic_forms/special_values.py b/src/sage/quadratic_forms/special_values.py index e7b4c425866..2cf1f3be5c5 100644 --- a/src/sage/quadratic_forms/special_values.py +++ b/src/sage/quadratic_forms/special_values.py @@ -274,7 +274,7 @@ def quadratic_L_function__numerical(n, d, num_terms=1000): sage: for d in range(-20,0): # long time (2s on sage.math 2014) ....: if abs(RR(quadratic_L_function__numerical(1, d, 10000) - quadratic_L_function__exact(1, d))) > 0.001: - ....: print("Oops! We have a problem at d = {}: exact = {}, numerical = {}".format(d, RR(quadratic_L_function__exact(1, d)), RR(quadratic_L_function__numerical(1, d)))) + ....: print("We have a problem at d = {}: exact = {}, numerical = {}".format(d, RR(quadratic_L_function__exact(1, d)), RR(quadratic_L_function__numerical(1, d)))) """ # Set the correct precision if it is given (for n). if isinstance(n.parent(), sage.rings.abc.RealField): diff --git a/src/sage/quadratic_forms/ternary_qf.py b/src/sage/quadratic_forms/ternary_qf.py index cd23c4db6a9..1b214724645 100644 --- a/src/sage/quadratic_forms/ternary_qf.py +++ b/src/sage/quadratic_forms/ternary_qf.py @@ -207,7 +207,7 @@ def __call__(self, v): if is_Matrix(v): # Check that v has 3 rows if v.nrows() != 3: - raise TypeError("Oops! The matrix must have 3 rows.") + raise TypeError("the matrix must have 3 rows") # Check if v has 3 cols if v.ncols() == 3: M = v.transpose() * self.matrix() * v @@ -217,12 +217,12 @@ def __call__(self, v): elif (is_Vector(v) or isinstance(v, (list, tuple))): # Check that v has length 3 if not (len(v) == 3): - raise TypeError("Oops! Your vector needs to have length 3") + raise TypeError("your vector needs to have length 3") v0, v1, v2 = v a, b, c, r, s, t = self.coefficients() return a*v0**2 + b*v1**2 + c*v2**2 + r*v1*v2 + s*v0*v2 + t*v0*v1 else: - raise TypeError("Oops! Presently we can only evaluate a quadratic form on a list, tuple, vector or matrix") + raise TypeError("presently we can only evaluate a quadratic form on a list, tuple, vector or matrix") def quadratic_form(self): """ @@ -510,8 +510,7 @@ def scale_by_factor(self, k): return QuadraticForm(R, 3, [k*self._a, k*self._t, k*self._s, k*self._b, k*self._r, k*self._c]) else: - - raise TypeError("Oops! " + k.__repr__() + " doesn't belongs to a Ring") + raise TypeError(f"{k} does not belong to a Ring") def reciprocal(self): """ @@ -1734,7 +1733,7 @@ def automorphisms(self, slow=True): True """ if not self.is_definite(): - raise ValueError("Oops, only implemented for definite forms.") + raise ValueError("only implemented for definite forms") if self._automorphisms is not None: return self._automorphisms @@ -1956,7 +1955,7 @@ def number_of_automorphisms(self, slow=True): 24 """ if not self.is_definite(): - raise ValueError("Oops, only implemented for definite forms.") + raise ValueError("only implemented for definite forms") if self._number_of_automorphisms is not None: return self._number_of_automorphisms From b831d78728f8ebacdb78360d68cbb7f63b2f6db7 Mon Sep 17 00:00:00 2001 From: Julian Ritter Date: Mon, 11 Jul 2022 19:15:33 +0200 Subject: [PATCH 263/416] Pycodestyle cleanup for sage/geometry/hyperplane_arrangement/hyperplane.py --- .../hyperplane_arrangement/hyperplane.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/sage/geometry/hyperplane_arrangement/hyperplane.py b/src/sage/geometry/hyperplane_arrangement/hyperplane.py index 146cf2db80a..1ff5cae5fce 100644 --- a/src/sage/geometry/hyperplane_arrangement/hyperplane.py +++ b/src/sage/geometry/hyperplane_arrangement/hyperplane.py @@ -45,7 +45,7 @@ True sage: V([3, 2, -5], -7) Hyperplane 3*x + 2*y - 5*z - 7 - + Or constant term and coefficients together in one list/tuple/iterable:: sage: V([-7, 3, 2, -5]) @@ -98,7 +98,7 @@ over Rational Field with coordinates x, y, z' """ -#***************************************************************************** +# ***************************************************************************** # Copyright (C) 2013 David Perkinson # Volker Braun # @@ -106,14 +106,13 @@ # 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/ -#***************************************************************************** +# ***************************************************************************** from sage.misc.cachefunc import cached_method from sage.geometry.linear_expression import LinearExpression, LinearExpressionModule - class Hyperplane(LinearExpression): """ A hyperplane. @@ -136,7 +135,7 @@ class Hyperplane(LinearExpression): Hyperplane x + y - 1 sage: ambient = H.ambient_space() - sage: ambient._element_constructor_(x+y-1) + sage: ambient._element_constructor_(x+y-1) Hyperplane x + y - 1 For technical reasons, we must allow the degenerate cases of @@ -207,7 +206,7 @@ def _latex_(self): def normal(self): """ Return the normal vector. - + OUTPUT: A vector over the base ring. @@ -300,8 +299,8 @@ def polyhedron(self): sage: P.Hrepresentation() (An equation (1, 2, 3) x - 4 == 0,) sage: P.Vrepresentation() - (A line in the direction (0, 3, -2), - A line in the direction (3, 0, -1), + (A line in the direction (0, 3, -2), + A line in the direction (3, 0, -1), A vertex at (0, 0, 4/3)) """ from sage.geometry.polyhedron.constructor import Polyhedron @@ -377,7 +376,7 @@ def linear_part_projection(self, point): def point(self): """ Return the point closest to the origin. - + OUTPUT: A vector of the ambient vector space. The closest point to the @@ -385,7 +384,7 @@ def point(self): In finite characteristic a random point will be returned if the norm of the hyperplane normal vector is zero. - + EXAMPLES:: @@ -395,7 +394,7 @@ def point(self): (2/7, 4/7, 6/7) sage: h.point() in h True - + sage: H. = HyperplaneArrangements(GF(3)) sage: h = 2*x + y + z + 1 sage: h.point() @@ -625,7 +624,7 @@ def _affine_subspace(self): """ from sage.geometry.hyperplane_arrangement.affine_subspace import AffineSubspace return AffineSubspace(self.point(), self.linear_part()) - + def plot(self, **kwds): """ Plot the hyperplane. @@ -654,7 +653,7 @@ def __or__(self, other): Arrangement sage: x | [(0,1), 1] Arrangement - + TESTS:: sage: (x | y).parent() is L @@ -689,7 +688,8 @@ def to_symmetric_space(self): S = self.parent().symmetric_space() G = S.gens() # We skip the first coefficient since it corresponds to the constant term - return S.sum(G[i]*c for i,c in enumerate(coeff[1:])) + return S.sum(G[i]*c for i, c in enumerate(coeff[1:])) + class AmbientVectorSpace(LinearExpressionModule): """ @@ -724,7 +724,7 @@ def _repr_(self): return '{0}-dimensional linear space over {3} with coordinate{1} {2}'.format( self.dimension(), 's' if self.ngens() > 1 else '', - ', '.join(self._names), + ', '.join(self._names), self.base_ring()) def dimension(self): @@ -746,7 +746,7 @@ def dimension(self): 1 """ return self.ngens() - + def change_ring(self, base_ring): """ Return a ambient vector space with a changed base ring. @@ -756,7 +756,7 @@ def change_ring(self, base_ring): - ``base_ring`` -- a ring; the new base ring OUTPUT: - + A new :class:`AmbientVectorSpace`. EXAMPLES:: From 1e1061022bcea46e7e1a7a431ca3f7d6e9e9d084 Mon Sep 17 00:00:00 2001 From: Julian Ritter Date: Mon, 11 Jul 2022 20:02:04 +0200 Subject: [PATCH 264/416] Fixed repeated word typos --- src/sage/combinat/fast_vector_partitions.pyx | 2 +- src/sage/combinat/nu_tamari_lattice.py | 2 +- src/sage/data_structures/sparse_bitset.pxd | 3 +-- src/sage/databases/knotinfo_db.py | 4 ++-- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 2 +- src/sage/geometry/polyhedron/backend_normaliz.py | 2 +- src/sage/geometry/polyhedron/constructor.py | 2 +- src/sage/graphs/domination.py | 2 +- src/sage/graphs/generic_graph.py | 4 ++-- src/sage/knots/knotinfo.py | 2 +- src/sage/libs/ntl/ntl_ZZX.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pEX.pyx | 2 +- src/sage/libs/ntl/ntl_ZZ_pX.pyx | 2 +- src/sage/manifolds/differentiable/scalarfield.py | 2 +- src/sage/manifolds/differentiable/vectorfield_module.py | 2 +- src/sage/modules/fp_graded/morphism.py | 4 ++-- src/sage/numerical/gauss_legendre.pyx | 2 +- src/sage/quadratic_forms/genera/genus.py | 4 ++-- src/sage/rings/complex_interval_field.py | 2 +- src/sage/rings/number_field/selmer_group.py | 2 +- src/sage/rings/rational_field.py | 2 +- src/sage/rings/valuation/valuation.py | 2 +- src/sage/schemes/elliptic_curves/mod_sym_num.pyx | 2 +- src/sage/schemes/hyperelliptic_curves/jacobian_generic.py | 2 +- src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py | 2 +- src/sage/symbolic/ginac/power.h | 2 +- 26 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/sage/combinat/fast_vector_partitions.pyx b/src/sage/combinat/fast_vector_partitions.pyx index d25a1d1d445..2a1e093104b 100644 --- a/src/sage/combinat/fast_vector_partitions.pyx +++ b/src/sage/combinat/fast_vector_partitions.pyx @@ -43,7 +43,7 @@ cdef list vector_halve(list v): OUTPUT: A list, understood as the integer vector halfway down the list of - lexicographically ordered vectors between between ``v`` and zero. + lexicographically ordered vectors between ``v`` and zero. EXAMPLES:: diff --git a/src/sage/combinat/nu_tamari_lattice.py b/src/sage/combinat/nu_tamari_lattice.py index e90fc4d6791..0d6b391aa8b 100644 --- a/src/sage/combinat/nu_tamari_lattice.py +++ b/src/sage/combinat/nu_tamari_lattice.py @@ -62,7 +62,7 @@ def NuTamariLattice(nu): INPUT: - - `\nu` -- a list of of 0s and 1s or a string of 0s and 1s. + - `\nu` -- a list of 0s and 1s or a string of 0s and 1s. OUTPUT: diff --git a/src/sage/data_structures/sparse_bitset.pxd b/src/sage/data_structures/sparse_bitset.pxd index ce1a0f0a468..742ac26c6a5 100644 --- a/src/sage/data_structures/sparse_bitset.pxd +++ b/src/sage/data_structures/sparse_bitset.pxd @@ -49,8 +49,7 @@ cdef struct sparse_bitset_s: # Storing the non zero positions can safe time, when performing # multiple comparisons. # E.g. one can set them while computing the intersection - # and then use those those to ``bitset_issubset`` many - # times in a row. + # and then use those to ``bitset_issubset`` many times in a row. # Any modification, will invalidate the already computed positions. # It is stored, whether the non zero chunks are correctly initialized diff --git a/src/sage/databases/knotinfo_db.py b/src/sage/databases/knotinfo_db.py index 7d789b42229..21be7479ef4 100644 --- a/src/sage/databases/knotinfo_db.py +++ b/src/sage/databases/knotinfo_db.py @@ -162,8 +162,8 @@ class KnotInfoFilename(Enum): r""" Enum for the different data files. The following choices are possible: - - ``knots`` -- contains the the data from KnotInfo - - ``links`` -- contains the the data for proper links from LinkInfo + - ``knots`` -- contains the data from KnotInfo + - ``links`` -- contains the data for proper links from LinkInfo Examples:: diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 07575dc2754..c814b81987a 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -5810,7 +5810,7 @@ def _is_preperiodic(self, P, err=0.1, return_period=False): # however precision issues can occur so we can only tell *not* preperiodic # if the value is larger than the error if h <= err: - # if the canonical height is less than than the + # if the canonical height is less than the # error, then we suspect preperiodic so check # either we can find the cycle or the height is # larger than the difference between the canonical height diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py index 9d109238df1..3901dfbd729 100644 --- a/src/sage/geometry/polyhedron/backend_normaliz.py +++ b/src/sage/geometry/polyhedron/backend_normaliz.py @@ -1494,7 +1494,7 @@ def _volume_normaliz(self, measure='euclidean'): sage: cube._volume_normaliz(measure='induced_lattice') # optional - pynormaliz 6 - Or one can can calculate the ambient volume, which is the above multiplied by the + Or one can calculate the ambient volume, which is the above multiplied by the volume of the unimodular simplex (or zero if not full-dimensional):: sage: cube._volume_normaliz(measure='ambient') # optional - pynormaliz diff --git a/src/sage/geometry/polyhedron/constructor.py b/src/sage/geometry/polyhedron/constructor.py index 4606d979cfb..961a6f13e22 100644 --- a/src/sage/geometry/polyhedron/constructor.py +++ b/src/sage/geometry/polyhedron/constructor.py @@ -207,7 +207,7 @@ Be careful when you construct polyhedra with floating point numbers. The only available backend for such computation is ``cdd`` which uses machine floating - point numbers which have have limited precision. If the input consists of + point numbers which have limited precision. If the input consists of floating point numbers and the ``base_ring`` is not specified, the base ring is set to be the ``RealField`` with the precision given by the minimal bit precision of the input. Then, if the obtained minimum is 53 bits of precision, the diff --git a/src/sage/graphs/domination.py b/src/sage/graphs/domination.py index 73d8314b69e..25e9a687790 100644 --- a/src/sage/graphs/domination.py +++ b/src/sage/graphs/domination.py @@ -15,7 +15,7 @@ :meth:`~is_dominating` | Check whether a set of vertices dominates a graph. :meth:`~is_redundant` | Check whether a set of vertices has redundant vertices (with respect to domination). :meth:`~private_neighbors` | Return the private neighbors of a vertex with respect to other vertices. - :meth:`~greedy_dominating_set` | Return a greedy distance-`k` dominating set of of the graph. + :meth:`~greedy_dominating_set` | Return a greedy distance-`k` dominating set of the graph. EXAMPLES: diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index c5ef0c06ec5..fbe6229f7f0 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -314,7 +314,7 @@ :meth:`~GenericGraph.multicommodity_flow` | Solve a multicommodity flow problem. :meth:`~GenericGraph.disjoint_routed_paths` | Return a set of disjoint routed paths. :meth:`~GenericGraph.dominating_set` | Return a minimum dominating set of the graph - :meth:`~GenericGraph.greedy_dominating_set` | Return a greedy distance-`k` dominating set of of the graph. + :meth:`~GenericGraph.greedy_dominating_set` | Return a greedy distance-`k` dominating set of the graph. :meth:`~GenericGraph.subgraph_search` | Return a copy of ``G`` in ``self``. :meth:`~GenericGraph.subgraph_search_count` | Return the number of labelled occurrences of ``G`` in ``self``. :meth:`~GenericGraph.subgraph_search_iterator` | Return an iterator over the labelled copies of ``G`` in ``self``. @@ -15428,7 +15428,7 @@ def _girth_bfs(self, odd=False, certificate=False): INPUT: - ``odd`` -- boolean (default: ``False``); whether to compute the odd - girth instead instead of the girth + girth instead of the girth - ``certificate`` -- boolean (default: ``False``); whether to return ``(g, c)``, where ``g`` is the (odd) girth and ``c`` is a list diff --git a/src/sage/knots/knotinfo.py b/src/sage/knots/knotinfo.py index 45417f83757..ed0f90dc1b9 100644 --- a/src/sage/knots/knotinfo.py +++ b/src/sage/knots/knotinfo.py @@ -848,7 +848,7 @@ def is_knot(self): @cached_method def name_unoriented(self): r""" - Return the the part of the name of ``self`` which is independent on the + Return the part of the name of ``self`` which is independent on the orientation. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_ZZX.pyx b/src/sage/libs/ntl/ntl_ZZX.pyx index 759ba34640f..8d38fcb7f8f 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pyx +++ b/src/sage/libs/ntl/ntl_ZZX.pyx @@ -968,7 +968,7 @@ cdef class ntl_ZZX(): def trace_mod(self, ntl_ZZX modulus): """ Return the trace of this polynomial modulus the modulus. - The modulus must be monic, and of positive degree degree bigger + The modulus must be monic, and of positive degree bigger than the degree of self. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx index 73af622fc98..f9d2e982343 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx @@ -1048,7 +1048,7 @@ cdef class ntl_ZZ_pEX(): def trace_mod(self, ntl_ZZ_pEX modulus): """ Return the trace of this polynomial modulo the modulus. - The modulus must be monic, and of positive degree degree bigger + The modulus must be monic, and of positive degree bigger than the degree of self. EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pyx b/src/sage/libs/ntl/ntl_ZZ_pX.pyx index 2d03c23a88f..95d77f727fa 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pyx @@ -1203,7 +1203,7 @@ cdef class ntl_ZZ_pX(): def trace_mod(self, ntl_ZZ_pX modulus): """ Return the trace of this polynomial modulus the modulus. - The modulus must be monic, and of positive degree degree bigger + The modulus must be monic, and of positive degree bigger than the degree of self. EXAMPLES:: diff --git a/src/sage/manifolds/differentiable/scalarfield.py b/src/sage/manifolds/differentiable/scalarfield.py index b2efd06ca9a..9763bf46352 100644 --- a/src/sage/manifolds/differentiable/scalarfield.py +++ b/src/sage/manifolds/differentiable/scalarfield.py @@ -890,7 +890,7 @@ def hodge_dual( self, nondegenerate_tensor: Union[PseudoRiemannianMetric, SymplecticForm] ) -> DiffForm: r""" - Compute the Hodge dual of the scalar field with respect to to some non-degenerate + Compute the Hodge dual of the scalar field with respect to some non-degenerate bilinear form (Riemannian metric or symplectic form). If `M` is the domain of the scalar field (denoted by `f`), `n` is the diff --git a/src/sage/manifolds/differentiable/vectorfield_module.py b/src/sage/manifolds/differentiable/vectorfield_module.py index cec856eb103..cf3f1dc687d 100644 --- a/src/sage/manifolds/differentiable/vectorfield_module.py +++ b/src/sage/manifolds/differentiable/vectorfield_module.py @@ -2241,7 +2241,7 @@ def sym_bilinear_form(self, name=None, latex_name=None): INPUT: - ``name`` -- string (default: ``None``); name given to the - symmetric bilinear bilinear form + symmetric bilinear form - ``latex_name`` -- string (default: ``None``); LaTeX symbol to denote the symmetric bilinear form; if ``None``, the LaTeX symbol is set to ``name`` diff --git a/src/sage/modules/fp_graded/morphism.py b/src/sage/modules/fp_graded/morphism.py index 816425c8aea..0417bd72347 100755 --- a/src/sage/modules/fp_graded/morphism.py +++ b/src/sage/modules/fp_graded/morphism.py @@ -1689,7 +1689,7 @@ def _resolve_kernel(self, top_dim=None, verbose=False): # 1) `j` be a homomorphism into `\ker(self)`, and # 2) 'n' be an integer. # - # The induction loop starts each iteration assuming that that `j` is onto + # The induction loop starts each iteration assuming that `j` is onto # the kernel in degrees below `n`. Each iteration of the loop then # extends the map `j` minimally so that `j_n` becomes onto the kernel. # @@ -1821,7 +1821,7 @@ def _resolve_image(self, top_dim=None, verbose=False): # 1) `j` be a homomorphism into `\im(self)`, and # 2) 'n' be an integer. # - # The induction loop starts each iteration assuming that that `j` is onto + # The induction loop starts each iteration assuming that `j` is onto # the image in degrees below `n`. Each iteration of the loop then # extends the map `j` minimally so that `j_n` becomes onto the image. # diff --git a/src/sage/numerical/gauss_legendre.pyx b/src/sage/numerical/gauss_legendre.pyx index 347a47a61d4..175513687df 100644 --- a/src/sage/numerical/gauss_legendre.pyx +++ b/src/sage/numerical/gauss_legendre.pyx @@ -301,7 +301,7 @@ def integrate_vector_N(f, prec, N=3): .. NOTE:: The nodes and weights are calculated in the real field with ``prec`` - bits of precision. If the the vector space in which ``f`` takes values + bits of precision. If the vector space in which ``f`` takes values is over a field which is incompatible with this field (e.g. a finite field) then a TypeError occurs. """ diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index a3e6fd7c9e5..6cc57b8688c 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -1612,7 +1612,7 @@ def automorphous_numbers(self): for r in I: # We need to consider all pairs in I # since at most 2 elements are part of a pair - # we need need at most 2 of each type + # we need at most 2 of each type if I.count(r) > 2: I.remove(r) # products of all pairs @@ -1650,7 +1650,7 @@ def automorphous_numbers(self): L = I + II # We need to consider all pairs in L # since at most 2 elements are part of a pair - # we need need at most 2 of each type + # we need at most 2 of each type for r in L: # remove triplicates if L.count(r) > 2: L.remove(r) diff --git a/src/sage/rings/complex_interval_field.py b/src/sage/rings/complex_interval_field.py index effc3b60648..b27b8905c94 100644 --- a/src/sage/rings/complex_interval_field.py +++ b/src/sage/rings/complex_interval_field.py @@ -360,7 +360,7 @@ def real_field(self): """ return RealIntervalField(self._prec) - # For compatibility with with other complex number implementations + # For compatibility with other complex number implementations # such as CC. _real_field = real_field diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py index 77facaaf86a..c534aaa9f66 100644 --- a/src/sage/rings/number_field/selmer_group.py +++ b/src/sage/rings/number_field/selmer_group.py @@ -445,7 +445,7 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): EXAMPLES: - Over `\QQ` the the unit contribution is trivial unless `p=2` and + Over `\QQ` the unit contribution is trivial unless `p=2` and the class group is trivial:: sage: from sage.rings.number_field.selmer_group import pSelmerGroup diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 50710e0c13d..ea1bccc58c3 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -1101,7 +1101,7 @@ def polynomial(self): r""" Return a defining polynomial of `\QQ`, as for other number fields. - This is is also aliased to :meth:`self.defining_polynomial()` + This is also aliased to :meth:`self.defining_polynomial()` and :meth:`self.absolute_polynomial()`. EXAMPLES:: diff --git a/src/sage/rings/valuation/valuation.py b/src/sage/rings/valuation/valuation.py index 4cbe63fe2f9..ecbb5595cdc 100644 --- a/src/sage/rings/valuation/valuation.py +++ b/src/sage/rings/valuation/valuation.py @@ -415,7 +415,7 @@ def mac_lane_approximants(self, G, assume_squarefree=False, require_final_EF=Tru at least that valuation. - ``require_incomparability`` -- a boolean (default: ``False``); - whether to require require the returned valuations to be incomparable + whether to require the returned valuations to be incomparable (with respect to the partial order on valuations defined by comparing them pointwise.) diff --git a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx index cff51b53659..dd452869e2e 100644 --- a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx +++ b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx @@ -3109,7 +3109,7 @@ cdef class ModularSymbolNumerical: else: y += m x -= a - # Note: it could still still be non-unitary. + # Note: it could still be non-unitary. # Example: N=36 a=2, m=5 uu = (-y) % N vv = m % N diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py index 457d037cc89..c7cdf99a83f 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py @@ -228,7 +228,7 @@ def geometric_endomorphism_algebra_is_field(self, B=200, proof=False): Return whether the geometric endomorphism algebra is a field. This implies that the Jacobian of the curve is geometrically - simple. It is based on Algorithm 4.10 from from [Lom2019]_ + simple. It is based on Algorithm 4.10 from [Lom2019]_ INPUT: diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 9240426dafc..b1f10eb1344 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -3018,7 +3018,7 @@ def _richcmp_(self, other, op): This does not compare elements by any reduction; it only compares the coefficients. The comparison - should be be done against a normal form or possibly + should be done against a normal form or possibly after some reduction steps. EXAMPLES:: diff --git a/src/sage/symbolic/ginac/power.h b/src/sage/symbolic/ginac/power.h index f19bea6fbe4..e47186f4994 100644 --- a/src/sage/symbolic/ginac/power.h +++ b/src/sage/symbolic/ginac/power.h @@ -34,7 +34,7 @@ class numeric; class add; class mul; -/** This class holds a two-component object, a basis and and exponent +/** This class holds a two-component object, a basis and exponent * representing exponentiation. */ class power : public basic { From 8e7c7d780d032bf0b2ddd02daee50e85a54bd284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 11 Jul 2022 20:13:33 +0200 Subject: [PATCH 265/416] some wrapping and unwrapping in coding --- src/sage/coding/cyclic_code.py | 3 +-- src/sage/coding/decoder.py | 3 +-- src/sage/coding/kasami_codes.pyx | 5 ++--- src/sage/coding/linear_code.py | 12 ++++++------ src/sage/coding/linear_rank_metric.py | 9 +++++---- src/sage/coding/reed_muller_code.py | 8 ++++---- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/sage/coding/cyclic_code.py b/src/sage/coding/cyclic_code.py index e013f217769..a5c3a4c88fb 100644 --- a/src/sage/coding/cyclic_code.py +++ b/src/sage/coding/cyclic_code.py @@ -400,8 +400,7 @@ def __init__(self, generator_pol=None, length=None, code=None, check=True, self._polynomial_ring = g.parent() self._generator_polynomial = g self._dimension = code.dimension() - super().__init__(code.base_ring(), n, - "Vector", "Syndrome") + super().__init__(code.base_ring(), n, "Vector", "Syndrome") # Case (3) : a defining set, a length and a field are provided elif (D is not None and length is not None and field is not None and diff --git a/src/sage/coding/decoder.py b/src/sage/coding/decoder.py index e12b1bde73f..8a8e6496f74 100644 --- a/src/sage/coding/decoder.py +++ b/src/sage/coding/decoder.py @@ -35,8 +35,7 @@ class Decoder(SageObject): - inherit from :class:`Decoder` - call ``Decoder.__init__`` in the subclass constructor. - Example: ``super().__init__(code, input_space, - connected_encoder_name)``. + Example: ``super().__init__(code, input_space, connected_encoder_name)``. By doing that, your subclass will have all the parameters described above initialized. - Then, you need to override one of decoding methods, either :meth:`decode_to_code` or diff --git a/src/sage/coding/kasami_codes.pyx b/src/sage/coding/kasami_codes.pyx index 44a761f3a56..8212ae29ded 100644 --- a/src/sage/coding/kasami_codes.pyx +++ b/src/sage/coding/kasami_codes.pyx @@ -196,12 +196,11 @@ class KasamiCode(AbstractLinearCode): self._t = t self._extended = extended - length = s-1 + length = s - 1 if extended: length += 1 - super().__init__(GF(2), length, - "GeneratorMatrix", "Syndrome") + super().__init__(GF(2), length, "GeneratorMatrix", "Syndrome") def parameters(self): r""" diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index fac96bbac30..91678c17e49 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -418,7 +418,8 @@ def __init__(self, base_field, length, default_encoder_name, default_decoder_nam self._registered_decoders['InformationSet'] = LinearCodeInformationSetDecoder self._generic_constructor = LinearCode - super().__init__(base_field, length, default_encoder_name, default_decoder_name) + super().__init__(base_field, length, default_encoder_name, + default_decoder_name) def _an_element_(self): r""" @@ -2309,7 +2310,8 @@ def __init__(self, generator, d=None): # Assume input is an AbstractLinearCode, extract its generator matrix generator = generator.generator_matrix() - super().__init__(base_ring, generator.ncols(), "GeneratorMatrix", "Syndrome") + super().__init__(base_ring, generator.ncols(), + "GeneratorMatrix", "Syndrome") self._generator_matrix = generator self._dimension = generator.rank() self._minimum_distance = d @@ -2636,8 +2638,7 @@ def __init__(self, code, maximum_error_weight=None): raise ValueError("maximum_error_weight has to be less than code's length minus its dimension") else: self._maximum_error_weight = maximum_error_weight - super().__init__(code, code.ambient_space(), - code._default_encoder_name) + super().__init__(code, code.ambient_space(), code._default_encoder_name) self._lookup_table = self._build_lookup_table() def __eq__(self, other): @@ -2933,8 +2934,7 @@ def __init__(self, code): sage: D Nearest neighbor decoder for [7, 4] linear code over GF(2) """ - super().__init__(code, code.ambient_space(), - code._default_encoder_name) + super().__init__(code, code.ambient_space(), code._default_encoder_name) def __eq__(self, other): r""" diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 804b68fc890..78db1b8c602 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -472,7 +472,8 @@ def __init__(self, base_field, sub_field, length, default_encoder_name, self._sub_field = sub_field self._generic_constructor = LinearRankMetricCode - super().__init__(base_field, length, default_encoder_name, default_decoder_name, "rank") + super().__init__(base_field, length, default_encoder_name, + default_decoder_name, "rank") def sub_field(self): r""" @@ -710,7 +711,8 @@ def __init__(self, generator, sub_field=None, basis=None): self._generator_matrix = generator self._length = generator.ncols() - super().__init__(base_field, sub_field, self._length, "GeneratorMatrix", "NearestNeighbor", basis) + super().__init__(base_field, sub_field, self._length, + "GeneratorMatrix", "NearestNeighbor", basis) def _repr_(self): r""" @@ -796,8 +798,7 @@ def __init__(self, code): sage: D Nearest neighbor decoder for [3, 2] linear rank metric code over GF(64)/GF(4) """ - super().__init__(code, code.ambient_space(), - code._default_encoder_name) + super().__init__(code, code.ambient_space(), code._default_encoder_name) def __eq__(self, other): r""" diff --git a/src/sage/coding/reed_muller_code.py b/src/sage/coding/reed_muller_code.py index 84d9c561fe0..457f90bdab9 100644 --- a/src/sage/coding/reed_muller_code.py +++ b/src/sage/coding/reed_muller_code.py @@ -260,10 +260,11 @@ def __init__(self, base_field, order, num_of_var): if not(isinstance(num_of_var, (Integer, int))): raise ValueError("The number of variables must be an integer") q = base_field.cardinality() - if (order >= q): + if order >= q: raise ValueError("The order must be less than %s" % q) - super().__init__(base_field, q**num_of_var, "EvaluationVector", "Syndrome") + super().__init__(base_field, q**num_of_var, + "EvaluationVector", "Syndrome") self._order = order self._num_of_var = num_of_var self._dimension = binomial(num_of_var + order, order) @@ -428,8 +429,7 @@ def __init__(self, order, num_of_var): "The order must be less than or equal to %s" % num_of_var) - super().__init__(GF(2), 2**num_of_var, - "EvaluationVector", "Syndrome") + super().__init__(GF(2), 2**num_of_var, "EvaluationVector", "Syndrome") self._order = order self._num_of_var = num_of_var self._dimension = _binomial_sum(num_of_var, order) From eb3ff5c2a9bf63440fad78a301608d785d280114 Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Mon, 11 Jul 2022 23:19:34 +0200 Subject: [PATCH 266/416] #34155 : update openssl to 3.0.5 --- build/pkgs/openssl/checksums.ini | 6 +++--- build/pkgs/openssl/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/openssl/checksums.ini b/build/pkgs/openssl/checksums.ini index 39cd6044a4e..216fe96e725 100644 --- a/build/pkgs/openssl/checksums.ini +++ b/build/pkgs/openssl/checksums.ini @@ -1,5 +1,5 @@ tarball=openssl-VERSION.tar.gz -sha1=cde0c343646ce10600e6b28fc7000e9096e7959f -md5=32c7e6f6274e591e73fc463617078690 -cksum=2111910744 +sha1=a5305213c681a5a4322dad7347a6e66b7b6ef3c7 +md5=163bb3e58c143793d1dc6a6ec7d185d5 +cksum=439183449 upstream_url=https://www.openssl.org/source/openssl-VERSION.tar.gz diff --git a/build/pkgs/openssl/package-version.txt b/build/pkgs/openssl/package-version.txt index b0f2dcb32fc..eca690e737b 100644 --- a/build/pkgs/openssl/package-version.txt +++ b/build/pkgs/openssl/package-version.txt @@ -1 +1 @@ -3.0.4 +3.0.5 From 57eac4c679a2107a67273c31ff9ca3a4eae1fcde Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 30 Jun 2022 16:32:28 -0600 Subject: [PATCH 267/416] Fix use-after-free in cutwidth_dyn Cython warns of a use-after-free in cutwidth_dyn. The finally clause of a try block deallocated memory in neighborhoods that is then passed to find_order. Move code using neighborhoods inside the try block. --- src/sage/graphs/graph_decompositions/cutwidth.pyx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sage/graphs/graph_decompositions/cutwidth.pyx b/src/sage/graphs/graph_decompositions/cutwidth.pyx index daf4d81d192..eb1d0ad7287 100644 --- a/src/sage/graphs/graph_decompositions/cutwidth.pyx +++ b/src/sage/graphs/graph_decompositions/cutwidth.pyx @@ -522,13 +522,12 @@ def cutwidth_dyn(G, lower_bound=0): if exists(g, neighborhoods, 0, 0, i, k) <= k: order = find_order(g, neighborhoods, k) return k, [g.int_to_vertices[i] for i in order] + + order = find_order(g, neighborhoods, k) + return k, [g.int_to_vertices[i] for i in order] finally: sig_free(neighborhoods) - order = find_order(g, neighborhoods, k) - return k, [g.int_to_vertices[i] for i in order] - - cdef inline int exists(FastDigraph g, uint8_t* neighborhoods, int S, int cost_S, int v, int k): r""" Check whether an ordering with the given cost `k` exists, and updates data From d35b85c9ab491d1c5c25a64c8d02f3ef8959896a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 17:35:34 -0700 Subject: [PATCH 268/416] src/tox.ini (rst): New, via flake8-rst-docstrings --- src/tox.ini | 21 ++++++++++++++++++++- tox.ini | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/tox.ini b/src/tox.ini index 15cc6d181e0..477997ca701 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -21,7 +21,7 @@ ## in a virtual environment. ## [tox] -envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell +envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst # When adding environments above, also update the delegations in SAGE_ROOT/tox.ini skipsdist = true @@ -172,6 +172,25 @@ commands = codespell \ --ignore-words={toxinidir}/.codespell-ignore.txt \ {posargs:{toxinidir}/sage/} +[testenv:rst] +description = + validate Python docstrings markup as reStructuredText +deps = flake8-rst-docstrings +commands = flake8 --select=RST {posargs:{toxinidir}/sage/} + +[flake8] +rst-roles = + class, + func, + meth, + mod, + ref, + trac, + wikipedia +rst-directives = + SEEALSO, + TODO + [pytest] python_files = *_test.py norecursedirs = local prefix venv build pkgs .git src/doc src/bin diff --git a/tox.ini b/tox.ini index e445ad45d2d..ff0f1b690b4 100644 --- a/tox.ini +++ b/tox.ini @@ -750,3 +750,11 @@ passenv = {[sage_src]passenv} envdir = {[sage_src]envdir} commands = {[sage_src]commands} whitelist_externals = {[sage_src]whitelist_externals} + +[testenv:rst] +description = + validate Python docstrings markup as reStructuredText +passenv = {[sage_src]passenv} +envdir = {[sage_src]envdir} +commands = {[sage_src]commands} +whitelist_externals = {[sage_src]whitelist_externals} From e0ed96b78cd9a161934536c29fcf0d4b8780e86c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 17:54:00 -0700 Subject: [PATCH 269/416] src/tox.ini (flake8): Add to rst-roles, rst-directives, extend-ignore --- src/tox.ini | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tox.ini b/src/tox.ini index 477997ca701..748a93e7838 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -180,16 +180,28 @@ commands = flake8 --select=RST {posargs:{toxinidir}/sage/} [flake8] rst-roles = + # Sphinx class, func, meth, mod, ref, + # from src/sage/misc/sagedoc.py + arxiv, + doi, + mathscinet, + oeis, + pari, + python, trac, wikipedia rst-directives = + PLOT, SEEALSO, TODO +extend-ignore = + # Ignore RST306 Unknown target name -- because of references to the global bibliography + RST306 [pytest] python_files = *_test.py From 9ee09da29834339000747c273aa1291e542da375 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:06:00 -0700 Subject: [PATCH 270/416] src/tox.ini (flake8): Add more rst-roles, rst-directives --- src/tox.ini | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tox.ini b/src/tox.ini index 748a93e7838..43a10eac86f 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -181,11 +181,18 @@ commands = flake8 --select=RST {posargs:{toxinidir}/sage/} [flake8] rst-roles = # Sphinx + file, + ref, + # Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects + attr, class, + const, + data, + exc, func, meth, mod, - ref, + obj, # from src/sage/misc/sagedoc.py arxiv, doi, @@ -196,6 +203,7 @@ rst-roles = trac, wikipedia rst-directives = + automethod, PLOT, SEEALSO, TODO From c0a99401922c2d895f30d28be6f3d5418adc3a66 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:10:16 -0700 Subject: [PATCH 271/416] src/tox.ini (flake8): Add more rst-roles --- src/tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tox.ini b/src/tox.ini index 43a10eac86f..242e72f16bd 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -181,8 +181,11 @@ commands = flake8 --select=RST {posargs:{toxinidir}/sage/} [flake8] rst-roles = # Sphinx + doc, file, ref, + # Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#the-standard-domain (selection) + envvar, # Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects attr, class, From 99a17c791aac6873910e8795a2b60f29bc698b6f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:33:02 -0700 Subject: [PATCH 272/416] .github/workflows/lint.yml: Run tox -e rst --- .github/workflows/lint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2cd99caa7cd..811a61cc928 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,3 +36,17 @@ jobs: run: pip install tox relint - name: Lint using relint run: tox -e relint src/sage/ + lint-rst: + name: Validate docstring markup as RST + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install tox + run: pip install tox + - name: Lint using tox -e rst + run: tox -e rst From 2859d805bd963edc8175ea0e90af3d17d86a2f65 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:37:49 -0700 Subject: [PATCH 273/416] src/tox.ini (flake8): Add more rst-roles --- src/tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tox.ini b/src/tox.ini index 242e72f16bd..7eb626858ab 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -207,6 +207,7 @@ rst-roles = wikipedia rst-directives = automethod, + ONLY, PLOT, SEEALSO, TODO From 64b6fe8a066ccf7e7b94fb03f48f1b7b066f0f6c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:44:07 -0700 Subject: [PATCH 274/416] src/sage/geometry/polyhedron/backend_normaliz.py: Fix errors shown by tox -e rst --- .../geometry/polyhedron/backend_normaliz.py | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py index 9d109238df1..f9769e3a0d9 100644 --- a/src/sage/geometry/polyhedron/backend_normaliz.py +++ b/src/sage/geometry/polyhedron/backend_normaliz.py @@ -1250,30 +1250,30 @@ def __getstate__(self): TESTS:: - sage: P = polytopes.simplex(backend='normaliz') # optional - pynormaliz - sage: P.__getstate__() # optional - pynormaliz - (Polyhedra in ZZ^4, - {'_Hrepresentation': (An inequality (0, 0, 0, 1) x + 0 >= 0, - An inequality (0, 0, 1, 0) x + 0 >= 0, - An inequality (0, 1, 0, 0) x + 0 >= 0, - An inequality (1, 0, 0, 0) x + 0 >= 0, - An equation (1, 1, 1, 1) x - 1 == 0), - '_Vrepresentation': (A vertex at (0, 0, 0, 1), - A vertex at (0, 0, 1, 0), - A vertex at (0, 1, 0, 0), - A vertex at (1, 0, 0, 0)), - '_normaliz_field': Rational Field, - '_pickle_equations': [(-1, 1, 1, 1, 1)], - '_pickle_inequalities': [(0, 0, 0, 0, 1), - (0, 0, 0, 1, 0), - (0, 0, 1, 0, 0), - (0, 1, 0, 0, 0)], - '_pickle_lines': [], - '_pickle_rays': [], - '_pickle_vertices': [(0, 0, 0, 1), - (0, 0, 1, 0), - (0, 1, 0, 0), - (1, 0, 0, 0)]}) + sage: P = polytopes.simplex(backend='normaliz') # optional - pynormaliz + sage: P.__getstate__() # optional - pynormaliz + (Polyhedra in ZZ^4, + {'_Hrepresentation': (An inequality (0, 0, 0, 1) x + 0 >= 0, + An inequality (0, 0, 1, 0) x + 0 >= 0, + An inequality (0, 1, 0, 0) x + 0 >= 0, + An inequality (1, 0, 0, 0) x + 0 >= 0, + An equation (1, 1, 1, 1) x - 1 == 0), + '_Vrepresentation': (A vertex at (0, 0, 0, 1), + A vertex at (0, 0, 1, 0), + A vertex at (0, 1, 0, 0), + A vertex at (1, 0, 0, 0)), + '_normaliz_field': Rational Field, + '_pickle_equations': [(-1, 1, 1, 1, 1)], + '_pickle_inequalities': [(0, 0, 0, 0, 1), + (0, 0, 0, 1, 0), + (0, 0, 1, 0, 0), + (0, 1, 0, 0, 0)], + '_pickle_lines': [], + '_pickle_rays': [], + '_pickle_vertices': [(0, 0, 0, 1), + (0, 0, 1, 0), + (0, 1, 0, 0), + (1, 0, 0, 0)]}) """ state = super(Polyhedron_normaliz, self).__getstate__() state = (state[0], state[1].copy()) @@ -2247,8 +2247,8 @@ def _Hstar_function_normaliz(self, acting_group=None, output=None): - ``acting_group`` -- (default=None) a permgroup object. A subgroup of ``self``'s ``restricted_automorphism_group`` output as a permutation. - If ``None``, it is set to the full ``restricted_automorphism_group`` - of ``self``. The acting group should always use output='permutation'. + If ``None``, it is set to the full ``restricted_automorphism_group`` + of ``self``. The acting group should always use output='permutation'. - ``output`` -- string. an output option. The allowed values are: From 9a57421aa635ce1684a0d5ef84f2cc909942e44d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:44:56 -0700 Subject: [PATCH 275/416] src/sage/geometry/polyhedron/backend_cdd.py: Fix errors shown by tox -e rst --- src/sage/geometry/polyhedron/backend_cdd.py | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sage/geometry/polyhedron/backend_cdd.py b/src/sage/geometry/polyhedron/backend_cdd.py index e7f9afbf8e3..442aabbd328 100644 --- a/src/sage/geometry/polyhedron/backend_cdd.py +++ b/src/sage/geometry/polyhedron/backend_cdd.py @@ -244,19 +244,19 @@ def _init_from_cdd_output(self, cddout): Check that :trac:`31253` is fixed:: - sage: P = polytopes.permutahedron(2, backend='cdd') - sage: P.Hrepresentation() - (An inequality (0, 1) x - 1 >= 0, - An inequality (1, 0) x - 1 >= 0, - An equation (1, 1) x - 3 == 0) - sage: Q = Polyhedron(P.vertices(), backend='cdd') - sage: Q.Hrepresentation() - (An inequality (-1, 0) x + 2 >= 0, - An inequality (1, 0) x - 1 >= 0, - An equation (1, 1) x - 3 == 0) - sage: [x.ambient_Hrepresentation() for x in P.facets()] - [(An inequality (1, 0) x - 1 >= 0, An equation (1, 1) x - 3 == 0), - (An inequality (0, 1) x - 1 >= 0, An equation (1, 1) x - 3 == 0)] + sage: P = polytopes.permutahedron(2, backend='cdd') + sage: P.Hrepresentation() + (An inequality (0, 1) x - 1 >= 0, + An inequality (1, 0) x - 1 >= 0, + An equation (1, 1) x - 3 == 0) + sage: Q = Polyhedron(P.vertices(), backend='cdd') + sage: Q.Hrepresentation() + (An inequality (-1, 0) x + 2 >= 0, + An inequality (1, 0) x - 1 >= 0, + An equation (1, 1) x - 3 == 0) + sage: [x.ambient_Hrepresentation() for x in P.facets()] + [(An inequality (1, 0) x - 1 >= 0, An equation (1, 1) x - 3 == 0), + (An inequality (0, 1) x - 1 >= 0, An equation (1, 1) x - 3 == 0)] """ cddout = cddout.splitlines() From 87ac4e2752279b7d6aa36fdb60c642fd437dface Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:45:36 -0700 Subject: [PATCH 276/416] src/sage/geometry/polyhedron/backend_polymake.py: Fix errors shown by tox -e rst --- .../geometry/polyhedron/backend_polymake.py | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sage/geometry/polyhedron/backend_polymake.py b/src/sage/geometry/polyhedron/backend_polymake.py index 776cb613074..1e071121d36 100644 --- a/src/sage/geometry/polyhedron/backend_polymake.py +++ b/src/sage/geometry/polyhedron/backend_polymake.py @@ -601,29 +601,29 @@ def __getstate__(self): TESTS:: - sage: P = polytopes.simplex(backend='polymake') # optional - polymake - sage: P.__getstate__() # optional - polymake - (Polyhedra in QQ^4, - {'_Hrepresentation': (An inequality (0, -1, -1, -1) x + 1 >= 0, - An inequality (0, 1, 0, 0) x + 0 >= 0, - An inequality (0, 0, 1, 0) x + 0 >= 0, - An inequality (0, 0, 0, 1) x + 0 >= 0, - An equation (1, 1, 1, 1) x - 1 == 0), - '_Vrepresentation': (A vertex at (1, 0, 0, 0), - A vertex at (0, 1, 0, 0), - A vertex at (0, 0, 1, 0), - A vertex at (0, 0, 0, 1)), - '_pickle_equations': [(-1, 1, 1, 1, 1)], - '_pickle_inequalities': [(1, 0, -1, -1, -1), - (0, 0, 1, 0, 0), - (0, 0, 0, 1, 0), - (0, 0, 0, 0, 1)], - '_pickle_lines': [], - '_pickle_rays': [], - '_pickle_vertices': [(1, 0, 0, 0), - (0, 1, 0, 0), - (0, 0, 1, 0), - (0, 0, 0, 1)]}) + sage: P = polytopes.simplex(backend='polymake') # optional - polymake + sage: P.__getstate__() # optional - polymake + (Polyhedra in QQ^4, + {'_Hrepresentation': (An inequality (0, -1, -1, -1) x + 1 >= 0, + An inequality (0, 1, 0, 0) x + 0 >= 0, + An inequality (0, 0, 1, 0) x + 0 >= 0, + An inequality (0, 0, 0, 1) x + 0 >= 0, + An equation (1, 1, 1, 1) x - 1 == 0), + '_Vrepresentation': (A vertex at (1, 0, 0, 0), + A vertex at (0, 1, 0, 0), + A vertex at (0, 0, 1, 0), + A vertex at (0, 0, 0, 1)), + '_pickle_equations': [(-1, 1, 1, 1, 1)], + '_pickle_inequalities': [(1, 0, -1, -1, -1), + (0, 0, 1, 0, 0), + (0, 0, 0, 1, 0), + (0, 0, 0, 0, 1)], + '_pickle_lines': [], + '_pickle_rays': [], + '_pickle_vertices': [(1, 0, 0, 0), + (0, 1, 0, 0), + (0, 0, 1, 0), + (0, 0, 0, 1)]}) """ state = super().__getstate__() state = (state[0], state[1].copy()) From a09c09a28130e42423a2d49b98cd527d01560e2a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:47:03 -0700 Subject: [PATCH 277/416] src/sage/geometry/polyhedron/base3.py: Fix errors shown by tox -e rst --- src/sage/geometry/polyhedron/base3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/geometry/polyhedron/base3.py b/src/sage/geometry/polyhedron/base3.py index 3a70cf79afc..0b85c4f944c 100644 --- a/src/sage/geometry/polyhedron/base3.py +++ b/src/sage/geometry/polyhedron/base3.py @@ -1100,7 +1100,7 @@ def a_maximal_chain(self): sage: [face.ambient_V_indices() for face in chain] [(), (5,), (0, 5), (0, 3, 4, 5), (0, 1, 2, 3, 4, 5, 6, 7)] - TESTS:: + TESTS: Check output for the empty polyhedron:: From 05df4769cca846e6f097324b191513cd2ae3a3fb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 18:54:20 -0700 Subject: [PATCH 278/416] src/sage/schemes: Fix some errors shown by tox -e rst --- src/sage/schemes/elliptic_curves/ell_rational_field.py | 2 +- src/sage/schemes/elliptic_curves/hom_composite.py | 2 +- src/sage/schemes/elliptic_curves/weierstrass_morphism.py | 2 +- src/sage/schemes/hyperelliptic_curves/jacobian_homset.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 6b1f1bc1868..7e24738dcf1 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -3567,7 +3567,7 @@ def _generalized_congmod_numbers(self, M, invariant="both"): - ``M`` -- non-negative integer; this function is only ever called on `M > 1`, although the algorithm works fine for the case `M = 1` - - ``invariant`` -- string (default: "both"``); options are: + - ``invariant`` -- string (default: ``"both"``); options are: - "both" -- both modular degree and congruence number at level `MN` are computed diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 8b5c41356fe..8184e86a7dc 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -414,7 +414,7 @@ def _eval(self, P): INPUT: a sequence of 3 coordinates defining a point on ``self`` - OUTPUT: the result of evaluating ``self'' at the given point + OUTPUT: the result of evaluating ``self`` at the given point EXAMPLES:: diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 4df16edf3b2..13617317e4b 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -586,7 +586,7 @@ def _eval(self, P): INPUT: a sequence of 3 coordinates defining a point on ``self`` - OUTPUT: the result of evaluating ``self'' at the given point + OUTPUT: the result of evaluating ``self`` at the given point EXAMPLES:: diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py index 287cab4a49f..f7b0a1f67f0 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py @@ -76,13 +76,13 @@ def __call__(self, P): 0. A point P in J = Jac(C), returning P; 1. A point P on the curve C such that J = Jac(C), where C is - an odd degree model, returning [P - oo]; + an odd degree model, returning [P - oo]; 2. A pair of points (P, Q) on the curve C such that J = Jac(C), - returning [P-Q]; + returning [P-Q]; 3. A list of polynomials (a,b) such that `b^2 + h*b - f = 0 mod a`, - returning [(a(x),y-b(x))]. + returning [(a(x),y-b(x))]. EXAMPLES:: From e459087afd695de1dcf7fe8f0ae19d572ba19286 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:05:53 -0700 Subject: [PATCH 279/416] src/sage/graphs: Fix some errors shown by tox -e rst --- src/sage/graphs/digraph.py | 14 ++++++++------ src/sage/graphs/domination.py | 2 +- src/sage/graphs/generic_graph.py | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/sage/graphs/digraph.py b/src/sage/graphs/digraph.py index a17d008e6b1..5b4c53e6f2c 100644 --- a/src/sage/graphs/digraph.py +++ b/src/sage/graphs/digraph.py @@ -3941,9 +3941,10 @@ def _rec_out_branchings(depth): This function makes use of the following to keep track of partial out branchings: - list_edges -- list of edges in self. - list_merged_edges -- list of edges that are currently merged - graph -- a copy of self where edges have an appropriate label + + - ``list_edges`` -- list of edges in self. + - ``list_merged_edges`` -- list of edges that are currently merged + - ``graph`` -- a copy of self where edges have an appropriate label """ if not depth: # We have enough merged edges to form a out_branching @@ -4158,9 +4159,10 @@ def _rec_in_branchings(depth): This function makes use of the following to keep track of partial in branchings: - list_edges -- list of edges in self. - list_merged_edges -- list of edges that are currently merged - graph -- a copy of self where edges have an appropriate label + + - ``list_edges`` -- list of edges in self. + - ``list_merged_edges`` -- list of edges that are currently merged + - ``graph`` -- a copy of self where edges have an appropriate label """ if not depth: # We have enough merged edges to form a in_branching diff --git a/src/sage/graphs/domination.py b/src/sage/graphs/domination.py index 73d8314b69e..25ac5122332 100644 --- a/src/sage/graphs/domination.py +++ b/src/sage/graphs/domination.py @@ -513,7 +513,7 @@ def _aux_with_rep(H, to_dom, u_next): .. WARNING:: - The same output may be output several times (up to |H| times). + The same output may be output several times (up to ``H`` times). In order to later remove duplicates, we here output pairs ``(ext, i)`` where ``ext`` is the output candidate extension and ``i`` counts how diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index c5ef0c06ec5..dcda5d458f8 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2244,7 +2244,7 @@ def distance_matrix(self, vertices=None, *, base_ring=None, **kwds): * :meth:`~sage.graphs.generic_graph.GenericGraph.distance_all_pairs` -- computes the distance between any two vertices. - TESTS:: + TESTS: Asking for an immutable matrix:: From ab4f8dc25624fda09e5b5ebf3e4e87ee24015d09 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:10:59 -0700 Subject: [PATCH 280/416] src/sage/matrix: Fix errors shown by tox -e rst --- src/sage/matrix/matrix_space.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py index d14addb5bfb..c29bcc64260 100644 --- a/src/sage/matrix/matrix_space.py +++ b/src/sage/matrix/matrix_space.py @@ -538,7 +538,7 @@ def __classcall__(cls, base_ring, nrows, ncols=None, sparse=False, implementatio ... ValueError: unknown matrix implementation 'foobar' over Integer Ring - Check that :trac:`29466`is fixed:: + Check that :trac:`29466` is fixed:: sage: class MyMatrixSpace(MatrixSpace): ....: @staticmethod @@ -580,7 +580,7 @@ def __init__(self, base_ring, nrows, ncols, sparse, implementation): r""" INPUT: - - ``base_ring` + - ``base_ring`` - ``nrows`` - (positive integer) the number of rows @@ -1107,7 +1107,7 @@ def _coerce_map_from_base_ring(self): return self._generic_coerce_map(self.base_ring()) def _coerce_map_from_(self, S): - """ + r""" Canonical coercion from ``S`` to this matrix space. EXAMPLES:: From 1b29e34afe600d81dff6315ec47ddf1959e17312 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:12:24 -0700 Subject: [PATCH 281/416] src/sage/topology: Fix errors shown by tox -e rst --- src/sage/topology/simplicial_complex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index be4e2626ee9..7aa029b7c27 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -2230,7 +2230,7 @@ def _homology_(self, dim=None, base_ring=ZZ, subcomplex=None, :type reduced: boolean; optional, default ``True`` :param generators: If ``True``, return the homology groups and - also generators for them. + also generators for them. :type reduced: boolean; optional, default ``False`` From 7a2feed2831e6f4e1d3bb5875572d54f7201239c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:13:50 -0700 Subject: [PATCH 282/416] src/sage/symbolic: Fix errors shown by tox -e rst --- src/sage/symbolic/expression_conversions.py | 2 +- src/sage/symbolic/integration/external.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sage/symbolic/expression_conversions.py b/src/sage/symbolic/expression_conversions.py index b4952b359fc..ff5f9c2c9dd 100644 --- a/src/sage/symbolic/expression_conversions.py +++ b/src/sage/symbolic/expression_conversions.py @@ -2108,7 +2108,7 @@ def __init__(self, ex, *args): sage: s(1/foo(foo(x)) + foo(2)) 1/bar(bar(x)) + bar(2) - TESTS:: + TESTS: Check that the old syntax still works:: diff --git a/src/sage/symbolic/integration/external.py b/src/sage/symbolic/integration/external.py index 7e91380de60..0760f20920b 100644 --- a/src/sage/symbolic/integration/external.py +++ b/src/sage/symbolic/integration/external.py @@ -94,8 +94,6 @@ def mma_free_integrator(expression, v, a=None, b=None): sage: result.simplify_trig() # optional - internet -1/2*cos(y)*sin(y) + 1/2*y - :: - Check that :trac:`14764` is resolved:: sage: integrate(x^2, x, 0, 1, algorithm="mathematica_free") # optional - internet From a39244fcc74f0fe0fe0212742d741bd26b2cdb6d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:14:51 -0700 Subject: [PATCH 283/416] src/sage/functions: Fix errors shown by tox -e rst --- src/sage/functions/piecewise.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/functions/piecewise.py b/src/sage/functions/piecewise.py index b9a5156c534..688db13a3b8 100644 --- a/src/sage/functions/piecewise.py +++ b/src/sage/functions/piecewise.py @@ -108,7 +108,7 @@ def __call__(self, function_pieces, **kwds): domain and a symbolic function. - ``var=x`` -- a symbolic variable or ``None`` (default). The - real variable in which the function is piecewise in. + real variable in which the function is piecewise in. OUTPUT: From 047a8450d0249eb6b5115df102c986c003efada9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:25:15 -0700 Subject: [PATCH 284/416] src/sage/categories: Fix some errors shown by tox -e rst --- src/sage/categories/category_with_axiom.py | 2 +- src/sage/categories/chain_complexes.py | 2 +- src/sage/categories/enumerated_sets.py | 2 +- src/sage/categories/modules_with_basis.py | 2 +- src/sage/categories/sets_cat.py | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index dd01c69a050..237ad5dfede 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -2352,7 +2352,7 @@ def __reduce__(self): additive magma is implemented as ``MagmasAndAdditiveMagmas.Distributive.AdditiveAssociative.AdditiveCommutative`` and not - ``MagmasAndAdditiveMagmas.Distributive.AdditiveCommutative.AdditiveAssociative``:: + ``MagmasAndAdditiveMagmas.Distributive.AdditiveCommutative.AdditiveAssociative``. EXAMPLES:: diff --git a/src/sage/categories/chain_complexes.py b/src/sage/categories/chain_complexes.py index 1cf64c011d7..531fc48e4cd 100644 --- a/src/sage/categories/chain_complexes.py +++ b/src/sage/categories/chain_complexes.py @@ -235,7 +235,7 @@ def _apply_functor_to_morphism(self, f): r""" Apply ``self`` to a chain map. - TESTS: + TESTS:: sage: E3 = EuclideanSpace(3) # optional - sage.symbolic sage: C = E3.de_rham_complex() # optional - sage.symbolic diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py index 7b36a19c4bd..563a8025e6d 100644 --- a/src/sage/categories/enumerated_sets.py +++ b/src/sage/categories/enumerated_sets.py @@ -179,7 +179,7 @@ def __iter__(self): If none of these are provided, raise a ``NotImplementedError``. - EXAMPLES:: + EXAMPLES: We start with an example where nothing is implemented:: diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index e616ce19241..49d91c17049 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -2166,7 +2166,7 @@ def __call_on_basis__(self, **options): sage: phi(x[1] + x[2] + x[3]) B[1] + 4*B[2] + 9*B[3] - TESTS:: + TESTS: As for usual homsets, the argument can be a Python function:: diff --git a/src/sage/categories/sets_cat.py b/src/sage/categories/sets_cat.py index ea95ab2e527..09a57770a3b 100644 --- a/src/sage/categories/sets_cat.py +++ b/src/sage/categories/sets_cat.py @@ -1471,10 +1471,10 @@ def construction(self): def _test_construction(self, **options): """ - Test that the construction returned by self really yields self. + Test that the construction returned by ``self`` really yields ``self``. - :meth:`construction` either returns None or a pair ``(F,O)``, - and if it returns the latter, then it is supposed that ``F(O)==self`. + :meth:`construction` either returns None or a pair ``(F, O)``, + and if it returns the latter, then it is supposed that ``F(O) == self``. The test verifies this assumption. EXAMPLES: From a4552e10291abdc1be1e9bbf70b98c2c8bb98bcf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:32:21 -0700 Subject: [PATCH 285/416] src/sage/coding: Fix some errors shown by tox -e rst --- src/sage/coding/delsarte_bounds.py | 32 ++++++++--------- src/sage/coding/gabidulin_code.py | 56 +++++++++++++++--------------- src/sage/coding/linear_code.py | 7 ++-- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/sage/coding/delsarte_bounds.py b/src/sage/coding/delsarte_bounds.py index f2c7ae86f26..15d5ade7887 100644 --- a/src/sage/coding/delsarte_bounds.py +++ b/src/sage/coding/delsarte_bounds.py @@ -678,29 +678,29 @@ def delsarte_bound_Q_matrix(q, d, return_data=False, solver="PPL", isinteger=Fal (ILP), rather that an LP solver. Can be very slow if set to ``True``. - EXAMPLES: + EXAMPLES: - The bound on dimension of linear `F_2`-codes of length 10 and minimal distance 6:: + The bound on dimension of linear `F_2`-codes of length 10 and minimal distance 6:: - sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) - sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) - 2 + sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) + sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) + 2 - sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) - sage: [j for i,j in p.get_values(a).items()] - [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) + sage: [j for i,j in p.get_values(a).items()] + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] - TESTS: + TESTS: - cases for using Hamming scheme Q matrix:: + Cases for using Hamming scheme Q matrix:: - sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) - sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) - 2 + sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) + sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) + 2 - sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) - sage: [j for i,j in p.get_values(a).items()] - [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) + sage: [j for i,j in p.get_values(a).items()] + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] """ diff --git a/src/sage/coding/gabidulin_code.py b/src/sage/coding/gabidulin_code.py index 353f76c6ee4..dc1c319dc62 100644 --- a/src/sage/coding/gabidulin_code.py +++ b/src/sage/coding/gabidulin_code.py @@ -45,13 +45,13 @@ class GabidulinCode(AbstractLinearRankMetricCode): EXAMPLES: - A Gabidulin Code can be constructed in the following way: + A Gabidulin Code can be constructed in the following way:: - sage: Fqm = GF(16) - sage: Fq = GF(4) - sage: C = codes.GabidulinCode(Fqm, 2, 2, Fq) - sage: C - [2, 2, 1] linear Gabidulin code over GF(16)/GF(4) + sage: Fqm = GF(16) + sage: Fq = GF(4) + sage: C = codes.GabidulinCode(Fqm, 2, 2, Fq) + sage: C + [2, 2, 1] linear Gabidulin code over GF(16)/GF(4) """ _registered_encoders = {} _registered_decoders = {} @@ -113,7 +113,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, ValueError: 'length' can be at most the degree of the extension, 3 If the number of evaluation points is not equal to the length - of the code, an error is raised: + of the code, an error is raised:: sage: Fqm = GF(5^20) sage: Fq = GF(5) @@ -125,7 +125,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, ValueError: the number of evaluation points should be equal to the length of the code If evaluation points are not linearly independent over the ``base_field``, - an error is raised: + an error is raised:: sage: evals = [ aa*i for i in range(2) ] sage: C = codes.GabidulinCode(Fqm, 2, 2, Fq, None, evals) @@ -134,7 +134,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, ValueError: the evaluation points provided are not linearly independent If an evaluation point does not belong to the ``base_field``, an error - is raised: + is raised:: sage: a = GF(3).gen() sage: evals = [ a*i for i in range(2) ] @@ -146,7 +146,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, Given that both ``sub_field`` and ``twisting_homomorphism`` are specified and ``twisting_homomorphism`` has a fixed field method. If the fixed field of ``twisting_homomorphism`` is not ``sub_field``, an error is - raised: + raised:: sage: Fqm = GF(64) sage: Fq = GF(8) @@ -158,7 +158,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, If ``twisting_homomorphism`` is given, but ``sub_field`` is not. In case ``twisting_homomorphism`` does not have a fixed field method, and error - is raised: + is raised:: sage: Fqm. = GF(64) sage: sigma = Hom(Fqm, Fqm)[1]; sigma @@ -417,7 +417,7 @@ def __init__(self, code): TESTS: - If the code is not a Gabidulin code, an error is raised: + If the code is not a Gabidulin code, an error is raised:: sage: C = codes.HammingCode(GF(4), 2) sage: E = codes.encoders.GabidulinVectorEvaluationEncoder(C) @@ -433,7 +433,7 @@ def _repr_(self): """ Return a string representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -447,7 +447,7 @@ def _latex_(self): r""" Return a latex representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -571,7 +571,7 @@ def __init__(self, code): TESTS: - If the code is not a Gabidulin code, an error is raised: + If the code is not a Gabidulin code, an error is raised:: sage: C = codes.HammingCode(GF(4), 2) sage: E = codes.encoders.GabidulinPolynomialEvaluationEncoder(C) @@ -587,7 +587,7 @@ def _repr_(self): """ Return a string representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -601,7 +601,7 @@ def _latex_(self): r""" Return a latex representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -648,7 +648,7 @@ def message_space(self): r""" Return the message space of the associated code of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -680,7 +680,7 @@ def encode(self, p, form="vector"): - a codeword corresponding to `p` in vector or matrix form - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -749,7 +749,7 @@ def unencode_nocheck(self, c): - a skew polynomial of degree less than ``self.code().dimension()`` - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -800,7 +800,7 @@ def __init__(self, code): TESTS: - If the code is not a Gabidulin code, an error is raised: + If the code is not a Gabidulin code, an error is raised:: sage: C = codes.HammingCode(GF(4), 2) sage: D = codes.decoders.GabidulinGaoDecoder(C) @@ -816,7 +816,7 @@ def _repr_(self): """ Return a string representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -830,7 +830,7 @@ def _latex_(self): r""" Return a latex representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -894,7 +894,7 @@ def _partial_xgcd(self, a, b, d_stop): - ``u_c`` -- right linearized quotient of `a` and `b` - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -942,7 +942,7 @@ def _decode_to_code_and_message(self, r): - the decoded codeword and decoded message corresponding to the received codeword `r` - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -993,7 +993,7 @@ def decode_to_code(self, r): - the decoded codeword corresponding to the received codeword - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(3^20) sage: Fq = GF(3) @@ -1026,7 +1026,7 @@ def decode_to_message(self, r): - the message corresponding to the received codeword - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -1047,7 +1047,7 @@ def decoding_radius(self): """ Return the decoding radius of the Gabidulin Gao Decoder. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5) diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index cfd84e86e5c..3fe439bb848 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -2274,9 +2274,10 @@ def __init__(self, generator, d=None): sage: C.minimum_distance() 3 - We can construct a linear code directly from a vector space - sage: VS = matrix(GF(2), [[1,0,1],\ - [1,0,1]]).row_space() + We can construct a linear code directly from a vector space:: + + sage: VS = matrix(GF(2), [[1,0,1], + ....: [1,0,1]]).row_space() sage: C = LinearCode(VS); C [3, 1] linear code over GF(2) From 3a6c1afcde3d227f165009dccdeb819200ea8c15 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:33:58 -0700 Subject: [PATCH 286/416] src/sage/cpython: Fix errors shown by tox -e rst --- src/sage/cpython/_py2_random.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/cpython/_py2_random.py b/src/sage/cpython/_py2_random.py index b1a4cf37ba9..745834f0cd1 100644 --- a/src/sage/cpython/_py2_random.py +++ b/src/sage/cpython/_py2_random.py @@ -471,7 +471,7 @@ def gammavariate(self, alpha, beta): Conditions on the parameters are alpha > 0 and beta > 0. - The probability distribution function is: + The probability distribution function is:: x ** (alpha - 1) * math.exp(-x / beta) pdf(x) = -------------------------------------- From 521a142222460013ffc64e49f9c27833b6ac050a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:38:30 -0700 Subject: [PATCH 287/416] src/sage/doctest: Fix some errors shown by tox -e rst --- src/sage/doctest/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index beccbeacf1f..db40b1e7b49 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -301,7 +301,7 @@ class Logger(): 'hello world\n' """ def __init__(self, *files): - """ + r""" Initialize the logger for writing to all files in ``files``. TESTS:: From c53c78cac00fb44d36a99aae736a2e2c4aa3f192 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:45:29 -0700 Subject: [PATCH 288/416] src/sage/knots: Fix errors shown by tox -e rst --- 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 c2068ac0842..dafb088c24b 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -3963,7 +3963,7 @@ def get_knotinfo(self, mirror_version=True, unique=True): sage: Ks10_83.sage_link().get_knotinfo() # optional - snappy (, False) - TESTS: + TESTS:: sage: L = KnotInfo.L10a171_1_1_0 # optional - database_knotinfo sage: l = L.link(L.items.braid_notation) # optional - database_knotinfo From 438d08b3672f13f221c270dd83dd5c21c70fb913 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:46:40 -0700 Subject: [PATCH 289/416] src/sage/libs: Fix errors shown by tox -e rst --- src/sage/libs/singular/standard_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/libs/singular/standard_options.py b/src/sage/libs/singular/standard_options.py index 4756a6ec1db..6797cb05001 100644 --- a/src/sage/libs/singular/standard_options.py +++ b/src/sage/libs/singular/standard_options.py @@ -100,7 +100,7 @@ def __exit__(self, typ, value, tb): self.libsingular_option_context.__exit__(typ,value,tb) def libsingular_gb_standard_options(func): - """ + r""" Decorator to force a reduced Singular groebner basis. TESTS:: From 16c80463d2b1df1c6f372f0d52ffeda790ba8a63 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:51:08 -0700 Subject: [PATCH 290/416] src/sage/misc: Fix some errors shown by tox -e rst --- src/sage/misc/abstract_method.py | 2 +- src/sage/misc/inline_fortran.py | 2 +- src/sage/misc/sageinspect.py | 2 +- src/sage/misc/superseded.py | 2 +- src/sage/misc/viewer.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/misc/abstract_method.py b/src/sage/misc/abstract_method.py index 99604777c08..720f7f5a7f0 100644 --- a/src/sage/misc/abstract_method.py +++ b/src/sage/misc/abstract_method.py @@ -182,7 +182,7 @@ def __repr__(self): return "<" + ("optional " if self._optional else "") + "abstract method %s at %s>" % (self.__name__, hex(id(self._f))) def _sage_src_lines_(self): - """ + r""" Returns the source code location for the wrapped function. EXAMPLES:: diff --git a/src/sage/misc/inline_fortran.py b/src/sage/misc/inline_fortran.py index d7ed02fe92b..6e71016c427 100644 --- a/src/sage/misc/inline_fortran.py +++ b/src/sage/misc/inline_fortran.py @@ -47,7 +47,7 @@ def _import_module_from_path(name, path=None): def _import_module_from_path_impl(name, path): - """Implement ``_import_module_from_path for Python 3.4+.""" + """Implement ``_import_module_from_path`` for Python 3.4+.""" # This is remarkably tricky to do right, considering that the new # importlib is supposed to make direct interaction with the import diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 13f0fc1bec3..9add0610149 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -886,7 +886,7 @@ def visit_UnaryOp(self, node): def _grep_first_pair_of_parentheses(s): - """ + r""" Return the first matching pair of parentheses in a code string. INPUT: diff --git a/src/sage/misc/superseded.py b/src/sage/misc/superseded.py index eb2ff9c2b27..2bc69b0ffb8 100644 --- a/src/sage/misc/superseded.py +++ b/src/sage/misc/superseded.py @@ -383,7 +383,7 @@ def __init__(self, trac_number, func, module, instance=None, unbound=None): @lazy_attribute def __name__(self): - """ + r""" TESTS:: sage: from sage.misc.superseded import deprecated_function_alias diff --git a/src/sage/misc/viewer.py b/src/sage/misc/viewer.py index 9bdde290365..de84f31ddf4 100644 --- a/src/sage/misc/viewer.py +++ b/src/sage/misc/viewer.py @@ -161,7 +161,7 @@ def _set(self, app=None, TYPE='browser'): - ``app`` -- ``None`` or a string, the program to use - ``TYPE`` -- a string, must be in the list ``VIEWERS`` defined in - :module:`sage.misc.viewer`. Default 'browser'. + :mod:`sage.misc.viewer`. Default 'browser'. EXAMPLES:: From 450cdc312f4727cdbe952b0798c3de7635292f45 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 19:57:08 -0700 Subject: [PATCH 291/416] src/sage/modular: Fix some errors shown by tox -e rst --- src/sage/modular/btquotients/pautomorphicform.py | 10 +++++----- src/sage/modular/hecke/algebra.py | 4 ++-- src/sage/modular/modform/ring.py | 2 +- .../modular/modform_hecketriangle/abstract_ring.py | 2 +- src/sage/modular/pollack_stevens/modsym.py | 2 +- src/sage/modular/pollack_stevens/sigma0.py | 1 + 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/sage/modular/btquotients/pautomorphicform.py b/src/sage/modular/btquotients/pautomorphicform.py index 10b71899389..ea54c2286ff 100644 --- a/src/sage/modular/btquotients/pautomorphicform.py +++ b/src/sage/modular/btquotients/pautomorphicform.py @@ -672,7 +672,7 @@ def __classcall__(cls, X, k, prec=None, basis_matrix=None, base_field=None): - ``k`` - integer - The weight. It must be even. - ``prec`` - integer (default: None). If specified, the - precision for the coefficient module + precision for the coefficient module - ``basis_matrix`` - a matrix (default: None). @@ -2223,12 +2223,12 @@ def __classcall__(cls, domain, U, prec=None, t=None, R=None, it automatically from ``prec``, ``U`` and the ``overconvergent`` flag. - ``R`` -- (default : None). If specified, coefficient field of the automorphic forms. - If not specified it defaults to the base ring of the distributions ``U``, or to `Q_p` - with the working precision ``prec``. + If not specified it defaults to the base ring of the distributions ``U``, or to `Q_p` + with the working precision ``prec``. - ``overconvergent`` -- Boolean (default = False). If True, will construct overconvergent - `p`-adic automorphic forms. Otherwise it constructs the finite dimensional space of - `p`-adic automorphic forms which is isomorphic to the space of harmonic cocycles. + `p`-adic automorphic forms. Otherwise it constructs the finite dimensional space of + `p`-adic automorphic forms which is isomorphic to the space of harmonic cocycles. EXAMPLES: diff --git a/src/sage/modular/hecke/algebra.py b/src/sage/modular/hecke/algebra.py index e840b306d3e..646f0ecb2cb 100644 --- a/src/sage/modular/hecke/algebra.py +++ b/src/sage/modular/hecke/algebra.py @@ -206,9 +206,9 @@ def __call__(self, x, check=True): - something that can be converted into an element of the underlying matrix space. - In the last case, the parameter ``check'' controls whether or + In the last case, the parameter ``check`` controls whether or not to check that this element really does lie in the - appropriate algebra. At present, setting ``check=True'' raises + appropriate algebra. At present, setting ``check=True`` raises a NotImplementedError unless x is a scalar (or a diagonal matrix). diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index 67b0b236fbb..db1c76ab382 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -202,7 +202,7 @@ def __init__(self, group, base_ring=QQ): - ``base_ring`` (ring, default: `\QQ`) -- a base ring, which should be `\QQ`, `\ZZ`, or the integers mod `p` for some prime `p` - TESTS:: + TESTS: Check that :trac:`15037` is fixed:: diff --git a/src/sage/modular/modform_hecketriangle/abstract_ring.py b/src/sage/modular/modform_hecketriangle/abstract_ring.py index ed30e5e7af1..52922f6a1f2 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_ring.py +++ b/src/sage/modular/modform_hecketriangle/abstract_ring.py @@ -52,7 +52,7 @@ def __init__(self, group, base_ring, red_hom, n): - ``group`` -- The Hecke triangle group (default: ``HeckeTriangleGroup(3)``) - - ``base_ring`` -- The base_ring (default: `\Z). + - ``base_ring`` -- The base_ring (default: `\Z`). - ``red_hom`` -- If ``True`` then results of binary operations are considered homogeneous whenever it makes sense (default: ``False``). diff --git a/src/sage/modular/pollack_stevens/modsym.py b/src/sage/modular/pollack_stevens/modsym.py index 7c71fd24a13..1b6b2164b1a 100644 --- a/src/sage/modular/pollack_stevens/modsym.py +++ b/src/sage/modular/pollack_stevens/modsym.py @@ -1283,7 +1283,7 @@ def _lift_to_OMS(self, p, M, new_base_ring, algorithm = 'greenberg'): OUTPUT: - An overconvergent modular symbol whose specialization - equals self up to some Eisenstein error. + equals self up to some Eisenstein error. EXAMPLES:: diff --git a/src/sage/modular/pollack_stevens/sigma0.py b/src/sage/modular/pollack_stevens/sigma0.py index fa2f4ac7d81..88d86a7a06b 100644 --- a/src/sage/modular/pollack_stevens/sigma0.py +++ b/src/sage/modular/pollack_stevens/sigma0.py @@ -9,6 +9,7 @@ Over `\QQ` or `\ZZ`, it is the monoid of matrices `2\times2` matrices `\begin{pmatrix} a & b \\ c & d \end{pmatrix}` such that + - `ad - bc \ne 0`, - `a` is integral and invertible at the primes dividing `N`, - `c` has valuation at least `v_p(N)` for each `p` dividing `N` (but may be From 74738fbeae44f655e1492c47eba4837a35781187 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 20:01:30 -0700 Subject: [PATCH 292/416] src/sage/plot: Fix some errors shown by tox -e rst --- src/sage/plot/graphics.py | 5 +++-- src/sage/plot/plot.py | 4 +--- src/sage/plot/plot3d/list_plot3d.py | 1 + src/sage/plot/streamline_plot.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py index b80f61dc3c2..e779e1210e3 100644 --- a/src/sage/plot/graphics.py +++ b/src/sage/plot/graphics.py @@ -1331,6 +1331,7 @@ def _set_scale(self, subplot, scale=None, base=None): only for internal use. INPUT: + - ``subplot`` -- matplotlib Axes instance. - ``scale`` -- the scale of the figure. Values it can take are ``"linear"``, ``"loglog"``, ``"semilogx"``, ``"semilogy"``. See @@ -2482,13 +2483,13 @@ def _get_vmin_vmax(self, vmin, vmax, basev, axes_pad): plot; otherwise the reader may assume that the scale is linear. For internal use only. - We check if this case occurs (for e.g. assuming xmin < xmax): + We check if this case occurs (for e.g. assuming xmin < xmax):: floor(logxmin) ceil(logxmax) ----|---------+----------+----------|----------------------|-- logxmin logxmax - Or if this case occurs (assuming xmin < xmax): + Or if this case occurs (assuming xmin < xmax):: floor(logxmin) floor(logxmax) ceil(logxmax) ----|---------+---------------------|-----+----------------|-- diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py index ba571ef5f92..95735332b72 100644 --- a/src/sage/plot/plot.py +++ b/src/sage/plot/plot.py @@ -2064,7 +2064,7 @@ def _plot(funcs, xrange, parametric=False, OUTPUT: a ``Graphics`` object - EXAMPLES:: + EXAMPLES: See :func:`plot` for many, many implicit examples. Here is an explicit one:: @@ -2106,8 +2106,6 @@ def _plot(funcs, xrange, parametric=False, sage: q2 Graphics object consisting of 2 graphics primitives - :: - Make sure that we don't get multiple legend labels for plot segments (:trac:`11998`):: diff --git a/src/sage/plot/plot3d/list_plot3d.py b/src/sage/plot/plot3d/list_plot3d.py index 4c04f5f99ef..417b9a3528a 100644 --- a/src/sage/plot/plot3d/list_plot3d.py +++ b/src/sage/plot/plot3d/list_plot3d.py @@ -506,6 +506,7 @@ def list_plot3d_tuples(v, interpolation_type, **kwds): pi = float(pi) m = matrix(RDF, 6, [sin(i**2 + j**2) for i in np.linspace(0,pi,6) for j in np.linspace(0,pi,6)]) sphinx_plot(list_plot3d(m, color='yellow', interpolation_type='spline', frame_aspect_ratio=[1, 1, 1/3])) + :: sage: show(list_plot3d([[1, 1, 1], [1, 2, 1], [0, 1, 3], [1, 0, 4]], point_list=True)) diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py index 615390ebb8c..8e34bcc297b 100644 --- a/src/sage/plot/streamline_plot.py +++ b/src/sage/plot/streamline_plot.py @@ -108,7 +108,7 @@ def _repr_(self): sage: P[0] StreamlinePlot defined by a 20 x 20 vector grid - TESTS: + TESTS:: sage: x, y = var('x y') sage: P = streamline_plot((sin(x), cos(y)), (x,-3,3), (y,-3,3), wrong_option='nonsense') From dccceb4f56039392b8dd98f62bf0d74d5f25aba8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 20:03:46 -0700 Subject: [PATCH 293/416] src/sage/parallel: Fix errors shown by tox -e rst --- src/sage/parallel/decorate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py index bde55df0df4..c14518af570 100644 --- a/src/sage/parallel/decorate.py +++ b/src/sage/parallel/decorate.py @@ -232,7 +232,7 @@ def _sage_argspec_(self): """ Returns the argument specification for this object, which is just the argument specification for the underlying function. - See :module:`sage.misc.sageinspect` for more information on + See :mod:`sage.misc.sageinspect` for more information on this convention. EXAMPLES:: @@ -252,7 +252,7 @@ def _sage_src_(self): """ Returns the source code for this object, which is just the source code for the underlying function. See - :module:`sage.misc.sageinspect` for more information on this + :mod:`sage.misc.sageinspect` for more information on this convention. EXAMPLES:: @@ -269,10 +269,10 @@ def _sage_src_(self): return sage_getsource(self.func) def _instancedoc_(self): - """ + r""" Returns the docstring for this object, which is just the docstring for the underlying function. See - :module:`sage.misc.sageinspect` for more information on this + :mod:`sage.misc.sageinspect` for more information on this convention. EXAMPLES:: From 4cc56747eb5fe190bf67fe7705a889537570d320 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 20:08:34 -0700 Subject: [PATCH 294/416] src/sage/quadratic_forms: Fix errors shown by tox -e rst --- .../quadratic_form__local_representation_conditions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4ca4a0d0910..bce9d38ed3f 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py +++ b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py @@ -210,7 +210,7 @@ def __init__(self, Q): def __repr__(self): - """ + r""" Print the local conditions. INPUT: From a2f5ef6bb6c88a73b7ee7ca150a7966660383c69 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 20:09:49 -0700 Subject: [PATCH 295/416] src/sage/repl: Fix some errors shown by tox -e rst --- src/sage/repl/rich_output/backend_emacs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/repl/rich_output/backend_emacs.py b/src/sage/repl/rich_output/backend_emacs.py index 820682a046c..c1c54a27ea6 100644 --- a/src/sage/repl/rich_output/backend_emacs.py +++ b/src/sage/repl/rich_output/backend_emacs.py @@ -78,7 +78,7 @@ def default_preferences(self): return DisplayPreferences() def displayhook(self, plain_text, rich_output): - """ + r""" Backend implementation of the displayhook INPUT: From c2d0a913755f78195506cfa50dd9f0656e66d546 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 20:21:22 -0700 Subject: [PATCH 296/416] src/sage/rings: Fix some errors shown by tox -e rst --- src/sage/rings/asymptotic/term_monoid.py | 16 ++++++++-------- src/sage/rings/complex_interval_field.py | 2 +- src/sage/rings/function_field/place.py | 2 +- src/sage/rings/number_field/bdd_height.py | 6 +++--- src/sage/rings/number_field/number_field.py | 2 +- src/sage/rings/number_field/number_field_rel.py | 2 +- src/sage/rings/number_field/order.py | 4 ++-- src/sage/rings/padics/lattice_precision.py | 5 ++++- src/sage/rings/polynomial/ore_polynomial_ring.py | 2 +- src/sage/rings/tests.py | 6 ++++-- 10 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/sage/rings/asymptotic/term_monoid.py b/src/sage/rings/asymptotic/term_monoid.py index 53dfbc621a1..36b3d2e4f33 100644 --- a/src/sage/rings/asymptotic/term_monoid.py +++ b/src/sage/rings/asymptotic/term_monoid.py @@ -1916,7 +1916,7 @@ def _validate_growth_or_error_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -1976,7 +1976,7 @@ def _validate_coefficient_or_error_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -2068,7 +2068,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -2991,7 +2991,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -3588,7 +3588,7 @@ def _validate_coefficient_or_error_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -3676,7 +3676,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -4453,7 +4453,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -4995,7 +4995,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: diff --git a/src/sage/rings/complex_interval_field.py b/src/sage/rings/complex_interval_field.py index effc3b60648..f7c9ab64eaf 100644 --- a/src/sage/rings/complex_interval_field.py +++ b/src/sage/rings/complex_interval_field.py @@ -12,7 +12,7 @@ - Carl Witty (2007-10-24): rewrite for intervals -- Niles Johnson (2010-08): :Trac:`3893`: ``random_element()`` +- Niles Johnson (2010-08): :trac:`3893`: ``random_element()`` should pass on ``*args`` and ``**kwds``. - Travis Scrimshaw (2012-10-18): Added documentation to get full coverage. diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index 190d0329efc..a05d9ae3fae 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -941,7 +941,7 @@ def _residue_field(self, name=None): def to_V(e): """ - An example to show the idea: Suppose that + An example to show the idea: Suppose that:: [x 0 0] M = [0 1 0] and v = (x^10, x^7 + x^3, x^7 + x^4 + x^3 + 1) diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py index 39ab3ceca09..7e863142524 100644 --- a/src/sage/rings/number_field/bdd_height.py +++ b/src/sage/rings/number_field/bdd_height.py @@ -454,14 +454,14 @@ def rational_in(x, y): def delta_approximation(x, delta): r""" - Compute a rational number in range (x-delta, x+delta) + Compute a rational number in range `(x-delta, x+delta)` """ return rational_in(x - delta, x + delta) def vector_delta_approximation(v, delta): r""" - Compute a rational vector w=(w1, ..., wn) - such that |vi-wi| Date: Mon, 11 Jul 2022 20:23:24 -0700 Subject: [PATCH 297/416] src/sage/structure: Fix errors shown by tox -e rst --- src/sage/structure/global_options.py | 2 +- src/sage/structure/sequence.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/structure/global_options.py b/src/sage/structure/global_options.py index 57c3cb74b00..a529d39cd5e 100644 --- a/src/sage/structure/global_options.py +++ b/src/sage/structure/global_options.py @@ -1384,7 +1384,7 @@ def __getstate__(self): def __eq__(self, other): r""" - Two options classes are equal if they return the same :meth:`__getstate__. + Two options classes are equal if they return the same :meth:`__getstate__`. EXAMPLES:: diff --git a/src/sage/structure/sequence.py b/src/sage/structure/sequence.py index 49fa26c7490..6cdaa84e4ef 100644 --- a/src/sage/structure/sequence.py +++ b/src/sage/structure/sequence.py @@ -405,7 +405,7 @@ class Sequence_generic(sage.structure.sage_object.SageObject, list): """ def __init__(self, x, universe=None, check=True, immutable=False, cr=False, cr_str=None, use_sage_types=False): - """ + r""" Create a sequence. EXAMPLES:: @@ -685,7 +685,7 @@ def _latex_(self): return list_latex_function(self) def __str__(self): - """ + r""" EXAMPLES:: sage: s = Sequence([1,2,3], cr=False) From 18121fe1aead7e80c81f81e8fcedfb642e9a236f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 20:27:14 -0700 Subject: [PATCH 298/416] src/sage/modules: Fix errors shown by tox -e rst --- src/sage/modules/fp_graded/free_morphism.py | 2 +- src/sage/modules/fp_graded/steenrod/morphism.py | 6 +++--- src/sage/modules/free_module.py | 2 +- src/sage/modules/quotient_module.py | 2 +- src/sage/modules/vector_space_homspace.py | 3 +++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/sage/modules/fp_graded/free_morphism.py b/src/sage/modules/fp_graded/free_morphism.py index ab1bd91015b..8044fb3883b 100755 --- a/src/sage/modules/fp_graded/free_morphism.py +++ b/src/sage/modules/fp_graded/free_morphism.py @@ -55,7 +55,7 @@ class FreeGradedModuleMorphism(FPModuleMorphism): Defn: b[4] |--> (Sq(0,2)+Sq(3,1)+Sq(6))*d[2] b[5] |--> (Sq(1,2)+Sq(7))*d[2] + (Sq(0,2)+Sq(3,1)+Sq(6))*d[3] - TESTS:: + TESTS: A non-example because the degree is not well-defined:: diff --git a/src/sage/modules/fp_graded/steenrod/morphism.py b/src/sage/modules/fp_graded/steenrod/morphism.py index d55b51faf4a..595db1a33aa 100755 --- a/src/sage/modules/fp_graded/steenrod/morphism.py +++ b/src/sage/modules/fp_graded/steenrod/morphism.py @@ -280,7 +280,7 @@ def _resolve_kernel(self, top_dim=None, verbose=False): OUTPUT: A homomorphism `j: F \rightarrow D` where `D` is the domain of this homomorphism, `F` is free and such that `\ker(self) = \operatorname{im}(j)`. - TESTS: + TESTS:: sage: from sage.modules.fp_graded.steenrod.module import SteenrodFPModule sage: A = SteenrodAlgebra(2) @@ -328,7 +328,7 @@ def _resolve_image(self, top_dim=None, verbose=False): of this homomorphism, `F` is free, and `\operatorname{im}(self) = \operatorname{im}(j)`. - TESTS: + TESTS:: sage: from sage.modules.fp_graded.steenrod.module import SteenrodFPModule sage: A = SteenrodAlgebra(2) @@ -348,7 +348,7 @@ def _action(self, method, *args, **kwds): Changes the ground ring to a finite algebra, acts by the given method and changes back into the original ground ring before returning. - TESTS: + TESTS:: sage: from sage.modules.fp_graded.steenrod.module import SteenrodFPModule sage: from sage.modules.fp_graded.morphism import FPModuleMorphism diff --git a/src/sage/modules/free_module.py b/src/sage/modules/free_module.py index 628ffb636c8..deb966b9e7f 100644 --- a/src/sage/modules/free_module.py +++ b/src/sage/modules/free_module.py @@ -5321,7 +5321,7 @@ def echelonized_basis_matrix(self): def _echelon_matrix_richcmp(self, other, op): r""" - Compare the free module ``self`` with ``other`. + Compare the free module ``self`` with ``other``. This compares modules by their ambient spaces, then by dimension, then in order by their echelon matrices. However, if diff --git a/src/sage/modules/quotient_module.py b/src/sage/modules/quotient_module.py index fbb370a018c..f7aa99210a1 100644 --- a/src/sage/modules/quotient_module.py +++ b/src/sage/modules/quotient_module.py @@ -155,7 +155,7 @@ def _coerce_map_from_(self, M): """ Return a coercion map from `M` to ``self``, or ``None``. - TESTS: + TESTS:: sage: S. = PolynomialRing(QQ) sage: M = S**2 diff --git a/src/sage/modules/vector_space_homspace.py b/src/sage/modules/vector_space_homspace.py index 75727ba261d..13004ea14ce 100644 --- a/src/sage/modules/vector_space_homspace.py +++ b/src/sage/modules/vector_space_homspace.py @@ -249,14 +249,17 @@ def __call__(self, A, check=True, **kwds): - ``A`` - one of several possible inputs representing a morphism from this vector space homspace. + - a vector space morphism in this homspace - a matrix representation relative to the bases of the vector spaces, which acts on a vector placed to the left of the matrix - a list or tuple containing images of the domain's basis vectors - a function from the domain to the codomain + - ``check`` (default: True) - ``True`` or ``False``, required for compatibility with calls from :meth:`sage.structure.parent.Parent.hom`. + - the keyword ``side`` can be assigned the values ``"left"`` or ``"right"``. It corresponds to the side of vectors relative to the matrix. From d24eea822da6c3676b3194898da152828f3ee46b Mon Sep 17 00:00:00 2001 From: Jing Guo Date: Tue, 12 Jul 2022 12:42:04 +0800 Subject: [PATCH 299/416] 33971: Allow domain and codomain have diff dim's --- src/sage/schemes/affine/affine_morphism.py | 9 ++++ .../schemes/projective/projective_morphism.py | 43 +++++++++++-------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index f3938e7e773..537415cf558 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -733,6 +733,15 @@ def global_height(self, prec=None): sage: f = H([1/3*x^2 + 10, 7*x^3]) sage: f.global_height() 3.40119738166216 + + :: + + sage: P. = AffineSpace(QQ, 2) + sage: A. = AffineSpace(QQ, 1) + sage: H = Hom(P, A) + sage: f = H([1/1331*x^2 + 4000*y]) + sage: f.global_height() + 15.4877354584971 """ return self.homogenize(0).global_height(prec=prec) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 04fddebf9be..ce9ff261fc4 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1300,51 +1300,57 @@ def global_height(self, prec=None): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.global_height() 20.8348429892146 :: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.global_height(prec=11) 20.8 - This function does not automatically normalize:: + :: - sage: P. = ProjectiveSpace(ZZ,2) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(ZZ, 2) + sage: H = Hom(P, P) sage: f = H([4*x^2 + 100*y^2, 210*x*y, 10000*z^2]); sage: f.global_height() 8.51719319141624 - sage: f.normalize_coordinates() - sage: f.global_height() - 8.51719319141624 :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2-2) + sage: K. = NumberField(z^2 - 2) sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O,1) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(O, 1) + sage: H = Hom(P, P) sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) sage: f.global_height() 1.09861228866811 :: - sage: P. = ProjectiveSpace(QQbar,1) - sage: P2. = ProjectiveSpace(QQbar,2) - sage: H = Hom(P,P2) + sage: P. = ProjectiveSpace(QQbar, 1) + sage: P2. = ProjectiveSpace(QQbar, 2) + sage: H = Hom(P, P2) sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) sage: f.global_height() 1.09861228866811 + :: + + sage: P. = ProjectiveSpace(QQ, 2) + sage: A. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, A) + sage: f = H([1/1331*x^2 + 4000*y*z, y^2]) + sage: f.global_height() + 15.4877354584971 + :: sage: P. = ProjectiveSpace(QQ, 1) @@ -1371,9 +1377,8 @@ def global_height(self, prec=None): else: raise TypeError("Must be over a Numberfield or a Numberfield Order or QQbar") - coeffs = [] - for i in range(self.domain().ambient_space().dimension_relative() + 1): - coeffs += f[i].coefficients() + # Get the coefficients from all of the polynomials in the dynamical system + coeffs = [x for xs in [k.coefficients() for k in f] for x in xs] from sage.schemes.projective.projective_space import ProjectiveSpace From d66c66e75f41c911f779c28083e20054770f794b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 11 Jul 2022 22:47:04 -0700 Subject: [PATCH 300/416] .github/workflows/lint.yml: Do not fail when rst checks fail --- .github/workflows/lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 811a61cc928..8456f3666dc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -50,3 +50,5 @@ jobs: run: pip install tox - name: Lint using tox -e rst run: tox -e rst + # Until all errors are fixed: + continue-on-error: true From 0677319ed0309e28ba3f125b2b06366e3f9462f6 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Jul 2022 16:47:27 +0900 Subject: [PATCH 301/416] Fix a typo --- src/sage/game_theory/normal_form_game.py | 2 +- src/sage/graphs/domination.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/game_theory/normal_form_game.py b/src/sage/game_theory/normal_form_game.py index 2e27caa4a60..f1adc424e3e 100644 --- a/src/sage/game_theory/normal_form_game.py +++ b/src/sage/game_theory/normal_form_game.py @@ -1137,7 +1137,7 @@ def _gambit_(self, as_integer=False, maximization=True): { "" 3, 5, 8 } { "" 2, 6, 4 } } - 1 2 3 4 5 6 7 8 + 1 2 3 4 5 6 7 8 """ from decimal import Decimal diff --git a/src/sage/graphs/domination.py b/src/sage/graphs/domination.py index 25ac5122332..8cc1e57de9c 100644 --- a/src/sage/graphs/domination.py +++ b/src/sage/graphs/domination.py @@ -513,7 +513,7 @@ def _aux_with_rep(H, to_dom, u_next): .. WARNING:: - The same output may be output several times (up to ``H`` times). + The same output may be output several times (up to `|H|` times). In order to later remove duplicates, we here output pairs ``(ext, i)`` where ``ext`` is the output candidate extension and ``i`` counts how @@ -593,7 +593,7 @@ def minimal_dominating_sets(G, to_dominate=None, work_on_copy=True): - ``work_on_copy`` -- boolean (default: ``True``); whether or not to work on a copy of the input graph; if set to ``False``, the input graph will be modified (relabeled). - + OUTPUT: An iterator over the inclusion-minimal sets of vertices of ``G``. From 4c025d33996853981dba8612a4bed42167e3bc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 12 Jul 2022 11:14:21 +0200 Subject: [PATCH 302/416] some pyflakes details in quadratic forms --- ...tic_form__local_representation_conditions.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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 52006fc0a21..9c9fdfd588d 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py +++ b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py @@ -1,18 +1,18 @@ """ Local Representation Conditions """ -########################################################################## -# Class for keeping track of the local conditions for representability ## -# of numbers by a quadratic form over ZZ (and eventually QQ also). ## -########################################################################## +######################################################################## +# Class for keeping track of the local conditions for representability # +# of numbers by a quadratic form over ZZ (and eventually QQ also). # +######################################################################## from copy import deepcopy -from sage.rings.integer_ring import ZZ from sage.arith.all import prime_divisors, valuation, is_square +from sage.misc.functional import numerator, denominator from sage.quadratic_forms.extras import least_quadratic_nonresidue from sage.rings.infinity import infinity -from sage.misc.functional import numerator, denominator +from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ @@ -165,7 +165,6 @@ def __init__(self, Q): # -------------------------------------------------- N = Q.level() level_primes = prime_divisors(N) - prime_repn_modulus_list = [p**(valuation(4*N, p) + 2) for p in level_primes] # Make a table of local normal forms for each p | N local_normal_forms = [Q.local_normal_form(p) for p in level_primes] @@ -381,7 +380,7 @@ def local_conditions_vector_for_prime(self, p): v = [p, None, None, None, None, None, None, None, None] sqclass = self.squareclass_vector(p) - for i in range(len(sq_class)): + for i in range(len(sqclass)): if QQ(self.coeff / sqclass[i]).is_padic_square(p): # Note:This should happen only once! nu = valuation(self.coeff / sqclass[i], p) / 2 else: @@ -395,8 +394,6 @@ def local_conditions_vector_for_prime(self, p): raise RuntimeError("Error... The dimension stored should be a non-negative integer!") - - def is_universal_at_prime(self, p): """ Determines if the (integer-valued/rational) quadratic form represents all of `Z_p`. From 7b1b93787f017b3baaa40fc5a3a6d9f8bbb78850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 12 Jul 2022 21:21:14 +0200 Subject: [PATCH 303/416] rst fixes in schemes --- src/sage/schemes/curves/zariski_vankampen.py | 2 +- .../cyclic_covers/cycliccover_finite_field.py | 2 +- .../elliptic_curves/ell_number_field.py | 2 +- .../elliptic_curves/ell_rational_field.py | 8 ++++--- .../elliptic_curves/gal_reps_number_field.py | 9 +++++--- .../schemes/elliptic_curves/isogeny_class.py | 2 +- src/sage/schemes/elliptic_curves/padics.py | 13 ++++------- .../schemes/elliptic_curves/period_lattice.py | 4 ++-- .../riemann_surfaces/riemann_surface.py | 23 ++++++++++--------- 9 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/sage/schemes/curves/zariski_vankampen.py b/src/sage/schemes/curves/zariski_vankampen.py index f2ab4c69307..71956e584e5 100644 --- a/src/sage/schemes/curves/zariski_vankampen.py +++ b/src/sage/schemes/curves/zariski_vankampen.py @@ -732,7 +732,7 @@ def geometric_basis(G, E, p): - ``G`` -- the graph of the bounded regions of a Voronoi Diagram - ``E`` -- the subgraph of ``G`` formed by the edges that touch an unbounded - region + region - ``p`` -- a vertex of ``E`` diff --git a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py index 618e0d847cc..1ff68f8d4cd 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py @@ -855,7 +855,7 @@ def _reduce_vector_vertical_plain(G, s0, s, k=1): OUTPUT: - a vector -- `H \in W_{-1, r*(s - k) + s0}` such that - `G y^{-(r*s + s0)} dx \cong H y^{-(r*(s -k) + s0)} dx` + `G y^{-(r*s + s0)} dx \cong H y^{-(r*(s -k) + s0)} dx` """ if self._verbose > 2: print( diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 67a89a6736c..e56794443c0 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -737,7 +737,7 @@ def _scale_by_units(self): A model for this elliptic curve, optimally scaled with respect to scaling by units, with respect to the logarithmic embedding - of |c4|^(1/4)+|c6|^(1/6). No scaling by roots of unity is + of `|c4|^(1/4)+|c6|^(1/6)`. No scaling by roots of unity is carried out, so there is no change when the unit rank is 0. EXAMPLES:: diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 6b1f1bc1868..ee8e69a9293 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -6417,10 +6417,12 @@ def S_integral_points_with_bounded_mw_coeffs(): Return the set of S-integers x which are x-coordinates of points on the curve which are linear combinations of the generators (basis and torsion points) with coefficients - bounded by `H_q`. The bound `H_q` will be computed at - runtime. + bounded by `H_q`. + + The bound `H_q` will be computed at runtime. + (Modified version of integral_points_with_bounded_mw_coeffs() in - integral_points() ) + integral_points()) .. TODO:: 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 cc950676c6d..9f1893b0e00 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -570,11 +570,14 @@ def primes_iter(): L = [2] + L return L + def _exceptionals(E, L, patience=1000): r""" - Determine which primes in L are exceptional for E, using Proposition 19 - of Section 2.8 of Serre's ``Propriétés Galoisiennes des Points d'Ordre - Fini des Courbes Elliptiques'' [Ser1972]_. + Determine which primes in L are exceptional for E. + + This is done using Proposition 19 of Section 2.8 of Serre's + *Propriétés Galoisiennes des Points d'Ordre Fini des Courbes Elliptiques* + [Ser1972]_. INPUT: diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index 59f271a1d39..340a7710ca2 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -97,7 +97,7 @@ def __iter__(self): def __getitem__(self, i): """ - Return the `i`th curve in the class. + Return the `i` th curve in the class. EXAMPLES:: diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index e77387298b0..509d94e9e33 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -1646,24 +1646,22 @@ def matrix_of_frobenius(self, p, prec=20, check=False, check_hypotheses=True, al return frob_p.change_ring(Zp(p, prec)) + def _brent(F, p, N): r""" This is an internal function; it is used by padic_sigma(). - `F` is a assumed to be a power series over - `R = \ZZ/p^{N-1}\ZZ`. + `F` is a assumed to be a power series over `R = \ZZ/p^{N-1}\ZZ`. It solves the differential equation `G'(t)/G(t) = F(t)` using Brent's algorithm, with initial condition `G(0) = 1`. - It is assumed that the solution `G` has - `p`-integral coefficients. + It is assumed that the solution `G` has `p`-integral coefficients. More precisely, suppose that `f(t)` is a power series with genuine `p`-adic coefficients, and suppose that `g(t)` is an exact solution to `g'(t)/g(t) = f(t)`. Let `I` be the ideal - `(p^N, p^{N-1} t, \ldots, - p t^{N-1}, t^N)`. The input + `(p^N, p^{N-1} t, \ldots, p t^{N-1}, t^N)`. The input `F(t)` should be a finite-precision approximation to `f(t)`, in the sense that `\int (F - f) dt` should lie in `I`. Then the function returns a series @@ -1673,8 +1671,7 @@ def _brent(F, p, N): some log-log factors. For more information, and a proof of the precision guarantees, see - Lemma 4 in "Efficient Computation of p-adic Heights" (David - Harvey). + Lemma 4 in "Efficient Computation of p-adic Heights" (David Harvey). AUTHORS: diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 41734a69716..704fe7e4d0b 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -142,10 +142,10 @@ def __init__(self, E, embedding=None): - use the built-in coercion to `\RR` for `K=\QQ`; - use the first embedding into `\RR` given by - ``K.embeddings(RealField())``, if there are any; + ``K.embeddings(RealField())``, if there are any; - use the first embedding into `\CC` given by - ``K.embeddings(ComplexField())``, if `K` is totally complex. + ``K.embeddings(ComplexField())``, if `K` is totally complex. .. NOTE:: diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py index 7ed22dcdd61..bae271bc76c 100644 --- a/src/sage/schemes/riemann_surfaces/riemann_surface.py +++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py @@ -1558,17 +1558,18 @@ def _bounding_data(self, differentials): the list corresponds to an element of ``differentials``. Introducing the notation ``RBzg = PolynomialRing(self._R, ['z','g'])`` and ``CCzg = PolynomialRing(self._CC, ['z','g'])``, we have that: - - ``g`` is the full rational function in ``self._R.fraction_field()`` - giving the differential, - - ``dgdz`` is the derivative of ``g`` with respect to ``self._R.gen(0)``, - written in terms of ``self._R.gen(0)`` and ``g``, hence laying in - ``RBzg``, - - ``F`` is the minimal polynomial of ``g`` over ``self._R.gen(0)``, - laying in the polynomial ring ``CCzg``, - - ``a0_info`` is a tuple ``(lc, roots)`` where ``lc`` and ``roots`` are - the leading coefficient and roots of the polynomial in ``CCzg.gen(0)`` - that is the coefficient of the term of ``F`` of highest degree in - ``CCzg.gen(1)``. + + - ``g`` is the full rational function in ``self._R.fraction_field()`` + giving the differential, + - ``dgdz`` is the derivative of ``g`` with respect to ``self._R.gen(0)`` + , written in terms of ``self._R.gen(0)`` and ``g``, hence laying in + ``RBzg``, + - ``F`` is the minimal polynomial of ``g`` over ``self._R.gen(0)``, + laying in the polynomial ring ``CCzg``, + - ``a0_info`` is a tuple ``(lc, roots)`` where ``lc`` and ``roots`` are + the leading coefficient and roots of the polynomial in ``CCzg.gen(0)`` + that is the coefficient of the term of ``F`` of highest degree in + ``CCzg.gen(1)``. EXAMPLES:: From be5851f1975792161018cff63f15154fe600bcaf Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Tue, 12 Jul 2022 14:48:06 -0700 Subject: [PATCH 304/416] trac 34168: fix docstring markup for src/categories --- src/sage/categories/affine_weyl_groups.py | 2 +- src/sage/categories/category.py | 2 +- src/sage/categories/facade_sets.py | 6 ++++-- src/sage/categories/fields.py | 2 +- src/sage/categories/finite_coxeter_groups.py | 4 ++-- src/sage/categories/hecke_modules.py | 2 +- src/sage/categories/integral_domains.py | 2 +- src/sage/categories/rings.py | 2 +- src/sage/categories/unique_factorization_domains.py | 6 +++--- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/sage/categories/affine_weyl_groups.py b/src/sage/categories/affine_weyl_groups.py index 37dc4a2c9dc..285fe9e45ab 100644 --- a/src/sage/categories/affine_weyl_groups.py +++ b/src/sage/categories/affine_weyl_groups.py @@ -19,7 +19,7 @@ class AffineWeylGroups(Category_singleton): """ The category of affine Weyl groups - .. todo:: add a description of this category + .. TODO:: add a description of this category .. SEEALSO:: diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index a52b95dda00..b69475b67fe 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -1392,7 +1392,7 @@ def _test_category_graph(self, **options): method resolution order of the parent and element classes. This method checks this. - .. todo:: currently, this won't work for hom categories. + .. TODO:: currently, this won't work for hom categories. EXAMPLES:: diff --git a/src/sage/categories/facade_sets.py b/src/sage/categories/facade_sets.py index 0e36e2875e9..0ddebfe30d2 100644 --- a/src/sage/categories/facade_sets.py +++ b/src/sage/categories/facade_sets.py @@ -186,8 +186,10 @@ def __contains__(self, element): Returns whether ``element`` is in one of the parents ``self`` is a facade for. - .. warning:: this default implementation is currently - overridden by :meth:`Parent.__contains__`. + .. warning:: + + this default implementation is currently + overridden by :meth:`Parent.__contains__`. EXAMPLES:: diff --git a/src/sage/categories/fields.py b/src/sage/categories/fields.py index 9148d51832c..3dad6f9946d 100644 --- a/src/sage/categories/fields.py +++ b/src/sage/categories/fields.py @@ -76,7 +76,7 @@ def __contains__(self, x): This implementation will not be needed anymore once every field in Sage will be properly declared in the category - :class:`Fields`(). + :class:`Fields`. Caveat: this should eventually be fixed:: diff --git a/src/sage/categories/finite_coxeter_groups.py b/src/sage/categories/finite_coxeter_groups.py index f799a79a274..24553fadaf0 100644 --- a/src/sage/categories/finite_coxeter_groups.py +++ b/src/sage/categories/finite_coxeter_groups.py @@ -202,7 +202,7 @@ def bruhat_poset(self, facade=False): sage: [len(WeylGroup(["A", n]).bruhat_poset().cover_relations()) for n in [1,2,3]] [1, 8, 58] - .. todo:: + .. TODO:: - Use the symmetric group in the examples (for nicer output), and print the edges for a stronger test. @@ -464,7 +464,7 @@ def weak_poset(self, side="right", facade=False): sage: [len(WeylGroup(["A", n]).weak_poset(side = "left" ).cover_relations()) for n in [1,2,3]] [1, 6, 36] - .. todo:: + .. TODO:: - Use the symmetric group in the examples (for nicer output), and print the edges for a stronger test. diff --git a/src/sage/categories/hecke_modules.py b/src/sage/categories/hecke_modules.py index 65900348b15..06dcb99687d 100644 --- a/src/sage/categories/hecke_modules.py +++ b/src/sage/categories/hecke_modules.py @@ -109,7 +109,7 @@ def _Hom_(self, Y, category): INPUT: - ``Y`` -- an Hecke module - - ``category`` -- a subcategory of :class:`HeckeModules`() or None + - ``category`` -- a subcategory of :class:`HeckeModules` or None The sole purpose of this method is to construct the homset as a :class:`~sage.modular.hecke.homspace.HeckeModuleHomspace`. If diff --git a/src/sage/categories/integral_domains.py b/src/sage/categories/integral_domains.py index 9113d724a04..4f80ea1b5bf 100644 --- a/src/sage/categories/integral_domains.py +++ b/src/sage/categories/integral_domains.py @@ -58,7 +58,7 @@ def __contains__(self, x): This implementation will not be needed anymore once every field in Sage will be properly declared in the category - :class:`IntegralDomains`(). + :class:`IntegralDomains`. """ try: return self._contains_helper(x) or x.is_integral_domain() diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index c48c48e5e49..c41d1f4d8d8 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -386,7 +386,7 @@ def _Hom_(self, Y, category): INPUT: - ``Y`` -- a ring - - ``category`` -- a subcategory of :class:`Rings`() or None + - ``category`` -- a subcategory of :class:`Rings` or None The sole purpose of this method is to construct the homset as a :class:`~sage.rings.homset.RingHomset`. If diff --git a/src/sage/categories/unique_factorization_domains.py b/src/sage/categories/unique_factorization_domains.py index f7943cb0f0c..3d0f4598fa9 100644 --- a/src/sage/categories/unique_factorization_domains.py +++ b/src/sage/categories/unique_factorization_domains.py @@ -74,7 +74,7 @@ def __contains__(self, x): This implementation will not be needed anymore once every field in Sage will be properly declared in the category - :class:`UniqueFactorizationDomains`(). + :class:`UniqueFactorizationDomains`. """ try: return self._contains_helper(x) or x.is_unique_factorization_domain() @@ -221,7 +221,7 @@ def radical(self, *args, **kwds): This default implementation calls ``squarefree_decomposition`` if available, and ``factor`` otherwise. - .. seealso:: :meth:`squarefree_part` + .. SEEALSO:: :meth:`squarefree_part` EXAMPLES:: @@ -271,7 +271,7 @@ def squarefree_part(self): This default implementation calls ``squarefree_decomposition``. - .. seealso:: :meth:`radical` + .. SEEALSO:: :meth:`radical` EXAMPLES:: From 0794103713c3e3e30512571ab9c7cc827d7ae474 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Tue, 12 Jul 2022 15:20:00 -0700 Subject: [PATCH 305/416] trac 34172: doc markup fixes for groups, misc --- src/sage/groups/cubic_braid.py | 10 +++++----- src/sage/misc/call.py | 10 ++++++---- src/sage/misc/profiler.py | 2 +- src/sage/misc/sage_input.py | 14 +++++++------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py index cfba5c589af..295d43aa1d2 100644 --- a/src/sage/groups/cubic_braid.py +++ b/src/sage/groups/cubic_braid.py @@ -1373,13 +1373,13 @@ def _element_constructor_(self, x, **kwds): INPUT: - ``x`` -- can be one of the following: - -- an instance of the element class of ``self`` (but possible to a different parent). - -- an instance of the element class of the braid group. - -- a tuple representing a braid in Tietze form. - -- an instance of an element class of a parent P such that there is a map from ``self`` to P + - an instance of the element class of ``self`` (but possible to a different parent). + - an instance of the element class of the braid group. + - a tuple representing a braid in Tietze form. + - an instance of an element class of a parent P such that there is a map from ``self`` to P having :meth:`lift`, for example an element of an alternative realization of ``self``, such as the classical realization. - -- any other object which works for the element constructor of :class:`FinitelyPresentedGroup`. + - any other object which works for the element constructor of :class:`FinitelyPresentedGroup`. OUTPUT: diff --git a/src/sage/misc/call.py b/src/sage/misc/call.py index 71368bbadd5..ddb48610e59 100644 --- a/src/sage/misc/call.py +++ b/src/sage/misc/call.py @@ -109,10 +109,12 @@ def __hash__(self): This method tries to ensure that, when two ``attrcall`` objects are equal, they have the same hash value. - .. warning:: dicts are not hashable, so we instead hash their - items; however the order of those items might differ. The - proper fix would be to use a frozen dict for ``kwds``, when - frozen dicts will be available in Python. + .. warning:: + + dicts are not hashable, so we instead hash their + items; however the order of those items might differ. The + proper fix would be to use a frozen dict for ``kwds``, when + frozen dicts will be available in Python. EXAMPLES:: diff --git a/src/sage/misc/profiler.py b/src/sage/misc/profiler.py index aabbed90fd1..c442c67693b 100644 --- a/src/sage/misc/profiler.py +++ b/src/sage/misc/profiler.py @@ -61,7 +61,7 @@ class Profiler: .. SEEALSO:: :func:`runsnake` - .. todo:: + .. TODO:: - Add Pyrex source code inspection (I assume it doesn't currently do this) diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py index 2a71bc1b665..24586170e4e 100644 --- a/src/sage/misc/sage_input.py +++ b/src/sage/misc/sage_input.py @@ -1838,11 +1838,11 @@ def __init__(self, sib, func, args, kwargs): - ``func`` - a :class:`SageInputExpression` representing a function - - ``args`` - a list of :class:`SageInputExpression`s representing the - positional arguments + - ``args`` - a list of instances of :class:`SageInputExpression` + representing the positional arguments - - ``kwargs`` -- a dictionary mapping strings to - :class:`SageInputExpression`s representing the keyword arguments + - ``kwargs`` -- a dictionary mapping strings to instances of + :class:`SageInputExpression` representing the keyword arguments EXAMPLES:: @@ -2137,8 +2137,8 @@ def __init__(self, sib, values, is_list): - ``sib`` -- a :class:`SageInputBuilder` - - ``values`` -- a list of :class:`SageInputExpression`s representing the - elements of this tuple + - ``values`` -- a list of instances of :class:`SageInputExpression` + representing the elements of this tuple - ``is_list`` -- is True if this class represents a list, False for a tuple @@ -2246,7 +2246,7 @@ def __init__(self, sib, entries): - ``sib`` -- a :class:`SageInputBuilder` - - ``entries`` -- a list of pairs of :class:`SageInputExpression`s + - ``entries`` -- a list of pairs of :class:`SageInputExpression` representing the entries of this dict EXAMPLES:: From 92d28b3ffc04c70c0f3501c48ad95c9015b40c69 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Jul 2022 11:40:29 +0900 Subject: [PATCH 306/416] Add - before th --- .../schemes/elliptic_curves/isogeny_class.py | 2 +- .../riemann_surfaces/riemann_surface.py | 164 +++++++++--------- 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index 340a7710ca2..2178273200e 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -97,7 +97,7 @@ def __iter__(self): def __getitem__(self, i): """ - Return the `i` th curve in the class. + Return the `i`-th curve in the class. EXAMPLES:: diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py index bae271bc76c..c6bd60b7964 100644 --- a/src/sage/schemes/riemann_surfaces/riemann_surface.py +++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py @@ -350,9 +350,9 @@ class RiemannSurface(): by the monomials of degree up to `d-3`. - ``integration_method`` -- (default: ``'rigorous'``). String specifying the - integration method to use when calculating the integrals of differentials. + integration method to use when calculating the integrals of differentials. The options are ``'heuristic'`` and ``'rigorous'``, the latter of - which is often the most efficient. + which is often the most efficient. EXAMPLES:: @@ -386,19 +386,19 @@ class RiemannSurface(): sage: all( len(T.minpoly().roots(K)) > 0 for T in A) True - The ``'heuristic'`` integration method uses the method ``integrate_vector`` - defined in ``sage.numerical.gauss_legendre`` to compute integrals of differentials. - As mentioned there, this works by iteratively doubling the number of nodes + The ``'heuristic'`` integration method uses the method ``integrate_vector`` + defined in ``sage.numerical.gauss_legendre`` to compute integrals of differentials. + As mentioned there, this works by iteratively doubling the number of nodes used in the quadrature, and uses a heuristic based on the rate at which the result is seemingly converging to estimate the error. The ``'rigorous'`` - method uses results from [Neu2018]_, and bounds the algebraic integrands on + method uses results from [Neu2018]_, and bounds the algebraic integrands on circular domains using Cauchy's form of the remainder in Taylor approximation coupled to Fujiwara's bound on polynomial roots (see Bruin-DisneyHogg-Gao, - in preparation). Note this method of bounding on circular domains is also - implemented in :meth:`_compute_delta`. The net result of this bounding is + in preparation). Note this method of bounding on circular domains is also + implemented in :meth:`_compute_delta`. The net result of this bounding is that one can know (an upper bound on) the number of nodes required to achieve - a certain error. This means that for any given integral, assuming that the - same number of nodes is required by both methods in order to achieve the + a certain error. This means that for any given integral, assuming that the + same number of nodes is required by both methods in order to achieve the desired error (not necessarily true in practice), approximately half the number of integrand evaluations are required. When the required number of nodes is high, e.g. when the precision required is high, this can make @@ -408,7 +408,7 @@ class RiemannSurface(): if the computation is 'fast', the heuristic method may outperform the rigorous method, but for slower computations the rigorous method can be much faster:: - + sage: f = z*w^3+z^3+w sage: p = 53 sage: Sh = RiemannSurface(f, prec=p, integration_method='heuristic') @@ -417,18 +417,18 @@ class RiemannSurface(): sage: import time sage: nodes.cache.clear() sage: ct = time.time() - sage: Rh = Sh.riemann_matrix() + sage: Rh = Sh.riemann_matrix() sage: ct1 = time.time()-ct sage: nodes.cache.clear() sage: ct = time.time() - sage: Rr = Sr.riemann_matrix() + sage: Rr = Sr.riemann_matrix() sage: ct2 = time.time()-ct sage: ct2/ct1 # random 1.2429363969691192 This disparity in timings can get increasingly worse, and testing has shown that even for random quadrics the heuristic method can be as bad as 30 times - slower. + slower. TESTS: @@ -1549,27 +1549,27 @@ def _bounding_data(self, differentials): INPUT: - ``differentials`` -- list. A list of polynomials in ``self._R`` giving - the numerators of the differentials, as per the output of - :meth:`cohomology_basis`. + the numerators of the differentials, as per the output of + :meth:`cohomology_basis`. OUTPUT: - A tuple ``(CCzg, [(g, dgdz, F, a0_info), ...])`` where each element of + A tuple ``(CCzg, [(g, dgdz, F, a0_info), ...])`` where each element of the list corresponds to an element of ``differentials``. Introducing the - notation ``RBzg = PolynomialRing(self._R, ['z','g'])`` and + notation ``RBzg = PolynomialRing(self._R, ['z','g'])`` and ``CCzg = PolynomialRing(self._CC, ['z','g'])``, we have that: - - ``g`` is the full rational function in ``self._R.fraction_field()`` + - ``g`` is the full rational function in ``self._R.fraction_field()`` giving the differential, - ``dgdz`` is the derivative of ``g`` with respect to ``self._R.gen(0)`` - , written in terms of ``self._R.gen(0)`` and ``g``, hence laying in + , written in terms of ``self._R.gen(0)`` and ``g``, hence laying in ``RBzg``, - - ``F`` is the minimal polynomial of ``g`` over ``self._R.gen(0)``, + - ``F`` is the minimal polynomial of ``g`` over ``self._R.gen(0)``, laying in the polynomial ring ``CCzg``, - - ``a0_info`` is a tuple ``(lc, roots)`` where ``lc`` and ``roots`` are + - ``a0_info`` is a tuple ``(lc, roots)`` where ``lc`` and ``roots`` are the leading coefficient and roots of the polynomial in ``CCzg.gen(0)`` - that is the coefficient of the term of ``F`` of highest degree in - ``CCzg.gen(1)``. + that is the coefficient of the term of ``F`` of highest degree in + ``CCzg.gen(1)``. EXAMPLES:: @@ -1592,8 +1592,8 @@ def _bounding_data(self, differentials): -0.500000000000000 + 0.866025403784439*I]))]) """ - # This copies previous work by NB, outputting the zipped list required - # for a certified line integral. + # This copies previous work by NB, outputting the zipped list required + # for a certified line integral. RB = self._R.base_ring() P = PolynomialRing(RB, 'Z') k = P.fraction_field() @@ -1602,12 +1602,12 @@ def _bounding_data(self, differentials): L = k.extension(fZW, 'Wb') dfdw_L = self._dfdw(P.gen(0), L.gen(0)) integrand_list = [h/self._dfdw for h in differentials] - # minpoly_univ gives the minimal polynomial for h, in variable x, with + # minpoly_univ gives the minimal polynomial for h, in variable x, with # coefficients given by polynomials in P (i.e. rational polynomials in Z). minpoly_univ = [(h(P.gen(0), L.gen(0))/dfdw_L).minpoly().numerator() for h in differentials] RBzg = PolynomialRing(RB, ['z', 'g']) - # The following line changes the variables in these minimal polynomials + # The following line changes the variables in these minimal polynomials # as Z -> z, x -> G, then evaluates at G = QQzg.gens(1) ( = g ) RBzgG = PolynomialRing(RBzg, 'G') minpoly_list = [RBzgG([c(RBzg.gen(0)) for c in list(h)])(RBzg.gen(1)) @@ -1615,17 +1615,17 @@ def _bounding_data(self, differentials): # h(z,g)=0 --> dg/dz = - dhdz/dhdg dgdz_list = [-h.derivative(RBzg.gen(0))/h.derivative(RBzg.gen(1)) for h in minpoly_list] - + CCzg = PolynomialRing(self._CC, ['z','g']) CCminpoly_list = [CCzg(h) for h in minpoly_list] - + a0_list = [P(h.leading_coefficient()) for h in minpoly_univ] # Note that because the field over which the Riemann surface is defined - # is embedded into CC, it has characteristic 0, and so we know the + # is embedded into CC, it has characteristic 0, and so we know the # irreducible factors are all separable, i.e. the roots have multiplicity - # one. + # one. a0_info = [(self._CC(a0.leading_coefficient()), - flatten([self._CCz(F).roots(multiplicities=False)*m + flatten([self._CCz(F).roots(multiplicities=False)*m for F, m in a0.factor()])) for a0 in a0_list] return CCzg, list(zip(integrand_list, dgdz_list, CCminpoly_list, a0_info)) @@ -1635,10 +1635,10 @@ def rigorous_line_integral(self, upstairs_edge, differentials, bounding_data): Perform vectorized integration along a straight path. Using the error bounds for Gauss-Legendre integration found in [Neu2018]_ - and a method for bounding an algebraic integrand on a circular domains - using Cauchy's form of the remainder in Taylor approximation coupled to - Fujiwara's bound on polynomial roots (see Bruin-DisneyHogg-Gao, in - preparation), this method calculates (semi-)rigorously the integral of a + and a method for bounding an algebraic integrand on a circular domains + using Cauchy's form of the remainder in Taylor approximation coupled to + Fujiwara's bound on polynomial roots (see Bruin-DisneyHogg-Gao, in + preparation), this method calculates (semi-)rigorously the integral of a list of differentials along an edge of the upstairs graph. INPUT: @@ -1651,7 +1651,7 @@ def rigorous_line_integral(self, upstairs_edge, differentials, bounding_data): the equation defining the Riemann surface. - ``bounding_data`` -- tuple containing the data required for bounding - the integrands. This should be in the form of the output from + the integrands. This should be in the form of the output from :meth:`_bounding_data`. OUTPUT: @@ -1677,81 +1677,81 @@ def rigorous_line_integral(self, upstairs_edge, differentials, bounding_data): .. NOTE:: - Uses data that ``homology_basis`` initializes. + Uses data that ``homology_basis`` initializes. Note also that the data of the differentials is contained within - ``bounding_data``. It is, however, still advantageous to have this + ``bounding_data``. It is, however, still advantageous to have this be a separate argument, as it lets the user supply a fast-callable - version of the differentials, to significantly speed up execution - of the integrand calls, and not have to re-calculate these + version of the differentials, to significantly speed up execution + of the integrand calls, and not have to re-calculate these fast-callables for every run of the function. This is also the benefit - of representing the differentials as a polynomial over a known - common denominator. + of representing the differentials as a polynomial over a known + common denominator. .. TODO:: Note that bounding_data contains the information of the integrands, so one may want to check for consistency between ``bounding_data`` - and ``differentials``. If so one would not want to do so at the - expense of speed. + and ``differentials``. If so one would not want to do so at the + expense of speed. - Moreover, the current implementation bounds along a line by + Moreover, the current implementation bounds along a line by splitting it up into segments, each of which can be covered entirely - by a single circle, and then placing inside that the ellipse + by a single circle, and then placing inside that the ellipse required to bound as per [Neu2018]_. This is reliably more efficient - than the heuristic method, especially in poorly-conditioned cases + than the heuristic method, especially in poorly-conditioned cases where discriminant points are close together around the edges, but in the case where the branch locus is well separated, it can require slightly more nodes than necessary. One may want to include a method - here to transition in this regime to an algorithm that covers the - entire line with one ellipse, then bounds along that ellipse with - multiple circles. + here to transition in this regime to an algorithm that covers the + entire line with one ellipse, then bounds along that ellipse with + multiple circles. """ - # Note that this, in its current formalism, makes no check that bounding - # data at all corresponds to the differentials given. The onus is then + # Note that this, in its current formalism, makes no check that bounding + # data at all corresponds to the differentials given. The onus is then # on the design of other functions which use it. - - # CCzg is required to be known as we need to know the ring which the minpolys lie in. + + # CCzg is required to be known as we need to know the ring which the minpolys lie in. CCzg, bounding_data_list = bounding_data - + i0, _ = upstairs_edge[0] i1, _ = upstairs_edge[1] z0 = self._vertices[i0] z1 = self._vertices[i1] zwt, z1_minus_z0 = self.make_zw_interpolator(upstairs_edge) - + # list of (centre, radius) pairs that still need to be processed ball_stack = [(self._RR(1/2), self._RR(1/2), 0)] - alpha = self._RR(912/1000) - # alpha set manually for scaling purposes. Basic benchmarking shows - # that ~0.9 is a sensible value. + alpha = self._RR(912/1000) + # alpha set manually for scaling purposes. Basic benchmarking shows + # that ~0.9 is a sensible value. E_global = self._RR(2)**(-self._prec+3) - # Output will iteratively store the output of the integral. + # Output will iteratively store the output of the integral. V = VectorSpace(self._CC, len(differentials)) output = V(0) - # The purpose of this loop is as follows: We know we will be using + # The purpose of this loop is as follows: We know we will be using # Gauss-Legendre quadrature to do the integral, and results from [Neu2018]_ - # tell us an upper bound on the number of nodes required to achieve a - # given error bound for this quadrature, provided we have a bound for - # the integrand on a certain ellipse in the complex plane. The method + # tell us an upper bound on the number of nodes required to achieve a + # given error bound for this quadrature, provided we have a bound for + # the integrand on a certain ellipse in the complex plane. The method # developed by Bruin and Gao that uses Cauchy and Fujiwara can bound an # algebraic integrand on a circular region. Hence we need a way to change - # from bounding with an ellipse to bounding with a circle. The size of - # these circles will be constrained by the distance to the nearest point - # where the integrand blows up, i.e. the nearest branchpoint. Basic - # benchmarking showed that it was in general a faster method to split - # the original line segment into multiple smaller line segments, and + # from bounding with an ellipse to bounding with a circle. The size of + # these circles will be constrained by the distance to the nearest point + # where the integrand blows up, i.e. the nearest branchpoint. Basic + # benchmarking showed that it was in general a faster method to split + # the original line segment into multiple smaller line segments, and # compute the contribution from each of the line segments bounding with # a single circle, the benefits mainly coming when the curve is poorly - # conditioned s.t. the branch points are close together. The following - # loop does exactly this, repeatedly bisecting a segment if it is not + # conditioned s.t. the branch points are close together. The following + # loop does exactly this, repeatedly bisecting a segment if it is not # possible to cover it entirely in a ball which encompasses an appropriate - # ellipse. + # ellipse. def local_N(ct, rt): cz = (1-ct)*z0+ct*z1 # This is the central z-value of our ball. - distances = [(cz-b).abs() for b in self.branch_locus] + distances = [(cz-b).abs() for b in self.branch_locus] rho_z = min(distances) rho_t = rho_z/(z1_minus_z0).abs() rho_t = alpha*rho_t+(1-alpha)*rt # sqrt(rho_t*rt) could also work @@ -1765,11 +1765,11 @@ def local_N(ct, rt): n = minpoly.degree(CCzg.gen(1)) ai_new = [(minpoly.coefficient({CCzg.gen(1):i}))(z=cz+self._CCz.gen(0)) for i in range(n)] - ai_pos = [self._RRz([c.abs() for c in h.list()]) + ai_pos = [self._RRz([c.abs() for c in h.list()]) for h in ai_new] m = [a(rho_z)/z_1 for a in ai_pos] l = len(m) - M_tilde = 2*max((m[i].abs())**(1/self._RR(l-i)) + M_tilde = 2*max((m[i].abs())**(1/self._RR(l-i)) for i in range(l)) cg = g(cz,cw) cdgdz = dgdz(cz,cg) @@ -1786,7 +1786,7 @@ def local_N(ct, rt): if not lN: cz = (1-ct)*z0+ct*z1 - distances = [(cz-b).abs() for b in self.branch_locus] + distances = [(cz-b).abs() for b in self.branch_locus] rho_z = min(distances) rho_t = rho_z/(z1_minus_z0).abs() @@ -1794,7 +1794,7 @@ def local_N(ct, rt): ball_stack.append((ncts[0], nrt, 0)) ball_stack.append((ncts[1], nrt, 0)) continue - + lN = local_N(ct, rt) nNs = [local_N(nct, nrt) for nct in ncts] @@ -1834,7 +1834,7 @@ def matrix_of_integral_values(self, differentials, integration_method="heuristic - ``differentials`` -- a list of polynomials. - ``integration_method`` -- (default: ``'heuristic'``). String specifying - the integration method to use. The options are ``'heuristic'`` and + the integration method to use. The options are ``'heuristic'`` and ``'rigorous'``. OUTPUT: @@ -1885,7 +1885,7 @@ def normalize_pairs(L): raise ValueError("Invalid integration method") integral_dict = {edge: line_int(edge) for edge in occurring_edges} - + rows = [] for cycle in cycles: V = VectorSpace(self._CC, len(differentials)).zero() @@ -1928,7 +1928,7 @@ def period_matrix(self): 3 One can check that the two methods give similar answers:: - + sage: from sage.schemes.riemann_surfaces.riemann_surface import RiemannSurface sage: R. = QQ[] sage: f = y^2 - x^3 + 1 From 8f13a5a6562853dfc6e9e709ea7753d7c5ea228a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 10:05:39 +0200 Subject: [PATCH 307/416] rst fixes in interfaces/ --- src/sage/interfaces/ecm.py | 11 +++++------ src/sage/interfaces/frobby.py | 2 +- src/sage/interfaces/giac.py | 7 ++----- src/sage/interfaces/interface.py | 17 +++++++++-------- src/sage/interfaces/jmoldata.py | 7 ++++--- src/sage/interfaces/magma.py | 2 +- src/sage/interfaces/mathematica.py | 25 ++++++++++++++----------- src/sage/interfaces/mathics.py | 9 ++++++--- src/sage/interfaces/mupad.py | 10 ++++------ src/sage/interfaces/phc.py | 8 +++----- src/sage/interfaces/polymake.py | 3 +-- src/sage/interfaces/qepcad.py | 12 +++++++----- src/sage/interfaces/r.py | 30 ++++++++++++++---------------- 13 files changed, 71 insertions(+), 72 deletions(-) diff --git a/src/sage/interfaces/ecm.py b/src/sage/interfaces/ecm.py index e5401bb1bcc..171040c77a3 100644 --- a/src/sage/interfaces/ecm.py +++ b/src/sage/interfaces/ecm.py @@ -336,8 +336,8 @@ def recommended_B1(self, factor_digits): r'(?P.*) cofactor (?P\d+) has [\s]*(?P\d+) digits') def _parse_output(self, n, out): - """ - Parse the ECM output + r""" + Parse the ECM output. INPUT: @@ -348,10 +348,9 @@ def _parse_output(self, n, out): OUTPUT: List of pairs ``(integer, bool)`` consisting of factors of the - ECM input and whether they are deemed to be probable - prime. Note that ECM is not a good primality test, and there - is a sizeable probability that the "probable prime" is - actually composite. + ECM input and whether they are deemed to be probable prime. + Note that ECM is not a good primality test, and there is a + sizeable probability that the "probable prime" is actually composite. EXAMPLES:: diff --git a/src/sage/interfaces/frobby.py b/src/sage/interfaces/frobby.py index a47f12720be..7680704d291 100644 --- a/src/sage/interfaces/frobby.py +++ b/src/sage/interfaces/frobby.py @@ -361,7 +361,7 @@ def _parse_4ti2_matrix(self, string): A list of rows of the matrix, where each row is represented as a list of integers. - EXAMPLES:: + EXAMPLES: The format is straight-forward, as this example shows. :: diff --git a/src/sage/interfaces/giac.py b/src/sage/interfaces/giac.py index cb8f7e94c59..87ff828edec 100644 --- a/src/sage/interfaces/giac.py +++ b/src/sage/interfaces/giac.py @@ -903,8 +903,6 @@ def _richcmp_(self, other, op): sage: a == 5 True - :: - sage: c = giac(3) sage: a == c False @@ -915,8 +913,6 @@ def _richcmp_(self, other, op): sage: c <= a True - :: - TESTS:: sage: x = var('x') @@ -1065,10 +1061,11 @@ def _sage_(self, locals=None): This method works successfully when Giac returns a result or list of results that consist only of: + - numbers, i.e. integers, floats, complex numbers; - functions and named constants also present in Sage, where: - Sage knows how to translate the function or constant's name - from Giac's naming scheme through the ``symbol_table``, or + from Giac's naming scheme through the ``symbol_table``, or - you provide a translation dictionary ``locals``. New conversions can be added using Pynac's ``register_symbol``. diff --git a/src/sage/interfaces/interface.py b/src/sage/interfaces/interface.py index a61c2389b4f..47ccd0cdbff 100644 --- a/src/sage/interfaces/interface.py +++ b/src/sage/interfaces/interface.py @@ -248,15 +248,16 @@ def execute(self, *args, **kwds): return self.eval(*args, **kwds) def __call__(self, x, name=None): - r""" - Create a new object in self from x. + Create a new object in ``self`` from ``x``. + + The object ``X`` returned can be used like any Sage object, and + wraps an object in ``self``. The standard arithmetic operators + work. Moreover if ``foo`` is a function then:: + + ``X.foo(y,z,...)`` - The object X returned can be used like any Sage object, and - wraps an object in self. The standard arithmetic operators - work. Moreover if foo is a function then - X.foo(y,z,...) - calls foo(X, y, z, ...) and returns the corresponding object. + calls ``foo(X, y, z, ...)`` and returns the corresponding object. EXAMPLES:: @@ -446,7 +447,7 @@ def _relation_symbols(self): def _exponent_symbol(self): """ - Return the symbol used to denote *10^ in floats, e.g 'e' in 1.5e6 + Return the symbol used to denote ``*10^`` in floats, e.g 'e' in 1.5e6 EXAMPLES:: diff --git a/src/sage/interfaces/jmoldata.py b/src/sage/interfaces/jmoldata.py index bc18be8dd04..b94f168c6cf 100644 --- a/src/sage/interfaces/jmoldata.py +++ b/src/sage/interfaces/jmoldata.py @@ -31,12 +31,13 @@ import sys from pathlib import Path + class JmolData(SageObject): r""" - .. todo:: + .. TODO:: - Create an animated image file (GIF) if spin is on and put data - extracted from a file into a variable/string/structure to return + Create an animated image file (GIF) if spin is on and put data + extracted from a file into a variable/string/structure to return """ def __init__(self): """ diff --git a/src/sage/interfaces/magma.py b/src/sage/interfaces/magma.py index e8f2bd81f67..bd75a6a1850 100644 --- a/src/sage/interfaces/magma.py +++ b/src/sage/interfaces/magma.py @@ -2627,7 +2627,7 @@ def __bool__(self): sage: bool(magma(0)) # optional - magma False - TESTS:: + TESTS: Verify that :trac:`32602` is fixed:: diff --git a/src/sage/interfaces/mathematica.py b/src/sage/interfaces/mathematica.py index 81da91093b2..df6303d2ae0 100644 --- a/src/sage/interfaces/mathematica.py +++ b/src/sage/interfaces/mathematica.py @@ -414,14 +414,14 @@ def _un_camel(name): EXAMPLES:: - sage: sage.interfaces.mathematica._un_camel('CamelCase') - 'camel_case' - sage: sage.interfaces.mathematica._un_camel('EllipticE') - 'elliptic_e' - sage: sage.interfaces.mathematica._un_camel('FindRoot') - 'find_root' - sage: sage.interfaces.mathematica._un_camel('GCD') - 'gcd' + sage: sage.interfaces.mathematica._un_camel('CamelCase') + 'camel_case' + sage: sage.interfaces.mathematica._un_camel('EllipticE') + 'elliptic_e' + sage: sage.interfaces.mathematica._un_camel('FindRoot') + 'find_root' + sage: sage.interfaces.mathematica._un_camel('GCD') + 'gcd' """ s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() @@ -725,17 +725,20 @@ def _sage_(self, locals={}): This method works successfully when Mathematica returns a result or list of results that consist only of: + - numbers, i.e. integers, floats, complex numbers; - functions and named constants also present in Sage, where: - Sage knows how to translate the function or constant's name - from Mathematica's naming scheme, or + from Mathematica's naming scheme, or - you provide a translation dictionary `locals`, or - the Sage name for the function or constant is simply the - Mathematica name in lower case; - - symbolic variables whose names don't pathologically overlap with + Mathematica name in lower case; + + - symbolic variables whose names do not pathologically overlap with objects already defined in Sage. This method will not work when Mathematica's output includes: + - strings; - functions unknown to Sage that are not specified in `locals`; - Mathematica functions with different parameters/parameter order to diff --git a/src/sage/interfaces/mathics.py b/src/sage/interfaces/mathics.py index 11acc86e5f7..aa86c956635 100644 --- a/src/sage/interfaces/mathics.py +++ b/src/sage/interfaces/mathics.py @@ -979,17 +979,20 @@ def _sage_(self, locals={}): This method works successfully when Mathics returns a result or list of results that consist only of: + - numbers, i.e. integers, floats, complex numbers; - functions and named constants also present in Sage, where: - Sage knows how to translate the function or constant's name - from Mathics's naming scheme, or + from Mathics's naming scheme, or - you provide a translation dictionary `locals`, or - the Sage name for the function or constant is simply the - Mathics name in lower case; - - symbolic variables whose names don't pathologically overlap with + Mathics name in lower case; + + - symbolic variables whose names do not pathologically overlap with objects already defined in Sage. This method will not work when Mathics's output includes: + - strings; - functions unknown to Sage; - Mathics functions with different parameters/parameter order to diff --git a/src/sage/interfaces/mupad.py b/src/sage/interfaces/mupad.py index 4c14187ec78..7f6cf4c682a 100644 --- a/src/sage/interfaces/mupad.py +++ b/src/sage/interfaces/mupad.py @@ -157,22 +157,20 @@ def __reduce__(self): return reduce_load_mupad, tuple([]) def _read_in_file_command(self, filename): - """ + r""" EXAMPLES:: sage: mupad._read_in_file_command('test') 'read("test")' sage: filename = tmp_filename() - sage: f = open(filename, 'w') - sage: _ = f.write('x := 2;\n') - sage: f.close() + sage: with open(filename, 'w') as f: + ....: f.write('x := 2;\n') sage: mupad.read(filename) # optional - MuPAD sage: mupad.get('x').strip() # optional - mupad '2' - """ - return 'read("%s")'%filename + return 'read("%s")' % filename def _quit_string(self): """ diff --git a/src/sage/interfaces/phc.py b/src/sage/interfaces/phc.py index 375ec7a0f36..40b160598fa 100644 --- a/src/sage/interfaces/phc.py +++ b/src/sage/interfaces/phc.py @@ -482,19 +482,17 @@ def _output_from_command_list(self, command_list, polys, verbose=False): return output_filename def _input_file(self, polys): - """ + r""" This is used internally to implement the PHC interface. INPUT: - polys -- a list of polynomials in a Sage polynomial ring - over a field that embeds into the complex - numbers. + over a field that embeds into the complex numbers OUTPUT: - - a PHC input file (as a text string) that describes these - - polynomials. + a PHC input file (as a text string) that describes these polynomials EXAMPLES:: diff --git a/src/sage/interfaces/polymake.py b/src/sage/interfaces/polymake.py index 5c9d96aa44a..e335f33ae0a 100644 --- a/src/sage/interfaces/polymake.py +++ b/src/sage/interfaces/polymake.py @@ -449,7 +449,7 @@ def _equality_symbol(self): return "==" def _read_in_file_command(self, filename): - """ + r""" TESTS:: sage: polymake._read_in_file_command('foobar') @@ -466,7 +466,6 @@ def _read_in_file_command(self, filename): sage: L = polymake([42] * 84) # optional - polymake sage: len(L) # optional - polymake 84 - """ return 'eval read_file "{}";\n'.format(filename) diff --git a/src/sage/interfaces/qepcad.py b/src/sage/interfaces/qepcad.py index e83f5dedeeb..549877b392d 100644 --- a/src/sage/interfaces/qepcad.py +++ b/src/sage/interfaces/qepcad.py @@ -628,14 +628,16 @@ def _qepcad_atoms(formula): - `formula` (string) - a quantifier-free formula. - .. note:: this function is pis-aller used for doctesting, not a complete - parser, which should be written in a further ticket. + .. NOTE:: + + This function is pis-aller used for doctesting, not a complete + parser, which should be written in a further ticket. EXAMPLES:: - sage: from sage.interfaces.qepcad import _qepcad_atoms - sage: _qepcad_atoms('y^5 + 4 y + 8 >= 0 /\\ y <= 0 /\\ [ y = 0 \\/ y^5 + 4 y + 8 = 0 ]') - {'y <= 0', 'y = 0', 'y^5 + 4 y + 8 = 0', 'y^5 + 4 y + 8 >= 0'} + sage: from sage.interfaces.qepcad import _qepcad_atoms + sage: _qepcad_atoms('y^5 + 4 y + 8 >= 0 /\\ y <= 0 /\\ [ y = 0 \\/ y^5 + 4 y + 8 = 0 ]') + {'y <= 0', 'y = 0', 'y^5 + 4 y + 8 = 0', 'y^5 + 4 y + 8 >= 0'} """ return set(i.strip() for i in flatten([i.split('\\/') for i in formula.replace('[','').replace(']','').split('/\\')])) diff --git a/src/sage/interfaces/r.py b/src/sage/interfaces/r.py index d922f3b55cd..3b3887b1ed2 100644 --- a/src/sage/interfaces/r.py +++ b/src/sage/interfaces/r.py @@ -297,13 +297,12 @@ def _setup_r_to_sage_converter(): Set up a the converter used to convert from rpy2's representation of R objects to the one sage expects. - EXAMPLES:: - - Test + EXAMPLES: - Simple numeric values are represented as vectors in R. So `1` would actually - be an array of length 1. We convert all vectors of length 1 to simple values, - whether or not they "originally" were simple values or not: + Simple numeric values are represented as vectors in R. So `1` + would actually be an array of length 1. We convert all vectors of + length 1 to simple values, whether or not they "originally" were + simple values or not:: sage: r([42]).sage() # optional - rpy2 42 @@ -314,13 +313,13 @@ def _setup_r_to_sage_converter(): sage: r('c("foo")').sage() # optional - rpy2 'foo' - Arrays of length greater than one are treated normally: + Arrays of length greater than one are treated normally:: sage: r([42, 43]).sage() # optional - rpy2 [42, 43] We also convert all numeric values to integers if that is possible without - loss of precision: + loss of precision:: sage: type(r([1.0]).sage()) == int # optional - rpy2 True @@ -328,13 +327,13 @@ def _setup_r_to_sage_converter(): sage: r([1.0, 42.5]).sage() # optional - rpy2 [1, 42.5] - Matrices are converted to sage matrices: + Matrices are converted to sage matrices:: sage: r('matrix(c(2,4,3,1,5,7), nrow=2, ncol=3)').sage() # optional - rpy2 [2 3 5] [4 1 7] - More complex r structures are represented by dictionaries: + More complex r structures are represented by dictionaries:: sage: r.summary(1).sage() # optional - rpy2 {'DATA': [1, 1, 1, 1, 1, 1], @@ -345,7 +344,7 @@ def _setup_r_to_sage_converter(): {'DATA': {'width': 60}, '_Names': 'width'} The conversion can handle "not a number", infintiy, imaginary values and - missing values: + missing values:: sage: r(-17).sqrt().sage() # optional - rpy2 nan @@ -356,8 +355,7 @@ def _setup_r_to_sage_converter(): sage: inf = r('Inf'); inf.sage() # optional - rpy2 inf - - Character Vectors are represented by regular python arrays: + Character Vectors are represented by regular python arrays:: sage: labs = r.paste('c("X","Y")', '1:10', sep='""'); labs.sage() # optional - rpy2 ['X1', 'Y2', 'X3', 'Y4', 'X5', 'Y6', 'X7', 'Y8', 'X9', 'Y10'] @@ -503,9 +501,9 @@ def _lazy_init(self): the blas implementation that is used. For details, see https://bitbucket.org/rpy2/rpy2/issues/491. - TESTS:: + TESTS: - Initialization happens on eval: + Initialization happens on eval:: sage: my_r = R() # optional - rpy2 sage: my_r._initialized # optional - rpy2 @@ -1391,6 +1389,7 @@ def __getitem__(self, s): INPUT: - s -- a string + OUTPUT: RFunction -- the R function that in R has name s EXAMPLES:: @@ -2082,4 +2081,3 @@ def __repr__(self): R! """ return str(self) - From c79ff66bb559802e7dc4f0f4fb8512b4ca6ab8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 10:42:01 +0200 Subject: [PATCH 308/416] fix details --- src/sage/interfaces/mupad.py | 2 +- src/sage/interfaces/r.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sage/interfaces/mupad.py b/src/sage/interfaces/mupad.py index 7f6cf4c682a..077ef21e70d 100644 --- a/src/sage/interfaces/mupad.py +++ b/src/sage/interfaces/mupad.py @@ -165,7 +165,7 @@ def _read_in_file_command(self, filename): sage: filename = tmp_filename() sage: with open(filename, 'w') as f: - ....: f.write('x := 2;\n') + ....: _ = f.write('x := 2;\n') sage: mupad.read(filename) # optional - MuPAD sage: mupad.get('x').strip() # optional - mupad '2' diff --git a/src/sage/interfaces/r.py b/src/sage/interfaces/r.py index 3b3887b1ed2..565d6a1da93 100644 --- a/src/sage/interfaces/r.py +++ b/src/sage/interfaces/r.py @@ -2060,13 +2060,14 @@ def r_version(): """ return r.version() + class HelpExpression(str): """ Used to improve printing of output of r.help. """ def __repr__(self): - """ - Return string representation of self. + r""" + Return string representation of ``self``. OUTPUT: string From dc5ac64ef5d9de3868ce0ae146ce1c76ecc4b900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 10:47:34 +0200 Subject: [PATCH 309/416] rst fixes in modular --- src/sage/modular/hecke/module.py | 4 ++-- src/sage/modular/overconvergent/genus0.py | 8 ++------ src/sage/modular/overconvergent/hecke_series.py | 14 +++++++------- src/sage/modular/pollack_stevens/sigma0.py | 6 ++++-- src/sage/modular/pollack_stevens/space.py | 11 ++++++----- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/sage/modular/hecke/module.py b/src/sage/modular/hecke/module.py index 168cb3403d6..602f8f8b813 100644 --- a/src/sage/modular/hecke/module.py +++ b/src/sage/modular/hecke/module.py @@ -627,8 +627,8 @@ def _eigen_nonzero_element(self, n=1): def _hecke_image_of_ith_basis_vector(self, n, i): r""" - Return `T_n(e_i)`, where `e_i` is the - `i`th basis vector of the ambient space. + Return `T_n(e_i)`, where `e_i` is the `i`-th basis vector + of the ambient space. EXAMPLES:: diff --git a/src/sage/modular/overconvergent/genus0.py b/src/sage/modular/overconvergent/genus0.py index 8c5f36fa933..5e0e75542f4 100644 --- a/src/sage/modular/overconvergent/genus0.py +++ b/src/sage/modular/overconvergent/genus0.py @@ -160,18 +160,14 @@ 3^9 + 2*3^12 + 3^15 + 3^17 + 3^18 + 3^19 + 3^20 + 2*3^22 + 2*3^23 + 2*3^27 + 2*3^28 + 3^32 + 3^33 + 2*3^34 + 3^38 + 2*3^39 + 3^40 + 2*3^41 + 3^44 + 3^45 + 3^46 + 2*3^47 + 2*3^48 + 3^49 + 3^50 + 2*3^51 + 2*3^52 + 3^53 + 2*3^54 + 3^55 + 3^56 + 3^57 + 2*3^58 + 2*3^59 + 3^60 + 2*3^61 + 2*3^63 + 2*3^64 + 3^65 + 2*3^67 + 3^68 + 2*3^69 + 2*3^71 + 3^72 + 2*3^74 + 3^75 + 3^76 + 3^79 + 3^80 + 2*3^83 + 2*3^84 + 3^85 + 2*3^87 + 3^88 + 2*3^89 + 2*3^90 + 2*3^91 + 3^92 + O(3^98) sage: efuncs[3].slope() 9 - ------------ """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008 William Stein # 2008-9 David Loeffler # # Distributed under the terms of the GNU General Public License (GPL) # https://www.gnu.org/licenses/ -#***************************************************************************** - +# **************************************************************************** from sage.matrix.all import matrix, MatrixSpace, diagonal_matrix from sage.misc.verbose import verbose from sage.misc.cachefunc import cached_method diff --git a/src/sage/modular/overconvergent/hecke_series.py b/src/sage/modular/overconvergent/hecke_series.py index 36bf374095c..007b729b25f 100644 --- a/src/sage/modular/overconvergent/hecke_series.py +++ b/src/sage/modular/overconvergent/hecke_series.py @@ -286,26 +286,27 @@ def random_solution(B,K): return a + # AUXILIARY CODE: ECHELON FORM -def ech_form(A,p): +def ech_form(A, p): r""" - Returns echelon form of matrix ``A`` over the ring of integers modulo + Return echelon form of matrix ``A`` over the ring of integers modulo `p^m`, for some prime `p` and `m \ge 1`. - .. todo:: + .. TODO:: This should be moved to :mod:`sage.matrix.matrix_modn_dense` at some point. INPUT: - - ``A`` -- matrix over ``Zmod(p^m)`` for some m. - - ``p`` - prime p. + - ``A`` -- matrix over ``Zmod(p^m)`` for some m + - ``p`` - prime p OUTPUT: - - matrix over ``Zmod(p^m)``. + matrix over ``Zmod(p^m)`` EXAMPLES:: @@ -316,7 +317,6 @@ def ech_form(A,p): [0 1 2] [0 0 0] """ - S = A[0, 0].parent() a = A.nrows() b = A.ncols() diff --git a/src/sage/modular/pollack_stevens/sigma0.py b/src/sage/modular/pollack_stevens/sigma0.py index fa2f4ac7d81..7b3dceda983 100644 --- a/src/sage/modular/pollack_stevens/sigma0.py +++ b/src/sage/modular/pollack_stevens/sigma0.py @@ -296,7 +296,9 @@ def matrix(self): def inverse(self): r""" - Return the inverse of self. This will raise an error if the result is not in the monoid. + Return the inverse of ``self``. + + This will raise an error if the result is not in the monoid. EXAMPLES:: @@ -310,7 +312,7 @@ def inverse(self): ... TypeError: no conversion of this rational to integer - .. todo:: + .. TODO:: In an ideal world this would silently extend scalars to `\QQ` if the inverse has non-integer entries but is still in `\Sigma_0(N)` diff --git a/src/sage/modular/pollack_stevens/space.py b/src/sage/modular/pollack_stevens/space.py index 47097c27305..8bb41867770 100644 --- a/src/sage/modular/pollack_stevens/space.py +++ b/src/sage/modular/pollack_stevens/space.py @@ -658,15 +658,16 @@ def _an_element_(self): OUTPUT: - An element of the modular symbol space. + an element of the modular symbol space - Returns a "typical" element of this space; in this case the constant - map sending every element to an element of the coefficient module. + This returns a "typical" element of this space; in this case + the constant map sending every element to an element of the + coefficient module. .. WARNING:: - This is not really an element of the space because it does not satisfy - the Manin relations. + This is not really an element of the space because it does + not satisfy the Manin relations. EXAMPLES:: From 279391c4878f7c8e9a2618ada85616972b581025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 10:57:09 +0200 Subject: [PATCH 310/416] rst fixes in game_theory --- src/sage/game_theory/normal_form_game.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/game_theory/normal_form_game.py b/src/sage/game_theory/normal_form_game.py index 2e27caa4a60..2c2438c1f8d 100644 --- a/src/sage/game_theory/normal_form_game.py +++ b/src/sage/game_theory/normal_form_game.py @@ -2315,7 +2315,7 @@ def _Hrepresentation(self, m1, m2): return s, t def _lrs_nash_format(self, m1, m2): - """ + r""" Create the input format for ``lrsnash``, version 6.1 or newer. EXAMPLES: From 832de2ea4d5580a9355f9cf8d8b0dc6dadf74eba Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Jul 2022 17:58:00 +0900 Subject: [PATCH 311/416] Change - to -- --- src/sage/modular/overconvergent/hecke_series.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sage/modular/overconvergent/hecke_series.py b/src/sage/modular/overconvergent/hecke_series.py index 007b729b25f..e4028f8d10b 100644 --- a/src/sage/modular/overconvergent/hecke_series.py +++ b/src/sage/modular/overconvergent/hecke_series.py @@ -302,11 +302,9 @@ def ech_form(A, p): INPUT: - ``A`` -- matrix over ``Zmod(p^m)`` for some m - - ``p`` - prime p + - ``p`` -- prime p - OUTPUT: - - matrix over ``Zmod(p^m)`` + OUTPUT: matrix over ``Zmod(p^m)`` EXAMPLES:: From e483da9dd04e8f68349017d671cef3a58cc7aa61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:01:29 +0200 Subject: [PATCH 312/416] rst_fixes in databases --- src/sage/databases/findstat.py | 7 ++++--- src/sage/databases/sql_db.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 2b04d96678e..d4c0c29bb36 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -470,8 +470,9 @@ def _post_json(url, data, **kwargs): return result raise ConnectionError(response.text) + def _submit(args, url): - """ + r""" Open a post form containing fields for each of the arguments, which is sent to the given url. @@ -2171,7 +2172,7 @@ def _richcmp_(self, other, op): return richcmp(self.id(), other.id(), op) def _fetch_data(self): - """ + r""" Return a dictionary containing the data of the statistic, except for the values, fetched from FindStat. @@ -3109,7 +3110,7 @@ def _richcmp_(self, other, op): return richcmp(self.id(), other.id(), op) def _fetch_data(self): - """ + r""" Return a dictionary containing the data of the map, fetched from FindStat. diff --git a/src/sage/databases/sql_db.py b/src/sage/databases/sql_db.py index d13d1e83940..0487d770f65 100644 --- a/src/sage/databases/sql_db.py +++ b/src/sage/databases/sql_db.py @@ -277,9 +277,10 @@ def construct_skeleton(database): skeleton[table[0]][name]['unique'] = bool(col[2]) return skeleton + p = 0 def _create_print_table(cur, col_titles, **kwds): - """ + r""" Create a nice printable table from the cursor given with the given column titles. From bacd72de27c1fa944388dd0c022269cc2cbb1525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:05:55 +0200 Subject: [PATCH 313/416] rst fixes in doctest --- src/sage/doctest/sources.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py index 68b6037bec9..72e44025b89 100644 --- a/src/sage/doctest/sources.py +++ b/src/sage/doctest/sources.py @@ -193,7 +193,7 @@ def _process_doc(self, doctests, doc, namespace, start): - ``namespace`` -- a dictionary or :class:`sage.doctest.util.RecordingDict`, used in the - creation of new :class:`doctest.DocTest`s. + creation of new :class:`doctest.DocTest` s. - ``start`` -- an integer, giving the line number of the start of this docstring in the larger file. @@ -239,7 +239,7 @@ def _create_doctests(self, namespace, tab_okay=None): - ``namespace`` -- a dictionary or :class:`sage.doctest.util.RecordingDict`, used in the - creation of new :class:`doctest.DocTest`s. + creation of new :class:`doctest.DocTest` s. - ``tab_okay`` -- whether tabs are allowed in this source. @@ -418,7 +418,7 @@ def __init__(self, basename, source, options, printpath, lineno_shift=0): DocTestSource.__init__(self, options) def __iter__(self): - """ + r""" Iterating over this source yields pairs ``(lineno, line)``. EXAMPLES:: @@ -763,13 +763,12 @@ def _test_enough_doctests(self, check_extras=True, verbose=True): INPUT: - - ``check_extras`` -- bool (default True), whether to check if - doctests are created that don't correspond to either a - ``sage: `` or a ``>>> `` prompt. + - ``check_extras`` -- bool (default ``True``), whether to check if + doctests are created that do not correspond to either a ``sage: `` + or a ``>>> `` prompt - - ``verbose`` -- bool (default True), whether to print - offending line numbers when there are missing or extra - tests. + - ``verbose`` -- bool (default ``True``), whether to print + offending line numbers when there are missing or extra tests TESTS:: From d7ab8840c35f3cc2e00e18a6c56c4c9b7d76a1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:07:55 +0200 Subject: [PATCH 314/416] fix --- src/sage/doctest/sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py index 72e44025b89..3136139e10a 100644 --- a/src/sage/doctest/sources.py +++ b/src/sage/doctest/sources.py @@ -755,7 +755,7 @@ def create_doctests(self, namespace): return self._create_doctests(namespace) def _test_enough_doctests(self, check_extras=True, verbose=True): - """ + r""" This function checks to see that the doctests are not getting unexpectedly skipped. It uses a different (and simpler) code path than the doctest creation functions, so there are a few From c088449d35cb3b27805c6eb7b1d9d400d7df84b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:13:00 +0200 Subject: [PATCH 315/416] rst fixes in plot and graphs --- src/sage/graphs/dot2tex_utils.py | 10 ++++++---- src/sage/plot/polygon.py | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/sage/graphs/dot2tex_utils.py b/src/sage/graphs/dot2tex_utils.py index 4568fe2287c..d67d283234d 100644 --- a/src/sage/graphs/dot2tex_utils.py +++ b/src/sage/graphs/dot2tex_utils.py @@ -77,11 +77,13 @@ def quoted_latex(x): """ return re.sub("\"|\r|(%[^\n]*)?\n","", latex(x)) + def quoted_str(x): - """ - Strips the string representation of ``x`` to make it suitable for - a ``dot2tex`` string, and especially a node label (``dot2tex`` - gets confused by newlines, and braces) + r""" + Strip the string representation of ``x`` to make it suitable for + a ``dot2tex`` string, and especially a node label. + + Indeed, ``dot2tex`` gets confused by newlines, and braces. EXAMPLES:: diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index 82ea3197162..916957643d7 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -97,8 +97,9 @@ def _repr_(self): def __getitem__(self, i): """ - Return `i`th vertex of Polygon primitive, starting count - from 0th vertex. + Return `i`-th vertex of Polygon primitive + + It is starting count from 0th vertex. EXAMPLES:: @@ -111,9 +112,11 @@ def __getitem__(self, i): def __setitem__(self, i, point): """ - Changes `i`th vertex of Polygon primitive, starting count - from 0th vertex. Note that this only changes a vertex, - but does not create new vertices. + Change `i`-th vertex of Polygon primitive + + It is starting count from 0th vertex. + + Note that this only changes a vertex, but does not create new vertices. EXAMPLES:: From 0911fb10ada4d2e610a8faabf078b65299c656ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:17:32 +0200 Subject: [PATCH 316/416] append TESTS:: and indent all file --- src/sage/tests/book_stein_modform.py | 1092 +++++++++++++------------- 1 file changed, 547 insertions(+), 545 deletions(-) diff --git a/src/sage/tests/book_stein_modform.py b/src/sage/tests/book_stein_modform.py index b0e909c0017..a43391ba028 100644 --- a/src/sage/tests/book_stein_modform.py +++ b/src/sage/tests/book_stein_modform.py @@ -2,551 +2,553 @@ This file contains a bunch of tests extracted from the published book 'Modular Forms: a Computational Approach' by William Stein, AMS 2007. -sage: G = SL(2,ZZ); G -Special Linear Group of degree 2 over Integer Ring -sage: S, T = G.gens() -sage: S -[ 0 1] -[-1 0] -sage: T -[1 1] -[0 1] -sage: delta_qexp(6) -q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6) -sage: bernoulli(12) --691/2730 -sage: bernoulli(50) -495057205241079648212477525/66 -sage: len(str(bernoulli(10000))) -27706 -sage: E4 = eisenstein_series_qexp(4, 3) -sage: E6 = eisenstein_series_qexp(6, 3) -sage: E4^6 -1/191102976000000 + 1/132710400000*q + 203/44236800000*q^2 + O(q^3) -sage: E4^3*E6^2 -1/3511517184000 - 1/12192768000*q - 377/4064256000*q^2 + O(q^3) -sage: E6^4 -1/64524128256 - 1/32006016*q + 241/10668672*q^2 + O(q^3) -sage: victor_miller_basis(28,5) -[ -1 + 15590400*q^3 + 36957286800*q^4 + O(q^5), -q + 151740*q^3 + 61032448*q^4 + O(q^5), -q^2 + 192*q^3 - 8280*q^4 + O(q^5) -] -sage: R. = QQ[['q']] -sage: F4 = 240 * eisenstein_series_qexp(4,3) -sage: F6 = -504 * eisenstein_series_qexp(6,3) -sage: F4^3 -1 + 720*q + 179280*q^2 + O(q^3) -sage: Delta = (F4^3 - F6^2)/1728; Delta -q - 24*q^2 + O(q^3) -sage: F4^3 - 720*Delta -1 + 196560*q^2 + O(q^3) -sage: M = ModularForms(1,36, prec=6).echelon_form() -sage: M.basis() -[ -1 + 6218175600*q^4 + 15281788354560*q^5 + O(q^6), -q + 57093088*q^4 + 37927345230*q^5 + O(q^6), -q^2 + 194184*q^4 + 7442432*q^5 + O(q^6), -q^3 - 72*q^4 + 2484*q^5 + O(q^6) -] -sage: T2 = M.hecke_matrix(2); T2 -[ 34359738369 0 6218175600 9026867482214400] -[ 0 0 34416831456 5681332472832] -[ 0 1 194184 -197264484] -[ 0 0 -72 -54528] -sage: T2.charpoly().factor() -(x - 34359738369) * (x^3 - 139656*x^2 - 59208339456*x - 1467625047588864) -sage: bernoulli_mod_p(23) -[1, 4, 13, 17, 13, 6, 10, 5, 10, 9, 15] -sage: set_modsym_print_mode ('modular') -sage: M = ModularSymbols(11, 2) -sage: M.basis() -({Infinity, 0}, {-1/8, 0}, {-1/9, 0}) -sage: S = M.cuspidal_submodule() -sage: S.integral_basis() # basis over ZZ. -({-1/8, 0}, {-1/9, 0}) -sage: set_modsym_print_mode ('manin') # set it back -sage: continued_fraction(4/7).convergents() -[0, 1, 1/2, 4/7] -sage: M = ModularSymbols(2,2) -sage: M -Modular Symbols space of dimension 1 for Gamma_0(2) -of weight 2 with sign 0 over Rational Field -sage: M.manin_generators() -[(0,1), (1,0), (1,1)] +TESTS:: -sage: M = ModularSymbols(3,2) -sage: M.manin_generators() -[(0,1), (1,0), (1,1), (1,2)] + sage: G = SL(2,ZZ); G + Special Linear Group of degree 2 over Integer Ring + sage: S, T = G.gens() + sage: S + [ 0 1] + [-1 0] + sage: T + [1 1] + [0 1] + sage: delta_qexp(6) + q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6) + sage: bernoulli(12) + -691/2730 + sage: bernoulli(50) + 495057205241079648212477525/66 + sage: len(str(bernoulli(10000))) + 27706 + sage: E4 = eisenstein_series_qexp(4, 3) + sage: E6 = eisenstein_series_qexp(6, 3) + sage: E4^6 + 1/191102976000000 + 1/132710400000*q + 203/44236800000*q^2 + O(q^3) + sage: E4^3*E6^2 + 1/3511517184000 - 1/12192768000*q - 377/4064256000*q^2 + O(q^3) + sage: E6^4 + 1/64524128256 - 1/32006016*q + 241/10668672*q^2 + O(q^3) + sage: victor_miller_basis(28,5) + [ + 1 + 15590400*q^3 + 36957286800*q^4 + O(q^5), + q + 151740*q^3 + 61032448*q^4 + O(q^5), + q^2 + 192*q^3 - 8280*q^4 + O(q^5) + ] + sage: R. = QQ[['q']] + sage: F4 = 240 * eisenstein_series_qexp(4,3) + sage: F6 = -504 * eisenstein_series_qexp(6,3) + sage: F4^3 + 1 + 720*q + 179280*q^2 + O(q^3) + sage: Delta = (F4^3 - F6^2)/1728; Delta + q - 24*q^2 + O(q^3) + sage: F4^3 - 720*Delta + 1 + 196560*q^2 + O(q^3) + sage: M = ModularForms(1,36, prec=6).echelon_form() + sage: M.basis() + [ + 1 + 6218175600*q^4 + 15281788354560*q^5 + O(q^6), + q + 57093088*q^4 + 37927345230*q^5 + O(q^6), + q^2 + 194184*q^4 + 7442432*q^5 + O(q^6), + q^3 - 72*q^4 + 2484*q^5 + O(q^6) + ] + sage: T2 = M.hecke_matrix(2); T2 + [ 34359738369 0 6218175600 9026867482214400] + [ 0 0 34416831456 5681332472832] + [ 0 1 194184 -197264484] + [ 0 0 -72 -54528] + sage: T2.charpoly().factor() + (x - 34359738369) * (x^3 - 139656*x^2 - 59208339456*x - 1467625047588864) + sage: bernoulli_mod_p(23) + [1, 4, 13, 17, 13, 6, 10, 5, 10, 9, 15] + sage: set_modsym_print_mode ('modular') + sage: M = ModularSymbols(11, 2) + sage: M.basis() + ({Infinity, 0}, {-1/8, 0}, {-1/9, 0}) + sage: S = M.cuspidal_submodule() + sage: S.integral_basis() # basis over ZZ. + ({-1/8, 0}, {-1/9, 0}) + sage: set_modsym_print_mode ('manin') # set it back + sage: continued_fraction(4/7).convergents() + [0, 1, 1/2, 4/7] + sage: M = ModularSymbols(2,2) + sage: M + Modular Symbols space of dimension 1 for Gamma_0(2) + of weight 2 with sign 0 over Rational Field + sage: M.manin_generators() + [(0,1), (1,0), (1,1)] -sage: M = ModularSymbols(6,2) -sage: M.manin_generators() -[(0,1), (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (2,1), - (2,3), (2,5), (3,1), (3,2)] -sage: M = ModularSymbols(2,2) -sage: [x.lift_to_sl2z(2) for x in M.manin_generators()] -[[1, 0, 0, 1], [0, -1, 1, 0], [1, 0, 1, 1]] -sage: M = ModularSymbols(6,2) -sage: x = M.manin_generators()[9] -sage: x -(2,5) -sage: x.lift_to_sl2z(6) -[1, 2, 2, 5] -sage: M = ModularSymbols(2,2) -sage: M.manin_basis() -[1] -sage: [M.manin_generators()[i] for i in M.manin_basis()] -[(1,0)] -sage: M = ModularSymbols(6,2) -sage: M.manin_basis() -[1, 10, 11] -sage: [M.manin_generators()[i] for i in M.manin_basis()] -[(1,0), (3,1), (3,2)] -sage: M.basis() -((1,0), (3,1), (3,2)) -sage: [x.modular_symbol_rep() for x in M.basis()] -[{Infinity, 0}, {0, 1/3}, {-1/2, -1/3}] -sage: M = ModularSymbols(2,2) -sage: M.manin_gens_to_basis() -[-1] -[ 1] -[ 0] -sage: M = ModularSymbols(2,2) -sage: x = (1,0); M(x) -(1,0) -sage: M( (3,1) ) # entries are reduced modulo 2 first -0 -sage: M( (10,19) ) --(1,0) -sage: M = ModularSymbols(6,2) -sage: M.manin_gens_to_basis() -[-1 0 0] -[ 1 0 0] -[ 0 0 0] -[ 0 -1 1] -[ 0 -1 0] -[ 0 -1 1] -[ 0 0 0] -[ 0 1 -1] -[ 0 0 -1] -[ 0 1 -1] -[ 0 1 0] -[ 0 0 1] -sage: M = ModularSymbols(6,2) -sage: M((0,1)) --(1,0) -sage: M((1,2)) --(3,1) + (3,2) -sage: HeilbronnCremona(2).to_list() -[[1, 0, 0, 2], [2, 0, 0, 1], [2, 1, 0, 1], [1, 0, 1, 2]] -sage: HeilbronnCremona(3).to_list() -[[1, 0, 0, 3], [3, 1, 0, 1], [1, 0, 1, 3], [3, 0, 0, 1], - [3, -1, 0, 1], [-1, 0, 1, -3]] -sage: HeilbronnCremona(5).to_list() -[[1, 0, 0, 5], [5, 2, 0, 1], [2, 1, 1, 3], [1, 0, 3, 5], - [5, 1, 0, 1], [1, 0, 1, 5], [5, 0, 0, 1], [5, -1, 0, 1], - [-1, 0, 1, -5], [5, -2, 0, 1], [-2, 1, 1, -3], - [1, 0, -3, 5]] -sage: len(HeilbronnCremona(37)) -128 -sage: len(HeilbronnCremona(389)) -1892 -sage: len(HeilbronnCremona(2003)) -11662 -sage: M = ModularSymbols(2,2) -sage: M.T(2).matrix() -[1] -sage: M = ModularSymbols(6, 2) -sage: M.T(2).matrix() -[ 2 1 -1] -[-1 0 1] -[-1 -1 2] -sage: M.T(3).matrix() -[3 2 0] -[0 1 0] -[2 2 1] -sage: M.T(3).fcp() # factored characteristic polynomial -(x - 3) * (x - 1)^2 -sage: M = ModularSymbols(39, 2) -sage: T2 = M.T(2) -sage: T2.matrix() -[ 3 0 -1 0 0 1 1 -1 0] -[ 0 0 2 0 -1 1 0 1 -1] -[ 0 1 0 -1 1 1 0 1 -1] -[ 0 0 1 0 0 1 0 1 -1] -[ 0 -1 2 0 0 1 0 1 -1] -[ 0 0 1 1 0 1 1 -1 0] -[ 0 0 0 -1 0 1 1 2 0] -[ 0 0 0 1 0 0 2 0 1] -[ 0 0 -1 0 0 0 1 0 2] -sage: T2.fcp() # factored characteristic polynomial -(x - 1)^2 * (x - 3)^3 * (x^2 + 2*x - 1)^2 -sage: T2 = M.T(2).matrix() -sage: T5 = M.T(5).matrix() -sage: T2*T5 - T5*T2 == 0 -True -sage: T5.charpoly().factor() -(x - 2)^2 * (x - 6)^3 * (x^2 - 8)^2 -sage: M = ModularSymbols(39, 2) -sage: M.T(2).decomposition() -[ -Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 9 for Gamma_0(39) of weight 2 with sign 0 over Rational Field, -Modular Symbols subspace of dimension 3 of Modular Symbols space of dimension 9 for Gamma_0(39) of weight 2 with sign 0 over Rational Field, -Modular Symbols subspace of dimension 4 of Modular Symbols space of dimension 9 for Gamma_0(39) of weight 2 with sign 0 over Rational Field -] -sage: M = ModularSymbols(2, 2) -sage: M.boundary_map() -Hecke module morphism boundary map defined by the matrix -[ 1 -1] -Domain: Modular Symbols space of dimension 1 for -Gamma_0(2) of weight ... -Codomain: Space of Boundary Modular Symbols for -Congruence Subgroup Gamma0(2) ... -sage: M.cuspidal_submodule() -Modular Symbols subspace of dimension 0 of Modular -Symbols space of dimension 1 for Gamma_0(2) of weight -2 with sign 0 over Rational Field -sage: M = ModularSymbols(11, 2) -sage: M.boundary_map().matrix() -[ 1 -1] -[ 0 0] -[ 0 0] -sage: M.cuspidal_submodule() -Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field -sage: S = M.cuspidal_submodule(); S -Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field -sage: S.basis() -((1,8), (1,9)) -sage: S.T(2).matrix() -[-2 0] -[ 0 -2] -sage: S.T(3).matrix() -[-1 0] -[ 0 -1] -sage: S.T(5).matrix() -[1 0] -[0 1] -sage: E = EllipticCurve([0,-1,1,-10,-20]) -sage: 2 + 1 - E.Np(2) --2 -sage: 3 + 1 - E.Np(3) --1 -sage: 5 + 1 - E.Np(5) -1 -sage: 7 + 1 - E.Np(7) --2 -sage: [S.T(p).matrix()[0,0] for p in [2,3,5,7]] -[-2, -1, 1, -2] -sage: M = ModularSymbols(11); M.basis() -((1,0), (1,8), (1,9)) -sage: S = M.cuspidal_submodule(); S -Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field -sage: S.T(2).matrix() -[-2 0] -[ 0 -2] -sage: S.T(3).matrix() -[-1 0] -[ 0 -1] -sage: M = ModularSymbols(33) -sage: S = M.cuspidal_submodule(); S -Modular Symbols subspace of dimension 6 of Modular -Symbols space of dimension 9 for Gamma_0(33) of weight -2 with sign 0 over Rational Field -sage: R. = PowerSeriesRing(QQ) -sage: v = [S.T(n).matrix()[0,0] for n in range(1,6)] -sage: f00 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) -sage: f00 -q - q^2 - q^3 + q^4 + O(q^6) -sage: v = [S.T(n).matrix()[0,1] for n in range(1,6)] -sage: f01 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) -sage: f01 --2*q^3 + O(q^6) -sage: v = [S.T(n).matrix()[1,0] for n in range(1,6)] -sage: f10 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) -sage: f10 -q^3 + O(q^6) -sage: v = [S.T(n).matrix()[1,1] for n in range(1,6)] -sage: f11 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) -sage: f11 -q - 2*q^2 + 2*q^4 + q^5 + O(q^6) -sage: M = ModularSymbols(23) -sage: S = M.cuspidal_submodule() -sage: S -Modular Symbols subspace of dimension 4 of Modular -Symbols space of dimension 5 for Gamma_0(23) of weight -2 with sign 0 over Rational Field -sage: f = S.q_expansion_cuspforms(6) -sage: f(0,0) -q - 2/3*q^2 + 1/3*q^3 - 1/3*q^4 - 4/3*q^5 + O(q^6) -sage: f(0,1) -O(q^6) -sage: f(1,0) --1/3*q^2 + 2/3*q^3 + 1/3*q^4 - 2/3*q^5 + O(q^6) -sage: S.q_expansion_basis(6) -[ -q - q^3 - q^4 + O(q^6), -q^2 - 2*q^3 - q^4 + 2*q^5 + O(q^6) -] -sage: R = Integers(49) -sage: R -Ring of integers modulo 49 -sage: R.unit_gens() -(3,) -sage: Integers(25).unit_gens() -(2,) -sage: Integers(100).unit_gens() -(51, 77) -sage: Integers(200).unit_gens() -(151, 101, 177) -sage: Integers(2005).unit_gens() -(402, 1206) -sage: Integers(200000000).unit_gens() -(174218751, 51562501, 187109377) -sage: list(DirichletGroup(5)) -[Dirichlet character modulo 5 of conductor 1 mapping 2 |--> 1, -Dirichlet character modulo 5 of conductor 5 mapping 2 |--> zeta4, -Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1, -Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -zeta4] -sage: list(DirichletGroup(5, QQ)) -[Dirichlet character modulo 5 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1] -sage: G = DirichletGroup(200) -sage: G -Group of Dirichlet characters modulo 200 with values in Cyclotomic Field of order 20 and degree 8 -sage: G.exponent() -20 -sage: G.gens() -(Dirichlet character modulo 200 of conductor 4 mapping 151 |--> -1, 101 |--> 1, 177 |--> 1, -Dirichlet character modulo 200 of conductor 8 mapping 151 |--> 1, 101 |--> -1, 177 |--> 1, -Dirichlet character modulo 200 of conductor 25 mapping 151 |--> 1, 101 |--> 1, 177 |--> zeta20) -sage: K = G.base_ring() -sage: zeta = K.0 -sage: eps = G([1,-1,zeta^5]) -sage: eps -Dirichlet character modulo 200 of conductor 40 mapping 151 |--> 1, 101 |--> -1, 177 |--> zeta20^5 -sage: eps(3) -zeta20^5 -sage: -zeta^15 -zeta20^5 -sage: kronecker(151,200) -1 -sage: kronecker(101,200) --1 -sage: kronecker(177,200) -1 -sage: G = DirichletGroup(20) -sage: G.galois_orbits() -[ -[Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> -1], -[Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> -zeta4, - Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> zeta4], -[Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1], -[Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -1], -[Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -zeta4, - Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4], -[Dirichlet character modulo 20 of conductor 1 mapping 11 |--> 1, 17 |--> 1] -] -sage: G = DirichletGroup(11, QQ); G -Group of Dirichlet characters modulo 11 with values in Rational Field -sage: list(G) -[Dirichlet character modulo 11 of conductor 1 mapping 2 |--> 1, -Dirichlet character modulo 11 of conductor 11 mapping 2 |--> -1] -sage: eps = G.0 # 0th generator for Dirichlet group -sage: eps -Dirichlet character modulo 11 of conductor 11 mapping 2 |--> -1 -sage: G.unit_gens() -(2,) -sage: eps(2) --1 -sage: eps(3) -1 -sage: [eps(11*n) for n in range(10)] -[0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -sage: R = CyclotomicField(4) -sage: CyclotomicField(4) -Cyclotomic Field of order 4 and degree 2 -sage: G = DirichletGroup(15, R) -sage: G -Group of Dirichlet characters modulo 15 with values in Cyclotomic Field of order 4 and degree 2 -sage: list(G) -[Dirichlet character modulo 15 of conductor 1 mapping 11 |--> 1, 7 |--> 1, -Dirichlet character modulo 15 of conductor 3 mapping 11 |--> -1, 7 |--> 1, -Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> zeta4, -Dirichlet character modulo 15 of conductor 15 mapping 11 |--> -1, 7 |--> zeta4, -Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> -1, -Dirichlet character modulo 15 of conductor 15 mapping 11 |--> -1, 7 |--> -1, -Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> -zeta4, -Dirichlet character modulo 15 of conductor 15 mapping 11 |--> -1, 7 |--> -zeta4] -sage: e = G.1 -sage: e(4) --1 -sage: e(-1) --1 -sage: e(5) -0 -sage: [e(n) for n in range(15)] -[0, 1, zeta4, 0, -1, 0, 0, zeta4, -zeta4, - 0, 0, 1, 0, -zeta4, -1] -sage: G = DirichletGroup(15, GF(5)); G -Group of Dirichlet characters modulo 15 with values in Finite Field of size 5 -sage: list(G) -[Dirichlet character modulo 15 of conductor 1 mapping 11 |--> 1, 7 |--> 1, -Dirichlet character modulo 15 of conductor 3 mapping 11 |--> 4, 7 |--> 1, -Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> 2, -Dirichlet character modulo 15 of conductor 15 mapping 11 |--> 4, 7 |--> 2, -Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> 4, -Dirichlet character modulo 15 of conductor 15 mapping 11 |--> 4, 7 |--> 4, -Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> 3, -Dirichlet character modulo 15 of conductor 15 mapping 11 |--> 4, 7 |--> 3] -sage: e = G.1 -sage: e(-1) -4 -sage: e(2) -2 -sage: e(5) -0 -sage: [e(n) for n in range(15)] -[0, 1, 2, 0, 4, 0, 0, 2, 3, 0, 0, 1, 0, 3, 4] -sage: G = DirichletGroup(5) -sage: e = G.0 -sage: e(2) -zeta4 -sage: e.bernoulli(1) --1/5*zeta4 - 3/5 -sage: e.bernoulli(9) --108846/5*zeta4 - 176868/5 -sage: E = EisensteinForms(Gamma1(13),2) -sage: E.eisenstein_series() -[ -1/2 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6), --7/13*zeta6 - 11/13 + q + (2*zeta6 + 1)*q^2 + (-3*zeta6 + 1)*q^3 + (6*zeta6 - 3)*q^4 - 4*q^5 + O(q^6), -q + (zeta6 + 2)*q^2 + (-zeta6 + 3)*q^3 + (3*zeta6 + 3)*q^4 + 4*q^5 + O(q^6), --zeta6 + q + (2*zeta6 - 1)*q^2 + (3*zeta6 - 2)*q^3 + (-2*zeta6 - 1)*q^4 + 6*q^5 + O(q^6), -q + (zeta6 + 1)*q^2 + (zeta6 + 2)*q^3 + (zeta6 + 2)*q^4 + 6*q^5 + O(q^6), --1 + q - q^2 + 4*q^3 + 3*q^4 - 4*q^5 + O(q^6), -q + q^2 + 4*q^3 + 3*q^4 + 4*q^5 + O(q^6), -zeta6 - 1 + q + (-2*zeta6 + 1)*q^2 + (-3*zeta6 + 1)*q^3 + (2*zeta6 - 3)*q^4 + 6*q^5 + O(q^6), -q + (-zeta6 + 2)*q^2 + (-zeta6 + 3)*q^3 + (-zeta6 + 3)*q^4 + 6*q^5 + O(q^6), -7/13*zeta6 - 18/13 + q + (-2*zeta6 + 3)*q^2 + (3*zeta6 - 2)*q^3 + (-6*zeta6 + 3)*q^4 - 4*q^5 + O(q^6), -q + (-zeta6 + 3)*q^2 + (zeta6 + 2)*q^3 + (-3*zeta6 + 6)*q^4 + 4*q^5 + O(q^6) -] -sage: e = E.eisenstein_series() -sage: for e in E.eisenstein_series(): -....: print(e.parameters()) -(Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 13) -(Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6, 1) -(Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) -(Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6 - 1, 1) -(Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6 - 1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) -(Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -1, 1) -(Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) -(Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6, 1) -(Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) -(Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6 + 1, 1) -(Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6 + 1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) -sage: from sage.modular.dims import * -sage: dimension_cusp_forms(Gamma0(2007),2) -221 -sage: dimension_eis(Gamma0(2007),2) -7 -sage: dimension_modular_forms(Gamma0(2007),2) -228 -sage: dimension_new_cusp_forms(Gamma0(11),12) -8 -sage: dimension_cusp_forms(Gamma0(11),12) -10 -sage: dimension_new_cusp_forms(Gamma0(2007),12) -1017 -sage: dimension_cusp_forms(Gamma0(2007),12) -2460 -sage: dimension_cusp_forms(Gamma1(2007),2) -147409 -sage: dimension_eis(Gamma1(2007),2) -3551 -sage: dimension_modular_forms(Gamma1(2007),2) -150960 -sage: G = DirichletGroup(2007) -sage: e = prod(G.gens(), G(1)) -sage: dimension_cusp_forms(e,2) -222 -sage: dimension_cusp_forms(e,3) -0 -sage: dimension_cusp_forms(e,4) -670 -sage: dimension_cusp_forms(e,24) -5150 -sage: dimension_eis(e,2) -4 -sage: dimension_eis(e,3) -0 -sage: dimension_eis(e,4) -4 -sage: dimension_eis(e,24) -4 -sage: G = DirichletGroup(2007, QQ) -sage: e = prod(G.gens(), G(1)) -sage: dimension_new_cusp_forms(e,2) -76 -sage: p = 389 -sage: k = GF(p) -sage: a = k(7/13); a -210 -sage: a.rational_reconstruction() -7/13 -sage: M = MatrixSpace(QQ,4,8) -sage: A = M([[-9,6,7,3,1,0,0,0],[-10,3,8,2,0,1,0,0],[3,-6,2,8,0,0,1,0],[-8,-6,-8,6,0,0,0,1]]) -sage: A41 = MatrixSpace(GF(41),4,8)(A) -sage: E41 = A41.echelon_form() -sage: B = A.matrix_from_columns([0,1,2,4]) -sage: E = B^(-1)*A -sage: B = A.matrix_from_columns([0,1,2,3]) -sage: M = ModularSymbols(Gamma0(6)); M -Modular Symbols space of dimension 3 for Gamma_0(6) -of weight 2 with sign 0 over Rational Field -sage: M.new_subspace() -Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 3 for Gamma_0(6) of weight 2 with sign 0 over Rational Field -sage: M.old_subspace() -Modular Symbols subspace of dimension 3 of Modular -Symbols space of dimension 3 for Gamma_0(6) of weight -2 with sign 0 over Rational Field -sage: G = DirichletGroup(13) -sage: G -Group of Dirichlet characters modulo 13 with values in Cyclotomic Field of order 12 and degree 4 -sage: dimension_modular_forms(Gamma1(13),2) -13 -sage: [dimension_modular_forms(e,2) for e in G] -[1, 0, 3, 0, 2, 0, 2, 0, 2, 0, 3, 0] -sage: G = DirichletGroup(100) -sage: G -Group of Dirichlet characters modulo 100 with values in Cyclotomic Field of order 20 and degree 8 -sage: dimension_modular_forms(Gamma1(100),2) -370 -sage: v = [dimension_modular_forms(e,2) for e in G]; v -[24, 0, 0, 17, 18, 0, 0, 17, 18, 0, 0, 21, 18, 0, 0, 17, - 18, 0, 0, 17, 24, 0, 0, 17, 18, 0, 0, 17, 18, 0, 0, 21, - 18, 0, 0, 17, 18, 0, 0, 17] -sage: sum(v) -370 -sage: S = CuspForms(Gamma0(45), 2, prec=14); S -Cuspidal subspace of dimension 3 of Modular Forms space -of dimension 10 for Congruence Subgroup Gamma0(45) of -weight 2 over Rational Field -sage: S.basis() -[ -q - q^4 - q^10 - 2*q^13 + O(q^14), -q^2 - q^5 - 3*q^8 + 4*q^11 + O(q^14), -q^3 - q^6 - q^9 - q^12 + O(q^14) -] -sage: S.new_subspace().basis() -[ -q + q^2 - q^4 - q^5 - 3*q^8 - q^10 + 4*q^11 - 2*q^13 + O(q^14) -] -sage: CuspForms(Gamma0(9),2) -Cuspidal subspace of dimension 0 of Modular Forms space -of dimension 3 for Congruence Subgroup Gamma0(9) of -weight 2 over Rational Field -sage: CuspForms(Gamma0(15),2, prec=10).basis() -[ -q - q^2 - q^3 - q^4 + q^5 + q^6 + 3*q^8 + q^9 + O(q^10) -] + sage: M = ModularSymbols(3,2) + sage: M.manin_generators() + [(0,1), (1,0), (1,1), (1,2)] + + sage: M = ModularSymbols(6,2) + sage: M.manin_generators() + [(0,1), (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (2,1), + (2,3), (2,5), (3,1), (3,2)] + sage: M = ModularSymbols(2,2) + sage: [x.lift_to_sl2z(2) for x in M.manin_generators()] + [[1, 0, 0, 1], [0, -1, 1, 0], [1, 0, 1, 1]] + sage: M = ModularSymbols(6,2) + sage: x = M.manin_generators()[9] + sage: x + (2,5) + sage: x.lift_to_sl2z(6) + [1, 2, 2, 5] + sage: M = ModularSymbols(2,2) + sage: M.manin_basis() + [1] + sage: [M.manin_generators()[i] for i in M.manin_basis()] + [(1,0)] + sage: M = ModularSymbols(6,2) + sage: M.manin_basis() + [1, 10, 11] + sage: [M.manin_generators()[i] for i in M.manin_basis()] + [(1,0), (3,1), (3,2)] + sage: M.basis() + ((1,0), (3,1), (3,2)) + sage: [x.modular_symbol_rep() for x in M.basis()] + [{Infinity, 0}, {0, 1/3}, {-1/2, -1/3}] + sage: M = ModularSymbols(2,2) + sage: M.manin_gens_to_basis() + [-1] + [ 1] + [ 0] + sage: M = ModularSymbols(2,2) + sage: x = (1,0); M(x) + (1,0) + sage: M( (3,1) ) # entries are reduced modulo 2 first + 0 + sage: M( (10,19) ) + -(1,0) + sage: M = ModularSymbols(6,2) + sage: M.manin_gens_to_basis() + [-1 0 0] + [ 1 0 0] + [ 0 0 0] + [ 0 -1 1] + [ 0 -1 0] + [ 0 -1 1] + [ 0 0 0] + [ 0 1 -1] + [ 0 0 -1] + [ 0 1 -1] + [ 0 1 0] + [ 0 0 1] + sage: M = ModularSymbols(6,2) + sage: M((0,1)) + -(1,0) + sage: M((1,2)) + -(3,1) + (3,2) + sage: HeilbronnCremona(2).to_list() + [[1, 0, 0, 2], [2, 0, 0, 1], [2, 1, 0, 1], [1, 0, 1, 2]] + sage: HeilbronnCremona(3).to_list() + [[1, 0, 0, 3], [3, 1, 0, 1], [1, 0, 1, 3], [3, 0, 0, 1], + [3, -1, 0, 1], [-1, 0, 1, -3]] + sage: HeilbronnCremona(5).to_list() + [[1, 0, 0, 5], [5, 2, 0, 1], [2, 1, 1, 3], [1, 0, 3, 5], + [5, 1, 0, 1], [1, 0, 1, 5], [5, 0, 0, 1], [5, -1, 0, 1], + [-1, 0, 1, -5], [5, -2, 0, 1], [-2, 1, 1, -3], + [1, 0, -3, 5]] + sage: len(HeilbronnCremona(37)) + 128 + sage: len(HeilbronnCremona(389)) + 1892 + sage: len(HeilbronnCremona(2003)) + 11662 + sage: M = ModularSymbols(2,2) + sage: M.T(2).matrix() + [1] + sage: M = ModularSymbols(6, 2) + sage: M.T(2).matrix() + [ 2 1 -1] + [-1 0 1] + [-1 -1 2] + sage: M.T(3).matrix() + [3 2 0] + [0 1 0] + [2 2 1] + sage: M.T(3).fcp() # factored characteristic polynomial + (x - 3) * (x - 1)^2 + sage: M = ModularSymbols(39, 2) + sage: T2 = M.T(2) + sage: T2.matrix() + [ 3 0 -1 0 0 1 1 -1 0] + [ 0 0 2 0 -1 1 0 1 -1] + [ 0 1 0 -1 1 1 0 1 -1] + [ 0 0 1 0 0 1 0 1 -1] + [ 0 -1 2 0 0 1 0 1 -1] + [ 0 0 1 1 0 1 1 -1 0] + [ 0 0 0 -1 0 1 1 2 0] + [ 0 0 0 1 0 0 2 0 1] + [ 0 0 -1 0 0 0 1 0 2] + sage: T2.fcp() # factored characteristic polynomial + (x - 1)^2 * (x - 3)^3 * (x^2 + 2*x - 1)^2 + sage: T2 = M.T(2).matrix() + sage: T5 = M.T(5).matrix() + sage: T2*T5 - T5*T2 == 0 + True + sage: T5.charpoly().factor() + (x - 2)^2 * (x - 6)^3 * (x^2 - 8)^2 + sage: M = ModularSymbols(39, 2) + sage: M.T(2).decomposition() + [ + Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 9 for Gamma_0(39) of weight 2 with sign 0 over Rational Field, + Modular Symbols subspace of dimension 3 of Modular Symbols space of dimension 9 for Gamma_0(39) of weight 2 with sign 0 over Rational Field, + Modular Symbols subspace of dimension 4 of Modular Symbols space of dimension 9 for Gamma_0(39) of weight 2 with sign 0 over Rational Field + ] + sage: M = ModularSymbols(2, 2) + sage: M.boundary_map() + Hecke module morphism boundary map defined by the matrix + [ 1 -1] + Domain: Modular Symbols space of dimension 1 for + Gamma_0(2) of weight ... + Codomain: Space of Boundary Modular Symbols for + Congruence Subgroup Gamma0(2) ... + sage: M.cuspidal_submodule() + Modular Symbols subspace of dimension 0 of Modular + Symbols space of dimension 1 for Gamma_0(2) of weight + 2 with sign 0 over Rational Field + sage: M = ModularSymbols(11, 2) + sage: M.boundary_map().matrix() + [ 1 -1] + [ 0 0] + [ 0 0] + sage: M.cuspidal_submodule() + Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field + sage: S = M.cuspidal_submodule(); S + Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field + sage: S.basis() + ((1,8), (1,9)) + sage: S.T(2).matrix() + [-2 0] + [ 0 -2] + sage: S.T(3).matrix() + [-1 0] + [ 0 -1] + sage: S.T(5).matrix() + [1 0] + [0 1] + sage: E = EllipticCurve([0,-1,1,-10,-20]) + sage: 2 + 1 - E.Np(2) + -2 + sage: 3 + 1 - E.Np(3) + -1 + sage: 5 + 1 - E.Np(5) + 1 + sage: 7 + 1 - E.Np(7) + -2 + sage: [S.T(p).matrix()[0,0] for p in [2,3,5,7]] + [-2, -1, 1, -2] + sage: M = ModularSymbols(11); M.basis() + ((1,0), (1,8), (1,9)) + sage: S = M.cuspidal_submodule(); S + Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field + sage: S.T(2).matrix() + [-2 0] + [ 0 -2] + sage: S.T(3).matrix() + [-1 0] + [ 0 -1] + sage: M = ModularSymbols(33) + sage: S = M.cuspidal_submodule(); S + Modular Symbols subspace of dimension 6 of Modular + Symbols space of dimension 9 for Gamma_0(33) of weight + 2 with sign 0 over Rational Field + sage: R. = PowerSeriesRing(QQ) + sage: v = [S.T(n).matrix()[0,0] for n in range(1,6)] + sage: f00 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) + sage: f00 + q - q^2 - q^3 + q^4 + O(q^6) + sage: v = [S.T(n).matrix()[0,1] for n in range(1,6)] + sage: f01 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) + sage: f01 + -2*q^3 + O(q^6) + sage: v = [S.T(n).matrix()[1,0] for n in range(1,6)] + sage: f10 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) + sage: f10 + q^3 + O(q^6) + sage: v = [S.T(n).matrix()[1,1] for n in range(1,6)] + sage: f11 = sum(v[n-1]*q^n for n in range(1,6)) + O(q^6) + sage: f11 + q - 2*q^2 + 2*q^4 + q^5 + O(q^6) + sage: M = ModularSymbols(23) + sage: S = M.cuspidal_submodule() + sage: S + Modular Symbols subspace of dimension 4 of Modular + Symbols space of dimension 5 for Gamma_0(23) of weight + 2 with sign 0 over Rational Field + sage: f = S.q_expansion_cuspforms(6) + sage: f(0,0) + q - 2/3*q^2 + 1/3*q^3 - 1/3*q^4 - 4/3*q^5 + O(q^6) + sage: f(0,1) + O(q^6) + sage: f(1,0) + -1/3*q^2 + 2/3*q^3 + 1/3*q^4 - 2/3*q^5 + O(q^6) + sage: S.q_expansion_basis(6) + [ + q - q^3 - q^4 + O(q^6), + q^2 - 2*q^3 - q^4 + 2*q^5 + O(q^6) + ] + sage: R = Integers(49) + sage: R + Ring of integers modulo 49 + sage: R.unit_gens() + (3,) + sage: Integers(25).unit_gens() + (2,) + sage: Integers(100).unit_gens() + (51, 77) + sage: Integers(200).unit_gens() + (151, 101, 177) + sage: Integers(2005).unit_gens() + (402, 1206) + sage: Integers(200000000).unit_gens() + (174218751, 51562501, 187109377) + sage: list(DirichletGroup(5)) + [Dirichlet character modulo 5 of conductor 1 mapping 2 |--> 1, + Dirichlet character modulo 5 of conductor 5 mapping 2 |--> zeta4, + Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1, + Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -zeta4] + sage: list(DirichletGroup(5, QQ)) + [Dirichlet character modulo 5 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1] + sage: G = DirichletGroup(200) + sage: G + Group of Dirichlet characters modulo 200 with values in Cyclotomic Field of order 20 and degree 8 + sage: G.exponent() + 20 + sage: G.gens() + (Dirichlet character modulo 200 of conductor 4 mapping 151 |--> -1, 101 |--> 1, 177 |--> 1, + Dirichlet character modulo 200 of conductor 8 mapping 151 |--> 1, 101 |--> -1, 177 |--> 1, + Dirichlet character modulo 200 of conductor 25 mapping 151 |--> 1, 101 |--> 1, 177 |--> zeta20) + sage: K = G.base_ring() + sage: zeta = K.0 + sage: eps = G([1,-1,zeta^5]) + sage: eps + Dirichlet character modulo 200 of conductor 40 mapping 151 |--> 1, 101 |--> -1, 177 |--> zeta20^5 + sage: eps(3) + zeta20^5 + sage: -zeta^15 + zeta20^5 + sage: kronecker(151,200) + 1 + sage: kronecker(101,200) + -1 + sage: kronecker(177,200) + 1 + sage: G = DirichletGroup(20) + sage: G.galois_orbits() + [ + [Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> -1], + [Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> -zeta4, + Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> zeta4], + [Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1], + [Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -1], + [Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -zeta4, + Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4], + [Dirichlet character modulo 20 of conductor 1 mapping 11 |--> 1, 17 |--> 1] + ] + sage: G = DirichletGroup(11, QQ); G + Group of Dirichlet characters modulo 11 with values in Rational Field + sage: list(G) + [Dirichlet character modulo 11 of conductor 1 mapping 2 |--> 1, + Dirichlet character modulo 11 of conductor 11 mapping 2 |--> -1] + sage: eps = G.0 # 0th generator for Dirichlet group + sage: eps + Dirichlet character modulo 11 of conductor 11 mapping 2 |--> -1 + sage: G.unit_gens() + (2,) + sage: eps(2) + -1 + sage: eps(3) + 1 + sage: [eps(11*n) for n in range(10)] + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + sage: R = CyclotomicField(4) + sage: CyclotomicField(4) + Cyclotomic Field of order 4 and degree 2 + sage: G = DirichletGroup(15, R) + sage: G + Group of Dirichlet characters modulo 15 with values in Cyclotomic Field of order 4 and degree 2 + sage: list(G) + [Dirichlet character modulo 15 of conductor 1 mapping 11 |--> 1, 7 |--> 1, + Dirichlet character modulo 15 of conductor 3 mapping 11 |--> -1, 7 |--> 1, + Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> zeta4, + Dirichlet character modulo 15 of conductor 15 mapping 11 |--> -1, 7 |--> zeta4, + Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> -1, + Dirichlet character modulo 15 of conductor 15 mapping 11 |--> -1, 7 |--> -1, + Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> -zeta4, + Dirichlet character modulo 15 of conductor 15 mapping 11 |--> -1, 7 |--> -zeta4] + sage: e = G.1 + sage: e(4) + -1 + sage: e(-1) + -1 + sage: e(5) + 0 + sage: [e(n) for n in range(15)] + [0, 1, zeta4, 0, -1, 0, 0, zeta4, -zeta4, + 0, 0, 1, 0, -zeta4, -1] + sage: G = DirichletGroup(15, GF(5)); G + Group of Dirichlet characters modulo 15 with values in Finite Field of size 5 + sage: list(G) + [Dirichlet character modulo 15 of conductor 1 mapping 11 |--> 1, 7 |--> 1, + Dirichlet character modulo 15 of conductor 3 mapping 11 |--> 4, 7 |--> 1, + Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> 2, + Dirichlet character modulo 15 of conductor 15 mapping 11 |--> 4, 7 |--> 2, + Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> 4, + Dirichlet character modulo 15 of conductor 15 mapping 11 |--> 4, 7 |--> 4, + Dirichlet character modulo 15 of conductor 5 mapping 11 |--> 1, 7 |--> 3, + Dirichlet character modulo 15 of conductor 15 mapping 11 |--> 4, 7 |--> 3] + sage: e = G.1 + sage: e(-1) + 4 + sage: e(2) + 2 + sage: e(5) + 0 + sage: [e(n) for n in range(15)] + [0, 1, 2, 0, 4, 0, 0, 2, 3, 0, 0, 1, 0, 3, 4] + sage: G = DirichletGroup(5) + sage: e = G.0 + sage: e(2) + zeta4 + sage: e.bernoulli(1) + -1/5*zeta4 - 3/5 + sage: e.bernoulli(9) + -108846/5*zeta4 - 176868/5 + sage: E = EisensteinForms(Gamma1(13),2) + sage: E.eisenstein_series() + [ + 1/2 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6), + -7/13*zeta6 - 11/13 + q + (2*zeta6 + 1)*q^2 + (-3*zeta6 + 1)*q^3 + (6*zeta6 - 3)*q^4 - 4*q^5 + O(q^6), + q + (zeta6 + 2)*q^2 + (-zeta6 + 3)*q^3 + (3*zeta6 + 3)*q^4 + 4*q^5 + O(q^6), + -zeta6 + q + (2*zeta6 - 1)*q^2 + (3*zeta6 - 2)*q^3 + (-2*zeta6 - 1)*q^4 + 6*q^5 + O(q^6), + q + (zeta6 + 1)*q^2 + (zeta6 + 2)*q^3 + (zeta6 + 2)*q^4 + 6*q^5 + O(q^6), + -1 + q - q^2 + 4*q^3 + 3*q^4 - 4*q^5 + O(q^6), + q + q^2 + 4*q^3 + 3*q^4 + 4*q^5 + O(q^6), + zeta6 - 1 + q + (-2*zeta6 + 1)*q^2 + (-3*zeta6 + 1)*q^3 + (2*zeta6 - 3)*q^4 + 6*q^5 + O(q^6), + q + (-zeta6 + 2)*q^2 + (-zeta6 + 3)*q^3 + (-zeta6 + 3)*q^4 + 6*q^5 + O(q^6), + 7/13*zeta6 - 18/13 + q + (-2*zeta6 + 3)*q^2 + (3*zeta6 - 2)*q^3 + (-6*zeta6 + 3)*q^4 - 4*q^5 + O(q^6), + q + (-zeta6 + 3)*q^2 + (zeta6 + 2)*q^3 + (-3*zeta6 + 6)*q^4 + 4*q^5 + O(q^6) + ] + sage: e = E.eisenstein_series() + sage: for e in E.eisenstein_series(): + ....: print(e.parameters()) + (Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 13) + (Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6, 1) + (Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) + (Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6 - 1, 1) + (Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta6 - 1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) + (Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -1, 1) + (Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) + (Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6, 1) + (Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) + (Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6 + 1, 1) + (Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta6 + 1, Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1, 1) + sage: from sage.modular.dims import * + sage: dimension_cusp_forms(Gamma0(2007),2) + 221 + sage: dimension_eis(Gamma0(2007),2) + 7 + sage: dimension_modular_forms(Gamma0(2007),2) + 228 + sage: dimension_new_cusp_forms(Gamma0(11),12) + 8 + sage: dimension_cusp_forms(Gamma0(11),12) + 10 + sage: dimension_new_cusp_forms(Gamma0(2007),12) + 1017 + sage: dimension_cusp_forms(Gamma0(2007),12) + 2460 + sage: dimension_cusp_forms(Gamma1(2007),2) + 147409 + sage: dimension_eis(Gamma1(2007),2) + 3551 + sage: dimension_modular_forms(Gamma1(2007),2) + 150960 + sage: G = DirichletGroup(2007) + sage: e = prod(G.gens(), G(1)) + sage: dimension_cusp_forms(e,2) + 222 + sage: dimension_cusp_forms(e,3) + 0 + sage: dimension_cusp_forms(e,4) + 670 + sage: dimension_cusp_forms(e,24) + 5150 + sage: dimension_eis(e,2) + 4 + sage: dimension_eis(e,3) + 0 + sage: dimension_eis(e,4) + 4 + sage: dimension_eis(e,24) + 4 + sage: G = DirichletGroup(2007, QQ) + sage: e = prod(G.gens(), G(1)) + sage: dimension_new_cusp_forms(e,2) + 76 + sage: p = 389 + sage: k = GF(p) + sage: a = k(7/13); a + 210 + sage: a.rational_reconstruction() + 7/13 + sage: M = MatrixSpace(QQ,4,8) + sage: A = M([[-9,6,7,3,1,0,0,0],[-10,3,8,2,0,1,0,0],[3,-6,2,8,0,0,1,0],[-8,-6,-8,6,0,0,0,1]]) + sage: A41 = MatrixSpace(GF(41),4,8)(A) + sage: E41 = A41.echelon_form() + sage: B = A.matrix_from_columns([0,1,2,4]) + sage: E = B^(-1)*A + sage: B = A.matrix_from_columns([0,1,2,3]) + sage: M = ModularSymbols(Gamma0(6)); M + Modular Symbols space of dimension 3 for Gamma_0(6) + of weight 2 with sign 0 over Rational Field + sage: M.new_subspace() + Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 3 for Gamma_0(6) of weight 2 with sign 0 over Rational Field + sage: M.old_subspace() + Modular Symbols subspace of dimension 3 of Modular + Symbols space of dimension 3 for Gamma_0(6) of weight + 2 with sign 0 over Rational Field + sage: G = DirichletGroup(13) + sage: G + Group of Dirichlet characters modulo 13 with values in Cyclotomic Field of order 12 and degree 4 + sage: dimension_modular_forms(Gamma1(13),2) + 13 + sage: [dimension_modular_forms(e,2) for e in G] + [1, 0, 3, 0, 2, 0, 2, 0, 2, 0, 3, 0] + sage: G = DirichletGroup(100) + sage: G + Group of Dirichlet characters modulo 100 with values in Cyclotomic Field of order 20 and degree 8 + sage: dimension_modular_forms(Gamma1(100),2) + 370 + sage: v = [dimension_modular_forms(e,2) for e in G]; v + [24, 0, 0, 17, 18, 0, 0, 17, 18, 0, 0, 21, 18, 0, 0, 17, + 18, 0, 0, 17, 24, 0, 0, 17, 18, 0, 0, 17, 18, 0, 0, 21, + 18, 0, 0, 17, 18, 0, 0, 17] + sage: sum(v) + 370 + sage: S = CuspForms(Gamma0(45), 2, prec=14); S + Cuspidal subspace of dimension 3 of Modular Forms space + of dimension 10 for Congruence Subgroup Gamma0(45) of + weight 2 over Rational Field + sage: S.basis() + [ + q - q^4 - q^10 - 2*q^13 + O(q^14), + q^2 - q^5 - 3*q^8 + 4*q^11 + O(q^14), + q^3 - q^6 - q^9 - q^12 + O(q^14) + ] + sage: S.new_subspace().basis() + [ + q + q^2 - q^4 - q^5 - 3*q^8 - q^10 + 4*q^11 - 2*q^13 + O(q^14) + ] + sage: CuspForms(Gamma0(9),2) + Cuspidal subspace of dimension 0 of Modular Forms space + of dimension 3 for Congruence Subgroup Gamma0(9) of + weight 2 over Rational Field + sage: CuspForms(Gamma0(15),2, prec=10).basis() + [ + q - q^2 - q^3 - q^4 + q^5 + q^6 + 3*q^8 + q^9 + O(q^10) + ] """ From 24e01a2c1145730ae297cfaccf983a8404d21652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:24:53 +0200 Subject: [PATCH 317/416] rst fixes in tests --- .../article_heuberger_krenn_kropf_fsm-in-sage.py | 12 +++++++----- src/sage/tests/benchmark.py | 16 ++++++++++------ src/sage/tests/gosper-sum.py | 2 ++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py index b52523cbbde..6125930bd45 100644 --- a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +++ b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py @@ -1,5 +1,5 @@ r""" -This file contains doctests of the article +This file contains doctests of the article :: Automata and Transducers in the Computer Algebra System Sage @@ -7,10 +7,12 @@ by Clemens Heuberger, Daniel Krenn, and Sara Kropf, :arxiv:`1404.7458`. IF IT BECOMES NECESSARY TO CHANGE ANY TESTS IN THIS FILE, THERE -NEEDS TO BE A ONE-YEAR DEPRECATION PERIOD. ALSO, PLEASE INFORM - Clemens Heuberger , - Daniel Krenn , AND - Sara Kropf +NEEDS TO BE A ONE-YEAR DEPRECATION PERIOD. ALSO, PLEASE INFORM: + +- Clemens Heuberger , +- Daniel Krenn , AND +- Sara Kropf + IN THIS CASE REGARDING THE CHANGES! """ diff --git a/src/sage/tests/benchmark.py b/src/sage/tests/benchmark.py index 3612f941168..1eb66f6c28b 100644 --- a/src/sage/tests/benchmark.py +++ b/src/sage/tests/benchmark.py @@ -64,12 +64,16 @@ def run(self, systems=None, timeout=60, trials=1, sort=False, optional=False): given. INPUT: - systems -- list of strings of which systems to run tests on - if None, runs the standard systems - timeout -- how long (in seconds) to run each test for - trials -- integer, number of trials - sort -- whether to sort system names - optional -- if systems is None, whether to test optional systems + + - systems -- optional list of strings of which systems to run tests on; + if ``None``, runs the standard systems + - timeout -- optional integer (default 60); how long (in seconds) + to run each test for + - trials -- optional integer (default 1); number of trials + - sort -- optional boolean (default ``False``); whether to sort + system names + - optional -- optional boolean (default ``False``); + if systems is ``None``, whether to test optional systems EXAMPLES:: diff --git a/src/sage/tests/gosper-sum.py b/src/sage/tests/gosper-sum.py index add407f4aa7..95266ac235c 100644 --- a/src/sage/tests/gosper-sum.py +++ b/src/sage/tests/gosper-sum.py @@ -1,4 +1,6 @@ """ +Some tests about Gosper sums. + References ========== From f2b44c59183f41753d94065df5b0116a53768a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 11:57:29 +0200 Subject: [PATCH 318/416] rst fixes in rings and interacts --- src/sage/interacts/library.py | 4 +-- src/sage/rings/localization.py | 27 +++++++++---------- .../rings/number_field/number_field_ideal.py | 16 ++++++----- .../rings/padics/padic_lattice_element.py | 18 ++++++------- src/sage/rings/quotient_ring.py | 2 +- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/sage/interacts/library.py b/src/sage/interacts/library.py index a2d952526ac..8166014739d 100644 --- a/src/sage/interacts/library.py +++ b/src/sage/interacts/library.py @@ -91,8 +91,8 @@ def library_interact( INPUT: - ``**widgets`` -- keyword arguments that are passed to the - ``interact`` function to create the widgets. Each value must be a callable that - returns a widget. + ``interact`` function to create the widgets. Each value must + be a callable that returns a widget. EXAMPLES:: diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 3ffe60192e6..03dbff6cc01 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- r""" Localization -Localization is an important ring construction tool. Whenever you have to extend a given -integral domain such that it contains the inverses of a finite set of elements but should -allow non injective homomorphic images this construction will be needed. See the example -on Ariki-Koike algebras below for such an application. +Localization is an important ring construction tool. Whenever you have +to extend a given integral domain such that it contains the inverses +of a finite set of elements but should allow non injective homomorphic +images this construction will be needed. See the example on +Ariki-Koike algebras below for such an application. EXAMPLES:: @@ -32,8 +32,8 @@ sage: u = [u0, u1, u2] sage: S = Set(u) sage: I = S.cartesian_product(S) - sage: add_units = u + [q, q+1] + [ui -uj for ui, uj in I if ui != uj]\ - + [q*ui -uj for ui, uj in I if ui != uj] + sage: add_units = u + [q, q+1] + [ui -uj for ui, uj in I if ui != uj] + ....: + [q*ui -uj for ui, uj in I if ui != uj] sage: L = R.localization(tuple(add_units)); L Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, u2*q - u1, u2*q - u0, @@ -42,12 +42,12 @@ Define the representation matrices (of one of the three dimensional irreducible representations):: sage: m1 = matrix(L, [[u1, 0, 0],[0, u0, 0],[0, 0, u0]]) - sage: m2 = matrix(L, [[(u0*q - u0)/(u0 - u1), (u0*q - u1)/(u0 - u1), 0],\ - [(-u1*q + u0)/(u0 - u1), (-u1*q + u1)/(u0 - u1), 0],\ - [0, 0, -1]]) - sage: m3 = matrix(L, [[-1, 0, 0],\ - [0, u0*(1 - q)/(u1*q - u0), q*(u1 - u0)/(u1*q - u0)],\ - [0, (u1*q^2 - u0)/(u1*q - u0), (u1*q^ 2 - u1*q)/(u1*q - u0)]]) + sage: m2 = matrix(L, [[(u0*q - u0)/(u0 - u1), (u0*q - u1)/(u0 - u1), 0], + ....: [(-u1*q + u0)/(u0 - u1), (-u1*q + u1)/(u0 - u1), 0], + ....: [0, 0, -1]]) + sage: m3 = matrix(L, [[-1, 0, 0], + ....: [0, u0*(1 - q)/(u1*q - u0), q*(u1 - u0)/(u1*q - u0)], + ....: [0, (u1*q^2 - u0)/(u1*q - u0), (u1*q^ 2 - u1*q)/(u1*q - u0)]]) sage: m1.base_ring() == L True @@ -100,7 +100,6 @@ [ 0 4 5] [ 0 7 6] - Obtain specializations in characteristic 0:: sage: fQ = L.hom((3,5,7,11), codomain=QQ); fQ diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py index f785f229ef8..357cd8afe7a 100644 --- a/src/sage/rings/number_field/number_field_ideal.py +++ b/src/sage/rings/number_field/number_field_ideal.py @@ -3009,13 +3009,15 @@ def _p_quotient(self, p): computing the quotient of the ring of integers by a prime ideal. INPUT: - p -- a prime number contained in self. + + - ``p`` -- a prime number contained in ``self`` OUTPUT: - V -- a vector space of characteristic p - quo -- a partially defined quotient homomorphism from the - ambient number field to V - lift -- a section of quo. + + - ``V`` -- a vector space of characteristic ``p`` + - ``quo`` -- a partially defined quotient homomorphism from the + ambient number field to ``V`` + - ``lift`` -- a section of ``quo``. EXAMPLES:: @@ -3250,7 +3252,7 @@ def __call__(self, x): return self.__Q( list(w) ) def __repr__(self): - """ + r""" Return a string representation of this QuotientMap. EXAMPLES:: @@ -3315,7 +3317,7 @@ def __call__(self, x): return self.__OK(sum(z[i] * self.__Kgen ** i for i in range(len(z)))) def __repr__(self): - """ + r""" Return a string representation of this QuotientMap. EXAMPLES:: diff --git a/src/sage/rings/padics/padic_lattice_element.py b/src/sage/rings/padics/padic_lattice_element.py index 4cb37b7ebbf..5f679a5ea72 100644 --- a/src/sage/rings/padics/padic_lattice_element.py +++ b/src/sage/rings/padics/padic_lattice_element.py @@ -617,10 +617,10 @@ def _div_(self, other): r""" Return the quotient of this element and ``other``. - NOTE:: + .. NOTE:: - The result of division always lives in the fraction field, - even if the element to be inverted is a unit. + The result of division always lives in the fraction field, + even if the element to be inverted is a unit. EXAMPLES:: @@ -660,10 +660,10 @@ def __invert__(self): r""" Return the multiplicative inverse of this element. - NOTE:: + .. NOTE:: - The result of division always lives in the fraction field, - even if the element to be inverted is a unit. + The result of division always lives in the fraction field, + even if the element to be inverted is a unit. EXAMPLES:: @@ -1278,10 +1278,10 @@ def _is_exact_zero(self): r""" Return ``True`` if this element is exactly zero. - NOTE:: + .. NOTE:: - Since exact zeros are not supported in the precision lattice - model, this function always returns ``False``. + Since exact zeros are not supported in the precision lattice + model, this function always returns ``False``. EXAMPLES:: diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 90f177f9694..ad016bfb36e 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -15,7 +15,7 @@ sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2]) sage: S = R.quotient_ring(I) -.. todo:: +.. TODO:: The following skipped tests should be removed once :trac:`13999` is fixed:: From cf409edc1edeb438f881ffaf099593e564d01d0f Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Wed, 13 Jul 2022 11:45:16 +0100 Subject: [PATCH 319/416] update curl to 7.84 --- build/pkgs/curl/checksums.ini | 7 ++++--- build/pkgs/curl/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/pkgs/curl/checksums.ini b/build/pkgs/curl/checksums.ini index d151b9053f7..4dd30b4fc57 100644 --- a/build/pkgs/curl/checksums.ini +++ b/build/pkgs/curl/checksums.ini @@ -1,4 +1,5 @@ tarball=curl-VERSION.tar.bz2 -sha1=062a9f50723970cdbf9864781efedeef71e9d68e -md5=7adf426f80c68bbdd04d44b9bc171d61 -cksum=4255230082 +sha1=0113fe762aed27d58c4e53ce2be7a98bc7f74957 +md5=35fca80437f32dd7ef6c2e30b4916f06 +cksum=1239842454 +upstream_url=https://curl.se/download/curl-VERSION.tar.bz2 diff --git a/build/pkgs/curl/package-version.txt b/build/pkgs/curl/package-version.txt index 6ee390638e4..1ec007eaa2e 100644 --- a/build/pkgs/curl/package-version.txt +++ b/build/pkgs/curl/package-version.txt @@ -1 +1 @@ -7.62.0.p0 +7.84.0 From 783dbc3e5ff8c81a765f079aeee19a1a30b6e6c1 Mon Sep 17 00:00:00 2001 From: John Cremona Date: Wed, 13 Jul 2022 11:51:19 +0100 Subject: [PATCH 320/416] #34174: fix precision issue in scaling elliptic curves by units --- .../elliptic_curves/ell_number_field.py | 39 +++++++++++---- .../elliptic_curves/gal_reps_number_field.py | 50 +++++++++++++------ 2 files changed, 64 insertions(+), 25 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 67a89a6736c..3ad971fbccc 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -775,27 +775,44 @@ def _scale_by_units(self): sage: E1 = E.scale_curve(u^5) sage: E1._scale_by_units().ainvs() == E.ainvs() True + + TESTS: + + See :trac:`34174`. This used to raise an error due to insufficient precision:: + + sage: K. = QuadraticField(4569) + sage: j = 46969655/32768 + sage: E = EllipticCurve(j=K(j)) + sage: C = E.isogeny_class() """ K = self.base_field() r1, r2 = K.signature() if r1 + r2 == 1: # unit rank is 0 return self - prec = 1000 # lower precision works badly! - embs = K.places(prec=prec) degs = [1]*r1 + [2]*r2 fu = K.units() - from sage.matrix.all import Matrix - U = Matrix([[e(u).abs().log()*d for d,e in zip(degs,embs)] for u in fu]) - A = U*U.transpose() - Ainv = A.inverse() - c4, c6 = self.c_invariants() - c4s = [e(c4) for e in embs] - c6s = [e(c6) for e in embs] + + from sage.matrix.all import Matrix from sage.modules.free_module_element import vector - v = vector([(x4.abs().nth_root(4)+x6.abs().nth_root(6)).log()*d for x4,x6,d in zip(c4s,c6s,degs)]) - es = [e.round() for e in -Ainv*U*v] + + prec = 1000 # initial value, will be increased if necessary + ok = False + while not ok: + embs = K.places(prec=prec) + c4s = [e(c4) for e in embs] + c6s = [e(c6) for e in embs] + + U = Matrix([[e(u).abs().log()*d for d,e in zip(degs,embs)] for u in fu]) + v = vector([(x4.abs().nth_root(4)+x6.abs().nth_root(6)).log()*d for x4,x6,d in zip(c4s,c6s,degs)]) + w = -(U*U.transpose()).inverse()*U*v + try: + es = [e.round() for e in w] + ok = True + except ValueError: + prec *= 2 + u = prod([uj**ej for uj,ej in zip(fu,es)]) return self.scale_curve(u) 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 cc950676c6d..54e012a5854 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -468,7 +468,8 @@ def _non_surjective(E, patience=100): def Frobenius_filter(E, L, patience=100): - r""" Determine which primes in L might have an image contained in a + r""" + Determine which primes in L might have an image contained in a Borel subgroup, by checking of traces of Frobenius. .. NOTE:: @@ -526,7 +527,7 @@ def Frobenius_filter(E, L, patience=100): sage: [len(E.isogenies_prime_degree(l)) for l in [2,3]] [1, 1] """ - E = _over_numberfield(E) + E = _over_numberfield(E).global_integral_model() K = E.base_field() L = list(set(L)) # Remove duplicates from L and makes a copy for output @@ -1135,7 +1136,8 @@ def Billerey_P_l(E, l): INPUT: - - ``E`` -- an elliptic curve over a number field `K` + - ``E`` -- an elliptic curve over a number field `K`, given by a + global integral model. - ``l`` -- a rational prime @@ -1168,7 +1170,8 @@ def Billerey_B_l(E,l,B=0): INPUT: - - ``E`` -- an elliptic curve over a number field `K` + - ``E`` -- an elliptic curve over a number field `K`, given by a + global integral model. - ``l`` (int) -- a rational prime @@ -1208,7 +1211,8 @@ def Billerey_R_q(E, q, B=0): INPUT: - - ``E`` -- an elliptic curve over a number field `K` + - ``E`` -- an elliptic curve over a number field `K`, given by a + global integral model. - ``q`` -- a prime ideal of `K` @@ -1244,7 +1248,7 @@ def Billerey_R_q(E, q, B=0): def Billerey_B_bound(E, max_l=200, num_l=8, small_prime_bound=0, debug=False): - """ + r""" Compute Billerey's bound `B`. We compute `B_l` for `l` up to ``max_l`` (at most) until ``num_l`` @@ -1255,7 +1259,8 @@ def Billerey_B_bound(E, max_l=200, num_l=8, small_prime_bound=0, debug=False): INPUT: - - ``E`` -- an elliptic curve over a number field `K`. + - ``E`` -- an elliptic curve over a number field `K`, given by a + global integral model. - ``max_l`` (int, default 200) -- maximum size of primes l to check. @@ -1361,7 +1366,8 @@ def Billerey_R_bound(E, max_l=200, num_l=8, small_prime_bound=None, debug=False) INPUT: - - ``E`` -- an elliptic curve over a number field `K`. + - ``E`` -- an elliptic curve over a number field `K`, given by a + global integral model. - ``max_l`` (int, default 200) -- maximum size of rational primes l for which the primes q above l are checked. @@ -1509,6 +1515,18 @@ def reducible_primes_Billerey(E, num_l=None, max_l=None, verbose=False): sage: E = EllipticCurve_from_j(K(2268945/128)).global_minimal_model() # c.f. [Sut2012] sage: reducible_primes_Billerey(E) [7] + + TESTS: + + Test that this function works with non-integral models (see :trac:`34174`):: + + sage: K. = QuadraticField(4569) + sage: j = 46969655/32768 + sage: E = EllipticCurve(j=K(j)) + sage: EK = E.change_ring(K) + sage: C = EK.isogeny_class(minimal_models=False) + sage: len(C) + 4 """ #verbose=True if verbose: @@ -1522,8 +1540,12 @@ def reducible_primes_Billerey(E, num_l=None, max_l=None, verbose=False): K = E.base_field() DK = K.discriminant() - ED = E.discriminant().norm() - B0 = ZZ(6*DK*ED).prime_divisors() # TODO: only works if discriminant is integral + + # We replace E by an integral model if necessary, since this + # function and the helper functions need this: + E1 = E.global_integral_model() + ED = E1.discriminant().norm() + B0 = ZZ(6*DK*ED).prime_divisors() # Billeray's algorithm will be faster if we tell it to ignore # small primes; these can be tested using the naive algorithm. @@ -1532,16 +1554,16 @@ def reducible_primes_Billerey(E, num_l=None, max_l=None, verbose=False): print("First doing naive test of primes up to {}...".format(max_l)) max_small_prime = 200 - OK_small_primes = reducible_primes_naive(E, max_l=max_small_prime, num_P=200, verbose=verbose) + OK_small_primes = reducible_primes_naive(E1, max_l=max_small_prime, num_P=200, verbose=verbose) if verbose: print("Naive test of primes up to {} returns {}.".format(max_small_prime, OK_small_primes)) - B1 = Billerey_B_bound(E, max_l, num_l, max_small_prime, verbose) + B1 = Billerey_B_bound(E1, max_l, num_l, max_small_prime, verbose) if B1 == [0]: if verbose: print("... B_bound ineffective using max_l={}, moving on to R-bound".format(max_l)) - B1 = Billerey_R_bound(E,max_l, num_l, max_small_prime, verbose) + B1 = Billerey_R_bound(E1,max_l, num_l, max_small_prime, verbose) if B1 == [0]: if verbose: print("... R_bound ineffective using max_l={}",format(max_l)) @@ -1556,7 +1578,7 @@ def reducible_primes_Billerey(E, num_l=None, max_l=None, verbose=False): print("... combined bound = {}".format(B)) num_p = 100 - B = Frobenius_filter(E, B, num_p) + B = Frobenius_filter(E1, B, num_p) if verbose: print("... after Frobenius filter = {}".format(B)) return B From 39aa2f1ea4432291c4e5920971d6f10e175a838b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 13 Jul 2022 08:31:44 -0700 Subject: [PATCH 321/416] src/sage_setup/command/sage_install.py (sage_clean): Clean __init__.py when installed package was ordinary, source package is namespace --- src/sage_setup/command/sage_install.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sage_setup/command/sage_install.py b/src/sage_setup/command/sage_install.py index 8571b4e9813..abfc142eec4 100644 --- a/src/sage_setup/command/sage_install.py +++ b/src/sage_setup/command/sage_install.py @@ -71,9 +71,12 @@ def clean_stale_files(self): # Determine all Python modules inside all packages py_modules = [] + ordinary_packages = [] for package in dist.packages: package_dir = cmd_build_py.get_package_dir(package) - py_modules += cmd_build_py.find_package_modules(package, package_dir) + if os.path.exists(os.path.join(package_dir, '__init__.py')): + ordinary_packages.append(package) + py_modules.extend(cmd_build_py.find_package_modules(package, package_dir)) # modules is a list of triples (package, module, module_file). # Construct the complete module name from this. py_modules = ["{0}.{1}".format(*m) for m in py_modules] @@ -97,7 +100,7 @@ def clean_stale_files(self): for output_dir in set(output_dirs): log.info('- cleaning {0}'.format(output_dir)) clean_install_dir(output_dir, - dist.packages, + ordinary_packages, py_modules, dist.ext_modules, data_files, From 989217f4e353a395a47d4ba2b76ddefc956a1b83 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 13 Jul 2022 08:41:03 -0700 Subject: [PATCH 322/416] build/pkgs/setuptools: Update to 63.1.0 --- build/pkgs/setuptools/checksums.ini | 6 +++--- build/pkgs/setuptools/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini index fa27f02d052..438f06da715 100644 --- a/build/pkgs/setuptools/checksums.ini +++ b/build/pkgs/setuptools/checksums.ini @@ -1,5 +1,5 @@ tarball=setuptools-VERSION.tar.gz -sha1=6857985d72c5b23fc37eaa9f254e8d66c2ead0ad -md5=cfa521312f6ac49b2fda5640df4f8f6d -cksum=4003835603 +sha1=7d014e537ac0b131bb2fda74c5bdffbe07aaf09e +md5=238035bd51bcb90131af33a5467ccb74 +cksum=193190829 upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt index 3f9b36de511..c3998b266a0 100644 --- a/build/pkgs/setuptools/package-version.txt +++ b/build/pkgs/setuptools/package-version.txt @@ -1 +1 @@ -62.6.0 +63.1.0 From 5da5e1f7accc63c293aecee678a7d3f969638c30 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Wed, 13 Jul 2022 11:15:37 -0700 Subject: [PATCH 323/416] trac 34172: ignore misc/sagedoc.py when using flake8 to check rst markup --- src/tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tox.ini b/src/tox.ini index 7eb626858ab..f2d6b601e05 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -214,6 +214,8 @@ rst-directives = extend-ignore = # Ignore RST306 Unknown target name -- because of references to the global bibliography RST306 +exclude = + sage/misc/sagedoc.py [pytest] python_files = *_test.py From 80d7f8f4047c999758a141ae2cea777c27d776f0 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Wed, 13 Jul 2022 13:13:43 -0700 Subject: [PATCH 324/416] trac 34168: more markup fixes for categories --- src/sage/categories/fields.py | 2 +- src/sage/categories/hecke_modules.py | 4 ++-- src/sage/categories/integral_domains.py | 2 +- src/sage/categories/rings.py | 6 +++--- src/sage/categories/unique_factorization_domains.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/categories/fields.py b/src/sage/categories/fields.py index 3dad6f9946d..0ea91e393ff 100644 --- a/src/sage/categories/fields.py +++ b/src/sage/categories/fields.py @@ -76,7 +76,7 @@ def __contains__(self, x): This implementation will not be needed anymore once every field in Sage will be properly declared in the category - :class:`Fields`. + :class:`Fields() `. Caveat: this should eventually be fixed:: diff --git a/src/sage/categories/hecke_modules.py b/src/sage/categories/hecke_modules.py index 06dcb99687d..aa2ce2aea7b 100644 --- a/src/sage/categories/hecke_modules.py +++ b/src/sage/categories/hecke_modules.py @@ -109,7 +109,8 @@ def _Hom_(self, Y, category): INPUT: - ``Y`` -- an Hecke module - - ``category`` -- a subcategory of :class:`HeckeModules` or None + - ``category`` -- a subcategory of :class:`HeckeModules() + ` or ``None`` The sole purpose of this method is to construct the homset as a :class:`~sage.modular.hecke.homspace.HeckeModuleHomspace`. If @@ -143,7 +144,6 @@ def _Hom_(self, Y, category): Traceback (most recent call last): ... TypeError: Category of Hecke modules over Finite Field of size 5 is not a subcategory of Category of Hecke modules over Rational Field - """ # TODO: double check that it's the correct HeckeModules category below: if category is not None and not category.is_subcategory(HeckeModules(self.base_ring())): diff --git a/src/sage/categories/integral_domains.py b/src/sage/categories/integral_domains.py index 4f80ea1b5bf..9daa68ff25e 100644 --- a/src/sage/categories/integral_domains.py +++ b/src/sage/categories/integral_domains.py @@ -58,7 +58,7 @@ def __contains__(self, x): This implementation will not be needed anymore once every field in Sage will be properly declared in the category - :class:`IntegralDomains`. + :class:`IntegralDomains() `. """ try: return self._contains_helper(x) or x.is_integral_domain() diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index c41d1f4d8d8..efac793478e 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -386,12 +386,13 @@ def _Hom_(self, Y, category): INPUT: - ``Y`` -- a ring - - ``category`` -- a subcategory of :class:`Rings` or None + - ``category`` -- a subcategory of :class:`Rings() + ` or ``None`` The sole purpose of this method is to construct the homset as a :class:`~sage.rings.homset.RingHomset`. If ``category`` is specified and is not a subcategory of - :class:`Rings`, a ``TypeError`` is raised instead + :class:`Rings() `, a ``TypeError`` is raised instead This method is not meant to be called directly. Please use :func:`sage.categories.homset.Hom` instead. @@ -412,7 +413,6 @@ def _Hom_(self, Y, category): sage: TestSuite(Hom(QQ, QQ, category = Rings())).run() # indirect doctest - """ if category is not None and not category.is_subcategory(Rings()): raise TypeError("%s is not a subcategory of Rings()"%category) diff --git a/src/sage/categories/unique_factorization_domains.py b/src/sage/categories/unique_factorization_domains.py index 3d0f4598fa9..49a41b97098 100644 --- a/src/sage/categories/unique_factorization_domains.py +++ b/src/sage/categories/unique_factorization_domains.py @@ -74,7 +74,7 @@ def __contains__(self, x): This implementation will not be needed anymore once every field in Sage will be properly declared in the category - :class:`UniqueFactorizationDomains`. + :class:`UniqueFactorizationDomains() `. """ try: return self._contains_helper(x) or x.is_unique_factorization_domain() From b531034fb9fec3db0b82cb4db00f2be57eae41c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 13 Jul 2022 10:54:22 +0200 Subject: [PATCH 325/416] rst fixes in manifolds --- src/sage/manifolds/chart.py | 2 +- src/sage/manifolds/differentiable/degenerate_submanifold.py | 4 ++-- src/sage/manifolds/differentiable/integrated_curve.py | 2 +- src/sage/manifolds/differentiable/manifold.py | 4 ++-- src/sage/manifolds/manifold.py | 4 ++-- src/sage/manifolds/subset.py | 2 +- src/sage/manifolds/topological_submanifold.py | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py index e5f7ad47a46..b109b634d93 100644 --- a/src/sage/manifolds/chart.py +++ b/src/sage/manifolds/chart.py @@ -477,7 +477,7 @@ def _normalize_coord_restrictions(coordinates, coord_restrictions): r""" Rewrite ``coord_restrictions`` as a ``frozenset``, representing a logical "and", of other clauses. - Also replace ``list``s by ``frozenset``s, making the result hashable. + Also replace ``list`` by ``frozenset`` , making the result hashable. EXAMPLES:: diff --git a/src/sage/manifolds/differentiable/degenerate_submanifold.py b/src/sage/manifolds/differentiable/degenerate_submanifold.py index a29b9b0ee8d..1a8db5f8aa9 100644 --- a/src/sage/manifolds/differentiable/degenerate_submanifold.py +++ b/src/sage/manifolds/differentiable/degenerate_submanifold.py @@ -697,9 +697,9 @@ def _ambient_decomposition(self, screen=None): spanning the transversal normal distribution, the 4th one being a list of independent riggings in `Rig(T\Sigma)` according to the decomposition - .. MATH:: + .. MATH:: - TM_{|\Sigma}=S(T\Sigma)\oplus_{orth}((Rad(T\Sigma)\oplus_{orth}( + TM_{|\Sigma}=S(T\Sigma)\oplus_{orth}((Rad(T\Sigma)\oplus_{orth}( T\sigma^\perp\cap tr(TM))\oplus Rig(T\Sigma)) EXAMPLES: diff --git a/src/sage/manifolds/differentiable/integrated_curve.py b/src/sage/manifolds/differentiable/integrated_curve.py index b972b26c8eb..8b62aab4f39 100644 --- a/src/sage/manifolds/differentiable/integrated_curve.py +++ b/src/sage/manifolds/differentiable/integrated_curve.py @@ -2111,7 +2111,7 @@ def __call__(self, t, interpolation_key=None, INPUT: - - ``t'' -- curve parameter value at which the curve is evaluated + - ``t`` -- curve parameter value at which the curve is evaluated - ``interpolation_key`` -- (default: ``None``) key which the interpolation requested to compute the point is associated to; a default value is chosen if none is provided diff --git a/src/sage/manifolds/differentiable/manifold.py b/src/sage/manifolds/differentiable/manifold.py index 14af055aee5..d5e0ebc6200 100644 --- a/src/sage/manifolds/differentiable/manifold.py +++ b/src/sage/manifolds/differentiable/manifold.py @@ -852,10 +852,10 @@ def _init_open_subset(self, resu, coord_def): INPUT: - - ``resu`` -- an instance of ``:class:`TopologicalManifold` or + - ``resu`` -- an instance of :class:`TopologicalManifold` or a subclass. - - ``coord_def`` -- (default: {}) definition of the subset in + - ``coord_def`` -- (default: ``{}``) definition of the subset in terms of coordinates; ``coord_def`` must a be dictionary with keys charts on the manifold and values the symbolic expressions formed by the coordinates to define the subset diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py index cdc289467f8..09b040fb3fc 100644 --- a/src/sage/manifolds/manifold.py +++ b/src/sage/manifolds/manifold.py @@ -904,10 +904,10 @@ def _init_open_subset(self, resu, coord_def): INPUT: - - ``resu`` -- an instance of ``:class:`TopologicalManifold` or + - ``resu`` -- an instance of :class:`TopologicalManifold` or a subclass. - - ``coord_def`` -- (default: {}) definition of the subset in + - ``coord_def`` -- (default: ``{}``) definition of the subset in terms of coordinates; ``coord_def`` must a be dictionary with keys charts on the manifold and values the symbolic expressions formed by the coordinates to define the subset diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py index 9e5c12d4cc7..43fc76a95d6 100644 --- a/src/sage/manifolds/subset.py +++ b/src/sage/manifolds/subset.py @@ -2067,7 +2067,7 @@ def _init_open_subset(self, resu, coord_def): INPUT: - - ``resu`` -- an instance of ``:class:`TopologicalManifold` or + - ``resu`` -- an instance of :class:`TopologicalManifold` or a subclass. - ``coord_def`` -- (default: {}) definition of the subset in diff --git a/src/sage/manifolds/topological_submanifold.py b/src/sage/manifolds/topological_submanifold.py index 91f6f0d6062..828b97703f5 100644 --- a/src/sage/manifolds/topological_submanifold.py +++ b/src/sage/manifolds/topological_submanifold.py @@ -344,15 +344,15 @@ def _init_open_subset(self, resu, coord_def): INPUT: - - ``resu`` -- an instance of ``:class:`TopologicalManifold` or + - ``resu`` -- an instance of :class:`TopologicalManifold` or a subclass. - - ``coord_def`` -- (default: {}) definition of the subset in + - ``coord_def`` -- (default: ``{}``) definition of the subset in terms of coordinates; ``coord_def`` must a be dictionary with keys charts on the manifold and values the symbolic expressions formed by the coordinates to define the subset - EXAMPLES: + EXAMPLES:: sage: M = Manifold(3, 'M', structure="topological") sage: N = Manifold(2, 'N', ambient=M, structure="topological") From 82e1b52a5fa5d3ccca259da43723d979a6d63fd2 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Thu, 14 Jul 2022 09:16:38 +0100 Subject: [PATCH 326/416] use --with-openssl unconditionally --- build/pkgs/curl/dependencies | 3 +-- build/pkgs/curl/spkg-install.in | 10 +--------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/build/pkgs/curl/dependencies b/build/pkgs/curl/dependencies index 4f00de20375..a16ee9adce1 100644 --- a/build/pkgs/curl/dependencies +++ b/build/pkgs/curl/dependencies @@ -1,4 +1,3 @@ -# no dependencies - +openssl ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/curl/spkg-install.in b/build/pkgs/curl/spkg-install.in index bc09f074780..a697d0b1cf8 100644 --- a/build/pkgs/curl/spkg-install.in +++ b/build/pkgs/curl/spkg-install.in @@ -1,4 +1,5 @@ cd src +CURL_CONFIGURE="--with-openssl $CURL_CONFIGURE" if [ "$SAGE_FAT_BINARY" = yes ]; then # Let's disable a bunch of stuff which might get linked. @@ -6,15 +7,6 @@ if [ "$SAGE_FAT_BINARY" = yes ]; then CURL_CONFIGURE="--disable-ldap --disable-ldaps --disable-rtsp --disable-ares --disable-crypto-auth --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-libidn --without-nghttp2 --without-gssapi $CURL_CONFIGURE" fi -if [ "$UNAME" = "Darwin" ]; then - if [ $MACOSX_VERSION -ge 16 ]; then - echo "OS X 10.$[$MACOSX_VERSION-4] Building with clang and --with-darwinssl." - CC=clang - export CFLAGS="$CFLAGS_NON_NATIVE" - CURL_CONFIGURE="--with-darwinssl $CURL_CONFIGURE" - fi -fi - sdh_configure $CURL_CONFIGURE sdh_make sdh_make_install From d60fa1865a2f2ba5908d52ad995c122b8d8732b9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 14 Jul 2022 09:43:38 -0700 Subject: [PATCH 327/416] build/pkgs/setuptools: Update to 63.2.0 --- build/pkgs/setuptools/checksums.ini | 6 +++--- build/pkgs/setuptools/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini index 438f06da715..8a9faad33ca 100644 --- a/build/pkgs/setuptools/checksums.ini +++ b/build/pkgs/setuptools/checksums.ini @@ -1,5 +1,5 @@ tarball=setuptools-VERSION.tar.gz -sha1=7d014e537ac0b131bb2fda74c5bdffbe07aaf09e -md5=238035bd51bcb90131af33a5467ccb74 -cksum=193190829 +sha1=2a5a4ac384ace22dd10e3dac0a1b6af49e03c596 +md5=d72acb93671bde8e4ca0971866f9cdda +cksum=2262493785 upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt index c3998b266a0..61f1f83a084 100644 --- a/build/pkgs/setuptools/package-version.txt +++ b/build/pkgs/setuptools/package-version.txt @@ -1 +1 @@ -63.1.0 +63.2.0 From 4950d2bb19bbecd0311e1317e46ed4a1f1955156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Thu, 14 Jul 2022 20:18:49 +0200 Subject: [PATCH 328/416] fix one detail --- src/sage/rings/localization.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/localization.py b/src/sage/rings/localization.py index 03dbff6cc01..55f3e215ed4 100644 --- a/src/sage/rings/localization.py +++ b/src/sage/rings/localization.py @@ -32,8 +32,8 @@ sage: u = [u0, u1, u2] sage: S = Set(u) sage: I = S.cartesian_product(S) - sage: add_units = u + [q, q+1] + [ui -uj for ui, uj in I if ui != uj] - ....: + [q*ui -uj for ui, uj in I if ui != uj] + sage: add_units = u + [q, q + 1] + [ui - uj for ui, uj in I if ui != uj] + sage: add_units += [q*ui - uj for ui, uj in I if ui != uj] sage: L = R.localization(tuple(add_units)); L Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, u2*q - u1, u2*q - u0, From 7336e9d1513009d36f64734f4137808dfe84e5fb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 15 Jul 2022 08:36:59 -0700 Subject: [PATCH 329/416] build/pkgs/sagelib/spkg-install: Remove installed sage/__init__.py --- build/pkgs/sagelib/spkg-install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/pkgs/sagelib/spkg-install b/build/pkgs/sagelib/spkg-install index 4ae18e5a42f..c4e59541d4d 100755 --- a/build/pkgs/sagelib/spkg-install +++ b/build/pkgs/sagelib/spkg-install @@ -38,6 +38,7 @@ export SAGE_SHARE=/doesnotexist # export SAGE_DOC=/doesnotexist SITEPACKAGESDIR=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') + if [ "$SAGE_EDITABLE" = yes ]; then # In an incremental build, we may need to uninstall old versions installed by distutils # under the old distribution name "sage" (before #30912, which switched to setuptools @@ -46,6 +47,9 @@ if [ "$SAGE_EDITABLE" = yes ]; then (cd "$SITEPACKAGESDIR" && rm -rf sage sage_setup sage-[1-9]*.egg-info sage-[1-9]*.dist-info) time python3 -m pip install --verbose --no-deps --no-index --no-build-isolation --isolated --editable . || exit 1 else + # Make sure that an installed old version of sagelib in which sage is an ordinary package + # does not shadow the namespace package sage during the build. + (cd "$SITEPACKAGESDIR" && rm -f sage/__init__.py) # Likewise, we should remove the egg-link that may have been installed previously. (cd "$SITEPACKAGESDIR" && rm -f sagemath-standard.egg-link) time python3 -u setup.py --no-user-cfg build install || exit 1 From f447a11cd0b3aad3b5b638902a345a92c7723380 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 15 Jul 2022 08:37:10 -0700 Subject: [PATCH 330/416] src/sage/__init__.py: Remove --- src/sage/__init__.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/sage/__init__.py diff --git a/src/sage/__init__.py b/src/sage/__init__.py deleted file mode 100644 index 6ea8b846de3..00000000000 --- a/src/sage/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -# Do not add anything to this file. -# It will be removed soon in order to turn 'sage' into a native namespace package. -# See https://trac.sagemath.org/ticket/29705 - - - -# Deprecated leftover of monkey-patching inspect.isfunction() to support Cython functions. -# We cannot use lazy_import for the deprecation here. -def isfunction(obj): - """ - Check whether something is a function. - - This is a variant of ``inspect.isfunction``: - We assume that anything which has a genuine ``__code__`` - attribute (not using ``__getattr__`` overrides) is a function. - This is meant to support Cython functions. - - This function is deprecated. Most uses of ``isfunction`` - can be replaced by ``callable``. - - EXAMPLES:: - - sage: from sage import isfunction - sage: def f(): pass - sage: isfunction(f) - doctest:warning... - DeprecationWarning: sage.isfunction is deprecated; use callable or sage.misc.sageinspect.is_function_or_cython_function instead - See https://trac.sagemath.org/32479 for details. - True - """ - from sage.misc.superseded import deprecation - deprecation(32479, "sage.isfunction is deprecated; use callable or sage.misc.sageinspect.is_function_or_cython_function instead") - from sage.misc.sageinspect import is_function_or_cython_function - return is_function_or_cython_function(obj) From 01f914312302f1ca01aa90a4438e1eb51fdbc239 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 15 Jul 2022 09:29:13 -0700 Subject: [PATCH 331/416] src/sage_setup: Fix for namespace package sage --- src/sage_setup/find.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sage_setup/find.py b/src/sage_setup/find.py index 28467135c12..5cec2c4ee44 100644 --- a/src/sage_setup/find.py +++ b/src/sage_setup/find.py @@ -274,8 +274,9 @@ def _cythonized_dir(src_dir=None, editable_install=None): if src_dir is None: src_dir = SAGE_SRC src_dir = Path(src_dir) - sage = import_module('sage') - d = Path(sage.__file__).resolve().parent.parent + # sage.cpython is an ordinary package, so it has __file__ + sage_cpython = import_module('sage.cpython') + d = Path(sage_cpython.__file__).resolve().parent.parent.parent editable_install = d == src_dir.resolve() if editable_install: # Editable install: Cython generates files in the source tree @@ -390,7 +391,7 @@ def installed_files_by_module(site_packages, modules=('sage',)): EXAMPLES:: - sage: site_packages = os.path.dirname(os.path.dirname(sage.__file__)) + sage: site_packages = os.path.dirname(os.path.dirname(os.path.dirname(sage.cpython.__file__))) sage: from sage_setup.find import installed_files_by_module sage: files_by_module = installed_files_by_module(site_packages) sage: (f,) = files_by_module['sage.structure.sage_object']; f From 9627219b021d4f23ef044091dc7e8115da6dfafe Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 15 Jul 2022 09:34:28 -0700 Subject: [PATCH 332/416] src/sage/misc/edit_module.py: Update doctest --- src/sage/misc/edit_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/misc/edit_module.py b/src/sage/misc/edit_module.py index 634af340d88..5c1dfa6d7ae 100644 --- a/src/sage/misc/edit_module.py +++ b/src/sage/misc/edit_module.py @@ -75,8 +75,8 @@ def file_and_line(obj): EXAMPLES:: sage: import sage.misc.edit_module as edit_module - sage: edit_module.file_and_line(sage) - ('...sage/__init__.py', 0) + sage: edit_module.file_and_line(sage.cpython) + ('...sage/cpython/__init__.py', 0) The following tests against a bug that was fixed in :trac:`11298`:: From e884c9efe7c88d07c76e3614d68a647a5d0053cf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 15 Jul 2022 09:39:47 -0700 Subject: [PATCH 333/416] src/sage/misc/sageinspect.py: Update doctest --- src/sage/misc/sageinspect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 13f0fc1bec3..9d0c255aff5 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -2599,7 +2599,8 @@ def __internal_tests(): sage: sage_getdoc(None) '' - sage: sage_getsource(sage) + sage: import sage.all__sagemath_objects + sage: sage_getsource(sage.all__sagemath_objects) '...all...' A cython function with default arguments (one of which is a string):: From 18b9c1816e22cbe95fd7545e1e3bf29db038cda3 Mon Sep 17 00:00:00 2001 From: Peter Morawitz Date: Wed, 3 Mar 2021 15:39:29 -0500 Subject: [PATCH 334/416] improved longest increasing subsequences function --- src/sage/combinat/permutation.py | 66 ++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index a38eaa71079..5803330ebed 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2205,12 +2205,16 @@ def longest_increasing_subsequence_length(self) -> Integer: def longest_increasing_subsequences(self): r""" - Return the list of the longest increasing subsequences of ``self``. - - .. NOTE:: - - The algorithm is not optimal. - + Return the list of the longest increasing subsequences of ``self`` + + A theorem of Schensted ([Sch1961]) states that an increasing + subsequence of length `i` ends with the value entered in the `i`-th + column of the p-tableau. The algorithm records which column of the + p-tableau each value of the permutation is entered into, and + computes all possible combinations of one entry from each column. + The algorithm then checks if the combination is an increasing + sequence. + EXAMPLES:: sage: Permutation([2,3,4,1]).longest_increasing_subsequences() @@ -2218,8 +2222,54 @@ def longest_increasing_subsequences(self): sage: Permutation([5, 7, 1, 2, 6, 4, 3]).longest_increasing_subsequences() [[1, 2, 6], [1, 2, 4], [1, 2, 3]] """ - patt = list(range(1,self.longest_increasing_subsequence_length()+1)) - return [[self[i] for i in m] for m in self.pattern_positions(patt)] + + def is_subsequence_of(seq, self): + r""" + Returns whether seq1 is a subsequence of permutation ``self`` + """ + + j = 0 + while j < len(seq)-1: + if self.index(seq[j]) < self.index(seq[j+1]): + j = j+1 + else: + return False + return True + + + n = self.size() + + # getting the column in which each element is inserted + first_row_p_tableau = [] + column = [] + for i in range(n): + inserted = False + j = 0 # j is j-th column of p-tableau + while j < len(first_row_p_tableau) and not inserted: + if first_row_p_tableau[j] > self[i]: + first_row_p_tableau[j] = self[i] + column.append(j) + inserted = True + j = j+1 + if not inserted: + first_row_p_tableau.append(self[i]) + column.append(j) + + # getting the sets for columns + s = [[] for i in range(len(first_row_p_tableau))] + for i in range(n): + s[column[i]].append(self[i]) + increasing_sequences = [] + + # getting the increasing sequences + import itertools + potential_sequences = list(itertools.product(*s)) + for seq in potential_sequences: + seq = list(seq) + if seq == sorted(seq) and is_subsequence_of(seq, self): + increasing_sequences.append(seq) + return increasing_sequences + def cycle_type(self): r""" From 5b4a2dac5559ffbc80563c24fba5081b90095dd3 Mon Sep 17 00:00:00 2001 From: Peter Morawitz Date: Wed, 3 Mar 2021 16:14:46 -0500 Subject: [PATCH 335/416] Added reference --- src/doc/en/reference/references/index.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 33d876d08eb..30c3f830138 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -5127,6 +5127,10 @@ REFERENCES: .. [Sam2012] \P. Samanta: *Antipodal Graphs* :doi:`10.13140/RG.2.2.28238.46409` +.. [Sch1961] Craige Schensted. *Longest increasing and decreasing + subsequences*, Canadian Journal of Mathematics, Vol 13 + (1961), pp. 179--191. + .. [Sch1990] Schnyder, Walter. *Embedding Planar Graphs on the Grid*. Proc. 1st Annual ACM-SIAM Symposium on Discrete Algorithms, San Francisco (1994), pp. 138-147. From 0d23fada91c5c1cd22104f12562da40716100f5a Mon Sep 17 00:00:00 2001 From: Peter Morawitz Date: Sun, 14 Mar 2021 21:02:57 -0700 Subject: [PATCH 336/416] tscrim edits --- src/sage/combinat/permutation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 5803330ebed..f7320c83a85 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2207,7 +2207,7 @@ def longest_increasing_subsequences(self): r""" Return the list of the longest increasing subsequences of ``self`` - A theorem of Schensted ([Sch1961]) states that an increasing + A theorem of Schensted ([Sch1961_]) states that an increasing subsequence of length `i` ends with the value entered in the `i`-th column of the p-tableau. The algorithm records which column of the p-tableau each value of the permutation is entered into, and @@ -2225,7 +2225,7 @@ def longest_increasing_subsequences(self): def is_subsequence_of(seq, self): r""" - Returns whether seq1 is a subsequence of permutation ``self`` + Returns whether seq is a subsequence of permutation ``self`` """ j = 0 @@ -2250,7 +2250,7 @@ def is_subsequence_of(seq, self): first_row_p_tableau[j] = self[i] column.append(j) inserted = True - j = j+1 + j += 1 if not inserted: first_row_p_tableau.append(self[i]) column.append(j) @@ -2263,8 +2263,7 @@ def is_subsequence_of(seq, self): # getting the increasing sequences import itertools - potential_sequences = list(itertools.product(*s)) - for seq in potential_sequences: + for seq in itertools.product(*s): seq = list(seq) if seq == sorted(seq) and is_subsequence_of(seq, self): increasing_sequences.append(seq) From 944ba38991edca81a5fcc73b13ab861b9fa54945 Mon Sep 17 00:00:00 2001 From: Peter Morawitz Date: Wed, 17 Mar 2021 10:36:35 -0700 Subject: [PATCH 337/416] [Sch1961]_ --- 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 f7320c83a85..243838c6b52 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2207,7 +2207,7 @@ def longest_increasing_subsequences(self): r""" Return the list of the longest increasing subsequences of ``self`` - A theorem of Schensted ([Sch1961_]) states that an increasing + A theorem of Schensted ([Sch1961]_) states that an increasing subsequence of length `i` ends with the value entered in the `i`-th column of the p-tableau. The algorithm records which column of the p-tableau each value of the permutation is entered into, and From bf213ab5762e8acf45c2a825512f07fb013d9e9b Mon Sep 17 00:00:00 2001 From: Peter Morawitz Date: Wed, 17 Mar 2021 10:39:59 -0700 Subject: [PATCH 338/416] Tab in references --- src/doc/en/reference/references/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 30c3f830138..e0bd787ff2b 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -5128,8 +5128,8 @@ REFERENCES: :doi:`10.13140/RG.2.2.28238.46409` .. [Sch1961] Craige Schensted. *Longest increasing and decreasing - subsequences*, Canadian Journal of Mathematics, Vol 13 - (1961), pp. 179--191. + subsequences*, Canadian Journal of Mathematics, Vol 13 + (1961), pp. 179--191. .. [Sch1990] Schnyder, Walter. *Embedding Planar Graphs on the Grid*. Proc. 1st Annual ACM-SIAM Symposium on Discrete Algorithms, From 98030ff0691b5a1d740421debfc73e70a40f69d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadia=20Lafreni=C3=A8re?= Date: Thu, 14 Jul 2022 16:06:50 -0400 Subject: [PATCH 339/416] Implementation of digraph strategy for Longest Increasing Subsequences --- src/sage/combinat/permutation.py | 59 ++++++++++++++------------------ 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 243838c6b52..ad62457f5ec 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2210,10 +2210,10 @@ def longest_increasing_subsequences(self): A theorem of Schensted ([Sch1961]_) states that an increasing subsequence of length `i` ends with the value entered in the `i`-th column of the p-tableau. The algorithm records which column of the - p-tableau each value of the permutation is entered into, and - computes all possible combinations of one entry from each column. - The algorithm then checks if the combination is an increasing - sequence. + p-tableau each value of the permutation is entered into, creates a + digraph to record all increasing subsequences, and reads the paths + from a source to a sink; these are the longest increasing subsequences. + EXAMPLES:: @@ -2222,51 +2222,44 @@ def longest_increasing_subsequences(self): sage: Permutation([5, 7, 1, 2, 6, 4, 3]).longest_increasing_subsequences() [[1, 2, 6], [1, 2, 4], [1, 2, 3]] """ - - def is_subsequence_of(seq, self): - r""" - Returns whether seq is a subsequence of permutation ``self`` - """ - - j = 0 - while j < len(seq)-1: - if self.index(seq[j]) < self.index(seq[j+1]): - j = j+1 - else: - return False - return True - - n = self.size() # getting the column in which each element is inserted first_row_p_tableau = [] - column = [] + columns = [[] for _ in range(self.longest_increasing_subsequence_length())] + D = DiGraph(n+2) for i in range(n): inserted = False j = 0 # j is j-th column of p-tableau while j < len(first_row_p_tableau) and not inserted: if first_row_p_tableau[j] > self[i]: first_row_p_tableau[j] = self[i] - column.append(j) + columns[j].append(self[i]) + for k in columns[j-1]: + if k < self[i]: + D.add_edge(k, self[i]) inserted = True j += 1 if not inserted: first_row_p_tableau.append(self[i]) - column.append(j) - - # getting the sets for columns - s = [[] for i in range(len(first_row_p_tableau))] - for i in range(n): - s[column[i]].append(self[i]) + columns[j].append(self[i]) + for k in columns[j-1]: + if k < self[i]: + D.add_edge(k, self[i]) + increasing_sequences = [] - # getting the increasing sequences - import itertools - for seq in itertools.product(*s): - seq = list(seq) - if seq == sorted(seq) and is_subsequence_of(seq, self): - increasing_sequences.append(seq) + for i in columns[0]: + D.add_edge(0, i) # 0 is source + for i in columns[-1]: + D.add_edge(i, n+1) # n+1 is sink + + for p in D.all_paths(0, n+1): + increasing_sequences.append(p[1:-1]) + + increasing_sequences.sort() + increasing_sequences.reverse() + return increasing_sequences From 8d1c1d6d8e39875c22299ec1912752db0e9332b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadia=20Lafreni=C3=A8re?= Date: Thu, 14 Jul 2022 16:29:33 -0400 Subject: [PATCH 340/416] Fixing a bug with n=0 for longest increasing subsequences --- src/sage/combinat/permutation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index ad62457f5ec..58954ec39a6 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2223,7 +2223,9 @@ def longest_increasing_subsequences(self): [[1, 2, 6], [1, 2, 4], [1, 2, 3]] """ n = self.size() - + if n == 0: + return([[]]) + # getting the column in which each element is inserted first_row_p_tableau = [] columns = [[] for _ in range(self.longest_increasing_subsequence_length())] @@ -2247,7 +2249,7 @@ def longest_increasing_subsequences(self): if k < self[i]: D.add_edge(k, self[i]) - increasing_sequences = [] + increasing_subsequences = [] for i in columns[0]: D.add_edge(0, i) # 0 is source @@ -2255,12 +2257,12 @@ def longest_increasing_subsequences(self): D.add_edge(i, n+1) # n+1 is sink for p in D.all_paths(0, n+1): - increasing_sequences.append(p[1:-1]) + increasing_subsequences.append(p[1:-1]) - increasing_sequences.sort() - increasing_sequences.reverse() + increasing_subsequences.sort() + increasing_subsequences.reverse() - return increasing_sequences + return increasing_subsequences def cycle_type(self): From 7a0ff3f91909d6ca2645497a6af856093650b515 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 08:14:42 -0700 Subject: [PATCH 341/416] src/sage/all.py: Restore sage.isfunction as a LazyImport --- src/sage/all.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sage/all.py b/src/sage/all.py index 8c2514ecd96..a1a740a0018 100644 --- a/src/sage/all.py +++ b/src/sage/all.py @@ -274,6 +274,11 @@ def quit_sage(verbose=True): # sys.settrace(poison_currRing) +# Deprecated leftover of monkey-patching inspect.isfunction() to support Cython functions. +lazy_import('sage.misc.sageinspect', 'is_function_or_cython_function', + as_='isfunction', namespace=sage.__dict__, deprecation=32479) + + # Set a new random number seed as the very last thing # (so that printing initial_seed() and using that seed # in set_random_seed() will result in the same sequence you got at From 8431c6c2568d3bc49a63c3f1bb2dde4c0fee7e3d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 09:00:32 -0700 Subject: [PATCH 342/416] src/sage/rings: Remove imports from sage.rings.all --- src/sage/rings/asymptotic/asymptotic_ring.py | 2 +- src/sage/rings/asymptotic/misc.py | 7 ++++++- src/sage/rings/complex_arb.pyx | 4 +++- src/sage/rings/finite_rings/residue_field.pyx | 4 +++- src/sage/rings/fraction_field.py | 2 +- .../rings/function_field/function_field.py | 2 +- src/sage/rings/number_field/S_unit_solver.py | 6 +++--- src/sage/rings/number_field/bdd_height.py | 3 ++- src/sage/rings/number_field/class_group.py | 2 +- src/sage/rings/number_field/number_field.py | 19 +++++++++++-------- .../rings/number_field/number_field_ideal.py | 2 +- src/sage/rings/number_field/order.py | 6 ++++-- .../rings/padics/padic_ZZ_pX_CA_element.pyx | 2 +- .../rings/padics/padic_ZZ_pX_FM_element.pyx | 2 +- src/sage/rings/padics/padic_valuation.py | 2 +- src/sage/rings/polynomial/polynomial_gf2x.pyx | 2 +- .../polynomial/polynomial_modn_dense_ntl.pyx | 2 +- src/sage/rings/polynomial/real_roots.pyx | 9 ++++++--- src/sage/rings/qqbar.py | 6 +++--- src/sage/rings/real_double.pyx | 5 +++-- 20 files changed, 54 insertions(+), 35 deletions(-) diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index 64a35142397..ed8504ebc95 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -419,7 +419,7 @@ from sage.structure.unique_representation import UniqueRepresentation from sage.misc.defaults import series_precision import sage.rings.abc -from sage.rings.all import RIF +from sage.rings.real_mpfi import RIF from .misc import WithLocals diff --git a/src/sage/rings/asymptotic/misc.py b/src/sage/rings/asymptotic/misc.py index f639cfbdeed..33388f9f183 100644 --- a/src/sage/rings/asymptotic/misc.py +++ b/src/sage/rings/asymptotic/misc.py @@ -141,9 +141,14 @@ def parent_to_repr_short(P): sage: parent_to_repr_short(Zmod(3)['g']) 'Univariate Polynomial Ring in g over Ring of integers modulo 3' """ - from sage.rings.all import RR, CC, RIF, CIF, RBF, CBF + from sage.rings.cc import CC + from sage.rings.cif import CIF + from sage.rings.complex_arb import CBF from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ + from sage.rings.real_arb import RBF + from sage.rings.real_mpfi import RIF + from sage.rings.real_mpfr import RR from sage.symbolic.ring import SR from sage.rings.polynomial.polynomial_ring import is_PolynomialRing from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 07dad97e48e..3919e90b5f2 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -567,7 +567,9 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): emb = other.coerce_embedding() return emb is not None and self.has_coerce_map_from(emb.codomain()) - from sage.rings.all import QQ, AA, QQbar, RLF, CLF + from sage.rings.qqbar import AA, QQbar + from sage.rings.real_lazy import RLF, CLF + if other in [AA, QQbar, RLF, CLF]: return True diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx index ec0b8f432cc..7596f2a3028 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -151,7 +151,9 @@ from sage.rings.rational cimport Rational from sage.categories.homset import Hom from sage.categories.basic import Fields, Rings from sage.categories.pushout import AlgebraicExtensionFunctor -from sage.rings.all import ZZ, QQ, Integers +from sage.rings.finite_rings.integer_mod_ring import Integers +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ from sage.rings.finite_rings.finite_field_constructor import zech_log_bound, FiniteField as GF from sage.rings.finite_rings.finite_field_givaro import FiniteField_givaro from sage.rings.finite_rings.finite_field_ntl_gf2e import FiniteField_ntl_gf2e diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index eba5c22d8bf..0ba0f233a91 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -1036,7 +1036,7 @@ def function_field(self): :meth:`sage.rings.function_field.RationalFunctionField.field` """ - from sage.rings.all import FunctionField + from sage.rings.function_field.constructor import FunctionField return FunctionField(self.base_ring(), names=self.variable_name()) def _coerce_map_from_(self, R): diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 39b04c3f32c..e8cf51beda6 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -3436,7 +3436,7 @@ def number_of_rational_places(self, r=1): sage: [F.number_of_rational_places(r) for r in [1..10]] [4, 8, 4, 16, 44, 56, 116, 288, 508, 968] """ - from sage.rings.all import IntegerRing + from sage.rings.integer_ring import IntegerRing q = self.constant_field().order() L = self.L_polynomial() diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py index 77bf8e67c9a..e99dff850fb 100644 --- a/src/sage/rings/number_field/S_unit_solver.py +++ b/src/sage/rings/number_field/S_unit_solver.py @@ -54,7 +54,7 @@ # **************************************************************************** -from sage.rings.all import Infinity +from sage.rings.infinity import Infinity from sage.symbolic.ring import SR from sage.rings.integer import Integer from sage.rings.integer_ring import ZZ @@ -69,11 +69,11 @@ from sage.rings.padics.factory import Qp from sage.combinat.combination import Combinations from sage.misc.misc_c import prod -from sage.arith.all import factorial +from sage.arith.functions import lcm +from sage.arith.misc import gcd, CRT, factorial from sage.matrix.constructor import matrix, identity_matrix, vector, block_matrix, zero_matrix from sage.modules.free_module_element import zero_vector from itertools import combinations_with_replacement -from sage.arith.all import gcd, lcm, CRT from copy import copy import itertools diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py index 39ab3ceca09..14cd053778b 100644 --- a/src/sage/rings/number_field/bdd_height.py +++ b/src/sage/rings/number_field/bdd_height.py @@ -35,7 +35,8 @@ from sage.modules.free_module_element import vector from sage.matrix.constructor import column_matrix from sage.rings.rational_field import QQ -from sage.rings.all import RR, Infinity +from sage.rings.infinity import Infinity +from sage.rings.real_mpfr import RR from sage.geometry.polyhedron.constructor import Polyhedron diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py index cdb35e88944..018ff5f5c62 100644 --- a/src/sage/rings/number_field/class_group.py +++ b/src/sage/rings/number_field/class_group.py @@ -288,7 +288,7 @@ def representative_prime(self, norm_bound=1000): # otherwise we just search: Cl = self.parent() K = Cl.number_field() - from sage.rings.all import RR + from sage.rings.real_mpfr import RR for P in K.primes_of_bounded_norm_iter(RR(norm_bound)): if Cl(P)==c: return P diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index e00dbe9b7d2..374e2f40b4b 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -128,7 +128,7 @@ from sage.misc.functional import is_odd, lift from sage.misc.misc_c import prod -from sage.rings.all import Infinity +from sage.rings.infinity import Infinity from sage.categories.number_fields import NumberFields import sage.rings.ring @@ -3290,7 +3290,8 @@ def algebraic_closure(self): sage: K.algebraic_closure() Algebraic Field """ - return sage.rings.all.QQbar + from sage.rings.qqbar import QQbar + return QQbar @cached_method def conductor(self, check_abelian=True): @@ -6807,7 +6808,7 @@ def regulator(self, proof=None): try: return self.__regulator except AttributeError: - from sage.rings.all import RealField + from sage.rings.real_mpfr import RealField k = self.pari_bnf(proof) self.__regulator = RealField(53)(k.bnf_get_reg()) return self.__regulator @@ -8116,7 +8117,8 @@ def _coerce_from_other_number_field(self, x): # Do not use CDF or RDF because of constraints on the # exponent of floating-point numbers - from sage.rings.all import RealField, ComplexField + from sage.rings.complex_mpfr import ComplexField + from sage.rings.real_mpfr import RealField CC = ComplexField(53) RR = RealField(53) @@ -9369,8 +9371,9 @@ def places(self, all_complex=False, prec=None): C = sage.rings.complex_double.CDF elif prec == Infinity: - R = sage.rings.all.AA - C = sage.rings.all.QQbar + from sage.rings.qqbar import AA, QQbar + R = AA + C = QQbar else: R = sage.rings.real_mpfr.RealField(prec) @@ -9677,7 +9680,7 @@ def relativize(self, alpha, names, structure=None): L = alpha.domain() alpha = alpha(L.gen()) # relativize over phi's domain if L is QQ: - from sage.rings.all import polygen + from sage.rings.polynomial.polynomial_ring import polygen f = polygen(QQ) else: f = L.defining_polynomial() # = alpha.minpoly() @@ -10039,7 +10042,7 @@ def hilbert_symbol(self, a, b, P = None): if P.domain() is not self: raise ValueError("Domain of P (=%s) should be self (=%s) in self.hilbert_symbol" % (P, self)) codom = P.codomain() - from sage.rings.all import (AA, QQbar) + from sage.rings.qqbar import AA, QQbar if isinstance(codom, (sage.rings.abc.ComplexField, sage.rings.abc.ComplexDoubleField, sage.rings.abc.ComplexIntervalField)) or \ codom is QQbar: if P(self.gen()).imag() == 0: diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py index f785f229ef8..b4dd1eb0e22 100644 --- a/src/sage/rings/number_field/number_field_ideal.py +++ b/src/sage/rings/number_field/number_field_ideal.py @@ -2731,7 +2731,7 @@ def ideallog(self, x, gens=None, check=True): ans = N.hermite_form()[0, 1:].list() if check: - from sage.rings.all import Zmod + from sage.rings.finite_rings.integer_mod_ring import Zmod Z_norm = Zmod(self.norm().numerator()) # norm is an integer ? t = 1 for gi, ai in zip(gens, ans): diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py index 8f4d5349505..a77a69b31f4 100644 --- a/src/sage/rings/number_field/order.py +++ b/src/sage/rings/number_field/order.py @@ -2752,7 +2752,8 @@ def GaussianIntegers(names="I", latex_name="i"): sage: GaussianIntegers().basis() [1, I] """ - from sage.rings.all import CDF, NumberField + from sage.rings.complex_double import CDF + from sage.rings.number_field.number_field import NumberField f = ZZ['x']([1, 0, 1]) nf = NumberField(f, names, embedding=CDF(0, 1), latex_name=latex_name) return nf.ring_of_integers() @@ -2780,7 +2781,8 @@ def EisensteinIntegers(names="omega"): sage: EisensteinIntegers().basis() [1, omega] """ - from sage.rings.all import CDF, NumberField + from sage.rings.complex_double import CDF + from sage.rings.number_field.number_field import NumberField f = ZZ['x']([1, 1, 1]) nf = NumberField(f, names, embedding=CDF(-0.5, 0.8660254037844386)) return nf.ring_of_integers() diff --git a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx index c8c787dfe49..731d27ec33c 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx @@ -180,7 +180,7 @@ from sage.rings.padics.padic_generic_element cimport pAdicGenericElement from sage.libs.pari.all import pari_gen from sage.interfaces.gp import GpElement from sage.rings.finite_rings.integer_mod import is_IntegerMod -from sage.rings.all import IntegerModRing +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.rings.padics.padic_ext_element cimport pAdicExtElement from sage.rings.padics.precision_error import PrecisionError diff --git a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx index 74270163b51..9e182de50d5 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx @@ -149,7 +149,7 @@ from sage.rings.rational cimport Rational from sage.libs.pari.all import pari_gen from sage.interfaces.gp import GpElement from sage.rings.finite_rings.integer_mod import is_IntegerMod -from sage.rings.all import IntegerModRing +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing from sage.rings.padics.pow_computer_ext cimport PowComputer_ZZ_pX_FM_Eis diff --git a/src/sage/rings/padics/padic_valuation.py b/src/sage/rings/padics/padic_valuation.py index cc6c6a1e658..fa0e2e8335c 100644 --- a/src/sage/rings/padics/padic_valuation.py +++ b/src/sage/rings/padics/padic_valuation.py @@ -1252,7 +1252,7 @@ def simplify(self, x, error=None, force=False, size_heuristic_bound=32): return self.domain().zero() from sage.rings.rational_field import QQ - from sage.rings.all import Qp + from sage.rings.padics.factory import Qp precision_ring = Qp(self.p(), QQ(error).floor() + 1 - v) reduced = precision_ring(x) lift = (reduced >> v).lift() diff --git a/src/sage/rings/polynomial/polynomial_gf2x.pyx b/src/sage/rings/polynomial/polynomial_gf2x.pyx index 93eb921e059..3c90a42e033 100644 --- a/src/sage/rings/polynomial/polynomial_gf2x.pyx +++ b/src/sage/rings/polynomial/polynomial_gf2x.pyx @@ -147,7 +147,7 @@ cdef class Polynomial_GF2X(Polynomial_template): from sage.misc.verbose import verbose from sage.functions.all import ceil from sage.matrix.constructor import Matrix - from sage.rings.all import FiniteField as GF + from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF cdef Polynomial_GF2X res cdef GF2XModulus_c modulus diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx index 44b957e0da1..643ef81027a 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -547,7 +547,7 @@ def small_roots(self, X=None, beta=1.0, epsilon=None, **kwds): """ from sage.misc.verbose import verbose from sage.matrix.constructor import Matrix - from sage.rings.all import RR + from sage.rings.real_mpfr import RR N = self.parent().characteristic() diff --git a/src/sage/rings/polynomial/real_roots.pyx b/src/sage/rings/polynomial/real_roots.pyx index 05196dead27..1315d68c4a9 100644 --- a/src/sage/rings/polynomial/real_roots.pyx +++ b/src/sage/rings/polynomial/real_roots.pyx @@ -137,11 +137,14 @@ import time from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.infinity import infinity -from sage.rings.all import RR, AA, RealField, RealIntervalField, RIF, RDF -from sage.arith.all import binomial, factorial +from sage.rings.qqbar import AA +from sage.rings.real_double import RDF +from sage.rings.real_mpfi import RealIntervalField, RIF +from sage.rings.real_mpfr import RR, RealField +from sage.arith.misc import binomial, factorial from sage.misc.randstate import randstate from sage.modules.all import vector, FreeModule -from sage.matrix.all import MatrixSpace +from sage.matrix.matrix_space import MatrixSpace from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import polygen from sage.misc.functional import numerator, denominator diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index 72e87d0ff79..e3fb0f7dfe0 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -1970,17 +1970,17 @@ def random_element(self, poly_degree=2, *args, **kwds): sage: v # random (0.4694381338921299?, -0.500000000000000? + 0.866025403784439?*I) """ - import sage.rings.all + from sage.rings.integer_ring import ZZ import sage.misc.prandom try: - poly_degree = sage.rings.all.ZZ(poly_degree) + poly_degree = ZZ(poly_degree) except TypeError: msg = "polynomial degree must be an integer, not {0}" raise TypeError(msg.format(poly_degree)) if poly_degree < 1: msg = "polynomial degree must be greater than zero, not {0}" raise ValueError(msg.format(poly_degree)) - R = PolynomialRing(sage.rings.all.ZZ, 'x') + R = PolynomialRing(ZZ, 'x') p = R.random_element(degree=poly_degree, *args, **kwds) # degree zero polynomials have no roots # totally zero poly has degree -1 diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 1e53565ea4b..3c53e1c85b7 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -1047,7 +1047,8 @@ cdef class RealDoubleElement(FieldElement): v = -v return v - from sage.rings.all import ZZ, RR + from sage.rings.integer_ring import ZZ + from sage.rings.real_mpfr import RR cdef bint negative = self._value < 0 if negative: @@ -1287,7 +1288,7 @@ cdef class RealDoubleElement(FieldElement): sage: RDF('-0').sign_mantissa_exponent() (-1, 0, 0) """ - from sage.rings.all import RR + from sage.rings.real_mpfr import RR return RR(self._value).sign_mantissa_exponent() def as_integer_ratio(self): From 6df82e356ce7437a0852c14d159b0e97595c329c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 09:05:09 -0700 Subject: [PATCH 343/416] src/sage/rings/rational_field.py: Remove imports from sage.rings.all --- src/sage/rings/rational_field.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index 50710e0c13d..d4dac6aca19 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -680,17 +680,18 @@ def places(self, all_complex=False, prec=None): import sage.rings.all from sage.rings.infinity import Infinity if prec is None: - R = sage.rings.all.RR - C = sage.rings.all.CC + from sage.rings.real_mpfr import RR as R + from sage.rings.cc import CC as C elif prec == 53: - R = sage.rings.all.RDF - C = sage.rings.all.CDF + from sage.rings.real_double import RDF as R + from sage.rings.complex_double import CDF as C elif prec == Infinity: - R = sage.rings.all.AA - C = sage.rings.all.QQbar + from sage.rings.qqbar import AA as R, QQbar as C else: - R = sage.rings.all.RealField(prec) - C = sage.rings.all.ComplexField(prec) + from sage.rings.real_mpfr import RealField + from sage.rings.complex_mpfr import ComplexField + R = RealField(prec) + C = ComplexField(prec) domain = C if all_complex else R return [self.hom([domain(1)])] @@ -1082,7 +1083,7 @@ def algebraic_closure(self): sage: QQ.algebraic_closure() Algebraic Field """ - from sage.rings.all import QQbar + from sage.rings.qqbar import QQbar return QQbar def order(self): @@ -1484,7 +1485,7 @@ def quadratic_defect(self, a, p, check=True): sage: QQ.quadratic_defect(5, 5) 1 """ - from sage.rings.all import Infinity + from sage.rings.infinity import Infinity from sage.arith.misc import legendre_symbol if a not in self: raise TypeError(str(a) + " must be an element of " + str(self)) From 3e420f7215031691850519bb7fa853c9d9b43f0f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 09:10:20 -0700 Subject: [PATCH 344/416] src/sage/rings: Remove remaining imports from sage.rings.all --- src/sage/rings/lazy_series.py | 4 ++-- src/sage/rings/polynomial/infinite_polynomial_ring.py | 4 ++-- src/sage/rings/valuation/valuation_space.py | 2 +- src/sage/rings/valuation/value_group.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index a07327a07da..c5034928ab6 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -2972,12 +2972,12 @@ def approximate_series(self, prec, name=None): name = S.variable_name() if self.valuation() < 0: - from sage.rings.all import LaurentSeriesRing + from sage.rings.laurent_series_ring import LaurentSeriesRing R = LaurentSeriesRing(S.base_ring(), name=name) n = self.valuation() return R([self[i] for i in range(n, prec)], n).add_bigoh(prec) else: - from sage.rings.all import PowerSeriesRing + from sage.rings.power_series_ring import PowerSeriesRing R = PowerSeriesRing(S.base_ring(), name=name) return R([self[i] for i in range(prec)]).add_bigoh(prec) diff --git a/src/sage/rings/polynomial/infinite_polynomial_ring.py b/src/sage/rings/polynomial/infinite_polynomial_ring.py index 9ce33af686d..68e20e1aa74 100644 --- a/src/sage/rings/polynomial/infinite_polynomial_ring.py +++ b/src/sage/rings/polynomial/infinite_polynomial_ring.py @@ -1337,7 +1337,7 @@ def krull_dimension(self, *args, **kwds): sage: R.krull_dimension() +Infinity """ - from sage.rings.all import Infinity + from sage.rings.infinity import Infinity return Infinity def order(self): @@ -1351,7 +1351,7 @@ def order(self): sage: R.order() +Infinity """ - from sage.rings.all import Infinity + from sage.rings.infinity import Infinity return Infinity diff --git a/src/sage/rings/valuation/valuation_space.py b/src/sage/rings/valuation/valuation_space.py index 332fede825d..b6fbf04534f 100644 --- a/src/sage/rings/valuation/valuation_space.py +++ b/src/sage/rings/valuation/valuation_space.py @@ -761,7 +761,7 @@ def separating_element(self, others): else: # others[i](ret) > 0 # construct an element which approximates a unit with respect to others[i] # and has negative valuation with respect to others[:i] - from sage.rings.all import NN + from sage.rings.semirings.non_negative_integer_semiring import NN for r in iter(NN): # When we enter this loop we are essentially out of # luck. The size of the coefficients is likely going diff --git a/src/sage/rings/valuation/value_group.py b/src/sage/rings/valuation/value_group.py index 4ef2038f70f..d02fd5ed617 100644 --- a/src/sage/rings/valuation/value_group.py +++ b/src/sage/rings/valuation/value_group.py @@ -471,7 +471,7 @@ def __classcall__(cls, generators): for h in generators: if g == h: continue - from sage.rings.all import NN + from sage.rings.semirings.non_negative_integer_semiring import NN if h/g in NN: simplified_generators.remove(h) break @@ -525,7 +525,7 @@ def _solve_linear_program(self, target): return None if len(self._generators) == 1: - from sage.rings.all import NN + from sage.rings.semirings.non_negative_integer_semiring import NN exp = target / self._generators[0] if exp not in NN: return None From 12697fe8eb658f3f9ef68c58942fb8489fca2bde Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Fri, 1 Jul 2022 15:57:12 -0600 Subject: [PATCH 345/416] trac 34105 fix ZeroDivisionError --- src/sage/rings/polynomial/multi_polynomial_element.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index 4454aba8ff2..770a20e1b36 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -2324,6 +2324,14 @@ def reduce(self, I): sage: G=[y1^2 + y2^2, y1*y2 + y2^2, y2^3] sage: type((y2^3).reduce(G)) + + TESTS: + + Verify that :trac:`34105` is fixed:: + + sage: R. = AA[] + sage: x.reduce(R.zero_ideal()) + x """ from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal @@ -2353,7 +2361,7 @@ def reduce(self, I): gi = I[i] plm = p.lm() gilm = gi.lm() - if P.monomial_divides(gilm, plm): + if gilm and P.monomial_divides(gilm, plm): quot = p.lc()/gi.lc() * P.monomial_quotient(plm, gilm) p -= quot*I[i] break From 03d0ae2ef0de5b0bff662b81bf268f859389671c Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Fri, 1 Jul 2022 16:00:29 -0600 Subject: [PATCH 346/416] minor refactoring --- src/sage/rings/polynomial/multi_polynomial_element.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index 770a20e1b36..c87ac1c09f9 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -2324,11 +2324,11 @@ def reduce(self, I): sage: G=[y1^2 + y2^2, y1*y2 + y2^2, y2^3] sage: type((y2^3).reduce(G)) - + TESTS: - + Verify that :trac:`34105` is fixed:: - + sage: R. = AA[] sage: x.reduce(R.zero_ideal()) x @@ -2363,7 +2363,7 @@ def reduce(self, I): gilm = gi.lm() if gilm and P.monomial_divides(gilm, plm): quot = p.lc()/gi.lc() * P.monomial_quotient(plm, gilm) - p -= quot*I[i] + p -= quot * gi break else: plt = p.lt() From dbb63fa02596ed7f65fe0e0edf1045d94108a363 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 13:43:31 -0700 Subject: [PATCH 347/416] build/pkgs/prompt_toolkit: Downgrade to 3.0.24 --- build/pkgs/prompt_toolkit/checksums.ini | 6 +++--- build/pkgs/prompt_toolkit/package-version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/prompt_toolkit/checksums.ini b/build/pkgs/prompt_toolkit/checksums.ini index e490811967d..ec0df09c5b9 100644 --- a/build/pkgs/prompt_toolkit/checksums.ini +++ b/build/pkgs/prompt_toolkit/checksums.ini @@ -1,5 +1,5 @@ tarball=prompt_toolkit-VERSION.tar.gz -sha1=b5797c39ab8ae04639768b04e9a557c524f99122 -md5=170d4c9b420570f58fa1a6f763d70b12 -cksum=3627149035 +sha1=77365bfc17ab577d80708a3395186ec68a7dbb2c +md5=214d36301eb139adba280793040d7755 +cksum=3187933391 upstream_url=https://pypi.io/packages/source/p/prompt_toolkit/prompt_toolkit-VERSION.tar.gz diff --git a/build/pkgs/prompt_toolkit/package-version.txt b/build/pkgs/prompt_toolkit/package-version.txt index 92eba66b0da..03a04fce56f 100644 --- a/build/pkgs/prompt_toolkit/package-version.txt +++ b/build/pkgs/prompt_toolkit/package-version.txt @@ -1 +1 @@ -3.0.29 +3.0.24 From 83af1a834990144156faf04325945f4c59851d48 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Sun, 17 Jul 2022 17:23:03 +0100 Subject: [PATCH 348/416] add 32-bit catch-all case --- src/sage/rings/polynomial/hilbert.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/hilbert.pyx b/src/sage/rings/polynomial/hilbert.pyx index 13d0cbea11c..ca3523d1fa1 100644 --- a/src/sage/rings/polynomial/hilbert.pyx +++ b/src/sage/rings/polynomial/hilbert.pyx @@ -578,10 +578,11 @@ def hilbert_poincare_series(I, grading=None): This example exceeded the capabilities of Singular before version 4.2.1p2. In Singular 4.3.1 on 32-bit, it prints overflow warnings and omits some terms. - On 64-bit:: + It works on 64-bit, but coefficients overflow on 32-bit, see :trac:`33134` :: sage: J.hilbert_numerator(algorithm='singular') 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 # 64-bit + ... # 32-bit """ cdef Polynomial_integer_dense_flint HP From c8cfa341a29c563f6814bc25314092de29e6f10e Mon Sep 17 00:00:00 2001 From: Steven Trogdon Date: Sun, 17 Jul 2022 18:33:01 -0600 Subject: [PATCH 349/416] Update ModuleNotFoundError patch --- src/sage/misc/cython.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index cedc9d480c3..1f495803536 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -527,6 +527,8 @@ def cython_import(filename, **kwds): oldpath = sys.path try: sys.path.append(build_dir) + return builtins.__import__(name) + except ModuleNotFoundError: import importlib importlib.invalidate_caches() return builtins.__import__(name) From 7c732d37c30b5f1ab869ef502e4c379b20487d95 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Jul 2022 22:29:04 -0700 Subject: [PATCH 350/416] src/sage/rings/number_field/order.py: Incidental pyflakes fix --- src/sage/rings/number_field/order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py index a77a69b31f4..1da04baf9e5 100644 --- a/src/sage/rings/number_field/order.py +++ b/src/sage/rings/number_field/order.py @@ -1786,13 +1786,13 @@ def _assume_maximal(self, is_maximal=True, p=None): self.__is_maximal = False elif is_maximal: if self._is_maximal() is False: - raise ValueError(f"cannot assume this order to be maximal because we already found it to be a non-maximal order") + raise ValueError("cannot assume this order to be maximal because we already found it to be a non-maximal order") self.__is_maximal = True # No need to keep information at specific primes anymore. self.__is_maximal_at = {} else: if self._is_maximal() is True: - raise ValueError(f"cannot assume this order to be non-maximal because we already found it to be a maximal order") + raise ValueError("cannot assume this order to be non-maximal because we already found it to be a maximal order") self.__is_maximal = False else: p = ZZ(p).abs() From 517980d4a84d7309843c3ec72f9dee0e8a1e20b0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Jul 2022 22:29:34 -0700 Subject: [PATCH 351/416] src/sage/rings/rational_field.py: Remove two more .all imports --- src/sage/rings/rational_field.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index d4dac6aca19..dc457eccf6d 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -540,7 +540,7 @@ def primes_of_bounded_norm_iter(self, B): if B < 2: return - from sage.arith.all import primes + from sage.arith.misc import primes for p in primes(B+1): yield p @@ -1071,7 +1071,7 @@ def extension(self, poly, names, **kwds): sage: a^3 -5 """ - from sage.rings.number_field.all import NumberField + from sage.rings.number_field.number_field import NumberField return NumberField(poly, names=names, **kwds) def algebraic_closure(self): From 635976a125945239fbb6ccc2ba5112e3c8e19d70 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Jul 2022 22:31:00 -0700 Subject: [PATCH 352/416] src/sage/rings/rational_field.py: Remove last .all import --- src/sage/rings/rational_field.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index dc457eccf6d..70e3cba6450 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -677,7 +677,6 @@ def places(self, all_complex=False, prec=None): To: Complex Field with 200 bits of precision Defn: 1 |--> 1.0000000000000000000000000000000000000000000000000000000000] """ - import sage.rings.all from sage.rings.infinity import Infinity if prec is None: from sage.rings.real_mpfr import RR as R From 309726f869cfefaafd2ce7bc7c3ed2f43bdd87a8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 17 Jul 2022 22:48:22 -0700 Subject: [PATCH 353/416] sage.rings: Remove imports from sage.all --- src/sage/rings/fraction_field.py | 4 ++-- src/sage/rings/number_field/number_field.py | 7 ++++--- src/sage/rings/number_field/number_field_element.pyx | 6 +++++- src/sage/rings/padics/local_generic.py | 2 +- src/sage/rings/polynomial/hilbert.pyx | 5 +++-- src/sage/rings/polynomial/infinite_polynomial_element.py | 4 ++-- src/sage/rings/polynomial/multi_polynomial_ideal.py | 2 +- src/sage/rings/polynomial/polynomial_quotient_ring.py | 6 ++---- src/sage/rings/qqbar.py | 2 +- src/sage/rings/quotient_ring.py | 3 ++- src/sage/rings/valuation/augmented_valuation.py | 2 +- src/sage/rings/valuation/valuation.py | 2 +- 12 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/sage/rings/fraction_field.py b/src/sage/rings/fraction_field.py index 0ba0f233a91..8128d796f3e 100644 --- a/src/sage/rings/fraction_field.py +++ b/src/sage/rings/fraction_field.py @@ -1058,7 +1058,7 @@ def _coerce_map_from_(self, R): """ from sage.rings.function_field.function_field import RationalFunctionField if isinstance(R, RationalFunctionField) and self.variable_name() == R.variable_name() and self.base_ring() is R.constant_base_field(): - from sage.categories.all import Hom + from sage.categories.homset import Hom parent = Hom(R, self) from sage.rings.function_field.maps import FunctionFieldToFractionField return parent.__make_element_class__(FunctionFieldToFractionField)(parent) @@ -1138,7 +1138,7 @@ def section(self): """ from sage.categories.sets_with_partial_maps import SetsWithPartialMaps - from sage.all import Hom + from sage.categories.all import Hom parent = Hom(self.codomain(), self.domain(), SetsWithPartialMaps()) return parent.__make_element_class__(FractionFieldEmbeddingSection)(self) diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index 374e2f40b4b..dab12980a3c 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -1635,7 +1635,7 @@ def construction(self): """ from sage.categories.pushout import AlgebraicExtensionFunctor - from sage.all import QQ + from sage.rings.rational_field import QQ names = self.variable_names() polys = [] embeddings = [] @@ -9670,7 +9670,8 @@ def relativize(self, alpha, names, structure=None): # step 1: construct the abstract field generated by alpha.w # step 2: make a relative extension of it. # step 3: construct isomorphisms - from sage.all import vector, matrix + from sage.matrix.constructor import matrix + from sage.modules.free_module_element import vector from sage.categories.map import is_Map if is_Map(alpha): @@ -10036,7 +10037,7 @@ def hilbert_symbol(self, a, b, P = None): return pari(self).nfhilbert(a, b) from sage.categories.map import Map - from sage.categories.all import Rings + from sage.categories.rings import Rings if isinstance(P, Map) and P.category_for().is_subcategory(Rings()): # P is a morphism of Rings if P.domain() is not self: diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 13a0018b4ee..784c239dc10 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -2948,7 +2948,11 @@ cdef class NumberFieldElement(FieldElement): from .number_field import NumberField_cyclotomic if isinstance(K, NumberField_cyclotomic): # solution by radicals may be difficult, but we have a closed form - from sage.all import exp, I, pi, ComplexField, RR + from sage.functions.log import exp + from sage.rings.complex_mpfr import ComplexField + from sage.rings.imaginary_unit import I + from sage.rings.real_mpfr import RR + from sage.symbolic.constants import pi CC = ComplexField(53) two_pi_i = 2 * pi * I k = ( K._n()*CC(K.gen()).log() / CC(two_pi_i) ).real().round() # n ln z / (2 pi i) diff --git a/src/sage/rings/padics/local_generic.py b/src/sage/rings/padics/local_generic.py index bc2b6439f6f..c05ea238ca3 100644 --- a/src/sage/rings/padics/local_generic.py +++ b/src/sage/rings/padics/local_generic.py @@ -1459,7 +1459,7 @@ def _test_matrix_smith(self, **options): tester.assertEqual(self.residue_field().characteristic(), self.residue_characteristic()) from itertools import chain - from sage.all import MatrixSpace + from sage.matrix.matrix_space import MatrixSpace from .precision_error import PrecisionError matrices = chain(*[MatrixSpace(self, n, m).some_elements() for n in (1,3,7) for m in (1,4,7)]) for M in tester.some_elements(matrices): diff --git a/src/sage/rings/polynomial/hilbert.pyx b/src/sage/rings/polynomial/hilbert.pyx index 4cd91d0a464..abe71f503b2 100644 --- a/src/sage/rings/polynomial/hilbert.pyx +++ b/src/sage/rings/polynomial/hilbert.pyx @@ -464,8 +464,9 @@ def first_hilbert_series(I, grading=None, return_grading=False): sage: first_hilbert_series(singular(I)) 0 """ - from sage.all import ZZ, PolynomialRing - PR = PolynomialRing(ZZ,'t') + from sage.rings.integer_ring import ZZ + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing + PR = PolynomialRing(ZZ, 't') cdef Node AN # The "active node". If a recursive computation is needed, it will be equipped # with a 'Left' and a 'Right' child node, and some 'Multipliers'. Later, the first Hilbert diff --git a/src/sage/rings/polynomial/infinite_polynomial_element.py b/src/sage/rings/polynomial/infinite_polynomial_element.py index c779bb4b3f2..659e903ce75 100644 --- a/src/sage/rings/polynomial/infinite_polynomial_element.py +++ b/src/sage/rings/polynomial/infinite_polynomial_element.py @@ -164,7 +164,7 @@ def InfinitePolynomial(A, p): alpha_2^2 + alpha_1^2 """ - from sage.all import parent + from sage.structure.element import parent if hasattr(A,'_P'): if parent(p) is A._P or (A._P.base_ring().has_coerce_map_from(parent(p))): return InfinitePolynomial_dense(A, p) @@ -826,7 +826,7 @@ def _richcmp_(self, x, op): # but of course the underlying polynomial rings # may be widely different, and the sage coercion # system can't guess what order we want. - from sage.all import parent + from sage.structure.element import parent R1 = parent(self._p) R2 = parent(x._p) if (hasattr(R1,'has_coerce_map_from') and R1.has_coerce_map_from(R2)) or (hasattr(R2,'has_coerce_map_from') and R2.has_coerce_map_from(R1)): diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index 1b6c33563d7..a884699503e 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -1313,7 +1313,7 @@ def _groebner_basis_ginv(self, algorithm="TQ", criteria='CritPartially', divisio except KeyError: raise NotImplementedError("Term order '%s' not supported by Sage's GINV interface or GINV"%T.term_order()) - from sage.all import QQ + from sage.rings.rational_field import QQ if K is QQ: ic = ginv.CoeffInterface("GmpQ", st) elif K.order() <= 2**16 and K.order().is_prime(): diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index feb7483f5a7..bbd294e5b3a 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -575,7 +575,7 @@ def _coerce_map_from_(self, R): return False except (ZeroDivisionError,ArithmeticError): return False - from sage.all import Hom + from sage.categories.homset import Hom parent = Hom(R, self, category=self.category()._meet_(R.category())) return parent.__make_element_class__(PolynomialQuotientRing_coercion)(R, self, category=parent.homset_category()) @@ -744,8 +744,7 @@ def _singular_init_(self, S=None): """ if S is None: - from sage.all import singular - S = singular + from sage.interfaces.singular import singular as S Rpoly = S(self.polynomial_ring()) Rpoly.set_ring() modulus = S(self.modulus()) # should live in Rpoly @@ -754,7 +753,6 @@ def _singular_init_(self, S=None): self.__singular = S("ideal(fetch(%s,%s))"%(Rpoly.name(),modulus.name()),"qring") return self.__singular - def _repr_(self): return "Univariate Quotient Polynomial Ring in %s over %s with modulus %s"%( self.variable_name(), self.base_ring(), self.modulus()) diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index e3fb0f7dfe0..28838896d84 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -1757,7 +1757,7 @@ def construction(self): (AlgebraicClosureFunctor, Rational Field) """ from sage.categories.pushout import AlgebraicClosureFunctor - from sage.all import QQ + from sage.rings.rational_field import QQ return (AlgebraicClosureFunctor(), QQ) def gens(self): diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 90f177f9694..30bc0384949 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -278,7 +278,8 @@ def QuotientRing(R, I, names=None, **kwds): # 2. We want to support quotients of free algebras by homogeneous two-sided ideals. #if not isinstance(R, commutative_ring.CommutativeRing): # raise TypeError, "R must be a commutative ring." - from sage.all import Integers, ZZ + from sage.rings.finite_rings.integer_mod_ring import Integers + from sage.rings.integer_ring import ZZ if R not in Rings(): raise TypeError("R must be a ring.") try: diff --git a/src/sage/rings/valuation/augmented_valuation.py b/src/sage/rings/valuation/augmented_valuation.py index fbad8a0a39d..50178e0b112 100644 --- a/src/sage/rings/valuation/augmented_valuation.py +++ b/src/sage/rings/valuation/augmented_valuation.py @@ -1111,7 +1111,7 @@ def lift(self, F): from sage.rings.polynomial.polynomial_quotient_ring_element import PolynomialQuotientRingElement from sage.rings.function_field.element import FunctionFieldElement_polymod from sage.rings.number_field.number_field_element import NumberFieldElement_relative - from sage.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if isinstance(F, PolynomialQuotientRingElement): G = F.lift() elif isinstance(F, FunctionFieldElement_polymod): diff --git a/src/sage/rings/valuation/valuation.py b/src/sage/rings/valuation/valuation.py index 4cbe63fe2f9..9afe673da68 100644 --- a/src/sage/rings/valuation/valuation.py +++ b/src/sage/rings/valuation/valuation.py @@ -735,7 +735,7 @@ def create_children(node): def reduce_tree(v, w): return v + w - from sage.all import RecursivelyEnumeratedSet + from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet tree = RecursivelyEnumeratedSet([seed], successors=create_children, structure='forest', From 0b16491070a4ab16439b85359972f39a338b5fe2 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Mon, 18 Jul 2022 15:12:38 +0900 Subject: [PATCH 354/416] Remove zeros from generator set --- src/sage/rings/ideal.py | 8 +------- src/sage/rings/polynomial/multi_polynomial_element.py | 6 ++---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index 40653979145..8bb1de564f3 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -298,8 +298,6 @@ def _repr_short(self): [0 2] ) of Full MatrixSpace of 2 by 2 dense matrices over Rational Field - - """ L = [] has_return = False @@ -339,7 +337,6 @@ def random_element(self, *args, **kwds): """ return sum(self.__ring.random_element(*args, **kwds) * g for g in self.__gens) - def _richcmp_(self, other, op): """ Compares the generators of two ideals. @@ -441,8 +438,6 @@ def __bool__(self): return True return False - - def base_ring(self): r""" Returns the base ring of this ideal. @@ -772,7 +767,6 @@ def is_primary(self, P=None): else: return (len(ass) == 1) and (ass[0] == P) - def primary_decomposition(self): r""" Return a decomposition of this ideal into primary ideals. @@ -962,7 +956,7 @@ def is_trivial(self): True This test addresses ticket :trac:`20514`:: - + sage: R = QQ['x', 'y'] sage: I = R.ideal(R.gens()) sage: I.is_trivial() diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index c87ac1c09f9..2fc930a9a7f 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -1751,8 +1751,6 @@ def __bool__(self): """ return self._MPolynomial_element__element.dict()!={} - - def _floordiv_(self, right): r""" Quotient of division of self by other. This is denoted //. @@ -2351,8 +2349,8 @@ def reduce(self, I): except (NotImplementedError, TypeError): pass + I = [g for g in I if g] lI = len(I) - I = list(I) r = P.zero() p = self @@ -2361,7 +2359,7 @@ def reduce(self, I): gi = I[i] plm = p.lm() gilm = gi.lm() - if gilm and P.monomial_divides(gilm, plm): + if P.monomial_divides(gilm, plm): quot = p.lc()/gi.lc() * P.monomial_quotient(plm, gilm) p -= quot * gi break From 08e3bfefeac28babcbffc26ef5d255de041995b8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 18 Jul 2022 18:51:37 +0200 Subject: [PATCH 355/416] 33798: improving performance once more --- src/sage/groups/braid.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index a45f8e6a743..b8a5bdee786 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -764,7 +764,6 @@ def TL_matrix(self, drain_size, variab=None, sparse=True): M = M*rep[-i-1][1] return M - @cached_method def links_gould_matrix(self, symbolics=False): r""" Return the representation matrix of ``self`` according to the R-matrix @@ -790,8 +789,9 @@ def links_gould_matrix(self, symbolics=False): sage: HopfLG.dimensions() (16, 16) sage: HopfLG.base_ring() - Quotient of Multivariate Laurent Polynomial Ring in s0r, s1r, Yr - over Integer Ring by the ideal (s0r^2*s1r^2 - s0r^2 - s1r^2 + Yr^2 + 1) + Univariate Quotient Polynomial Ring in Yrbar + over Multivariate Laurent Polynomial Ring in s0r, s1r + over Integer Ring with modulus Yr^2 + s0r^2*s1r^2 - s0r^2 - s1r^2 + 1 sage: HopfLGs = Hopf.links_gould_matrix(symbolics=True) sage: HopfLGs.base_ring() Symbolic Ring @@ -806,7 +806,7 @@ def links_gould_matrix(self, symbolics=False): return M @cached_method - def links_gould_polynomial(self, varnames='t0, t1', use_symbolics=False): + def links_gould_polynomial(self, varnames=None, use_symbolics=False): r""" Return the Links-Gould polynomial of the closure of ``self``. See [MW2012]_, section 3 and references given there. @@ -835,6 +835,14 @@ def links_gould_polynomial(self, varnames='t0, t1', use_symbolics=False): - [MW2012]_ """ + from sage.rings.integer_ring import ZZ + if varnames is not None: + poly = self.links_gould_polynomial(use_symbolics=use_symbolics) + R = LaurentPolynomialRing(ZZ, varnames) + t0, t1 = R.gens() + return poly(t0=t0, t1=t1) + varnames = 't0, t1' + rep = self.parent()._links_gould_representation(symbolics=use_symbolics) l = len(rep) mu = rep[l-1] # quantum trace factor @@ -842,7 +850,6 @@ def links_gould_polynomial(self, varnames='t0, t1', use_symbolics=False): d1, d2 = M.dimensions() e = d1//4 B = M.base_ring() - from sage.rings.integer_ring import ZZ R = LaurentPolynomialRing(ZZ, varnames) # partial quantum trace according to I. Marin section 2.5 @@ -855,13 +862,13 @@ def links_gould_polynomial(self, varnames='t0, t1', use_symbolics=False): F = R.fraction_field() # to make coercion work return R(F(pstr)) else: - ltemp = ptemp.lift() + ltemp = ptemp.lift().constant_coefficient() # Since the result of the calculation is known to be a Laurent polynomial # in t0 and t1 all exponents of ltemp must be divisable by 2 L = ltemp.parent() - lred = L({(k[0]/2, k[1]/2, k[2]/2): v for k, v in ltemp.dict().items()}) + lred = L({(k[0]/2, k[1]/2): v for k, v in ltemp.dict().items()}) t0, t1 = R.gens() - return lred(t0, t1, (t0-1)*(1-t1)) + return lred(t0, t1) def tropical_coordinates(self): r""" @@ -2568,7 +2575,7 @@ def _links_gould_representation(self, symbolics=False): sage: g1, g2, mu3 = B._links_gould_representation() sage: R1, R1I = g1 sage: R2, R2I = g2 - sage: (R1*R2*R1 - R2*R1*R2).is_zero() + sage: R1*R2*R1 == R2*R1*R2 True """ from sage.matrix.constructor import matrix @@ -2585,12 +2592,13 @@ def _links_gould_representation(self, symbolics=False): Y = sqrt(-(t0 - 1)*(t1 - 1)) sparse = False else: - from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.integer_ring import ZZ - LR = LaurentPolynomialRing(ZZ, 's0r, s1r, Yr') - s0r, s1r, Yr = LR.gens() + LR = LaurentPolynomialRing(ZZ, 's0r, s1r') + PR = PolynomialRing(LR, 'Yr') + s0r, s1r, Yr = PR.gens_dict_recursive().values() pqr = Yr**2 + (s0r**2-1)*(s1r**2 -1) - BR = LR.quotient_ring(pqr) + BR = PR.quotient_ring(pqr) s0 = BR(s0r) s1 = BR(s1r) t0 = BR(s0r**2) @@ -2609,7 +2617,7 @@ def _links_gould_representation(self, symbolics=False): (11, 14): s1, (12, 3): 1, (12, 6): -Y*s0*s1, (12, 9): Y, (12, 12): -(t0 - 1)*(t1 - 1), (13, 7): s1, (13, 13): t1 - 1, (14, 11): s1, (14, 14): t1 - 1, (15, 15): t1}, sparse=sparse) - RI = R.inverse() + RI = (~t0 + ~t1)*(1 + R) - ~t0*~t1*(R + R**2) - 1 # quantum trace operator on two fold tensor space E = mu.parent().one() From adb89ffc5793d8491a3915ddb9a4b09b43c4958f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 18 Jul 2022 10:31:13 -0700 Subject: [PATCH 356/416] src/sage/misc/lazy_import.pyx: Improve deprecation message when as_ is in use --- src/sage/misc/lazy_import.pyx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx index 97055afb01a..35f09ba3063 100644 --- a/src/sage/misc/lazy_import.pyx +++ b/src/sage/misc/lazy_import.pyx @@ -255,18 +255,19 @@ cdef class LazyImport(): raise FeatureNotPresentError(self._feature, reason=f'Importing {self._name} failed: {e}') raise - name = self._as_name if self._deprecation is not None: from sage.misc.superseded import deprecation_cython as deprecation try: trac_number, message = self._deprecation except TypeError: trac_number = self._deprecation - message = ('\nImporting {name} from here is deprecated. ' + - 'If you need to use it, please import it directly from' + - ' {module_name}').format(name=name, module_name=self._module) + import_command = f'from {self._module} import {self._name}' + if self._as_name != self._name: + import_command += f' as {self._as_name}' + message = f'\nImporting {self._as_name} from here is deprecated; please use "{import_command}" instead.' deprecation(trac_number, message) # Replace the lazy import in the namespace by the actual object + name = self._as_name if self._namespace is not None: if self._namespace.get(name) is self: self._namespace[name] = self._object @@ -1028,7 +1029,7 @@ def lazy_import(module, names, as_=None, *, sage: lazy_import('sage.all', 'Qp', 'my_Qp', deprecation=14275) sage: my_Qp(5) doctest:...: DeprecationWarning: - Importing my_Qp from here is deprecated. If you need to use it, please import it directly from sage.all + Importing my_Qp from here is deprecated; please use "from sage.all import Qp as my_Qp" instead. See http://trac.sagemath.org/14275 for details. 5-adic Field with capped relative precision 20 From 9cb58077cc79f10d78f33f657de56fc33ad857b9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 18 Jul 2022 19:47:21 -0700 Subject: [PATCH 357/416] src/sage/rings/polynomial/hilbert.pyx: Final fix for the 32-bit result --- src/sage/rings/polynomial/hilbert.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/polynomial/hilbert.pyx b/src/sage/rings/polynomial/hilbert.pyx index da5c06f01d8..0f432de9415 100644 --- a/src/sage/rings/polynomial/hilbert.pyx +++ b/src/sage/rings/polynomial/hilbert.pyx @@ -582,7 +582,7 @@ def hilbert_poincare_series(I, grading=None): sage: J.hilbert_numerator(algorithm='singular') 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 # 64-bit - 120*t^33 - 3465*t^32 + 48180*t^31 - ... # 32-bit + ...120*t^33 - 3465*t^32 + 48180*t^31 - ... # 32-bit """ cdef Polynomial_integer_dense_flint HP HP, grading = first_hilbert_series(I, grading=grading, return_grading=True) From a77b97142827021e5a21d0b1c2b87865c3e24223 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 18 Jul 2022 21:21:36 -0700 Subject: [PATCH 358/416] Update doctest output for changed lazy_import deprecation warnings --- src/sage/functions/other.py | 4 ++-- src/sage/groups/matrix_gps/homset.py | 5 ++--- src/sage/modular/modform/find_generators.py | 4 ++-- src/sage/rings/all.py | 9 ++++++--- src/sage/schemes/hyperelliptic_curves/all.py | 12 ++++++++---- .../graphique_doctest.py | 4 ++-- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/sage/functions/other.py b/src/sage/functions/other.py index 19f95496077..04237301e62 100644 --- a/src/sage/functions/other.py +++ b/src/sage/functions/other.py @@ -7,8 +7,8 @@ sage: from sage.functions.other import beta sage: beta(x, x) - doctest:...: DeprecationWarning: - Importing beta from here is deprecated. If you need to use it, please import it directly from sage.functions.gamma + doctest:warning...: DeprecationWarning: + Importing beta from here is deprecated; please use "from sage.functions.gamma import beta" instead. See http://trac.sagemath.org/24411 for details. beta(x, x) """ diff --git a/src/sage/groups/matrix_gps/homset.py b/src/sage/groups/matrix_gps/homset.py index 274047ad2e4..46d8e225582 100644 --- a/src/sage/groups/matrix_gps/homset.py +++ b/src/sage/groups/matrix_gps/homset.py @@ -30,9 +30,8 @@ def is_MatrixGroupHomset(x): sage: from sage.groups.matrix_gps.homset import is_MatrixGroupHomset sage: is_MatrixGroupHomset(4) doctest:...: DeprecationWarning: - Importing MatrixGroupHomset from here is deprecated. - If you need to use it, please import it directly from - sage.groups.libgap_morphism + Importing MatrixGroupHomset from here is deprecated; please use + "from sage.groups.libgap_morphism import GroupHomset_libgap as MatrixGroupHomset" instead. See https://trac.sagemath.org/25444 for details. False diff --git a/src/sage/modular/modform/find_generators.py b/src/sage/modular/modform/find_generators.py index 637b3520e61..e851bcebfb3 100644 --- a/src/sage/modular/modform/find_generators.py +++ b/src/sage/modular/modform/find_generators.py @@ -21,7 +21,7 @@ sage: find_generators(ModularFormsRing(1)) doctest:warning ... - DeprecationWarning: Importing find_generators from here is deprecated. If you need to use it, please import it directly from sage.modular.modform.ring + DeprecationWarning: Importing find_generators from here is deprecated; please use "from sage.modular.modform.ring import find_generators" instead. See https://trac.sagemath.org/31559 for details. [(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)), @@ -45,7 +45,7 @@ sage: _span_of_forms_in_weight(forms, 12, prec=5) doctest:warning ... - DeprecationWarning: Importing _span_of_forms_in_weight from here is deprecated. If you need to use it, please import it directly from sage.modular.modform.ring + DeprecationWarning: Importing _span_of_forms_in_weight from here is deprecated; please use "from sage.modular.modform.ring import _span_of_forms_in_weight" instead. See https://trac.sagemath.org/31559 for details. Vector space of degree 5 and dimension 2 over Rational Field Basis matrix: diff --git a/src/sage/rings/all.py b/src/sage/rings/all.py index 6d62ee8f5b5..6e6b81eab7b 100644 --- a/src/sage/rings/all.py +++ b/src/sage/rings/all.py @@ -6,19 +6,22 @@ sage: PowerSeries doctest:warning...: DeprecationWarning: - Importing PowerSeries from here is deprecated. If you need to use it, please import it directly from sage.rings.power_series_ring_element + Importing PowerSeries from here is deprecated; + please use "from sage.rings.power_series_ring_element import PowerSeries" instead. See https://trac.sagemath.org/33602 for details. ... sage: PuiseuxSeries doctest:warning...: DeprecationWarning: - Importing PuiseuxSeries from here is deprecated. If you need to use it, please import it directly from sage.rings.puiseux_series_ring_element + Importing PuiseuxSeries from here is deprecated; + please use "from sage.rings.puiseux_series_ring_element import PuiseuxSeries" instead. See https://trac.sagemath.org/33602 for details. ... sage: LaurentSeries doctest:warning...: DeprecationWarning: - Importing LaurentSeries from here is deprecated. If you need to use it, please import it directly from sage.rings.laurent_series_ring_element + Importing LaurentSeries from here is deprecated; + please use "from sage.rings.laurent_series_ring_element import LaurentSeries" instead. See https://trac.sagemath.org/33602 for details. ... """ diff --git a/src/sage/schemes/hyperelliptic_curves/all.py b/src/sage/schemes/hyperelliptic_curves/all.py index fffc78cd9a4..1228f1a6fad 100644 --- a/src/sage/schemes/hyperelliptic_curves/all.py +++ b/src/sage/schemes/hyperelliptic_curves/all.py @@ -4,28 +4,32 @@ sage: igusa_clebsch_invariants doctest:warning...: DeprecationWarning: - Importing igusa_clebsch_invariants from here is deprecated. If you need to use it, please import it directly from sage.schemes.hyperelliptic_curves.invariants + Importing igusa_clebsch_invariants from here is deprecated; + please use "from sage.schemes.hyperelliptic_curves.invariants import igusa_clebsch_invariants" instead. See https://trac.sagemath.org/28064 for details. ... sage: absolute_igusa_invariants_kohel doctest:warning...: DeprecationWarning: - Importing absolute_igusa_invariants_kohel from here is deprecated. If you need to use it, please import it directly from sage.schemes.hyperelliptic_curves.invariants + Importing absolute_igusa_invariants_kohel from here is deprecated; + please use "from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_kohel" instead. See https://trac.sagemath.org/28064 for details. ... sage: absolute_igusa_invariants_wamelen doctest:warning...: DeprecationWarning: - Importing absolute_igusa_invariants_wamelen from here is deprecated. If you need to use it, please import it directly from sage.schemes.hyperelliptic_curves.invariants + Importing absolute_igusa_invariants_wamelen from here is deprecated; + please use "from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_wamelen" instead. See https://trac.sagemath.org/28064 for details. ... sage: clebsch_invariants doctest:warning...: DeprecationWarning: - Importing clebsch_invariants from here is deprecated. If you need to use it, please import it directly from sage.schemes.hyperelliptic_curves.invariants + Importing clebsch_invariants from here is deprecated; + please use "from sage.schemes.hyperelliptic_curves.invariants import clebsch_invariants" instead. See https://trac.sagemath.org/28064 for details. ... """ diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py index 5d3ff884c86..472b7167ac9 100644 --- a/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +++ b/src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py @@ -71,10 +71,10 @@ DeprecationWarning: the package sage.finance is deprecated See https://trac.sagemath.org/32427 for details. doctest:warning... - Importing finance from here is deprecated. If you need to use it, please import it directly from sage.finance + Importing finance from here is deprecated; please use "from sage.finance import all as finance" instead. See https://trac.sagemath.org/32427 for details. doctest:warning... - Importing TimeSeries from here is deprecated. If you need to use it, please import it directly from sage.stats.time_series + Importing TimeSeries from here is deprecated; please use "from sage.stats.time_series import TimeSeries" instead. See https://trac.sagemath.org/32427 for details. Graphics object consisting of 20 graphics primitives From 09276311eec133eb6a562cc6993e561549753b4e Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Tue, 19 Jul 2022 16:01:44 +0200 Subject: [PATCH 359/416] #32088 : gfan patch to fix int size on 32bit arch --- .../patches/fix-int64-for-32bit-archs.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 build/pkgs/gfan/patches/fix-int64-for-32bit-archs.patch diff --git a/build/pkgs/gfan/patches/fix-int64-for-32bit-archs.patch b/build/pkgs/gfan/patches/fix-int64-for-32bit-archs.patch new file mode 100644 index 00000000000..0d1baf45cec --- /dev/null +++ b/build/pkgs/gfan/patches/fix-int64-for-32bit-archs.patch @@ -0,0 +1,21 @@ +Description: Use int64_t instead of signed long int for 64-bit integer typedef. +On 32-bit architectures, longs are only 32 bits. The resulting overflow was +causing an infinite loop in the 0602ResultantFanProjection test. + +References: +https://trac.sagemath.org/ticket/32088 +https://salsa.debian.org/math-team/gfan/-/commit/acaaa70 +https://github.com/void-linux/void-packages/pull/34182 + +Author: Doug Torrance + +--- a/src/vektor.h ++++ b/src/vektor.h +@@ -10,7 +10,7 @@ + + using namespace std; + +-typedef signed long int int64; ++typedef int64_t int64; + + void outOfRange(int i, int n); From 561ed35a6645130945338fa97a3730b022d6b580 Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Tue, 19 Jul 2022 20:10:07 +0200 Subject: [PATCH 360/416] #32088 : add -ffloat-store flag to let gfan 0009RenderStairCase testuite pass on 32bit machines --- build/pkgs/gfan/spkg-install.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/pkgs/gfan/spkg-install.in b/build/pkgs/gfan/spkg-install.in index b90f704d4aa..61546e1cb5a 100644 --- a/build/pkgs/gfan/spkg-install.in +++ b/build/pkgs/gfan/spkg-install.in @@ -7,6 +7,14 @@ cd src # clash of log2 macro with standard library (C++ >= 14), #28984 find src -type f -print0 | xargs -0 sed -i.bak "s/log2/logger2/g" +# To let testsuite/0009RenderStairCase pass on 32bit machines +# See https://trac.sagemath.org/ticket/32088 +case "$($CC -dumpmachine)" in + i[3456]86*) + CFLAGS+=" -ffloat-store" + ;; +esac + echo "Now building gfan..." # We don't use the makefile to install gfan so we don't need to set PREFIX sdh_make CPPFLAGS="-I$SAGE_LOCAL/include" From 6592da5472ba3186193330e7096d4140e76a5e82 Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Tue, 19 Jul 2022 21:50:01 +0200 Subject: [PATCH 361/416] #32088 : CFLAGS -> CXXFLAGS --- build/pkgs/gfan/spkg-install.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/gfan/spkg-install.in b/build/pkgs/gfan/spkg-install.in index 61546e1cb5a..f3224735e4f 100644 --- a/build/pkgs/gfan/spkg-install.in +++ b/build/pkgs/gfan/spkg-install.in @@ -11,7 +11,7 @@ find src -type f -print0 | xargs -0 sed -i.bak "s/log2/logger2/g" # See https://trac.sagemath.org/ticket/32088 case "$($CC -dumpmachine)" in i[3456]86*) - CFLAGS+=" -ffloat-store" + CXXFLAGS+=" -ffloat-store" ;; esac From 54702a1732248253ca30242345d31831fc2a5f7a Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Tue, 19 Jul 2022 21:53:33 +0200 Subject: [PATCH 362/416] #32088 : enable gfan testsuite in the CI --- build/bin/write-dockerfile.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index bf3afa3947f..c64b9c76f2d 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -252,7 +252,7 @@ ARG NUMPROC=8 ENV MAKE="make -j\${NUMPROC}" ARG USE_MAKEFLAGS="-k V=0" ENV SAGE_CHECK=warn -ENV SAGE_CHECK_PACKAGES="!gfan,!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" +ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" #:make: ARG TARGETS_PRE="all-sage-local" $RUN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS_PRE} $ENDRUN @@ -262,7 +262,7 @@ ARG NUMPROC=8 ENV MAKE="make -j\${NUMPROC}" ARG USE_MAKEFLAGS="-k V=0" ENV SAGE_CHECK=warn -ENV SAGE_CHECK_PACKAGES="!gfan,!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" +ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" $ADD src src ARG TARGETS="build" $RUN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS} $ENDRUN @@ -272,7 +272,7 @@ ARG NUMPROC=8 ENV MAKE="make -j\${NUMPROC}" ARG USE_MAKEFLAGS="-k V=0" ENV SAGE_CHECK=warn -ENV SAGE_CHECK_PACKAGES="!gfan,!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" +ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" ARG TARGETS_OPTIONAL="ptest" $RUN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS_OPTIONAL} || echo "(error ignored)" $ENDRUN From 95c79abe8b6f65dc6b71385e03dfeceb216c9bc7 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Tue, 19 Jul 2022 13:49:57 -0700 Subject: [PATCH 363/416] trac 34200: add importlib_metadata to and remove six from build/pkgs/sphinx/dependencies --- build/pkgs/sphinx/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sphinx/dependencies b/build/pkgs/sphinx/dependencies index af580c77d88..75c668d9c23 100644 --- a/build/pkgs/sphinx/dependencies +++ b/build/pkgs/sphinx/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments six snowballstemmer imagesize babel alabaster requests sphinxcontrib_websupport sphinxcontrib_applehelp sphinxcontrib_devhelp sphinxcontrib_htmlhelp sphinxcontrib_jsmath sphinxcontrib_qthelp sphinxcontrib_serializinghtml packaging +$(PYTHON) | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments snowballstemmer imagesize babel alabaster requests sphinxcontrib_websupport sphinxcontrib_applehelp sphinxcontrib_devhelp sphinxcontrib_htmlhelp sphinxcontrib_jsmath sphinxcontrib_qthelp sphinxcontrib_serializinghtml packaging importlib_metadata ---------- All lines of this file are ignored except the first. From 2633cc9b0e65e80c25a41eb0afb31aa2512a199a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Jul 2022 19:19:05 -0700 Subject: [PATCH 364/416] build/sage_bootstrap/uninstall.py: Do not refuse to uninstall packages that do not exist in the source tree --- build/sage_bootstrap/uninstall.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/build/sage_bootstrap/uninstall.py b/build/sage_bootstrap/uninstall.py index bfd5aae9a80..2cfa42bc8b9 100644 --- a/build/sage_bootstrap/uninstall.py +++ b/build/sage_bootstrap/uninstall.py @@ -259,20 +259,6 @@ def dir_type(path): return path -def spkg_type(pkg): - """ - A custom argument 'type' for spkgs--checks whether the given package name - is a known spkg. - """ - pkgbase = pth.join(PKGS, pkg) - - if not pth.isdir(pkgbase): - raise argparse.ArgumentTypeError( - "'{0}' is not a known spkg".format(pkg)) - - return pkg - - def make_parser(): """Returns the command-line argument parser for sage-spkg-uninstall.""" @@ -283,7 +269,7 @@ def make_parser(): epilog='\n'.join(doc_lines[1:]).strip(), formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument('spkg', type=spkg_type, help='the spkg to uninstall') + parser.add_argument('spkg', type=str, help='the spkg to uninstall') parser.add_argument('sage_local', type=dir_type, nargs='?', default=os.environ.get('SAGE_LOCAL'), help='the SAGE_LOCAL path (default: the $SAGE_LOCAL ' From dbc61b3b29e36ac84031b8665486d7623ceaf5c5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Jul 2022 19:50:52 -0700 Subject: [PATCH 365/416] build/sage_bootstrap/uninstall.py: Do not override the stamp file location from environment variable --- build/sage_bootstrap/uninstall.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/sage_bootstrap/uninstall.py b/build/sage_bootstrap/uninstall.py index 2cfa42bc8b9..99ecac7fd08 100644 --- a/build/sage_bootstrap/uninstall.py +++ b/build/sage_bootstrap/uninstall.py @@ -14,9 +14,10 @@ 2) New-style uninstallation: More recently installed packages that were installed with staged installation have a record of all files installed - by that package. That file is stored in the $SAGE_SPKG_INST directory - (typically $SAGE_LOCAL/var/lib/sage/installed) and is created when the - spkg is installed. This is a JSON file containing some meta-data about + by that package. That file is stored in the directory + $SAGE_LOCAL/var/lib/sage/installed or $SAGE_VENV/var/lib/sage/installed + and is created when the spkg is installed. + This is a JSON file containing some meta-data about the package, including the list of all files associated with the package. This script removes all these files, including the record file. Any directories that are empty after files are removed from them @@ -57,7 +58,6 @@ def uninstall(spkg_name, sage_local, keep_files=False, verbose=False): # The default path to this directory; however its value should be read # from the environment if possible spkg_inst = pth.join(sage_local, 'var', 'lib', 'sage', 'installed') - spkg_inst = os.environ.get('SAGE_SPKG_INST', spkg_inst) # Find all stamp files for the package; there should be only one, but if # there is somehow more than one we'll work with the most recent and delete From 3a5ea93b14204008c3398eec1c24262a4e4a0277 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 20 Jul 2022 20:31:54 -0700 Subject: [PATCH 366/416] build/make/Makefile.in: New implicit targets %-SAGE_LOCAL-uninstall, %-SAGE_VENV-uninstall --- build/make/Makefile.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 6b168c12e1f..e0a6eaa0e7c 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -370,6 +370,21 @@ _clean-broken-gcc: rm -f "$(SAGE_ROOT)/build/make/.clean-broken-gcc"; \ echo "Cleaned up old broken GCC install"; \ fi + +%-SAGE_LOCAL-uninstall: + @package=$@; \ + package=$${package%%-*}; \ + if [ -d '$(SAGE_LOCAL)' ]; then \ + sage-spkg-uninstall $$package; \ + fi + +%-SAGE_VENV-uninstall: + @package=$@; \ + package=$${package%%-*}; \ + if [ -d '$(SAGE_VENV)' ]; then \ + sage-spkg-uninstall $$package $(SAGE_VENV); \ + fi + #============================================================================== # Setting SAGE_CHECK... variables #============================================================================== From 65a56047d5933990cc3a65ef437b530a08aa3f7b Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Tue, 16 Jun 2020 15:12:15 -0700 Subject: [PATCH 367/416] trac 29097: change "make SPKG-clean" to "make SPKG-uninstall". --- build/bin/sage-site | 2 +- build/make/Makefile.in | 40 ++++++++++++++++++++++------------------ tox.ini | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/build/bin/sage-site b/build/bin/sage-site index 413abff4dd1..0472f5652b3 100755 --- a/build/bin/sage-site +++ b/build/bin/sage-site @@ -170,7 +170,7 @@ if [ "$1" = '-i' ]; then # First, uninstall the packages if -f was given if [ "$FORCE_INSTALL" = yes ]; then for PKG in $PACKAGES; do - $MAKE "$PKG-clean" || true # Ignore errors + $MAKE "$PKG-uninstall" || true # Ignore errors done fi diff --git a/build/make/Makefile.in b/build/make/Makefile.in index e0a6eaa0e7c..61f9906607c 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -114,7 +114,7 @@ INSTALLED_PACKAGE_INSTS = \ # All previously installed standard/optional/experimental packages that are to be uninstalled OPTIONAL_UNINSTALLED_PACKAGES = @SAGE_OPTIONAL_UNINSTALLED_PACKAGES@ UNINSTALLED_PACKAGES = $(OPTIONAL_UNINSTALLED_PACKAGES) -UNINSTALLED_PACKAGES_CLEANS = $(UNINSTALLED_PACKAGES:%=%-clean) +UNINSTALLED_PACKAGES_UNINSTALLS = $(UNINSTALLED_PACKAGES:%=%-uninstall) # All packages which should be downloaded SDIST_PACKAGES = @SAGE_SDIST_PACKAGES@ @@ -167,7 +167,7 @@ $(foreach tree,SAGE_LOCAL SAGE_VENV SAGE_DOCS, \ $(foreach pkgname,$(INSTALLED_PACKAGES), \ $(if $(findstring $(tree),$(trees_$(pkgname))), \ $(inst_$(pkgname))))) \ - $(eval $(tree)_CLEANED_PACKAGE_CLEANS = \ + $(eval $(tree)_UNINSTALLED_PACKAGE_UNINSTALLS = \ $(foreach pkgname,$(INSTALLED_PACKAGES), \ $(if $(findstring $(tree),$(trees_$(pkgname))), \ $(inst_$(pkgname)))))) @@ -191,7 +191,7 @@ PLUS = endif # List of targets that can be run using `sage -i` or `sage -f` -# These should generally have an associated -clean target for `sage -f` to +# These should generally have an associated -uninstall target for `sage -f` to # work correctly SAGE_I_TARGETS = sagelib doc @@ -242,24 +242,24 @@ base-toolchain: _clean-broken-gcc base # All targets except for the base packages and except the documentation all-sage: \ - $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_CLEANS) \ - $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_CLEANS) + $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_UNINSTALLS) \ + $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_UNINSTALLS) # Same but filtered by installation trees: all-build-local: toolchain-deps +$(MAKE_REC) all-sage-local -all-sage-local: $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_CLEANS) +all-sage-local: $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_UNINSTALLS) all-build-venv: toolchain-deps +$(MAKE_REC) all-sage-venv -all-sage-venv: $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_CLEANS) +all-sage-venv: $(SAGE_VENV_INSTALLED_PACKAGE_INSTS) $(SAGE_VENV_UNINSTALLED_PACKAGES_UNINSTALLS) all-build-docs: toolchain-deps +$(MAKE_REC) all-sage-docs -all-sage-docs: $(SAGE_DOCS_INSTALLED_PACKAGE_INSTS) $(SAGE_DOCS_UNINSTALLED_PACKAGES_CLEANS) +all-sage-docs: $(SAGE_DOCS_INSTALLED_PACKAGE_INSTS) $(SAGE_DOCS_UNINSTALLED_PACKAGES_UNINSTALLS) # Download all packages which should be inside an sdist tarball (the -B # option to make forces all targets to be built unconditionally) @@ -470,7 +470,7 @@ pkg_deps = \ # -no-deps: # +$(AM_V_at)sage-logger -p '$(SAGE_SPKG) -' '$(SAGE_LOGS)/-.log' # -# -clean: +# -uninstall: # sage-spkg-uninstall '$(SAGE_LOCAL)' # # So -build-deps installs just the dependencies, while @@ -485,7 +485,7 @@ pkg_deps = \ # # python3: $(INST)/python3-3.7.3 # -# python3-clean: +# python3-uninstall: # sage-spkg-uninstall python3 '$(SAGE_LOCAL)' # # Note: In these rules the $(INST)/- target is used @@ -527,15 +527,17 @@ $(1)-$(4)-no-deps: $(1)-no-deps: $(1)-$(4)-no-deps -$(1)-$(4)-clean: +$(1)-$(4)-uninstall: if [ -d '$$($(4))' ]; then \ sage-spkg-uninstall $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-files) \ $(1) '$$($(4))'; \ fi -$(1)-clean: $(1)-$(4)-clean +$(1)-uninstall: $(1)-$(4)-uninstall + +$(1)-clean: $(1)-uninstall -.PHONY: $(1) $(1)-clean $(1)-build-deps $(1)-no-deps +.PHONY: $(1) $(1)-$(4)-uninstall $(1)-uninstall $(1)-clean $(1)-build-deps $(1)-no-deps endef ################################################################# $(foreach pkgname, $(NORMAL_PACKAGES),\ @@ -558,7 +560,7 @@ endif # : # $(AM_V_at)sage-logger -p 'sage --pip install ...' '$(SAGE_LOGS)/.log' # -# -clean: +# -uninstall: # -sage --pip uninstall -y ... # Positional arguments: @@ -573,10 +575,12 @@ $(1): $(2) $(1)-no-deps: $(AM_V_at)sage-logger -p 'sage --pip install -r "$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt"' '$$(SAGE_LOGS)/$(1).log' -$(1)-clean: +$(1)-uninstall: -sage --pip uninstall --isolated --yes --no-input -r '$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt' -.PHONY: $(1) $(1)-clean $(1)-build-deps $(1)-no-deps +$(1)-clean: $(1)-uninstall + +.PHONY: $(1) $(1)-uninstall $(1)-clean $(1)-build-deps $(1)-no-deps endef $(foreach pkgname,$(PIP_PACKAGES),\ @@ -602,7 +606,7 @@ endif # # : $(INST)/- # -# -clean: +# -uninstall: # -$(AM_V_at)cd '$SAGE_ROOT' && \\ # . '$SAGE_ROOT/src/bin/sage-env-config' && \\ # . '$SAGE_ROOT/src/bin/sage-env' && \\ @@ -677,7 +681,7 @@ $(1)-tox-%: FORCE SAGE_SPKG_WHEELS=$$(SAGE_LOCAL)/var/lib/sage/wheels \ tox -v -v -v -e $$* -.PHONY: $(1) $(1)-uninstall $(1)-build-deps $(1)-no-deps $(1)-clean +.PHONY: $(1) $(1)-uninstall $(1)-clean $(1)-build-deps $(1)-no-deps $(1)-clean endef diff --git a/tox.ini b/tox.ini index e445ad45d2d..b6dfb7196b3 100644 --- a/tox.ini +++ b/tox.ini @@ -90,7 +90,7 @@ envlist = # # Or to rebuild a package with verbose output: # - # $ tox -e local-homebrew-macos-standard -- ppl-clean ppl V=1 + # $ tox -e local-homebrew-macos-standard -- ppl-uninstall ppl V=1 # # The variant "local-homebrew-macos-usrlocal" uses the global installation in /usr/local # instead. It may install packages or update packages. It will not remove packages. From 46096069a2b56db02e600ccb542e3823d2d7c322 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 12:22:14 -0700 Subject: [PATCH 368/416] build/make/Makefile.in: Also add implicit rule %-uninstall --- build/make/Makefile.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 61f9906607c..8a74f47e41f 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -371,6 +371,7 @@ _clean-broken-gcc: echo "Cleaned up old broken GCC install"; \ fi +# Implicit rules for uninstalling packages that no longer exist in the source tree. %-SAGE_LOCAL-uninstall: @package=$@; \ package=$${package%%-*}; \ @@ -385,6 +386,11 @@ _clean-broken-gcc: sage-spkg-uninstall $$package $(SAGE_VENV); \ fi +%-uninstall: + @package=$@; \ + package=$${package%%-*}; \ + $(MAKE) $$package-SAGE_LOCAL-uninstall $$package-SAGE_VENV-uninstall + #============================================================================== # Setting SAGE_CHECK... variables #============================================================================== From 8619b2928acb518db7056933fa68ff6f2ff4ac64 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 11 May 2022 15:46:54 -0700 Subject: [PATCH 369/416] configure.ac: Make --enable-editable the default --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 09f694d0575..4ab080c6115 100644 --- a/configure.ac +++ b/configure.ac @@ -127,8 +127,9 @@ AC_ARG_ENABLE([debug], AC_ARG_VAR(SAGE_DEBUG, controls debugging support: "no" debugging; debugging "symbols" (default); build debug version ("yes")) AC_ARG_ENABLE([editable], - [AS_HELP_STRING([--enable-editable], - [use an editable install of the Sage library])], + [AS_HELP_STRING([--disable-editable], + [do not use an editable install of the Sage library: changes to Python files will require "sage -b" to rebuild the Sage library])], + [AC_SUBST([SAGE_EDITABLE], [$enableval])], [AC_SUBST([SAGE_EDITABLE], [yes])]) # Check whether we are on a supported platform From 6513b6b9cb35df25b9ad536dff99cb6d74b0c62d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 11 May 2022 18:26:31 -0700 Subject: [PATCH 370/416] README.md: Explain configure --disable-editable --- README.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8b6493631c8..fd467aa85f8 100644 --- a/README.md +++ b/README.md @@ -304,6 +304,11 @@ in the Installation Guide. where `SAGE_LOCAL` is the desired installation prefix, which must be writable by the user. + If you use this option in combination with `--disable-editable`, + you can delete the entire Sage source tree after completing + the build process. What is installed in `SAGE_LOCAL` will be + a self-contained installation of Sage. + - Note that in Sage's build process, `make` builds **and** installs (`make install` is a no-op). Therefore the installation hierarchy must be writable by the user. @@ -321,19 +326,7 @@ in the Installation Guide. $ ./configure --help - Some notable options for Sage developers are the following: - - - Use `./configure --enable-editable` to configure the Sage distribution - to install the Sage library in "develop" ("editable", "in-place") mode - instead of using the Sage library's custom incremental build system. - - It has the benefit that to try out changes to Python files, one does not - need to run `./sage -b` any more; restarting Sage is enough. It may also - have benefits in certain develop environments that get confused by - sagelib's custom build system. - - Note that in an editable install, the source directory will be cluttered - with build artifacts (but they are `.gitignored`). This is normal. + A notable option for Sage developers is the following: - Use `./configure --enable-download-from-upstream-url` to allow downloading packages from their upstream URL if they cannot (yet) be From ff8710efc1b6a1088444e77c40d006c746e3f906 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 15:14:30 -0700 Subject: [PATCH 371/416] docker/Dockerfile: Use configure --disable-editable --- docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 32ea73394c6..269b4667ed9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -168,7 +168,8 @@ ENV MAKEFLAGS $MAKEFLAGS ARG SAGE_NUM_THREADS="2" ENV SAGE_NUM_THREADS $SAGE_NUM_THREADS RUN make configure -RUN ./configure +# Old default before https://trac.sagemath.org/ticket/32406 +RUN ./configure --disable-editable RUN make build ################################################################################ From e9b30bb31428885a6bebbf6a56f7491431046554 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 15:47:11 -0700 Subject: [PATCH 372/416] build/sage_bootstrap/uninstall.py: Update comment --- build/sage_bootstrap/uninstall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/sage_bootstrap/uninstall.py b/build/sage_bootstrap/uninstall.py index 99ecac7fd08..ecbee7df3ff 100644 --- a/build/sage_bootstrap/uninstall.py +++ b/build/sage_bootstrap/uninstall.py @@ -55,8 +55,8 @@ def uninstall(spkg_name, sage_local, keep_files=False, verbose=False): SAGE_LOCAL if it is currently installed. """ - # The default path to this directory; however its value should be read - # from the environment if possible + # The path to the installation records. + # See SPKG_INST_RELDIR in SAGE_ROOT/build/make/Makefile.in spkg_inst = pth.join(sage_local, 'var', 'lib', 'sage', 'installed') # Find all stamp files for the package; there should be only one, but if From fef04d0cf798c43d33f40a2f4aa5ad04395ed6e9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 15:52:20 -0700 Subject: [PATCH 373/416] build/sage_bootstrap/uninstall.py: Clarify that the sage_local argument is SAGE_LOCAL or SAGE_VENV --- build/sage_bootstrap/uninstall.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build/sage_bootstrap/uninstall.py b/build/sage_bootstrap/uninstall.py index ecbee7df3ff..feb91ead158 100644 --- a/build/sage_bootstrap/uninstall.py +++ b/build/sage_bootstrap/uninstall.py @@ -1,5 +1,5 @@ """ -Command-line script for uninstalling an existing Sage spkg from $SAGE_LOCAL. +Command-line script for uninstalling an existing SPKG from an installation tree ($SAGE_LOCAL, $SAGE_VENV). This performs two types of uninstallation: @@ -51,8 +51,8 @@ def uninstall(spkg_name, sage_local, keep_files=False, verbose=False): """ - Given a package name and path to SAGE_LOCAL, uninstall that package from - SAGE_LOCAL if it is currently installed. + Given a package name and path to an installation tree (SAGE_LOCAL or SAGE_VENV, + uninstall that package from that tree if it is currently installed. """ # The path to the installation records. @@ -131,8 +131,9 @@ def legacy_uninstall(spkg_name, verbose=False): def modern_uninstall(spkg_name, sage_local, files, verbose=False): """ - Remove all listed files from the given SAGE_LOCAL (all file paths should - be assumed relative to SAGE_LOCAL). + Remove all listed files from the given installation tree (SAGE_LOCAL or SAGE_VENV). + + All file paths should be assumed relative to the installation tree. This is otherwise (currently) agnostic about what package is actually being uninstalled--all it cares about is removing a list of files. @@ -272,7 +273,7 @@ def make_parser(): parser.add_argument('spkg', type=str, help='the spkg to uninstall') parser.add_argument('sage_local', type=dir_type, nargs='?', default=os.environ.get('SAGE_LOCAL'), - help='the SAGE_LOCAL path (default: the $SAGE_LOCAL ' + help='the path of the installation tree (default: the $SAGE_LOCAL ' 'environment variable if set)') parser.add_argument('-v', '--verbose', action='store_true', help='verbose output showing all files removed') @@ -291,7 +292,7 @@ def run(argv=None): args = parser.parse_args(argv if argv is not None else sys.argv[1:]) if args.sage_local is None: - print('Error: SAGE_LOCAL must be specified either at the command ' + print('Error: An installation tree must be specified either at the command ' 'line or in the $SAGE_LOCAL environment variable', file=sys.stderr) sys.exit(1) From 9693865b1eabba0fd125679c1d25e13365d9211c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 15:54:58 -0700 Subject: [PATCH 374/416] build/make/Makefile.in: Clarify SAGE_I_TARGETS --- build/make/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 8a74f47e41f..c32b8d98554 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -190,7 +190,7 @@ else PLUS = endif -# List of targets that can be run using `sage -i` or `sage -f` +# List of targets that can be run (in addition to names of packages) using `sage -i` or `sage -f` # These should generally have an associated -uninstall target for `sage -f` to # work correctly SAGE_I_TARGETS = sagelib doc From 72695aa2ee6c9c87e427933f11326d55f5ecc2c6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 16:09:04 -0700 Subject: [PATCH 375/416] build/sage_bootstrap/uninstall.py: Fix typo in docstring --- build/sage_bootstrap/uninstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/sage_bootstrap/uninstall.py b/build/sage_bootstrap/uninstall.py index feb91ead158..1ce039921fc 100644 --- a/build/sage_bootstrap/uninstall.py +++ b/build/sage_bootstrap/uninstall.py @@ -51,7 +51,7 @@ def uninstall(spkg_name, sage_local, keep_files=False, verbose=False): """ - Given a package name and path to an installation tree (SAGE_LOCAL or SAGE_VENV, + Given a package name and path to an installation tree (SAGE_LOCAL or SAGE_VENV), uninstall that package from that tree if it is currently installed. """ From 7221a76614e788bb6432dae23aefba44004fcd1f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 18:24:07 -0700 Subject: [PATCH 376/416] src/setup.py: Do not run find_namespace_packages for 'setup.py dist_info' --- src/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup.py b/src/setup.py index 19f1ca9015f..948e4754513 100755 --- a/src/setup.py +++ b/src/setup.py @@ -50,7 +50,7 @@ # ## Configuration # ######################################################## -if len(sys.argv) > 1 and (sys.argv[1] == "sdist" or sys.argv[1] == "egg_info"): +if len(sys.argv) > 1 and (sys.argv[1] in ["sdist", "egg_info", "dist_info"]): sdist = True else: sdist = False From a911e0fbe1f8117cd63e3f67753fdf421592f30b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 18:36:18 -0700 Subject: [PATCH 377/416] src/MANIFEST.in: prune sage_docbuild, doc --- src/MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MANIFEST.in b/src/MANIFEST.in index 44978cc8c8f..f63856e03aa 100644 --- a/src/MANIFEST.in +++ b/src/MANIFEST.in @@ -7,3 +7,5 @@ prune .tox prune sage/ext/interpreters # In particular, __init__.py must not be present in the distribution; or sage_setup.autogen.interpreters.rebuild will not generate the code prune sage_setup +prune sage_docbuild +prune doc From b6aaad2b9a5d050e5333ec04d09cb8129d50410f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 21 Jul 2022 20:28:58 -0700 Subject: [PATCH 378/416] build/pkgs/sip: Remove --- build/pkgs/sip/SPKG.rst | 24 ------------------------ build/pkgs/sip/checksums.ini | 4 ---- build/pkgs/sip/dependencies | 4 ---- build/pkgs/sip/distros/conda.txt | 1 - build/pkgs/sip/distros/homebrew.txt | 1 - build/pkgs/sip/distros/macports.txt | 1 - build/pkgs/sip/distros/repology.txt | 1 - build/pkgs/sip/distros/void.txt | 1 - build/pkgs/sip/package-version.txt | 1 - build/pkgs/sip/spkg-install.in | 22 ---------------------- build/pkgs/sip/type | 1 - 11 files changed, 61 deletions(-) delete mode 100644 build/pkgs/sip/SPKG.rst delete mode 100644 build/pkgs/sip/checksums.ini delete mode 100644 build/pkgs/sip/dependencies delete mode 100644 build/pkgs/sip/distros/conda.txt delete mode 100644 build/pkgs/sip/distros/homebrew.txt delete mode 100644 build/pkgs/sip/distros/macports.txt delete mode 100644 build/pkgs/sip/distros/repology.txt delete mode 100644 build/pkgs/sip/distros/void.txt delete mode 100644 build/pkgs/sip/package-version.txt delete mode 100644 build/pkgs/sip/spkg-install.in delete mode 100644 build/pkgs/sip/type diff --git a/build/pkgs/sip/SPKG.rst b/build/pkgs/sip/SPKG.rst deleted file mode 100644 index 933d0dbeaed..00000000000 --- a/build/pkgs/sip/SPKG.rst +++ /dev/null @@ -1,24 +0,0 @@ -sip: Python extension module generator for C and C++ libraries -============================================================== - -Description ------------ - -Python extension module generator for C and C++ libraries - - -Upstream contact ----------------- - -- https://www.riverbankcomputing.com/software/sip/ -- https://pypi.python.org/pypi/SIP - -License -------- - -SIP is released under the GPL v2, GPL v3 licenses, and under a -license -similar to the BSD license. - -SIP is copyright (c) Riverbank Computing Limited. Its homepage is -https://www.riverbankcomputing.com/software/sip/. diff --git a/build/pkgs/sip/checksums.ini b/build/pkgs/sip/checksums.ini deleted file mode 100644 index af0fdce5737..00000000000 --- a/build/pkgs/sip/checksums.ini +++ /dev/null @@ -1,4 +0,0 @@ -tarball=sip-VERSION.tar.gz -sha1=6704854bc684de3b76c9db61ce54a74e7de5cf45 -md5=78724bf2a79878201c3bc81a1d8248ea -cksum=429231662 diff --git a/build/pkgs/sip/dependencies b/build/pkgs/sip/dependencies deleted file mode 100644 index 1700e743d59..00000000000 --- a/build/pkgs/sip/dependencies +++ /dev/null @@ -1,4 +0,0 @@ -$(PYTHON) - ----------- -All lines of this file are ignored except the first. diff --git a/build/pkgs/sip/distros/conda.txt b/build/pkgs/sip/distros/conda.txt deleted file mode 100644 index 641cf835012..00000000000 --- a/build/pkgs/sip/distros/conda.txt +++ /dev/null @@ -1 +0,0 @@ -sip diff --git a/build/pkgs/sip/distros/homebrew.txt b/build/pkgs/sip/distros/homebrew.txt deleted file mode 100644 index 641cf835012..00000000000 --- a/build/pkgs/sip/distros/homebrew.txt +++ /dev/null @@ -1 +0,0 @@ -sip diff --git a/build/pkgs/sip/distros/macports.txt b/build/pkgs/sip/distros/macports.txt deleted file mode 100644 index 77f4069bd93..00000000000 --- a/build/pkgs/sip/distros/macports.txt +++ /dev/null @@ -1 +0,0 @@ -py-sip diff --git a/build/pkgs/sip/distros/repology.txt b/build/pkgs/sip/distros/repology.txt deleted file mode 100644 index d2bfd2d7b27..00000000000 --- a/build/pkgs/sip/distros/repology.txt +++ /dev/null @@ -1 +0,0 @@ -python:sip diff --git a/build/pkgs/sip/distros/void.txt b/build/pkgs/sip/distros/void.txt deleted file mode 100644 index 87c3df8807a..00000000000 --- a/build/pkgs/sip/distros/void.txt +++ /dev/null @@ -1 +0,0 @@ -python3-sip diff --git a/build/pkgs/sip/package-version.txt b/build/pkgs/sip/package-version.txt deleted file mode 100644 index fdaefe3468b..00000000000 --- a/build/pkgs/sip/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -4.18 diff --git a/build/pkgs/sip/spkg-install.in b/build/pkgs/sip/spkg-install.in deleted file mode 100644 index 5daafce0f2e..00000000000 --- a/build/pkgs/sip/spkg-install.in +++ /dev/null @@ -1,22 +0,0 @@ -cd src - -python3 configure.py -if [ $? -ne 0 ] -then - echo "Configuration of sip failed" - exit 1 -fi - -${MAKE} -if [ $? -ne 0 ] -then - echo "Build of sip failed" -exit 1 -fi - -${MAKE} install -if [ $? -ne 0 ] -then - echo "Installation of sip failed" - exit 1 -fi diff --git a/build/pkgs/sip/type b/build/pkgs/sip/type deleted file mode 100644 index 134d9bc32d5..00000000000 --- a/build/pkgs/sip/type +++ /dev/null @@ -1 +0,0 @@ -optional From 62b9a399268375ef45311c9d773f40227a7dcfd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadia=20Lafreni=C3=A8re?= Date: Fri, 22 Jul 2022 11:31:20 -0400 Subject: [PATCH 379/416] Simplified end of code for longest increasing subsequences --- src/sage/combinat/permutation.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 58954ec39a6..20873f504bf 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2249,18 +2249,13 @@ def longest_increasing_subsequences(self): if k < self[i]: D.add_edge(k, self[i]) - increasing_subsequences = [] - for i in columns[0]: D.add_edge(0, i) # 0 is source for i in columns[-1]: D.add_edge(i, n+1) # n+1 is sink - for p in D.all_paths(0, n+1): - increasing_subsequences.append(p[1:-1]) - - increasing_subsequences.sort() - increasing_subsequences.reverse() + increasing_subsequences = [p[1:-1] for p in D.all_paths(0, n+1)] + increasing_subsequences.sort(reverse=True) return increasing_subsequences From 824412689ec642d17b04edbec893d53e510dfc21 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Fri, 22 Jul 2022 13:54:27 -0700 Subject: [PATCH 380/416] trac 33705: 'make doc-clean' should remove inventory, doctrees --- Makefile | 7 +++++++ build/make/Makefile.in | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88107dbb37d..ed376cfa0e1 100644 --- a/Makefile +++ b/Makefile @@ -131,6 +131,13 @@ sage_setup-clean: build-clean: clean doc-clean sagelib-clean sage_docbuild-clean doc-clean: + if [ -f "$(SAGE_SRC)"/bin/sage-env-config ]; then \ + . "$(SAGE_SRC)"/bin/sage-env-config; \ + if [ -n "$$SAGE_LOCAL" ]; then \ + rm -rf "$$SAGE_LOCAL/share/doc/sage/inventory"; \ + rm -rf "$$SAGE_LOCAL/share/doc/sage/doctrees"; \ + fi; \ + fi; \ cd "$(SAGE_SRC)/doc" && $(MAKE) clean # Deleting src/lib is to get rid of src/lib/pkgconfig diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 6b168c12e1f..df6c54fe859 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -340,9 +340,10 @@ doc-html: sagemath_doc_html # 'doc-html-no-plot': build docs without building the graphics coming # from the '.. plot' directive, in case you want to save a few -# megabytes of disk space. 'doc-clean' is a prerequisite because the -# presence of graphics is cached in src/doc/output. -doc-html-no-plot: doc-clean +# megabytes of disk space. Run 'make doc-clean' first because the +# presence of graphics is cached in the built documentation. +doc-html-no-plot: + (cd $(SAGE_ROOT) && $(MAKE) doc-clean) +$(MAKE_REC) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-plot" doc-html # Using mathjax is actually the only options, but we keep From e0c9408a83f9be80e6c0556c2d30a5d56201168f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 22 Jul 2022 16:04:04 -0700 Subject: [PATCH 381/416] Move sage-gdb-commands from src/bin to src/sage/doctest --- pkgs/sagemath-repl/setup.cfg.m4 | 2 +- src/{bin => sage/doctest}/sage-gdb-commands | 0 src/setup.cfg.m4 | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/{bin => sage/doctest}/sage-gdb-commands (100%) diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 96f554b8de1..59f85521b1f 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -65,7 +65,6 @@ scripts = bin/sage-valgrind bin/sage-cleaner # Uncategorized scripts in alphabetical order - bin/sage-gdb-commands bin/sage-inline-fortran bin/sage-ipynb2rst bin/sage-ipython @@ -78,6 +77,7 @@ scripts = [options.package_data] sage.doctest = + sage-gdb-commands tests/* sage.repl.rich_output = diff --git a/src/bin/sage-gdb-commands b/src/sage/doctest/sage-gdb-commands similarity index 100% rename from src/bin/sage-gdb-commands rename to src/sage/doctest/sage-gdb-commands diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 index 68056007ed0..9d1030eed2a 100644 --- a/src/setup.cfg.m4 +++ b/src/setup.cfg.m4 @@ -105,7 +105,6 @@ scripts = bin/sage-env # sage-env-config -- installed by sage_conf # sage-env-config.in -- not to be installed - bin/sage-gdb-commands bin/sage-grep bin/sage-grepdoc bin/sage-inline-fortran @@ -133,6 +132,7 @@ sage.interfaces = sage-maxima.lisp sage.doctest = + sage-gdb-commands tests/* sage.repl.rich_output = From a9a2fdec13b87c95008bd45ed03e97d43c114836 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 22 Jul 2022 16:49:51 -0700 Subject: [PATCH 382/416] src/sage/doctest/control.py: Get sage-gdb-commands with importlib.resources --- src/sage/doctest/control.py | 147 +++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index beccbeacf1f..66069686df2 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -24,8 +24,10 @@ import os import sys import time +import importlib.resources import json import re +import shlex import types import sage.misc.flatten import sage.misc.randstate as randstate @@ -1183,14 +1185,14 @@ def run_val_gdb(self, testing=False): sage: DD = DocTestDefaults(gdb=True) sage: DC = DocTestController(DD, ["hello_world.py"]) sage: DC.run_val_gdb(testing=True) - exec gdb -x "...sage-gdb-commands" --args sage-runtests --serial --timeout=0 hello_world.py + exec gdb -x ...sage-gdb-commands... --args sage-runtests --serial --timeout=0 hello_world.py :: sage: DD = DocTestDefaults(valgrind=True, optional="all", timeout=172800) sage: DC = DocTestController(DD, ["hello_world.py"]) sage: DC.run_val_gdb(testing=True) - exec valgrind --tool=memcheck --leak-resolution=high --leak-check=full --num-callers=25 --suppressions="...valgrind/pyalloc.supp" --suppressions="...valgrind/sage.supp" --suppressions="...valgrind/sage-additional.supp" --log-file=".../valgrind/sage-memcheck.%p" sage-runtests --serial --timeout=172800 --optional=all hello_world.py + exec valgrind --tool=memcheck --leak-resolution=high --leak-check=full --num-callers=25 --suppressions="...valgrind/pyalloc.supp" --suppressions="...valgrind/sage.supp" --suppressions="...valgrind/sage-additional.supp" --log-file=.../valgrind/sage-memcheck.%p... sage-runtests --serial --timeout=172800 --optional=all hello_world.py """ try: sage_cmd = self._assemble_cmd() @@ -1198,77 +1200,80 @@ def run_val_gdb(self, testing=False): self.log(sys.exc_info()[1]) return 2 opt = self.options - if opt.gdb: - cmd = '''exec gdb -x "%s" --args '''%(os.path.join(SAGE_VENV, "bin", "sage-gdb-commands")) - flags = "" - if opt.logfile: - sage_cmd += " --logfile %s"%(opt.logfile) - else: - if opt.logfile is None: - default_log = os.path.join(DOT_SAGE, "valgrind") - if os.path.exists(default_log): - if not os.path.isdir(default_log): - self.log("%s must be a directory"%default_log) - return 2 - else: - os.makedirs(default_log) - logfile = os.path.join(default_log, "sage-%s") - else: - logfile = opt.logfile - if opt.valgrind: - toolname = "memcheck" - flags = os.getenv("SAGE_MEMCHECK_FLAGS") - if flags is None: - flags = "--leak-resolution=high --leak-check=full --num-callers=25 " - flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","pyalloc.supp")) - flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage.supp")) - flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage-additional.supp")) - elif opt.massif: - toolname = "massif" - flags = os.getenv("SAGE_MASSIF_FLAGS", "--depth=6 ") - elif opt.cachegrind: - toolname = "cachegrind" - flags = os.getenv("SAGE_CACHEGRIND_FLAGS", "") - elif opt.omega: - toolname = "exp-omega" - flags = os.getenv("SAGE_OMEGA_FLAGS", "") - cmd = "exec valgrind --tool=%s "%(toolname) - flags += ''' --log-file="%s" ''' % logfile - if opt.omega: - toolname = "omega" - if "%s" in flags: - flags %= toolname + ".%p" # replace %s with toolname - cmd += flags + sage_cmd - sys.stdout.flush() - sys.stderr.flush() - self.log(cmd) - - if testing: - return - - # Setup signal handlers. - # Save crash logs in temporary directory. - os.putenv('CYSIGNALS_CRASH_LOGS', tmp_dir("crash_logs_")) - init_cysignals() + with importlib.resources.path(__package__, 'sage-gdb-commands') as sage_gdb_commands: + if opt.gdb: + cmd = f'''exec gdb -x {shlex.quote(str(sage_gdb_commands))} --args ''' + flags = "" + if opt.logfile: + sage_cmd += f" --logfile {shlex.quote(opt.logfile)}" + else: + if opt.logfile is None: + default_log = os.path.join(DOT_SAGE, "valgrind") + if os.path.exists(default_log): + if not os.path.isdir(default_log): + self.log(f"{default_log} must be a directory") + return 2 + else: + os.makedirs(default_log) + logfile = os.path.join(default_log, "sage-%s") + else: + logfile = opt.logfile + if opt.valgrind: + toolname = "memcheck" + flags = os.getenv("SAGE_MEMCHECK_FLAGS") + if flags is None: + flags = "--leak-resolution=high --leak-check=full --num-callers=25 " + flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","pyalloc.supp")) + flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage.supp")) + flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage-additional.supp")) + elif opt.massif: + toolname = "massif" + flags = os.getenv("SAGE_MASSIF_FLAGS", "--depth=6 ") + elif opt.cachegrind: + toolname = "cachegrind" + flags = os.getenv("SAGE_CACHEGRIND_FLAGS", "") + elif opt.omega: + toolname = "exp-omega" + flags = os.getenv("SAGE_OMEGA_FLAGS", "") + cmd = "exec valgrind --tool=%s "%(toolname) + flags += f''' --log-file={shlex.quote(logfile)} ''' + if opt.omega: + toolname = "omega" + if "%s" in flags: + flags %= toolname + ".%p" # replace %s with toolname + cmd += flags + sage_cmd + + sys.stdout.flush() + sys.stderr.flush() + self.log(cmd) + + if testing: + return + + # Setup signal handlers. + # Save crash logs in temporary directory. + os.putenv('CYSIGNALS_CRASH_LOGS', tmp_dir("crash_logs_")) + init_cysignals() + + import signal + import subprocess + p = subprocess.Popen(cmd, shell=True) - import signal - import subprocess - p = subprocess.Popen(cmd, shell=True) - if opt.timeout > 0: - signal.alarm(opt.timeout) - try: - return p.wait() - except AlarmInterrupt: - self.log(" Timed out") - return 4 - except KeyboardInterrupt: - self.log(" Interrupted") - return 128 - finally: - signal.alarm(0) - if p.returncode is None: - p.terminate() + if opt.timeout > 0: + signal.alarm(opt.timeout) + try: + return p.wait() + except AlarmInterrupt: + self.log(" Timed out") + return 4 + except KeyboardInterrupt: + self.log(" Interrupted") + return 128 + finally: + signal.alarm(0) + if p.returncode is None: + p.terminate() def run(self): """ From 5460f8a9117709e43801fb9abc82cd0d29d3221c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 22 Jul 2022 17:16:19 -0700 Subject: [PATCH 383/416] src/bin/sage-version.sh: Stop 'setup.py develop' from mistaking this file for a Python file --- src/bin/sage-update-version | 6 +++++- src/bin/sage-version.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index be312ed5775..fe80627466c 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -54,7 +54,11 @@ EOF # Update Sage version file for shell scripts in SAGE_SRC/bin/sage-version.sh cat < "$SAGE_SRC/bin/sage-version.sh" -# Sage version information for shell scripts +# Sage version information for shell scripts. +# +# #31049: The following line is valid shell code but not valid Python code, +# which stops "setup.py develop" from rewriting it as a Python file. +: # This file is auto-generated by the sage-update-version script, do not edit! SAGE_VERSION='$SAGE_VERSION' SAGE_RELEASE_DATE='$SAGE_RELEASE_DATE' diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index a189f800535..31e841443cd 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -1,4 +1,8 @@ -# Sage version information for shell scripts +# Sage version information for shell scripts. The following line is valid shell code +# +# #31049: The following line is valid shell code but not valid Python code, +# which stops "setup.py develop" from rewriting it as a Python file. +: # This file is auto-generated by the sage-update-version script, do not edit! SAGE_VERSION='9.7.beta5' SAGE_RELEASE_DATE='2022-07-10' From 6cc5205f998b31d0790ed82ec914c0dfa9b7c19f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 22 Jul 2022 23:39:14 -0700 Subject: [PATCH 384/416] src/sage/doctest/control.py: When invoking gdb, use sys.executable --- src/sage/doctest/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 66069686df2..482e5c6f8f9 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -1203,7 +1203,7 @@ def run_val_gdb(self, testing=False): with importlib.resources.path(__package__, 'sage-gdb-commands') as sage_gdb_commands: if opt.gdb: - cmd = f'''exec gdb -x {shlex.quote(str(sage_gdb_commands))} --args ''' + cmd = f'''exec gdb -x {shlex.quote(str(sage_gdb_commands))} --args {sys.executable} ''' flags = "" if opt.logfile: sage_cmd += f" --logfile {shlex.quote(opt.logfile)}" From 9d2c48f0ed85c53a2eb06bab090613f7e7cd6311 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Jul 2022 00:20:32 -0700 Subject: [PATCH 385/416] src/bin/sage, src/sage/doctest/control.py: Eliminate use of sage-gdb-commands --- pkgs/sagemath-repl/setup.cfg.m4 | 1 - src/bin/sage | 4 +- src/sage/doctest/control.py | 144 ++++++++++++++--------------- src/sage/doctest/sage-gdb-commands | 1 - src/setup.cfg.m4 | 1 - 5 files changed, 73 insertions(+), 78 deletions(-) delete mode 100644 src/sage/doctest/sage-gdb-commands diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 59f85521b1f..f8757ee66cb 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -77,7 +77,6 @@ scripts = [options.package_data] sage.doctest = - sage-gdb-commands tests/* sage.repl.rich_output = diff --git a/src/bin/sage b/src/bin/sage index d80ec0ee837..2a875b6dc00 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -1069,12 +1069,12 @@ if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then shift sage_setup if [ "$SAGE_DEBUG" = "no" ]; then - gdb -x "${SELF}-gdb-commands" \ + gdb --eval-command "run" \ -args python "${SELF}-ipython" "$@" -i else sage_dir=$(sage-python -c 'import os, sage; print(os.path.dirname(sage.__file__))') cygdb "$sage_dir" "$SAGE_SRC/sage" \ - -- -x "${SELF}-gdb-commands" \ + -- --eval-command "run" \ -args python "${SELF}-ipython" "$@" -i fi exit $? diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 482e5c6f8f9..2b464b728c5 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -24,7 +24,6 @@ import os import sys import time -import importlib.resources import json import re import shlex @@ -1185,7 +1184,7 @@ def run_val_gdb(self, testing=False): sage: DD = DocTestDefaults(gdb=True) sage: DC = DocTestController(DD, ["hello_world.py"]) sage: DC.run_val_gdb(testing=True) - exec gdb -x ...sage-gdb-commands... --args sage-runtests --serial --timeout=0 hello_world.py + exec gdb --eval-command="run" --args ...python... sage-runtests --serial --timeout=0 hello_world.py :: @@ -1201,79 +1200,78 @@ def run_val_gdb(self, testing=False): return 2 opt = self.options - with importlib.resources.path(__package__, 'sage-gdb-commands') as sage_gdb_commands: - if opt.gdb: - cmd = f'''exec gdb -x {shlex.quote(str(sage_gdb_commands))} --args {sys.executable} ''' - flags = "" - if opt.logfile: - sage_cmd += f" --logfile {shlex.quote(opt.logfile)}" - else: - if opt.logfile is None: - default_log = os.path.join(DOT_SAGE, "valgrind") - if os.path.exists(default_log): - if not os.path.isdir(default_log): - self.log(f"{default_log} must be a directory") - return 2 - else: - os.makedirs(default_log) - logfile = os.path.join(default_log, "sage-%s") + if opt.gdb: + cmd = f'''exec gdb --eval-command="run" --args {shlex.quote(sys.executable)} ''' + flags = "" + if opt.logfile: + sage_cmd += f" --logfile {shlex.quote(opt.logfile)}" + else: + if opt.logfile is None: + default_log = os.path.join(DOT_SAGE, "valgrind") + if os.path.exists(default_log): + if not os.path.isdir(default_log): + self.log(f"{default_log} must be a directory") + return 2 else: - logfile = opt.logfile - if opt.valgrind: - toolname = "memcheck" - flags = os.getenv("SAGE_MEMCHECK_FLAGS") - if flags is None: - flags = "--leak-resolution=high --leak-check=full --num-callers=25 " - flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","pyalloc.supp")) - flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage.supp")) - flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage-additional.supp")) - elif opt.massif: - toolname = "massif" - flags = os.getenv("SAGE_MASSIF_FLAGS", "--depth=6 ") - elif opt.cachegrind: - toolname = "cachegrind" - flags = os.getenv("SAGE_CACHEGRIND_FLAGS", "") - elif opt.omega: - toolname = "exp-omega" - flags = os.getenv("SAGE_OMEGA_FLAGS", "") - cmd = "exec valgrind --tool=%s "%(toolname) - flags += f''' --log-file={shlex.quote(logfile)} ''' - if opt.omega: - toolname = "omega" - if "%s" in flags: - flags %= toolname + ".%p" # replace %s with toolname - cmd += flags + sage_cmd - - sys.stdout.flush() - sys.stderr.flush() - self.log(cmd) - - if testing: - return - - # Setup signal handlers. - # Save crash logs in temporary directory. - os.putenv('CYSIGNALS_CRASH_LOGS', tmp_dir("crash_logs_")) - init_cysignals() - - import signal - import subprocess - p = subprocess.Popen(cmd, shell=True) + os.makedirs(default_log) + logfile = os.path.join(default_log, "sage-%s") + else: + logfile = opt.logfile + if opt.valgrind: + toolname = "memcheck" + flags = os.getenv("SAGE_MEMCHECK_FLAGS") + if flags is None: + flags = "--leak-resolution=high --leak-check=full --num-callers=25 " + flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","pyalloc.supp")) + flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage.supp")) + flags += '''--suppressions="%s" '''%(os.path.join(SAGE_EXTCODE,"valgrind","sage-additional.supp")) + elif opt.massif: + toolname = "massif" + flags = os.getenv("SAGE_MASSIF_FLAGS", "--depth=6 ") + elif opt.cachegrind: + toolname = "cachegrind" + flags = os.getenv("SAGE_CACHEGRIND_FLAGS", "") + elif opt.omega: + toolname = "exp-omega" + flags = os.getenv("SAGE_OMEGA_FLAGS", "") + cmd = "exec valgrind --tool=%s "%(toolname) + flags += f''' --log-file={shlex.quote(logfile)} ''' + if opt.omega: + toolname = "omega" + if "%s" in flags: + flags %= toolname + ".%p" # replace %s with toolname + cmd += flags + sage_cmd - if opt.timeout > 0: - signal.alarm(opt.timeout) - try: - return p.wait() - except AlarmInterrupt: - self.log(" Timed out") - return 4 - except KeyboardInterrupt: - self.log(" Interrupted") - return 128 - finally: - signal.alarm(0) - if p.returncode is None: - p.terminate() + sys.stdout.flush() + sys.stderr.flush() + self.log(cmd) + + if testing: + return + + # Setup signal handlers. + # Save crash logs in temporary directory. + os.putenv('CYSIGNALS_CRASH_LOGS', tmp_dir("crash_logs_")) + init_cysignals() + + import signal + import subprocess + p = subprocess.Popen(cmd, shell=True) + + if opt.timeout > 0: + signal.alarm(opt.timeout) + try: + return p.wait() + except AlarmInterrupt: + self.log(" Timed out") + return 4 + except KeyboardInterrupt: + self.log(" Interrupted") + return 128 + finally: + signal.alarm(0) + if p.returncode is None: + p.terminate() def run(self): """ diff --git a/src/sage/doctest/sage-gdb-commands b/src/sage/doctest/sage-gdb-commands deleted file mode 100644 index 4286f428e3b..00000000000 --- a/src/sage/doctest/sage-gdb-commands +++ /dev/null @@ -1 +0,0 @@ -r diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 index 9d1030eed2a..a69b69924c5 100644 --- a/src/setup.cfg.m4 +++ b/src/setup.cfg.m4 @@ -132,7 +132,6 @@ sage.interfaces = sage-maxima.lisp sage.doctest = - sage-gdb-commands tests/* sage.repl.rich_output = From d24b928c9710baab95281d2a26bc071366a6b72b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Jul 2022 00:33:13 -0700 Subject: [PATCH 386/416] src/bin/sage (--gdb): Do not try to run cygdb unless SAGE_DEBUG=yes --- src/bin/sage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/sage b/src/bin/sage index 2a875b6dc00..8f2f676a6d4 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -1068,7 +1068,7 @@ fi if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then shift sage_setup - if [ "$SAGE_DEBUG" = "no" ]; then + if [ "$SAGE_DEBUG" != "yes" ]; then gdb --eval-command "run" \ -args python "${SELF}-ipython" "$@" -i else From 2f4717b2a6c5bcb3577b602f4b812f006242cb31 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 22 Jul 2022 22:45:02 -0700 Subject: [PATCH 387/416] New commands 'sage --lldb', 'sage -t --lldb' --- src/bin/sage | 8 +++++++- src/bin/sage-runtests | 1 + src/sage/doctest/control.py | 15 ++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index 8f2f676a6d4..e4d97835bb1 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -343,7 +343,7 @@ usage_advanced() { 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" + echo " --lldb -- run Sage under the control of lldb" else echo "Running Sage:" echo " (not installed currently, " @@ -1080,6 +1080,12 @@ if [ "$1" = '-gdb' -o "$1" = "--gdb" ]; then exit $? fi +if [ "$1" = '-lldb' -o "$1" = "--lldb" ]; then + shift + sage_setup + lldb --one-line "process launch --tty" --one-line "cont" -- python "${SELF}-ipython" "$@" +fi + if [ "$1" = '-valgrind' -o "$1" = "--valgrind" -o "$1" = '-memcheck' -o "$1" = "--memcheck" ]; then shift sage_setup diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests index 75e2119c99a..81dff8d5bf3 100755 --- a/src/bin/sage-runtests +++ b/src/bin/sage-runtests @@ -68,6 +68,7 @@ if __name__ == "__main__": parser.add_argument("--only-errors", action="store_true", default=False, help="only output failures, not test successes") parser.add_argument("--gdb", action="store_true", default=False, help="run doctests under the control of gdb") + parser.add_argument("--lldb", action="store_true", default=False, help="run doctests under the control of lldb") parser.add_argument("--valgrind", "--memcheck", action="store_true", default=False, help="run doctests using Valgrind's memcheck tool. The log " "files are named sage-memcheck.PID and can be found in " + diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 2b464b728c5..ad0ce22c917 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -120,6 +120,7 @@ def __init__(self, **kwds): self.debug = False self.only_errors = False self.gdb = False + self.lldb = False self.valgrind = False self.massif = False self.cachegrind = False @@ -365,7 +366,7 @@ def __init__(self, options, args): # account and check compatibility of the user's specified # options. if options.timeout < 0: - if options.gdb or options.debug: + if options.gdb or options.lldb or options.debug: # Interactive debuggers: "infinite" timeout options.timeout = 0 elif options.valgrind or options.massif or options.cachegrind or options.omega: @@ -1142,7 +1143,7 @@ def _optional_tags_string(self): def _assemble_cmd(self): """ - Assembles a shell command used in running tests under gdb or valgrind. + Assembles a shell command used in running tests under gdb, lldb, or valgrind. EXAMPLES:: @@ -1154,7 +1155,7 @@ def _assemble_cmd(self): cmd = "sage-runtests --serial " opt = dict_difference(self.options.__dict__, DocTestDefaults().__dict__) if "all" in opt: - raise ValueError("You cannot run gdb/valgrind on the whole sage library") + raise ValueError("You cannot run gdb/lldb/valgrind on the whole sage library") for o in ("all", "long", "force_lib", "verbose", "failed", "new"): if o in opt: cmd += "--%s "%o @@ -1167,7 +1168,7 @@ def _assemble_cmd(self): def run_val_gdb(self, testing=False): """ - Spawns a subprocess to run tests under the control of gdb or valgrind. + Spawns a subprocess to run tests under the control of gdb, lldb, or valgrind. INPUT: @@ -1205,6 +1206,10 @@ def run_val_gdb(self, testing=False): flags = "" if opt.logfile: sage_cmd += f" --logfile {shlex.quote(opt.logfile)}" + elif opt.lldb: + sage_cmd = sage_cmd.replace('sage-runtests', '$(command -v sage-runtests)') + cmd = f'''exec lldb --one-line "process launch" --one-line "cont" -- {sys.executable} ''' + flags = "" else: if opt.logfile is None: default_log = os.path.join(DOT_SAGE, "valgrind") @@ -1325,7 +1330,7 @@ def run(self): """ opt = self.options - L = (opt.gdb, opt.valgrind, opt.massif, opt.cachegrind, opt.omega) + L = (opt.gdb, opt.lldb, opt.valgrind, opt.massif, opt.cachegrind, opt.omega) if any(L): if L.count(True) > 1: self.log("You may only specify one of gdb, valgrind/memcheck, massif, cachegrind, omega") From 2e183cf011466c7b39f3304c84930dde70d5e092 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 23 Jul 2022 12:55:54 +0200 Subject: [PATCH 388/416] trac #34214: faster longest_increasing_subsequence_length --- src/sage/combinat/permutation.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index a38eaa71079..ac486e1dcb5 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2194,13 +2194,18 @@ def longest_increasing_subsequence_length(self) -> Integer: sage: Permutation([]).longest_increasing_subsequence_length() 0 """ + from bisect import bisect r: list[int] = [] + np = len(self) + 1 for x in self: - if max(r+[0]) > x: - y = min(z for z in r if z > x) - r[r.index(y)] = x - else: + # Search for the smallest value y larger than x + idx = bisect(r, x) + if idx == len(r): + # We have max(r) < x r.append(x) + else: + # We replace y by x + r[idx] = x return len(r) def longest_increasing_subsequences(self): From 15aa550c5ca1e6c8e03d518bde51e08ad6877227 Mon Sep 17 00:00:00 2001 From: dcoudert Date: Sat, 23 Jul 2022 12:57:42 +0200 Subject: [PATCH 389/416] trac #34214: remove a useless variable --- src/sage/combinat/permutation.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index ac486e1dcb5..31bbe1e1306 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2196,7 +2196,6 @@ def longest_increasing_subsequence_length(self) -> Integer: """ from bisect import bisect r: list[int] = [] - np = len(self) + 1 for x in self: # Search for the smallest value y larger than x idx = bisect(r, x) From 3516245b96c7d05afeab64d5c63a490b6a60b32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 3 Apr 2022 09:36:06 -0300 Subject: [PATCH 390/416] Trac #33636: don't use loadable_module_extension() in sage.misc.cython.cython() Notes: - The option `use_cache=True` is only used in `sage.repl.load.load_cython()` I'm not sure there's any doctest that will run this code. - The option `create_local_so_file=True` is not used anywhere, and it's not doctested either. - If both options are given together and the compiled `*.so` file is found in cache, it will not save a copy in the current directory (seems to be a bug). --- src/sage/misc/cython.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index 5a7927b2e1e..0f0e70cdc58 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -240,13 +240,20 @@ def cython(filename, verbose=0, compile_message=False, # There is already a module here. Maybe we do not have to rebuild? # Find the name. if use_cache: - from sage.misc.sageinspect import loadable_module_extension - prev_so = [F for F in os.listdir(target_dir) if F.endswith(loadable_module_extension())] - if len(prev_so) > 0: - prev_so = prev_so[0] # should have length 1 because of deletes below - if os.path.getmtime(filename) <= os.path.getmtime('%s/%s' % (target_dir, prev_so)): + from importlib.machinery import EXTENSION_SUFFIXES + for f in os.listdir(target_dir): + for suffix in EXTENSION_SUFFIXES: + if f.endswith(suffix): + # use the first matching extension + prev_file = os.path.join(target_dir, f) + prev_name = f[:-len(suffix)] + break + else: + # no match, try next file + continue + if os.path.getmtime(filename) <= os.path.getmtime(prev_file): # We do not have to rebuild. - return prev_so[:-len(loadable_module_extension())], target_dir + return prev_name, target_dir # Delete all ordinary files in target_dir for F in os.listdir(target_dir): @@ -409,9 +416,11 @@ def cython(filename, verbose=0, compile_message=False, if create_local_so_file: # Copy module to current directory - from sage.misc.sageinspect import loadable_module_extension - shutil.copy(os.path.join(target_dir, name + loadable_module_extension()), - os.curdir) + from importlib.machinery import EXTENSION_SUFFIXES + for ext in EXTENSION_SUFFIXES: + path = os.path.join(target_dir, name + ext) + if os.path.exists(path): + shutil.copy(path, os.curdir) return name, target_dir From 780be6a71d8920c30b7de053e79ed82630919738 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 23 Jul 2022 09:45:16 -0700 Subject: [PATCH 391/416] src/sage/misc/sageinspect.py: Deprecate loadable_module_extension --- src/sage/misc/sageinspect.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 13f0fc1bec3..ced989e3b4e 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -179,13 +179,20 @@ def loadable_module_extension(): It is '.dll' on cygwin, '.so' otherwise. + This function is deprecated. + EXAMPLES:: sage: from sage.misc.sageinspect import loadable_module_extension sage: from importlib.machinery import EXTENSION_SUFFIXES sage: loadable_module_extension() in EXTENSION_SUFFIXES + doctest:warning... + DeprecationWarning: loadable_module_extension is deprecated; use importlib.machinery.EXTENSION_SUFFIXES instead + See https://trac.sagemath.org/33636 for details. True """ + from sage.misc.superseded import deprecation + deprecation(33636, "loadable_module_extension is deprecated; use importlib.machinery.EXTENSION_SUFFIXES instead") # Return the full platform-specific extension module suffix return import_machinery.EXTENSION_SUFFIXES[0] From 4cbf230a0e4c49fc00acdef92cc24bb96f70598c Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Sat, 23 Jul 2022 20:16:33 -0600 Subject: [PATCH 392/416] doctest for trac 22857 --- src/sage/symbolic/expression.pyx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index b8e50e04149..1ea4218fef3 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -3445,6 +3445,12 @@ cdef class Expression(Expression_abc): sage: bool(f(x) - f(x) == 0) True + Check that :trac:`22857` is fixed:: + + sage: a, b = var('a b', domain='positive') + sage: bool((a-b)*b == 0) + False + Check that :trac:`24658` is fixed:: sage: val = pi - 2286635172367940241408/1029347477390786609545*sqrt(2) From 7f7149489cd662174d19733feb97c00899f3eaec Mon Sep 17 00:00:00 2001 From: Release Manager Date: Sun, 24 Jul 2022 14:00:35 +0200 Subject: [PATCH 393/416] Updated SageMath version to 9.7.beta6 --- .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 70b795b82de..521a275f9f9 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.beta5", - "version": "9.7.beta5", + "title": "sagemath/sage: 9.7.beta6", + "version": "9.7.beta6", "upload_type": "software", - "publication_date": "2022-07-10", + "publication_date": "2022-07-24", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/9.7.beta5", + "identifier": "https://github.com/sagemath/sage/tree/9.7.beta6", "relation": "isSupplementTo" }, { diff --git a/VERSION.txt b/VERSION.txt index b67ee65e457..f863f2ae553 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 9.7.beta5, Release Date: 2022-07-10 +SageMath version 9.7.beta6, Release Date: 2022-07-24 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 45c84606a18..d69d37294c9 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=7f35111c9a2aeb985580f13c2f1f72b2219ffcb1 -md5=30cf7cce73540a45384762cea5da5f62 -cksum=2110985588 +sha1=7df04dc0c2e0d7cdfd767dfb86dd3a60d3af1767 +md5=f8e92133f5447c39196fc45a026ed49d +cksum=1963708627 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 250df17642e..463c496acf2 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -b393ee3e8e5501fd7e9101d884c743567df1816d +e3ababd22689e7cc6e89a01b1e8bd6d770e7b1cf diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/src/VERSION.txt b/src/VERSION.txt index 1d3a97792b7..ec1cd2281f6 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -9.7.beta5 +9.7.beta6 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index a189f800535..c66568933c0 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.beta5' -SAGE_RELEASE_DATE='2022-07-10' -SAGE_VERSION_BANNER='SageMath version 9.7.beta5, Release Date: 2022-07-10' +SAGE_VERSION='9.7.beta6' +SAGE_RELEASE_DATE='2022-07-24' +SAGE_VERSION_BANNER='SageMath version 9.7.beta6, Release Date: 2022-07-24' diff --git a/src/sage/version.py b/src/sage/version.py index 7fd94a3db6f..d7d504505d1 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.beta5' -date = '2022-07-10' -banner = 'SageMath version 9.7.beta5, Release Date: 2022-07-10' +version = '9.7.beta6' +date = '2022-07-24' +banner = 'SageMath version 9.7.beta6, Release Date: 2022-07-24' From 942639d6a6471aa96d72cd464823953abf6f1b25 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 24 Jul 2022 15:29:33 -0700 Subject: [PATCH 394/416] build/pkgs/{gfortran,openssl,python3}: On Cygwin, do not try to build the SPKG --- build/pkgs/gfortran/spkg-configure.m4 | 6 ++++++ build/pkgs/openssl/spkg-configure.m4 | 6 ++++++ build/pkgs/python3/spkg-configure.m4 | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/build/pkgs/gfortran/spkg-configure.m4 b/build/pkgs/gfortran/spkg-configure.m4 index 663acf3070c..db7c4e7bc14 100644 --- a/build/pkgs/gfortran/spkg-configure.m4 +++ b/build/pkgs/gfortran/spkg-configure.m4 @@ -93,4 +93,10 @@ SAGE_SPKG_CONFIGURE([gfortran], [ ]) ]) fi + AS_CASE([$host], + [*-*-cygwin*], [AS_VAR_IF([sage_spkg_install_gfortran], [yes], [ + AS_VAR_APPEND([SAGE_SPKG_ERRORS], [" + On Cygwin, gfortran must be installed as a system package. This is an error."]) + ]) + ]) ]) diff --git a/build/pkgs/openssl/spkg-configure.m4 b/build/pkgs/openssl/spkg-configure.m4 index 650c046667b..2862d7ebec0 100644 --- a/build/pkgs/openssl/spkg-configure.m4 +++ b/build/pkgs/openssl/spkg-configure.m4 @@ -27,6 +27,12 @@ SAGE_SPKG_CONFIGURE([openssl], [ ], [dnl No openssl found sage_spkg_install_openssl=yes ]) + AS_CASE([$host], + [*-*-cygwin*], [AS_VAR_IF([sage_spkg_install_openssl], [yes], [ + AS_VAR_APPEND([SAGE_SPKG_ERRORS], [" +On Cygwin, openssl must be installed as a system package. This is an error."]) + ]) + ]) ], [dnl REQUIRED-CHECK AC_REQUIRE([SAGE_SPKG_CONFIGURE_PYTHON3]) dnl openssl is a dependency only of python3; so if we use system python3, diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4 index a217268b040..65cc548d8f3 100644 --- a/build/pkgs/python3/spkg-configure.m4 +++ b/build/pkgs/python3/spkg-configure.m4 @@ -70,6 +70,12 @@ SAGE_SPKG_CONFIGURE([python3], [ sage_spkg_install_python3=yes ]) ]) + AS_CASE([$host], + [*-*-cygwin*], [AS_VAR_IF([sage_spkg_install_python3], [yes], [ + AS_VAR_APPEND([SAGE_SPKG_ERRORS], [" + On Cygwin, python3 must be installed as a system package. This is an error."]) + ]) + ]) ],, [ dnl PRE ], [ From 4a7f5c8cf4097ff903f625d1e4b97b5416308fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadia=20Lafreni=C3=A8re?= Date: Mon, 25 Jul 2022 11:58:45 -0400 Subject: [PATCH 395/416] Use of bisect for columns in longest_increasing_subsequences --- src/sage/combinat/permutation.py | 49 +++++++++++++++++--------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 20873f504bf..5d0506f56f9 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2213,7 +2213,6 @@ def longest_increasing_subsequences(self): p-tableau each value of the permutation is entered into, creates a digraph to record all increasing subsequences, and reads the paths from a source to a sink; these are the longest increasing subsequences. - EXAMPLES:: @@ -2221,43 +2220,47 @@ def longest_increasing_subsequences(self): [[2, 3, 4]] sage: Permutation([5, 7, 1, 2, 6, 4, 3]).longest_increasing_subsequences() [[1, 2, 6], [1, 2, 4], [1, 2, 3]] + + .. NOTE:: + This algorithm could be made faster using a balanced search tree + for each column instead of sorted lists. See discussion on + :trac:`31451`. """ n = self.size() if n == 0: return([[]]) + from bisect import insort, bisect + # getting the column in which each element is inserted first_row_p_tableau = [] - columns = [[] for _ in range(self.longest_increasing_subsequence_length())] + columns = [] D = DiGraph(n+2) - for i in range(n): - inserted = False - j = 0 # j is j-th column of p-tableau - while j < len(first_row_p_tableau) and not inserted: - if first_row_p_tableau[j] > self[i]: - first_row_p_tableau[j] = self[i] - columns[j].append(self[i]) + for x in self: + j = bisect(first_row_p_tableau, x) + if j == len(first_row_p_tableau): + if columns: + for k in columns[-1]: + if k >= x: + break + D.add_edge(k, x) + first_row_p_tableau.append(x) + columns.append([x]) + else: + first_row_p_tableau[j] = x + insort(columns[j], x) + if j: for k in columns[j-1]: - if k < self[i]: - D.add_edge(k, self[i]) - inserted = True - j += 1 - if not inserted: - first_row_p_tableau.append(self[i]) - columns[j].append(self[i]) - for k in columns[j-1]: - if k < self[i]: - D.add_edge(k, self[i]) + if k > x: + break + D.add_edge(k, x) for i in columns[0]: D.add_edge(0, i) # 0 is source for i in columns[-1]: D.add_edge(i, n+1) # n+1 is sink - increasing_subsequences = [p[1:-1] for p in D.all_paths(0, n+1)] - increasing_subsequences.sort(reverse=True) - - return increasing_subsequences + return sorted([p[1:-1] for p in D.all_paths(0, n+1)], reverse=True) def cycle_type(self): From e82312aeb671fbdd59c06fbf21370859fe932121 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 09:32:48 -0700 Subject: [PATCH 396/416] pkgs/sagemath-{environment,repl}/tox.ini: Update from sagemath-objects --- pkgs/sagemath-environment/tox.ini | 12 ++++++++---- pkgs/sagemath-repl/tox.ini | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index 8af948f4676..7f08078d74e 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -1,16 +1,20 @@ # To build and test in the tox environment: # -# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v)' +# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v -e sagepython)' # # To test interactively: # -# pkgs/sagemath-environment/.tox/python/bin/python +# pkgs/sagemath-environment/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements + isolated_build = True [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage @@ -25,7 +29,7 @@ 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)); import sage.misc.package' + {envpython} -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' [testenv:sagepython] passenv = diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini index ff2e8e826f1..d766fa55f74 100644 --- a/pkgs/sagemath-repl/tox.ini +++ b/pkgs/sagemath-repl/tox.ini @@ -1,16 +1,20 @@ # To build and test in the tox environment: # -# ./sage -sh -c '(cd pkgs/sagemath-repl && tox -v -v)' +# ./sage -sh -c '(cd pkgs/sagemath-repl && tox -v -v -e sagepython)' # # To test interactively: # -# pkgs/sagemath-repl/.tox/python/bin/python +# pkgs/sagemath-repl/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements + isolated_build = True [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage @@ -25,9 +29,9 @@ 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.repl.all; import sage.doctest.all' + {envpython} -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 $SAGE_SRC/sage/misc/sage_input.py $SAGE_SRC/sage/misc/sage_eval.py || echo "(lots of doctest failures are expected)"' + bash -c 'cd bin && SAGE_SRC=$({envpython} -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)"' [testenv:sagepython] passenv = From 5969edaa2e395e683feaba38db8ea94c6290e996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadia=20Lafreni=C3=A8re?= Date: Mon, 25 Jul 2022 13:24:44 -0400 Subject: [PATCH 397/416] proper formatting for longest_increasing_subsequences --- src/sage/combinat/permutation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 5d0506f56f9..3071dbf8c13 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2222,6 +2222,7 @@ def longest_increasing_subsequences(self): [[1, 2, 6], [1, 2, 4], [1, 2, 3]] .. NOTE:: + This algorithm could be made faster using a balanced search tree for each column instead of sorted lists. See discussion on :trac:`31451`. @@ -2258,7 +2259,7 @@ def longest_increasing_subsequences(self): for i in columns[0]: D.add_edge(0, i) # 0 is source for i in columns[-1]: - D.add_edge(i, n+1) # n+1 is sink + D.add_edge(i, n+1) # n+1 is sink return sorted([p[1:-1] for p in D.all_paths(0, n+1)], reverse=True) From 8358976f2889e1fcf9fbd9f5156a0c8a27d443e9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 11:14:54 -0700 Subject: [PATCH 398/416] src/bin/sage-update-version: Update install-requires.txt for the distribution packages in pkgs/ --- build/pkgs/sage_conf/install-requires.txt | 3 ++- build/pkgs/sage_docbuild/install-requires.txt | 3 ++- build/pkgs/sage_setup/install-requires.txt | 3 ++- build/pkgs/sage_sws2rst/install-requires.txt | 3 ++- build/pkgs/sagelib/install-requires.txt | 3 ++- .../sagemath_categories/install-requires.txt | 3 ++- .../sagemath_environment/install-requires.txt | 3 ++- build/pkgs/sagemath_objects/install-requires.txt | 4 ++-- src/bin/sage-update-version | 16 ++++++++++++++++ 9 files changed, 32 insertions(+), 9 deletions(-) diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 2d13b49ef28..8ec83b2b905 100644 --- a/build/pkgs/sage_conf/install-requires.txt +++ b/build/pkgs/sage_conf/install-requires.txt @@ -1 +1,2 @@ -sage-conf ~= 9.7.b3 +# This file is updated on every release by the sage-update-version script +sage-conf ~= 9.7b6 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index b6e14e76015..9199fde5772 100644 --- a/build/pkgs/sage_docbuild/install-requires.txt +++ b/build/pkgs/sage_docbuild/install-requires.txt @@ -1 +1,2 @@ -sage_docbuild +# This file is updated on every release by the sage-update-version script +sage-docbuild ~= 9.7b6 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index 17adea02d63..4497f3f35a9 100644 --- a/build/pkgs/sage_setup/install-requires.txt +++ b/build/pkgs/sage_setup/install-requires.txt @@ -1 +1,2 @@ -sage-setup ~= 9.7.b3 +# This file is updated on every release by the sage-update-version script +sage-setup ~= 9.7b6 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index b489fda6aeb..aabd0d31807 100644 --- a/build/pkgs/sage_sws2rst/install-requires.txt +++ b/build/pkgs/sage_sws2rst/install-requires.txt @@ -1 +1,2 @@ -sage_sws2rst +# This file is updated on every release by the sage-update-version script +sage-sws2rst ~= 9.7b6 diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index 29a9a5df969..35f845894d6 100644 --- a/build/pkgs/sagelib/install-requires.txt +++ b/build/pkgs/sagelib/install-requires.txt @@ -1 +1,2 @@ -sagemath-standard +# This file is updated on every release by the sage-update-version script +sagelib ~= 9.7b6 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index e35667f8201..da1b503c697 100644 --- a/build/pkgs/sagemath_categories/install-requires.txt +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -1 +1,2 @@ -sagemath-categories ~= 9.5b6 +# This file is updated on every release by the sage-update-version script +sagemath-categories ~= 9.7b6 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index bea4334d7e4..1dd6c84bc68 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1 +1,2 @@ -sagemath-environment == 9.6rc3.post2 +# This file is updated on every release by the sage-update-version script +sagemath-environment ~= 9.7b6 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 06766454a53..b28d0b381ca 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.post4 +# This file is updated on every release by the sage-update-version script +sagemath-objects ~= 9.7b6 diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index 25e4c594798..dfd4d228eae 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -43,6 +43,21 @@ for version_file in "$SAGE_ROOT"/pkgs/*/VERSION.txt; do fi done +# Update install-requires.txt for all distribution packages +( cd "$SAGE_ROOT"/build/pkgs/ && for spkg in sage*; do + if [ -f "$spkg"/install-requires.txt -a -d "$spkg"/src ]; then + ( echo "# This file is updated on every release by the sage-update-version script" + # Normalize the package name to PyPI convention (dashes, not underscores) + pkg=${spkg//_/-} + # Normalize the version (updated above as VERSION.txt) according to PEP440. + version=$(cat "$spkg"/package-version.txt) + version=${version//.beta/b} + version=${version//.rc/rc} + # ~= asks for a compatible release. https://peps.python.org/pep-0440/#compatible-release + echo "$pkg ~= $version" ) > "$spkg"/install-requires.txt + fi + done ) + # Update Sage version file for Python in SAGE_SRC/sage cat < "$SAGE_SRC/sage/version.py" # Sage version information for Python scripts @@ -81,6 +96,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/*/install-requires.txt" \ "$SAGE_ROOT"/pkgs/*/VERSION.txt \ || die "Error committing to the repository." From b79b5c6945f8c6f960a3e91c95296a2ebb372e32 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 11:27:33 -0700 Subject: [PATCH 399/416] build/pkgs/sagemath_objects/dependencies: Restore comment lost in merge --- build/pkgs/sagemath_objects/dependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index 5310597e856..688f08df8b3 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,3 +1,4 @@ FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig build +# FORCE: Always run the spkg-install script # ipython - for the doctester From 7bb6dee62f181d00960b619af956c22f865b0b53 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 11:33:30 -0700 Subject: [PATCH 400/416] build/pkgs/python_build: Rename from build/pkgs/build --- build/pkgs/build/SPKG.rst | 18 ------------------ build/pkgs/python_build/SPKG.rst | 18 ++++++++++++++++++ .../pkgs/{build => python_build}/dependencies | 0 .../{build => python_build}/requirements.txt | 0 build/pkgs/{build => python_build}/type | 0 build/pkgs/sagemath_objects/dependencies | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 build/pkgs/build/SPKG.rst create mode 100644 build/pkgs/python_build/SPKG.rst rename build/pkgs/{build => python_build}/dependencies (100%) rename build/pkgs/{build => python_build}/requirements.txt (100%) rename build/pkgs/{build => python_build}/type (100%) diff --git a/build/pkgs/build/SPKG.rst b/build/pkgs/build/SPKG.rst deleted file mode 100644 index 8d222b8f6cc..00000000000 --- a/build/pkgs/build/SPKG.rst +++ /dev/null @@ -1,18 +0,0 @@ -build: A simple, correct PEP517 package builder -=============================================== - -Description ------------ - -A simple, correct PEP517 package builder - -License -------- - -MIT - -Upstream Contact ----------------- - -https://pypi.org/project/build/ - diff --git a/build/pkgs/python_build/SPKG.rst b/build/pkgs/python_build/SPKG.rst new file mode 100644 index 00000000000..9249861c610 --- /dev/null +++ b/build/pkgs/python_build/SPKG.rst @@ -0,0 +1,18 @@ +python_build: A simple, correct PEP517 package builder +====================================================== + +Description +----------- + +``build`` is a simple, correct PEP517 package builder + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/build/ + diff --git a/build/pkgs/build/dependencies b/build/pkgs/python_build/dependencies similarity index 100% rename from build/pkgs/build/dependencies rename to build/pkgs/python_build/dependencies diff --git a/build/pkgs/build/requirements.txt b/build/pkgs/python_build/requirements.txt similarity index 100% rename from build/pkgs/build/requirements.txt rename to build/pkgs/python_build/requirements.txt diff --git a/build/pkgs/build/type b/build/pkgs/python_build/type similarity index 100% rename from build/pkgs/build/type rename to build/pkgs/python_build/type diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index 688f08df8b3..217821d206b 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,4 +1,4 @@ -FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig build +FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig python_build # FORCE: Always run the spkg-install script # ipython - for the doctester From 96af429a8919975e1ebf2b26f25cf0e9899c2387 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 11:50:05 -0700 Subject: [PATCH 401/416] src/.relint.yml (namespace_pkg_all_import): Check all namespace packages from #33011, also check .pxi files --- src/.relint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/.relint.yml b/src/.relint.yml index 5e40cf7814e..abadae0de28 100644 --- a/src/.relint.yml +++ b/src/.relint.yml @@ -47,6 +47,6 @@ hint: | Sage library code should not import from sage.PAC.KAGE.all when sage.PAC.KAGE is an implicit Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import. - pattern: 'from\s+sage[.](categories|misc|rings|combinat|graphs|interfaces|libs)[.]all\s+import' - filePattern: '.*[.](py|pyx)$' + pattern: 'from\s+sage(|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings|sets))[.]all\s+import' + filePattern: '.*[.](py|pyx|pxi)$' error: false # Make this a warning instead of an error for now From 5047328a2a817ed59f0185d71d0221b3b1584cb4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 11:53:08 -0700 Subject: [PATCH 402/416] src/sage/rings/quotient_ring.py: Remove .all import --- src/sage/rings/quotient_ring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/quotient_ring.py b/src/sage/rings/quotient_ring.py index 30bc0384949..b2cc718e2f4 100644 --- a/src/sage/rings/quotient_ring.py +++ b/src/sage/rings/quotient_ring.py @@ -589,7 +589,7 @@ def is_commutative(self): return True except (AttributeError, NotImplementedError): pass - from sage.all import Infinity + from sage.rings.infinity import Infinity if self.ngens() == Infinity: raise NotImplementedError("This quotient ring has an infinite number of generators.") for i in range(self.ngens()): From eecd57794eb0119236b6352f75e8108f0d200ca4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 25 Jul 2022 11:53:31 -0700 Subject: [PATCH 403/416] src/sage/rings/padics/padic_template_element.pxi: Remove .all import --- src/sage/rings/padics/padic_template_element.pxi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/padics/padic_template_element.pxi b/src/sage/rings/padics/padic_template_element.pxi index 80c33df881b..fed8ac89f81 100644 --- a/src/sage/rings/padics/padic_template_element.pxi +++ b/src/sage/rings/padics/padic_template_element.pxi @@ -741,7 +741,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): if field and absprec != 1: raise ValueError("field keyword may only be set at precision 1") if absprec == 0: - from sage.rings.all import IntegerModRing + from sage.rings.finite_rings.integer_mod_ring import IntegerModRing return IntegerModRing(1).zero() elif absprec == 1: parent = R.residue_field() From 52e8c4184d6e083b7cc259aff72223df9078213f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 May 2022 00:26:07 -0700 Subject: [PATCH 404/416] build/bin/sage-build-env[-config]: Do not override SAGE_EDITABLE if it is set already --- build/bin/sage-build-env | 4 ++++ build/bin/sage-build-env-config.in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build/bin/sage-build-env b/build/bin/sage-build-env index ddda5ce212d..ed999b703f0 100644 --- a/build/bin/sage-build-env +++ b/build/bin/sage-build-env @@ -27,6 +27,10 @@ if [ "x$SAGE_BUILD_ENV_SOURCED" = "x" ]; then if [ "x$SAGE_DEBUG" = "x" ]; then export SAGE_DEBUG="$CONFIGURED_SAGE_DEBUG" fi + # Likewise for SAGE_EDITABLE + if [ "x$SAGE_EDITABLE" = "x" ]; then + export SAGE_EDITABLE="$CONFIGURED_SAGE_EDITABLE" + fi # This is usually blank if the system GMP is used, or $SAGE_LOCAL otherwise if [ -n "$SAGE_GMP_PREFIX" ]; then diff --git a/build/bin/sage-build-env-config.in b/build/bin/sage-build-env-config.in index 92e7dadba06..58d6bd5e5d7 100644 --- a/build/bin/sage-build-env-config.in +++ b/build/bin/sage-build-env-config.in @@ -57,4 +57,4 @@ export SAGE_SUITESPARSE_PREFIX="@SAGE_SUITESPARSE_PREFIX@" export SAGE_CONFIGURE_FFLAS_FFPACK="@SAGE_CONFIGURE_FFLAS_FFPACK@" -export SAGE_EDITABLE="@SAGE_EDITABLE@" +export CONFIGURED_SAGE_EDITABLE="@SAGE_EDITABLE@" From cee005d122dd13210b3b5bc687046a70e9c72f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadia=20Lafreni=C3=A8re?= Date: Mon, 25 Jul 2022 16:19:06 -0400 Subject: [PATCH 405/416] Implemented longest_increasing_subsequences_number() --- src/sage/combinat/permutation.py | 60 ++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 173680ac65b..5880ff13612 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2217,7 +2217,7 @@ def longest_increasing_subsequences(self): p-tableau each value of the permutation is entered into, creates a digraph to record all increasing subsequences, and reads the paths from a source to a sink; these are the longest increasing subsequences. - + EXAMPLES:: sage: Permutation([2,3,4,1]).longest_increasing_subsequences() @@ -2239,7 +2239,7 @@ def longest_increasing_subsequences(self): # getting the column in which each element is inserted first_row_p_tableau = [] - columns = [] + columns = [] D = DiGraph(n+2) for x in self: j = bisect(first_row_p_tableau, x) @@ -2268,6 +2268,62 @@ def longest_increasing_subsequences(self): return sorted([p[1:-1] for p in D.all_paths(0, n+1)], reverse=True) + def longest_increasing_subsequences_number(self): + r""" + Return the number of increasing subsequences of maximal length + in ``self``. + + The list of longest increasing subsequences of a permutation is + given by ``self.longest_increasing_subsequences()``, and the + length of these subsequences is given by + ``self.longest_increasing_subsequence_length()``. + + EXAMPLES:: + + sage: p = Permutations(50).random_element() + sage: (len(p.longest_increasing_subsequences()) == + ....: p.longest_increasing_subsequences_number()) + True + """ + n = self.size() + if n == 0: + return 1 + + from bisect import insort, bisect + + # getting the column in which each element is inserted + first_row_p_tableau = [] + columns = [] + D = DiGraph(n+2) + for x in self: + j = bisect(first_row_p_tableau, x) + if j == len(first_row_p_tableau): + if columns: + for k in columns[-1]: + if k >= x: + break + D.add_edge(k, x) + first_row_p_tableau.append(x) + columns.append([x]) + else: + first_row_p_tableau[j] = x + insort(columns[j], x) + if j: + for k in columns[j-1]: + if k > x: + break + D.add_edge(k, x) + + for i in columns[0]: + D.add_edge(0, i) # 0 is source + for i in columns[-1]: + D.add_edge(i, n+1) # n+1 is sink + + Path_matrix = (D.adjacency_matrix() + **(self.longest_increasing_subsequence_length()+1)) + return Path_matrix[0][n+1] + + def cycle_type(self): r""" Return a partition of ``len(self)`` corresponding to the cycle From a98a60f021bb79800196477c59cf66b48b332e8c Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com> Date: Mon, 25 Jul 2022 23:20:15 +0200 Subject: [PATCH 406/416] faster p.longest_increasing_subsequences_number --- src/sage/combinat/permutation.py | 33 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 5880ff13612..020dbfb207e 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2280,6 +2280,9 @@ def longest_increasing_subsequences_number(self): EXAMPLES:: + sage: sum(p.longest_increasing_subsequences_number() for p in Permutations(8)) + 120770 + sage: p = Permutations(50).random_element() sage: (len(p.longest_increasing_subsequences()) == ....: p.longest_increasing_subsequences_number()) @@ -2292,37 +2295,25 @@ def longest_increasing_subsequences_number(self): from bisect import insort, bisect # getting the column in which each element is inserted + count = [0] * (n + 1) first_row_p_tableau = [] columns = [] - D = DiGraph(n+2) for x in self: j = bisect(first_row_p_tableau, x) if j == len(first_row_p_tableau): - if columns: - for k in columns[-1]: - if k >= x: - break - D.add_edge(k, x) first_row_p_tableau.append(x) columns.append([x]) else: first_row_p_tableau[j] = x insort(columns[j], x) - if j: - for k in columns[j-1]: - if k > x: - break - D.add_edge(k, x) - - for i in columns[0]: - D.add_edge(0, i) # 0 is source - for i in columns[-1]: - D.add_edge(i, n+1) # n+1 is sink - - Path_matrix = (D.adjacency_matrix() - **(self.longest_increasing_subsequence_length()+1)) - return Path_matrix[0][n+1] - + if j == 0: + count[x] = 1 + else: + for k in columns[j-1]: + if k > x: + break + count[x] += count[k] + return sum(count[x] for x in columns[-1]) def cycle_type(self): r""" From 88676d8e657f28756e3604b8eec7a55147d78967 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com> Date: Tue, 26 Jul 2022 09:03:31 +0200 Subject: [PATCH 407/416] optimization and typing --- src/sage/combinat/permutation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 020dbfb207e..c7a94208a8e 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -2196,7 +2196,7 @@ def longest_increasing_subsequence_length(self) -> Integer: """ from bisect import bisect r: list[int] = [] - for x in self: + for x in self._list: # Search for the smallest value y larger than x idx = bisect(r, x) if idx == len(r): @@ -2241,7 +2241,7 @@ def longest_increasing_subsequences(self): first_row_p_tableau = [] columns = [] D = DiGraph(n+2) - for x in self: + for x in self._list: j = bisect(first_row_p_tableau, x) if j == len(first_row_p_tableau): if columns: @@ -2294,11 +2294,10 @@ def longest_increasing_subsequences_number(self): from bisect import insort, bisect - # getting the column in which each element is inserted - count = [0] * (n + 1) + count: list[int] = [0] * (n + 1) first_row_p_tableau = [] columns = [] - for x in self: + for x in self._list: j = bisect(first_row_p_tableau, x) if j == len(first_row_p_tableau): first_row_p_tableau.append(x) From 11e2592449863d4f6a57205aa46a3851c24393b6 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix <20100.delecroix@gmail.com> Date: Tue, 26 Jul 2022 09:03:36 +0200 Subject: [PATCH 408/416] more documentation --- src/sage/combinat/permutation.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index c7a94208a8e..a7ddbf536e6 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -62,6 +62,7 @@ :meth:`~sage.combinat.permutation.Permutation.runs` | Returns a list of the runs in the permutation ``self``. :meth:`~sage.combinat.permutation.Permutation.longest_increasing_subsequence_length` | Returns the length of the longest increasing subsequences of ``self``. :meth:`~sage.combinat.permutation.Permutation.longest_increasing_subsequences` | Returns the list of the longest increasing subsequences of ``self``. + :meth:`~sage.combinat.permutation.Permutation.longest_increasing_subsequences_number` | Returns the number of longest increasing subsequences :meth:`~sage.combinat.permutation.Permutation.cycle_type` | Returns the cycle type of ``self`` as a partition of ``len(self)``. :meth:`~sage.combinat.permutation.Permutation.foata_bijection` | Returns the image of the permutation ``self`` under the Foata bijection `\phi`. :meth:`~sage.combinat.permutation.Permutation.foata_bijection_inverse` | Returns the image of the permutation ``self`` under the inverse of the Foata bijection `\phi`. @@ -2267,16 +2268,21 @@ def longest_increasing_subsequences(self): return sorted([p[1:-1] for p in D.all_paths(0, n+1)], reverse=True) - def longest_increasing_subsequences_number(self): r""" Return the number of increasing subsequences of maximal length in ``self``. The list of longest increasing subsequences of a permutation is - given by ``self.longest_increasing_subsequences()``, and the + given by :meth:`longest_increasing_subsequences`, and the length of these subsequences is given by - ``self.longest_increasing_subsequence_length()``. + :meth:`longest_increasing_subsequence_length`. + + The algorithm is similar to :meth:`longest_increasing_subsequences`. + Namely, the longest increasing subsequences are encoded as increasing + sequences in a ranked poset from a smallest to a largest element. Their + number can be obtained via dynamic programming : for each `v` in the poset + we compute the number of paths from a smallest element to `v`. EXAMPLES:: From 64b212caa93f9e9c4f0868eb065bb35fd22cfc6a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 26 Jul 2022 11:05:28 -0700 Subject: [PATCH 409/416] pkgs/sagemath-*/tox.ini: Make sagepython-norequirements actually use sage python --- pkgs/sagemath-categories/tox.ini | 12 +++++++----- pkgs/sagemath-environment/tox.ini | 11 +++++++---- pkgs/sagemath-objects/tox.ini | 11 +++++++---- pkgs/sagemath-repl/tox.ini | 11 +++++++---- pkgs/sagemath-standard/tox.ini | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/pkgs/sagemath-categories/tox.ini b/pkgs/sagemath-categories/tox.ini index 60cdfe4ca7c..7ac63bae0ec 100644 --- a/pkgs/sagemath-categories/tox.ini +++ b/pkgs/sagemath-categories/tox.ini @@ -19,13 +19,15 @@ setenv = HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash - commands = # Beware of the treacherous non-src layout. "./sage/" shadows the install sage package. {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.cpython.builtin_types, sage.cpython.cython_metaclass, sage.cpython.debug, sage.structure.all, sage.categories.all' @@ -36,7 +38,7 @@ commands = bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_categories --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index 7f08078d74e..890ffdf0015 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -21,8 +21,11 @@ setenv = HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash @@ -32,7 +35,7 @@ commands = {envpython} -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' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-objects/tox.ini b/pkgs/sagemath-objects/tox.ini index 727254cf844..e03cbab1c3c 100644 --- a/pkgs/sagemath-objects/tox.ini +++ b/pkgs/sagemath-objects/tox.ini @@ -19,8 +19,11 @@ setenv = HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash @@ -34,7 +37,7 @@ commands = #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/structure || echo "(lots of doctest failures are expected)"' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini index d766fa55f74..a7e321104cd 100644 --- a/pkgs/sagemath-repl/tox.ini +++ b/pkgs/sagemath-repl/tox.ini @@ -21,8 +21,11 @@ setenv = HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash @@ -34,7 +37,7 @@ commands = bash -c 'cd bin && SAGE_SRC=$({envpython} -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)"' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-standard/tox.ini b/pkgs/sagemath-standard/tox.ini index b80af350be4..75e72ae32bd 100644 --- a/pkgs/sagemath-standard/tox.ini +++ b/pkgs/sagemath-standard/tox.ini @@ -82,7 +82,7 @@ passenv = PKG_CONFIG_PATH # Parallel build SAGE_NUM_THREADS - # SAGE_VENV only for finding the wheels + # SAGE_VENV only for referring to the basepython or finding the wheels sagepython, sagewheels: SAGE_VENV # Location of the wheels (needs to include a PEP 503 compliant # Simple Repository index, i.e., a subdirectory "simple") From 4f10ac72c743238191ef79c23f6e02f5063d735c Mon Sep 17 00:00:00 2001 From: Amritanshu Prasad Date: Wed, 27 Jul 2022 15:29:45 +0530 Subject: [PATCH 410/416] Invariant subspace generating function --- src/sage/combinat/similarity_class_type.py | 146 +++++++++++++++++++-- 1 file changed, 133 insertions(+), 13 deletions(-) diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index 8febf66ec03..ef814980139 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -109,6 +109,10 @@ class type, it is also possible to compute the number of classes of that type functions coming from the cycle index type techniques of Kung and Stong (see Morrison [Morrison06]_). +They can also be used to caclulate the number of invariant subspaces for a matrix +over a finite field of any given dimension. For this we use the elegant recursive +formula of Ramaré [R17]_ (see also [PR22]_). + Along with the results of [PSS13]_, similarity class types can be used to calculate the number of similarity classes of matrices of order `n` with entries in a principal ideal local ring of length two with residue field of cardinality @@ -152,6 +156,13 @@ class type, it is also possible to compute the number of classes of that type .. [PSS13] Prasad, A., Singla, P., and Spallone, S., *Similarity of matrices over local rings of length two*. :arxiv:`1212.6157` +.. [PR22] Prasad, A., Ram, S., *Splitting subspaces and a finite field + interpretation of the Touchard-Riordan formula*. :arxiv:`2205.11076` + +.. [R17] Ramaré, O., *Rationality of the zeta function of the subgroups of + abelian p-groups*. Publ. Math. Debrecen 90.1-2. + :doi:`10.5486/PMD.2017.7466` + AUTHOR: - Amritanshu Prasad (2013-07-18): initial implementation @@ -159,6 +170,8 @@ class type, it is also possible to compute the number of classes of that type - Amritanshu Prasad (2013-09-09): added functions for similarity classes over rings of length two +- Amritanshu Prasad (2022-07-31): added computation of similarity class type of + a given matrix and invariant subspace generating function """ # **************************************************************************** # Copyright (C) 2013 Amritanshu Prasad @@ -180,7 +193,7 @@ class type, it is also possible to compute the number of classes of that type from sage.arith.misc import factorial from sage.arith.all import moebius, divisors from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass -from sage.structure.element import Element +from sage.structure.element import Element, is_Matrix from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets @@ -191,7 +204,7 @@ class type, it is also possible to compute the number of classes of that type from sage.rings.rational_field import QQ from sage.misc.cachefunc import cached_in_parent_method, cached_function from sage.combinat.misc import IterableFunctionCall - +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing @cached_function def fq(n, q=None): @@ -204,7 +217,7 @@ def fq(n, q=None): - ``q`` -- an integer or an indeterminate - OUTPUT: + OUTPUT: A rational function in ``q``. @@ -340,7 +353,39 @@ def centralizer_group_cardinality(la, q=None): q = ZZ['q'].gen() return q**centralizer_algebra_dim(la)*prod([fq(m, q=q) for m in la.to_exp()]) +def invariant_subspace_generating_function(la,q=None,t=None): + """ + Return the invariant subpace generating function of a nilpotent matrix with + Jordan block sizes given by ``la``. + + INPUT: + + ``la`` -- a partition. + + OUTPUT: + + A polynomial in ``t`` whose coefficients are polynomials in ``q``. + + EXAMPLES:: + sage: from sage.combinat.similarity_class_type import invariant_subspace_generating_function + sage: invariant_subspace_generating_function([2,2]) + t^4 + (q + 1)*t^3 + (q^2 + q + 1)*t^2 + (q + 1)*t + 1 + """ + if q is None: + q = PolynomialRing(QQ,'q').gen() + S = q.parent() + if t is None: + t = PolynomialRing(S,'t').gen() + R = t.parent() + Rff = R.fraction_field() + if len(la)==0: + return Rff(1) + else: + u = invariant_subspace_generating_function(la[1:],q=q,t=t) + return R((t**(la[0]+1)*q**(sum(la[1:]))*u.substitute(t=t/q)-u.substitute(t=t*q))/(t-1)) + + class PrimarySimilarityClassType(Element, metaclass=InheritComparisonClasscallMetaclass): r""" @@ -554,6 +599,27 @@ def centralizer_group_card(self, q=None): q = FractionField(ZZ['q']).gen() return self.statistic(centralizer_group_cardinality, q=q) + def invariant_subspace_generating_function(self,q=None,t=None): + """ + Return the invariant subspace generating function of ``self``. + + INPUT: + + - ``q`` -- an integer or an inderminate. + - ``t`` -- an indeterminate. + + EXAMPLES:: + + sage: PrimarySimilarityClassType(1,[2,2]).invariant_subspace_generating_function() + t^4 + (q + 1)*t^3 + (q^2 + q + 1)*t^2 + (q + 1)*t + 1 + """ + if q is None: + q = PolynomialRing(QQ,'q').gen() + S = q.parent() + if t is None: + t = PolynomialRing(S,'t').gen() + return invariant_subspace_generating_function(self.partition(),q=q,t=t).substitute(q=q**self.degree()).substitute(t=t**self.degree()) + class PrimarySimilarityClassTypes(UniqueRepresentation, Parent): r""" @@ -697,12 +763,18 @@ class SimilarityClassType(CombinatorialElement): INPUT: - - ``tau`` -- A list of primary similarity class types + - ``tau`` -- A list of primary similarity class types or a square matrix + over a finite field. EXAMPLES:: sage: tau1 = SimilarityClassType([[3, [3, 2, 1]], [2, [2, 1]]]); tau1 [[2, [2, 1]], [3, [3, 2, 1]]] + + EXAMPLES:: + + sage: SimilarityClassType(Matrix(GF(2), [[1,1],[0,1]])) + [[1, [2]]] """ @staticmethod def __classcall_private__(cls, tau): @@ -721,6 +793,11 @@ def __classcall_private__(cls, tau): sage: tau1 == tau2 True + The input can also be a matrix with entries in a finite field:: + + sage: SimilarityClassType(Matrix(GF(2), [[1,1],[0,1]])) + [[1, [2]]] + The parent class is the class of similarity class types of the sum of the sizes of the primary matrix types in ``tau``:: @@ -728,15 +805,28 @@ def __classcall_private__(cls, tau): sage: tau.parent().size() 24 """ - ret = [] - for l in tau: - if isinstance(l, PrimarySimilarityClassType): - ret.append(l) - else: - ret.append(PrimarySimilarityClassType(*l)) - n = sum([PT.size() for PT in ret]) - T = SimilarityClassTypes(n) - return T(tau) + if is_Matrix(tau): + n = tau.nrows() + F = tau.base_ring() + R = PolynomialRing(F,'t') + t = R.gen() + S = (t-tau).smith_form(transformation=False) + L = reversed([S[i,i] for i in range(n) if S[i,i]]) + f = [dict(list(p.factor())) for p in L] + d = dict() + for p in f[0].keys(): + d[p] = Partition([h[p] for h in f if p in h.keys()]) + return SimilarityClassType([[p.degree(), d[p]] for p in d.keys()]) + else: + ret = [] + for l in tau: + if isinstance(l, PrimarySimilarityClassType): + ret.append(l) + else: + ret.append(PrimarySimilarityClassType(*l)) + n = sum([PT.size() for PT in ret]) + T = SimilarityClassTypes(n) + return T(tau) def __init__(self, parent, tau): """ @@ -970,6 +1060,36 @@ def statistic(self, func, q=None): q = FractionField(ZZ['q']).gen() return prod([PT.statistic(func, q=q) for PT in self]) + def invariant_subspace_generating_function(self,q=None,t=None): + r""" + Return the invariant subspace generating function of ``self``. + + The invariant subspace generating function is the function is the + polynomial + + .. MATH:: + + \sum_{j\geq 0} a_j(q) t^j, + + where `a_j(q)` denotes the number of `j`-dimensional invariant subspaces + of dimensiona `j` for any matrix with the similarity class type ``self`` + with entries in a field of order `q`. + + EXAMPLES:: + + sage: SimilarityClassType([[1, [2,2]]]).invariant_subspace_generating_function() + t^4 + (q + 1)*t^3 + (q^2 + q + 1)*t^2 + (q + 1)*t + 1 + sage: A = Matrix(GF(2),[(0, 1, 0, 0), (0, 1, 1, 1), (1, 0, 1, 0), (1, 1, 0, 0)]) + sage: SimilarityClassType(A).invariant_subspace_generating_function() + t^4 + 1 + """ + if q is None: + q = PolynomialRing(QQ,'q').gen() + S = q.parent() + if t is None: + t = PolynomialRing(S,'t').gen() + return prod(p.invariant_subspace_generating_function(q=q,t=t) for p in self) + class SimilarityClassTypes(UniqueRepresentation, Parent): r""" From 9ed5b663a22a8aecd7f3a33ceb73641f967887fe Mon Sep 17 00:00:00 2001 From: Amritanshu Prasad Date: Wed, 27 Jul 2022 16:31:13 +0530 Subject: [PATCH 411/416] fixed changes suggested by Travis --- src/sage/combinat/similarity_class_type.py | 59 ++++++++++------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index ef814980139..adc640e0579 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -213,11 +213,11 @@ def fq(n, q=None): INPUT: - - ``n`` -- A non-negative integer + - ``n`` -- a non-negative integer - ``q`` -- an integer or an indeterminate - OUTPUT: + OUTPUT: A rational function in ``q``. @@ -353,14 +353,16 @@ def centralizer_group_cardinality(la, q=None): q = ZZ['q'].gen() return q**centralizer_algebra_dim(la)*prod([fq(m, q=q) for m in la.to_exp()]) -def invariant_subspace_generating_function(la,q=None,t=None): +def invariant_subspace_generating_function(la, q=None, t=None): """ Return the invariant subpace generating function of a nilpotent matrix with Jordan block sizes given by ``la``. INPUT: - ``la`` -- a partition. + - ``la`` -- a partition + - ``q`` -- (optional) an integer or an inderminate + - ``t`` -- (optional) an indeterminate OUTPUT: @@ -379,11 +381,10 @@ def invariant_subspace_generating_function(la,q=None,t=None): t = PolynomialRing(S,'t').gen() R = t.parent() Rff = R.fraction_field() - if len(la)==0: + if not la: return Rff(1) - else: - u = invariant_subspace_generating_function(la[1:],q=q,t=t) - return R((t**(la[0]+1)*q**(sum(la[1:]))*u.substitute(t=t/q)-u.substitute(t=t*q))/(t-1)) + u = invariant_subspace_generating_function(la[1:], q=q, t=t) + return R((t**(la[0]+1) * q**(sum(la[1:])) * u.substitute(t=t/q) - u.substitute(t=t*q)) / (t - 1)) class PrimarySimilarityClassType(Element, @@ -599,26 +600,26 @@ def centralizer_group_card(self, q=None): q = FractionField(ZZ['q']).gen() return self.statistic(centralizer_group_cardinality, q=q) - def invariant_subspace_generating_function(self,q=None,t=None): + def invariant_subspace_generating_function(self, q=None, t=None): """ Return the invariant subspace generating function of ``self``. INPUT: - - ``q`` -- an integer or an inderminate. - - ``t`` -- an indeterminate. + - ``q`` -- (optional) an integer or an inderminate + - ``t`` -- (optional) an indeterminate EXAMPLES:: - sage: PrimarySimilarityClassType(1,[2,2]).invariant_subspace_generating_function() + sage: PrimarySimilarityClassType(1, [2, 2]).invariant_subspace_generating_function() t^4 + (q + 1)*t^3 + (q^2 + q + 1)*t^2 + (q + 1)*t + 1 """ if q is None: - q = PolynomialRing(QQ,'q').gen() + q = PolynomialRing(QQ, 'q').gen() S = q.parent() if t is None: - t = PolynomialRing(S,'t').gen() - return invariant_subspace_generating_function(self.partition(),q=q,t=t).substitute(q=q**self.degree()).substitute(t=t**self.degree()) + t = PolynomialRing(S, 't').gen() + return invariant_subspace_generating_function(self.partition()).substitute(q=q**self.degree(), t=t**self.degree()) class PrimarySimilarityClassTypes(UniqueRepresentation, Parent): @@ -763,16 +764,14 @@ class SimilarityClassType(CombinatorialElement): INPUT: - - ``tau`` -- A list of primary similarity class types or a square matrix - over a finite field. + - ``tau`` -- a list of primary similarity class types or a square matrix + over a finite field EXAMPLES:: sage: tau1 = SimilarityClassType([[3, [3, 2, 1]], [2, [2, 1]]]); tau1 [[2, [2, 1]], [3, [3, 2, 1]]] - EXAMPLES:: - sage: SimilarityClassType(Matrix(GF(2), [[1,1],[0,1]])) [[1, [2]]] """ @@ -808,15 +807,13 @@ def __classcall_private__(cls, tau): if is_Matrix(tau): n = tau.nrows() F = tau.base_ring() - R = PolynomialRing(F,'t') + R = PolynomialRing(F, 't') t = R.gen() - S = (t-tau).smith_form(transformation=False) - L = reversed([S[i,i] for i in range(n) if S[i,i]]) + S = (t - tau).smith_form(transformation=False) + L = [S[i,i] for i in range(n-1, -1, -1) if S[i,i]] f = [dict(list(p.factor())) for p in L] - d = dict() - for p in f[0].keys(): - d[p] = Partition([h[p] for h in f if p in h.keys()]) - return SimilarityClassType([[p.degree(), d[p]] for p in d.keys()]) + d = {p: Partition([h[p] for h in f if p in h]) for p in f[0]} + return SimilarityClassType([[p.degree(), d[p]] for p in d]) else: ret = [] for l in tau: @@ -1060,7 +1057,7 @@ def statistic(self, func, q=None): q = FractionField(ZZ['q']).gen() return prod([PT.statistic(func, q=q) for PT in self]) - def invariant_subspace_generating_function(self,q=None,t=None): + def invariant_subspace_generating_function(self, q=None, t=None): r""" Return the invariant subspace generating function of ``self``. @@ -1077,18 +1074,18 @@ def invariant_subspace_generating_function(self,q=None,t=None): EXAMPLES:: - sage: SimilarityClassType([[1, [2,2]]]).invariant_subspace_generating_function() + sage: SimilarityClassType([[1, [2, 2]]]).invariant_subspace_generating_function() t^4 + (q + 1)*t^3 + (q^2 + q + 1)*t^2 + (q + 1)*t + 1 sage: A = Matrix(GF(2),[(0, 1, 0, 0), (0, 1, 1, 1), (1, 0, 1, 0), (1, 1, 0, 0)]) sage: SimilarityClassType(A).invariant_subspace_generating_function() t^4 + 1 """ if q is None: - q = PolynomialRing(QQ,'q').gen() + q = PolynomialRing(QQ, 'q').gen() S = q.parent() if t is None: - t = PolynomialRing(S,'t').gen() - return prod(p.invariant_subspace_generating_function(q=q,t=t) for p in self) + t = PolynomialRing(S, 't').gen() + return prod(p.invariant_subspace_generating_function(q=q, t=t) for p in self) class SimilarityClassTypes(UniqueRepresentation, Parent): From 5cb365a9ea51495e772c954192986b267ca7d84f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 27 Jul 2022 10:39:01 -0700 Subject: [PATCH 412/416] .github/workflows/docker.yml: Reduce NUMPROC to 4 --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 38f9bbffcc7..e9575ae8969 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -192,7 +192,7 @@ jobs: echo "EXTRA_DOCKER_TAGS=$EXTRA_DOCKER_TAGS" >> $GITHUB_ENV - name: Configure and build Sage distribution within a Docker container run: | - set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;" + set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg NUMPROC=4 --build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;" - name: Copy logs from the Docker image or build container run: | mkdir -p "artifacts/$LOGS_ARTIFACT_NAME" From 069edffadc16cae0fc2c00373ec5c593034e7743 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 27 Jul 2022 11:48:46 -0700 Subject: [PATCH 413/416] tox.ini, .github/workflows/docker.yml: Remove ubuntu-{hirsute,impish} (package repos no longer available) --- .github/workflows/docker.yml | 2 -- tox.ini | 4 ---- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e9575ae8969..23cab40539d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,8 +20,6 @@ on: "ubuntu-xenial-toolchain-gcc_9", "ubuntu-bionic", "ubuntu-focal", - "ubuntu-hirsute", - "ubuntu-impish", "ubuntu-jammy", "ubuntu-kinetic", "debian-stretch", diff --git a/tox.ini b/tox.ini index f45cf3fb94a..f3f2474604a 100644 --- a/tox.ini +++ b/tox.ini @@ -201,10 +201,6 @@ setenv = ubuntu-bionic: BASE_TAG=bionic ubuntu-bionic: IGNORE_MISSING_SYSTEM_PACKAGES=yes ubuntu-focal: BASE_TAG=focal - ubuntu-hirsute: BASE_TAG=hirsute - ubuntu-hirsute: IGNORE_MISSING_SYSTEM_PACKAGES=no - ubuntu-impish: BASE_TAG=impish - ubuntu-impish: IGNORE_MISSING_SYSTEM_PACKAGES=yes ubuntu-jammy: BASE_TAG=jammy ubuntu-jammy: IGNORE_MISSING_SYSTEM_PACKAGES=yes ubuntu-kinetic: BASE_TAG=kinetic From a3d2200413dd20996ea3018e9501f1253d2ee61b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 27 Jul 2022 11:59:40 -0700 Subject: [PATCH 414/416] .github/workflows/tox-{optional,experimental}: Remove ubuntu-{hirsute,impish} here too --- .github/workflows/tox-experimental.yml | 2 +- .github/workflows/tox-optional.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox-experimental.yml b/.github/workflows/tox-experimental.yml index 848e4f6653a..3abeec4a775 100644 --- a/.github/workflows/tox-experimental.yml +++ b/.github/workflows/tox-experimental.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false max-parallel: 6 matrix: - tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] + tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] tox_packages_factor: [maximal] targets_pattern: [0-g, h-o, p, q-z] env: diff --git a/.github/workflows/tox-optional.yml b/.github/workflows/tox-optional.yml index 17cb90a8984..72b63ef61c3 100644 --- a/.github/workflows/tox-optional.yml +++ b/.github/workflows/tox-optional.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false max-parallel: 6 matrix: - tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] + tox_system_factor: [ubuntu-trusty-toolchain-gcc_9, ubuntu-xenial-toolchain-gcc_9, ubuntu-bionic, ubuntu-focal, ubuntu-jammy, ubuntu-kinetic, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, linuxmint-21, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, fedora-37, centos-7-devtoolset-gcc_11, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386-devtoolset-gcc_11] tox_packages_factor: [maximal] targets_pattern: [0-g, h-o, p, q-z] env: From 6ba1084fbff2ddfd52ce18a8949cffbb493c444f Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Sun, 31 Jul 2022 18:43:00 +0200 Subject: [PATCH 415/416] Use fuzzy zero in doctest --- src/sage/symbolic/expression.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 56b8caeeb98..50f34aed331 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -12872,7 +12872,7 @@ cdef class Expression(Expression_abc): sage: x = var('x', domain='real') sage: s = abs((1+I*x)^4) sage: f = s._plot_fast_callable(x) - sage: f(10) == abs((I*10+1)^4) + sage: abs(f(10) - abs((I*10+1)^4)) < 1e-11 True sage: plot(s) Graphics object consisting of 1 graphics primitive From cd1e2b13afa25e5a1a26c02fb3c8085f004b541b Mon Sep 17 00:00:00 2001 From: Release Manager Date: Mon, 1 Aug 2022 22:24:15 +0200 Subject: [PATCH 416/416] Updated SageMath version to 9.7.beta7 --- .zenodo.json | 8 ++++---- VERSION.txt | 2 +- build/pkgs/configure/checksums.ini | 6 +++--- build/pkgs/configure/package-version.txt | 2 +- build/pkgs/sage_conf/install-requires.txt | 2 +- build/pkgs/sage_docbuild/install-requires.txt | 2 +- build/pkgs/sage_setup/install-requires.txt | 2 +- build/pkgs/sage_sws2rst/install-requires.txt | 2 +- build/pkgs/sagelib/install-requires.txt | 2 +- build/pkgs/sagemath_categories/install-requires.txt | 2 +- build/pkgs/sagemath_environment/install-requires.txt | 2 +- build/pkgs/sagemath_objects/install-requires.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 | 8 ++++---- src/sage/version.py | 6 +++--- 24 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 521a275f9f9..c85db074952 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.beta6", - "version": "9.7.beta6", + "title": "sagemath/sage: 9.7.beta7", + "version": "9.7.beta7", "upload_type": "software", - "publication_date": "2022-07-24", + "publication_date": "2022-08-01", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/9.7.beta6", + "identifier": "https://github.com/sagemath/sage/tree/9.7.beta7", "relation": "isSupplementTo" }, { diff --git a/VERSION.txt b/VERSION.txt index f863f2ae553..856153db3cc 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 9.7.beta6, Release Date: 2022-07-24 +SageMath version 9.7.beta7, Release Date: 2022-08-01 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index afab7685edb..5d644a9c50a 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=32693d220d5b1c5d743b33e2a5ab8b1cbd07d077 -md5=ee385184c3a968a0dcf6534c538ff25d -cksum=4278547201 +sha1=4990a91b1c7cd53d82c6f7bbfc5bef6fa8db4343 +md5=fdda24ab1c082707991f319419057d77 +cksum=640816463 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 070c6a81d59..d2c6ebac44a 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -74ea2f1b4b1eb592f2f9b1aaba35cc3bc09d5af3 +c94df557112150bfba730df6413f11cb2e467a2a diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 8ec83b2b905..0a0c5683586 100644 --- a/build/pkgs/sage_conf/install-requires.txt +++ b/build/pkgs/sage_conf/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-conf ~= 9.7b6 +sage-conf ~= 9.7b7 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index 9199fde5772..308ba619e99 100644 --- a/build/pkgs/sage_docbuild/install-requires.txt +++ b/build/pkgs/sage_docbuild/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-docbuild ~= 9.7b6 +sage-docbuild ~= 9.7b7 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index 4497f3f35a9..88513351baa 100644 --- a/build/pkgs/sage_setup/install-requires.txt +++ b/build/pkgs/sage_setup/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-setup ~= 9.7b6 +sage-setup ~= 9.7b7 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index aabd0d31807..dba96c04502 100644 --- a/build/pkgs/sage_sws2rst/install-requires.txt +++ b/build/pkgs/sage_sws2rst/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-sws2rst ~= 9.7b6 +sage-sws2rst ~= 9.7b7 diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index 35f845894d6..95b491986be 100644 --- a/build/pkgs/sagelib/install-requires.txt +++ b/build/pkgs/sagelib/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagelib ~= 9.7b6 +sagelib ~= 9.7b7 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index da1b503c697..b6bf33b366b 100644 --- a/build/pkgs/sagemath_categories/install-requires.txt +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-categories ~= 9.7b6 +sagemath-categories ~= 9.7b7 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index 1dd6c84bc68..2b0860e50e3 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-environment ~= 9.7b6 +sagemath-environment ~= 9.7b7 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index b28d0b381ca..a5e38a81da6 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-objects ~= 9.7b6 +sagemath-objects ~= 9.7b7 diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/src/VERSION.txt b/src/VERSION.txt index ec1cd2281f6..126f83659f2 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -9.7.beta6 +9.7.beta7 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index 33a79c5a046..a2e6977f9c6 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -1,9 +1,9 @@ -# Sage version information for shell scripts. The following line is valid shell code +# Sage version information for shell scripts. # # #31049: The following line is valid shell code but not valid Python code, # which stops "setup.py develop" from rewriting it as a Python file. : # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='9.7.beta6' -SAGE_RELEASE_DATE='2022-07-24' -SAGE_VERSION_BANNER='SageMath version 9.7.beta6, Release Date: 2022-07-24' +SAGE_VERSION='9.7.beta7' +SAGE_RELEASE_DATE='2022-08-01' +SAGE_VERSION_BANNER='SageMath version 9.7.beta7, Release Date: 2022-08-01' diff --git a/src/sage/version.py b/src/sage/version.py index d7d504505d1..79214ce3e4d 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.beta6' -date = '2022-07-24' -banner = 'SageMath version 9.7.beta6, Release Date: 2022-07-24' +version = '9.7.beta7' +date = '2022-08-01' +banner = 'SageMath version 9.7.beta7, Release Date: 2022-08-01'