diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8e901d82af..d214d952f6f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,11 +29,13 @@ 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 install -y git python3-venv # Reuse built SAGE_LOCAL contained in the Docker image ./bootstrap ./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv --enable-editable --enable-download-from-upstream-url - # Install test tools - apt-get install -y git - name: Static code check with pyright run: pyright @@ -44,6 +46,16 @@ jobs: MAKE: make -j2 SAGE_NUM_THREADS: 2 + - name: Pytest + if: contains(github.ref, 'pytest') + run: | + ../sage -python -m pip install coverage pytest-xdist + ../sage -python -m coverage run -m pytest -c tox.ini --doctest-modules || true + working-directory: ./src + env: + # Increase the length of the lines in the "short summary" + COLUMNS: 120 + - name: Test run: | ../sage -python -m pip install coverage diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 32cab1e0ffb..32495956209 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -24,6 +24,7 @@ jobs: # Reuse built SAGE_LOCAL contained in the Docker image ./bootstrap ./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv --enable-download-from-upstream-url + make furo - name: Build run: make doc-html diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index beb4e91a027..bb3f4186d07 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false max-parallel: 20 matrix: - tox_system_factor: [gitpod, ubuntu-trusty, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, centos-7, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, slackware-14.2, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386] + tox_system_factor: [ubuntu-trusty, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-hirsute, ubuntu-impish, ubuntu-jammy, debian-stretch, debian-buster, debian-bullseye, debian-bookworm, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, linuxmint-20.1, linuxmint-20.2, linuxmint-20.3, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, fedora-33, fedora-34, fedora-35, fedora-36, centos-7, centos-stream-8, gentoo-python3.9, gentoo-python3.10, archlinux-latest, opensuse-15.3, opensuse-tumbleweed, slackware-14.2, conda-forge, ubuntu-bionic-i386, manylinux-2_24-i686, debian-buster-i386, centos-7-i386] tox_packages_factor: [minimal, standard] env: TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }} diff --git a/.gitignore b/.gitignore index 84c0c28eca8..1c92edd7e12 100644 --- a/.gitignore +++ b/.gitignore @@ -166,10 +166,16 @@ build/bin/sage-build-env-config /pkgs/sagemath-objects/setup.cfg /pkgs/sagemath-categories/setup.cfg +/pkgs/sagemath-environment/setup.cfg +/pkgs/sagemath-repl/setup.cfg /pkgs/sagemath-objects/pyproject.toml /pkgs/sagemath-categories/pyproject.toml +/pkgs/sagemath-environment/pyproject.toml +/pkgs/sagemath-repl/pyproject.toml /pkgs/sagemath-objects/requirements.txt /pkgs/sagemath-categories/requirements.txt +/pkgs/sagemath-environment/requirements.txt +/pkgs/sagemath-repl/requirements.txt /pkgs/sagemath-categories/MANIFEST.in # same for old locations - before Trac #31577 diff --git a/.gitpod.yml b/.gitpod.yml index f57b047b8e1..6017bd072e8 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,41 +1,32 @@ # Use custom docker image. https://www.gitpod.io/docs/config-docker image: -# Each of these two options works: -# - Directly use the "-with-targets" image built by .github/workflows/tox.yml -# image: ghcr.io/sagemath/sage/sage-docker-gitpod-standard-with-targets:dev -# - or go through a custom Dockerfile, which builds a smaller image -# based on the "-with-system-packages" image built by .github/workflows/tox.yml -# with the built SAGE_LOCAL from the "-with-targets" image copied in. - file: docker/.gitpod.Dockerfile - -# We use the following layout: -# -# $HOME/sage Source tree used by the Docker build; see SAGE_ROOT/tox.ini (gitpod). -# - We delete it in every invocation of the 'before' script -# and replace it by a symlink to /workspace/... -# (This symlink is needed because the package-removal scripts -# ({prefix,venv}/var/lib/sage/scripts/*/{spkg-piprm,spkg-prerm,spkg-postrm) -# hardcode SAGE_ROOT and SAGE_SRC from package installation time) -# $HOME/sage/logs Logs of the Docker build. -# - In the first invocation of the 'before' script, we move it -# to /workspace/.../logs -# $HOME/sage-local The configured prefix (SAGE_LOCAL) of the Sage installation. -# - During the Docker build, this is the physical location. -# - In the first invocation of the 'before' script, we move it -# to the new physical location /workspace/.../local -# (because gitpod only preserves the contents of /workspace) -# and replace it by a symlink to the new physical location. -# - In subsequent invocations of the 'before' script, we -# remove it and replace it by a symlink to the physical -# location /workspace/.../local -# /worktree/.../local The physical location of the Sage installation, -# established in the first run of the 'before' script and -# preserved by gitpod. + file: docker/.gitpod.Dockerfile # Start up tasks. https://www.gitpod.io/docs/config-start-tasks/ tasks: - name: Setup - before: | + init: | + # Create conda environment + ./bootstrap-conda + mamba env create --file src/environment-dev.yml --prefix venv + conda config --append envs_dirs /workspace/sagetrac-mirror + conda activate /workspace/sagetrac-mirror/venv + + # Build sage + ./bootstrap + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX + pip install --no-build-isolation -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup + pip install --no-build-isolation -v -v -e ./src + + command: | + # Activate conda environment + conda config --append envs_dirs /workspace/sagetrac-mirror + conda activate /workspace/sagetrac-mirror/venv + + # RestructuredText extension recommends python extension, although we have already installed it + ## So disable the recommendation dialog + echo "{\"restructuredtext.pythonRecommendation.disabled\": true}" > /workspace/.vscode-remote/data/Machine/settings.json + # Setup trac as remote ## In order to push to trac, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$( ~/.ssh/id_rsa sed -i '/^$/d' ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - unset PRIVATE_SSH_KEY + echo "PubkeyAcceptedKeyTypes +ssh-rsa" > ~/.ssh/config ssh-keyscan -H trac.sagemath.org >> ~/.ssh/known_hosts # Setup trac repo @@ -60,43 +51,7 @@ tasks: git remote add trac https://github.com/sagemath/sagetrac-mirror.git -t master -t develop git remote set-url --push trac pushing-needs-ssh-key fi - - ## No need for pyenv - pyenv shell --unset 2> /dev/null - pyenv global system 2> /dev/null - if [ -d local ]; then - mkdir -p logs && echo '### .gitpod.yml Setup.before: Prebuild init script has been run. Running "make" again in case the build had timed out.' >> logs/install.log - # The init script has already populated the SAGE_LOCAL, - # but only /workspace is preserved; and the $HOME/sage-local may contain a resurrected - # copy of sage-local. Replace it again by a symlink. - rm -Rf $HOME/sage-local - ln -sf $(pwd)/local $HOME/sage-local - # Now run make. No timeout here. - MAKE='make -j24' make build V=0 - else - # Prebuild init script has not been run - # Only /workspace is preserved during build. - # If the Docker image contains a built SAGE_LOCAL, use it to populate the SAGE_LOCAL in the workspace. - if [ -d $HOME/sage-local ]; then - mv $HOME/sage-local local - fi - rm -Rf $HOME/sage-local - ln -sf $(pwd)/local $HOME/sage-local - # Save the logs of the source tree used by the Docker build - if [ -d $HOME/sage/logs ]; then - mv $HOME/sage/logs logs - fi - fi - # Remove the source tree used by the Docker build and replace it by a symlink - rm -Rf $HOME/sage - ln -s $(pwd) $HOME/sage - init: | - # Start build - mkdir -p logs && echo '### .gitpod.yml Setup.init: Starting build' >> logs/install.log - ./bootstrap - ./configure --enable-editable --enable-download-from-upstream-url --prefix=$HOME/sage-local --with-sage-venv - ## Gitpod has a timeout of 1h, so make sure we are below this to ensure that the prebuild is always successful - MAKE='make -j24' timeout 51m make build V=0 || echo "(ignoring error)" + env: SAGE_NUM_THREADS: 8 @@ -109,6 +64,8 @@ vscode: - lextudio.restructuredtext - streetsidesoftware.code-spell-checker - ms-toolsai.jupyter + - ms-toolsai.jupyter-keymap + - ms-toolsai.jupyter-renderers # https://www.gitpod.io/docs/prebuilds#github-specific-configuration github: diff --git a/.vscode/settings.json b/.vscode/settings.json index d63271ab85c..cb06559edea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,10 @@ "--doctest-modules", ], "python.testing.unittestEnabled": false, + "python.linting.pycodestyleEnabled": true, + "python.linting.enabled": true, "cSpell.words": [ + "furo" "Conda", "Cython" ], diff --git a/.zenodo.json b/.zenodo.json index be408937a6f..f05573e690c 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,10 +1,10 @@ { "description": "Mirror of the Sage https://sagemath.org/ source tree", "license": "other-open", - "title": "sagemath/sage: 9.7.beta1", - "version": "9.7.beta1", + "title": "sagemath/sage: 9.7.beta2", + "version": "9.7.beta2", "upload_type": "software", - "publication_date": "2022-05-26", + "publication_date": "2022-06-12", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/9.7.beta1", + "identifier": "https://github.com/sagemath/sage/tree/9.7.beta2", "relation": "isSupplementTo" }, { diff --git a/Makefile b/Makefile index a9290e54b70..2c779f3f772 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,8 @@ pypi-sdists: sage_setup ./sage --sh build/pkgs/sagelib/spkg-src ./sage --sh build/pkgs/sagemath_objects/spkg-src ./sage --sh build/pkgs/sagemath_categories/spkg-src + ./sage --sh build/pkgs/sagemath_environment/spkg-src + ./sage --sh build/pkgs/sagemath_repl/spkg-src @echo "Built sdists are in upstream/" # ssl: build Sage, and also install pyOpenSSL. This is necessary for @@ -168,7 +170,6 @@ bootstrap-clean: rm -rf config configure build/make/Makefile-auto.in rm -f src/doc/en/installation/*.txt rm -rf src/doc/en/reference/spkg/*.rst - rm -f src/doc/en/reference/repl/*.txt rm -f environment.yml rm -f src/environment.yml rm -f src/environment-dev.yml diff --git a/README.md b/README.md index ae7f22e225b..a145ae872b9 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ in the Installation Guide. ``ExtUtils::MakeMaker``), `ranlib`, `git`, `tar`, `bc`. - Python 3.4 or later, or Python 2.7, a full installation including - `urllib`; but ideally version 3.7.x, 3.8.x, 3.9.x, or 3.10.x, which + `urllib`; but ideally version 3.8.x, 3.9.x, or 3.10.x, which will avoid having to build Sage's own copy of Python 3. We have collected lists of system packages that provide these build diff --git a/VERSION.txt b/VERSION.txt index 8cb99453ed0..8f5b1728548 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 9.7.beta1, Release Date: 2022-05-26 +SageMath version 9.7.beta2, Release Date: 2022-06-12 diff --git a/bootstrap b/bootstrap index d059afc0482..4d7021c4823 100755 --- a/bootstrap +++ b/bootstrap @@ -85,12 +85,12 @@ bootstrap () { rm -f m4/sage_spkg_configures.m4 spkg_configures="" # initialize SAGE_ENABLE... options for standard packages - for pkgname in $(./sage --package list :standard: | sort); do + for pkgname in $(sage-package list :standard: | sort); do spkg_configures="$spkg_configures AS_VAR_SET_IF([SAGE_ENABLE_$pkgname], [], [AS_VAR_SET([SAGE_ENABLE_$pkgname], [yes])])" done # --enable-SPKG options - for pkgname in $(./sage --package list :optional: :experimental: | sort); do + for pkgname in $(sage-package list :optional: :experimental: | sort); do # Trac #29629: Temporary solution for Sage 9.1: Do not provide # --enable-SPKG options for installing pip packages if [ ! -f build/pkgs/$pkgname/requirements.txt ]; then @@ -109,12 +109,12 @@ SAGE_SPKG_ENABLE([$pkgname], [$pkgtype], [$(grep -v ^= build/pkgs/$pkgname/SPKG. esac fi done - for pkgname in $(./sage --package list --has-file spkg-configure.m4 | sort); do + for pkgname in $(sage-package list --has-file spkg-configure.m4 | sort); do echo "m4_sinclude([build/pkgs/$pkgname/spkg-configure.m4])" spkg_configures="$spkg_configures SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')" done >> m4/sage_spkg_configures.m4 - for pkgname in $(./sage --package list | sort); do + for pkgname in $(sage-package list | sort); do DIR=build/pkgs/$pkgname pkgtype="$(cat $DIR/type)" if test -f "$DIR/requirements.txt"; then @@ -143,7 +143,7 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" done echo "$spkg_configures" >> m4/sage_spkg_configures.m4 - for pkgname in $(./sage --package list --has-file bootstrap); do + for pkgname in $(sage-package list --has-file bootstrap); do (cd build/pkgs/$pkgname && ./bootstrap) || exit 1 done @@ -247,7 +247,6 @@ save () { build/make/Makefile-auto.in \ src/doc/en/installation/*.txt \ src/doc/en/reference/spkg/*.rst \ - src/doc/en/reference/repl/*.txt \ environment.yml \ src/environment.yml \ environment-optional.yml \ @@ -262,10 +261,10 @@ save () { # Compute checksum if [ "${BOOTSTRAP_QUIET}" = "no" ]; then - ./sage --package fix-checksum configure + sage-package fix-checksum configure else # Hide the "Updating checksum..." message - ./sage --package fix-checksum configure > /dev/null + sage-package fix-checksum configure > /dev/null fi } diff --git a/bootstrap-conda b/bootstrap-conda index 356c621895b..6638afde3d7 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -4,6 +4,8 @@ # Generate auto-generated conda environment files ######################################################################### +export PATH="$(pwd)/build/bin:$PATH" + STRIP_COMMENTS="sed s/#.*//;" RECOMMENDED_SPKG_PATTERN="@(_recommended$(for a in $(head -n 1 build/pkgs/_recommended/dependencies); do echo -n "|"$a; done))" @@ -13,7 +15,7 @@ OPTIONAL_SYSTEM_PACKAGES= SAGELIB_SYSTEM_PACKAGES= SAGELIB_OPTIONAL_SYSTEM_PACKAGES= RECOMMENDED_SYSTEM_PACKAGES= -for PKG_BASE in $(./sage --package list --has-file distros/conda.txt); do +for PKG_BASE in $(sage-package list --has-file distros/conda.txt); do PKG_SCRIPTS=build/pkgs/$PKG_BASE SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/conda.txt PKG_TYPE=$(cat $PKG_SCRIPTS/type) @@ -65,6 +67,7 @@ echo " # Additional dev tools" >> src/environment-dev.yml echo " - openssh" >> src/environment-dev.yml echo " - pycodestyle" >> src/environment-dev.yml echo " - pytest" >> src/environment-dev.yml +echo " - esbonio" >> src/environment-dev.yml cp environment.yml environment-optional.yml echo " # optional packages" >> environment-optional.yml diff --git a/build/bin/sage-bootstrap-python b/build/bin/sage-bootstrap-python index 38ceeca0f29..f78e5e62a1d 100755 --- a/build/bin/sage-bootstrap-python +++ b/build/bin/sage-bootstrap-python @@ -11,7 +11,17 @@ if [ -z "$SAGE_ORIG_PATH" ]; then # If not we're running from within sage-env just set the existing path SAGE_ORIG_PATH="$PATH" fi - +IFS=':' +NEW_PATH="" +for path in $SAGE_ORIG_PATH +do + case "$path" in + */.pyenv/shims*);; + *) NEW_PATH="$NEW_PATH$path:";; + esac +done +unset IFS +SAGE_ORIG_PATH=${NEW_PATH%%':'} # In particular, it is invoked by "bootstrap -d" for sage-download-file, # i.e., before a configure run, and by "sage-spkg", also for sage-download-file. # So it needs to find a python that has the urllib module. diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 3b6e2621d71..5e762084183 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -22,6 +22,37 @@ if [ -r "$PKG_SCRIPTS/type" ] ; then echo fi echo +echo "Dependencies" +echo "------------" +echo +dep= +for dep_file in dependencies dependencies_order_only; do + if [ -r "$PKG_SCRIPTS/$dep_file" ] ; then + for dep in $(sed 's/^ *//; s/ *#.*//; q' "$PKG_SCRIPTS/$dep_file"); do + case "$dep" in + # Do not use order-only syntax, too much information + \|) ;; + # Suppress dependencies on source file of the form $(SAGE_ROOT)/..., $(SAGE_SRC)/... + \$\(SAGE_*) ;; + # Suppress FORCE + FORCE) ;; + # Dependencies like $(BLAS) + \$\(*) echo "- $dep";; + # Looks like a package + *) if [ -n "$OUTPUT_RST" -a -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then + # This RST label is set in src/doc/bootstrap + echo "- :ref:\`spkg_$dep\`" + else + echo "- $dep" + fi;; + esac + done + fi +done +if [ -z "$dep" ]; then + echo "None" +fi +echo echo "Version Information" echo "-------------------" echo @@ -56,6 +87,7 @@ done if [ $have_repology = yes ]; then systems="$systems repology" fi +system= for system in $systems; do system_package_file="$PKG_DISTROS"/$system.txt system_packages="$(echo $(sed 's/#.*//;' $system_package_file))" diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 4e2f891d506..752a9c26f58 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -207,7 +207,7 @@ FROM with-system-packages as bootstrapped #:bootstrapping: RUN mkdir -p sage WORKDIR sage -$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./ +$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./ $ADD src/doc/bootstrap src/doc/bootstrap $ADD src/bin src/bin $ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/setup.cfg.m4 src/ diff --git a/build/pkgs/4ti2/SPKG.rst b/build/pkgs/4ti2/SPKG.rst index 8b13ac91bcb..1a3a5e5c9c4 100644 --- a/build/pkgs/4ti2/SPKG.rst +++ b/build/pkgs/4ti2/SPKG.rst @@ -20,8 +20,3 @@ Upstream Contact - Raymond Hemmecke, TU Munich, Germany - Matthias Köppe, UC Davis, CA, USA - -Dependencies ------------- - -GLPK, GMP. diff --git a/build/pkgs/4ti2/dependencies b/build/pkgs/4ti2/dependencies index 2b36820a7c5..72c4505b110 100644 --- a/build/pkgs/4ti2/dependencies +++ b/build/pkgs/4ti2/dependencies @@ -2,4 +2,3 @@ zlib $(MP_LIBRARY) glpk ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/alabaster/dependencies b/build/pkgs/alabaster/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/alabaster/dependencies +++ b/build/pkgs/alabaster/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/appnope/dependencies b/build/pkgs/appnope/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/appnope/dependencies +++ b/build/pkgs/appnope/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/arb/dependencies b/build/pkgs/arb/dependencies index 09c8e56f94a..c95d2836ce5 100644 --- a/build/pkgs/arb/dependencies +++ b/build/pkgs/arb/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr flint ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/attrs/SPKG.rst b/build/pkgs/attrs/SPKG.rst index 12e3ed868e5..8f25e11d68f 100644 --- a/build/pkgs/attrs/SPKG.rst +++ b/build/pkgs/attrs/SPKG.rst @@ -18,8 +18,3 @@ Upstream Contact ---------------- Home page: https://www.attrs.org - -Dependencies ------------- - -Python diff --git a/build/pkgs/attrs/dependencies b/build/pkgs/attrs/dependencies index 8b3637a0a0e..4361e46ddaf 100644 --- a/build/pkgs/attrs/dependencies +++ b/build/pkgs/attrs/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/awali/SPKG.rst b/build/pkgs/awali/SPKG.rst index 845e3dda372..117b27010ed 100644 --- a/build/pkgs/awali/SPKG.rst +++ b/build/pkgs/awali/SPKG.rst @@ -28,16 +28,5 @@ Upstream Contact Dependencies ------------ -- Python -- CMake -- Cython -- ncurses - - graphviz must be installed from your distro, and available in the path. - - -Special Update/Build Instructions ---------------------------------- - -- None diff --git a/build/pkgs/awali/dependencies b/build/pkgs/awali/dependencies index ad153b34f3e..b125e2ded92 100644 --- a/build/pkgs/awali/dependencies +++ b/build/pkgs/awali/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cmake cython nbconvert ncurses ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/babel/dependencies b/build/pkgs/babel/dependencies index 2fabe3177df..41462907c20 100644 --- a/build/pkgs/babel/dependencies +++ b/build/pkgs/babel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pytz ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/backcall/dependencies b/build/pkgs/backcall/dependencies index 35228f20368..902a5feed13 100644 --- a/build/pkgs/backcall/dependencies +++ b/build/pkgs/backcall/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) flit_core tomli ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/barvinok/dependencies b/build/pkgs/barvinok/dependencies index e564790ea88..02d761438ff 100644 --- a/build/pkgs/barvinok/dependencies +++ b/build/pkgs/barvinok/dependencies @@ -2,4 +2,3 @@ ntl isl polylib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/benzene/SPKG.rst b/build/pkgs/benzene/SPKG.rst index 9a31276399b..6dd94f0bb7e 100644 --- a/build/pkgs/benzene/SPKG.rst +++ b/build/pkgs/benzene/SPKG.rst @@ -24,8 +24,3 @@ version was adapted by Gunnar Brinkmann and Nico Van Cleemput for Grinvin. http://www.grinvin.org/ - -Dependencies ------------- - -- None diff --git a/build/pkgs/bleach/SPKG.rst b/build/pkgs/bleach/SPKG.rst index 688e9214eda..f7a1b5ecc64 100644 --- a/build/pkgs/bleach/SPKG.rst +++ b/build/pkgs/bleach/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact ---------------- Home Page: https://github.com/mozilla/bleach - -Dependencies ------------- - -Python, html5lib, six diff --git a/build/pkgs/bleach/dependencies b/build/pkgs/bleach/dependencies index 7b139dc904c..4a74f9bfd68 100644 --- a/build/pkgs/bleach/dependencies +++ b/build/pkgs/bleach/dependencies @@ -1,5 +1,4 @@ -$(PYTHON) packaging six | $(PYTHON_TOOLCHAIN) +$(PYTHON) packaging six webencodings | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/bliss/SPKG.rst b/build/pkgs/bliss/SPKG.rst index 236b87a1990..875bc39a2df 100644 --- a/build/pkgs/bliss/SPKG.rst +++ b/build/pkgs/bliss/SPKG.rst @@ -24,8 +24,3 @@ We apply patches generated from https://github.com/mkoeppe/bliss (branch apply_debian_patches) as our upstream. This tracks the patches from the Debian package, adding an autotools build system and adjusting the include file locations. - -Dependencies ------------- - -None diff --git a/build/pkgs/bliss/dependencies b/build/pkgs/bliss/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/bliss/dependencies +++ b/build/pkgs/bliss/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/boost_cropped/SPKG.rst b/build/pkgs/boost_cropped/SPKG.rst index 2aa8d4992a1..4efa07ea966 100644 --- a/build/pkgs/boost_cropped/SPKG.rst +++ b/build/pkgs/boost_cropped/SPKG.rst @@ -31,8 +31,3 @@ Upstream Contact Website: http://www.boost.org/ See mailing list page at http://www.boost.org/community/groups.html - -Dependencies ------------- - -None diff --git a/build/pkgs/boost_cropped/dependencies b/build/pkgs/boost_cropped/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/boost_cropped/dependencies +++ b/build/pkgs/boost_cropped/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/brial/dependencies b/build/pkgs/brial/dependencies index 1944cbeb530..fdc17b08c96 100644 --- a/build/pkgs/brial/dependencies +++ b/build/pkgs/brial/dependencies @@ -2,4 +2,3 @@ boost_cropped m4ri libpng | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/buckygen/SPKG.rst b/build/pkgs/buckygen/SPKG.rst index b522376e3c7..63a9dbef355 100644 --- a/build/pkgs/buckygen/SPKG.rst +++ b/build/pkgs/buckygen/SPKG.rst @@ -22,8 +22,3 @@ Buckygen was mainly written by Jan Goedgebeur, jan.goedgebeur[at]ugent.be. http://caagt.ugent.be/buckygen/ - -Dependencies ------------- - -- None diff --git a/build/pkgs/buckygen/dependencies b/build/pkgs/buckygen/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/buckygen/dependencies +++ b/build/pkgs/buckygen/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/bzip2/SPKG.rst b/build/pkgs/bzip2/SPKG.rst index 30b3de98ac5..6aa6cda65b6 100644 --- a/build/pkgs/bzip2/SPKG.rst +++ b/build/pkgs/bzip2/SPKG.rst @@ -23,12 +23,6 @@ Upstream Contact - Website http://bzip.org/ - Author: Julian Seward -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/bzip2/dependencies b/build/pkgs/bzip2/dependencies index dae4f925522..5598eb21a8b 100644 --- a/build/pkgs/bzip2/dependencies +++ b/build/pkgs/bzip2/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cbc/dependencies b/build/pkgs/cbc/dependencies index 7137ee6f521..bdec3fbe76e 100644 --- a/build/pkgs/cbc/dependencies +++ b/build/pkgs/cbc/dependencies @@ -2,4 +2,3 @@ readline zlib bzip2 $(BLAS) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ccache/dependencies b/build/pkgs/ccache/dependencies index 4c0aa5c0d31..a1eb8a80d3d 100644 --- a/build/pkgs/ccache/dependencies +++ b/build/pkgs/ccache/dependencies @@ -2,4 +2,3 @@ zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cddlib/dependencies b/build/pkgs/cddlib/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/cddlib/dependencies +++ b/build/pkgs/cddlib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/certifi/SPKG.rst b/build/pkgs/certifi/SPKG.rst index 222b3923976..3b06f9d655c 100644 --- a/build/pkgs/certifi/SPKG.rst +++ b/build/pkgs/certifi/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact ---------------- Home page: https://pypi.python.org/pypi/certifi - -Dependencies ------------- - -Python, Setuptools diff --git a/build/pkgs/certifi/dependencies b/build/pkgs/certifi/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/certifi/dependencies +++ b/build/pkgs/certifi/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cffi/dependencies b/build/pkgs/cffi/dependencies index aef34bf5a4d..9e4c266ad69 100644 --- a/build/pkgs/cffi/dependencies +++ b/build/pkgs/cffi/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pycparser ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cliquer/SPKG.rst b/build/pkgs/cliquer/SPKG.rst index 9c0a7e25687..270e001ee6d 100644 --- a/build/pkgs/cliquer/SPKG.rst +++ b/build/pkgs/cliquer/SPKG.rst @@ -22,11 +22,6 @@ Cliquer was mainly written by Sampo Niskanen, sampo.niskanenQiki.fi https://users.aalto.fi/~pat/cliquer.html -Dependencies ------------- - -- None - Patches ------- diff --git a/build/pkgs/cliquer/dependencies b/build/pkgs/cliquer/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/cliquer/dependencies +++ b/build/pkgs/cliquer/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cmake/SPKG.rst b/build/pkgs/cmake/SPKG.rst index 0cc5039b297..33eeabf7367 100644 --- a/build/pkgs/cmake/SPKG.rst +++ b/build/pkgs/cmake/SPKG.rst @@ -27,11 +27,3 @@ Upstream Contact - https://cmake.org/ - cmake-developers@cmake.org - -Dependencies ------------- - -- curl -- zlib -- bzip2 -- xz diff --git a/build/pkgs/cmake/dependencies b/build/pkgs/cmake/dependencies index 2b79396e60e..614b742ab6d 100644 --- a/build/pkgs/cmake/dependencies +++ b/build/pkgs/cmake/dependencies @@ -2,4 +2,3 @@ curl zlib bzip2 liblzma ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cocoalib/dependencies b/build/pkgs/cocoalib/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/cocoalib/dependencies +++ b/build/pkgs/cocoalib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/combinatorial_designs/SPKG.rst b/build/pkgs/combinatorial_designs/SPKG.rst index 0f2c0fbb687..f6ebb33642f 100644 --- a/build/pkgs/combinatorial_designs/SPKG.rst +++ b/build/pkgs/combinatorial_designs/SPKG.rst @@ -19,8 +19,3 @@ Upstream Contact ---------------- None - -Dependencies ------------- - -N/A diff --git a/build/pkgs/combinatorial_designs/dependencies b/build/pkgs/combinatorial_designs/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/combinatorial_designs/dependencies +++ b/build/pkgs/combinatorial_designs/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/configure/SPKG.rst b/build/pkgs/configure/SPKG.rst index 29846d5e379..6b1365806d0 100644 --- a/build/pkgs/configure/SPKG.rst +++ b/build/pkgs/configure/SPKG.rst @@ -20,12 +20,6 @@ Upstream Contact Automatically generated by Sage, use trac and/or sage-devel for questions. -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index ef64036305b..1bc9808428d 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=e147a1128d59e97feef980eb3847798d1838565b -md5=134802b2602846ef70dba2d0740be18c -cksum=2068092591 +sha1=fee64e7ae45bcfd9bfa1c55605a579f49b19057e +md5=42d9e4a2308a8c01f4e68f3915c3b856 +cksum=3408158874 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 8f33ed65cfa..d45eb7f9401 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -8501c7398215556ff4a4c8b05c6699949c8dfca3 +b95c1659af1d26926ddf421d28b2d1f76dbc4810 diff --git a/build/pkgs/conway_polynomials/SPKG.rst b/build/pkgs/conway_polynomials/SPKG.rst index f3673e36f12..64a5bad04df 100644 --- a/build/pkgs/conway_polynomials/SPKG.rst +++ b/build/pkgs/conway_polynomials/SPKG.rst @@ -6,11 +6,6 @@ Description Frank Lübeck's tables of Conway polynomials over finite fields. -Dependencies ------------- - -- Sage library - Upstream contact ---------------- diff --git a/build/pkgs/conway_polynomials/dependencies b/build/pkgs/conway_polynomials/dependencies index 304d0c987a2..1700e743d59 100644 --- a/build/pkgs/conway_polynomials/dependencies +++ b/build/pkgs/conway_polynomials/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/coxeter3/SPKG.rst b/build/pkgs/coxeter3/SPKG.rst index fa546b079d2..6efb3da16a2 100644 --- a/build/pkgs/coxeter3/SPKG.rst +++ b/build/pkgs/coxeter3/SPKG.rst @@ -37,12 +37,6 @@ Alas, Fokko Ducloux passed away in 2006. http://math.univ-lyon1.fr/~ducloux/du_Cloux.html -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/cppy/dependencies b/build/pkgs/cppy/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/cppy/dependencies +++ b/build/pkgs/cppy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cryptominisat/dependencies b/build/pkgs/cryptominisat/dependencies index 18f1811f305..15e88888b6d 100644 --- a/build/pkgs/cryptominisat/dependencies +++ b/build/pkgs/cryptominisat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) m4ri zlib libpng | cmake boost_cropped ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/csdp/SPKG.rst b/build/pkgs/csdp/SPKG.rst index a6776483533..b65b9305e66 100644 --- a/build/pkgs/csdp/SPKG.rst +++ b/build/pkgs/csdp/SPKG.rst @@ -19,10 +19,6 @@ Upstream Contact Dmitrii Pasechnik -Dependencies ------------- - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/csdp/dependencies b/build/pkgs/csdp/dependencies index 052eb4373db..40ad3c0e9b6 100644 --- a/build/pkgs/csdp/dependencies +++ b/build/pkgs/csdp/dependencies @@ -2,4 +2,3 @@ $(BLAS) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/curl/SPKG.rst b/build/pkgs/curl/SPKG.rst index d19345aca4f..33fac1d71e9 100644 --- a/build/pkgs/curl/SPKG.rst +++ b/build/pkgs/curl/SPKG.rst @@ -18,14 +18,3 @@ Upstream Contact According to the file README at the root of the tarball, contact is done by mailing https://curl.haxx.se/mail/ - -Dependencies ------------- - -None listed. - - -Special Update/Build Instructions ---------------------------------- - -None. diff --git a/build/pkgs/curl/dependencies b/build/pkgs/curl/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/curl/dependencies +++ b/build/pkgs/curl/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cvxopt/SPKG.rst b/build/pkgs/cvxopt/SPKG.rst index 1bb5f3813ae..0730481d997 100644 --- a/build/pkgs/cvxopt/SPKG.rst +++ b/build/pkgs/cvxopt/SPKG.rst @@ -27,30 +27,3 @@ License GPLv3 or later. Includes parts under GPLv2, GNU Lesser General Public License, v2.1. See src/LICENSE for more details. (Sage-compatible) - -Dependencies ------------- - -- GNU patch -- GSL -- GLPK - - -Special Update/Build Instructions ---------------------------------- - -- cvxopt.h.patch: Fix building with GCC on Solaris. - -- setup.py.patch: look for libraries and includes in $SAGE_LOCAL - instead of /usr. Add fortran, blas,... libraries if needed. - Build with GSL and GLPK support. - -- remove doc/html/, as it can be rebuild by invoking 'sage -sh' and - running 'make html' in doc/ - -- TODO: Add more tests in spkg-check - -- TODO: one might want to enhance the code to allow other Sage - random sources, at the moment only GSL is used in CVXOPT-1.1.3 - spkg, apparently it will need an unclear to me "with seed(..)" - construct. diff --git a/build/pkgs/cvxopt/dependencies b/build/pkgs/cvxopt/dependencies index 2354fdb1c1e..d47ae01f215 100644 --- a/build/pkgs/cvxopt/dependencies +++ b/build/pkgs/cvxopt/dependencies @@ -1,7 +1,4 @@ -$(PYTHON) numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig matplotlib $(and $(filter-out no,$(SAGE_CHECK_cvxopt)), pytest) - -matplotlib is needed to test cvxopt (i.e., if SAGE_CHECK=yes). See #12742. +$(PYTHON) numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cvxopt/dependencies_check b/build/pkgs/cvxopt/dependencies_check new file mode 100644 index 00000000000..68469b0ce91 --- /dev/null +++ b/build/pkgs/cvxopt/dependencies_check @@ -0,0 +1,5 @@ +matplotlib pytest + +# matplotlib is needed to test cvxopt (i.e., if SAGE_CHECK=yes). See #12742. +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/cycler/SPKG.rst b/build/pkgs/cycler/SPKG.rst index 93cbed9e199..750580f9869 100644 --- a/build/pkgs/cycler/SPKG.rst +++ b/build/pkgs/cycler/SPKG.rst @@ -20,10 +20,3 @@ cycler is developed on github: https://github.com/matplotlib/cycler A more informative webpage about cycler, its motivation and usage is at http://tacaswell.github.io/cycler/ - -Dependencies ------------- - -- python -- setuptools -- six diff --git a/build/pkgs/cycler/dependencies b/build/pkgs/cycler/dependencies index fd848c100a8..730af09b339 100644 --- a/build/pkgs/cycler/dependencies +++ b/build/pkgs/cycler/dependencies @@ -1,5 +1,4 @@ $(PYTHON) six | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cypari/SPKG.rst b/build/pkgs/cypari/SPKG.rst index f9473ab6206..0dd0ee8b31f 100644 --- a/build/pkgs/cypari/SPKG.rst +++ b/build/pkgs/cypari/SPKG.rst @@ -16,11 +16,3 @@ Upstream Contact ---------------- https://github.com/defeo/cypari2 - -Dependencies ------------- - -- Python -- Cython -- PARI -- cysignals diff --git a/build/pkgs/cypari/dependencies b/build/pkgs/cypari/dependencies index 3f04dd2b8f3..72b5af7ad81 100644 --- a/build/pkgs/cypari/dependencies +++ b/build/pkgs/cypari/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython pari cysignals | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cysignals/SPKG.rst b/build/pkgs/cysignals/SPKG.rst index e866501cb1d..0329da8193b 100644 --- a/build/pkgs/cysignals/SPKG.rst +++ b/build/pkgs/cysignals/SPKG.rst @@ -17,9 +17,3 @@ Upstream Contact https://github.com/sagemath/cysignals -Dependencies ------------- - -- Python -- Cython -- PARI (optional) diff --git a/build/pkgs/cysignals/dependencies b/build/pkgs/cysignals/dependencies index 19bc31a739c..d3225d480f1 100644 --- a/build/pkgs/cysignals/dependencies +++ b/build/pkgs/cysignals/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython pari | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/cython/SPKG.rst b/build/pkgs/cython/SPKG.rst index e7a958c78be..da9be186bde 100644 --- a/build/pkgs/cython/SPKG.rst +++ b/build/pkgs/cython/SPKG.rst @@ -30,8 +30,3 @@ Upstream Contact - http://www.cython.org/ - cython-devel@python.org - -Dependencies ------------- - -- Python diff --git a/build/pkgs/cython/dependencies b/build/pkgs/cython/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/cython/dependencies +++ b/build/pkgs/cython/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/d3js/SPKG.rst b/build/pkgs/d3js/SPKG.rst index c5d838f1c84..219f731d168 100644 --- a/build/pkgs/d3js/SPKG.rst +++ b/build/pkgs/d3js/SPKG.rst @@ -20,12 +20,6 @@ Upstream Contact - Author: Mike Bostock (http://bost.ocks.org/mike/) - Home page: http://d3js.org/ -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/d3js/dependencies b/build/pkgs/d3js/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/d3js/dependencies +++ b/build/pkgs/d3js/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_cremona_ellcurve/SPKG.rst b/build/pkgs/database_cremona_ellcurve/SPKG.rst index 9341e1bd335..7d37832e6cb 100644 --- a/build/pkgs/database_cremona_ellcurve/SPKG.rst +++ b/build/pkgs/database_cremona_ellcurve/SPKG.rst @@ -15,17 +15,6 @@ License Public Domain -Dependencies ------------- - -None - -Patches -~~~~~~~ - -- None - - Upstream Contact ---------------- diff --git a/build/pkgs/database_cremona_ellcurve/dependencies b/build/pkgs/database_cremona_ellcurve/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_cremona_ellcurve/dependencies +++ b/build/pkgs/database_cremona_ellcurve/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_jones_numfield/SPKG.rst b/build/pkgs/database_jones_numfield/SPKG.rst index 1d5f81b68f0..14c4c73cf1d 100644 --- a/build/pkgs/database_jones_numfield/SPKG.rst +++ b/build/pkgs/database_jones_numfield/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact sage-devel@googlegroups.com -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/database_jones_numfield/dependencies b/build/pkgs/database_jones_numfield/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_jones_numfield/dependencies +++ b/build/pkgs/database_jones_numfield/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_knotinfo/dependencies b/build/pkgs/database_knotinfo/dependencies index 30b944a731d..0738c2d7777 100644 --- a/build/pkgs/database_knotinfo/dependencies +++ b/build/pkgs/database_knotinfo/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_database_knotinfo)), $(SAGERUNTIME) ipywidgets sympy singular gap libhomfly libbraiding matplotlib) +$(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/database_knotinfo/dependencies_check b/build/pkgs/database_knotinfo/dependencies_check new file mode 100644 index 00000000000..3543bac84df --- /dev/null +++ b/build/pkgs/database_knotinfo/dependencies_check @@ -0,0 +1 @@ +$(SAGERUNTIME) ipywidgets sympy singular gap libhomfly libbraiding matplotlib diff --git a/build/pkgs/database_mutation_class/SPKG.rst b/build/pkgs/database_mutation_class/SPKG.rst index e73e2c0be80..761db83425b 100644 --- a/build/pkgs/database_mutation_class/SPKG.rst +++ b/build/pkgs/database_mutation_class/SPKG.rst @@ -25,8 +25,3 @@ SPKG Maintainers ---------------- - C. Stump - -Dependencies ------------- - -- None diff --git a/build/pkgs/database_odlyzko_zeta/SPKG.rst b/build/pkgs/database_odlyzko_zeta/SPKG.rst index 17d0c366bf2..b58185fcaee 100644 --- a/build/pkgs/database_odlyzko_zeta/SPKG.rst +++ b/build/pkgs/database_odlyzko_zeta/SPKG.rst @@ -8,8 +8,3 @@ Table of zeros of the Riemann zeta function by Andrew Odlyzko. This package contains the file 'zeros6' with the first 2,001,052 zeros of the Riemann zeta function, accurate to within 4*10^(-9). - -Dependencies ------------- - -- Sage library diff --git a/build/pkgs/database_odlyzko_zeta/dependencies b/build/pkgs/database_odlyzko_zeta/dependencies index c1b713883fe..ec44bfaa468 100644 --- a/build/pkgs/database_odlyzko_zeta/dependencies +++ b/build/pkgs/database_odlyzko_zeta/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_stein_watkins/SPKG.rst b/build/pkgs/database_stein_watkins/SPKG.rst index 28746bfc826..74484171f7c 100644 --- a/build/pkgs/database_stein_watkins/SPKG.rst +++ b/build/pkgs/database_stein_watkins/SPKG.rst @@ -14,13 +14,3 @@ License ------- Public Domain - -Dependencies ------------- - -None - -Patches -~~~~~~~ - -None diff --git a/build/pkgs/database_stein_watkins/dependencies b/build/pkgs/database_stein_watkins/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_stein_watkins/dependencies +++ b/build/pkgs/database_stein_watkins/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_stein_watkins_mini/SPKG.rst b/build/pkgs/database_stein_watkins_mini/SPKG.rst index d9b14940131..e82989564b2 100644 --- a/build/pkgs/database_stein_watkins_mini/SPKG.rst +++ b/build/pkgs/database_stein_watkins_mini/SPKG.rst @@ -14,13 +14,3 @@ License ------- Public Domain - -Dependencies ------------- - -None - -Patches -~~~~~~~ - -None diff --git a/build/pkgs/database_stein_watkins_mini/dependencies b/build/pkgs/database_stein_watkins_mini/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_stein_watkins_mini/dependencies +++ b/build/pkgs/database_stein_watkins_mini/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/database_symbolic_data/SPKG.rst b/build/pkgs/database_symbolic_data/SPKG.rst index f809a76ec96..18f7dc963ff 100644 --- a/build/pkgs/database_symbolic_data/SPKG.rst +++ b/build/pkgs/database_symbolic_data/SPKG.rst @@ -35,12 +35,3 @@ Upstream Contact ---------------- - Andreas Nareike - -Dependencies ------------- - - -Special Update/Build Instructions ---------------------------------- - -List patches that need to be applied and what they do diff --git a/build/pkgs/database_symbolic_data/dependencies b/build/pkgs/database_symbolic_data/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/database_symbolic_data/dependencies +++ b/build/pkgs/database_symbolic_data/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/dateutil/SPKG.rst b/build/pkgs/dateutil/SPKG.rst index 796cbdb2f56..8d26c6dceb7 100644 --- a/build/pkgs/dateutil/SPKG.rst +++ b/build/pkgs/dateutil/SPKG.rst @@ -21,9 +21,3 @@ Author: Gustavo Niemeyer Home page: http://labix.org/python-dateutil https://pypi.org/project/python-dateutil/ - -Dependencies ------------- - -- Python -- Six diff --git a/build/pkgs/dateutil/dependencies b/build/pkgs/dateutil/dependencies index 4db01013112..7a972de985e 100644 --- a/build/pkgs/dateutil/dependencies +++ b/build/pkgs/dateutil/dependencies @@ -2,4 +2,3 @@ $(PYTHON) six | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/deformation/dependencies b/build/pkgs/deformation/dependencies index 09c8e56f94a..c95d2836ce5 100644 --- a/build/pkgs/deformation/dependencies +++ b/build/pkgs/deformation/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr flint ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/defusedxml/SPKG.rst b/build/pkgs/defusedxml/SPKG.rst index 921e3061af6..44d6549a764 100644 --- a/build/pkgs/defusedxml/SPKG.rst +++ b/build/pkgs/defusedxml/SPKG.rst @@ -19,12 +19,6 @@ Upstream Contact https://pypi.org/project/defusedxml/ -Dependencies ------------- - -- pip - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/docutils/SPKG.rst b/build/pkgs/docutils/SPKG.rst index 2547e4facfd..c0c6da387c7 100644 --- a/build/pkgs/docutils/SPKG.rst +++ b/build/pkgs/docutils/SPKG.rst @@ -21,14 +21,3 @@ Upstream Contact Author: David Goodger Home Page: http://docutils.sourceforge.net/ - -Dependencies ------------- - -None - - -Special Update/Build Instructions ---------------------------------- - -None diff --git a/build/pkgs/docutils/dependencies b/build/pkgs/docutils/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/docutils/dependencies +++ b/build/pkgs/docutils/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/dot2tex/dependencies b/build/pkgs/dot2tex/dependencies index e88742b6c74..c1925d16b73 100644 --- a/build/pkgs/dot2tex/dependencies +++ b/build/pkgs/dot2tex/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pyparsing ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/e_antic/dependencies b/build/pkgs/e_antic/dependencies index 895cffa0013..ff67f31325b 100644 --- a/build/pkgs/e_antic/dependencies +++ b/build/pkgs/e_antic/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) flint arb ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ecl/dependencies b/build/pkgs/ecl/dependencies index bf96c4ff887..cda6316bf5a 100644 --- a/build/pkgs/ecl/dependencies +++ b/build/pkgs/ecl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) readline gc libffi ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/eclib/SPKG.rst b/build/pkgs/eclib/SPKG.rst index cca1baa0670..5627fdcb57c 100644 --- a/build/pkgs/eclib/SPKG.rst +++ b/build/pkgs/eclib/SPKG.rst @@ -32,10 +32,3 @@ Upstream Contact - Website: http://homepages.warwick.ac.uk/staff/J.E.Cremona/mwrank/index.html - Repository: https://github.com/JohnCremona/eclib - -Dependencies ------------- - -- PARI -- NTL -- FLINT diff --git a/build/pkgs/eclib/dependencies b/build/pkgs/eclib/dependencies index 54e7e242559..b73cfa3391a 100644 --- a/build/pkgs/eclib/dependencies +++ b/build/pkgs/eclib/dependencies @@ -2,4 +2,3 @@ pari ntl flint ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ecm/dependencies b/build/pkgs/ecm/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/ecm/dependencies +++ b/build/pkgs/ecm/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/elliptic_curves/SPKG.rst b/build/pkgs/elliptic_curves/SPKG.rst index e167a6feef1..09c86a5a9e7 100644 --- a/build/pkgs/elliptic_curves/SPKG.rst +++ b/build/pkgs/elliptic_curves/SPKG.rst @@ -28,8 +28,3 @@ ellcurves - Author: William Stein - Email: wstein@gmail.com -Dependencies ------------- - -- sqlite -- python diff --git a/build/pkgs/elliptic_curves/dependencies b/build/pkgs/elliptic_curves/dependencies index 1a36cc52351..6b134137610 100644 --- a/build/pkgs/elliptic_curves/dependencies +++ b/build/pkgs/elliptic_curves/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/entrypoints/dependencies b/build/pkgs/entrypoints/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/entrypoints/dependencies +++ b/build/pkgs/entrypoints/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fflas_ffpack/SPKG.rst b/build/pkgs/fflas_ffpack/SPKG.rst index 26c7e6385a1..0e3a7efdc70 100644 --- a/build/pkgs/fflas_ffpack/SPKG.rst +++ b/build/pkgs/fflas_ffpack/SPKG.rst @@ -15,25 +15,7 @@ License LGPL V2.1 or later -SPKG Repository ---------------- - - https://bitbucket.org/malb/fflas-ffpack-spkg - - Upstream Contact ---------------- - - -Dependencies ------------- - -- Givaro -- a BLAS implementation such as openblas - - -Patches -------- - -- bash.patch: fix shebang line to "#!/usr/bin/env bash" diff --git a/build/pkgs/fflas_ffpack/dependencies b/build/pkgs/fflas_ffpack/dependencies index 9aba473c01b..dbb5493271d 100644 --- a/build/pkgs/fflas_ffpack/dependencies +++ b/build/pkgs/fflas_ffpack/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) givaro gsl $(BLAS) | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/flint/dependencies b/build/pkgs/flint/dependencies index 2a23f3894a5..385df4faa7d 100644 --- a/build/pkgs/flint/dependencies +++ b/build/pkgs/flint/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ntl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/flintqs/dependencies b/build/pkgs/flintqs/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/flintqs/dependencies +++ b/build/pkgs/flintqs/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fplll/SPKG.rst b/build/pkgs/fplll/SPKG.rst index d7c3ade83c0..2fe28e50e25 100644 --- a/build/pkgs/fplll/SPKG.rst +++ b/build/pkgs/fplll/SPKG.rst @@ -21,9 +21,3 @@ Upstream Contact - Martin Albrecht - Mailing List https://groups.google.com/forum/#!forum/fplll-devel - -Dependencies ------------- - -- gmp -- mpfr diff --git a/build/pkgs/fplll/checksums.ini b/build/pkgs/fplll/checksums.ini index c346ac9603d..2d6b70504f8 100644 --- a/build/pkgs/fplll/checksums.ini +++ b/build/pkgs/fplll/checksums.ini @@ -1,5 +1,5 @@ tarball=fplll-VERSION.tar.gz -sha1=fe1b225f2bff07b7b832ae8b20ffc85acfd231cd -md5=44db0a42c33e5aa60264b32ab0063351 -cksum=3420408626 +sha1=d84ae04deee3a29033c6e28e40c67ed14f8fff32 +md5=9e8ed4e5ff7f3231f9ccf397dca9a117 +cksum=855019078 upstream_url=https://github.com/fplll/fplll/releases/download/VERSION/fplll-VERSION.tar.gz diff --git a/build/pkgs/fplll/dependencies b/build/pkgs/fplll/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/fplll/dependencies +++ b/build/pkgs/fplll/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fplll/package-version.txt b/build/pkgs/fplll/package-version.txt index ade65226e0a..8ae03c11904 100644 --- a/build/pkgs/fplll/package-version.txt +++ b/build/pkgs/fplll/package-version.txt @@ -1 +1 @@ -5.4.1 +5.4.2 diff --git a/build/pkgs/fplll/spkg-configure.m4 b/build/pkgs/fplll/spkg-configure.m4 index d7cc77fe6c7..c220aecc60c 100644 --- a/build/pkgs/fplll/spkg-configure.m4 +++ b/build/pkgs/fplll/spkg-configure.m4 @@ -8,7 +8,7 @@ SAGE_SPKG_CONFIGURE([fplll], [ dnl Trac #31025: FPLLL/FPyLLL make no guarantee regarding compatibility dnl other than "whatever versions were released at the same time should work together" PKG_CHECK_MODULES([FPLLL], - [fplll >= 5.4.0 fplll <= 5.4.1], + [fplll >= 5.4.0 fplll <= 5.4.2], [ AC_MSG_CHECKING([whether BKZ default strategy JSON is installed]) AC_LANG_PUSH([C++]) diff --git a/build/pkgs/fpylll/SPKG.rst b/build/pkgs/fpylll/SPKG.rst index 84d7bcbf7ac..199893d5761 100644 --- a/build/pkgs/fpylll/SPKG.rst +++ b/build/pkgs/fpylll/SPKG.rst @@ -16,11 +16,3 @@ Upstream Contact ---------------- https://github.com/fplll/fpylll - -Dependencies ------------- - -- Cython -- fplll -- Sage (optional) -- NumPy (optional) diff --git a/build/pkgs/fpylll/checksums.ini b/build/pkgs/fpylll/checksums.ini index 5255ba6aec8..5a3fc413fe2 100644 --- a/build/pkgs/fpylll/checksums.ini +++ b/build/pkgs/fpylll/checksums.ini @@ -1,5 +1,5 @@ tarball=fpylll-VERSION.tar.gz -sha1=e2a005b53fcc3a9ec1f1111f144eb75b6de7fb44 -md5=5ea3a5fe30646311ef28ca1f8e9bf2bc -cksum=690866680 +sha1=9c4951f4ec50f36805129df4b821e5ea18b7ad30 +md5=d802205f818a9ae5846f8eaa34db7b5c +cksum=3615125514 upstream_url=https://github.com/fplll/fpylll/releases/download/VERSION/fpylll-VERSION.tar.gz diff --git a/build/pkgs/fpylll/dependencies b/build/pkgs/fpylll/dependencies index cc84e797e80..4b4fb1b44fb 100644 --- a/build/pkgs/fpylll/dependencies +++ b/build/pkgs/fpylll/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython cysignals numpy fplll ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fpylll/install-requires.txt b/build/pkgs/fpylll/install-requires.txt index 0461a00816f..c1a9bf38bbb 100644 --- a/build/pkgs/fpylll/install-requires.txt +++ b/build/pkgs/fpylll/install-requires.txt @@ -1 +1 @@ -fpylll >=0.5.5, <=0.5.6 +fpylll >=0.5.6, <=0.5.7 diff --git a/build/pkgs/fpylll/package-version.txt b/build/pkgs/fpylll/package-version.txt index b49b25336d4..d3532a107ee 100644 --- a/build/pkgs/fpylll/package-version.txt +++ b/build/pkgs/fpylll/package-version.txt @@ -1 +1 @@ -0.5.6 +0.5.7 diff --git a/build/pkgs/freetype/SPKG.rst b/build/pkgs/freetype/SPKG.rst index 74b3f67df71..368a6763462 100644 --- a/build/pkgs/freetype/SPKG.rst +++ b/build/pkgs/freetype/SPKG.rst @@ -45,8 +45,3 @@ Upstream Contact - official: http://git.savannah.gnu.org/cgit/freetype - mirror: https://github.com/aseprite/freetype2/ - -Dependencies ------------- - -See the ``dependencies`` file. diff --git a/build/pkgs/freetype/dependencies b/build/pkgs/freetype/dependencies index d4365d93067..af0f47547a8 100644 --- a/build/pkgs/freetype/dependencies +++ b/build/pkgs/freetype/dependencies @@ -2,4 +2,3 @@ libpng bzip2 ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/fricas/SPKG.rst b/build/pkgs/fricas/SPKG.rst index 7d18dd6fa78..5f8e01324ef 100644 --- a/build/pkgs/fricas/SPKG.rst +++ b/build/pkgs/fricas/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact ---------------- http://fricas.sourceforge.net/ - -Dependencies ------------- - -- ecl diff --git a/build/pkgs/fricas/dependencies b/build/pkgs/fricas/dependencies index ed6be201375..fffb89e2050 100644 --- a/build/pkgs/fricas/dependencies +++ b/build/pkgs/fricas/dependencies @@ -2,4 +2,3 @@ ecl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/frobby/SPKG.rst b/build/pkgs/frobby/SPKG.rst index 2586bb06902..eea712a3a9d 100644 --- a/build/pkgs/frobby/SPKG.rst +++ b/build/pkgs/frobby/SPKG.rst @@ -26,12 +26,6 @@ Upstream Contact - https://github.com/Macaulay2/frobby -Dependencies ------------- - -- GMP built with support for C++ - - Special Update/Build instructions --------------------------------- diff --git a/build/pkgs/furo/SPKG.rst b/build/pkgs/furo/SPKG.rst new file mode 100644 index 00000000000..368eff31748 --- /dev/null +++ b/build/pkgs/furo/SPKG.rst @@ -0,0 +1,16 @@ +furo: A clean customizable Sphinx documentation theme +===================================================== + +Description +----------- + +A clean customizable Sphinx documentation theme. + +License +------- + +Upstream Contact +---------------- + +https://pypi.org/project/furo/ + diff --git a/build/pkgs/furo/dependencies b/build/pkgs/furo/dependencies new file mode 100644 index 00000000000..9544f8d9e55 --- /dev/null +++ b/build/pkgs/furo/dependencies @@ -0,0 +1,9 @@ +$(PYTHON) beautifulsoup4 sphinx pygments | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. + +From https://github.com/pradyunsg/furo/blob/b4c8010cff5e494a93d617069897964c60b820e9/pyproject.toml#L18-L22 + "beautifulsoup4", + "sphinx ~= 4.0", + "pygments ~= 2.7", diff --git a/build/pkgs/furo/requirements.txt b/build/pkgs/furo/requirements.txt new file mode 100644 index 00000000000..a95ae18b4f9 --- /dev/null +++ b/build/pkgs/furo/requirements.txt @@ -0,0 +1 @@ +furo diff --git a/build/pkgs/furo/type b/build/pkgs/furo/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/furo/type @@ -0,0 +1 @@ +optional diff --git a/build/pkgs/gambit/dependencies b/build/pkgs/gambit/dependencies index 2040b648774..1f00cbf5321 100644 --- a/build/pkgs/gambit/dependencies +++ b/build/pkgs/gambit/dependencies @@ -2,4 +2,3 @@ cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gap/SPKG.rst b/build/pkgs/gap/SPKG.rst index c28f1881847..2f59f140a01 100644 --- a/build/pkgs/gap/SPKG.rst +++ b/build/pkgs/gap/SPKG.rst @@ -26,13 +26,6 @@ https://www.gap-system.org Mailing list at https://mail.gap-system.org/mailman/listinfo/gap -Dependencies ------------- - -- Readline -- GMP - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gap/dependencies b/build/pkgs/gap/dependencies index e0367988d88..a0bd86b58a1 100644 --- a/build/pkgs/gap/dependencies +++ b/build/pkgs/gap/dependencies @@ -2,4 +2,3 @@ ncurses readline zlib $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gap3/SPKG.rst b/build/pkgs/gap3/SPKG.rst index bf44d2cd8e5..1152b121bfd 100644 --- a/build/pkgs/gap3/SPKG.rst +++ b/build/pkgs/gap3/SPKG.rst @@ -79,7 +79,3 @@ Patches None -Dependencies ------------- - -None diff --git a/build/pkgs/gap_packages/dependencies b/build/pkgs/gap_packages/dependencies index 21b057d2e47..342d2c8edd1 100644 --- a/build/pkgs/gap_packages/dependencies +++ b/build/pkgs/gap_packages/dependencies @@ -2,4 +2,3 @@ gap libsemigroups planarity | $(SAGERUNTIME) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gc/SPKG.rst b/build/pkgs/gc/SPKG.rst index 3dc62b8f11e..ece6b70d3e6 100644 --- a/build/pkgs/gc/SPKG.rst +++ b/build/pkgs/gc/SPKG.rst @@ -19,12 +19,6 @@ Webpage: http://www.hboehm.info/gc/ Email List: bdwgc@lists.opendylan.org -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gc/dependencies b/build/pkgs/gc/dependencies index 28dadf07615..471ebd6cd85 100644 --- a/build/pkgs/gc/dependencies +++ b/build/pkgs/gc/dependencies @@ -1,4 +1,3 @@ libatomic_ops ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gdb/dependencies b/build/pkgs/gdb/dependencies index 30508b35c45..bdf81f77180 100644 --- a/build/pkgs/gdb/dependencies +++ b/build/pkgs/gdb/dependencies @@ -2,4 +2,3 @@ mpfr zlib ncurses $(PYTHON) xz ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gengetopt/dependencies b/build/pkgs/gengetopt/dependencies index 7a7b9cf8a80..eb5b66f34f2 100644 --- a/build/pkgs/gengetopt/dependencies +++ b/build/pkgs/gengetopt/dependencies @@ -4,4 +4,3 @@ xz is needed for unpacking the tarball when sage-bootstrap-python is ancient ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gf2x/SPKG.rst b/build/pkgs/gf2x/SPKG.rst index 29e4d5680fe..7f4b11e994f 100644 --- a/build/pkgs/gf2x/SPKG.rst +++ b/build/pkgs/gf2x/SPKG.rst @@ -24,12 +24,6 @@ Upstream Contact - Emmanuel Thomé - Paul Zimmermann -Dependencies ------------- - -- None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gfan/dependencies b/build/pkgs/gfan/dependencies index 674fe7612fd..4c6301e2e5d 100644 --- a/build/pkgs/gfan/dependencies +++ b/build/pkgs/gfan/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) cddlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gfortran/SPKG.rst b/build/pkgs/gfortran/SPKG.rst index d66a7b0f173..1bea5fae5fe 100644 --- a/build/pkgs/gfortran/SPKG.rst +++ b/build/pkgs/gfortran/SPKG.rst @@ -18,15 +18,6 @@ Upstream Contact http://gcc.gnu.org/ -Dependencies ------------- - -- zlib -- GMP -- MPFR -- MPC - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/giac/dependencies b/build/pkgs/giac/dependencies index c36972a1011..ddc04d1e402 100644 --- a/build/pkgs/giac/dependencies +++ b/build/pkgs/giac/dependencies @@ -2,4 +2,3 @@ readline libpng $(MP_LIBRARY) mpfr mpfi ntl gsl pari glpk curl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/install into SAGE_ROOT/build/Makefile. diff --git a/build/pkgs/givaro/dependencies b/build/pkgs/givaro/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/givaro/dependencies +++ b/build/pkgs/givaro/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/glpk/dependencies b/build/pkgs/glpk/dependencies index 6f9a6c00fe9..9b1acf2f429 100644 --- a/build/pkgs/glpk/dependencies +++ b/build/pkgs/glpk/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/glucose/SPKG.rst b/build/pkgs/glucose/SPKG.rst index f6f9beb9ca0..1a7ed45fc87 100644 --- a/build/pkgs/glucose/SPKG.rst +++ b/build/pkgs/glucose/SPKG.rst @@ -35,12 +35,6 @@ Upstream Contact Website: http://www.labri.fr/perso/lsimon/glucose/ -Dependencies ------------- - -zlib - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/glucose/dependencies b/build/pkgs/glucose/dependencies index 4c0aa5c0d31..a1eb8a80d3d 100644 --- a/build/pkgs/glucose/dependencies +++ b/build/pkgs/glucose/dependencies @@ -2,4 +2,3 @@ zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gmpy2/dependencies b/build/pkgs/gmpy2/dependencies index 510fc637e95..98c6065dc87 100644 --- a/build/pkgs/gmpy2/dependencies +++ b/build/pkgs/gmpy2/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(MP_LIBRARY) mpfr mpc | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gp2c/dependencies b/build/pkgs/gp2c/dependencies index 7537ca02746..92256baba2a 100644 --- a/build/pkgs/gp2c/dependencies +++ b/build/pkgs/gp2c/dependencies @@ -2,4 +2,3 @@ pari ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/install into SAGE_ROOT/build/Makefile. diff --git a/build/pkgs/graphs/SPKG.rst b/build/pkgs/graphs/SPKG.rst index 4a5f9d35ec8..fee55463698 100644 --- a/build/pkgs/graphs/SPKG.rst +++ b/build/pkgs/graphs/SPKG.rst @@ -28,7 +28,3 @@ Upstream Contact available at https://github.com/nathanncohen/strongly_regular_graphs_database. -Dependencies ------------- - -N/A diff --git a/build/pkgs/graphs/dependencies b/build/pkgs/graphs/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/graphs/dependencies +++ b/build/pkgs/graphs/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/gsl/SPKG.rst b/build/pkgs/gsl/SPKG.rst index 79d0151784d..fb66a085b10 100644 --- a/build/pkgs/gsl/SPKG.rst +++ b/build/pkgs/gsl/SPKG.rst @@ -42,19 +42,5 @@ GSL mailing lists: releases are made there. -Dependencies ------------- - -- None - GSL does not depend on any other Sage package to compile, link - and pass all of GSL's self-tests. Despite that fact, BLAS is listed - as - a dependency. (It comes with its own CBLAS implementation that is - e.g. - used when running the GSL test suite during installation; however, - the - Sage library only uses it as a fall-back, if e.g. BLAS library is not - present.) - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/gsl/dependencies b/build/pkgs/gsl/dependencies index 576809127c7..8073e1a7f67 100644 --- a/build/pkgs/gsl/dependencies +++ b/build/pkgs/gsl/dependencies @@ -2,4 +2,3 @@ $(BLAS) | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/html5lib/SPKG.rst b/build/pkgs/html5lib/SPKG.rst index b62607c15d7..c0abaca59f3 100644 --- a/build/pkgs/html5lib/SPKG.rst +++ b/build/pkgs/html5lib/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact Home Page: https://github.com/html5lib/html5lib-python/issues -Dependencies ------------- - -Python, webencodings, six diff --git a/build/pkgs/html5lib/dependencies b/build/pkgs/html5lib/dependencies index cdcfeeba041..89200065387 100644 --- a/build/pkgs/html5lib/dependencies +++ b/build/pkgs/html5lib/dependencies @@ -2,4 +2,3 @@ $(PYTHON) webencodings | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/iconv/SPKG.rst b/build/pkgs/iconv/SPKG.rst index 2604fddf232..48e0ffe761f 100644 --- a/build/pkgs/iconv/SPKG.rst +++ b/build/pkgs/iconv/SPKG.rst @@ -19,12 +19,6 @@ Upstream Contact - http://www.gnu.org/software/libiconv/ - Bug reports to bug-gnu-libiconv@gnu.org -Dependencies ------------- - -- None for the purposes of Sage, but in general gettext. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/iconv/dependencies b/build/pkgs/iconv/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/iconv/dependencies +++ b/build/pkgs/iconv/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/imagesize/dependencies b/build/pkgs/imagesize/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/imagesize/dependencies +++ b/build/pkgs/imagesize/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/iml/SPKG.rst b/build/pkgs/iml/SPKG.rst index ffb045c9113..635fe9da032 100644 --- a/build/pkgs/iml/SPKG.rst +++ b/build/pkgs/iml/SPKG.rst @@ -26,13 +26,6 @@ Upstream Contact - Zhuliang Chen z4chen@uwaterloo.ca - Arne Storjohann astorjoh@uwaterloo.ca -Dependencies ------------- - -- GMP -- a BLAS implementation such as openblas - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/iml/dependencies b/build/pkgs/iml/dependencies index 5a73e699d00..be919463819 100644 --- a/build/pkgs/iml/dependencies +++ b/build/pkgs/iml/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) $(BLAS) | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/importlib_metadata/SPKG.rst b/build/pkgs/importlib_metadata/SPKG.rst index f77ad32a048..d1b490d0082 100644 --- a/build/pkgs/importlib_metadata/SPKG.rst +++ b/build/pkgs/importlib_metadata/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact Home page: http://importlib-metadata.readthedocs.io/ -Dependencies ------------- - -Python, Setuptools, zipp diff --git a/build/pkgs/importlib_metadata/dependencies b/build/pkgs/importlib_metadata/dependencies index 9fcc3b0cc65..77aa2a42f93 100644 --- a/build/pkgs/importlib_metadata/dependencies +++ b/build/pkgs/importlib_metadata/dependencies @@ -2,4 +2,3 @@ $(PYTHON) zipp typing_extensions | $(PYTHON_TOOLCHAIN) tomli ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/info/dependencies b/build/pkgs/info/dependencies index c2c72b44a87..5405130e47b 100644 --- a/build/pkgs/info/dependencies +++ b/build/pkgs/info/dependencies @@ -7,4 +7,3 @@ system despite not being listed explicitly anywhere. ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipykernel/dependencies b/build/pkgs/ipykernel/dependencies index 5b3708a31fc..03ac4f70504 100644 --- a/build/pkgs/ipykernel/dependencies +++ b/build/pkgs/ipykernel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ipython_genutils importlib_metadata argcomplete matplotlib_inline ipyt ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipympl/dependencies b/build/pkgs/ipympl/dependencies index 56687b4dda0..b217268db20 100644 --- a/build/pkgs/ipympl/dependencies +++ b/build/pkgs/ipympl/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) ipywidgets matplotlib ipykernel jupyter_packaging $(findstring jupyterlab,$(OPTIONAL_INSTALLED_PACKAGES)) +$(PYTHON) | $(PYTHON_TOOLCHAIN) ipywidgets matplotlib ipykernel jupyter_packaging ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/ipympl/dependencies_optional b/build/pkgs/ipympl/dependencies_optional new file mode 100644 index 00000000000..c9356a72837 --- /dev/null +++ b/build/pkgs/ipympl/dependencies_optional @@ -0,0 +1 @@ +jupyterlab diff --git a/build/pkgs/ipython/dependencies b/build/pkgs/ipython/dependencies index f15f6f0aca1..afe4e745f2d 100644 --- a/build/pkgs/ipython/dependencies +++ b/build/pkgs/ipython/dependencies @@ -2,4 +2,3 @@ $(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets | $(PYTHON_TO ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipython_genutils/dependencies b/build/pkgs/ipython_genutils/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/ipython_genutils/dependencies +++ b/build/pkgs/ipython_genutils/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ipywidgets/dependencies b/build/pkgs/ipywidgets/dependencies index e719deacdd0..e6cc2ed95d5 100644 --- a/build/pkgs/ipywidgets/dependencies +++ b/build/pkgs/ipywidgets/dependencies @@ -2,4 +2,3 @@ $(PYTHON) widgetsnbextension | $(PYTHON_TOOLCHAIN) ipykernel ipython traitlets ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/isl/dependencies b/build/pkgs/isl/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/isl/dependencies +++ b/build/pkgs/isl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jedi/dependencies b/build/pkgs/jedi/dependencies index 0f21b645bd9..60b5f820a37 100644 --- a/build/pkgs/jedi/dependencies +++ b/build/pkgs/jedi/dependencies @@ -2,4 +2,3 @@ $(PYTHON) parso | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jinja2/SPKG.rst b/build/pkgs/jinja2/SPKG.rst index dab1c25cafa..7f962f0343e 100644 --- a/build/pkgs/jinja2/SPKG.rst +++ b/build/pkgs/jinja2/SPKG.rst @@ -25,15 +25,6 @@ Author: Pocoo Team Homepage: http://jinja.pocoo.org/ -Dependencies ------------- - -- Python (>= 2.4) -- setuptools (or distribute) -- Pygments (according to 'spkg/standard/deps') -- docutils (dito, as a note only) - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/jinja2/checksums.ini b/build/pkgs/jinja2/checksums.ini index e84600dd23a..f7070dfa137 100644 --- a/build/pkgs/jinja2/checksums.ini +++ b/build/pkgs/jinja2/checksums.ini @@ -1,5 +1,5 @@ -tarball=jinja2-VERSION.tar.gz -sha1=1017138fd4cb627204d3109b75c107c3d6f3f7fb -md5=0362203b22547abca06ed1082bc1e7b4 -cksum=1208782876 -upstream_url=https://pypi.io/packages/source/J/Jinja2/Jinja2-VERSION.tar.gz +tarball=Jinja2-VERSION.tar.gz +sha1=560f248ccb0b98256c5b50c86a002c2c1e57edb6 +md5=d31148abd89c1df1cdb077a55db27d02 +cksum=394934978 +upstream_url=https://pypi.io/packages/source/j/jinja2/Jinja2-VERSION.tar.gz diff --git a/build/pkgs/jinja2/dependencies b/build/pkgs/jinja2/dependencies index e8739c35b16..6947978ec42 100644 --- a/build/pkgs/jinja2/dependencies +++ b/build/pkgs/jinja2/dependencies @@ -2,4 +2,3 @@ $(PYTHON) markupsafe docutils | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jinja2/package-version.txt b/build/pkgs/jinja2/package-version.txt index 9e5bb77a3ba..ef538c28109 100644 --- a/build/pkgs/jinja2/package-version.txt +++ b/build/pkgs/jinja2/package-version.txt @@ -1 +1 @@ -2.11.2 +3.1.2 diff --git a/build/pkgs/jmol/dependencies b/build/pkgs/jmol/dependencies index 50320851772..3edeff40436 100644 --- a/build/pkgs/jmol/dependencies +++ b/build/pkgs/jmol/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jsonschema/SPKG.rst b/build/pkgs/jsonschema/SPKG.rst index c9f40de8258..bf655277b78 100644 --- a/build/pkgs/jsonschema/SPKG.rst +++ b/build/pkgs/jsonschema/SPKG.rst @@ -17,11 +17,3 @@ Upstream Contact Home page: http://github.com/Julian/jsonschema -Dependencies ------------- - -- Python -- Setuptools -- attrs -- importlib_metadata -- pyrsistent diff --git a/build/pkgs/jsonschema/dependencies b/build/pkgs/jsonschema/dependencies index c4bb27ca08e..543eb556459 100644 --- a/build/pkgs/jsonschema/dependencies +++ b/build/pkgs/jsonschema/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner attrs importlib_metadata pyrsistent | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupymake/SPKG.rst b/build/pkgs/jupymake/SPKG.rst index a6db0f64ab2..d2ee2c8b564 100644 --- a/build/pkgs/jupymake/SPKG.rst +++ b/build/pkgs/jupymake/SPKG.rst @@ -17,12 +17,5 @@ Upstream Contact https://github.com/polymake/JuPyMake -Dependencies ------------- - -- pip -- polymake - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/jupymake/dependencies b/build/pkgs/jupymake/dependencies index bcbd220117e..c8ed956ad6a 100644 --- a/build/pkgs/jupymake/dependencies +++ b/build/pkgs/jupymake/dependencies @@ -2,4 +2,3 @@ $(PYTHON) polymake | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyter_client/dependencies b/build/pkgs/jupyter_client/dependencies index d405e7b48d7..5e9a6c75874 100644 --- a/build/pkgs/jupyter_client/dependencies +++ b/build/pkgs/jupyter_client/dependencies @@ -2,4 +2,3 @@ $(PYTHON) jupyter_core | $(PYTHON_TOOLCHAIN) pyzmq dateutil nest_asyncio tornado ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyter_core/dependencies b/build/pkgs/jupyter_core/dependencies index 5dcd07f89fa..6aeda10f20d 100644 --- a/build/pkgs/jupyter_core/dependencies +++ b/build/pkgs/jupyter_core/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) traitlets ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyter_packaging/requirements.txt b/build/pkgs/jupyter_packaging/requirements.txt index b5ec61b7d14..c99565a4ced 100644 --- a/build/pkgs/jupyter_packaging/requirements.txt +++ b/build/pkgs/jupyter_packaging/requirements.txt @@ -1 +1 @@ -jupyter-packaging +jupyter-packaging < 0.12 diff --git a/build/pkgs/jupyterlab/SPKG.rst b/build/pkgs/jupyterlab/SPKG.rst index 3be24988c86..f728314ffae 100644 --- a/build/pkgs/jupyterlab/SPKG.rst +++ b/build/pkgs/jupyterlab/SPKG.rst @@ -17,10 +17,3 @@ Upstream Contact Home page: https://jupyter.org/ -Dependencies ------------- - -- Python -- Setuptools -- jupyter_core -- jupyter_client diff --git a/build/pkgs/jupyterlab/dependencies b/build/pkgs/jupyterlab/dependencies index 463f6e9d917..98ad2e94050 100644 --- a/build/pkgs/jupyterlab/dependencies +++ b/build/pkgs/jupyterlab/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner jupyter_core jupyter_client jinja2 tornado ipython packagi ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/jupyterlab_widgets/SPKG.rst b/build/pkgs/jupyterlab_widgets/SPKG.rst index 34913ab51b6..f17f3c08eda 100644 --- a/build/pkgs/jupyterlab_widgets/SPKG.rst +++ b/build/pkgs/jupyterlab_widgets/SPKG.rst @@ -16,8 +16,3 @@ Upstream Contact Home page: https://github.com/jupyter-widgets/ipywidgets -Dependencies ------------- - -- jupyterlab -- nodejs diff --git a/build/pkgs/kenzo/SPKG.rst b/build/pkgs/kenzo/SPKG.rst index 5d139df545e..9bca611ef82 100644 --- a/build/pkgs/kenzo/SPKG.rst +++ b/build/pkgs/kenzo/SPKG.rst @@ -21,7 +21,3 @@ Upstream Contact - https://github.com/miguelmarco/kenzo/ -Dependencies ------------- - -- ECL (Embedded Common Lisp) diff --git a/build/pkgs/kenzo/dependencies b/build/pkgs/kenzo/dependencies index ed6be201375..fffb89e2050 100644 --- a/build/pkgs/kenzo/dependencies +++ b/build/pkgs/kenzo/dependencies @@ -2,4 +2,3 @@ ecl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/kiwisolver/dependencies b/build/pkgs/kiwisolver/dependencies index 80b9352eb76..5df13094620 100644 --- a/build/pkgs/kiwisolver/dependencies +++ b/build/pkgs/kiwisolver/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cppy | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/latte_int/dependencies b/build/pkgs/latte_int/dependencies index ddfda62bcdb..412db1855de 100644 --- a/build/pkgs/latte_int/dependencies +++ b/build/pkgs/latte_int/dependencies @@ -1,5 +1,4 @@ -$(MP_LIBRARY) ntl 4ti2 cddlib lidia $(findstring lrslib,$(OPTIONAL_INSTALLED_PACKAGES)) +$(MP_LIBRARY) ntl 4ti2 cddlib lidia ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/latte_int/dependencies_optional b/build/pkgs/latte_int/dependencies_optional new file mode 100644 index 00000000000..c762c018aa3 --- /dev/null +++ b/build/pkgs/latte_int/dependencies_optional @@ -0,0 +1 @@ +lrslib diff --git a/build/pkgs/lcalc/dependencies b/build/pkgs/lcalc/dependencies index d42038dce36..ad46cc7f320 100644 --- a/build/pkgs/lcalc/dependencies +++ b/build/pkgs/lcalc/dependencies @@ -2,4 +2,3 @@ pari | gengetopt ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libatomic_ops/SPKG.rst b/build/pkgs/libatomic_ops/SPKG.rst index a4f1c0ce805..5d376f67e91 100644 --- a/build/pkgs/libatomic_ops/SPKG.rst +++ b/build/pkgs/libatomic_ops/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact - Webpage: http://www.hboehm.info/gc/ - Email List: bdwgc@lists.opendylan.org -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libatomic_ops/dependencies b/build/pkgs/libatomic_ops/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libatomic_ops/dependencies +++ b/build/pkgs/libatomic_ops/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libffi/dependencies b/build/pkgs/libffi/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libffi/dependencies +++ b/build/pkgs/libffi/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libgd/SPKG.rst b/build/pkgs/libgd/SPKG.rst index 33149d189fc..cade8ea66c7 100644 --- a/build/pkgs/libgd/SPKG.rst +++ b/build/pkgs/libgd/SPKG.rst @@ -25,14 +25,6 @@ Upstream Contact - Pierre Joye (http://blog.thepimp.net) - http://libgd.bitbucket.org/ -Dependencies ------------- - -- libpng -- freetype -- iconv - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libgd/dependencies b/build/pkgs/libgd/dependencies index 998d7d01593..e2cbc65b7da 100644 --- a/build/pkgs/libgd/dependencies +++ b/build/pkgs/libgd/dependencies @@ -3,4 +3,3 @@ libpng freetype xz # xz needed to unpack tarball when sage-bootstrap-python is Python < 3.3 ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libhomfly/SPKG.rst b/build/pkgs/libhomfly/SPKG.rst index f5c61344a3b..2d349b554ad 100644 --- a/build/pkgs/libhomfly/SPKG.rst +++ b/build/pkgs/libhomfly/SPKG.rst @@ -24,7 +24,3 @@ Upstream Contact Miguel Marco (mmarco@unizar.es) -Dependencies ------------- - -- gc diff --git a/build/pkgs/liblzma/SPKG.rst b/build/pkgs/liblzma/SPKG.rst index 925da031898..373af0a91a2 100644 --- a/build/pkgs/liblzma/SPKG.rst +++ b/build/pkgs/liblzma/SPKG.rst @@ -19,5 +19,3 @@ Upstream Contact http://tukaani.org/xz/ -Dependencies ------------- diff --git a/build/pkgs/liblzma/dependencies b/build/pkgs/liblzma/dependencies index f111204fa1f..52b7ce903f8 100644 --- a/build/pkgs/liblzma/dependencies +++ b/build/pkgs/liblzma/dependencies @@ -2,7 +2,6 @@ $(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/xz-$(vers_xz) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. Adding the above instead of "xz" makes sure that the dependency is not replaced by ".dummy". In this way, liblzma delegates building to xz when diff --git a/build/pkgs/libnauty/dependencies b/build/pkgs/libnauty/dependencies index 88254f7b556..cc6b7527ab9 100644 --- a/build/pkgs/libnauty/dependencies +++ b/build/pkgs/libnauty/dependencies @@ -2,7 +2,6 @@ $(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/nauty-$(vers_nauty) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. Adding the above instead of "nauty" makes sure that the dependency is not replaced by ".dummy". In this way, libnauty delegates building to nauty when diff --git a/build/pkgs/libogg/SPKG.rst b/build/pkgs/libogg/SPKG.rst index bf80b9680c6..2db78fcfcf2 100644 --- a/build/pkgs/libogg/SPKG.rst +++ b/build/pkgs/libogg/SPKG.rst @@ -49,14 +49,6 @@ Upstream Contact The Xiph.org mailing lists - see http://lists.xiph.org/mailman/listinfo -Dependencies ------------- - -This spkg provides dependencies for - -- the Sage library - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libogg/dependencies b/build/pkgs/libogg/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libogg/dependencies +++ b/build/pkgs/libogg/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libpng/SPKG.rst b/build/pkgs/libpng/SPKG.rst index b4ca40d71a6..414854d2ef1 100644 --- a/build/pkgs/libpng/SPKG.rst +++ b/build/pkgs/libpng/SPKG.rst @@ -28,14 +28,6 @@ https://libpng.sourceforge.io The png mailing lists - see http://www.libpng.org/pub/png/pngmisc.html#lists -Dependencies ------------- - -This spkg depends on: - -- libz - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libpng/dependencies b/build/pkgs/libpng/dependencies index 4c0aa5c0d31..a1eb8a80d3d 100644 --- a/build/pkgs/libpng/dependencies +++ b/build/pkgs/libpng/dependencies @@ -2,4 +2,3 @@ zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libsemigroups/dependencies b/build/pkgs/libsemigroups/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/libsemigroups/dependencies +++ b/build/pkgs/libsemigroups/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libtheora/SPKG.rst b/build/pkgs/libtheora/SPKG.rst index 3a75d68e7fb..0c2c9e1c642 100644 --- a/build/pkgs/libtheora/SPKG.rst +++ b/build/pkgs/libtheora/SPKG.rst @@ -48,19 +48,6 @@ Upstream Contact The Xiph.org mailing lists - see http://lists.xiph.org/mailman/listinfo -Dependencies ------------- - -This spkg depends on - -- libogg -- libpng - -This spkg provides dependencies for - -- the Sage library - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/libtheora/dependencies b/build/pkgs/libtheora/dependencies index 42f4da7f9d4..e62d879d3a4 100644 --- a/build/pkgs/libtheora/dependencies +++ b/build/pkgs/libtheora/dependencies @@ -2,4 +2,3 @@ libogg libpng ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/libxml2/dependencies b/build/pkgs/libxml2/dependencies index 6a9b467fe73..e1903120ece 100644 --- a/build/pkgs/libxml2/dependencies +++ b/build/pkgs/libxml2/dependencies @@ -2,4 +2,3 @@ iconv zlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lidia/SPKG.rst b/build/pkgs/lidia/SPKG.rst index 085cacf4e1f..7be393335db 100644 --- a/build/pkgs/lidia/SPKG.rst +++ b/build/pkgs/lidia/SPKG.rst @@ -26,7 +26,3 @@ Upstream Contact Matthias Köppe, UC Davis, CA, USA -Dependencies ------------- - -GMP. diff --git a/build/pkgs/lidia/dependencies b/build/pkgs/lidia/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/lidia/dependencies +++ b/build/pkgs/lidia/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lie/dependencies b/build/pkgs/lie/dependencies index 299ba61f5b7..9f475af894a 100644 --- a/build/pkgs/lie/dependencies +++ b/build/pkgs/lie/dependencies @@ -2,4 +2,3 @@ readline ncurses ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/linbox/dependencies b/build/pkgs/linbox/dependencies index 98b93071996..16264e23edc 100644 --- a/build/pkgs/linbox/dependencies +++ b/build/pkgs/linbox/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ntl givaro mpfr iml flint fflas_ffpack ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lrcalc/dependencies b/build/pkgs/lrcalc/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/lrcalc/dependencies +++ b/build/pkgs/lrcalc/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lrcalc_python/dependencies b/build/pkgs/lrcalc_python/dependencies index 63e5177ae0d..27c96045586 100644 --- a/build/pkgs/lrcalc_python/dependencies +++ b/build/pkgs/lrcalc_python/dependencies @@ -2,4 +2,3 @@ $(PYTHON) lrcalc | $(PYTHON_TOOLCHAIN) cython ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/lrslib/dependencies b/build/pkgs/lrslib/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/lrslib/dependencies +++ b/build/pkgs/lrslib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/m4ri/SPKG.rst b/build/pkgs/m4ri/SPKG.rst index 6ecd2218831..d5eb3478af3 100644 --- a/build/pkgs/m4ri/SPKG.rst +++ b/build/pkgs/m4ri/SPKG.rst @@ -20,12 +20,6 @@ Upstream Contact - Email: - Website: https://bitbucket.org/malb/m4ri -Dependencies ------------- - -- libPNG - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/m4ri/dependencies b/build/pkgs/m4ri/dependencies index a32404ffb8e..a6ce9ea4411 100644 --- a/build/pkgs/m4ri/dependencies +++ b/build/pkgs/m4ri/dependencies @@ -2,4 +2,3 @@ libpng ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/m4rie/dependencies b/build/pkgs/m4rie/dependencies index 4756344de51..8c26128557d 100644 --- a/build/pkgs/m4rie/dependencies +++ b/build/pkgs/m4rie/dependencies @@ -2,4 +2,3 @@ m4ri ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/markupsafe/SPKG.rst b/build/pkgs/markupsafe/SPKG.rst index 483b2aca876..907793aab6e 100644 --- a/build/pkgs/markupsafe/SPKG.rst +++ b/build/pkgs/markupsafe/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact Home page: http://github.com/mitsuhiko/markupsafe -Dependencies ------------- - -Python, setuptools diff --git a/build/pkgs/markupsafe/checksums.ini b/build/pkgs/markupsafe/checksums.ini index 3f0471b552e..5939d7266eb 100644 --- a/build/pkgs/markupsafe/checksums.ini +++ b/build/pkgs/markupsafe/checksums.ini @@ -1,4 +1,5 @@ -tarball=markupsafe-VERSION.tar.gz -sha1=f70e5fd3c120a1b108d4347ea1115e3962c42026 -md5=43fd756864fe42063068e092e220c57b -cksum=310980784 +tarball=MarkupSafe-VERSION.tar.gz +sha1=8bd9855f5b92145b6bc0d38cc241d0253cccc5a8 +md5=9809f9fdd98bc835b0c21aa8f79cbf30 +cksum=928883078 +upstream_url=https://pypi.io/packages/source/m/markupsafe/MarkupSafe-VERSION.tar.gz diff --git a/build/pkgs/markupsafe/dependencies b/build/pkgs/markupsafe/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/markupsafe/dependencies +++ b/build/pkgs/markupsafe/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/markupsafe/package-version.txt b/build/pkgs/markupsafe/package-version.txt index 524cb55242b..3e3c2f1e5ed 100644 --- a/build/pkgs/markupsafe/package-version.txt +++ b/build/pkgs/markupsafe/package-version.txt @@ -1 +1 @@ -1.1.1 +2.1.1 diff --git a/build/pkgs/markupsafe/spkg-install.in b/build/pkgs/markupsafe/spkg-install.in index b9bfecbfd50..37ac1a53437 100644 --- a/build/pkgs/markupsafe/spkg-install.in +++ b/build/pkgs/markupsafe/spkg-install.in @@ -1,14 +1,2 @@ -if [ -z "$SAGE_LOCAL" ]; then - echo >&2 "SAGE_LOCAL undefined ... exiting" - echo >&2 "Maybe run 'sage --sh'?" - exit 1 -fi - cd src - sdh_pip_install . - -if [ $? -ne 0 ]; then - echo "Error installing markupsafe ... exiting" - exit 1 -fi diff --git a/build/pkgs/mathics/SPKG.rst b/build/pkgs/mathics/SPKG.rst index db4a63b84f1..09f9e87aea0 100644 --- a/build/pkgs/mathics/SPKG.rst +++ b/build/pkgs/mathics/SPKG.rst @@ -1,5 +1,5 @@ -Mathics3: A general-purpose computer algebra system. -==================================================== +mathics: A general-purpose computer algebra system +================================================== Description ----------- diff --git a/build/pkgs/mathics/dependencies b/build/pkgs/mathics/dependencies index ab33cbad598..ac723a5ac26 100644 --- a/build/pkgs/mathics/dependencies +++ b/build/pkgs/mathics/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) | $(PYTHON_TOOLCHAIN) pint palettable mathics_scanner $(and $(filter-out no,$(SAGE_CHECK_mathics)), $(SAGERUNTIME) ipywidgets importlib_metadata sympy mpmath matplotlib) +$(PYTHON) | $(PYTHON_TOOLCHAIN) pint palettable mathics_scanner ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/mathics/dependencies_check b/build/pkgs/mathics/dependencies_check new file mode 100644 index 00000000000..a2c2a63716e --- /dev/null +++ b/build/pkgs/mathics/dependencies_check @@ -0,0 +1 @@ +$(SAGERUNTIME) ipywidgets importlib_metadata sympy mpmath matplotlib diff --git a/build/pkgs/mathjax/SPKG.rst b/build/pkgs/mathjax/SPKG.rst index 9ffa178b269..630198fdeb9 100644 --- a/build/pkgs/mathjax/SPKG.rst +++ b/build/pkgs/mathjax/SPKG.rst @@ -13,25 +13,7 @@ License Apache License, version 2.0 - Upstream Contact ---------------- Home page: https://www.mathjax.org/ - -Dependencies ------------- - -None. - - -Special Update/Build Instructions ---------------------------------- - -None. - - -Patches -------- - -None. diff --git a/build/pkgs/matplotlib/dependencies b/build/pkgs/matplotlib/dependencies index 0b3e62b01c1..1fcb30a9c9d 100644 --- a/build/pkgs/matplotlib/dependencies +++ b/build/pkgs/matplotlib/dependencies @@ -2,4 +2,3 @@ $(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull font ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/maxima/SPKG.rst b/build/pkgs/maxima/SPKG.rst index aac4e574185..a96fbf42354 100644 --- a/build/pkgs/maxima/SPKG.rst +++ b/build/pkgs/maxima/SPKG.rst @@ -30,12 +30,6 @@ Upstream Contact - The Maxima mailing list - see http://maxima.sourceforge.net/maximalist.html -Dependencies ------------- - -- ECL (Embedded Common Lisp) - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/maxima/dependencies b/build/pkgs/maxima/dependencies index ed6be201375..fffb89e2050 100644 --- a/build/pkgs/maxima/dependencies +++ b/build/pkgs/maxima/dependencies @@ -2,4 +2,3 @@ ecl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mcqd/SPKG.rst b/build/pkgs/mcqd/SPKG.rst index 7e7a2b83b97..17bf4d17fd6 100644 --- a/build/pkgs/mcqd/SPKG.rst +++ b/build/pkgs/mcqd/SPKG.rst @@ -19,7 +19,3 @@ Upstream Contact MCQD is currently being maintained by Janez Konc. https://gitlab.com/janezkonc/mcqd -Dependencies ------------- - -None diff --git a/build/pkgs/memory_allocator/SPKG.rst b/build/pkgs/memory_allocator/SPKG.rst index 42975c02f55..e85eaa2eb0e 100644 --- a/build/pkgs/memory_allocator/SPKG.rst +++ b/build/pkgs/memory_allocator/SPKG.rst @@ -1,5 +1,5 @@ -MemoryAllocator: An extension class to allocate memory easily with cython. -========================================================================== +memory\_allocator: An extension class to allocate memory easily with Cython +=========================================================================== This extension class started as part of the Sage software. @@ -20,7 +20,3 @@ Upstream Contact https://github.com/sagemath/memory_allocator -Dependencies ------------- - -- Cython diff --git a/build/pkgs/memory_allocator/dependencies b/build/pkgs/memory_allocator/dependencies index d3dac75e5f2..296a2bebad3 100644 --- a/build/pkgs/memory_allocator/dependencies +++ b/build/pkgs/memory_allocator/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mistune/SPKG.rst b/build/pkgs/mistune/SPKG.rst index 73c67f71a37..7d08e818625 100644 --- a/build/pkgs/mistune/SPKG.rst +++ b/build/pkgs/mistune/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact Home Page: https://github.com/lepture/mistune -Dependencies ------------- - -Python, Cython, Pip diff --git a/build/pkgs/mistune/dependencies b/build/pkgs/mistune/dependencies index d3dac75e5f2..296a2bebad3 100644 --- a/build/pkgs/mistune/dependencies +++ b/build/pkgs/mistune/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/modular_decomposition/SPKG.rst b/build/pkgs/modular_decomposition/SPKG.rst index 31c617357c1..543b8ce1b6b 100644 --- a/build/pkgs/modular_decomposition/SPKG.rst +++ b/build/pkgs/modular_decomposition/SPKG.rst @@ -21,12 +21,3 @@ Fabien de Montgolfier http://www.liafa.jussieu.fr/~fm/ -Dependencies ------------- - -None - -Patches -------- - -None diff --git a/build/pkgs/mpc/SPKG.rst b/build/pkgs/mpc/SPKG.rst index f51f4ce4ddb..821daf9f1db 100644 --- a/build/pkgs/mpc/SPKG.rst +++ b/build/pkgs/mpc/SPKG.rst @@ -28,13 +28,6 @@ The MPC team can be contacted via the MPC mailing list: mpc-discuss@lists.gforge.inria.fr -Dependencies ------------- - -- MPIR -- MPFR - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/mpc/dependencies b/build/pkgs/mpc/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/mpc/dependencies +++ b/build/pkgs/mpc/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpfi/SPKG.rst b/build/pkgs/mpfi/SPKG.rst index 5aa81fc9db9..cb145ca0e2a 100644 --- a/build/pkgs/mpfi/SPKG.rst +++ b/build/pkgs/mpfi/SPKG.rst @@ -38,8 +38,3 @@ The MPFI website is located at http://mpfi.gforge.inria.fr/ The MPFI team can be contacted via the MPFI mailing list: mpfi-users@lists.gforge.inria.fr -Dependencies ------------- - -- GMP -- MPFR diff --git a/build/pkgs/mpfi/dependencies b/build/pkgs/mpfi/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/mpfi/dependencies +++ b/build/pkgs/mpfi/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpfr/SPKG.rst b/build/pkgs/mpfr/SPKG.rst index b5b38b3603d..23b9d9110d1 100644 --- a/build/pkgs/mpfr/SPKG.rst +++ b/build/pkgs/mpfr/SPKG.rst @@ -39,13 +39,6 @@ The MPFR website is located at http://mpfr.org/ The MPFR team can be contacted via the MPFR mailing list: mpfr@loria.fr -Dependencies ------------- - -- GMP/MPIR -- GNU patch - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/mpfr/dependencies b/build/pkgs/mpfr/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/mpfr/dependencies +++ b/build/pkgs/mpfr/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpfrcx/dependencies b/build/pkgs/mpfrcx/dependencies index f51a741fc82..1c5fe72f749 100644 --- a/build/pkgs/mpfrcx/dependencies +++ b/build/pkgs/mpfrcx/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr mpc ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/mpmath/SPKG.rst b/build/pkgs/mpmath/SPKG.rst index 7ed4d8abe01..279d47a0318 100644 --- a/build/pkgs/mpmath/SPKG.rst +++ b/build/pkgs/mpmath/SPKG.rst @@ -23,7 +23,3 @@ Upstream Contact - http://mpmath.org - Website: https://github.com/fredrik-johansson/mpmath/ -Dependencies ------------- - -- Python diff --git a/build/pkgs/mpmath/dependencies b/build/pkgs/mpmath/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/mpmath/dependencies +++ b/build/pkgs/mpmath/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nauty/dependencies b/build/pkgs/nauty/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/nauty/dependencies +++ b/build/pkgs/nauty/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nbconvert/dependencies b/build/pkgs/nbconvert/dependencies index 86e4ceccf2e..5f8b20ddcf8 100644 --- a/build/pkgs/nbconvert/dependencies +++ b/build/pkgs/nbconvert/dependencies @@ -2,4 +2,3 @@ $(PYTHON) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints b ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nbformat/dependencies b/build/pkgs/nbformat/dependencies index c6dc6e3aed4..252d9165ae1 100644 --- a/build/pkgs/nbformat/dependencies +++ b/build/pkgs/nbformat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) jsonschema ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ncurses/SPKG.rst b/build/pkgs/ncurses/SPKG.rst index 208fad87814..7c50871739e 100644 --- a/build/pkgs/ncurses/SPKG.rst +++ b/build/pkgs/ncurses/SPKG.rst @@ -37,12 +37,6 @@ Upstream Contact - bug-ncurses@gnu.org -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/ncurses/checksums.ini b/build/pkgs/ncurses/checksums.ini index 27620e7d25a..f67d0e23402 100644 --- a/build/pkgs/ncurses/checksums.ini +++ b/build/pkgs/ncurses/checksums.ini @@ -1,4 +1,5 @@ tarball=ncurses-VERSION.tar.gz -sha1=acd606135a5124905da770803c05f1f20dd3b21c -md5=ee13d052e1ead260d7c28071f46eefb1 -cksum=1470804880 +sha1=38fb1462d13b04bb900adf07918725c4b7ed0682 +md5=a2736befde5fee7d2b7eb45eb281cdbe +cksum=981463359 +upstream_url=https://ftp.gnu.org/pub/gnu/ncurses/ncurses-VERSION.tar.gz diff --git a/build/pkgs/ncurses/dependencies b/build/pkgs/ncurses/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/ncurses/dependencies +++ b/build/pkgs/ncurses/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ncurses/package-version.txt b/build/pkgs/ncurses/package-version.txt index d5bfaf7a67f..0faee7d968e 100644 --- a/build/pkgs/ncurses/package-version.txt +++ b/build/pkgs/ncurses/package-version.txt @@ -1 +1 @@ -6.0.p0 +6.3 diff --git a/build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch b/build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch deleted file mode 100644 index 751ff5c3290..00000000000 --- a/build/pkgs/ncurses/patches/work_around_changed_output_of_GNU_cpp_5.x.patch +++ /dev/null @@ -1,24 +0,0 @@ -Building ncurses with GCC 5 (or more precisely, with its 'cpp') fails with a -syntax error, caused by earlier preprocessing. - -(I'm not entirely sure whether it's a GCC bug or rather caused by a new -feature which breaks further processing with 'awk' and 'sed'; I *think* -at least the 'awk' inline script "AW2" simply isn't prepared for the changed -output of 'cpp' w.r.t. line directives [1]. Anyway, the patch fixes the issue.) - -[1] https://gcc.gnu.org/gcc-5/porting_to.html - - ---- ncurses-5.9.20131221/ncurses/base/MKlib_gen.sh 2011-06-04 21:14:08.000000000 +0200 -+++ ncurses-5.9.20131221/ncurses/base/MKlib_gen.sh 2015-04-26 00:47:06.911680782 +0200 -@@ -62,7 +62,9 @@ - if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - if test "${LC_COLLATE+set}" = set; then LC_COLLATE=C; export LC_COLLATE; fi - --preprocessor="$1 -DNCURSES_INTERNALS -I../include" -+# Work around "unexpected" output of GCC 5.x's cpp w.r.t. #line directives -+# by simply suppressing them: -+preprocessor="$1 -P -DNCURSES_INTERNALS -I../include" - AWK="$2" - USE="$3" - diff --git a/build/pkgs/networkx/dependencies b/build/pkgs/networkx/dependencies index 2a20cb459ba..8eb6920e25d 100644 --- a/build/pkgs/networkx/dependencies +++ b/build/pkgs/networkx/dependencies @@ -1,5 +1,4 @@ -$(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy $(and $(filter-out no,$(SAGE_CHECK_networkx)), pytest) +$(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ninja_build/SPKG.rst b/build/pkgs/ninja_build/SPKG.rst index 90195aa30eb..5eef3722b85 100644 --- a/build/pkgs/ninja_build/SPKG.rst +++ b/build/pkgs/ninja_build/SPKG.rst @@ -17,7 +17,3 @@ Upstream Contact https://ninja-build.org/ -Dependencies ------------- - -None diff --git a/build/pkgs/ninja_build/dependencies b/build/pkgs/ninja_build/dependencies index 1a36cc52351..6b134137610 100644 --- a/build/pkgs/ninja_build/dependencies +++ b/build/pkgs/ninja_build/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nodeenv/SPKG.rst b/build/pkgs/nodeenv/SPKG.rst index 43c94e9abf6..397d909f16d 100644 --- a/build/pkgs/nodeenv/SPKG.rst +++ b/build/pkgs/nodeenv/SPKG.rst @@ -19,7 +19,3 @@ Upstream Contact Home page: https://github.com/ekalinin/nodeenv -Dependencies ------------- - -- Python diff --git a/build/pkgs/nodeenv/dependencies b/build/pkgs/nodeenv/dependencies index dc5a209df7b..16df46f57ee 100644 --- a/build/pkgs/nodeenv/dependencies +++ b/build/pkgs/nodeenv/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) certifi ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/nodejs/SPKG.rst b/build/pkgs/nodejs/SPKG.rst index 8686b7bf566..1176f4fea3b 100644 --- a/build/pkgs/nodejs/SPKG.rst +++ b/build/pkgs/nodejs/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact Home page: https://nodejs.org/ -Dependencies ------------- - -- nodeenv diff --git a/build/pkgs/nodejs/dependencies b/build/pkgs/nodejs/dependencies index 943a10ee5f5..a8de0ed1559 100644 --- a/build/pkgs/nodejs/dependencies +++ b/build/pkgs/nodejs/dependencies @@ -2,4 +2,3 @@ nodeenv ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/normaliz/SPKG.rst b/build/pkgs/normaliz/SPKG.rst index f43f767e3d0..c2f964bc0f2 100644 --- a/build/pkgs/normaliz/SPKG.rst +++ b/build/pkgs/normaliz/SPKG.rst @@ -25,13 +25,6 @@ Upstream Contact and https://github.com/Normaliz -Dependencies ------------- - -- GMP/MPIR -- boost - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/normaliz/dependencies b/build/pkgs/normaliz/dependencies index 66f3b59c2d2..a809da4b16d 100644 --- a/build/pkgs/normaliz/dependencies +++ b/build/pkgs/normaliz/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) flint e_antic libnauty ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/notebook/dependencies b/build/pkgs/notebook/dependencies index ba4f335e19a..9f5cb330ae2 100644 --- a/build/pkgs/notebook/dependencies +++ b/build/pkgs/notebook/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython jupyter_client ipykernel nbconvert nbfor ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/notedown/SPKG.rst b/build/pkgs/notedown/SPKG.rst index ca460eb925a..54cc022f4d0 100644 --- a/build/pkgs/notedown/SPKG.rst +++ b/build/pkgs/notedown/SPKG.rst @@ -17,12 +17,3 @@ Upstream Contact Author: Aaron O'Leary Home page: https://github.com/aaren/notedown -Dependencies ------------- - -- Python -- setuptools -- nbformat -- nbconvert -- six -- pandoc_attributes diff --git a/build/pkgs/notedown/dependencies b/build/pkgs/notedown/dependencies index 229a2ffe418..ea77eefc7f4 100644 --- a/build/pkgs/notedown/dependencies +++ b/build/pkgs/notedown/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(PYTHON_TOOLCHAIN) | pip nbformat nbconvert six pandoc_attributes ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ntl/SPKG.rst b/build/pkgs/ntl/SPKG.rst index 0641f7317fb..31c1844d655 100644 --- a/build/pkgs/ntl/SPKG.rst +++ b/build/pkgs/ntl/SPKG.rst @@ -22,13 +22,6 @@ Upstream Contact - Victor Shoup - for contact info see http://www.shoup.net/ -Dependencies ------------- - -- gmp -- gf2x - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/ntl/dependencies b/build/pkgs/ntl/dependencies index e675d884464..c447688066a 100644 --- a/build/pkgs/ntl/dependencies +++ b/build/pkgs/ntl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) gf2x ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/numpy/SPKG.rst b/build/pkgs/numpy/SPKG.rst index 776121ca731..80279977bed 100644 --- a/build/pkgs/numpy/SPKG.rst +++ b/build/pkgs/numpy/SPKG.rst @@ -16,17 +16,6 @@ Upstream Contact - Fernando Perez - Brian Granger -Dependencies ------------- - -- GNU patch -- Python -- Lapack -- Blas -- Atlas -- Fortran - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/numpy/dependencies b/build/pkgs/numpy/dependencies index f46820d1797..d3c0f0055e4 100644 --- a/build/pkgs/numpy/dependencies +++ b/build/pkgs/numpy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(BLAS) gfortran | $(PYTHON_TOOLCHAIN) pkgconfig cython ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/openblas/dependencies b/build/pkgs/openblas/dependencies index 46757bc2b61..a475340050b 100644 --- a/build/pkgs/openblas/dependencies +++ b/build/pkgs/openblas/dependencies @@ -2,4 +2,3 @@ gfortran | $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/openssl/dependencies b/build/pkgs/openssl/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/openssl/dependencies +++ b/build/pkgs/openssl/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ore_algebra/SPKG.rst b/build/pkgs/ore_algebra/SPKG.rst index 94044a54a65..5bb799bfe5b 100644 --- a/build/pkgs/ore_algebra/SPKG.rst +++ b/build/pkgs/ore_algebra/SPKG.rst @@ -26,8 +26,3 @@ Upstream Contact - Website: https://github.com/mkauers/ore_algebra/ - Sage accounts: mkauers, mmezzarobba -Dependencies ------------- - -- None - diff --git a/build/pkgs/ore_algebra/dependencies b/build/pkgs/ore_algebra/dependencies index fef6fe44862..05ba0d8954b 100644 --- a/build/pkgs/ore_algebra/dependencies +++ b/build/pkgs/ore_algebra/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/packaging/dependencies b/build/pkgs/packaging/dependencies index 2c5e2481b17..2323f9df04a 100644 --- a/build/pkgs/packaging/dependencies +++ b/build/pkgs/packaging/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | setuptools pip wheel pyparsing setuptools_wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pandoc_attributes/SPKG.rst b/build/pkgs/pandoc_attributes/SPKG.rst index c563b04365b..91b60e01b9d 100644 --- a/build/pkgs/pandoc_attributes/SPKG.rst +++ b/build/pkgs/pandoc_attributes/SPKG.rst @@ -19,14 +19,6 @@ Upstream Contact - Author: Aaron O'Leary - Home page: https://github.com/aaren/pandoc-attributes -Dependencies ------------- - -- Python -- setuptools -- pandocfilters - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pandoc_attributes/dependencies b/build/pkgs/pandoc_attributes/dependencies index 30b8148c07f..64f88253c78 100644 --- a/build/pkgs/pandoc_attributes/dependencies +++ b/build/pkgs/pandoc_attributes/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(PYTHON_TOOLCHAIN) | pip pandocfilters ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pandocfilters/SPKG.rst b/build/pkgs/pandocfilters/SPKG.rst index a4b73da9f99..50132ed9be5 100644 --- a/build/pkgs/pandocfilters/SPKG.rst +++ b/build/pkgs/pandocfilters/SPKG.rst @@ -17,12 +17,6 @@ Upstream Contact Author: John MacFarlane Home page: https://github.com/jgm/pandocfilters -Dependencies ------------- - -- Python - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pandocfilters/dependencies b/build/pkgs/pandocfilters/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pandocfilters/dependencies +++ b/build/pkgs/pandocfilters/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari/dependencies b/build/pkgs/pari/dependencies index 06ef082e690..c8379ce537b 100644 --- a/build/pkgs/pari/dependencies +++ b/build/pkgs/pari/dependencies @@ -2,4 +2,3 @@ readline $(MP_LIBRARY) | pari_galdata pari_seadata_small ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_elldata/dependencies b/build/pkgs/pari_elldata/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_elldata/dependencies +++ b/build/pkgs/pari_elldata/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_galdata/SPKG.rst b/build/pkgs/pari_galdata/SPKG.rst index 16a0c583200..099d9f87153 100644 --- a/build/pkgs/pari_galdata/SPKG.rst +++ b/build/pkgs/pari_galdata/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact http://pari.math.u-bordeaux.fr/ -Dependencies ------------- - -None (package contains data files only) diff --git a/build/pkgs/pari_galdata/dependencies b/build/pkgs/pari_galdata/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_galdata/dependencies +++ b/build/pkgs/pari_galdata/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_galpol/dependencies b/build/pkgs/pari_galpol/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_galpol/dependencies +++ b/build/pkgs/pari_galpol/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_nftables/dependencies b/build/pkgs/pari_nftables/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_nftables/dependencies +++ b/build/pkgs/pari_nftables/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_seadata/dependencies b/build/pkgs/pari_seadata/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_seadata/dependencies +++ b/build/pkgs/pari_seadata/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pari_seadata_small/SPKG.rst b/build/pkgs/pari_seadata_small/SPKG.rst index 6be2f5d5fd8..3aaa0917ab8 100644 --- a/build/pkgs/pari_seadata_small/SPKG.rst +++ b/build/pkgs/pari_seadata_small/SPKG.rst @@ -20,7 +20,3 @@ Upstream Contact http://pari.math.u-bordeaux.fr/ -Dependencies ------------- - -None (package contains data files only) diff --git a/build/pkgs/pari_seadata_small/dependencies b/build/pkgs/pari_seadata_small/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/pari_seadata_small/dependencies +++ b/build/pkgs/pari_seadata_small/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/parso/dependencies b/build/pkgs/parso/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/parso/dependencies +++ b/build/pkgs/parso/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/patch/SPKG.rst b/build/pkgs/patch/SPKG.rst index e7719fd6255..495c817cd28 100644 --- a/build/pkgs/patch/SPKG.rst +++ b/build/pkgs/patch/SPKG.rst @@ -32,12 +32,6 @@ Submit bugs: http://savannah.gnu.org/bugs/?func=additem&group=patch Mailing lists: bug-patch@gnu.org -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/patch/dependencies b/build/pkgs/patch/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/patch/dependencies +++ b/build/pkgs/patch/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pcre/SPKG.rst b/build/pkgs/pcre/SPKG.rst index 55cbfbdbbfa..d1839c2c1df 100644 --- a/build/pkgs/pcre/SPKG.rst +++ b/build/pkgs/pcre/SPKG.rst @@ -17,12 +17,6 @@ Upstream Contact Mailing list at https://lists.exim.org/mailman/listinfo/pcre-dev -Dependencies ------------- - -None listed. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pcre/dependencies b/build/pkgs/pcre/dependencies index 0dd12df6ad1..1ccba14e349 100644 --- a/build/pkgs/pcre/dependencies +++ b/build/pkgs/pcre/dependencies @@ -2,4 +2,3 @@ bzip2 ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/perl_term_readline_gnu/SPKG.rst b/build/pkgs/perl_term_readline_gnu/SPKG.rst index 402397926b1..aa2a0791d79 100644 --- a/build/pkgs/perl_term_readline_gnu/SPKG.rst +++ b/build/pkgs/perl_term_readline_gnu/SPKG.rst @@ -19,7 +19,3 @@ Upstream Contact Hiroo HAYASHI -Dependencies ------------- - -readline diff --git a/build/pkgs/perl_term_readline_gnu/dependencies b/build/pkgs/perl_term_readline_gnu/dependencies index 6a04d4dc1ff..7d283a67703 100644 --- a/build/pkgs/perl_term_readline_gnu/dependencies +++ b/build/pkgs/perl_term_readline_gnu/dependencies @@ -2,4 +2,3 @@ readline ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pexpect/SPKG.rst b/build/pkgs/pexpect/SPKG.rst index 0c087e38265..b972eecef2f 100644 --- a/build/pkgs/pexpect/SPKG.rst +++ b/build/pkgs/pexpect/SPKG.rst @@ -20,8 +20,3 @@ Upstream Contact - http://pexpect.readthedocs.org/en/stable/ - https://github.com/pexpect/pexpect -Dependencies ------------- - -- GNU patch -- Python diff --git a/build/pkgs/pexpect/dependencies b/build/pkgs/pexpect/dependencies index c320fcc874e..4a942502496 100644 --- a/build/pkgs/pexpect/dependencies +++ b/build/pkgs/pexpect/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ptyprocess | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pickleshare/dependencies b/build/pkgs/pickleshare/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pickleshare/dependencies +++ b/build/pkgs/pickleshare/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pillow/SPKG.rst b/build/pkgs/pillow/SPKG.rst index 6b64325474e..6a4bd0d09c5 100644 --- a/build/pkgs/pillow/SPKG.rst +++ b/build/pkgs/pillow/SPKG.rst @@ -22,7 +22,3 @@ Upstream Contact - https://python-pillow.org/ - Homepage: http://python-imaging.github.io/ -Dependencies ------------- - -- Python diff --git a/build/pkgs/pillow/dependencies b/build/pkgs/pillow/dependencies index 48498b499f5..2ece64e58e8 100644 --- a/build/pkgs/pillow/dependencies +++ b/build/pkgs/pillow/dependencies @@ -2,4 +2,3 @@ $(PYTHON) zlib freetype | $(PYTHON_TOOLCHAIN) pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pip/SPKG.rst b/build/pkgs/pip/SPKG.rst index 55a897a9307..837967428b7 100644 --- a/build/pkgs/pip/SPKG.rst +++ b/build/pkgs/pip/SPKG.rst @@ -24,8 +24,3 @@ Upstream Contact - Mailing list: http://groups.google.com/group/python-virtualenv - Docs: https://pip.pypa.io/ -Dependencies ------------- - -- python -- setuptools diff --git a/build/pkgs/pip/dependencies b/build/pkgs/pip/dependencies index 6f2aa240c02..618d627629a 100644 --- a/build/pkgs/pip/dependencies +++ b/build/pkgs/pip/dependencies @@ -2,4 +2,3 @@ $(PYTHON) setuptools wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pkgconf/SPKG.rst b/build/pkgs/pkgconf/SPKG.rst index ddf6c227948..64cf2bb4ebf 100644 --- a/build/pkgs/pkgconf/SPKG.rst +++ b/build/pkgs/pkgconf/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact https://github.com/pkgconf/pkgconf -Dependencies ------------- - -- C compiler + toolchain - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pkgconf/dependencies b/build/pkgs/pkgconf/dependencies index 5b535343f8d..47088a97fec 100644 --- a/build/pkgs/pkgconf/dependencies +++ b/build/pkgs/pkgconf/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pkgconfig/dependencies b/build/pkgs/pkgconfig/dependencies index 628b27750cd..79554fc438d 100644 --- a/build/pkgs/pkgconfig/dependencies +++ b/build/pkgs/pkgconfig/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/planarity/SPKG.rst b/build/pkgs/planarity/SPKG.rst index 095ac96e05b..75001aaaf32 100644 --- a/build/pkgs/planarity/SPKG.rst +++ b/build/pkgs/planarity/SPKG.rst @@ -26,12 +26,6 @@ Upstream Contact - John Boyer -Dependencies ------------- - -None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/planarity/dependencies b/build/pkgs/planarity/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/planarity/dependencies +++ b/build/pkgs/planarity/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/plantri/SPKG.rst b/build/pkgs/plantri/SPKG.rst index df6ef00e50c..df3210cec50 100644 --- a/build/pkgs/plantri/SPKG.rst +++ b/build/pkgs/plantri/SPKG.rst @@ -36,7 +36,3 @@ Brendan McKay See http://cs.anu.edu.au/~bdm/plantri -Dependencies ------------- - -- None diff --git a/build/pkgs/plantri/dependencies b/build/pkgs/plantri/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/plantri/dependencies +++ b/build/pkgs/plantri/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polylib/SPKG.rst b/build/pkgs/polylib/SPKG.rst index 89e4508cca6..23e7f1315ba 100644 --- a/build/pkgs/polylib/SPKG.rst +++ b/build/pkgs/polylib/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact - https://groups.google.com/forum/#!forum/isl-development -Dependencies ------------- - -- GMP diff --git a/build/pkgs/polylib/dependencies b/build/pkgs/polylib/dependencies index 2a23f3894a5..385df4faa7d 100644 --- a/build/pkgs/polylib/dependencies +++ b/build/pkgs/polylib/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ntl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polymake/dependencies b/build/pkgs/polymake/dependencies index 7d77b977a21..b3ed8ed4299 100644 --- a/build/pkgs/polymake/dependencies +++ b/build/pkgs/polymake/dependencies @@ -1,5 +1,4 @@ -$(MP_LIBRARY) bliss cddlib $(findstring lrslib,$(OPTIONAL_INSTALLED_PACKAGES)) normaliz perl_term_readline_gnu ppl perl_cpan_polymake_prereq libxml2 | ninja_build +$(MP_LIBRARY) bliss cddlib normaliz perl_term_readline_gnu ppl perl_cpan_polymake_prereq libxml2 | ninja_build ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polymake/dependencies_optional b/build/pkgs/polymake/dependencies_optional new file mode 100644 index 00000000000..c762c018aa3 --- /dev/null +++ b/build/pkgs/polymake/dependencies_optional @@ -0,0 +1 @@ +lrslib diff --git a/build/pkgs/polytopes_db/SPKG.rst b/build/pkgs/polytopes_db/SPKG.rst index 0e43231b7db..b1a26e6e73d 100644 --- a/build/pkgs/polytopes_db/SPKG.rst +++ b/build/pkgs/polytopes_db/SPKG.rst @@ -26,7 +26,3 @@ Upstream Contact http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html -Dependencies ------------- - -None diff --git a/build/pkgs/polytopes_db/dependencies b/build/pkgs/polytopes_db/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/polytopes_db/dependencies +++ b/build/pkgs/polytopes_db/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/polytopes_db_4d/SPKG.rst b/build/pkgs/polytopes_db_4d/SPKG.rst index 2e5ddcce995..589406d92d1 100644 --- a/build/pkgs/polytopes_db_4d/SPKG.rst +++ b/build/pkgs/polytopes_db_4d/SPKG.rst @@ -20,7 +20,3 @@ SPKG Maintainers Volker Braun -Dependencies ------------- - -None diff --git a/build/pkgs/ppl/dependencies b/build/pkgs/ppl/dependencies index e9c206ff16e..7af120e99c2 100644 --- a/build/pkgs/ppl/dependencies +++ b/build/pkgs/ppl/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) glpk ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/prometheus_client/dependencies b/build/pkgs/prometheus_client/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/prometheus_client/dependencies +++ b/build/pkgs/prometheus_client/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/prompt_toolkit/dependencies b/build/pkgs/prompt_toolkit/dependencies index 35259ef6b78..57465daf937 100644 --- a/build/pkgs/prompt_toolkit/dependencies +++ b/build/pkgs/prompt_toolkit/dependencies @@ -2,4 +2,3 @@ $(PYTHON) six wcwidth | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/ptyprocess/SPKG.rst b/build/pkgs/ptyprocess/SPKG.rst index 6cb6d2a5bd7..f72812b852d 100644 --- a/build/pkgs/ptyprocess/SPKG.rst +++ b/build/pkgs/ptyprocess/SPKG.rst @@ -26,7 +26,3 @@ Upstream Contact https://github.com/pexpect/ptyprocess -Dependencies ------------- - -- Python diff --git a/build/pkgs/ptyprocess/dependencies b/build/pkgs/ptyprocess/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/ptyprocess/dependencies +++ b/build/pkgs/ptyprocess/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycosat/SPKG.rst b/build/pkgs/pycosat/SPKG.rst index dc146802fc4..9853e76a211 100644 --- a/build/pkgs/pycosat/SPKG.rst +++ b/build/pkgs/pycosat/SPKG.rst @@ -23,12 +23,6 @@ Upstream Contact - PicoSAT: http://fmv.jku.at/picosat/ - pycosat: https://github.com/ContinuumIO/pycosat -Dependencies ------------- - -None. - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pycosat/dependencies b/build/pkgs/pycosat/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pycosat/dependencies +++ b/build/pkgs/pycosat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycparser/dependencies b/build/pkgs/pycparser/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pycparser/dependencies +++ b/build/pkgs/pycparser/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycryptosat/dependencies b/build/pkgs/pycryptosat/dependencies index 8b5414a59d4..b897ff72eae 100644 --- a/build/pkgs/pycryptosat/dependencies +++ b/build/pkgs/pycryptosat/dependencies @@ -2,4 +2,3 @@ $(PYTHON) m4ri zlib libpng cryptominisat | cmake boost_cropped $(PYTHON_TOOLCHAI ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pycygwin/dependencies b/build/pkgs/pycygwin/dependencies index d3dac75e5f2..296a2bebad3 100644 --- a/build/pkgs/pycygwin/dependencies +++ b/build/pkgs/pycygwin/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pygments/SPKG.rst b/build/pkgs/pygments/SPKG.rst index 7d799b5d090..4a5126cb858 100644 --- a/build/pkgs/pygments/SPKG.rst +++ b/build/pkgs/pygments/SPKG.rst @@ -35,12 +35,6 @@ Upstream Contact - Author: Georg Brandl - Home Page: https://pygments.org -Dependencies ------------- - -Python - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pygments/dependencies b/build/pkgs/pygments/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pygments/dependencies +++ b/build/pkgs/pygments/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pynormaliz/SPKG.rst b/build/pkgs/pynormaliz/SPKG.rst index c2dd1c97c3d..0875b81af19 100644 --- a/build/pkgs/pynormaliz/SPKG.rst +++ b/build/pkgs/pynormaliz/SPKG.rst @@ -17,12 +17,5 @@ Upstream Contact https://github.com/sebasguts/PyNormaliz -Dependencies ------------- - -- pip -- normaliz - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pynormaliz/dependencies b/build/pkgs/pynormaliz/dependencies index 40184a0cf5d..76200c19d23 100644 --- a/build/pkgs/pynormaliz/dependencies +++ b/build/pkgs/pynormaliz/dependencies @@ -2,4 +2,3 @@ $(PYTHON) normaliz | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pyparsing/SPKG.rst b/build/pkgs/pyparsing/SPKG.rst index 28bb37a10c6..0b765140901 100644 --- a/build/pkgs/pyparsing/SPKG.rst +++ b/build/pkgs/pyparsing/SPKG.rst @@ -18,7 +18,3 @@ Upstream Contact - Author: Paul McGuire - Home page: http://pyparsing.wikispaces.com -Dependencies ------------- - -Python diff --git a/build/pkgs/pyparsing/dependencies b/build/pkgs/pyparsing/dependencies index 3614951f5cb..d6e348e95b9 100644 --- a/build/pkgs/pyparsing/dependencies +++ b/build/pkgs/pyparsing/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | setuptools pip wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pyrsistent/dependencies b/build/pkgs/pyrsistent/dependencies index 8b3637a0a0e..4361e46ddaf 100644 --- a/build/pkgs/pyrsistent/dependencies +++ b/build/pkgs/pyrsistent/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/python3/dependencies b/build/pkgs/python3/dependencies index 0b9e91a711c..9bdcf05edc4 100644 --- a/build/pkgs/python3/dependencies +++ b/build/pkgs/python3/dependencies @@ -2,4 +2,3 @@ zlib readline sqlite libpng bzip2 liblzma xz libffi openssl ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/python3/distros/debian.txt b/build/pkgs/python3/distros/debian.txt index c647aec3c34..6b3ebf766dc 100644 --- a/build/pkgs/python3/distros/debian.txt +++ b/build/pkgs/python3/distros/debian.txt @@ -1,3 +1,4 @@ python3 libpython3-dev python3-distutils +python3-venv diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4 index 27af5be576d..a217268b040 100644 --- a/build/pkgs/python3/spkg-configure.m4 +++ b/build/pkgs/python3/spkg-configure.m4 @@ -1,6 +1,6 @@ SAGE_SPKG_CONFIGURE([python3], [ - m4_pushdef([MIN_VERSION], [3.7.0]) - m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.7.0]) + m4_pushdef([MIN_VERSION], [3.8.0]) + m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.8.0]) m4_pushdef([LT_STABLE_VERSION], [3.11.0]) m4_pushdef([LT_VERSION], [3.11.0]) AC_ARG_WITH([python], @@ -24,7 +24,7 @@ SAGE_SPKG_CONFIGURE([python3], [ dnl Check if we can do venv with a system python3 dnl instead of building our own copy. dnl Trac #31160: We no longer check for readline here. - check_modules="sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core, ssl" + check_modules="sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core, ssl, ensurepip" AC_CACHE_CHECK([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules], [ac_cv_path_PYTHON3], [ AS_IF([test x"$ac_path_PYTHON3" != x], [dnl checking explicitly specified $with_python AC_MSG_RESULT([]) diff --git a/build/pkgs/python_igraph/SPKG.rst b/build/pkgs/python_igraph/SPKG.rst index b8725f11451..6c3a52a3082 100644 --- a/build/pkgs/python_igraph/SPKG.rst +++ b/build/pkgs/python_igraph/SPKG.rst @@ -19,12 +19,5 @@ Upstream Contact http://igraph.org/python/ -Dependencies ------------- - -- python -- igraph - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/python_igraph/dependencies b/build/pkgs/python_igraph/dependencies index d76acadd7e6..67ed15160f4 100644 --- a/build/pkgs/python_igraph/dependencies +++ b/build/pkgs/python_igraph/dependencies @@ -2,4 +2,3 @@ igraph texttable $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pytz/dependencies b/build/pkgs/pytz/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/pytz/dependencies +++ b/build/pkgs/pytz/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/pyzmq/SPKG.rst b/build/pkgs/pyzmq/SPKG.rst index 356af355484..6896f7d256b 100644 --- a/build/pkgs/pyzmq/SPKG.rst +++ b/build/pkgs/pyzmq/SPKG.rst @@ -17,14 +17,6 @@ Upstream Contact http://www.zeromq.org -Dependencies ------------- - -- Python -- Cython -- zeromq - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/pyzmq/dependencies b/build/pkgs/pyzmq/dependencies index ab148841d34..c72b3d23340 100644 --- a/build/pkgs/pyzmq/dependencies +++ b/build/pkgs/pyzmq/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython zeromq | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/qepcad/SPKG.rst b/build/pkgs/qepcad/SPKG.rst index 1ac2993338e..fa8ef06fb7c 100644 --- a/build/pkgs/qepcad/SPKG.rst +++ b/build/pkgs/qepcad/SPKG.rst @@ -35,13 +35,6 @@ Upstream Contact https://www.usna.edu/Users/cs/wcbrown/qepcad/B/QEPCAD.html -Dependencies ------------- - -- readline -- saclib - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/qepcad/dependencies b/build/pkgs/qepcad/dependencies index c12d9eb11b8..8e67112f53d 100644 --- a/build/pkgs/qepcad/dependencies +++ b/build/pkgs/qepcad/dependencies @@ -2,4 +2,3 @@ readline saclib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/install into SAGE_ROOT/build/Makefile. diff --git a/build/pkgs/qhull/dependencies b/build/pkgs/qhull/dependencies index 66d6773d907..c225c495cc6 100644 --- a/build/pkgs/qhull/dependencies +++ b/build/pkgs/qhull/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/r/dependencies b/build/pkgs/r/dependencies index 281dc007225..c34daf966bd 100644 --- a/build/pkgs/r/dependencies +++ b/build/pkgs/r/dependencies @@ -2,4 +2,3 @@ $(BLAS) gfortran iconv readline bzip2 liblzma pcre curl | pkgconf ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/readline/SPKG.rst b/build/pkgs/readline/SPKG.rst index ddf2fe5eb16..80ff0d3ef8f 100644 --- a/build/pkgs/readline/SPKG.rst +++ b/build/pkgs/readline/SPKG.rst @@ -24,12 +24,6 @@ Upstream Contact - Chet Ramey at http://cnswww.cns.cwru.edu/~chet -Dependencies ------------- - -- ncurses - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/readline/checksums.ini b/build/pkgs/readline/checksums.ini index 5e4e180686f..05d4f89539f 100644 --- a/build/pkgs/readline/checksums.ini +++ b/build/pkgs/readline/checksums.ini @@ -1,5 +1,5 @@ tarball=readline-VERSION.tar.gz -sha1=d58041c2143595dc001d2777ae9a200be30198b0 -md5=7e6c1f16aee3244a69aba6e438295ca3 -cksum=3826776229 +sha1=8a05ad0d0ad67e18c383f1b2cf6a23bcbd46f87a +md5=12819fa739a78a6172400f399ab34f81 +cksum=829245750 upstream_url=https://ftp.gnu.org/gnu/readline/readline-VERSION.tar.gz diff --git a/build/pkgs/readline/dependencies b/build/pkgs/readline/dependencies index c3aa1a2cd99..7d1ee88ab32 100644 --- a/build/pkgs/readline/dependencies +++ b/build/pkgs/readline/dependencies @@ -2,4 +2,3 @@ ncurses ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/readline/package-version.txt b/build/pkgs/readline/package-version.txt index 657c5dea53b..6b409d977b8 100644 --- a/build/pkgs/readline/package-version.txt +++ b/build/pkgs/readline/package-version.txt @@ -1,2 +1 @@ -8.0 - +8.1.2 diff --git a/build/pkgs/requests/dependencies b/build/pkgs/requests/dependencies index b1bee0c4176..b896dbc3cac 100644 --- a/build/pkgs/requests/dependencies +++ b/build/pkgs/requests/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) idna urllib3 certifi charset_normalizer ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rpy2/SPKG.rst b/build/pkgs/rpy2/SPKG.rst index 0eb0b98bda5..a4d119802f1 100644 --- a/build/pkgs/rpy2/SPKG.rst +++ b/build/pkgs/rpy2/SPKG.rst @@ -22,10 +22,6 @@ Upstream Contact - https://rpy2.bitbucket.io -Dependencies ------------- - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/rpy2/dependencies b/build/pkgs/rpy2/dependencies index 35bbdcc39c9..862745ba3e0 100644 --- a/build/pkgs/rpy2/dependencies +++ b/build/pkgs/rpy2/dependencies @@ -1,5 +1,4 @@ -$(PYTHON) r cffi tzlocal pytz | $(PYTHON_TOOLCHAIN) pycparser $(and $(filter-out no,$(SAGE_CHECK_rpy2)), pytest numpy ipython) +$(PYTHON) r cffi tzlocal pytz | $(PYTHON_TOOLCHAIN) pycparser ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rpy2/dependencies_check b/build/pkgs/rpy2/dependencies_check new file mode 100644 index 00000000000..22c6e400a59 --- /dev/null +++ b/build/pkgs/rpy2/dependencies_check @@ -0,0 +1 @@ +pytest numpy ipython diff --git a/build/pkgs/rst2ipynb/SPKG.rst b/build/pkgs/rst2ipynb/SPKG.rst index ac19a2c8557..a514ae5a4c5 100644 --- a/build/pkgs/rst2ipynb/SPKG.rst +++ b/build/pkgs/rst2ipynb/SPKG.rst @@ -23,13 +23,6 @@ Upstream Contact Authors: Scott Sievert and Nicolas M. Thiéry Home page: https://github.com/nthiery/rst-to-ipynb -Dependencies ------------- - -- notedown -- pandoc - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/rst2ipynb/dependencies b/build/pkgs/rst2ipynb/dependencies index 4cf206f037d..7fcda2181e1 100644 --- a/build/pkgs/rst2ipynb/dependencies +++ b/build/pkgs/rst2ipynb/dependencies @@ -2,4 +2,3 @@ $(PYTHON) pandoc | $(PYTHON_TOOLCHAIN) notedown ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rubiks/dependencies b/build/pkgs/rubiks/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/rubiks/dependencies +++ b/build/pkgs/rubiks/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/rw/dependencies b/build/pkgs/rw/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/rw/dependencies +++ b/build/pkgs/rw/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/saclib/SPKG.rst b/build/pkgs/saclib/SPKG.rst index b55460978dd..06a733a7f20 100644 --- a/build/pkgs/saclib/SPKG.rst +++ b/build/pkgs/saclib/SPKG.rst @@ -35,7 +35,3 @@ Upstream Contact https://www.usna.edu/Users/cs/wcbrown/qepcad/B/QEPCAD.html -Dependencies ------------- - -None. diff --git a/build/pkgs/saclib/dependencies b/build/pkgs/saclib/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/saclib/dependencies +++ b/build/pkgs/saclib/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_conf/package-version.txt b/build/pkgs/sage_conf/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_conf/package-version.txt +++ b/build/pkgs/sage_conf/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sage_docbuild/package-version.txt b/build/pkgs/sage_docbuild/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_docbuild/package-version.txt +++ b/build/pkgs/sage_docbuild/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sage_numerical_backends_coin/dependencies b/build/pkgs/sage_numerical_backends_coin/dependencies index 2717db3a34f..4cbde1164f2 100644 --- a/build/pkgs/sage_numerical_backends_coin/dependencies +++ b/build/pkgs/sage_numerical_backends_coin/dependencies @@ -2,4 +2,3 @@ cbc cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_numerical_backends_cplex/dependencies b/build/pkgs/sage_numerical_backends_cplex/dependencies index bb56aad17be..0b35afa3540 100644 --- a/build/pkgs/sage_numerical_backends_cplex/dependencies +++ b/build/pkgs/sage_numerical_backends_cplex/dependencies @@ -2,4 +2,3 @@ cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sa ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_numerical_backends_gurobi/dependencies b/build/pkgs/sage_numerical_backends_gurobi/dependencies index bb56aad17be..0b35afa3540 100644 --- a/build/pkgs/sage_numerical_backends_gurobi/dependencies +++ b/build/pkgs/sage_numerical_backends_gurobi/dependencies @@ -2,4 +2,3 @@ cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sa ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_setup/dependencies b/build/pkgs/sage_setup/dependencies index 99b93d752bb..6fbb7edea4d 100644 --- a/build/pkgs/sage_setup/dependencies +++ b/build/pkgs/sage_setup/dependencies @@ -2,4 +2,3 @@ $(PYTHON) cython pkgconfig $(SAGE_ROOT)/pkgs/sage-setup/sage_setup/*.py $(SAGE_R ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sage_setup/package-version.txt b/build/pkgs/sage_setup/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_setup/package-version.txt +++ b/build/pkgs/sage_setup/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sage_sws2rst/dependencies b/build/pkgs/sage_sws2rst/dependencies index ec13b4746e1..5ca5e27df75 100644 --- a/build/pkgs/sage_sws2rst/dependencies +++ b/build/pkgs/sage_sws2rst/dependencies @@ -1 +1 @@ -$(PYTHON) beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_sage_sws2rst)), tox) +$(PYTHON) beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) diff --git a/build/pkgs/sage_sws2rst/dependencies_check b/build/pkgs/sage_sws2rst/dependencies_check new file mode 100644 index 00000000000..053148f8486 --- /dev/null +++ b/build/pkgs/sage_sws2rst/dependencies_check @@ -0,0 +1 @@ +tox diff --git a/build/pkgs/sage_sws2rst/package-version.txt b/build/pkgs/sage_sws2rst/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sage_sws2rst/package-version.txt +++ b/build/pkgs/sage_sws2rst/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies index c7b1154bf20..810713712ed 100644 --- a/build/pkgs/sagelib/dependencies +++ b/build/pkgs/sagelib/dependencies @@ -2,7 +2,6 @@ FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. The above are the *build-time* dependencies of the Sage library. These are, on the one hand, programs needed for the build/install process of the diff --git a/build/pkgs/sagelib/package-version.txt b/build/pkgs/sagelib/package-version.txt deleted file mode 100644 index 6442b83e510..00000000000 --- a/build/pkgs/sagelib/package-version.txt +++ /dev/null @@ -1 +0,0 @@ -9.7.beta1 diff --git a/build/pkgs/sagelib/package-version.txt b/build/pkgs/sagelib/package-version.txt new file mode 120000 index 00000000000..c4540217bba --- /dev/null +++ b/build/pkgs/sagelib/package-version.txt @@ -0,0 +1 @@ +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_categories/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_categories/package-version.txt b/build/pkgs/sagemath_categories/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sagemath_categories/package-version.txt +++ b/build/pkgs/sagemath_categories/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/SPKG.rst b/build/pkgs/sagemath_environment/SPKG.rst new file mode 120000 index 00000000000..b4545b4bda6 --- /dev/null +++ b/build/pkgs/sagemath_environment/SPKG.rst @@ -0,0 +1 @@ +src/README.rst \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/bootstrap b/build/pkgs/sagemath_environment/bootstrap new file mode 120000 index 00000000000..40542346a4e --- /dev/null +++ b/build/pkgs/sagemath_environment/bootstrap @@ -0,0 +1 @@ +../sagelib/bootstrap \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/dependencies b/build/pkgs/sagemath_environment/dependencies new file mode 120000 index 00000000000..55c209e6418 --- /dev/null +++ b/build/pkgs/sagemath_environment/dependencies @@ -0,0 +1 @@ +../sagemath_objects/dependencies \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt new file mode 100644 index 00000000000..bea4334d7e4 --- /dev/null +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -0,0 +1 @@ +sagemath-environment == 9.6rc3.post2 diff --git a/build/pkgs/sagemath_environment/package-version.txt b/build/pkgs/sagemath_environment/package-version.txt new file mode 120000 index 00000000000..c4540217bba --- /dev/null +++ b/build/pkgs/sagemath_environment/package-version.txt @@ -0,0 +1 @@ +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/spkg-install b/build/pkgs/sagemath_environment/spkg-install new file mode 120000 index 00000000000..e60fac9ffa1 --- /dev/null +++ b/build/pkgs/sagemath_environment/spkg-install @@ -0,0 +1 @@ +../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/spkg-src b/build/pkgs/sagemath_environment/spkg-src new file mode 100755 index 00000000000..4e2b7503da2 --- /dev/null +++ b/build/pkgs/sagemath_environment/spkg-src @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Script to prepare an sdist tarball for sagemath-categories +# This script is not used during build. +# +# HOW TO MAKE THE TARBALL: +# ./sage --sh build/pkgs/sagemath_categories/spkg-src + +if [ -z "$SAGE_ROOT" ] ; then + echo >&2 "Error - SAGE_ROOT undefined ... exiting" + echo >&2 "Maybe run 'sage -sh'?" + exit 1 +fi + +# Exit on failure +set -e + +cd build/pkgs/sagemath_environment + +cd src +python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_environment/src b/build/pkgs/sagemath_environment/src new file mode 120000 index 00000000000..a6bd42f71d3 --- /dev/null +++ b/build/pkgs/sagemath_environment/src @@ -0,0 +1 @@ +../../../pkgs/sagemath-environment \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/type b/build/pkgs/sagemath_environment/type new file mode 100644 index 00000000000..9839eb20815 --- /dev/null +++ b/build/pkgs/sagemath_environment/type @@ -0,0 +1 @@ +experimental diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index fcacb179b57..9aff58ee6b1 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,4 +1,4 @@ -FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig $(and $(filter-out no,$(SAGE_CHECK)), tox) +FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig # FORCE: Always run the spkg-install script # ipython - for the doctester diff --git a/build/pkgs/sagemath_objects/dependencies_check b/build/pkgs/sagemath_objects/dependencies_check new file mode 100644 index 00000000000..053148f8486 --- /dev/null +++ b/build/pkgs/sagemath_objects/dependencies_check @@ -0,0 +1 @@ +tox diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt new file mode 100644 index 00000000000..06766454a53 --- /dev/null +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -0,0 +1,2 @@ +# Pinned in Trac #29941 until proper namespace packages are supported in #28925. +sagemath-objects == 9.6rc3.post4 diff --git a/build/pkgs/sagemath_objects/package-version.txt b/build/pkgs/sagemath_objects/package-version.txt index cf10fe4b4e4..c4540217bba 120000 --- a/build/pkgs/sagemath_objects/package-version.txt +++ b/build/pkgs/sagemath_objects/package-version.txt @@ -1 +1 @@ -../sagelib/package-version.txt \ No newline at end of file +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/SPKG.rst b/build/pkgs/sagemath_repl/SPKG.rst new file mode 120000 index 00000000000..b4545b4bda6 --- /dev/null +++ b/build/pkgs/sagemath_repl/SPKG.rst @@ -0,0 +1 @@ +src/README.rst \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/bootstrap b/build/pkgs/sagemath_repl/bootstrap new file mode 120000 index 00000000000..40542346a4e --- /dev/null +++ b/build/pkgs/sagemath_repl/bootstrap @@ -0,0 +1 @@ +../sagelib/bootstrap \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/dependencies b/build/pkgs/sagemath_repl/dependencies new file mode 120000 index 00000000000..55c209e6418 --- /dev/null +++ b/build/pkgs/sagemath_repl/dependencies @@ -0,0 +1 @@ +../sagemath_objects/dependencies \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/package-version.txt b/build/pkgs/sagemath_repl/package-version.txt new file mode 120000 index 00000000000..c4540217bba --- /dev/null +++ b/build/pkgs/sagemath_repl/package-version.txt @@ -0,0 +1 @@ +src/VERSION.txt \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/spkg-install b/build/pkgs/sagemath_repl/spkg-install new file mode 120000 index 00000000000..e60fac9ffa1 --- /dev/null +++ b/build/pkgs/sagemath_repl/spkg-install @@ -0,0 +1 @@ +../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/spkg-src b/build/pkgs/sagemath_repl/spkg-src new file mode 100755 index 00000000000..b20ea463784 --- /dev/null +++ b/build/pkgs/sagemath_repl/spkg-src @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Script to prepare an sdist tarball for sagemath-categories +# This script is not used during build. +# +# HOW TO MAKE THE TARBALL: +# ./sage --sh build/pkgs/sagemath_categories/spkg-src + +if [ -z "$SAGE_ROOT" ] ; then + echo >&2 "Error - SAGE_ROOT undefined ... exiting" + echo >&2 "Maybe run 'sage -sh'?" + exit 1 +fi + +# Exit on failure +set -e + +cd build/pkgs/sagemath_repl + +cd src +python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_repl/src b/build/pkgs/sagemath_repl/src new file mode 120000 index 00000000000..87bcc53def5 --- /dev/null +++ b/build/pkgs/sagemath_repl/src @@ -0,0 +1 @@ +../../../pkgs/sagemath-repl \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/type b/build/pkgs/sagemath_repl/type new file mode 100644 index 00000000000..9839eb20815 --- /dev/null +++ b/build/pkgs/sagemath_repl/type @@ -0,0 +1 @@ +experimental diff --git a/build/pkgs/sagenb_export/dependencies b/build/pkgs/sagenb_export/dependencies index bad566f78a7..26033350f88 100644 --- a/build/pkgs/sagenb_export/dependencies +++ b/build/pkgs/sagenb_export/dependencies @@ -2,4 +2,3 @@ $(PYTHON) notebook nbconvert ipython six | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sagetex/dependencies b/build/pkgs/sagetex/dependencies index 43e658b4ff3..29f49d5c215 100644 --- a/build/pkgs/sagetex/dependencies +++ b/build/pkgs/sagetex/dependencies @@ -1,8 +1,4 @@ -$(PYTHON) maxima scipy matplotlib pillow tachyon | $(and $(filter-out no,$(SAGE_CHECK_sagetex)), $(SAGERUNTIME) sympy elliptic_curves jmol) - -To build SageTeX, you just need Python, but to test (SAGE_CHECK=yes) -SageTeX, you actually need to run Sage, produce plots,... +$(PYTHON) maxima scipy matplotlib pillow tachyon ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sagetex/dependencies_check b/build/pkgs/sagetex/dependencies_check new file mode 100644 index 00000000000..d24e23242d4 --- /dev/null +++ b/build/pkgs/sagetex/dependencies_check @@ -0,0 +1,7 @@ +$(SAGERUNTIME) sympy elliptic_curves jmol + +To build SageTeX, you just need Python, but to test (SAGE_CHECK=yes) +SageTeX, you actually need to run Sage, produce plots,... + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/scipoptsuite/dependencies b/build/pkgs/scipoptsuite/dependencies index 46cb93de623..dfc5ec2e844 100644 --- a/build/pkgs/scipoptsuite/dependencies +++ b/build/pkgs/scipoptsuite/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) bliss readline | cmake ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/scipy/dependencies b/build/pkgs/scipy/dependencies index 25ae8854c01..5cd74c1c23a 100644 --- a/build/pkgs/scipy/dependencies +++ b/build/pkgs/scipy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) $(BLAS) gfortran numpy pybind11 pythran | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/setuptools/dependencies b/build/pkgs/setuptools/dependencies index 304d0c987a2..1700e743d59 100644 --- a/build/pkgs/setuptools/dependencies +++ b/build/pkgs/setuptools/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/setuptools_scm/dependencies b/build/pkgs/setuptools_scm/dependencies index 22810d06619..1e7026365f0 100644 --- a/build/pkgs/setuptools_scm/dependencies +++ b/build/pkgs/setuptools_scm/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | setuptools pip wheel tomli packaging ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/setuptools_wheel/dependencies b/build/pkgs/setuptools_wheel/dependencies index 6f2aa240c02..618d627629a 100644 --- a/build/pkgs/setuptools_wheel/dependencies +++ b/build/pkgs/setuptools_wheel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) setuptools wheel ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/simplegeneric/dependencies b/build/pkgs/simplegeneric/dependencies index 7b38836acd6..703d0ec7ba3 100644 --- a/build/pkgs/simplegeneric/dependencies +++ b/build/pkgs/simplegeneric/dependencies @@ -7,4 +7,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/singular/dependencies b/build/pkgs/singular/dependencies index 01af3373fa6..41222544be2 100644 --- a/build/pkgs/singular/dependencies +++ b/build/pkgs/singular/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ntl flint readline mpfr cddlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sip/dependencies b/build/pkgs/sip/dependencies index 304d0c987a2..1700e743d59 100644 --- a/build/pkgs/sip/dependencies +++ b/build/pkgs/sip/dependencies @@ -2,4 +2,3 @@ $(PYTHON) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/six/dependencies b/build/pkgs/six/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/six/dependencies +++ b/build/pkgs/six/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/snowballstemmer/dependencies b/build/pkgs/snowballstemmer/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/snowballstemmer/dependencies +++ b/build/pkgs/snowballstemmer/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinx/dependencies b/build/pkgs/sphinx/dependencies index af979e75c97..af580c77d88 100644 --- a/build/pkgs/sphinx/dependencies +++ b/build/pkgs/sphinx/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments six snowballstemmer ima ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_applehelp/dependencies b/build/pkgs/sphinxcontrib_applehelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_applehelp/dependencies +++ b/build/pkgs/sphinxcontrib_applehelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_devhelp/dependencies b/build/pkgs/sphinxcontrib_devhelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_devhelp/dependencies +++ b/build/pkgs/sphinxcontrib_devhelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_htmlhelp/dependencies b/build/pkgs/sphinxcontrib_htmlhelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_htmlhelp/dependencies +++ b/build/pkgs/sphinxcontrib_htmlhelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_jsmath/dependencies b/build/pkgs/sphinxcontrib_jsmath/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_jsmath/dependencies +++ b/build/pkgs/sphinxcontrib_jsmath/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_qthelp/dependencies b/build/pkgs/sphinxcontrib_qthelp/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_qthelp/dependencies +++ b/build/pkgs/sphinxcontrib_qthelp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_serializinghtml/dependencies b/build/pkgs/sphinxcontrib_serializinghtml/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_serializinghtml/dependencies +++ b/build/pkgs/sphinxcontrib_serializinghtml/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sphinxcontrib_websupport/dependencies b/build/pkgs/sphinxcontrib_websupport/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/sphinxcontrib_websupport/dependencies +++ b/build/pkgs/sphinxcontrib_websupport/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sqlite/dependencies b/build/pkgs/sqlite/dependencies index 6a04d4dc1ff..7d283a67703 100644 --- a/build/pkgs/sqlite/dependencies +++ b/build/pkgs/sqlite/dependencies @@ -2,4 +2,3 @@ readline ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/surf/dependencies b/build/pkgs/surf/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/surf/dependencies +++ b/build/pkgs/surf/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/symengine/dependencies b/build/pkgs/symengine/dependencies index 77248f3a86e..1fc34963eda 100644 --- a/build/pkgs/symengine/dependencies +++ b/build/pkgs/symengine/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) arb ecm flint mpc mpfr | cmake ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/symengine_py/dependencies b/build/pkgs/symengine_py/dependencies index a48b85c68e8..0b94df79ab9 100644 --- a/build/pkgs/symengine_py/dependencies +++ b/build/pkgs/symengine_py/dependencies @@ -1,5 +1,4 @@ -symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_symengine_py)), pytest) +symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/symengine_py/dependencies_check b/build/pkgs/symengine_py/dependencies_check new file mode 100644 index 00000000000..e079f8a6038 --- /dev/null +++ b/build/pkgs/symengine_py/dependencies_check @@ -0,0 +1 @@ +pytest diff --git a/build/pkgs/symmetrica/dependencies b/build/pkgs/symmetrica/dependencies index 0fef19aa992..606ceeaec80 100644 --- a/build/pkgs/symmetrica/dependencies +++ b/build/pkgs/symmetrica/dependencies @@ -4,4 +4,3 @@ xz is needed for unpacking the tarball when sage-bootstrap-python is ancient ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sympow/dependencies b/build/pkgs/sympow/dependencies index e78bf13b4a2..948967f0256 100644 --- a/build/pkgs/sympow/dependencies +++ b/build/pkgs/sympow/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/sympy/dependencies b/build/pkgs/sympy/dependencies index c12b8329ca4..24e1585f16e 100644 --- a/build/pkgs/sympy/dependencies +++ b/build/pkgs/sympy/dependencies @@ -2,4 +2,3 @@ $(PYTHON) mpmath | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tachyon/dependencies b/build/pkgs/tachyon/dependencies index a32404ffb8e..a6ce9ea4411 100644 --- a/build/pkgs/tachyon/dependencies +++ b/build/pkgs/tachyon/dependencies @@ -2,4 +2,3 @@ libpng ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/terminado/dependencies b/build/pkgs/terminado/dependencies index c61d11251e3..e44a0d91033 100644 --- a/build/pkgs/terminado/dependencies +++ b/build/pkgs/terminado/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ptyprocess tornado ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/testpath/dependencies b/build/pkgs/testpath/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/testpath/dependencies +++ b/build/pkgs/testpath/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/texttable/dependencies b/build/pkgs/texttable/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/texttable/dependencies +++ b/build/pkgs/texttable/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tides/dependencies b/build/pkgs/tides/dependencies index efb6f50c4b2..1108dc4fb21 100644 --- a/build/pkgs/tides/dependencies +++ b/build/pkgs/tides/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) mpfr ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/topcom/dependencies b/build/pkgs/topcom/dependencies index 7f13f8aa14a..562554f4643 100644 --- a/build/pkgs/topcom/dependencies +++ b/build/pkgs/topcom/dependencies @@ -2,4 +2,3 @@ cddlib ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tornado/dependencies b/build/pkgs/tornado/dependencies index 7a3a585116d..212c6234efb 100644 --- a/build/pkgs/tornado/dependencies +++ b/build/pkgs/tornado/dependencies @@ -2,4 +2,3 @@ $(PYTHON) certifi | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tox/dependencies b/build/pkgs/tox/dependencies index a8747364ef2..5a00a282b7d 100644 --- a/build/pkgs/tox/dependencies +++ b/build/pkgs/tox/dependencies @@ -2,4 +2,3 @@ $(PYTHON) packaging six filelock pluggy py toml virtualenv importlib_metadata | ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/traitlets/dependencies b/build/pkgs/traitlets/dependencies index 242140707df..6598a788ccf 100644 --- a/build/pkgs/traitlets/dependencies +++ b/build/pkgs/traitlets/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/tzlocal/dependencies b/build/pkgs/tzlocal/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/tzlocal/dependencies +++ b/build/pkgs/tzlocal/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/valgrind/dependencies b/build/pkgs/valgrind/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/valgrind/dependencies +++ b/build/pkgs/valgrind/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/vcversioner/dependencies b/build/pkgs/vcversioner/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/vcversioner/dependencies +++ b/build/pkgs/vcversioner/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/wcwidth/dependencies b/build/pkgs/wcwidth/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/wcwidth/dependencies +++ b/build/pkgs/wcwidth/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/webencodings/dependencies b/build/pkgs/webencodings/dependencies index 15df0c4d6d8..0738c2d7777 100644 --- a/build/pkgs/webencodings/dependencies +++ b/build/pkgs/webencodings/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/wheel/dependencies b/build/pkgs/wheel/dependencies index dbe5d796c45..98d3e59447b 100644 --- a/build/pkgs/wheel/dependencies +++ b/build/pkgs/wheel/dependencies @@ -2,4 +2,3 @@ $(PYTHON) setuptools ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/widgetsnbextension/dependencies b/build/pkgs/widgetsnbextension/dependencies index 816ef654fc7..dd63a9f4ef1 100644 --- a/build/pkgs/widgetsnbextension/dependencies +++ b/build/pkgs/widgetsnbextension/dependencies @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN) jupyter_core ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/xz/dependencies b/build/pkgs/xz/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/xz/dependencies +++ b/build/pkgs/xz/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zeromq/dependencies b/build/pkgs/zeromq/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/zeromq/dependencies +++ b/build/pkgs/zeromq/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zipp/dependencies b/build/pkgs/zipp/dependencies index 8b3637a0a0e..4361e46ddaf 100644 --- a/build/pkgs/zipp/dependencies +++ b/build/pkgs/zipp/dependencies @@ -2,4 +2,3 @@ $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zlib/SPKG.rst b/build/pkgs/zlib/SPKG.rst index d7de9c4038a..5a3496935cf 100644 --- a/build/pkgs/zlib/SPKG.rst +++ b/build/pkgs/zlib/SPKG.rst @@ -18,12 +18,6 @@ Upstream Contact - http://www.zlib.net/ -Dependencies ------------- - -- None - - Special Update/Build Instructions --------------------------------- diff --git a/build/pkgs/zlib/dependencies b/build/pkgs/zlib/dependencies index 3546cda4614..4f00de20375 100644 --- a/build/pkgs/zlib/dependencies +++ b/build/pkgs/zlib/dependencies @@ -2,4 +2,3 @@ ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/build/pkgs/zn_poly/dependencies b/build/pkgs/zn_poly/dependencies index 9a77ea16f78..42dc0e9c107 100644 --- a/build/pkgs/zn_poly/dependencies +++ b/build/pkgs/zn_poly/dependencies @@ -2,4 +2,3 @@ $(MP_LIBRARY) ---------- All lines of this file are ignored except the first. -It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. diff --git a/docker/.gitpod.Dockerfile b/docker/.gitpod.Dockerfile index 56f2370ea0d..ff17d331515 100644 --- a/docker/.gitpod.Dockerfile +++ b/docker/.gitpod.Dockerfile @@ -1,12 +1,6 @@ -ARG BASE_GITHUB_REPOSITORY=sagemath/sage -ARG BASE_TAG=dev -FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-targets:${BASE_TAG} as with-targets -RUN sudo rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Fast doc rebuilds do not work because -# "loading pickled environment... failed; source directory has changed" -# Until this is fixed, we can as well remove the whole documentation, which saves a lot of space. -RUN rm -Rf /home/gitpod/sage-local/share/doc/sage - -FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-system-packages:${BASE_TAG} -COPY --chown=gitpod:gitpod --from=with-targets /home/gitpod/sage/logs /home/gitpod/sage/logs -COPY --chown=gitpod:gitpod --from=with-targets /home/gitpod/sage-local /home/gitpod/sage-local +# Use minimal Ubuntu installation that includes mamba +FROM condaforge/mambaforge +# Workaround so that vscode internals (such as git) find things installed in the conda env (notably ssh which is required to contribute to trac) +ENV PATH $PATH:/workspace/sagetrac-mirror/venv/bin +# Default to non-admin user +USER gitpod diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index b89985efbaa..05680ea9c5d 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -322,22 +322,28 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl dnl dnl Determine package dependencies dnl - DEP_FILE="$DIR/dependencies" - if test -f "$DEP_FILE"; then + AS_IF([test -f "$DIR/dependencies"], [dnl dnl - the # symbol is treated as comment which is removed - DEPS=`sed 's/^ *//; s/ *#.*//; q' $DEP_FILE` - else - m4_define([ORDER_ONLY_DEPS], [])dnl - m4_case(SPKG_SOURCE, - [pip], [dnl - m4_define([ORDER_ONLY_DEPS], [pip])dnl - ])dnl - m4_ifval(ORDER_ONLY_DEPS, [dnl - DEPS="| ORDER_ONLY_DEPS" - ], [dnl - DEPS="" - ])dnl - fi + AS_VAR_SET([DEPS], [`sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies`]) + ], [dnl + AS_VAR_SET([DEPS], []) + ]) + AS_IF([test -f "$DIR/dependencies_optional"], [dnl + for a in $(sed 's/^ *//; s/ *#.*//; q' "$DIR/dependencies_optional"); do + AS_VAR_APPEND([DEPS], [' $(findstring '$a',$(OPTIONAL_INSTALLED_PACKAGES)) ']) + done + ]) + AS_CASE(["$DEPS"], [*\|*], [], [AS_VAR_APPEND([DEPS], [" |"])]) + AS_IF([test -f "$DIR/dependencies_order_only"], [dnl + ADD_DEPS=$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_order_only)) + AS_VAR_APPEND([DEPS], [" $ADD_DEPS"]) + ], [dnl + m4_case(SPKG_SOURCE, [pip], [AS_VAR_APPEND([DEPS], [' pip'])], [:])dnl + ]) + AS_IF([test -f "$DIR/dependencies_check"], [dnl + ADD_DEPS=$(echo $(sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies_check)) + AS_VAR_APPEND([DEPS], [' $(and $(filter-out no,$(SAGE_CHECK_]SPKG_NAME[)), '"$ADD_DEPS"')'])dnl + ]) dnl SAGE_PACKAGE_DEPENDENCIES="${SAGE_PACKAGE_DEPENDENCIES}$(printf '\ndeps_')SPKG_NAME = ${DEPS}" dnl diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sage-conf/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-docbuild/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sage-docbuild/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sage-docbuild/setup.cfg b/pkgs/sage-docbuild/setup.cfg index 0952f72a1d3..abc71ffcd00 100644 --- a/pkgs/sage-docbuild/setup.cfg +++ b/pkgs/sage-docbuild/setup.cfg @@ -17,10 +17,9 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-setup/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sage-setup/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sage-setup/setup.cfg b/pkgs/sage-setup/setup.cfg index 197fc6791dc..79fd069f7c0 100644 --- a/pkgs/sage-setup/setup.cfg +++ b/pkgs/sage-setup/setup.cfg @@ -17,9 +17,9 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics @@ -31,7 +31,7 @@ packages = sage_setup.autogen.interpreters.specs sage_setup.command -python_requires = >=3.7, <3.11 +python_requires = >=3.8, <3.11 install_requires = pkgconfig diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sage-sws2rst/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sagemath-categories/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sagemath-categories/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sagemath-categories/setup.cfg.m4 b/pkgs/sagemath-categories/setup.cfg.m4 index 99bf2d3ecec..6bf81129de3 100644 --- a/pkgs/sagemath-categories/setup.cfg.m4 +++ b/pkgs/sagemath-categories/setup.cfg.m4 @@ -18,14 +18,14 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.11 +python_requires = >=3.8, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ diff --git a/pkgs/sagemath-environment/MANIFEST.in b/pkgs/sagemath-environment/MANIFEST.in new file mode 100644 index 00000000000..36f8fae1845 --- /dev/null +++ b/pkgs/sagemath-environment/MANIFEST.in @@ -0,0 +1,15 @@ +prune sage + +global-include all__sagemath_environment.py + +include sage/env.py +include sage/version.py +include sage/misc/package.py +include sage/misc/package_dir.py +include sage/misc/temporary_file.py +include sage/misc/viewer.py +graft sage/features + +include VERSION.txt + +global-exclude *.py[co] diff --git a/pkgs/sagemath-environment/README.rst b/pkgs/sagemath-environment/README.rst new file mode 100644 index 00000000000..f5c52660ca8 --- /dev/null +++ b/pkgs/sagemath-environment/README.rst @@ -0,0 +1,23 @@ +========================================================================= + Sage: Open Source Mathematics Software: System and software environment +========================================================================= + +About SageMath +-------------- + + "Creating a Viable Open Source Alternative to + Magma, Maple, Mathematica, and MATLAB" + + Copyright (C) 2005-2020 The Sage Development Team + + https://www.sagemath.org + +SageMath fully supports all major Linux distributions, recent versions of macOS, and Windows (using Cygwin or Windows Subsystem for Linux). + +The traditional and recommended way to install SageMath is from source via Sage-the-distribution (https://www.sagemath.org/download-source.html). Sage-the-distribution first builds a large number of open source packages from source (unless it finds suitable versions installed in the system) and then installs the Sage Library (sagelib, implemented in Python and Cython). + + +About this experimental pip-installable source distribution +----------------------------------------------------------- + +This pip-installable source distribution `sagemath-environment` is an experimental distribution of a small part of the Sage Library. Use at your own risk. It provides a small, fundamental subset of the modules of the Sage library ("sagelib", `sagemath-standard`), providing the connection to the system and software environment. diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sagemath-environment/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sagemath-environment/bin b/pkgs/sagemath-environment/bin new file mode 120000 index 00000000000..2f8b9b30ee7 --- /dev/null +++ b/pkgs/sagemath-environment/bin @@ -0,0 +1 @@ +../../src/bin \ No newline at end of file diff --git a/pkgs/sagemath-environment/pyproject.toml.m4 b/pkgs/sagemath-environment/pyproject.toml.m4 new file mode 100644 index 00000000000..686515673fc --- /dev/null +++ b/pkgs/sagemath-environment/pyproject.toml.m4 @@ -0,0 +1,8 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = [ + esyscmd(`sage-get-system-packages install-requires-toml \ + setuptools \ + wheel \ + ')] +build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-environment/requirements.txt.m4 b/pkgs/sagemath-environment/requirements.txt.m4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/sagemath-environment/sage b/pkgs/sagemath-environment/sage new file mode 120000 index 00000000000..e0da5daa6f2 --- /dev/null +++ b/pkgs/sagemath-environment/sage @@ -0,0 +1 @@ +../../src/sage \ No newline at end of file diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 new file mode 100644 index 00000000000..c67043cb715 --- /dev/null +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -0,0 +1,75 @@ +# -*- conf-unix -*- +[metadata] +name = sagemath-environment +version = file: VERSION.txt +description = Sage: Open Source Mathematics Software: System and software environment +long_description = file: README.rst +long_description_content_type = text/x-rst +license = GNU General Public License (GPL) v2 or later +author = The Sage Developers +author_email = sage-support@googlegroups.com +url = https://www.sagemath.org + +classifiers = + Development Status :: 6 - Mature + Intended Audience :: Education + Intended Audience :: Science/Research + License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + Topic :: Scientific/Engineering :: Mathematics + +[options] +python_requires = >=3.7, <3.11 +install_requires = + esyscmd(`sage-get-system-packages install-requires \ + | sed "2,\$s/^/ /;"')dnl + +py_modules = + sage.all__sagemath_environment + sage.env + sage.version + sage.misc.all__sagemath_environment + sage.misc.package + sage.misc.temporary_file + sage.misc.viewer + +packages = + sage.features + +scripts = + # The sage script + bin/sage + # Auxiliary scripts for setting up the environment + bin/sage-env + bin/sage-num-threads.py + bin/sage-venv-config + bin/sage-version.sh + # Auxiliary script for invoking Python in the Sage environment + bin/sage-python + # Not included: + # - bin/sage-env-config -- installed by sage_conf + # - bin/sage-env-config.in -- not to be installed + # - bin/sage-run, bin/sage-runtests, ... -- installed by sagemath-repl + # - bin/sage-ipython -- uses sage.repl, so installed by sagemath-repl + +[options.extras_require] +# sage.env can optionally use sage_conf +conf = esyscmd(`sage-get-system-packages install-requires sage_conf') +# For "sage --docbuild" +docbuild = esyscmd(`sage-get-system-packages install-requires sage_docbuild') +# For "sage", "sage -t", ... +sage = esyscmd(`sage-get-system-packages install-requires sagelib') +# For "sage --cython" +cython = esyscmd(`sage-get-system-packages install-requires cython') +# For "sage --pytest" +pytest = esyscmd(`sage-get-system-packages install-requires pytest') +# For "sage --rst2ipynb" +rst2ipynb = esyscmd(`sage-get-system-packages install-requires rst2ipynb') +# For "sage --sws2rst" +sws2rst = esyscmd(`sage-get-system-packages install-requires sage_sws2rst') diff --git a/pkgs/sagemath-environment/setup.py b/pkgs/sagemath-environment/setup.py new file mode 100644 index 00000000000..606849326a4 --- /dev/null +++ b/pkgs/sagemath-environment/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini new file mode 100644 index 00000000000..f28e260b196 --- /dev/null +++ b/pkgs/sagemath-environment/tox.ini @@ -0,0 +1,28 @@ +# To build and test in the tox environment: +# +# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v)' +# +# To test interactively: +# +# pkgs/sagemath-environment/.tox/python/bin/python +# +[tox] +isolated_build = True + +[testenv] +deps = -rrequirements.txt + +setenv = + # Sage scripts such as sage-runtests like to use $HOME/.sage + HOME={envdir} + +passenv = + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + +whitelist_externals = + bash + +commands = + # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. + python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name)); import sage.misc.package' diff --git a/pkgs/sagemath-objects/MANIFEST.in b/pkgs/sagemath-objects/MANIFEST.in index 5f82374a9c4..d112d9b5c16 100644 --- a/pkgs/sagemath-objects/MANIFEST.in +++ b/pkgs/sagemath-objects/MANIFEST.in @@ -82,7 +82,9 @@ graft sage/libs/gmp # sage/misc/latex -- this should really go to another package -## For doctesting +## For doctesting -- this duplication will be removed in #28925 +global-include all__sagemath_environment.py +global-include all__sagemath_repl.py include bin/sage include bin/sage-env include bin/sage-env-config @@ -95,6 +97,10 @@ include sage/misc/misc.* # walltime, cputime # graft sage/features include sage/misc/package.* include sage/misc/sagedoc.py +include sage/misc/banner.py +include sage/misc/sage_input.py +include sage/misc/sage_eval.py +include sage/misc/viewer.py graft sage/repl graft sage/server diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt deleted file mode 120000 index 43f4773d7de..00000000000 --- a/pkgs/sagemath-objects/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -../../src/VERSION.txt \ No newline at end of file diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sagemath-objects/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sagemath-objects/setup.cfg.m4 b/pkgs/sagemath-objects/setup.cfg.m4 index d2ba39a4a2b..34a4ffd2bc6 100644 --- a/pkgs/sagemath-objects/setup.cfg.m4 +++ b/pkgs/sagemath-objects/setup.cfg.m4 @@ -18,14 +18,14 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.11 +python_requires = >=3.8, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ diff --git a/pkgs/sagemath-repl/MANIFEST.in b/pkgs/sagemath-repl/MANIFEST.in new file mode 100644 index 00000000000..9bee69fd999 --- /dev/null +++ b/pkgs/sagemath-repl/MANIFEST.in @@ -0,0 +1,14 @@ +prune sage + +global-include all__sagemath_repl.py + +graft sage/doctest +graft sage/repl +include sage/misc/banner.py +include sage/misc/sagedoc.py +include sage/misc/sage_input.py +include sage/misc/sage_eval.py + +include VERSION.txt + +global-exclude *.py[co] diff --git a/pkgs/sagemath-repl/README.rst b/pkgs/sagemath-repl/README.rst new file mode 100644 index 00000000000..c240fbc1bac --- /dev/null +++ b/pkgs/sagemath-repl/README.rst @@ -0,0 +1,23 @@ +=================================================================================== + Sage: Open Source Mathematics Software: IPython kernel, Sage preparser, doctester +=================================================================================== + +About SageMath +-------------- + + "Creating a Viable Open Source Alternative to + Magma, Maple, Mathematica, and MATLAB" + + Copyright (C) 2005-2020 The Sage Development Team + + https://www.sagemath.org + +SageMath fully supports all major Linux distributions, recent versions of macOS, and Windows (using Cygwin or Windows Subsystem for Linux). + +The traditional and recommended way to install SageMath is from source via Sage-the-distribution (https://www.sagemath.org/download-source.html). Sage-the-distribution first builds a large number of open source packages from source (unless it finds suitable versions installed in the system) and then installs the Sage Library (sagelib, implemented in Python and Cython). + + +About this experimental pip-installable source distribution +----------------------------------------------------------- + +This pip-installable source distribution `sagemath-repl` is an experimental distribution of a small part of the Sage Library. Use at your own risk. It provides a small, fundamental subset of the modules of the Sage library ("sagelib", `sagemath-standard`), providing the IPython kernel, Sage preparser, and doctester. diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt new file mode 100644 index 00000000000..4cd5a231c54 --- /dev/null +++ b/pkgs/sagemath-repl/VERSION.txt @@ -0,0 +1 @@ +9.7.beta2 diff --git a/pkgs/sagemath-repl/bin b/pkgs/sagemath-repl/bin new file mode 120000 index 00000000000..2f8b9b30ee7 --- /dev/null +++ b/pkgs/sagemath-repl/bin @@ -0,0 +1 @@ +../../src/bin \ No newline at end of file diff --git a/pkgs/sagemath-repl/pyproject.toml.m4 b/pkgs/sagemath-repl/pyproject.toml.m4 new file mode 100644 index 00000000000..686515673fc --- /dev/null +++ b/pkgs/sagemath-repl/pyproject.toml.m4 @@ -0,0 +1,8 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = [ + esyscmd(`sage-get-system-packages install-requires-toml \ + setuptools \ + wheel \ + ')] +build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-repl/requirements.txt.m4 b/pkgs/sagemath-repl/requirements.txt.m4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/sagemath-repl/sage b/pkgs/sagemath-repl/sage new file mode 120000 index 00000000000..e0da5daa6f2 --- /dev/null +++ b/pkgs/sagemath-repl/sage @@ -0,0 +1 @@ +../../src/sage \ No newline at end of file diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 new file mode 100644 index 00000000000..96f554b8de1 --- /dev/null +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -0,0 +1,84 @@ +# -*- conf-unix -*- +[metadata] +name = sagemath-repl +version = file: VERSION.txt +description = Sage: Open Source Mathematics Software: System and software environment +long_description = file: README.rst +long_description_content_type = text/x-rst +license = GNU General Public License (GPL) v2 or later +author = The Sage Developers +author_email = sage-support@googlegroups.com +url = https://www.sagemath.org + +classifiers = + Development Status :: 6 - Mature + Intended Audience :: Education + Intended Audience :: Science/Research + License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + Topic :: Scientific/Engineering :: Mathematics + +[options] +python_requires = >=3.7, <3.11 +install_requires = + esyscmd(`sage-get-system-packages install-requires \ + sagemath_objects \ + sagemath_environment \ + ipython \ + ipywidgets \ + | sed "2,\$s/^/ /;"')dnl + +py_modules = + sage.all__sagemath_repl + sage.misc.all__sagemath_repl + sage.misc.banner + sage.misc.sagedoc + sage.misc.sage_input + sage.misc.sage_eval + +packages = + sage.doctest + sage.repl + sage.repl.display + sage.repl.ipython_kernel + sage.repl.rich_output + +scripts = + # Other scripts that should be in the path also for OS packaging of sage: + bin/sage-eval + # Included because it is useful for doctesting/coverage testing user scripts too: + bin/sage-runtests + bin/sage-fixdoctests + bin/sage-coverage + # Helper scripts invoked by sage script + # (they would actually belong to something like libexec) + bin/sage-cachegrind + bin/sage-callgrind + bin/sage-massif + bin/sage-omega + bin/sage-valgrind + bin/sage-cleaner + # Uncategorized scripts in alphabetical order + bin/sage-gdb-commands + bin/sage-inline-fortran + bin/sage-ipynb2rst + bin/sage-ipython + bin/sage-notebook + bin/sage-preparse + bin/sage-run + bin/sage-run-cython + bin/sage-startuptime.py + +[options.package_data] + +sage.doctest = + tests/* + +sage.repl.rich_output = + example* diff --git a/pkgs/sagemath-repl/setup.py b/pkgs/sagemath-repl/setup.py new file mode 100644 index 00000000000..606849326a4 --- /dev/null +++ b/pkgs/sagemath-repl/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini new file mode 100644 index 00000000000..0405938001f --- /dev/null +++ b/pkgs/sagemath-repl/tox.ini @@ -0,0 +1,30 @@ +# To build and test in the tox environment: +# +# ./sage -sh -c '(cd pkgs/sagemath-repl && tox -v -v)' +# +# To test interactively: +# +# pkgs/sagemath-repl/.tox/python/bin/python +# +[tox] +isolated_build = True + +[testenv] +deps = -rrequirements.txt + +setenv = + # Sage scripts such as sage-runtests like to use $HOME/.sage + HOME={envdir} + +passenv = + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + +whitelist_externals = + bash + +commands = + # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. + python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' + + bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_repl --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest $SAGE_SRC/sage/misc/sage_input.py $SAGE_SRC/sage/misc/sage_eval.py || echo "(lots of doctest failures are expected)"' diff --git a/pyrightconfig.json b/pyrightconfig.json index ac8865ed58b..2bcc9ea2a10 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -7,7 +7,7 @@ "root": "src" } ], - "pythonVersion": "3.7", + "pythonVersion": "3.8", "exclude": ["venv"], "venvPath": "./venv/", "venv": "./", diff --git a/src/VERSION.txt b/src/VERSION.txt index 6442b83e510..4cd5a231c54 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -9.7.beta1 +9.7.beta2 diff --git a/src/bin/sage b/src/bin/sage index 1daf4d91538..42d9a2581c0 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -102,33 +102,51 @@ usage() { #### 1.......................26..................................................78 #### |.....................--.|...................................................| echo - echo "Optional arguments:" - echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" - echo " --advanced -- list all command line options" - echo " -c -- Evaluates cmd as sage code" + echo "Running Sage:" + if command -v sage-ipython &>/dev/null; then + echo + echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" + echo " -c -- evaluate cmd as sage code" + echo " --notebook=[...] -- start the Sage notebook (valid options are" + echo " 'default', 'jupyter', 'jupyterlab', and 'export')" + echo " Current default is 'jupyter'" + echo " -n, --notebook -- shortcut for --notebook=default" + echo " --nodotsage -- run Sage without using the user's .sage directory:" + echo " create and use a temporary .sage directory instead" + echo " -t [options] <--all|files|dir>" + echo " -- test examples in .py, .pyx, .sage, .tex or .rst files" + echo " selected options:" + echo " --long - include lines with the phrase 'long time'" + echo " --verbose - print debugging output during the test" + echo " --optional - controls which optional tests are run" + echo " --help - show all testing options" + else + echo " (not installed currently, " + echo " to install, run sage --pip install sagemath-repl)" + fi + echo + echo "Running external programs:" + echo + command -v gap &>/dev/null && \ echo " --gap [...] -- run Sage's Gap with given arguments" + command -v gp &>/dev/null && \ echo " --gp [...] -- run Sage's PARI/GP calculator with given arguments" - echo " -h -- print this help message" echo " --pip [...] -- invoke pip, the Python package manager" + command -v maxima &>/dev/null && \ echo " --maxima [...] -- run Sage's Maxima with given arguments" + command -v mwrank &>/dev/null && \ echo " --mwrank [...] -- run Sage's mwrank with given arguments" - echo " --notebook=[...] -- start the Sage notebook (valid options are" - echo " 'default', 'jupyter', 'jupyterlab', and 'export')" - echo " Current default is 'jupyter'" - echo " -n, --notebook -- shortcut for --notebook=default" echo " --python [...], --python3 [...] -- run the Python 3 interpreter" + command -v R &>/dev/null && \ echo " -R [...] -- run Sage's R with given arguments" + command -v singular &>/dev/null && \ echo " --singular [...] -- run Sage's singular with given arguments" - echo " --nodotsage -- run Sage without using the user's .sage directory:" - echo " create and use a temporary .sage directory instead" - echo " -t [options] <--all|files|dir>" - echo " -- test examples in .py, .pyx, .sage, .tex or .rst files" - echo " selected options:" - echo " --long - include lines with the phrase 'long time'" - echo " --verbose - print debugging output during the test" - echo " --optional - controls which optional tests are run" - echo " --help - show all testing options" + echo + echo "Getting help:" + echo echo " -v, --version -- display Sage version information" + echo " -h, -?, --help -- print this help message" + echo " --advanced -- list all command line options" if [ -d "$SAGE_ROOT" ]; then exec "$SAGE_ROOT/build/bin/sage-site" "-h" fi @@ -208,7 +226,7 @@ case "$1" in exec "$SAGE_ROOT/build/bin/sage-site" "$@" # fallthrough if there is no sage-site script fi - echo "Error: unknown option: $1" + echo >&2 "Error: unknown option: $1" exit 1 ;; esac @@ -301,55 +319,48 @@ usage_advanced() { #### 1.......................26..................................................78 #### |.....................--.|...................................................| echo - echo "Running Sage, the most common options:" - echo - echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" - echo " -h, -?, --help -- print a short help message" - echo " -v, --version -- print the Sage version" - echo " --advanced -- print this list of Sage options" - echo " -c cmd -- evaluate cmd as sage code. For example," - echo " \"sage -c 'print(factor(35))'\" will" - echo " print \"5 * 7\"." - echo - echo "Running Sage, other options:" - echo - echo " --dumpversion -- print brief Sage version" - echo " --preparse file.sage -- preparse \"file.sage\", and produce" - echo " the corresponding Python file" - echo " \"file.sage.py\"" - echo " -q -- quiet; start with no banner" - echo " --min -- do not populate global namespace" - echo " (must be first option)" - echo " --nodotsage -- run Sage without using the user's" - echo " .sage directory: create and use a temporary" - echo " .sage directory instead." - echo " --gthread, --qthread, --q4thread, --wthread, --pylab" - echo " -- pass the option through to IPython" - echo " --simple-prompt -- pass the option through to IPython: use" - echo " this option with sage-shell mode in emacs" - if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then - echo " --grep [options] " - echo " -- regular expression search through the Sage" - echo " library for \"string\". Any options will" - echo " get passed to the \"grep\" command." - echo " --grepdoc [options] " - echo " -- regular expression search through the" - echo " Sage documentation for \"string\"." - echo " --search_src ... -- same as --grep" - echo " --search_doc ... -- same as --grepdoc" + if command -v sage-ipython &>/dev/null; then + echo "Running Sage, the most common options:" + echo + echo " file.[sage|py|spyx] -- run given .sage, .py or .spyx file" + echo " -c cmd -- evaluate cmd as sage code. For example," + echo " \"sage -c 'print(factor(35))'\" will" + echo " print \"5 * 7\"." + echo + echo "Running Sage, other options:" + echo + echo " --preparse file.sage -- preparse \"file.sage\", and produce" + echo " the corresponding Python file" + echo " \"file.sage.py\"" + echo " -q -- quiet; start with no banner" + echo " --min -- do not populate global namespace" + echo " (must be first option)" + echo " --nodotsage -- run Sage without using the user's" + echo " .sage directory: create and use a temporary" + echo " .sage directory instead." + echo " --gthread, --qthread, --q4thread, --wthread, --pylab" + echo " -- pass the option through to IPython" + echo " --simple-prompt -- pass the option through to IPython: use" + echo " this option with sage-shell mode in emacs" + echo " --gdb -- run Sage under the control of gdb" + echo " --gdb-ipython -- run Sage's IPython under the control of gdb" + else + echo "Running Sage:" + echo " (not installed currently, " + echo " to install, run sage --pip install sagemath-repl)" fi echo echo "Running external programs:" echo echo " --cython [...] -- run Cython with the given arguments" + command -v cython &>/dev/null || \ + echo " (not installed, run sage --pip install cython)" echo " --ecl [...], --lisp [...] -- run Sage's copy of ECL (Embeddable" echo " Common Lisp) with the given arguments" echo " --gap [...] -- run Sage's Gap with the given arguments" echo " --gap3 [...] -- run Sage's Gap3 with the given arguments" command -v gap3 &>/dev/null || \ echo " (not installed currently, run sage -i gap3)" - echo " --gdb -- run Sage under the control of gdb" - echo " --gdb-ipython -- run Sage's IPython under the control of gdb" echo " --git [...] -- run Sage's Git with the given arguments" echo " --gp [...] -- run Sage's PARI/GP calculator with the" echo " given arguments" @@ -388,50 +399,57 @@ usage_advanced() { #### |.....................--.|...................................................| echo "Testing files:" echo - echo " -t [options] -- test examples in .py, .pyx, .sage" - echo " or .tex files. Options:" - echo " --long -- include lines with the phrase 'long time'" - echo " --verbose -- print debugging output during the test" - echo " --all -- test all files" - echo " --optional -- also test all examples labeled \"# optional\"" - echo " --only-optional[=tags]" - echo " -- if no 'tags' are specified, only run" - echo " blocks of tests containing a line labeled" - echo " \"# optional\". If a comma-separated" - echo " list of tags is specified, only run block" - echo " containing a line labeled \"# optional tag\"" - echo " for any of the tags given, and in these blocks" - echo " only run the lines which are unlabeled or" - echo " labeled \"# optional\" or labeled" - echo " \"# optional tag\" for any of the tags given." - echo " --randorder[=seed] -- randomize order of tests" - echo " --random-seed[=seed] -- random seed (integer) for fuzzing doctests" - echo " --new -- only test files modified since last commit" - echo " --initial -- only show the first failure per block" - echo " --debug -- drop into PDB after an unexpected error" - echo " --failed -- only test files that failed last test" - echo " --warn-long [timeout] -- warning if doctest is slow" - echo " --only-errors -- only output failures, not successes" - echo " --gc=GC -- control garbarge collection (ALWAYS:" - echo " collect garbage before every test; NEVER:" - echo " disable gc; DEFAULT: Python default)" - echo " --short[=secs] -- run as many doctests as possible in about 300" - echo " seconds (or the number of seconds given.) This runs" - echo " the tests for each module from the top of the file" - echo " and skips tests once it exceeds the budget" - echo " allocated for that file." - echo " --help -- show all doctesting options" - echo " --tnew [...] -- equivalent to -t --new" - echo " -tp [...] -- like -t above, but tests in parallel using" - echo " N threads, with 0 interpreted as min(8, cpu_count())" - echo " --testall [options] -- equivalent to -t --all" - echo - echo " --coverage -- give information about doctest coverage of files" - echo " --coverageall -- give summary info about doctest coverage of" - echo " all files in the Sage library" - echo " --startuptime [module] -- display how long each component of Sage takes to" - echo " start up; optionally specify a module to get more" - echo " details about that particular module" + if command -v sage-runtests &>/dev/null; then + echo " -t [options] -- test examples in .py, .pyx, .sage" + echo " or .tex files. Options:" + echo " --long -- include lines with the phrase 'long time'" + echo " --verbose -- print debugging output during the test" + echo " --all -- test all files" + echo " --optional -- also test all examples labeled \"# optional\"" + echo " --only-optional[=tags]" + echo " -- if no 'tags' are specified, only run" + echo " blocks of tests containing a line labeled" + echo " \"# optional\". If a comma-separated" + echo " list of tags is specified, only run block" + echo " containing a line labeled \"# optional tag\"" + echo " for any of the tags given, and in these blocks" + echo " only run the lines which are unlabeled or" + echo " labeled \"# optional\" or labeled" + echo " \"# optional tag\" for any of the tags given." + echo " --randorder[=seed] -- randomize order of tests" + echo " --random-seed[=seed] -- random seed (integer) for fuzzing doctests" + echo " --new -- only test files modified since last commit" + echo " --initial -- only show the first failure per block" + echo " --debug -- drop into PDB after an unexpected error" + echo " --failed -- only test files that failed last test" + echo " --warn-long [timeout] -- warning if doctest is slow" + echo " --only-errors -- only output failures, not successes" + echo " --gc=GC -- control garbarge collection (ALWAYS:" + echo " collect garbage before every test; NEVER:" + echo " disable gc; DEFAULT: Python default)" + echo " --short[=secs] -- run as many doctests as possible in about 300" + echo " seconds (or the number of seconds given.) This runs" + echo " the tests for each module from the top of the file" + echo " and skips tests once it exceeds the budget" + echo " allocated for that file." + echo " --help -- show all doctesting options" + echo " --tnew [...] -- equivalent to -t --new" + echo " -tp [...] -- like -t above, but tests in parallel using" + echo " N threads, with 0 interpreted as min(8, cpu_count())" + echo " --testall [options] -- equivalent to -t --all" + echo + echo " --coverage -- give information about doctest coverage of files" + echo " --coverageall -- give summary info about doctest coverage of" + echo " all files in the Sage library" + echo " --startuptime [module] -- display how long each component of Sage takes to" + echo " start up; optionally specify a module to get more" + echo " details about that particular module" + else + echo " -t [options] -- test examples in .py, .pyx, .sage" + echo " or .tex files." + echo " (not installed currently, to install," + echo " run sage --pip install sagemath-repl)" + fi if [ -n "$SAGE_SRC" -a -f "$SAGE_SRC/tox.ini" ]; then echo " --tox [options] -- general entry point for testing" echo " and linting of the Sage library" @@ -451,6 +469,17 @@ usage_advanced() { echo echo "Some developer utilities:" echo + if [ -n "$SAGE_SRC" -a -d "$SAGE_SRC" ]; then + echo " --grep [options] " + echo " -- regular expression search through the Sage" + echo " library for \"string\". Any options will" + echo " get passed to the \"grep\" command." + echo " --grepdoc [options] " + echo " -- regular expression search through the" + echo " Sage documentation for \"string\"." + echo " --search_src ... -- same as --grep" + echo " --search_doc ... -- same as --grepdoc" + fi echo " --sh [...] -- run a shell with Sage environment variables" echo " as they are set in the runtime of Sage" echo " --cleaner -- run the Sage cleaner. This cleans up after Sage," @@ -492,6 +521,13 @@ usage_advanced() { echo " files are named sage-omega.PID can be found in" echo " \$DOT_SAGE" echo " --valgrind -- this is an alias for --memcheck" + echo + echo "Getting help:" + echo + echo " -v, --version -- display Sage version information" + echo " --dumpversion -- print brief Sage version" + echo " -h, -?, --help -- print a short help message" + echo " --advanced -- list all command line options" if [ -d "$SAGE_ROOT" ]; then exec "$SAGE_ROOT/build/bin/sage-site" "--advanced" fi diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index cdf165694f7..be312ed5775 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -36,7 +36,12 @@ SAGE_VERSION=`echo "$1" | sed 's/^sage-//'` SAGE_RELEASE_DATE=`date -u +'%Y-%m-%d'` SAGE_VERSION_BANNER="SageMath version $SAGE_VERSION, Release Date: $SAGE_RELEASE_DATE" -echo $SAGE_VERSION | tee "$SAGE_SRC/VERSION.txt" > "$SAGE_ROOT/build/pkgs/sagelib/package-version.txt" +# Update Sage version file for all distribution packages +for version_file in "$SAGE_ROOT"/pkgs/*/VERSION.txt; do + if [ -f "$version_file" ]; then + echo $SAGE_VERSION > "$version_file" + fi +done # Update Sage version file for Python in SAGE_SRC/sage cat < "$SAGE_SRC/sage/version.py" @@ -76,7 +81,7 @@ git commit -m "Updated SageMath version to $SAGE_VERSION" -- \ "$SAGE_SRC/bin/sage-version.sh" \ "$SAGE_ROOT/build/pkgs/configure/checksums.ini" \ "$SAGE_ROOT/build/pkgs/configure/package-version.txt" \ - "$SAGE_ROOT/build/pkgs/sagelib/package-version.txt" \ + "$SAGE_ROOT"/pkgs/*/VERSION.txt \ || die "Error committing to the repository." git tag -a "$SAGE_VERSION" -m "$SAGE_VERSION_BANNER" \ diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index bc8b231097a..3dc222edd01 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -1,5 +1,5 @@ # Sage version information for shell scripts # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='9.7.beta1' -SAGE_RELEASE_DATE='2022-05-26' -SAGE_VERSION_BANNER='SageMath version 9.7.beta1, Release Date: 2022-05-26' +SAGE_VERSION='9.7.beta2' +SAGE_RELEASE_DATE='2022-06-12' +SAGE_VERSION_BANNER='SageMath version 9.7.beta2, Release Date: 2022-06-12' diff --git a/src/doc/Makefile b/src/doc/Makefile index 90bea5dfac5..62fb1cafd18 100644 --- a/src/doc/Makefile +++ b/src/doc/Makefile @@ -3,10 +3,12 @@ # 'make doc-html' (synonym for 'make' and 'make all') builds the html documentation. # 'make doc-pdf' builds the PDF documentation. # -# SAGE_ROOT must be defined for these to work, so these commands -# should be called by build/make/Makefile. +# The "sage" script must be in PATH, and the Sage library and the package sage_docbuild +# must be installed for these to work. +# These commands are intended to be called by build/make/Makefile via +# build/pkgs/sagemath_doc_{html,pdf}/spkg-install. # -# 'make clean' removes build artifacts; SAGE_ROOT need not be defined for this to work. +# 'make clean' removes build artifacts; the "sage" script is not needed for this to work. all: doc-html @@ -15,22 +17,27 @@ clean: rm -rf en/reference/sage rm -f common/*.pyc +# Sources generated at build time. (For sources generated at bootstrap time, see bootstrap.) +doc-src: + mkdir -p en/reference/repl + sage -advanced > en/reference/repl/options.txt + # Matches doc-inventory--reference-manifolds etc. doc-inventory--%: - cd $(SAGE_ROOT) && ./sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-inventory--,,$@)) inventory $(SAGE_DOCBUILD_OPTS) + sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-inventory--,,$@)) inventory $(SAGE_DOCBUILD_OPTS) # Matches doc-html--developer, doc-html--reference-manifolds etc. doc-html--%: - cd $(SAGE_ROOT) && ./sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-html--,,$@)) html $(SAGE_DOCBUILD_OPTS) + sage --docbuild --no-pdf-links $(subst -,/,$(subst doc-html--,,$@)) html $(SAGE_DOCBUILD_OPTS) # reference manual, inventory ifndef SAGE_ROOT doc-inventory-reference: $(error SAGE_ROOT undefined. This Makefile needs to be invoked by build/make/install) else -doc-inventory-reference: - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents reference)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi +doc-inventory-reference: doc-src + $(eval DOCS = $(shell sage --docbuild --all-documents reference)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) doc-inventory--$(subst /,-,$(BIBLIO)) @@ -40,8 +47,8 @@ endif # reference manual, html doc-html-reference: doc-inventory-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents reference)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents reference)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-html--$(subst /,-,$(BIBLIO)) @@ -50,20 +57,20 @@ doc-html-reference: doc-inventory-reference # other documentation, html doc-html-other: doc-html-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents all)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents all)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-html--$(subst /,-,$(doc))) doc-html: doc-html-reference doc-html-other # Matches doc-pdf--developer, doc-pdf--reference-manifolds etc. doc-pdf--%: - cd $(SAGE_ROOT) && ./sage --docbuild $(subst -,/,$(subst doc-pdf--,,$@)) pdf $(SAGE_DOCBUILD_OPTS) + sage --docbuild $(subst -,/,$(subst doc-pdf--,,$@)) pdf $(SAGE_DOCBUILD_OPTS) # reference manual, pdf doc-pdf-reference: doc-inventory-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents reference)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents reference)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-pdf--$(subst /,-,$(BIBLIO)) @@ -72,17 +79,18 @@ doc-pdf-reference: doc-inventory-reference # other documentation, pdf doc-pdf-other: doc-html-reference - $(eval DOCS = $(shell cd $(SAGE_ROOT) && ./sage --docbuild --all-documents all)) - @if [ -z "$(DOCS)" ]; then echo "Error: './sage --docbuild --all-documents' failed"; exit 1; fi + $(eval DOCS = $(shell sage --docbuild --all-documents all)) + @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-pdf--$(subst /,-,$(doc))) # website with pdf links doc-pdf-website: - cd $(SAGE_ROOT) && ./sage --docbuild website html $(SAGE_DOCBUILD_OPTS) + sage --docbuild website html $(SAGE_DOCBUILD_OPTS) doc-pdf: doc-pdf-reference doc-pdf-other doc-pdf-website .PHONY: all clean \ + doc-src \ doc-html doc-pdf \ doc-inventory-reference doc-html-reference doc-pdf-reference \ doc-html-other doc-pdf-other diff --git a/src/doc/bootstrap b/src/doc/bootstrap index 90ae09160ba..44c94627a53 100755 --- a/src/doc/bootstrap +++ b/src/doc/bootstrap @@ -33,7 +33,7 @@ for SYSTEM in arch debian fedora cygwin homebrew; do SAGELIB_SYSTEM_PACKAGES= SAGELIB_OPTIONAL_SYSTEM_PACKAGES= RECOMMENDED_SYSTEM_PACKAGES= - for PKG_BASE in $(./sage --package list --has-file distros/$SYSTEM.txt); do + for PKG_BASE in $(sage-package list --has-file distros/$SYSTEM.txt); do PKG_SCRIPTS=build/pkgs/$PKG_BASE SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/$SYSTEM.txt PKG_TYPE=$(cat $PKG_SCRIPTS/type) @@ -91,7 +91,7 @@ Sage depends. It installs them automatically if it does not find equivalent system packages. EOF -for PKG_BASE in $(./sage --package list --has-file SPKG.rst :standard: | sort); do +for PKG_BASE in $(sage-package list --has-file SPKG.rst :standard: | sort); do echo "* :ref:\`spkg_$PKG_BASE\`" done >> "$OUTPUT_INDEX" cat >> "$OUTPUT_INDEX" <> "$OUTPUT_INDEX" cat >> "$OUTPUT_INDEX" <> "$OUTPUT_INDEX" cat >> "$OUTPUT_INDEX" < "$OUTPUT_DIR"/$PKG_BASE.rst echo >> "$OUTPUT_INDEX" " $PKG_BASE" done - -# #30064: Create the directory first -OUTPUT_DIR="src/doc/en/reference/repl" -mkdir -p "$OUTPUT_DIR" -OUTPUT="$OUTPUT_DIR/options.txt" -if [ "${BOOTSTRAP_QUIET}" = "no" ]; then - echo >&2 $0:$LINENO: installing "$OUTPUT" -fi -./sage -advanced > "$OUTPUT" diff --git a/src/doc/de/tutorial/interactive_shell.rst b/src/doc/de/tutorial/interactive_shell.rst index 869029fa70e..b356ea21f45 100644 --- a/src/doc/de/tutorial/interactive_shell.rst +++ b/src/doc/de/tutorial/interactive_shell.rst @@ -15,8 +15,8 @@ vornehmen. Nach dem Start von Sage sehen Sie etwa folgendes: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -175,8 +175,8 @@ in einer zukünftigen Sitzung (indem Sie einfach die Log-Datei laden). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -194,8 +194,8 @@ in einer zukünftigen Sitzung (indem Sie einfach die Log-Datei laden). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index 2b540852a61..2e35c533471 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -77,7 +77,7 @@ In particular, - Use CamelCase for class names:: - class SomeValue(object): + class SomeValue(): def __init__(self, x): self._x = 1 diff --git a/src/doc/en/developer/coding_in_python.rst b/src/doc/en/developer/coding_in_python.rst index 6214eb51e4d..da8d7de2d08 100644 --- a/src/doc/en/developer/coding_in_python.rst +++ b/src/doc/en/developer/coding_in_python.rst @@ -16,14 +16,14 @@ that Sage supports. The information regarding the supported versions can be found in the files ``build/pkgs/python3/spkg-configure.m4`` and ``src/setup.cfg.m4``. -As of Sage 9.4, Python 3.7 is the oldest supported version. Hence, -all language and library features that are available in Python 3.7 can -be used; but features introduced in Python 3.8 cannot be used. If a +As of Sage 9.7, Python 3.8 is the oldest supported version. Hence, +all language and library features that are available in Python 3.8 can +be used; but features introduced in Python 3.9 cannot be used. If a feature is deprecated in a newer supported version, it must be ensured that deprecation warnings issued by Python do not lead to failures in doctests. -Some key language and library features have been backported to Python 3.7 +Some key language and library features have been backported to Python 3.8 using one of two mechanisms: - ``from __future__ import annotations`` (see diff --git a/src/doc/en/developer/packaging.rst b/src/doc/en/developer/packaging.rst index 501a54c1027..de2552383f5 100644 --- a/src/doc/en/developer/packaging.rst +++ b/src/doc/en/developer/packaging.rst @@ -678,7 +678,6 @@ for ``eclib``: ---------- All lines of this file are ignored except the first. - It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. For Python packages, common dependencies include ``pip``, ``setuptools``, and ``future``. If your package depends on any of @@ -699,7 +698,6 @@ If there are no dependencies, you can use ---------- All lines of this file are ignored except the first. - It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile. There are actually two kinds of dependencies: there are normal dependencies and order-only dependencies, which are weaker. The syntax @@ -718,12 +716,22 @@ If there is no ``|``, then all dependencies are normal. dependency (for example, a dependency on pip simply because the ``spkg-install`` file uses pip). + Alternatively, you can put the order-only dependencies in a separate + file ``dependencies_order_only``. + - If A has a **normal dependency** on B, it means additionally that A should be rebuilt every time that B gets updated. This is the most common kind of dependency. A normal dependency is what you need for libraries: if we upgrade NTL, we should rebuild everything which uses NTL. +Some packages are only needed for self-tests of a package (``spkg-check``). +These dependencies should be declared in a separate file ``dependencies_check``. + +Some dependencies are optional in the sense that they are only +a dependency if they are configured to be installed. These dependencies +should be declared in a separate file ``dependencies_optional``. + In order to check that the dependencies of your package are likely correct, the following command should work without errors:: diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index a8ea6c8bd40..0515f5b2a34 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -152,9 +152,33 @@ The source directory of a distribution package, such as - ``README.rst`` -- a description of the distribution -- ``VERSION.txt``, ``LICENSE.txt`` -- relative symbolic links to the same files +- ``LICENSE.txt`` -- relative symbolic link to the same files in ``SAGE_ROOT/src`` +- ``VERSION.txt`` -- package version. This file is updated by the release manager by + running the ``sage-update-version`` script. + + Sometimes it may be necessary to upload a hotfix for a distribution + package to PyPI. These should be marked by adding a suffix + ``.post1``, ``.post2``; see `PEP 440 on post-releases + `_. For example, if + the current development release is ``9.7.beta8``, then such a + version could be marked ``9.7.beta8.post1``. + + Also sometimes when working on tickets it may be necessary to + increment the version because a new feature is needed in another + distribution package. Such versions should be marked by using the + version number of the anticipated next development release and + adding a suffix ``.dev1``, ``.dev2`` ... (see `PEP 440 on + developmental releases + `_). + For example, if the current development release is ``9.7.beta8``, + use ``9.7.beta9.dev1``. If the current development release is + the stable release ``9.8``, use ``9.9.beta0.dev1``. + + After the ticket is merged in the next development version, it will + be synchronized again with the other package versions. + - ``setup.py`` -- a `setuptools `_-based installation script @@ -171,6 +195,12 @@ When adding a new distribution package that uses a symbolic link pointing into Some of these files may actually be generated from source files with suffix ``.m4`` by the ``SAGE_ROOT/bootstrap`` script via the ``m4`` macro processor. +For every distribution package, there is also a subdirectory of ``SAGE_ROOT/build/pkgs/``, +which contains the build infrastructure that is specific to Sage-the-distribution. +Note that these subdirectories follows a different naming convention, +using underscores instead of dashes, see :ref:`section-directory-structure`. +Because the distribution packages are included in the source tree, we set them +up as "script packages" instead of "normal packages", see :ref:`section-package-source-types`. @@ -453,12 +483,17 @@ Hierarchy of distribution packages def node(label, pos): return text(label, (3*pos[0],2*pos[1]), background_color='pink', color='black') - def edge(start, end): - return arrow((3*start[0],2*start[1]+.5),(3*end[0],2*end[1]-.5), arrowsize=2) + def edge(start, end, **kwds): + return arrow((3*start[0],2*start[1]+.5),(3*end[0],2*end[1]-.5), arrowsize=2, **kwds) + def extras_require(start, end): + return edge(start, end, linestyle='dashed') g = Graphics() - g += (node("sagemath-objects", (1,0)) + edge((1,0),(1,1))) - g += (node("sagemath-categories", (1,1)) + edge((1,1),(0,2)) + - edge((1,1),(1,2)) + edge((1,1),(2,2))) + g += (node("sage_conf", (0.5,0)) + extras_require((0.5,0),(0.5,1))) + g += (node("sagemath-objects", (1.5,0)) + edge((1.5,0),(1.5,1))) + g += (node("sagemath-environment", (0.5,1)) + + edge((0.5,1),(0,2)) + edge((0.5,1),(1,2)) + edge((0.5,1),(2,2))) + g += (node("sagemath-categories", (1.5,1)) + edge((1.5,1),(0,2)) + + edge((1.5,1),(1,2)) + edge((1.5,1),(2,2))) g += (node("sagemath-graphs", (0,2)) + node("sagemath-polyhedra", (1,2)) + node("sagemath-singular", (2,2)) + edge((0,2),(0,3)) + edge((0,2),(1,3)) + edge((1,2),(1,3)) + edge((2,2),(2,3))) g += (node("sagemath-tdlib", (0,3)) + node("sagemath-standard-no-symbolics", (1,3)) + node("sagemath-symbolics", (2,3)) + @@ -467,6 +502,10 @@ Hierarchy of distribution packages sphinx_plot(g, figsize=(8, 4), axes=False) +Solid arrows indicate ``install_requires``, i.e., a declared runtime dependency. +Dashed arrows indicate ``extras_require``, i.e., a declared optional runtime dependency. + + Testing distribution packages ============================= diff --git a/src/doc/en/developer/portability_testing.rst b/src/doc/en/developer/portability_testing.rst index ad4b5521ffa..a0a7cbf40b8 100644 --- a/src/doc/en/developer/portability_testing.rst +++ b/src/doc/en/developer/portability_testing.rst @@ -897,7 +897,7 @@ The ``local-homebrew-macos-standard-python3_xcode`` environment installs the same packages, but uses XCode's ``/usr/bin/python3``. The ``local-homebrew-macos-standard-python3_pythonorg`` expects an -installation of Python 3.7 in +installation of Python 3.10 in ``/Library/Frameworks/Python.framework``; this is where the binary packages provided by python.org install themselves. diff --git a/src/doc/en/installation/source.rst b/src/doc/en/installation/source.rst index 81cf1f7d58d..259a235d22f 100644 --- a/src/doc/en/installation/source.rst +++ b/src/doc/en/installation/source.rst @@ -134,7 +134,7 @@ rather than building a Python 3 installation from scratch. Use the ``configure`` option ``--without-system-python3`` in case you want Python 3 built from scratch. -Sage will accept versions 3.7.x to 3.10.x. +Sage will accept versions 3.8.x to 3.10.x. You can also use ``--with-python=/path/to/python3_binary`` to tell Sage to use ``/path/to/python3_binary`` to set up the venv. Note that setting up venv requires @@ -599,7 +599,7 @@ General procedure $ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 8.8, Release Date: 2019-06-26 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: diff --git a/src/doc/en/reference/combinat/index.rst b/src/doc/en/reference/combinat/index.rst index 4470e97836d..1e2a6da8665 100644 --- a/src/doc/en/reference/combinat/index.rst +++ b/src/doc/en/reference/combinat/index.rst @@ -1,7 +1,10 @@ +.. _sage.combinat: + Combinatorics ============= -.. automodule:: sage.combinat +.. automodule:: sage.combinat.all + :noindex: Comprehensive Module List ------------------------- diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 30a792e8214..f5edfa301e4 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -968,7 +968,7 @@ REFERENCES: .. [BDGRTW2019] Bonderson, Delaney, Galindo, Rowell, Tran, and Wang, On invariants of modular categories beyond modular data. J. Pure Appl. Algebra 223 (2019), no. 9, 4065–4088. - :arXiv:`1805.05736`. + :arxiv:`1805.05736`. .. [BM2004] John M. Boyer and Wendy J. Myrvold, *On the Cutting Edge: *Simplified `O(n)` Planarity by Edge Addition*. Journal of Graph @@ -2060,7 +2060,7 @@ REFERENCES: .. [Dragan2018] Feodor Dragan, Michel Habib, Laurent Viennot. *Revisiting Radius, Diameter, and all Eccentricity Computation in Graphs through Certificates*. - http://arxiv.org/abs/1803.04660 + :arxiv:`1803.04660` .. [Dro1987] Carl Droms. *Isomorphisms of graph groups*. Proc. of the Amer. Math. Soc. **100** @@ -3592,7 +3592,7 @@ REFERENCES: Springer-Verlag, 2011. .. [KP2020] Lars Kastner and Marta Panizzut, *Hyperplane arrangements - in polymake*, arxiv:`2003.13548`. + in polymake*, :arxiv:`2003.13548`. .. [KPRWZ2010] \M. H. Klin, C. Pech, S. Reichard, A. Woldar, M. Zvi-Av, *Examples of computer experimentation in algebraic @@ -4486,7 +4486,7 @@ REFERENCES: .. [NaiRow2011] Naidu and Rowell, A finiteness property for braided fusion categories. Algebr. Represent. Theory 14 (2011), no. 5, 837–855. - :arXiv:`0903.4157`. + :arxiv:`0903.4157`. .. [NAR2018] Jamie R. Nunez, Christopher R. Anderson, Ryan S. Renslow *Optimizing colormaps with consideration for color vision @@ -5002,7 +5002,7 @@ REFERENCES: .. [Row2006] Eric Rowell, *From quantum groups to unitary modular tensor categories*. In Representations of algebraic groups, quantum groups, and Lie algebras, Contemp. Math., **413**, Amer. Math. Soc., Providence, RI, 2006. - :arXiv:`math/0503226`. + :arxiv:`math/0503226`. .. [RoStWa2009] Eric Rowell, Richard Stong and Zhenghan Wang, *On classification of modular tensor categories*, Comm. Math. Phys. 292, 343--389, 2009. @@ -5087,7 +5087,7 @@ REFERENCES: .. [Sag2011] Bruce E. Sagan, *The cyclic sieving phenomenon: a survey*, - :arXiv:`1008.0790v3` + :arxiv:`1008.0790v3` .. [Sah2000] Sartaj Sahni. *Data Structures, Algorithms, and Applications in Java*. McGraw-Hill, 2000. @@ -5100,12 +5100,11 @@ REFERENCES: York, 1958. .. [Sal1965] \G. Salmon: "A Treatise on the Analytic Geometry of Three - Dimensions", Vol II, Chelsea Publishing Co., New - York, 1965. + Dimensions", Vol II, Chelsea Publishing Co., New York, 1965. .. [Sal2014] \B. Salisbury. The flush statistic on semistandard Young tableaux. - :arXiv:`1401.1185` + :arxiv:`1401.1185` .. [Sam2012] \P. Samanta: *Antipodal Graphs* :doi:`10.13140/RG.2.2.28238.46409` diff --git a/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst b/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst index c0c36091367..e4e0b1eeb8b 100644 --- a/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst +++ b/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst @@ -658,7 +658,8 @@ An example with quadratic field: sage: V = polytopes.dodecahedron().vertices_list() # optional - sage.rings.number_field sage: Polyhedron(vertices=V, backend='polymake') # optional - polymake # optional - sage.rings.number_field A 3-dimensional polyhedron - in (Number Field in sqrt5 with defining polynomial x^2 - 5)^3 + in (Number Field in sqrt5 with defining polynomial x^2 - 5 + with sqrt5 = 2.236067977499790?)^3 defined as the convex hull of 20 vertices .. end of output diff --git a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst index a295508e0ab..51aec989810 100644 --- a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst +++ b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst @@ -374,7 +374,7 @@ An example: glass of beverage in a restaurant Let's write a small class about glasses in a restaurant:: - sage: class Glass(object): + sage: class Glass(): ....: def __init__(self, size): ....: assert size > 0 ....: self._size = float(size) # an attribute @@ -474,7 +474,7 @@ the common behavior and then reuses the methods from this class. We first write a small class ''AbstractDish'' which implements the "clean-dirty-wash" behavior:: - sage: class AbstractDish(object): + sage: class AbstractDish(): ....: def __init__(self): ....: self._clean = True ....: def is_clean(self): @@ -604,7 +604,7 @@ Solutions to the exercises 1. Here is a solution to the first exercise:: - sage: class Glass(object): + sage: class Glass(): ....: def __init__(self, size): ....: assert size > 0 ....: self._size = float(size) @@ -686,7 +686,7 @@ Solutions to the exercises #. Here is the solution to the second exercice:: - sage: class AbstractDish(object): + sage: class AbstractDish(): ....: def __init__(self): ....: self._clean = True ....: def is_clean(self): diff --git a/src/doc/en/tutorial/interactive_shell.rst b/src/doc/en/tutorial/interactive_shell.rst index 3029ad8b6b5..7ae821e416d 100644 --- a/src/doc/en/tutorial/interactive_shell.rst +++ b/src/doc/en/tutorial/interactive_shell.rst @@ -13,8 +13,8 @@ Sage, you get output similar to the following: .. CODE-BLOCK:: text ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -173,8 +173,8 @@ file). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -192,8 +192,8 @@ file). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/fr/tutorial/interactive_shell.rst b/src/doc/fr/tutorial/interactive_shell.rst index c38140f781b..81235ccaab9 100644 --- a/src/doc/fr/tutorial/interactive_shell.rst +++ b/src/doc/fr/tutorial/interactive_shell.rst @@ -17,8 +17,8 @@ le shell Sage affiche un message de ce genre : :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -182,8 +182,8 @@ session future (en rechargeant le fichier journal). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -201,8 +201,8 @@ session future (en rechargeant le fichier journal). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/ja/tutorial/interactive_shell.rst b/src/doc/ja/tutorial/interactive_shell.rst index 452914bd12a..38a5c2c4d3f 100644 --- a/src/doc/ja/tutorial/interactive_shell.rst +++ b/src/doc/ja/tutorial/interactive_shell.rst @@ -14,8 +14,8 @@ Sageを起動すると,すぐに次のような画面が現れる: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ @@ -163,8 +163,8 @@ Sageセッションのロギングと,セッションの保存(:ref:`section-s was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -182,8 +182,8 @@ Sageセッションのロギングと,セッションの保存(:ref:`section-s Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/doc/pt/tutorial/interactive_shell.rst b/src/doc/pt/tutorial/interactive_shell.rst index 1b3ec525c89..67d27269a1e 100644 --- a/src/doc/pt/tutorial/interactive_shell.rst +++ b/src/doc/pt/tutorial/interactive_shell.rst @@ -16,8 +16,8 @@ obtém o seguinte: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: @@ -174,8 +174,8 @@ arquivo log). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -193,8 +193,8 @@ arquivo log). Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load "setup" diff --git a/src/doc/ru/tutorial/interactive_shell.rst b/src/doc/ru/tutorial/interactive_shell.rst index 9129eeee005..e2d8a68cde6 100644 --- a/src/doc/ru/tutorial/interactive_shell.rst +++ b/src/doc/ru/tutorial/interactive_shell.rst @@ -16,8 +16,8 @@ Sage вы увидите вывод, похожий на следующий: :: ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: @@ -166,8 +166,8 @@ Notebook), то вы можете ввести ``%hist``, чтобы вывес was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: logstart setup @@ -185,8 +185,8 @@ Notebook), то вы можете ввести ``%hist``, чтобы вывес Exiting Sage (CPU time 0m0.61s, Wall time 0m50.39s). was@form:~$ sage ┌────────────────────────────────────────────────────────────────────┐ - │ SageMath version 9.0, Release Date: 2020-01-01 │ - │ Using Python 3.7.3. Type "help()" for help. │ + │ SageMath version 9.7, Release Date: 2022-01-10 │ + │ Using Python 3.10.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: load("setup") diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 06cc97dc106..08326db9c10 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -600,7 +600,7 @@ def exp_to_monomial(T): return self.element_class(self, {exp_to_monomial(T):c for T,c in x.letterplace_polynomial().dict().items()}) # ok, not a free algebra element (or should not be viewed as one). if isinstance(x, str): - from sage.all import sage_eval + from sage.misc.sage_eval import sage_eval G = self.gens() d = {str(v): G[i] for i,v in enumerate(self.variable_names())} return self(sage_eval(x, locals=d)) diff --git a/src/sage/algebras/lie_algebras/subalgebra.py b/src/sage/algebras/lie_algebras/subalgebra.py index c9e9748a7d6..6bd13a8aaf5 100644 --- a/src/sage/algebras/lie_algebras/subalgebra.py +++ b/src/sage/algebras/lie_algebras/subalgebra.py @@ -208,8 +208,8 @@ def __classcall_private__(cls, ambient, gens, ideal=False, if ambient in LieAlgebras(ambient.base_ring()).Nilpotent(): category = category.Nilpotent() - sup = super(LieSubalgebra_finite_dimensional_with_basis, cls) - return sup.__classcall__(cls, ambient, gens, ideal, order, category) + return super().__classcall__(cls, ambient, gens, ideal, + order, category) def __init__(self, ambient, gens, ideal, order=None, category=None): r""" @@ -240,8 +240,7 @@ def __init__(self, ambient, gens, ideal, order=None, category=None): self._reorganized_indices = [self._reversed_indices.index(i) for i in ambient.indices()] - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - sup.__init__(ambient.base_ring(), category=category) + super().__init__(ambient.base_ring(), category=category) # register a coercion to the ambient Lie algebra H = Hom(self, ambient) @@ -278,8 +277,7 @@ def __contains__(self, x): if x in self.ambient(): x = self.ambient()(x) return x.to_vector() in self.module() - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.__contains__(x) + return super().__contains__(x) def __getitem__(self, x): r""" @@ -300,8 +298,7 @@ def __getitem__(self, x): """ if isinstance(x, tuple) and len(x) == 2: return self(x[0])._bracket_(self(x[1])) - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.__getitem__(x) + return super().__getitem__(x) def _repr_(self): r""" @@ -405,8 +402,7 @@ def _element_constructor_(self, x): if isinstance(x, list) and len(x) == 2: return self(x[0])._bracket_(self(x[1])) - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup._element_constructor_(x) + return super()._element_constructor_(x) def _to_m(self, X): r""" @@ -766,9 +762,7 @@ def from_vector(self, v, order=None, coerce=False): """ if len(v) == self.ambient().dimension(): return self.retract(self.ambient().from_vector(v)) - - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.from_vector(v) + return super().from_vector(v) def basis_matrix(self): r""" @@ -854,9 +848,7 @@ def is_ideal(self, A): """ if A == self.ambient() and self._is_ideal: return True - - sup = super(LieSubalgebra_finite_dimensional_with_basis, self) - return sup.is_ideal(A) + return super().is_ideal(A) def reduce(self, X): r""" diff --git a/src/sage/all.py b/src/sage/all.py index 584c0614181..8c2514ecd96 100644 --- a/src/sage/all.py +++ b/src/sage/all.py @@ -103,7 +103,7 @@ ################ end setup warnings ############################### -from sage.env import SAGE_ROOT, SAGE_SRC, SAGE_DOC_SRC, SAGE_LOCAL, DOT_SAGE, SAGE_ENV +from .all__sagemath_environment import * ################################################################### diff --git a/src/sage/all__sagemath_environment.py b/src/sage/all__sagemath_environment.py new file mode 100644 index 00000000000..f68c74ab115 --- /dev/null +++ b/src/sage/all__sagemath_environment.py @@ -0,0 +1,3 @@ +from sage.env import SAGE_ROOT, SAGE_SRC, SAGE_DOC_SRC, SAGE_LOCAL, DOT_SAGE, SAGE_ENV + +from sage.misc.all__sagemath_environment import * diff --git a/src/sage/all__sagemath_repl.py b/src/sage/all__sagemath_repl.py new file mode 100644 index 00000000000..c9508c15bbe --- /dev/null +++ b/src/sage/all__sagemath_repl.py @@ -0,0 +1,12 @@ +from .all__sagemath_objects import * +from .all__sagemath_environment import * + +# FIXME: all.py should import from here and remove these imports. +from sage.doctest.all import * +from sage.repl.all import * +from sage.misc.all__sagemath_repl import * + +# For doctesting. These are overwritten later + +Integer = int +RealNumber = float diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index e15d19ecd5b..bb084e5c3bd 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -2162,24 +2162,34 @@ def get_inverse_mod(order): def power_mod(a, n, m): """ - Return the ``n``-th power of ``a`` modulo the integer ``m``. + Return the `n`-th power of `a` modulo `m`, where `a` and `m` + are elements of a ring that implements the modulo operator ``%``. + + ALGORITHM: square-and-multiply EXAMPLES:: - sage: power_mod(0,0,5) - Traceback (most recent call last): - ... - ArithmeticError: 0^0 is undefined + sage: power_mod(2,388,389) + 1 sage: power_mod(2,390,391) 285 sage: power_mod(2,-1,7) 4 sage: power_mod(11,1,7) 4 + + This function works for fairly general rings:: + sage: R. = ZZ[] sage: power_mod(3*x, 10, 7) 4*x^10 + sage: power_mod(-3*x^2+4, 7, 2*x^3-5) + x^14 + x^8 + x^6 + x^3 + 962509*x^2 - 791910*x - 698281 + TESTS:: + + sage: power_mod(0,0,5) + 1 sage: power_mod(11,1,0) Traceback (most recent call last): ... @@ -2194,29 +2204,33 @@ def power_mod(a, n, m): sage: power_mod(mpz(2),mpz(390),mpz(391)) mpz(285) """ - if m == 0: + if not m: raise ZeroDivisionError("modulus must be nonzero") + + a = a % m # this should coerce into a ring containing both a and m + if m == 1: - return 0 + return a.parent().zero() + + n = Integer(n) + if not n: + return a.parent().one() if n < 0: - ainv = inverse_mod(a, m) - return power_mod(ainv, -n, m) - if n == 0: - if a == 0: - raise ArithmeticError("0^0 is undefined") - return 1 + a = inverse_mod(a, m) + n = -n + + apow = a + while not n & 1: + apow = apow * apow % m + n >>= 1 - apow = a % m - while n & 1 == 0: - apow = (apow*apow) % m - n = n >> 1 power = apow - n = n >> 1 - while n != 0: - apow = (apow*apow) % m - if n & 1 != 0: - power = (power*apow) % m - n = n >> 1 + n >>= 1 + while n: + apow = apow * apow % m + if n & 1: + power = power * apow % m + n >>= 1 return power diff --git a/src/sage/arith/srange.pyx b/src/sage/arith/srange.pyx index 041d96996d8..c21a43c0ee1 100644 --- a/src/sage/arith/srange.pyx +++ b/src/sage/arith/srange.pyx @@ -1,4 +1,3 @@ -# cython: language_level=2 """ Ranges and the ``[1,2,..,n]`` notation @@ -16,7 +15,7 @@ AUTHORS: # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# http://www.gnu.org/licenses/ +# https://www.gnu.org/licenses/ # **************************************************************************** @@ -396,10 +395,9 @@ def ellipsis_iter(*args, step=None): if len(args) > step_magic+1: i = step_magic more = xsrange(args[i-2], args[i+1], step, coerce=False, include_endpoint=True) - a = None for a in more: + last_end = a yield a - last_end = a skip = True next_ = None step_magic += 1 @@ -428,8 +426,8 @@ def ellipsis_iter(*args, step=None): if last_end != first: yield first for a in more: + last_end = a yield a - last_end = a except StopIteration: last_end = None skip = True diff --git a/src/sage/coding/abstract_code.py b/src/sage/coding/abstract_code.py index 525bb6e63ec..ba2ec68a038 100644 --- a/src/sage/coding/abstract_code.py +++ b/src/sage/coding/abstract_code.py @@ -154,7 +154,7 @@ class AbstractCode(Parent): - inherit from AbstractCode - call AbstractCode ``__init__`` method in the subclass constructor. - Example: ``super(SubclassName, self).__init__(length, "EncoderName", + Example: ``super().__init__(length, "EncoderName", "DecoderName", "metric")``. "EncoderName" and "DecoderName" are set to ``None`` by default, a generic code class such as AbstractCode does not necessarily have to have general encoders/decoders. However, if you @@ -232,7 +232,7 @@ def __init__(self, length, default_encoder_name=None, sage: from sage.coding.abstract_code import AbstractCode sage: class MyCodeFamily(AbstractCode): ....: def __init__(self, length): - ....: super(MyCodeFamily, self).__init__(length) + ....: super().__init__(length) ....: def __iter__(self): ....: for i in range(self.length() + 1): ....: yield vector([1 for j in range(i)] + [0 for k in range(i, self.length())]) @@ -314,7 +314,7 @@ def __getstate__(self): sage: '_registered_encoders' in C.__getstate__() True """ - d = super(AbstractCode, self).__getstate__() + d = super().__getstate__() d['_registered_encoders'] = self._registered_encoders d['_registered_decoders'] = self._registered_decoders return d @@ -334,7 +334,7 @@ def __iter__(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self): - ....: super(MyCode, self).__init__(10) + ....: super().__init__(10) We check we get a sensible error message while asking for an iterator over the elements of our new class: @@ -362,7 +362,7 @@ def __contains__(self, c): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self, length): - ....: super(MyCode, self).__init__(length) + ....: super().__init__(length) We check we get a sensible error message while asking if an element is in our new class: @@ -386,7 +386,7 @@ def ambient_space(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self, length): - ....: super(MyCode, self).__init__(length) + ....: super().__init__(length) sage: C = MyCode(3) sage: C.ambient_space() Traceback (most recent call last): @@ -458,7 +458,7 @@ def _repr_(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self): - ....: super(MyCode, self).__init__(10) + ....: super().__init__(10) We check we get a sensible error message while asking for a string representation of an instance of our new class: @@ -486,7 +486,7 @@ def _latex_(self): sage: from sage.coding.abstract_code import AbstractCode sage: class MyCode(AbstractCode): ....: def __init__(self): - ....: super(MyCode, self).__init__(10) + ....: super().__init__(10) We check we get a sensible error message while asking for a string representation of an instance of our new class: @@ -561,7 +561,7 @@ def add_decoder(self, name, decoder): sage: class MyDecoder(sage.coding.decoder.Decoder): ....: def __init__(self, code): - ....: super(MyDecoder, self).__init__(code) + ....: super().__init__(code) ....: def _repr_(self): ....: return "MyDecoder decoder with associated code %s" % self.code() @@ -623,7 +623,7 @@ def add_encoder(self, name, encoder): sage: class MyEncoder(sage.coding.encoder.Encoder): ....: def __init__(self, code): - ....: super(MyEncoder, self).__init__(code) + ....: super().__init__(code) ....: def _repr_(self): ....: return "MyEncoder encoder with associated code %s" % self.code() diff --git a/src/sage/coding/ag_code_decoders.pyx b/src/sage/coding/ag_code_decoders.pyx index cdf8cdcfe37..2c0390c5f67 100644 --- a/src/sage/coding/ag_code_decoders.pyx +++ b/src/sage/coding/ag_code_decoders.pyx @@ -1519,6 +1519,7 @@ cdef class Decoder_K(object): if verbose: width = 7 * (K.degree() + 2) + # auxiliary function for verbose printing def vprint_g(g, s): if verbose > 1: diff --git a/src/sage/coding/binary_code.pyx b/src/sage/coding/binary_code.pyx index 11af1f7aadf..709a3e8fe76 100644 --- a/src/sage/coding/binary_code.pyx +++ b/src/sage/coding/binary_code.pyx @@ -3927,7 +3927,7 @@ cdef class BinaryCodeClassifier: sage: soc_iter = codes.databases.self_orthogonal_binary_codes(12, 6, 4) sage: L = list(soc_iter) - sage: for n in range(0, 13): + sage: for n in range(13): ....: s = 'n=%2d : '%n ....: for k in range(1,7): ....: s += '%3d '%len([C for C in L if C.length() == n and C.dimension() == k]) diff --git a/src/sage/coding/grs_code.py b/src/sage/coding/grs_code.py index 1bdbc70727f..840152f75f9 100644 --- a/src/sage/coding/grs_code.py +++ b/src/sage/coding/grs_code.py @@ -234,7 +234,7 @@ def __init__(self, evaluation_points, dimension, column_multipliers=None): if not F.is_finite() or not F.is_field(): raise ValueError("Evaluation points must be in a finite field (and %s is not one)" % F) - super(GeneralizedReedSolomonCode, self).__init__(F, + super().__init__(F, len(self._evaluation_points), "EvaluationVector", "Gao") if dimension not in ZZ or dimension > self._length or dimension < 1: @@ -703,7 +703,7 @@ def __init__(self, code): sage: E Evaluation vector-style encoder for [40, 12, 29] Reed-Solomon Code over GF(59) """ - super(GRSEvaluationVectorEncoder, self).__init__(code) + super().__init__(code) def __eq__(self, other): r""" @@ -874,7 +874,7 @@ def __init__(self, code, polynomial_ring=None): """ from sage.rings.polynomial.polynomial_ring import PolynomialRing_commutative - super(GRSEvaluationPolynomialEncoder, self).__init__(code) + super().__init__(code) if polynomial_ring is None: self._polynomial_ring = code.base_field()['x'] else: @@ -1129,8 +1129,8 @@ def __init__(self, code): """ if not isinstance(code, GeneralizedReedSolomonCode): raise ValueError("code has to be a generalized Reed-Solomon code") - super(GRSBerlekampWelchDecoder, self).__init__(code, code.ambient_space(), - "EvaluationPolynomial") + super().__init__(code, code.ambient_space(), + "EvaluationPolynomial") def __eq__(self, other): r""" @@ -1434,8 +1434,8 @@ def __init__(self, code): """ if not isinstance(code, GeneralizedReedSolomonCode): raise ValueError("code has to be a generalized Reed-Solomon code") - super(GRSGaoDecoder, self).__init__(code, code.ambient_space(), - "EvaluationPolynomial") + super().__init__(code, code.ambient_space(), + "EvaluationPolynomial") def __eq__(self, other): r""" @@ -1833,7 +1833,7 @@ def __init__(self, code): raise ValueError("code has to be a generalized Reed-Solomon code") input_space = cartesian_product([code.ambient_space(), VectorSpace(GF(2), code.ambient_space().dimension())]) - super(GRSErrorErasureDecoder, self).__init__(code, input_space, "EvaluationVector") + super().__init__(code, input_space, "EvaluationVector") def __eq__(self, other): r""" @@ -2074,8 +2074,8 @@ def __init__(self, code): raise ValueError("code has to be a generalized Reed-Solomon code") if code.base_field().zero() in code.evaluation_points(): raise ValueError("Impossible to use this decoder over a GRS code which contains 0 amongst its evaluation points") - super(GRSKeyEquationSyndromeDecoder, self).__init__(code, code.ambient_space(), - "EvaluationVector") + super().__init__(code, code.ambient_space(), + "EvaluationVector") def __eq__(self, other): r""" @@ -2354,7 +2354,7 @@ def decode_to_message(self, r): C = self.code() if C.length() == C.dimension(): return self.connected_encoder().unencode_nocheck(r) - return super(GRSKeyEquationSyndromeDecoder, self).decode_to_message(r) + return super().decode_to_message(r) def decoding_radius(self): r""" diff --git a/src/sage/combinat/affine_permutation.py b/src/sage/combinat/affine_permutation.py index 11b8a5feacb..b87167bb487 100644 --- a/src/sage/combinat/affine_permutation.py +++ b/src/sage/combinat/affine_permutation.py @@ -2403,4 +2403,3 @@ def one(self): return self([1,2,3,4,5,6]) Element = AffinePermutationTypeG - diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 953c6b29761..daef30fab6e 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -44,11 +44,14 @@ - :ref:`sage.graphs` """ +from sage.misc.namespace_package import install_doc, install_dict # install the docstring of this module to the containing package -from sage.misc.namespace_package import install_doc install_doc(__package__, __doc__) +# install modules quickref and tutorial to the containing package from . import quickref, tutorial +install_dict(__package__, {'quickref': quickref, 'tutorial': tutorial}) +del quickref, tutorial from sage.misc.lazy_import import lazy_import diff --git a/src/sage/combinat/binary_tree.py b/src/sage/combinat/binary_tree.py index 5fda457d72e..d8e0a46938b 100644 --- a/src/sage/combinat/binary_tree.py +++ b/src/sage/combinat/binary_tree.py @@ -234,7 +234,7 @@ def _repr_(self): if not self: return "." else: - return super(BinaryTree, self)._repr_() + return super()._repr_() def _ascii_art_(self): r""" @@ -4124,7 +4124,7 @@ def __call__(self, x=None, *args, **keywords): sage: B() . """ - return super(BinaryTrees, self).__call__(x, *args, **keywords) + return super().__call__(x, *args, **keywords) def unlabelled_trees(self): """ @@ -4190,8 +4190,8 @@ def __init__(self, size): sage: S is BinaryTrees(3) True """ - super(BinaryTrees_size, self).__init__(facade=BinaryTrees_all(), - category=FiniteEnumeratedSets()) + super().__init__(facade=BinaryTrees_all(), + category=FiniteEnumeratedSets()) self._size = size def _repr_(self): @@ -4423,8 +4423,8 @@ def __init__(self, size): sage: for i in range(1,6): ....: TestSuite(BinaryTrees(2*i-1, full=True)).run() """ - super(FullBinaryTrees_size, self).__init__(facade=BinaryTrees_all(), - category=FiniteEnumeratedSets()) + super().__init__(facade=BinaryTrees_all(), + category=FiniteEnumeratedSets()) self._size = size def _repr_(self): diff --git a/src/sage/combinat/chas/__init__.py b/src/sage/combinat/chas/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/chas/__init__.py +++ b/src/sage/combinat/chas/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/chas/all.py b/src/sage/combinat/chas/all.py index 899155c0385..5833abbe49c 100644 --- a/src/sage/combinat/chas/all.py +++ b/src/sage/combinat/chas/all.py @@ -18,4 +18,3 @@ lazy_import('sage.combinat.chas.fsym', ['FreeSymmetricFunctions']) lazy_import('sage.combinat.chas.wqsym', ['WordQuasiSymmetricFunctions']) - diff --git a/src/sage/combinat/cluster_algebra_quiver/all.py b/src/sage/combinat/cluster_algebra_quiver/all.py index 61fec4fde04..40b86813ba0 100644 --- a/src/sage/combinat/cluster_algebra_quiver/all.py +++ b/src/sage/combinat/cluster_algebra_quiver/all.py @@ -15,4 +15,3 @@ lazy_import("sage.combinat.cluster_algebra_quiver.quiver_mutation_type", "QuiverMutationType") lazy_import("sage.combinat.cluster_algebra_quiver.quiver", "ClusterQuiver") lazy_import("sage.combinat.cluster_algebra_quiver.cluster_seed", "ClusterSeed") - diff --git a/src/sage/combinat/composition_tableau.py b/src/sage/combinat/composition_tableau.py index 53d22a50346..64c98d81bf5 100644 --- a/src/sage/combinat/composition_tableau.py +++ b/src/sage/combinat/composition_tableau.py @@ -859,4 +859,3 @@ def get_next_pos(self, ii, jj): return ii, j return ii+1, 0 - diff --git a/src/sage/combinat/crystals/affine_factorization.py b/src/sage/combinat/crystals/affine_factorization.py index 9dfda1c5b77..b88f1e3adb1 100644 --- a/src/sage/combinat/crystals/affine_factorization.py +++ b/src/sage/combinat/crystals/affine_factorization.py @@ -506,4 +506,3 @@ def is_isomorphism(self): is_embedding = is_isomorphism is_surjective = is_isomorphism - diff --git a/src/sage/combinat/crystals/affinization.py b/src/sage/combinat/crystals/affinization.py index fc79e6c3912..49ee74d1df5 100644 --- a/src/sage/combinat/crystals/affinization.py +++ b/src/sage/combinat/crystals/affinization.py @@ -324,4 +324,3 @@ def weight(self): WLR = self.parent().weight_lattice_realization() La = WLR.fundamental_weights() return WLR.sum(c*La[i] for i,c in self._b.weight()) + self._m * WLR.null_root() - diff --git a/src/sage/combinat/crystals/all.py b/src/sage/combinat/crystals/all.py index 23955e34465..397639405c9 100644 --- a/src/sage/combinat/crystals/all.py +++ b/src/sage/combinat/crystals/all.py @@ -28,4 +28,3 @@ from sage.misc.lazy_import import lazy_import lazy_import('sage.combinat.crystals', 'catalog', 'crystals') - diff --git a/src/sage/combinat/crystals/bkk_crystals.py b/src/sage/combinat/crystals/bkk_crystals.py index bf3c3eb369b..622fbb9e350 100644 --- a/src/sage/combinat/crystals/bkk_crystals.py +++ b/src/sage/combinat/crystals/bkk_crystals.py @@ -139,4 +139,3 @@ def genuine_highest_weight_vectors(self, index_set=None): class Element(CrystalOfBKKTableauxElement): pass - diff --git a/src/sage/combinat/crystals/crystals.py b/src/sage/combinat/crystals/crystals.py index 0b3fa3998df..8b965b79c09 100644 --- a/src/sage/combinat/crystals/crystals.py +++ b/src/sage/combinat/crystals/crystals.py @@ -253,4 +253,3 @@ def _rec(self, x, state): # yield y and all elements further below yield y, "n/a", True - diff --git a/src/sage/combinat/crystals/direct_sum.py b/src/sage/combinat/crystals/direct_sum.py index 90b02717ef4..84676264822 100644 --- a/src/sage/combinat/crystals/direct_sum.py +++ b/src/sage/combinat/crystals/direct_sum.py @@ -253,4 +253,3 @@ def epsilon(self, i): 0 """ return self.value[1].epsilon(i) - diff --git a/src/sage/combinat/crystals/induced_structure.py b/src/sage/combinat/crystals/induced_structure.py index 0cf36648bba..1e89220f3ea 100644 --- a/src/sage/combinat/crystals/induced_structure.py +++ b/src/sage/combinat/crystals/induced_structure.py @@ -686,4 +686,3 @@ def weight(self): (1, 0, 1, 0) """ return self.parent()._inverse(self.value).weight() - diff --git a/src/sage/combinat/crystals/infinity_crystals.py b/src/sage/combinat/crystals/infinity_crystals.py index 919242aa1b8..0edf826c73e 100644 --- a/src/sage/combinat/crystals/infinity_crystals.py +++ b/src/sage/combinat/crystals/infinity_crystals.py @@ -725,4 +725,3 @@ def _element_constructor_(self, *args, **options): class Element(InfinityQueerCrystalOfTableauxElement): pass - diff --git a/src/sage/combinat/crystals/kyoto_path_model.py b/src/sage/combinat/crystals/kyoto_path_model.py index 0b5ad79a32f..12d3af264a6 100644 --- a/src/sage/combinat/crystals/kyoto_path_model.py +++ b/src/sage/combinat/crystals/kyoto_path_model.py @@ -492,4 +492,3 @@ def truncate(self, k=None): i = len(l) % N l.append(self.parent()._phi_dicts[i][ l[-1].Epsilon() ]) return P(*l) - diff --git a/src/sage/combinat/crystals/littelmann_path.py b/src/sage/combinat/crystals/littelmann_path.py index 6f45611e85c..3e6db2ce2fe 100644 --- a/src/sage/combinat/crystals/littelmann_path.py +++ b/src/sage/combinat/crystals/littelmann_path.py @@ -165,7 +165,7 @@ def __classcall_private__(cls, starting_weight, cartan_type = None, starting_wei if starting_weight.parent() != starting_weight_parent: raise ValueError("The passed parent is not equal to parent of the inputted weight!") - return super(CrystalOfLSPaths, cls).__classcall__(cls, starting_weight, starting_weight_parent = starting_weight_parent) + return super().__classcall__(cls, starting_weight, starting_weight_parent = starting_weight_parent) def __init__(self, starting_weight, starting_weight_parent): """ @@ -1320,8 +1320,8 @@ def e(self, i, power=1, length_only=False): sage: len(B.subcrystal(max_depth=7)) 116 """ - ret = super(InfinityCrystalOfLSPaths.Element, self).e(i, power=power, - length_only=length_only) + ret = super().e(i, power=power, + length_only=length_only) if ret is None: return None if length_only: @@ -1489,4 +1489,3 @@ def positively_parallel_weights(v, w): if v[i]*w[i] > 0 and v[i]*w == w[i]*v: return True return False - diff --git a/src/sage/combinat/crystals/monomial_crystals.py b/src/sage/combinat/crystals/monomial_crystals.py index 73c810bd594..43d71f16747 100644 --- a/src/sage/combinat/crystals/monomial_crystals.py +++ b/src/sage/combinat/crystals/monomial_crystals.py @@ -1255,4 +1255,3 @@ def cardinality(self): return super(InfinityCrystalOfNakajimaMonomials, self).cardinality() Element = CrystalOfNakajimaMonomialsElement - diff --git a/src/sage/combinat/crystals/multisegments.py b/src/sage/combinat/crystals/multisegments.py index 7db77030117..81b01f17fcc 100644 --- a/src/sage/combinat/crystals/multisegments.py +++ b/src/sage/combinat/crystals/multisegments.py @@ -451,4 +451,3 @@ def weight(self): n = self.parent()._cartan_type.rank() return WLR.sum(-1*alpha[j % n] for k,i in self.value for j in range(ZZ(i),ZZ(i)+k)) - diff --git a/src/sage/combinat/crystals/mv_polytopes.py b/src/sage/combinat/crystals/mv_polytopes.py index 25fdd16c3f3..4ff902a7b6b 100644 --- a/src/sage/combinat/crystals/mv_polytopes.py +++ b/src/sage/combinat/crystals/mv_polytopes.py @@ -461,4 +461,3 @@ def latex_options(self): return copy(self._latex_options) Element = MVPolytope - diff --git a/src/sage/combinat/crystals/pbw_crystal.py b/src/sage/combinat/crystals/pbw_crystal.py index 3143aa32a9d..1803b501f9e 100644 --- a/src/sage/combinat/crystals/pbw_crystal.py +++ b/src/sage/combinat/crystals/pbw_crystal.py @@ -506,4 +506,3 @@ def set_default_long_word(self, word): self._default_word = tuple(word) Element = PBWCrystalElement - diff --git a/src/sage/combinat/crystals/polyhedral_realization.py b/src/sage/combinat/crystals/polyhedral_realization.py index 4440dd2ac0a..2860eec417c 100644 --- a/src/sage/combinat/crystals/polyhedral_realization.py +++ b/src/sage/combinat/crystals/polyhedral_realization.py @@ -366,4 +366,3 @@ def truncate(self, k=None): i = len(l) % N l.append(self.parent()._tp[i]) return P(*l) - diff --git a/src/sage/combinat/crystals/star_crystal.py b/src/sage/combinat/crystals/star_crystal.py index 2ed01c49422..1434eac09eb 100644 --- a/src/sage/combinat/crystals/star_crystal.py +++ b/src/sage/combinat/crystals/star_crystal.py @@ -286,4 +286,3 @@ def jump(self, i): P = self.parent().weight_lattice_realization() ac = P.simple_coroot(i) return P(self.value.weight()).scalar(ac) + self.epsilon(i) + self.value.epsilon(i) - diff --git a/src/sage/combinat/crystals/subcrystal.py b/src/sage/combinat/crystals/subcrystal.py index 81af397e59e..9881a021e27 100644 --- a/src/sage/combinat/crystals/subcrystal.py +++ b/src/sage/combinat/crystals/subcrystal.py @@ -457,4 +457,3 @@ def weight(self): (0, 1, 0, 1, 1) """ return self.value.weight() - diff --git a/src/sage/combinat/crystals/tensor_product_element.pyx b/src/sage/combinat/crystals/tensor_product_element.pyx index 98083ecc9e4..b7f60016ecc 100644 --- a/src/sage/combinat/crystals/tensor_product_element.pyx +++ b/src/sage/combinat/crystals/tensor_product_element.pyx @@ -1857,6 +1857,7 @@ cdef class InfinityQueerCrystalOfTableauxElement(TensorProductOfQueerSuperCrysta n = self._parent._cartan_type.n + 1 zero = self._parent.weight_lattice_realization().zero() La = self._parent.weight_lattice_realization().fundamental_weights() + def fwt(i): return zero if i == n else La[i] ret -= sum((self._row_lengths[i] - 1 - self._row_lengths[i+1])*(fwt(n-i)-fwt(n-i-1)) diff --git a/src/sage/combinat/crystals/virtual_crystal.py b/src/sage/combinat/crystals/virtual_crystal.py index 81088735b4f..a537a64bfb8 100644 --- a/src/sage/combinat/crystals/virtual_crystal.py +++ b/src/sage/combinat/crystals/virtual_crystal.py @@ -198,7 +198,7 @@ def __classcall_private__(cls, ambient, virtualization, scaling_factors, return super(Subcrystal, cls).__classcall__(cls, ambient, virtualization, scaling_factors, contained, tuple(generators), cartan_type, tuple(index_set), category) - + def __init__(self, ambient, virtualization, scaling_factors, contained, generators, cartan_type, index_set, category): """ @@ -415,4 +415,3 @@ def weight(self): for i in self.index_set()) # TODO: implement a devirtualization map - diff --git a/src/sage/combinat/designs/__init__.py b/src/sage/combinat/designs/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/designs/__init__.py +++ b/src/sage/combinat/designs/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/diagram_algebras.py b/src/sage/combinat/diagram_algebras.py index de6813f7a23..eee9052ed76 100644 --- a/src/sage/combinat/diagram_algebras.py +++ b/src/sage/combinat/diagram_algebras.py @@ -257,7 +257,7 @@ def __init__(self, parent, d, check=True): sage: pd1 = da.AbstractPartitionDiagram(pd, ((-2,-1),(1,2)) ) """ self._base_diagram = tuple(sorted(tuple(sorted(i)) for i in d)) - super(AbstractPartitionDiagram, self).__init__(parent, self._base_diagram, check=check) + super().__init__(parent, self._base_diagram, check=check) def check(self): r""" @@ -588,7 +588,7 @@ def check(self): ValueError: {{-3, -1, 1, 2}} does not represent two rows of vertices of order 2 sage: pd4 = IdealDiagram([[1,-2,-1],[2]]) # indirect doctest """ - super(IdealDiagram, self).check() + super().check() if self.propagating_number() >= self.order(): raise ValueError("the diagram %s must have a propagating number smaller than the order" % self) @@ -659,7 +659,7 @@ def check(self): ValueError: {{-3, -1, 1, 2}} does not represent two rows of vertices of order 2 sage: pd4 = PlanarDiagram([[1,-2,-1],[2]]) # indirect doctest """ - super(PlanarDiagram, self).check() + super().check() if not self.is_planar(): raise ValueError("the diagram %s must be planar" % self) @@ -721,7 +721,7 @@ def check(self): ... ValueError: all blocks of {{-2, -1, 1}, {2}} must be of size 2 """ - super(TemperleyLiebDiagram, self).check() + super().check() if any(len(block) != 2 for block in self): raise ValueError("all blocks of %s must be of size 2" % self ) if not self.is_planar(): @@ -824,7 +824,7 @@ def check(self): ... ValueError: all blocks of {{-2, -1, 1, 2}} must be of size 2 """ - super(BrauerDiagram, self).check() + super().check() if any(len(i) != 2 for i in self): raise ValueError("all blocks of %s must be of size 2" % self) @@ -903,7 +903,7 @@ def _repr_normal(self): sage: bd([[1,2],[-1,-2]])._repr_normal() '{{-2, -1}, {1, 2}}' """ - return super(BrauerDiagram, self)._repr_() + return super()._repr_() def _repr_compact(self): """ @@ -1425,7 +1425,7 @@ def __contains__(self, obj): r = ZZ(self.order) else: r = ZZ(self.order + ZZ(1)/ZZ(2)) - return super(BrauerDiagrams, self).__contains__(obj) and [len(i) for i in obj] == [2]*r + return super().__contains__(obj) and [len(i) for i in obj] == [2]*r def cardinality(self): r""" @@ -1714,7 +1714,7 @@ def __contains__(self, obj): obj = self._element_constructor_(obj) except (ValueError, TypeError): return False - return super(PlanarDiagrams, self).__contains__(obj) + return super().__contains__(obj) class IdealDiagrams(AbstractPartitionDiagrams): r""" @@ -1761,7 +1761,7 @@ def __contains__(self, obj): obj = self._element_constructor_(obj) except (ValueError, TypeError): return False - return super(IdealDiagrams, self).__contains__(obj) and obj.propagating_number() < self.order + return super().__contains__(obj) and obj.propagating_number() < self.order class DiagramAlgebra(CombinatorialFreeModule): r""" @@ -2436,7 +2436,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="P"): """ if base_ring is None: base_ring = q.parent() - return super(PartitionAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) # The following is the basic constructor method for the class. # The purpose of the "prefix" is to label the basis elements @@ -2509,7 +2509,7 @@ def _element_constructor_(self, x): and self.has_coerce_map_from(x.parent().base_ring())): return sum(a * self._diag_to_Blst(d) for (d,a) in x) - return super(PartitionAlgebra, self)._element_constructor_(x) + return super()._element_constructor_(x) def _repr_(self): """ @@ -2598,7 +2598,7 @@ def _coerce_map_from_(self, R): if R.n <= self._k and self.base_ring().has_coerce_map_from(R.base_ring()): return R.module_morphism(self._perm_to_Blst, codomain=self) return None - return super(PartitionAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def orbit_basis(self): r""" @@ -3173,7 +3173,7 @@ def __classcall_private__(cls, *args): k, q, R = args q = R(q) alg = PartitionAlgebra(k, q, R) - return super(OrbitBasis, cls).__classcall__(cls, alg) + return super().__classcall__(cls, alg) def __init__(self, alg): """ @@ -3246,7 +3246,7 @@ def _coerce_map_from_(self, R): return self._alg.module_morphism(self._diagram_to_orbit_on_basis, codomain=self) if self._alg.coerce_map_from(R): return self._coerce_map_via([self._alg], R) - return super(OrbitBasis, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) @cached_method def one(self): @@ -3645,7 +3645,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="B"): """ if base_ring is None: base_ring = q.parent() - return super(BrauerAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" @@ -3704,7 +3704,7 @@ def _coerce_map_from_(self, R): if R.n <= self._k and self.base_ring().has_coerce_map_from(R.base_ring()): return R.module_morphism(self._perm_to_Blst, codomain=self) return None - return super(BrauerAlgebra, self)._coerce_map_from_(R) + return super()._coerce_map_from_(R) def _element_constructor_(self, set_partition): r""" @@ -3836,7 +3836,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="T"): """ if base_ring is None: base_ring = q.parent() - return super(TemperleyLiebAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" @@ -4003,7 +4003,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="Pl"): """ if base_ring is None: base_ring = q.parent() - return super(PlanarAlgebra, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" @@ -4092,7 +4092,7 @@ def __classcall_private__(cls, k, q, base_ring=None, prefix="I"): """ if base_ring is None: base_ring = q.parent() - return super(PropagatingIdeal, cls).__classcall__(cls, k, q, base_ring, prefix) + return super().__classcall__(cls, k, q, base_ring, prefix) def __init__(self, k, q, base_ring, prefix): r""" diff --git a/src/sage/combinat/finite_state_machine.py b/src/sage/combinat/finite_state_machine.py index f52a0f129d6..cd0f48871e3 100644 --- a/src/sage/combinat/finite_state_machine.py +++ b/src/sage/combinat/finite_state_machine.py @@ -2012,7 +2012,7 @@ def __bool__(self): """ return True # A state cannot be zero (see __init__) - + def _epsilon_successors_(self, fsm=None): """ @@ -2491,7 +2491,7 @@ def __bool__(self): """ return True # A transition cannot be zero (see __init__) - + # **************************************************************************** @@ -3932,7 +3932,7 @@ def __bool__(self): """ return bool(self._states_) - + def __eq__(self, other): """ @@ -11018,12 +11018,10 @@ def __init__(self, *args, **kwargs): True sage: Automaton()._allow_composition_ False - """ - super(Automaton, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._allow_composition_ = False - def _repr_(self): """ Represents the finite state machine as "Automaton with n @@ -11825,7 +11823,7 @@ class is created and is used during the processing. options['list_of_outputs'] = True options['only_accepted'] = True - result = super(Automaton, self).process(*args, **options) + result = super().process(*args, **options) if condensed_output: return any(result) @@ -11870,7 +11868,7 @@ def _process_convert_output_(self, output_data, **kwargs): (True, 'a', [1, 0, 1]) """ if kwargs['always_include_output']: - return super(Automaton, self)._process_convert_output_( + return super()._process_convert_output_( output_data, **kwargs) accept_input, current_state, output = output_data if kwargs['full_output']: @@ -12994,7 +12992,7 @@ class is created and is used during the processing. options['list_of_outputs'] = True options['only_accepted'] = True - result = super(Transducer, self).process(*args, **options) + result = super().process(*args, **options) if (condensed_output and not result or not options['full_output'] and result is None): @@ -13734,7 +13732,7 @@ def __init__(self, *args, **kwargs): ....: [False], ((0, 0),), False) tape at 0 """ - super(_FSMTapeCacheDetectEpsilon_, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._visited_states_ = set() @@ -13752,7 +13750,7 @@ def __deepcopy__(self, memo): sage: TC3._visited_states_ {1} """ - new = super(_FSMTapeCacheDetectEpsilon_, self).__deepcopy__(memo) + new = super().__deepcopy__(memo) new._visited_states_ = copy(self._visited_states_) return new @@ -15099,7 +15097,7 @@ def __init__(self, *args, **kwargs): self.TapeCache = _FSMTapeCacheDetectEpsilon_ self.visited_states = {} kwargs['check_epsilon_transitions'] = False - return super(_FSMProcessIteratorEpsilon_, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) def _push_branch_(self, state, tape_cache, outputs): @@ -15145,7 +15143,7 @@ def _push_branch_(self, state, tape_cache, outputs): if found: return - super(_FSMProcessIteratorEpsilon_, self)._push_branch_( + super()._push_branch_( state, tape_cache, outputs) # As tape_cache may have been discarded because current already @@ -15226,7 +15224,7 @@ def __init__(self, *args, **kwargs): self.TapeCache = _FSMTapeCacheDetectAll_ self.visited_states = {} kwargs['check_epsilon_transitions'] = False - return super(_FSMProcessIteratorAll_, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) # **************************************************************************** diff --git a/src/sage/combinat/free_dendriform_algebra.py b/src/sage/combinat/free_dendriform_algebra.py index 32709cfaf7c..ffac8fd2452 100644 --- a/src/sage/combinat/free_dendriform_algebra.py +++ b/src/sage/combinat/free_dendriform_algebra.py @@ -936,4 +936,3 @@ def _repr_(self): Dendriform[x,y,z,t] """ return "Dendriform[%s]" % ','.join(self.vars) - diff --git a/src/sage/combinat/hall_polynomial.py b/src/sage/combinat/hall_polynomial.py index cd540de429c..19d65bc2263 100644 --- a/src/sage/combinat/hall_polynomial.py +++ b/src/sage/combinat/hall_polynomial.py @@ -184,4 +184,3 @@ def hall_polynomial(nu, mu, la, q=None): from sage.algebras.hall_algebra import HallAlgebra H = HallAlgebra(R, q) return (H[mu]*H[la]).coefficient(nu) - diff --git a/src/sage/combinat/integer_matrices.py b/src/sage/combinat/integer_matrices.py index 6b48ca6c336..44d42ce39b1 100644 --- a/src/sage/combinat/integer_matrices.py +++ b/src/sage/combinat/integer_matrices.py @@ -333,4 +333,3 @@ def integer_matrices_generator(row_sums, column_sums): t = [column_sums[i]-ci for (i, ci) in enumerate(comp)] for mat in integer_matrices_generator(row_sums[1:], t): yield [list(comp)] + mat - diff --git a/src/sage/combinat/k_tableau.py b/src/sage/combinat/k_tableau.py index 0c1df07ba61..65b925d9ce0 100644 --- a/src/sage/combinat/k_tableau.py +++ b/src/sage/combinat/k_tableau.py @@ -438,7 +438,7 @@ def __hash__(self): if self.parent()._representation in ['core', 'bounded']: return hash(tuple(tuple(x) for x in self)) + hash(self.parent().k) else: - return super(WeakTableau_abstract, self).__hash__() + return super().__hash__() def _latex_(self): r""" @@ -1250,7 +1250,7 @@ def __classcall_private__(cls, k, shape, weight): shape = (Core(shape, k+1), Core([],k+1)) else: shape = tuple([Core(r,k+1) for r in shape]) - return super(WeakTableaux_core, cls).__classcall__(cls, k, shape, tuple(weight)) + return super().__classcall__(cls, k, shape, tuple(weight)) def __init__(self, k, shape, weight): r""" @@ -1718,7 +1718,7 @@ def __classcall_private__(cls, k, shape, weight): shape = (Partition(shape), Partition([])) else: shape = tuple([Partition(r) for r in shape]) - return super(WeakTableaux_bounded, cls).__classcall__(cls, k, shape, tuple(weight)) + return super().__classcall__(cls, k, shape, tuple(weight)) def __init__(self, k, shape, weight): r""" @@ -2139,7 +2139,7 @@ def __classcall_private__(cls, k, shape, weight): shape = (Core(shape, k+1), Core([],k+1)) else: shape = tuple([Core(r,k+1) for r in shape]) - return super(WeakTableaux_factorized_permutation, cls).__classcall__(cls, k, shape, tuple(weight)) + return super().__classcall__(cls, k, shape, tuple(weight)) def __init__(self, k, shape, weight): r""" @@ -3956,7 +3956,7 @@ def __classcall_private__(cls, k, shape, weight=None): inner_shape = Core(shape[1],k+1) if weight is not None: weight = tuple(weight) - return super(StrongTableaux, cls).__classcall__(cls, k, (outer_shape, inner_shape), weight) + return super().__classcall__(cls, k, (outer_shape, inner_shape), weight) def _repr_( self ): r""" diff --git a/src/sage/combinat/lr_tableau.py b/src/sage/combinat/lr_tableau.py index 3348c97e7d1..3a24b1007d3 100644 --- a/src/sage/combinat/lr_tableau.py +++ b/src/sage/combinat/lr_tableau.py @@ -304,4 +304,3 @@ def _tableau_join(t1, t2, shift=0): """ return [[e1 for e1 in row1] + [e2+shift for e2 in row2 if e2 is not None] for (row1, row2) in zip_longest(t1, t2, fillvalue=[])] - diff --git a/src/sage/combinat/matrices/all.py b/src/sage/combinat/matrices/all.py index baa34da139a..0f6adbb5355 100644 --- a/src/sage/combinat/matrices/all.py +++ b/src/sage/combinat/matrices/all.py @@ -17,4 +17,3 @@ lazy_import('sage.combinat.matrices.dlxcpp', 'DLXCPP') lazy_import('sage.combinat.matrices.hadamard_matrix', ['hadamard_matrix', 'hadamard_matrix_www']) - diff --git a/src/sage/combinat/matrices/dancing_links.pyx b/src/sage/combinat/matrices/dancing_links.pyx index 93859dce9b9..953b5c4e680 100644 --- a/src/sage/combinat/matrices/dancing_links.pyx +++ b/src/sage/combinat/matrices/dancing_links.pyx @@ -666,6 +666,7 @@ cdef class dancing_linksWrapper: "where ncols={}".format(column, self.ncols())) from sage.parallel.decorate import parallel + @parallel(ncpus=ncpus) def first_solution(i): dlx = self.restrict([i]) @@ -782,6 +783,7 @@ cdef class dancing_linksWrapper: "where ncols={}".format(column, self.ncols())) from sage.parallel.decorate import parallel + @parallel(ncpus=ncpus) def all_solutions(i): dlx = self.restrict([i]) @@ -881,6 +883,7 @@ cdef class dancing_linksWrapper: "where ncols={}".format(column, self.ncols())) from sage.parallel.decorate import parallel + @parallel(ncpus=ncpus) def nb_sol(i): dlx = self.restrict([i]) diff --git a/src/sage/combinat/matrices/dlxcpp.py b/src/sage/combinat/matrices/dlxcpp.py index 7a5b153b759..4e12b98e325 100644 --- a/src/sage/combinat/matrices/dlxcpp.py +++ b/src/sage/combinat/matrices/dlxcpp.py @@ -129,5 +129,3 @@ def OneExactCover(M): for s in AllExactCovers(M): return s - - diff --git a/src/sage/combinat/misc.py b/src/sage/combinat/misc.py index abcd7871932..d29b31a101f 100644 --- a/src/sage/combinat/misc.py +++ b/src/sage/combinat/misc.py @@ -399,4 +399,3 @@ def check_integer_list_constraints(l, **kwargs): return None else: return result - diff --git a/src/sage/combinat/multiset_partition_into_sets_ordered.py b/src/sage/combinat/multiset_partition_into_sets_ordered.py index 77a06dc4134..8963ab00f0d 100755 --- a/src/sage/combinat/multiset_partition_into_sets_ordered.py +++ b/src/sage/combinat/multiset_partition_into_sets_ordered.py @@ -3508,4 +3508,3 @@ def f(self,i): return None w = w.f(i) return P.element_class(P, (w, breaks)) - diff --git a/src/sage/combinat/ncsf_qsym/__init__.py b/src/sage/combinat/ncsf_qsym/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/ncsf_qsym/__init__.py +++ b/src/sage/combinat/ncsf_qsym/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/ncsf_qsym/all.py b/src/sage/combinat/ncsf_qsym/all.py index 212da647869..db6cb1f065e 100644 --- a/src/sage/combinat/ncsf_qsym/all.py +++ b/src/sage/combinat/ncsf_qsym/all.py @@ -14,4 +14,3 @@ from .qsym import QuasiSymmetricFunctions from .ncsf import NonCommutativeSymmetricFunctions - diff --git a/src/sage/combinat/ncsf_qsym/combinatorics.py b/src/sage/combinat/ncsf_qsym/combinatorics.py index 6688b4640ff..a0f8825ae3e 100644 --- a/src/sage/combinat/ncsf_qsym/combinatorics.py +++ b/src/sage/combinat/ncsf_qsym/combinatorics.py @@ -323,4 +323,3 @@ def number_of_SSRCT(content_comp, shape_comp): if cond([shape_comp[0]]+list(x), shape_comp): s += number_of_SSRCT(Comps(content_comp[1:]), x) return s - diff --git a/src/sage/combinat/ncsf_qsym/generic_basis_code.py b/src/sage/combinat/ncsf_qsym/generic_basis_code.py index d10de45aebc..3457b4cdd03 100644 --- a/src/sage/combinat/ncsf_qsym/generic_basis_code.py +++ b/src/sage/combinat/ncsf_qsym/generic_basis_code.py @@ -1432,4 +1432,3 @@ def internal_product_by_coercion(self, left, right): """ R = self.realization_of().a_realization() return self(R.internal_product(R(left), R(right))) - diff --git a/src/sage/combinat/ncsym/ncsym.py b/src/sage/combinat/ncsym/ncsym.py index 4df1db47990..6acf7dbc1c0 100644 --- a/src/sage/combinat/ncsym/ncsym.py +++ b/src/sage/combinat/ncsym/ncsym.py @@ -2109,4 +2109,3 @@ def _m_to_chi_on_basis(self, A): return self._from_dict({B: m[j,i] for j,B in enumerate(lst)}) chi = supercharacter - diff --git a/src/sage/combinat/output.py b/src/sage/combinat/output.py index 95b5cd0c046..d153149c48b 100644 --- a/src/sage/combinat/output.py +++ b/src/sage/combinat/output.py @@ -506,4 +506,3 @@ def get_len(e): return output.translate(tr) else: return output - diff --git a/src/sage/combinat/partition_kleshchev.py b/src/sage/combinat/partition_kleshchev.py index c379de07876..8fd46bc76fe 100644 --- a/src/sage/combinat/partition_kleshchev.py +++ b/src/sage/combinat/partition_kleshchev.py @@ -449,7 +449,7 @@ def is_regular(self): if self.size() == 0 or self.parent()._e == 0: return True KP = self.parent() - return super(KleshchevPartition, self).is_regular(KP._e, KP._multicharge) + return super().is_regular(KP._e, KP._multicharge) def is_restricted(self): r""" @@ -475,7 +475,8 @@ def is_restricted(self): if self.size() == 0 or self.parent()._e == 0: return True KP = self.parent() - return super(KleshchevPartition, self).is_restricted(KP._e, KP._multicharge) + return super().is_restricted(KP._e, KP._multicharge) + class KleshchevPartitionTuple(PartitionTuple): r""" @@ -1284,7 +1285,8 @@ def _element_constructor_(self, mu): if self._level>1 and KPmu._convention[0] == self._convention[0]: mu = mu[::-1] - return super(KleshchevPartitions, self)._element_constructor_(mu) + return super()._element_constructor_(mu) + class KleshchevPartitions_all(KleshchevPartitions): r""" @@ -1446,7 +1448,7 @@ def __init__(self, e, multicharge, convention): else: self.Element = KleshchevPartitionTupleCrystal - super(KleshchevPartitions_all, self).__init__(category=cat) + super().__init__(category=cat) self._e = e # for printing self._index_set = IntegerModRing(e) self._multicharge = multicharge @@ -1673,7 +1675,7 @@ def __init__(self, e, multicharge=(0,), size=0, convention='RS'): self._element_constructor_ = getattr_from_other_class(self, Partitions, '_element_constructor_') else: self.Element = KleshchevPartitionTuple - super(KleshchevPartitions_size, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self._size = size # As lists do not take negative indices the case e=0 needs to be handled # differently. Rather than doing this we set e equal to a "really big" diff --git a/src/sage/combinat/partition_tuple.py b/src/sage/combinat/partition_tuple.py index b4f54624d2f..90fbb6e6866 100644 --- a/src/sage/combinat/partition_tuple.py +++ b/src/sage/combinat/partition_tuple.py @@ -2076,7 +2076,7 @@ def __init__(self): sage: TestSuite( PartitionTuples() ).run() """ - super(PartitionTuples_all, self).__init__(category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) def _repr_(self): r""" @@ -2156,7 +2156,7 @@ def __init__(self, level, category=None): raise ValueError('level must be a non-negative integer') if category is None: category = InfiniteEnumeratedSets() - super(PartitionTuples_level, self).__init__(category=category) + super().__init__(category=category) self._level = level def _repr_(self): @@ -2259,8 +2259,8 @@ def __init__(self, size): """ if size not in NN: raise ValueError('size must be a non-negative integer') - super(PartitionTuples_size, self).__init__(category=InfiniteEnumeratedSets()) - self._size=size + super().__init__(category=InfiniteEnumeratedSets()) + self._size = size def _repr_(self): """ @@ -2361,9 +2361,9 @@ def __init__(self, level, size): """ if not (level in NN and size in NN): raise ValueError('n and level must be non-negative integers') - super(PartitionTuples_level_size, self).__init__(category=FiniteEnumeratedSets()) - self._level=level - self._size=size + super().__init__(category=FiniteEnumeratedSets()) + self._level = level + self._size = size def _repr_(self): """ @@ -2503,7 +2503,7 @@ def __setstate__(self, state): self.__class__=parts.__class__ self.__dict__=parts.__dict__ else: - super(PartitionTuples, self).__setstate__(state) + super().__setstate__(state) ############################################################################### # Regular partition tuples diff --git a/src/sage/combinat/path_tableaux/__init__.py b/src/sage/combinat/path_tableaux/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/path_tableaux/__init__.py +++ b/src/sage/combinat/path_tableaux/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/path_tableaux/dyck_path.py b/src/sage/combinat/path_tableaux/dyck_path.py index 50dbebe2839..26501ec6cc7 100644 --- a/src/sage/combinat/path_tableaux/dyck_path.py +++ b/src/sage/combinat/path_tableaux/dyck_path.py @@ -375,4 +375,3 @@ def _an_element_(self): return DyckPath([0,1,2,1,0]) Element = DyckPath - diff --git a/src/sage/combinat/path_tableaux/path_tableau.py b/src/sage/combinat/path_tableaux/path_tableau.py index 691882350c2..611f9d31310 100644 --- a/src/sage/combinat/path_tableaux/path_tableau.py +++ b/src/sage/combinat/path_tableaux/path_tableau.py @@ -722,4 +722,3 @@ def pp(self): max_width = max(max(len(x) for x in row) for row in data if row) print('\n'.join(' '.join(' '*(max_width-len(x)) + x for x in row) for row in data)) - diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 8eae4b7c84c..7fbcbff6f94 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -5611,7 +5611,7 @@ def __classcall_private__(cls, mset): sage: S1 is S2 True """ - return super(Permutations_mset, cls).__classcall__(cls, tuple(mset)) + return super().__classcall__(cls, tuple(mset)) def __init__(self, mset): """ @@ -5971,7 +5971,7 @@ def __classcall_private__(cls, s): sage: S1 is S2 True """ - return super(Permutations_set, cls).__classcall__(cls, tuple(s)) + return super().__classcall__(cls, tuple(s)) def __init__(self, s): """ @@ -6097,7 +6097,7 @@ def __classcall__(cls, mset, k): sage: S1 is S2 True """ - return super(Permutations_msetk, cls).__classcall__(cls, tuple(mset), k) + return super().__classcall__(cls, tuple(mset), k) def __init__(self, mset, k): """ @@ -6188,7 +6188,7 @@ def __classcall_private__(cls, s, k): sage: S1 is S2 True """ - return super(Permutations_setk, cls).__classcall__(cls, tuple(s), k) + return super().__classcall__(cls, tuple(s), k) def __init__(self, s, k): """ @@ -6604,7 +6604,7 @@ def _coerce_map_from_(self, G): return self._from_permutation_group_element if isinstance(G, StandardPermutations_n) and G.n <= self.n: return True - return super(StandardPermutations_n, self)._coerce_map_from_(G) + return super()._coerce_map_from_(G) def _from_permutation_group_element(self, x): """ @@ -7619,7 +7619,7 @@ def __classcall_private__(cls, d, n): sage: P1 is P2 True """ - return super(StandardPermutations_descents, cls).__classcall__(cls, tuple(sorted(d)), n) + return super().__classcall__(cls, tuple(sorted(d)), n) def __init__(self, d, n): r""" @@ -7845,7 +7845,7 @@ def __classcall_private__(cls, recoils): sage: S1 is S2 True """ - return super(StandardPermutations_recoilsfiner, cls).__classcall__(cls, Composition(recoils)) + return super().__classcall__(cls, Composition(recoils)) def __init__(self, recoils): """ @@ -7912,7 +7912,7 @@ def __classcall_private__(cls, recoils): sage: S1 is S2 True """ - return super(StandardPermutations_recoilsfatter, cls).__classcall__(cls, Composition(recoils)) + return super().__classcall__(cls, Composition(recoils)) def __init__(self, recoils): """ @@ -7986,7 +7986,7 @@ def __classcall_private__(cls, recoils): sage: S1 is S2 True """ - return super(StandardPermutations_recoils, cls).__classcall__(cls, Composition(recoils)) + return super().__classcall__(cls, Composition(recoils)) def __init__(self, recoils): """ @@ -8137,7 +8137,7 @@ def __classcall_private__(cls, p): sage: S1 is S2 True """ - return super(StandardPermutations_bruhat_smaller, cls).__classcall__(cls, Permutation(p)) + return super().__classcall__(cls, Permutation(p)) def __init__(self, p): """ @@ -8195,7 +8195,7 @@ def __classcall_private__(cls, p): sage: S1 is S2 True """ - return super(StandardPermutations_bruhat_greater, cls).__classcall__(cls, Permutation(p)) + return super().__classcall__(cls, Permutation(p)) def __init__(self, p): """ @@ -8412,7 +8412,7 @@ def __classcall_private__(cls, mset): Cyclic permutations of [1, 2, 3, 3] sage: TestSuite(CP).run() # not tested -- broken """ - return super(CyclicPermutations, cls).__classcall__(cls, tuple(mset)) + return super().__classcall__(cls, tuple(mset)) def _repr_(self): """ @@ -8527,7 +8527,7 @@ def __classcall_private__(cls, partition): True """ partition = tuple(map(tuple, partition)) - return super(CyclicPermutationsOfPartition, cls).__classcall__(cls, partition) + return super().__classcall__(cls, partition) def __init__(self, partition): """ @@ -8658,7 +8658,7 @@ def __classcall_private__(cls, a): True """ a = tuple(map(Permutation, a)) - return super(StandardPermutations_all_avoiding, cls).__classcall__(cls, a) + return super().__classcall__(cls, a) def __init__(self, a): """ @@ -8704,7 +8704,7 @@ def __contains__(self, x): sage: [2,1,3] in Permutations(avoiding=[]) True """ - if not super(StandardPermutations_all_avoiding, self).__contains__(x): + if not super().__contains__(x): return False x = Permutations()(x) return all(x.avoids(p) for p in self._a) @@ -8753,7 +8753,7 @@ def __classcall_private__(cls, n, a): True """ a = tuple(map(Permutation, a)) - return super(StandardPermutations_avoiding_generic, cls).__classcall__(cls, n, a) + return super().__classcall__(cls, n, a) def __init__(self, n, a): """ @@ -8810,7 +8810,7 @@ def __contains__(self, x): sage: [2,1,3] in Permutations(3, avoiding=[]) True """ - if not super(StandardPermutations_avoiding_generic, self).__contains__(x): + if not super().__contains__(x): return False x = Permutations()(x) return all(x.avoids(p) for p in self._a) @@ -8858,7 +8858,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[1, 2]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_12, self).__init__(n, (Permutations()([1, 2]),)) + super().__init__(n, (Permutations()([1, 2]),)) def __iter__(self): """ @@ -8889,7 +8889,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 1]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_21, self).__init__(n, (Permutations()([2, 1]),)) + super().__init__(n, (Permutations()([2, 1]),)) def __iter__(self): """ @@ -8920,7 +8920,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[1, 3, 2]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_132, self).__init__(n, (Permutations()([1, 3, 2]),)) + super().__init__(n, (Permutations()([1, 3, 2]),)) def cardinality(self): """ @@ -8992,7 +8992,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 1, 3]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_123, self).__init__(n, (Permutations()([1, 2, 3]),)) + super().__init__(n, (Permutations()([1, 2, 3]),)) def cardinality(self) -> Integer: """ @@ -9063,7 +9063,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[3, 2, 1]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_321, self).__init__(n, (Permutations()([3, 2, 1]),)) + super().__init__(n, (Permutations()([3, 2, 1]),)) def cardinality(self): """ @@ -9094,7 +9094,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 3, 1]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_231, self).__init__(n, (Permutations()([2, 3, 1]),)) + super().__init__(n, (Permutations()([2, 3, 1]),)) def cardinality(self): """ @@ -9126,7 +9126,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[3, 1, 2]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_312, self).__init__(n, (Permutations()([3, 1, 2]),)) + super().__init__(n, (Permutations()([3, 1, 2]),)) def cardinality(self): """ @@ -9158,7 +9158,7 @@ def __init__(self, n): sage: P = Permutations(3, avoiding=[2, 1, 3]) sage: TestSuite(P).run() """ - super(StandardPermutations_avoiding_213, self).__init__(n, (Permutations()([2, 1, 3]),)) + super().__init__(n, (Permutations()([2, 1, 3]),)) def cardinality(self): """ diff --git a/src/sage/combinat/recognizable_series.py b/src/sage/combinat/recognizable_series.py index 504fce7d808..808f5436e6e 100644 --- a/src/sage/combinat/recognizable_series.py +++ b/src/sage/combinat/recognizable_series.py @@ -901,7 +901,7 @@ def __bool__(self): return False return True - + def __hash__(self): r""" diff --git a/src/sage/combinat/ribbon.py b/src/sage/combinat/ribbon.py index 64f06fc801d..6c662f505c7 100644 --- a/src/sage/combinat/ribbon.py +++ b/src/sage/combinat/ribbon.py @@ -17,4 +17,3 @@ #***************************************************************************** from .ribbon_shaped_tableau import RibbonShapedTableau, StandardRibbonShapedTableaux - diff --git a/src/sage/combinat/rigged_configurations/bij_abstract_class.py b/src/sage/combinat/rigged_configurations/bij_abstract_class.py index 89c82a8224b..bbc3a4e5d04 100644 --- a/src/sage/combinat/rigged_configurations/bij_abstract_class.py +++ b/src/sage/combinat/rigged_configurations/bij_abstract_class.py @@ -214,7 +214,7 @@ def _update_vacancy_nums(self, a): sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[2,1]]) sage: from sage.combinat.rigged_configurations.bij_abstract_class import KRTToRCBijectionAbstract - sage: bijection = KRTToRCBijectionAbstract(KRT(pathlist=[[3,2]])) + sage: bijection = KRTToRCBijectionAbstract(KRT(pathlist=[[3,2]])) sage: bijection._update_vacancy_nums(2) """ # Check to make sure we have a valid index (currently removed) @@ -542,4 +542,3 @@ def _next_index(self, r): 1 """ return r - 1 - diff --git a/src/sage/combinat/rigged_configurations/bij_infinity.py b/src/sage/combinat/rigged_configurations/bij_infinity.py index 7717c8691a2..4c675135019 100644 --- a/src/sage/combinat/rigged_configurations/bij_infinity.py +++ b/src/sage/combinat/rigged_configurations/bij_infinity.py @@ -359,4 +359,3 @@ def run(self): self.cur_dims.pop(0) # Pop off the leading column return ret_crystal_path - diff --git a/src/sage/combinat/rigged_configurations/bij_type_A.py b/src/sage/combinat/rigged_configurations/bij_type_A.py index 78de0dfa555..0a7070297db 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A.py @@ -157,4 +157,3 @@ def next_state(self, height): self.cur_partitions[n - 1].rigging[row_num] = self.cur_partitions[n - 1].vacancy_numbers[row_num] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py b/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py index 57a17f31e83..8f41efa6474 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py @@ -332,4 +332,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[row_num_bar_next] = self.cur_partitions[n-1].vacancy_numbers[row_num_bar_next] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_even.py b/src/sage/combinat/rigged_configurations/bij_type_A2_even.py index be1cd2c4cd3..7253b9b6579 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_even.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_even.py @@ -90,7 +90,7 @@ def next_state(self, val): for a in range(pos_val - 1, n): max_width = self.ret_rig_con[a].insert_cell(max_width) case_S[a] = max_width - + # Special case for n self._insert_cell_case_S(self.ret_rig_con[n-1]) diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py b/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py index 34707d7b424..753c2a99c74 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py @@ -193,4 +193,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[ret_row_next] = self.cur_partitions[n-1].vacancy_numbers[ret_row_next] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_B.py b/src/sage/combinat/rigged_configurations/bij_type_B.py index eef6dede629..c73d2a41483 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_B.py +++ b/src/sage/combinat/rigged_configurations/bij_type_B.py @@ -590,7 +590,7 @@ def run(self, verbose=False, build_graph=False): from sage.combinat.rigged_configurations.bij_type_A2_odd import RCToKRTBijectionTypeA2Odd from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations from sage.combinat.rigged_configurations.rigged_partition import RiggedPartition, RiggedPartitionTypeB - + # Convert to a type A_{2n-1}^{(2)} RC RC = RiggedConfigurations(['A', 2*self.n-1, 2], self.cur_dims) if verbose: @@ -868,7 +868,7 @@ def next_state(self, height): else: row_num_next = None row_num_bar_next = None - + self._update_vacancy_numbers(n - 2) if row_num is not None: self.cur_partitions[n-2].rigging[row_num] = self.cur_partitions[n-2].vacancy_numbers[row_num] @@ -892,4 +892,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[j-1] = vac_num - 1 return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_D.py b/src/sage/combinat/rigged_configurations/bij_type_D.py index 8cdd0d33edb..b45ec097ed0 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D.py @@ -508,7 +508,7 @@ def run(self, verbose=False, build_graph=False): self.cur_dims[0][0] -= 1 # This takes care of the indexing b = self.next_state(self.cur_dims[0][0]) - + # Corrections for spinor if dim[0] == self.n and b == -self.n \ and self.cur_dims[0][0] == self.n - 1: @@ -766,4 +766,3 @@ def _correct_vacancy_nums(self): n = self.n for i in range(len(self.cur_partitions[n-1]._list)): self.cur_partitions[n-1].vacancy_numbers[i] += 1 - diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_tri.py b/src/sage/combinat/rigged_configurations/bij_type_D_tri.py index dda29c33373..55159ab4f48 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_tri.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_tri.py @@ -384,4 +384,3 @@ def next_state(self, height): P.rigging[j-1] = vac_num - 1 return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py index 96e32e0664e..78ba3d4a071 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py @@ -568,4 +568,3 @@ def next_state(self, height): self.cur_partitions[n-1].rigging[row_num_bar_next] = self.cur_partitions[n-1].vacancy_numbers[row_num_bar_next] return(b) - diff --git a/src/sage/combinat/rigged_configurations/bij_type_E67.py b/src/sage/combinat/rigged_configurations/bij_type_E67.py index d9d635540e6..c0ebd5735cb 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_E67.py +++ b/src/sage/combinat/rigged_configurations/bij_type_E67.py @@ -392,4 +392,3 @@ def endpoint7(r): return C((-7, 6)) elif r == 7: return C.module_generators[0] # C((7,)) - diff --git a/src/sage/combinat/rigged_configurations/bijection.py b/src/sage/combinat/rigged_configurations/bijection.py index 3815407c980..56fcbb98394 100644 --- a/src/sage/combinat/rigged_configurations/bijection.py +++ b/src/sage/combinat/rigged_configurations/bijection.py @@ -137,4 +137,3 @@ def RCToKRTBijection(rigged_configuration_elt): if typ == 'G': # D_4^{(3)} return RCToKRTBijectionTypeDTri(rigged_configuration_elt) raise NotImplementedError - diff --git a/src/sage/combinat/rigged_configurations/kleber_tree.py b/src/sage/combinat/rigged_configurations/kleber_tree.py index 4d9c040c834..df5db0f5fe8 100644 --- a/src/sage/combinat/rigged_configurations/kleber_tree.py +++ b/src/sage/combinat/rigged_configurations/kleber_tree.py @@ -1470,4 +1470,3 @@ def depth_first_iter(self, all_nodes=False): Kleber tree node with weight [0, 0, 0] and upwards edge root [1, 2, 1] """ return KleberTree.depth_first_iter(self) - diff --git a/src/sage/combinat/rigged_configurations/kr_tableaux.py b/src/sage/combinat/rigged_configurations/kr_tableaux.py index 821389b7d83..5c79e0807ef 100644 --- a/src/sage/combinat/rigged_configurations/kr_tableaux.py +++ b/src/sage/combinat/rigged_configurations/kr_tableaux.py @@ -1876,4 +1876,3 @@ def _tableau_height(self): return len(self.module_generators[0]) // self._s Element = KRTableauxTypeFromRCElement - diff --git a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py index 6c3c897a1b4..4ef6be9811c 100644 --- a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py +++ b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py @@ -2406,4 +2406,3 @@ def cocharge(self): return cc / ZZ(2) + rigging_sum cc = cocharge - diff --git a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py index 7658ddd0d28..87e8d0c97d0 100644 --- a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +++ b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py @@ -424,4 +424,3 @@ def to_tensor_product_of_kirillov_reshetikhin_crystals(self): """ TP = self.parent().tensor_product_of_kirillov_reshetikhin_crystals() return TP(*[x.to_kirillov_reshetikhin_crystal() for x in self]) - diff --git a/src/sage/combinat/root_system/all.py b/src/sage/combinat/root_system/all.py index 622eb87b309..e49d72ea222 100644 --- a/src/sage/combinat/root_system/all.py +++ b/src/sage/combinat/root_system/all.py @@ -141,4 +141,3 @@ lazy_import('sage.combinat.root_system.non_symmetric_macdonald_polynomials', 'NonSymmetricMacdonaldPolynomials') lazy_import('sage.combinat.root_system.integrable_representations', 'IntegrableRepresentation') - diff --git a/src/sage/combinat/root_system/ambient_space.py b/src/sage/combinat/root_system/ambient_space.py index c55646e94ce..b1499f4eb4d 100644 --- a/src/sage/combinat/root_system/ambient_space.py +++ b/src/sage/combinat/root_system/ambient_space.py @@ -507,4 +507,3 @@ def to_ambient(self): return self AmbientSpace.Element = AmbientSpaceElement - diff --git a/src/sage/combinat/root_system/associahedron.py b/src/sage/combinat/root_system/associahedron.py index 565b5d8581a..66b134a35e7 100644 --- a/src/sage/combinat/root_system/associahedron.py +++ b/src/sage/combinat/root_system/associahedron.py @@ -189,7 +189,7 @@ def __new__(typ, parent=None, Vrep=None, Hrep=None, cartan_type=None, **kwds): if cartan_type or (parent is None and Vrep is None and Hrep is None): # Called from element constructor in ``Associahedron_base``. # Alternatively called from ``loads`` in ``loads(dumps(...))``. - return super(Associahedron_class_base, typ).__new__(typ, parent, Vrep, Hrep, **kwds) + return super().__new__(typ, parent, Vrep, Hrep, **kwds) else: # Not called from element constructor in ``Associahedron_base``. # Return a polyhedron with proper backend (not an associahedron). @@ -214,7 +214,7 @@ def __init__(self, parent, Vrep, Hrep, cartan_type=None, **kwds): """ if cartan_type: self._cartan_type = cartan_type - super(Associahedron_class_base, self).__init__(parent, Vrep, Hrep, **kwds) + super().__init__(parent, Vrep, Hrep, **kwds) else: raise ValueError("associahedron must be initialized with cartan type") @@ -375,7 +375,7 @@ def _element_constructor_(self, cartan_type, **kwds): c = rhocheck.coefficient(orbit[0].leading_support()) for beta in orbit: inequalities.append([c] + [beta.coefficient(i) for i in I]) - associahedron = super(Associahedra_base, self)._element_constructor_(None, [inequalities, []], cartan_type=cartan_type) + associahedron = super()._element_constructor_(None, [inequalities, []], cartan_type=cartan_type) return associahedron def _coerce_map_from_(self, X): @@ -416,7 +416,7 @@ def _coerce_map_from_(self, X): """ if not isinstance(X, Associahedra_base): return False - return super(Associahedra_base, self)._coerce_map_from_(X) + return super()._coerce_map_from_(X) def _pushout_(self, other): r""" @@ -441,8 +441,8 @@ def _pushout_(self, other): return Polyhedra(QQ, self.ambient_dim(), self.backend()) # Call the overwritten pushout in case it exists. - if hasattr(super(Associahedra_base, self), '_pushout_'): - return super(Associahedra_base, self)._pushout_(other) + if hasattr(super(), '_pushout_'): + return super()._pushout_(other) class Associahedra_ppl(Associahedra_base, Polyhedra_QQ_ppl): Element = Associahedron_class_ppl diff --git a/src/sage/combinat/root_system/cartan_matrix.py b/src/sage/combinat/root_system/cartan_matrix.py index ed56efa197c..8030a093066 100644 --- a/src/sage/combinat/root_system/cartan_matrix.py +++ b/src/sage/combinat/root_system/cartan_matrix.py @@ -1164,4 +1164,3 @@ def find_cartan_type_from_matrix(CM): return None return CartanType(types) - diff --git a/src/sage/combinat/root_system/coxeter_type.py b/src/sage/combinat/root_system/coxeter_type.py index 5130d33ad8f..a8062d15c2f 100644 --- a/src/sage/combinat/root_system/coxeter_type.py +++ b/src/sage/combinat/root_system/coxeter_type.py @@ -669,4 +669,3 @@ def relabel(self, relabelling): Coxeter type of ['A', 2] relabelled by {1: -1, 2: -2} """ return CoxeterType(self._cartan_type.relabel(relabelling)) - diff --git a/src/sage/combinat/root_system/extended_affine_weyl_group.py b/src/sage/combinat/root_system/extended_affine_weyl_group.py index a2866253194..bd02024afc6 100644 --- a/src/sage/combinat/root_system/extended_affine_weyl_group.py +++ b/src/sage/combinat/root_system/extended_affine_weyl_group.py @@ -1984,7 +1984,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).PW0()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Multiplicative form of Weight lattice of the Root system of type ['C', 2] acted upon by Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice)" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupPW0, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_translation(self, la): r""" @@ -2163,7 +2163,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).W0P()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice) acting on Multiplicative form of Weight lattice of the Root system of type ['C', 2]" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupW0P, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def S0(self): r""" @@ -2356,7 +2356,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).WF()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Weyl Group of type ['BC', 2, 2] (as a matrix group acting on the root lattice) acted upon by Fundamental group of type ['BC', 2, 2]" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupWF, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_affine_weyl(self, w): r""" @@ -2512,7 +2512,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).FW()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Fundamental group of type ['BC', 2, 2] acting on Weyl Group of type ['BC', 2, 2] (as a matrix group acting on the root lattice)" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupFW, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() @cached_method def simple_reflections(self): @@ -2682,7 +2682,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).PvW0()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Multiplicative form of Weight lattice of the Root system of type ['C', 2] acted upon by Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice)" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupPvW0, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_dual_translation(self, la): r""" @@ -2847,7 +2847,7 @@ def _repr_(self): sage: ExtendedAffineWeylGroup(['A',4,2]).W0Pv()._repr_() "Extended affine Weyl group of type ['BC', 2, 2] realized by Semidirect product of Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice) acting on Multiplicative form of Weight lattice of the Root system of type ['C', 2]" """ - return self.realization_of()._repr_() + " realized by " + super(ExtendedAffineWeylGroup_Class.ExtendedAffineWeylGroupW0Pv, self)._repr_() + return self.realization_of()._repr_() + " realized by " + super()._repr_() def from_dual_translation(self, la): r""" diff --git a/src/sage/combinat/root_system/fusion_ring.py b/src/sage/combinat/root_system/fusion_ring.py index 315fc98e8c5..b261550db21 100644 --- a/src/sage/combinat/root_system/fusion_ring.py +++ b/src/sage/combinat/root_system/fusion_ring.py @@ -117,7 +117,7 @@ class FusionRing(WeylCharacterRing): The fusion ring has a number of methods that reflect its role as the Grothendieck ring of a *modular tensor category* (MTC). These include twist methods :meth:`Element.twist` and :meth:`Element.ribbon` - for its elements related to the ribbon structure, and the + for its elements related to the ribbon structure, and the S-matrix :meth:`s_ij`. There are two natural normalizations of the S-matrix. Both @@ -129,7 +129,7 @@ class FusionRing(WeylCharacterRing): The unitary S-matrix is `s=D^{-1/2}\tilde{s}` where .. MATH:: - + D = \sum_V d_i(V)^2. The sum is over all simple objects `V` with @@ -547,7 +547,7 @@ def virasoro_central_charge(self): field theory associated with the Fusion Ring. If `\mathfrak{g}` is the corresponding semisimple Lie algebra, this is - + .. MATH:: \frac{k\dim\mathfrak{g}}{k+h^\vee}, @@ -562,7 +562,7 @@ def virasoro_central_charge(self): is computed in :meth:`D_plus` and `D = \sum d_i^2 > 0` is computed by :meth:`global_q_dimension`. Squaring this identity and remembering that `D_+ D_- = D` gives - + .. MATH:: D_+ / D_- = e^{i\pi c/2}. @@ -707,7 +707,7 @@ def s_matrix(self, unitary=False): - ``unitary`` -- (default: ``False``) set to ``True`` to obtain the unitary S-matrix - Without the ``unitary`` parameter, this is the matrix denoted + Without the ``unitary`` parameter, this is the matrix denoted `\widetilde{s}` in [BaKi2001]_. EXAMPLES:: @@ -735,14 +735,14 @@ def s_matrix(self, unitary=False): return S / self.total_q_order() else: return S - + @cached_method def r_matrix(self, i, j, k): r""" Return the R-matrix entry corresponding to the subobject ``k`` in the tensor product of ``i`` with ``j``. - .. WARNING:: + .. WARNING:: This method only gives complete information when `N_{ij}^k = 1` (an important special case). Tables of MTC including R-matrices @@ -757,7 +757,7 @@ def r_matrix(self, i, j, k): R-matrix. This method computes that scalar. It is possible to adjust the set of embeddings `k \rightarrow i \otimes j` (called a *gauge*) so that this scalar equals - + .. MATH:: \pm \sqrt{\frac{ \theta_k }{ \theta_i \theta_j }}. @@ -906,7 +906,7 @@ def weight(self): def twist(self, reduced=True): r""" - Return a rational number `h` such that `\theta = e^{i \pi h}` + Return a rational number `h` such that `\theta = e^{i \pi h}` is the twist of ``self``. The quantity `e^{i \pi h}` is also available using :meth:`ribbon`. @@ -915,7 +915,7 @@ def twist(self, reduced=True): `h = \langle \lambda, \lambda+2\rho \rangle`, where `\rho` is half the sum of the positive roots. As in [Row2006]_, this requires normalizing - the invariant bilinear form so that + the invariant bilinear form so that `\langle \alpha, \alpha \rangle = 2` for short roots. INPUT: diff --git a/src/sage/combinat/root_system/integrable_representations.py b/src/sage/combinat/root_system/integrable_representations.py index 691718b46da..e17e6b3c7fe 100644 --- a/src/sage/combinat/root_system/integrable_representations.py +++ b/src/sage/combinat/root_system/integrable_representations.py @@ -42,8 +42,8 @@ class IntegrableRepresentation(UniqueRepresentation, CategoryObject): .. [KacPeterson] Kac and Peterson. *Infinite-dimensional Lie algebras, theta functions and modular forms*. Adv. in Math. 53 (1984), no. 2, 125-264. - - .. [Carter] Carter, *Lie algebras of finite and affine type*. Cambridge + + .. [Carter] Carter, *Lie algebras of finite and affine type*. Cambridge University Press, 2005 If `\Lambda` is a dominant integral weight for an affine root system, @@ -61,7 +61,7 @@ class IntegrableRepresentation(UniqueRepresentation, CategoryObject): lattice and `\rho` is the Weyl vector. Moreover if `m(\mu)>0` then `\mu\in\operatorname{supp}(V)` differs from `\Lambda` by an element of the root lattice ([Ka1990]_, Propositions 11.3 and 11.4). - + Let `\delta` be the nullroot, which is the lowest positive imaginary root. Then by [Ka1990]_, Proposition 11.3 or Corollary 11.9, for fixed `\mu` the function `m(\mu - k\delta)` is a monotone increasing function of @@ -150,9 +150,9 @@ class IntegrableRepresentation(UniqueRepresentation, CategoryObject): Lambda[0] + Lambda[2] - delta: 1 5 18 55 149 372 872 1941 4141 8523 17005 33019 2*Lambda[1] - delta: 1 4 15 44 122 304 721 1612 3469 7176 14414 28124 2*Lambda[2] - 2*delta: 2 7 26 72 194 467 1084 2367 5010 10191 20198 38907 - + Examples for twisted affine types:: - + sage: Lambda = RootSystem(["A",2,2]).weight_lattice(extended=True).fundamental_weights() sage: IntegrableRepresentation(Lambda[0]).strings() {Lambda[0]: [1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56]} @@ -421,7 +421,7 @@ def _inner_pq(self, pelt, qelt): mcp = pelt.monomial_coefficients() mcq = qelt.monomial_coefficients() zero = ZZ.zero() - return sum(mcp.get(i, zero) * mcq[i] / self._eps[i] for i in mcq) + return sum(mcp.get(i, zero) * mcq[i] / self._eps[i] for i in mcq) def _inner_pp(self, pelt1, pelt2): """ @@ -616,7 +616,7 @@ def _freudenthal_roots_imaginary(self, nu): EXAMPLES:: sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights() - sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3]) + sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3]) sage: [list(V._freudenthal_roots_imaginary(V.highest_weight() - mw)) ....: for mw in V.dominant_maximal_weights()] [[], [], [], [], []] @@ -631,10 +631,10 @@ def _freudenthal_roots_real(self, nu): r""" Iterate over the set of real positive roots `\alpha \in \Delta^+` in ``self`` such that `\nu - \alpha \in Q^+`. - + See [Ka1990]_ Proposition 6.3 for the way to compute the set of real roots for twisted affine case. - + INPUT: - ``nu`` -- an element in `Q` @@ -686,7 +686,7 @@ def _freudenthal_roots_real(self, nu): if rt not in ret: ret.add(rt) yield rt - + elif self._cartan_type.dual().type() == 'G': # case D^3_4 in the Kac notation for al in self._classical_roots: @@ -746,11 +746,11 @@ def _m_freudenthal(self, n): Compute the weight multiplicity using the Freudenthal multiplicity formula in ``self``. - The multiplicities of the imaginary roots for the twisted + The multiplicities of the imaginary roots for the twisted affine case are different than those for the untwisted case. See [Carter]_ Corollary 18.10 for general type and Corollary 18.15 for `A^2_{2l}` - + EXAMPLES:: sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights() @@ -798,7 +798,7 @@ def _m_freudenthal(self, n): # k-th element (starting from 1) is k*delta num += (4 - 2*val) * self._freudenthal_accum(mu, rt) val = 1 - val - + elif self._cartan_type.dual().type() == 'G': # D_4^{(3)} (or dual of G_2^{(1)}) for k,rt in enumerate(self._freudenthal_roots_imaginary(self._Lam - mu)): # k-th element (starting from 1) is k*delta @@ -819,7 +819,7 @@ def m(self, n): `\mu = \Lambda - \sum_i n_i \alpha_i`. INPUT: - + - ``n`` -- a tuple representing a weight `\mu`. EXAMPLES:: @@ -1115,7 +1115,7 @@ def branch(self, i=None, weyl_character_ring=None, sequence=None, depth=5): | | O---O=>=O - 1 2 3 + 1 2 3 B3~ In this example, we observe that removing the `i=2` node from the @@ -1142,14 +1142,14 @@ def branch(self, i=None, weyl_character_ring=None, sequence=None, depth=5): sage: V = IntegrableRepresentation(Lambda[0]) sage: V.cartan_type().dynkin_diagram() O---O---O=>=O---O - 0 1 2 3 4 + 0 1 2 3 4 F4~ sage: A1xC3=WeylCharacterRing("A1xC3",style="coroots") sage: A1xC3.dynkin_diagram() O - 1 + 1 O---O=<=O - 2 3 4 + 2 3 4 A1xC3 Observe that removing the `i=1` node from the ``F4~`` Dynkin diagram @@ -1219,4 +1219,3 @@ def next_level(x): ldict[contr] = x[1] ret.append(weyl_character_ring.char_from_weights(ldict)) return ret - diff --git a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py index cbece412f13..2e52b7fd7ee 100644 --- a/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +++ b/src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py @@ -355,7 +355,7 @@ class NonSymmetricMacdonaldPolynomials(CherednikOperatorsEigenvectors): .. [LNSSS12] \C. Lenart, S. Naito, D. Sagaki, A. Schilling, M. Shimozono, A uniform model for Kirillov-Reshetikhin crystals I: Lifting - the parabolic quantum Bruhat graph, preprint :arXiv:`1211.2042` + the parabolic quantum Bruhat graph, preprint :arxiv:`1211.2042` [math.QA] .. RUBRIC:: More examples @@ -1817,4 +1817,3 @@ def symmetric_macdonald_polynomial(self, mu): Torbit[c] = v * self._T.Tw([i])(Torbit[c.simple_reflection(i)]) s = s + Torbit[c] return s - diff --git a/src/sage/combinat/root_system/root_lattice_realizations.py b/src/sage/combinat/root_system/root_lattice_realizations.py index 1cd87355792..766b7932cdb 100644 --- a/src/sage/combinat/root_system/root_lattice_realizations.py +++ b/src/sage/combinat/root_system/root_lattice_realizations.py @@ -4514,4 +4514,3 @@ def is_real_root(self): False """ return self.norm_squared() > 0 - diff --git a/src/sage/combinat/root_system/type_B.py b/src/sage/combinat/root_system/type_B.py index 23a6f993665..036d9778b2f 100644 --- a/src/sage/combinat/root_system/type_B.py +++ b/src/sage/combinat/root_system/type_B.py @@ -341,4 +341,3 @@ def _default_folded_cartan_type(self): # For unpickling backward compatibility (Sage <= 4.1) from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.combinat.root_system.type_B', 'ambient_space', AmbientSpace) - diff --git a/src/sage/combinat/root_system/type_BC_affine.py b/src/sage/combinat/root_system/type_BC_affine.py index 8665d908c6e..c3e0640617b 100644 --- a/src/sage/combinat/root_system/type_BC_affine.py +++ b/src/sage/combinat/root_system/type_BC_affine.py @@ -282,4 +282,3 @@ def _default_folded_cartan_type(self): n = self.n return CartanTypeFolded(self, ['A', 2*n - 1, 1], [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) - diff --git a/src/sage/combinat/root_system/type_B_affine.py b/src/sage/combinat/root_system/type_B_affine.py index f818660ec4e..3e356e8cfe8 100644 --- a/src/sage/combinat/root_system/type_B_affine.py +++ b/src/sage/combinat/root_system/type_B_affine.py @@ -210,4 +210,3 @@ def _default_folded_cartan_type(self): return CartanTypeFolded(self, ['A', 1, 1], [[0], [1]]) return CartanTypeFolded(self, ['D', n + 1, 1], [[i] for i in range(n)] + [[n, n+1]]) - diff --git a/src/sage/combinat/root_system/type_C_affine.py b/src/sage/combinat/root_system/type_C_affine.py index 58d90c5961e..087a73029e5 100644 --- a/src/sage/combinat/root_system/type_C_affine.py +++ b/src/sage/combinat/root_system/type_C_affine.py @@ -181,4 +181,3 @@ def _default_folded_cartan_type(self): return CartanTypeFolded(self, ['A', 1, 1], [[0], [1]]) return CartanTypeFolded(self, ['A', 2*n-1, 1], [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) - diff --git a/src/sage/combinat/root_system/type_D_affine.py b/src/sage/combinat/root_system/type_D_affine.py index 03f45ab1fda..76d086f0a91 100644 --- a/src/sage/combinat/root_system/type_D_affine.py +++ b/src/sage/combinat/root_system/type_D_affine.py @@ -202,4 +202,3 @@ def ascii_art(self, label=lambda i: i, node=None): ret += "---".join(node(label(i)) for i in range(1, n)) ret += '\n' + "".join("{!s:4}".format(label(i)) for i in range(1,n)) return ret - diff --git a/src/sage/combinat/root_system/type_F_affine.py b/src/sage/combinat/root_system/type_F_affine.py index edb6a4ac3ad..5a4aeb7d5f7 100644 --- a/src/sage/combinat/root_system/type_F_affine.py +++ b/src/sage/combinat/root_system/type_F_affine.py @@ -129,4 +129,3 @@ def _default_folded_cartan_type(self): """ from sage.combinat.root_system.type_folded import CartanTypeFolded return CartanTypeFolded(self, ['E', 6, 1], [[0], [2], [4], [3, 5], [1, 6]]) - diff --git a/src/sage/combinat/root_system/type_G_affine.py b/src/sage/combinat/root_system/type_G_affine.py index b503edd34a7..b0043e7370d 100644 --- a/src/sage/combinat/root_system/type_G_affine.py +++ b/src/sage/combinat/root_system/type_G_affine.py @@ -124,4 +124,3 @@ def _default_folded_cartan_type(self): """ from sage.combinat.root_system.type_folded import CartanTypeFolded return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) - diff --git a/src/sage/combinat/root_system/type_H.py b/src/sage/combinat/root_system/type_H.py index 776a92c7ebb..f6989013971 100644 --- a/src/sage/combinat/root_system/type_H.py +++ b/src/sage/combinat/root_system/type_H.py @@ -100,4 +100,3 @@ def coxeter_number(self): if self.n == 3: return 10 return 30 - diff --git a/src/sage/combinat/root_system/type_I.py b/src/sage/combinat/root_system/type_I.py index 617782f06cb..8bb3f1f6895 100644 --- a/src/sage/combinat/root_system/type_I.py +++ b/src/sage/combinat/root_system/type_I.py @@ -105,4 +105,3 @@ def coxeter_number(self): 12 """ return self.n - diff --git a/src/sage/combinat/root_system/type_dual.py b/src/sage/combinat/root_system/type_dual.py index 2d472435dd8..3c9e48397fe 100644 --- a/src/sage/combinat/root_system/type_dual.py +++ b/src/sage/combinat/root_system/type_dual.py @@ -272,7 +272,7 @@ def ascii_art(self, label=lambda i: i, node=None): def __eq__(self, other): """ Return whether ``self`` is equal to ``other``. - + EXAMPLES:: sage: B41 = CartanType(['B', 4, 1]) @@ -293,7 +293,7 @@ def __eq__(self, other): def __ne__(self, other): """ Return whether ``self`` is equal to ``other``. - + EXAMPLES:: sage: B41 = CartanType(['B', 4, 1]) @@ -692,4 +692,3 @@ def _default_folded_cartan_type(self): if letter == 'G': # D_4^{(3)} return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) return super(CartanType, self)._default_folded_cartan_type() - diff --git a/src/sage/combinat/root_system/type_folded.py b/src/sage/combinat/root_system/type_folded.py index 93891fc941a..9482ec494c4 100644 --- a/src/sage/combinat/root_system/type_folded.py +++ b/src/sage/combinat/root_system/type_folded.py @@ -296,4 +296,3 @@ def f(i): cmax = max(c) return Family(dict( (i, int(cmax / c[i])) for i in self._cartan_type.index_set() )) - diff --git a/src/sage/combinat/sf/__init__.py b/src/sage/combinat/sf/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/sf/__init__.py +++ b/src/sage/combinat/sf/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/sf/character.py b/src/sage/combinat/sf/character.py index ef899203813..e55f356f5d1 100644 --- a/src/sage/combinat/sf/character.py +++ b/src/sage/combinat/sf/character.py @@ -594,4 +594,3 @@ def _self_to_other_on_basis(self, lam): 3*s[1] - 2*s[1, 1] - 2*s[2] + s[2, 1] """ return self._other(self._self_to_power_on_basis(lam)) - diff --git a/src/sage/combinat/sf/dual.py b/src/sage/combinat/sf/dual.py index d801ccd3a18..677a8dcfd3f 100644 --- a/src/sage/combinat/sf/dual.py +++ b/src/sage/combinat/sf/dual.py @@ -893,4 +893,3 @@ def expand(self, n, alphabet='x'): # Backward compatibility for unpickling from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.combinat.sf.dual', 'SymmetricFunctionAlgebraElement_dual', SymmetricFunctionAlgebra_dual.Element) - diff --git a/src/sage/combinat/sf/k_dual.py b/src/sage/combinat/sf/k_dual.py index 8f910a796fb..7b557b25104 100644 --- a/src/sage/combinat/sf/k_dual.py +++ b/src/sage/combinat/sf/k_dual.py @@ -1467,4 +1467,3 @@ def _m_to_F_on_basis(self, la): h = kB.khomogeneous() ks = kB.kschur() return sum( h(ks(x)).coefficient(la) * self(x) for x in PartitionsGreatestLE(sum(la), self.k)) - diff --git a/src/sage/combinat/sf/kfpoly.py b/src/sage/combinat/sf/kfpoly.py index e4a92ad2663..cf465b3e8c4 100644 --- a/src/sage/combinat/sf/kfpoly.py +++ b/src/sage/combinat/sf/kfpoly.py @@ -393,4 +393,3 @@ def weight(rg, t=None): mu = nu[k-1][i] - mid[i] res *= t**int(mu * (mu-1) // 2) return res - diff --git a/src/sage/combinat/sf/macdonald.py b/src/sage/combinat/sf/macdonald.py index c797d7a0cd4..3bc4bdbfd5f 100644 --- a/src/sage/combinat/sf/macdonald.py +++ b/src/sage/combinat/sf/macdonald.py @@ -1180,7 +1180,7 @@ def _to_s(self, part): class Element(MacdonaldPolynomials_generic.Element): pass - + class MacdonaldPolynomials_h(MacdonaldPolynomials_generic): def __init__(self, macdonald): r""" @@ -1346,7 +1346,7 @@ def _m_to_self( self, f ): Convert an element ``f`` from the monomial basis to the ``H`` basis. This calculation is performed by using the fact that `H_\mu[X(1-t)]` - is `c_\mu m_\mu` plus terms which are smaller in dominance order. + is `c_\mu m_\mu` plus terms which are smaller in dominance order. The leading coefficient of the expansion of ``f`` in the `H_\mu` basis is equal to the leading coefficient of `c_\mu^{-1} f[X(1-t)]`. diff --git a/src/sage/combinat/sf/orthogonal.py b/src/sage/combinat/sf/orthogonal.py index 336ddb7c198..b0ed060ee85 100644 --- a/src/sage/combinat/sf/orthogonal.py +++ b/src/sage/combinat/sf/orthogonal.py @@ -242,4 +242,3 @@ def _s_to_o_on_basis(self, lam): for nu in Partitions(j) ) for j in range(n//2+1) # // 2 for horizontal dominoes for mu in Partitions(n-2*j) }) - diff --git a/src/sage/combinat/sf/sf.py b/src/sage/combinat/sf/sf.py index eff9d392605..b4418a40606 100644 --- a/src/sage/combinat/sf/sf.py +++ b/src/sage/combinat/sf/sf.py @@ -1613,4 +1613,3 @@ def __call__(self, partition): # will have an optional optimization for the case when there # is no repetition in the support return self._codomain._from_dict(dict(self._t(self.fake_sym.monomial(partition))), coerce = True) - diff --git a/src/sage/combinat/sf/symplectic.py b/src/sage/combinat/sf/symplectic.py index be615f2ddcb..bd5a44bd615 100644 --- a/src/sage/combinat/sf/symplectic.py +++ b/src/sage/combinat/sf/symplectic.py @@ -249,4 +249,3 @@ def _s_to_sp_on_basis(self, lam): for nu in Partitions(j) ) for j in range(n//2+1) # // 2 for vertical dominoes for mu in Partitions(n-2*j) }) - diff --git a/src/sage/combinat/sf/witt.py b/src/sage/combinat/sf/witt.py index fbc7979936b..58da090aec1 100644 --- a/src/sage/combinat/sf/witt.py +++ b/src/sage/combinat/sf/witt.py @@ -1334,5 +1334,3 @@ def verschiebung(self, n): if all( i % n == 0 for i in lam )} result_in_w_basis = parent._from_dict(dct) return parent(result_in_w_basis) - - diff --git a/src/sage/combinat/shifted_primed_tableau.py b/src/sage/combinat/shifted_primed_tableau.py index 5b8eb900ece..5d59921c629 100644 --- a/src/sage/combinat/shifted_primed_tableau.py +++ b/src/sage/combinat/shifted_primed_tableau.py @@ -2163,7 +2163,7 @@ def __classcall_private__(cls, shape, max_entry=None, skew=None, primed_diagonal True """ shape = _Partitions(shape) - return super(ShiftedPrimedTableaux_shape, cls).__classcall__(cls, + return super().__classcall__(cls, shape=shape, max_entry=max_entry, skew=skew, primed_diagonal=primed_diagonal) def __init__(self, shape, max_entry=None, skew=None, primed_diagonal=False): @@ -2253,7 +2253,7 @@ def _contains_tableau(self, T): ....: primed_diagonal=True)._contains_tableau(t) True """ - if not super(ShiftedPrimedTableaux_shape, self)._contains_tableau(T): + if not super()._contains_tableau(T): return False shape = [len(row) for row in T] @@ -2300,7 +2300,7 @@ def __iter__(self): 1504 """ if not self._primed_diagonal: - for T in super(ShiftedPrimedTableaux_shape, self).__iter__(): + for T in super().__iter__(): yield T return @@ -2433,7 +2433,7 @@ def _contains_tableau(self, T): sage: ShiftedPrimedTableaux(weight=(1,2))._contains_tableau(u) False """ - if not super(ShiftedPrimedTableaux_weight, self)._contains_tableau(T): + if not super()._contains_tableau(T): return False flat = [item.integer() for sublist in T for item in sublist] @@ -2566,7 +2566,7 @@ def _contains_tableau(self, T): sage: ShiftedPrimedTableaux([], weight=())._contains_tableau(u) True """ - if not super(ShiftedPrimedTableaux_weight_shape, self)._contains_tableau(T): + if not super()._contains_tableau(T): return False flat = [item.integer() for sublist in T for item in sublist] @@ -2727,4 +2727,3 @@ def _add_strip(sub_tab, full_tab, length): k=len(plat_list), outer=plat_list): yield list(primed_strip) + list(non_primed_strip) - diff --git a/src/sage/combinat/six_vertex_model.py b/src/sage/combinat/six_vertex_model.py index a310a84cb4b..936a7e95b52 100644 --- a/src/sage/combinat/six_vertex_model.py +++ b/src/sage/combinat/six_vertex_model.py @@ -776,4 +776,3 @@ def to_alternating_sign_matrix(self): #ASM = AlternatingSignMatrices(self.parent()._nrows) #return ASM(self.to_signed_matrix()) return AlternatingSignMatrix(self.to_signed_matrix()) - diff --git a/src/sage/combinat/species/__init__.py b/src/sage/combinat/species/__init__.py index 8b137891791..e69de29bb2d 100644 --- a/src/sage/combinat/species/__init__.py +++ b/src/sage/combinat/species/__init__.py @@ -1 +0,0 @@ - diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index 298bcd8ca94..02e1bb52332 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -1364,4 +1364,3 @@ def LogarithmCycleIndexSeries(R = RationalField()): """ CIS = CycleIndexSeriesRing(R) return CIS(_cl_gen(R)) - diff --git a/src/sage/combinat/symmetric_group_representations.py b/src/sage/combinat/symmetric_group_representations.py index b7f93ba5733..a27cd240733 100644 --- a/src/sage/combinat/symmetric_group_representations.py +++ b/src/sage/combinat/symmetric_group_representations.py @@ -1011,4 +1011,3 @@ def partition_to_vector_of_contents(partition, reverse=False): if reverse: return tuple(v)[::-1] return tuple(v) - diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 9d7e3cc2b41..834cfabe51d 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -4362,7 +4362,7 @@ def check(self): ... ValueError: expected entry to be a positive integer at (row=0, col=0). Found (0) """ - super(SemistandardTableau, self).check() + super().check() # Tableau() has checked that t is tableau, so it remains to check that # the entries of t are positive integers which are weakly increasing @@ -4487,7 +4487,7 @@ def check(self): ValueError: the entries in a row standard tableau must increase along rows and contain the numbers 1,2,...,n """ - super(RowStandardTableau, self).check() + super().check() # We have checked that t is tableau, so it remains to check that # the entries of t are positive integers that increase along rows. flatx = sorted(sum((list(row) for row in self), [])) @@ -4590,7 +4590,7 @@ def check(self): ... ValueError: the entries in each row of a semistandard tableau must be weakly increasing """ - super(StandardTableau, self).check() + super().check() # t is semistandard so we only need to check # that its entries are in bijection with {1, 2, ..., n} flattened_list = [i for row in self for i in row] @@ -5045,7 +5045,7 @@ def check(self): # Empty tableau, so trivially an increasing tableau return - super(IncreasingTableau, self).check() + super().check() # Tableau() has checked that t is tableau, so it remains to check that # the entries of t are positive integers which are weakly increasing @@ -5558,9 +5558,8 @@ def __init__(self): sage: T = sage.combinat.tableau.Tableaux_all() sage: TestSuite(T).run() - """ - super(Tableaux_all, self).__init__(category=Sets()) + super().__init__(category=Sets()) def _repr_(self): """ @@ -5601,7 +5600,7 @@ def __init__(self, n): sage: T = sage.combinat.tableau.Tableaux_size(0) sage: TestSuite(T).run() """ - super(Tableaux_size, self).__init__(category=Sets()) + super().__init__(category=Sets()) self.size = n def __contains__(self,x): @@ -6172,8 +6171,7 @@ def __init__(self, n): sage: T = sage.combinat.tableau.SemistandardTableaux_size_inf(3) sage: TestSuite(T).run() """ - super(SemistandardTableaux_size_inf, self).__init__( - category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -6275,8 +6273,7 @@ def __init__(self, p): sage: TestSuite(SST).run() """ - super(SemistandardTableaux_shape_inf, self).__init__( - category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -6371,8 +6368,8 @@ def __init__(self, n, max_entry=None): if max_entry is None: max_entry = n - super(SemistandardTableaux_size, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -6569,8 +6566,8 @@ def __init__(self, p, max_entry=None): """ if max_entry is None: max_entry = sum(p) - super(SemistandardTableaux_shape, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.shape = p def __iter__(self): @@ -6775,7 +6772,7 @@ def __init__(self, p, mu): sage: SST = SemistandardTableaux([2,1], [2,1]) sage: TestSuite(SST).run() """ - super(SemistandardTableaux_shape_weight, self).__init__(p, len(mu)) + super().__init__(p, len(mu)) self.weight = mu def _repr_(self): @@ -6889,8 +6886,8 @@ def __init__(self, n, mu): sage: SST = SemistandardTableaux(3, [2,1]) sage: TestSuite(SST).run() """ - super(SemistandardTableaux_size_weight, self).__init__(max_entry=len(mu), - category=FiniteEnumeratedSets()) + super().__init__(max_entry=len(mu), + category=FiniteEnumeratedSets()) self.size = n self.weight = mu @@ -7268,7 +7265,7 @@ def __init__(self, p): sage: TestSuite( RowStandardTableaux([2,1,1]) ).run() """ - super(RowStandardTableaux_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -7772,7 +7769,7 @@ def __init__(self, p): sage: TestSuite( StandardTableaux([2,1,1]) ).run() """ - super(StandardTableaux_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -8726,7 +8723,7 @@ def __init__(self, n): sage: T = IncreasingTableaux_size_inf(3) sage: TestSuite(T).run() """ - super(IncreasingTableaux_size_inf, self).__init__(category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -8807,7 +8804,7 @@ def __init__(self, p): sage: TestSuite(IT).run() """ - super(IncreasingTableaux_shape_inf, self).__init__(category=InfiniteEnumeratedSets()) + super().__init__(category=InfiniteEnumeratedSets()) self.shape = p def __contains__(self, x): @@ -8895,8 +8892,8 @@ def __init__(self, n, max_entry=None): """ if max_entry is None: max_entry = n - super(IncreasingTableaux_size, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.size = n def _repr_(self): @@ -9010,8 +9007,8 @@ def __init__(self, p, max_entry=None): """ if max_entry is None: max_entry = sum(p) - super(IncreasingTableaux_shape, self).__init__(max_entry=max_entry, - category=FiniteEnumeratedSets()) + super().__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) self.shape = p def __iter__(self): @@ -9123,7 +9120,7 @@ def __init__(self, p, wt): sage: IT = IncreasingTableaux([2,1], (1,0,1)) sage: TestSuite(IT).run() """ - super(IncreasingTableaux_shape_weight, self).__init__(p, len(wt)) + super().__init__(p, len(wt)) self.weight = wt def _repr_(self): @@ -9267,8 +9264,8 @@ def __init__(self, n, wt): sage: IT = IncreasingTableaux(3, (1,0,1)) sage: TestSuite(IT).run() """ - super(IncreasingTableaux_size_weight, self).__init__(max_entry=len(wt), - category=FiniteEnumeratedSets()) + super().__init__(max_entry=len(wt), + category=FiniteEnumeratedSets()) self.size = n self.weight = wt diff --git a/src/sage/combinat/tableau_tuple.py b/src/sage/combinat/tableau_tuple.py index f911ca60535..4425dcb4f27 100644 --- a/src/sage/combinat/tableau_tuple.py +++ b/src/sage/combinat/tableau_tuple.py @@ -1567,7 +1567,7 @@ def __init__(self, parent, t, check=True): except ValueError: raise ValueError('not a valid row standard tableau tuple') - super(RowStandardTableauTuple, self).__init__(parent, t) + super().__init__(parent, t) if check: # We still have to check that t is row standard. @@ -1940,7 +1940,7 @@ def __init__(self, parent, t, check=True): False """ # The check that ``t`` is valid tableau tuple is done by RowStandardTableauTuple - super(StandardTableauTuple, self).__init__(parent, t, check=check) + super().__init__(parent, t, check=check) # As StandardTableauTuple inherits from RowStandardTableauTuple t must # be row strict and contain 1,2,...,n once each, so we only need to @@ -2385,9 +2385,8 @@ def __init__(self): sage: TableauTuples() Tableau tuples - """ - super(TableauTuples_all, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._level = None self._size = None @@ -2430,7 +2429,7 @@ def __init__(self, level): sage: TableauTuples(level=4)( [[[1,2],[4]],[],[],[[4,5,6],[7,8]]] ) ([[1, 2], [4]], [], [], [[4, 5, 6], [7, 8]]) """ - super(TableauTuples_level, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._level = level def __contains__(self, t): @@ -2511,7 +2510,7 @@ def __init__(self, size): sage: TableauTuples(size=6) Tableau tuples of size 6 """ - super(TableauTuples_size, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._size = size def __contains__(self, t): @@ -2598,7 +2597,7 @@ def __init__(self, level, size): sage: TableauTuples(4,3) Tableau tuples of level 4 and size 3 """ - super(TableauTuples_level_size, self).__init__(category=Sets()) + super().__init__(category=Sets()) self._level = level self._size = size @@ -3357,7 +3356,7 @@ def __init__(self, shape): sage: STT.cardinality() 1260 """ - super(RowStandardTableauTuples_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) from sage.combinat.partition_tuple import PartitionTuple self._shape = PartitionTuple(shape) self._level = len(shape) @@ -3579,7 +3578,7 @@ def __init__(self, residue): sage: tabs = RowStandardTableauTuple([[[6],[7]],[[3,4,5],[1,2]]]).residue_sequence(2,(0,0)).row_standard_tableaux() sage: TestSuite(tabs).run() # long time """ - super(RowStandardTableauTuples_residue, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) self._residue = residue self._quantum_characteristic = residue.quantum_characteristic() self._multicharge = residue.multicharge() @@ -3822,7 +3821,7 @@ def __init__(self, residue, shape): if residue.size() != shape.size(): raise ValueError('the size of the shape and the length of the residue defence must coincide!') - super(RowStandardTableauTuples_residue_shape, self).__init__(residue) + super().__init__(residue) self._shape = shape # The _standard_tableaux attribute below is used to generate the @@ -4736,7 +4735,7 @@ def __init__(self, shape): sage: STT.cardinality() 210 """ - super(StandardTableauTuples_shape, self).__init__(category=FiniteEnumeratedSets()) + super().__init__(category=FiniteEnumeratedSets()) from sage.combinat.partition_tuple import PartitionTuple self._shape = PartitionTuple(shape) self._level = len(shape) @@ -5087,7 +5086,7 @@ def __init__(self, residue): sage: T = StandardTableauTuple([[[6],[7]],[[1,2,3],[4,5]]]).residue_sequence(2,(0,0)).standard_tableaux() sage: TestSuite(T).run() """ - super(StandardTableaux_residue, self).__init__(residue, category=FiniteEnumeratedSets()) + super().__init__(residue, category=FiniteEnumeratedSets()) self._level = residue.level() self._multicharge = residue.multicharge() self._quantum_characteristic = residue.quantum_characteristic() diff --git a/src/sage/combinat/words/infinite_word.py b/src/sage/combinat/words/infinite_word.py index db8f15d577e..8baae7c1c3c 100644 --- a/src/sage/combinat/words/infinite_word.py +++ b/src/sage/combinat/words/infinite_word.py @@ -110,4 +110,3 @@ def length(self): +Infinity """ return Infinity - diff --git a/src/sage/combinat/words/morphic.py b/src/sage/combinat/words/morphic.py index 1e1c8d7847c..f84a90f6bb5 100644 --- a/src/sage/combinat/words/morphic.py +++ b/src/sage/combinat/words/morphic.py @@ -360,5 +360,3 @@ def __iter__(self): w = chain([next_w], w, self._morphism.image(next_w)) except StopIteration: return - - diff --git a/src/sage/combinat/words/paths.py b/src/sage/combinat/words/paths.py index 2a847391252..8e73c2331a7 100644 --- a/src/sage/combinat/words/paths.py +++ b/src/sage/combinat/words/paths.py @@ -634,7 +634,7 @@ def __init__(self, alphabet): d = [(1 ,0), (0,1), (-1,0), (0,-1)] #Construction of the class - super(WordPaths_square_grid, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) @lazy_attribute def _element_classes(self): @@ -710,7 +710,7 @@ def __init__(self, alphabet): vector(K, (ZZ(1)/ZZ(2), -sqrt3/2 ))) #Construction of the class - super(WordPaths_triangle_grid, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_triangle_grid @@ -778,7 +778,7 @@ def __init__(self, alphabet): """ #Construction of the class - super(WordPaths_hexagonal_grid, self).__init__(alphabet) + super().__init__(alphabet) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_hexagonal_grid @@ -847,7 +847,7 @@ def __init__(self, alphabet): """ #Construction of the class d = [(1,0,0), (0,1,0), (0,0,1), (-1,0,0), (0,-1,0), (0,0,-1)] - super(WordPaths_cube_grid, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_cube_grid @@ -913,7 +913,7 @@ def __init__(self, alphabet): """ #Construction of the class d = [(1,1), (1,-1)] - super(WordPaths_dyck, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_dyck @@ -981,7 +981,7 @@ def __init__(self, alphabet): """ #Construction of the class d = [(0,1), (1,0)] - super(WordPaths_north_east, self).__init__(alphabet, steps=d) + super().__init__(alphabet, steps=d) self._infinite_word_class = None self._finite_word_class = FiniteWordPath_north_east @@ -2144,7 +2144,7 @@ def is_simple(self): pavages*, Thèse de doctorat en Mathématiques, Montréal, UQAM, septembre 2008, 115 pages. """ - return super(FiniteWordPath_square_grid,self).is_simple() + return super().is_simple() def tikz_trajectory(self): r""" @@ -2255,9 +2255,8 @@ def __init__(self, parent, *args, **kwds): sage: f == loads(dumps(f)) True - """ - super(FiniteWordPath_hexagonal_grid, self).__init__(parent, *args, **kwds) + super().__init__(parent, *args, **kwds) class FiniteWordPath_cube_grid(FiniteWordPath_3d): pass diff --git a/src/sage/combinat/words/word_datatypes.pyx b/src/sage/combinat/words/word_datatypes.pyx index 98d0df2616c..b39c1b2e925 100644 --- a/src/sage/combinat/words/word_datatypes.pyx +++ b/src/sage/combinat/words/word_datatypes.pyx @@ -269,7 +269,7 @@ cdef class WordDatatype_list(WordDatatype): if isinstance(other, WordDatatype_list): return self._parent(self._data + other._data) else: - return super(WordDatatype_list, self).__mul__(other) + return super().__mul__(other) __add__ = __mul__ @@ -486,7 +486,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(sub, str): return self._data.find(sub, start, end) else: - return super(WordDatatype_str, self).find(sub, start, end) + return super().find(sub, start, end) def rfind(self, sub, start=0, end=None): r""" @@ -524,7 +524,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(sub, str): return self._data.rfind(sub, start, end) else: - return super(WordDatatype_str, self).rfind(sub, start, end) + return super().rfind(sub, start, end) def __len__(self): r""" @@ -606,7 +606,7 @@ cdef class WordDatatype_str(WordDatatype): if isinstance(other, WordDatatype_str): return self._parent(self._data + other._data) else: - return super(WordDatatype_str, self).__mul__(other) + return super().__mul__(other) __add__ = __mul__ @@ -711,11 +711,10 @@ cdef class WordDatatype_str(WordDatatype): sep = sep._data else: raise ValueError("the separator must be a string") - if maxsplit is None: - return [self._parent(z) for z in self._data.split(sep)] - else: - return [self._parent(z) for z in self._data.split(sep, maxsplit)] + maxsplit = -1 + return [self._parent(z) for z in self._data.split(sep=sep, + maxsplit=maxsplit)] def partition(self, sep): r""" @@ -802,7 +801,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(other, str): return other.endswith(self._data) else: - return super(WordDatatype_str, self).is_suffix(other) + return super().is_suffix(other) def has_suffix(self, other): """ @@ -834,7 +833,7 @@ cdef class WordDatatype_str(WordDatatype): elif isinstance(other, str): return self._data.endswith(other) else: - return super(WordDatatype_str, self).has_suffix(other) + return super().has_suffix(other) def is_prefix(self, other): r""" @@ -875,7 +874,7 @@ cdef class WordDatatype_str(WordDatatype): if isinstance(other ,str): return other.startswith(self._data) else: - return super(WordDatatype_str, self).is_prefix(other) + return super().is_prefix(other) def has_prefix(self, other): r""" @@ -916,7 +915,7 @@ cdef class WordDatatype_str(WordDatatype): if isinstance(other, str): return self._data.startswith(other) else: - return super(WordDatatype_str, self).has_prefix(other) + return super().has_prefix(other) cdef class WordDatatype_tuple(WordDatatype): r""" @@ -1120,6 +1119,6 @@ cdef class WordDatatype_tuple(WordDatatype): if isinstance(other, WordDatatype_tuple): return self._parent(self._data + other._data) else: - return super(WordDatatype_tuple, self).__mul__(other) + return super().__mul__(other) __add__ = __mul__ diff --git a/src/sage/combinat/words/word_infinite_datatypes.py b/src/sage/combinat/words/word_infinite_datatypes.py index 95664b687af..90ab35efd84 100644 --- a/src/sage/combinat/words/word_infinite_datatypes.py +++ b/src/sage/combinat/words/word_infinite_datatypes.py @@ -346,7 +346,7 @@ def __init__(self, parent, callable, length=None): sage: w.length() +Infinity """ - super(WordDatatype_callable_with_caching,self).__init__(parent,callable,length) + super().__init__(parent, callable, length) # for caching self._letter_cache = {} @@ -515,11 +515,11 @@ def __getitem__(self, key): ValueError: for infinite words, start and stop values cannot be negative """ if isinstance(key, slice): - return super(WordDatatype_callable_with_caching, self).__getitem__(key) + return super().__getitem__(key) else: if key not in self._letter_cache: self._letter_cache[key] = \ - super(WordDatatype_callable_with_caching, self).__getitem__(key) + super().__getitem__(key) return self._letter_cache[key] def __reduce__(self): @@ -945,7 +945,7 @@ def __init__(self, parent, iter, length=None): sage: w._len 8 """ - super(WordDatatype_iter_with_caching,self).__init__(parent,iter,length) + super().__init__(parent, iter, length) # we use self._data for returning an iterator through __iter__; # we use self._gen for caching self._data, self._gen = itertools.tee(self._data) @@ -1158,10 +1158,10 @@ def __getitem__(self, key): ValueError: Step for islice() must be a positive integer or None. """ if isinstance(key, slice): - return super(WordDatatype_iter_with_caching,self).__getitem__(key) + return super().__getitem__(key) else: if key < 0: - return super(WordDatatype_iter_with_caching,self).__getitem__(key) + return super().__getitem__(key) else: while self._last_index < key: try: @@ -1214,4 +1214,3 @@ def flush(self): self._gen = iter(self) self._list = [] self._last_index = -1 - diff --git a/src/sage/crypto/lwe.py b/src/sage/crypto/lwe.py index 8224caf5da7..bc027e97362 100644 --- a/src/sage/crypto/lwe.py +++ b/src/sage/crypto/lwe.py @@ -274,7 +274,7 @@ def __init__(self, n, q, D, secret_dist='uniform', m=None): sage: from sage.crypto.lwe import LWE sage: lwe = LWE(n=20, q=next_prime(400), D=D); lwe - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0, 'uniform', None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000, 'uniform', None) and sample 1000 samples:: @@ -335,10 +335,10 @@ def _repr_(self): sage: from sage.crypto.lwe import LWE sage: D = DiscreteGaussianDistributionIntegerSampler(3.0) sage: lwe = LWE(n=20, q=next_prime(400), D=D); lwe - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0, 'uniform', None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000, 'uniform', None) sage: lwe = LWE(n=20, q=next_prime(400), D=D, secret_dist=(-3, 3)); lwe - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0, (-3, 3), None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000, (-3, 3), None) """ if isinstance(self.secret_dist, str): return "LWE(%d, %d, %s, '%s', %s)"%(self.n,self.K.order(),self.D,self.secret_dist, self.m) @@ -388,7 +388,7 @@ def __init__(self, n, secret_dist='uniform', m=None): sage: from sage.crypto.lwe import Regev sage: Regev(n=20) - LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 1.915069 and c = 401, 'uniform', None) + LWE(20, 401, Discrete Gaussian sampler over the Integers with sigma = 1.915069 and c = 401.000000, 'uniform', None) """ q = ZZ(next_prime(n**2)) s = RR(1/(RR(n).sqrt() * log(n, 2)**2) * q) @@ -418,7 +418,7 @@ def __init__(self, n, delta=0.01, m=None): sage: from sage.crypto.lwe import LindnerPeikert sage: LindnerPeikert(n=20) - LWE(20, 2053, Discrete Gaussian sampler over the Integers with sigma = 3.600954 and c = 0, 'noise', 168) + LWE(20, 2053, Discrete Gaussian sampler over the Integers with sigma = 3.600954 and c = 0.000000, 'noise', 168) """ if m is None: m = 2*n + 128 diff --git a/src/sage/databases/oeis.py b/src/sage/databases/oeis.py index be0138b6b76..45b73054eac 100644 --- a/src/sage/databases/oeis.py +++ b/src/sage/databases/oeis.py @@ -8,7 +8,6 @@ - identify a sequence from its first terms. - obtain more terms, formulae, references, etc. for a given sequence. - AUTHORS: - Thierry Monteil (2012-02-10 -- 2013-06-21): initial version. @@ -105,7 +104,6 @@ 10: A326943: Number of T_0 sets of subsets of {1..n} that cover all n vertices and are closed under intersection. ... - What does the Taylor expansion of the `e^{e^x-1}` function have to do with primes ? @@ -127,12 +125,11 @@ 'E.g.f.: exp(exp(x) - 1).' sage: [i for i in b.comments() if 'prime' in i][-1] # optional -- internet - 'Number n is prime if mod(a(n)-2,n) = 0...' + 'Number n is prime if ...' sage: [n for n in range(2, 20) if (b(n)-2) % n == 0] # optional -- internet [2, 3, 5, 7, 11, 13, 17, 19] - .. SEEALSO:: - If you plan to do a lot of automatic searches for subsequences, you @@ -161,6 +158,8 @@ from urllib.request import urlopen from urllib.parse import urlencode from ssl import create_default_context as default_context +from collections import defaultdict +import re from sage.structure.sage_object import SageObject from sage.structure.unique_representation import UniqueRepresentation @@ -174,8 +173,6 @@ from sage.misc.html import HtmlFragment from sage.repl.preparse import preparse -from collections import defaultdict -import re oeis_url = 'https://oeis.org/' @@ -205,7 +202,7 @@ def _fetch(url): f.close() return bytes_to_str(result) except IOError as msg: - raise IOError("%s\nError fetching %s." % (msg, url)) + raise IOError("%s\nerror fetching %s" % (msg, url)) def _urls(html_string): @@ -229,7 +226,6 @@ def _urls(html_string): sage: html = 'http://example.com is not a link, but sagemath is' sage: _urls(html) ['http://sagemath.org/'] - """ urls = [] from html.parser import HTMLParser @@ -611,7 +607,7 @@ def _imaginary_entry(self, ident='A999999', keywords=''): '%o ' + ident + ' def ' + ident + '(n):\n' '%o ' + ident + ' assert(isinstance(n, (int, Integer))), "n must be an integer."\n' '%o ' + ident + ' if n < 38:\n' - '%o ' + ident + ' raise ValueError("The value %s is not accepted." %str(n))\n' + '%o ' + ident + ' raise ValueError("the value %s is not accepted" % str(n))\n' '%o ' + ident + ' elif n == 42:\n' '%o ' + ident + ' return 2\n' '%o ' + ident + ' else:\n' @@ -1365,14 +1361,14 @@ def __call__(self, k): sage: s(2) Traceback (most recent call last): ... - ValueError: Sequence A999999 is not defined (or known) for index 2 + ValueError: sequence A999999 is not defined (or known) for index 2 """ offset = self.offsets()[0] if 'cons' in self.keywords(): offset = - offset n = k - offset if not 0 <= n < len(self.first_terms()): - raise ValueError("Sequence %s is not defined (or known) for index %s" % (self.id(), k)) + raise ValueError("sequence %s is not defined (or known) for index %s" % (self.id(), k)) return self.first_terms()[n] def __getitem__(self, i): @@ -1454,7 +1450,7 @@ def __iter__(self): sage: next(i) # optional -- internet Traceback (most recent call last): ... - LookupError: Future values not provided by OEIS. + LookupError: future values not provided by OEIS :: @@ -1465,7 +1461,7 @@ def __iter__(self): ....: print(i) Traceback (most recent call last): ... - LookupError: Future values not provided by OEIS. + LookupError: future values not provided by OEIS TESTS:: @@ -1474,7 +1470,7 @@ def __iter__(self): ....: pass Traceback (most recent call last): ... - LookupError: Future values not provided by OEIS. + LookupError: future values not provided by OEIS sage: for i in s: ....: if i == 2: @@ -1488,7 +1484,7 @@ def __iter__(self): for x in self.first_terms(): yield x if not self.is_full() is True: - raise LookupError("Future values not provided by OEIS.") + raise LookupError("future values not provided by OEIS") def references(self): r""" @@ -1892,7 +1888,7 @@ def programs(self, language='all', preparsing=True, keep_comments=False): 0: def A999999(n): 1: assert(isinstance(n, (int, Integer))), "n must be an integer." 2: if n < 38: - 3: raise ValueError("The value %s is not accepted." %str(n)) + 3: raise ValueError("the value %s is not accepted" % str(n)) 4: elif n == 42: 5: return 2 6: else: diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index 58db12dff41..8dbc27d90e0 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -1,986 +1,4 @@ from sage.misc.superseded import deprecation deprecation(33763, "This module is deprecated. Use sage_docbuild.conf instead.") -import sys -import os -import sphinx -from sage.env import SAGE_DOC_SRC, SAGE_DOC, THEBE_DIR, PPLPY_DOCS, MATHJAX_DIR -from sage.misc.latex_macros import sage_mathjax_macros -import sage.version -from sage.misc.sagedoc import extlinks -import dateutil.parser -from docutils import nodes -from docutils.transforms import Transform -from sphinx.ext.doctest import blankline_re -from sphinx import highlighting -import sphinx.ext.intersphinx as intersphinx -from IPython.lib.lexers import IPythonConsoleLexer, IPyLexer - - -# General configuration -# --------------------- - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sage_docbuild.ext.inventory_builder', - 'sage_docbuild.ext.multidocs', - 'sage_docbuild.ext.sage_autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.extlinks', - 'sphinx.ext.mathjax', - 'IPython.sphinxext.ipython_directive', - 'matplotlib.sphinxext.plot_directive', - 'jupyter_sphinx', -] - -jupyter_execute_default_kernel = 'sagemath' - -jupyter_sphinx_thebelab_config = { - 'requestKernel': True, - 'binderOptions': { - 'repo': "sagemath/sage-binder-env", - }, - 'kernelOptions': { - 'name': "sagemath", - 'kernelName': "sagemath", - 'path': ".", - }, -} - -# This code is executed before each ".. PLOT::" directive in the Sphinx -# documentation. It defines a 'sphinx_plot' function that displays a Sage object -# through matplotlib, so that it will be displayed in the HTML doc -plot_html_show_source_link = False -plot_pre_code = r""" -# Set locale to prevent having commas in decimal numbers -# in tachyon input (see https://trac.sagemath.org/ticket/28971) -import locale -locale.setlocale(locale.LC_NUMERIC, 'C') -def sphinx_plot(graphics, **kwds): - import matplotlib.image as mpimg - import matplotlib.pyplot as plt - from sage.misc.temporary_file import tmp_filename - from sage.plot.graphics import _parse_figsize - if os.environ.get('SAGE_SKIP_PLOT_DIRECTIVE', 'no') != 'yes': - ## Option handling is taken from Graphics.save - options = dict() - if isinstance(graphics, sage.plot.graphics.Graphics): - options.update(sage.plot.graphics.Graphics.SHOW_OPTIONS) - options.update(graphics._extra_kwds) - options.update(kwds) - elif isinstance(graphics, sage.plot.multigraphics.MultiGraphics): - options.update(kwds) - else: - graphics = graphics.plot(**kwds) - dpi = options.pop('dpi', None) - transparent = options.pop('transparent', None) - fig_tight = options.pop('fig_tight', None) - figsize = options.pop('figsize', None) - if figsize is not None: - figsize = _parse_figsize(figsize) - plt.figure(figsize=figsize) - figure = plt.gcf() - if isinstance(graphics, (sage.plot.graphics.Graphics, - sage.plot.multigraphics.MultiGraphics)): - graphics.matplotlib(figure=figure, figsize=figsize, **options) - if isinstance(graphics, (sage.plot.graphics.Graphics, - sage.plot.multigraphics.GraphicsArray)): - # for Graphics and GraphicsArray, tight_layout adjusts the - # *subplot* parameters so ticks aren't cut off, etc. - figure.tight_layout() - else: - # 3d graphics via png - import matplotlib as mpl - mpl.rcParams['image.interpolation'] = 'bilinear' - mpl.rcParams['image.resample'] = False - mpl.rcParams['figure.figsize'] = [8.0, 6.0] - mpl.rcParams['figure.dpi'] = 80 - mpl.rcParams['savefig.dpi'] = 100 - fn = tmp_filename(ext=".png") - graphics.save(fn) - img = mpimg.imread(fn) - plt.imshow(img) - plt.axis("off") - plt.margins(0) - if not isinstance(graphics, sage.plot.multigraphics.MultiGraphics): - plt.tight_layout(pad=0) - -from sage.all_cmdline import * -""" - -plot_html_show_formats = False -plot_formats = ['svg', 'pdf', 'png'] - -# We do *not* fully initialize intersphinx since we call it by hand -# in find_sage_dangling_links. -#, 'sphinx.ext.intersphinx'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = [os.path.join(SAGE_DOC_SRC, 'common', 'templates'), 'templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = "" -copyright = "2005--{}, The Sage Development Team".format(dateutil.parser.parse(sage.version.date).year) - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -version = sage.version.version -release = sage.version.version - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of glob-style patterns that should be excluded when looking for -# source files. [1] They are matched against the source file names -# relative to the source directory, using slashes as directory -# separators on all platforms. -exclude_patterns = ['.build'] - -# The reST default role (used for this markup: `text`) to use for all documents. -default_role = 'math' - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. NOTE: -# This overrides a HTML theme's corresponding setting (see below). -pygments_style = 'sphinx' - -# Default lexer to use when highlighting code blocks, using the IPython -# console lexers. 'ipycon' is the IPython console, which is what we want -# for most code blocks: anything with "sage:" prompts. For other IPython, -# like blocks which might appear in a notebook cell, use 'ipython'. -highlighting.lexers['ipycon'] = IPythonConsoleLexer(in1_regex=r'sage: ', in2_regex=r'[.][.][.][.]: ') -highlighting.lexers['ipython'] = IPyLexer() -highlight_language = 'ipycon' - -# Extension configuration -# ----------------------- - -# include the todos -todo_include_todos = True - -# Cross-links to other project's online documentation. -python_version = sys.version_info.major - -def set_intersphinx_mappings(app, config): - """ - Add precompiled inventory (the objects.inv) - """ - refpath = os.path.join(SAGE_DOC, "html", "en", "reference") - invpath = os.path.join(SAGE_DOC, "inventory", "en", "reference") - if app.config.multidoc_first_pass == 1 or \ - not (os.path.exists(refpath) and os.path.exists(invpath)): - app.config.intersphinx_mapping = {} - return - - app.config.intersphinx_mapping = { - 'python': ('https://docs.python.org/', - os.path.join(SAGE_DOC_SRC, "common", - "python{}.inv".format(python_version))), - 'pplpy': (PPLPY_DOCS, None)} - - # Add master intersphinx mapping - dst = os.path.join(invpath, 'objects.inv') - app.config.intersphinx_mapping['sagemath'] = (refpath, dst) - - # Add intersphinx mapping for subdirectories - # We intentionally do not name these such that these get higher - # priority in case of conflicts - for directory in os.listdir(os.path.join(invpath)): - if directory == 'jupyter_execute': - # This directory is created by jupyter-sphinx extension for - # internal use and should be ignored here. See trac #33507. - continue - if os.path.isdir(os.path.join(invpath, directory)): - src = os.path.join(refpath, directory) - dst = os.path.join(invpath, directory, 'objects.inv') - app.config.intersphinx_mapping[src] = dst - - intersphinx.normalize_intersphinx_mapping(app, config) - -# By default document are not master. -multidocs_is_master = True - -# Options for HTML output -# ----------------------- - -# Sage default HTML theme. We use a custom theme to set a Pygments style, -# stylesheet, and insert MathJax macros. See the directory -# doc/common/themes/sage-classic/ for files comprising the custom theme. -html_theme = 'sage-classic' - -# Theme options are theme-specific and customize the look and feel of -# a theme further. For a list of options available for each theme, -# see the documentation. -html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [os.path.join(SAGE_DOC_SRC, 'common', 'themes')] - -# HTML style sheet NOTE: This overrides a HTML theme's corresponding -# setting. -#html_style = 'default.css' - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (within the static path) to place at the top of -# the sidebar. -#html_logo = 'sagelogo-word.ico' - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -html_favicon = 'favicon.ico' - -# html_static_path defined here and imported in the actual configuration file -# conf.py read by Sphinx was the cause of subtle bugs in builders (see #30418 for -# instance). Hence now html_common_static_path contains the common paths to static -# files, and is combined to html_static_path in each conf.py file read by Sphinx. -html_common_static_path = [os.path.join(SAGE_DOC_SRC, 'common', 'static'), - THEBE_DIR, 'static'] - -# Configure MathJax -# https://docs.mathjax.org/en/latest/options/input/tex.html -mathjax3_config = { - "tex": { - # Add custom sage macros - # http://docs.mathjax.org/en/latest/input/tex/macros.html - "macros": sage_mathjax_macros(), - # Add $...$ as possible inline math - # https://docs.mathjax.org/en/latest/input/tex/delimiters.html#tex-and-latex-math-delimiters - "inlineMath": [["$", "$"], ["\\(", "\\)"]], - # Increase the limit the size of the string to be processed - # https://docs.mathjax.org/en/latest/options/input/tex.html#option-descriptions - "maxBuffer": 50 * 1024, - # Use colorv2 extension instead of built-in color extension - # https://docs.mathjax.org/en/latest/input/tex/extensions/autoload.html#tex-autoload-options - # https://docs.mathjax.org/en/latest/input/tex/extensions/colorv2.html#tex-colorv2 - "autoload": {"color": [], "colorv2": ["color"]}, - }, -} - -if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes': - mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" -else: - mathjax_path = 'mathjax/tex-chtml.js' - html_common_static_path += [MATHJAX_DIR] - -# A list of glob-style patterns that should be excluded when looking for source -# files. They are matched against the source file names relative to the -# source directory, using slashes as directory separators on all platforms. -exclude_patterns = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_use_modindex = True - -# A list of prefixes that are ignored for sorting the Python module index ( if -# this is set to ['foo.'], then foo.bar is shown under B, not F). Works only -# for the HTML builder currently. -modindex_common_prefix = ['sage.'] - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -html_split_index = True - -# If true, the reST sources are included in the HTML build as _sources/. -#html_copy_source = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' - -# Output file base name for HTML help builder. -#htmlhelp_basename = '' - -# Options for LaTeX output -# ------------------------ -# See http://sphinx-doc.org/config.html#confval-latex_elements -latex_elements = {} - -# The paper size ('letterpaper' or 'a4paper'). -#latex_elements['papersize'] = 'letterpaper' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_elements['pointsize'] = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, document class [howto/manual]). -latex_documents = [] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = 'sagelogo-word.png' - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# Additional stuff for the LaTeX preamble. -latex_elements['preamble'] = r""" -\usepackage{amsmath} -\usepackage{amssymb} -\usepackage{textcomp} -\usepackage{mathrsfs} -\usepackage{iftex} - -% Only declare unicode characters when compiling with pdftex; E.g. japanese -% tutorial does not use pdftex -\ifPDFTeX - \DeclareUnicodeCharacter{01CE}{\capitalcaron a} - \DeclareUnicodeCharacter{0428}{cyrillic Sha} - \DeclareUnicodeCharacter{250C}{+} - \DeclareUnicodeCharacter{2510}{+} - \DeclareUnicodeCharacter{2514}{+} - \DeclareUnicodeCharacter{2518}{+} - \DeclareUnicodeCharacter{253C}{+} - - \DeclareUnicodeCharacter{03B1}{\ensuremath{\alpha}} - \DeclareUnicodeCharacter{03B2}{\ensuremath{\beta}} - \DeclareUnicodeCharacter{03B3}{\ensuremath{\gamma}} - \DeclareUnicodeCharacter{0393}{\ensuremath{\Gamma}} - \DeclareUnicodeCharacter{03B4}{\ensuremath{\delta}} - \DeclareUnicodeCharacter{0394}{\ensuremath{\Delta}} - \DeclareUnicodeCharacter{03B5}{\ensuremath{\varepsilon}} - \DeclareUnicodeCharacter{03B6}{\ensuremath{\zeta}} - \DeclareUnicodeCharacter{03B7}{\ensuremath{\eta}} - \DeclareUnicodeCharacter{03B8}{\ensuremath{\vartheta}} - \DeclareUnicodeCharacter{0398}{\ensuremath{\Theta}} - \DeclareUnicodeCharacter{03BA}{\ensuremath{\kappa}} - \DeclareUnicodeCharacter{03BB}{\ensuremath{\lambda}} - \DeclareUnicodeCharacter{039B}{\ensuremath{\Lambda}} - \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} % micron sign - \DeclareUnicodeCharacter{03BC}{\ensuremath{\mu}} - \DeclareUnicodeCharacter{03BD}{\ensuremath{\nu}} - \DeclareUnicodeCharacter{03BE}{\ensuremath{\xi}} - \DeclareUnicodeCharacter{039E}{\ensuremath{\Xi}} - \DeclareUnicodeCharacter{03B9}{\ensuremath{\iota}} - \DeclareUnicodeCharacter{03C0}{\ensuremath{\pi}} - \DeclareUnicodeCharacter{03A0}{\ensuremath{\Pi}} - \DeclareUnicodeCharacter{03C1}{\ensuremath{\rho}} - \DeclareUnicodeCharacter{03C3}{\ensuremath{\sigma}} - \DeclareUnicodeCharacter{03A3}{\ensuremath{\Sigma}} - \DeclareUnicodeCharacter{03C4}{\ensuremath{\tau}} - \DeclareUnicodeCharacter{03C6}{\ensuremath{\varphi}} - \DeclareUnicodeCharacter{03A6}{\ensuremath{\Phi}} - \DeclareUnicodeCharacter{03C7}{\ensuremath{\chi}} - \DeclareUnicodeCharacter{03C8}{\ensuremath{\psi}} - \DeclareUnicodeCharacter{03A8}{\ensuremath{\Psi}} - \DeclareUnicodeCharacter{03C9}{\ensuremath{\omega}} - \DeclareUnicodeCharacter{03A9}{\ensuremath{\Omega}} - \DeclareUnicodeCharacter{03C5}{\ensuremath{\upsilon}} - \DeclareUnicodeCharacter{03A5}{\ensuremath{\Upsilon}} - \DeclareUnicodeCharacter{2113}{\ell} - - \DeclareUnicodeCharacter{2148}{\ensuremath{\id}} - \DeclareUnicodeCharacter{2202}{\ensuremath{\partial}} - \DeclareUnicodeCharacter{2205}{\ensuremath{\emptyset}} - \DeclareUnicodeCharacter{2208}{\ensuremath{\in}} - \DeclareUnicodeCharacter{2209}{\ensuremath{\notin}} - \DeclareUnicodeCharacter{2211}{\ensuremath{\sum}} - \DeclareUnicodeCharacter{221A}{\ensuremath{\sqrt{}}} - \DeclareUnicodeCharacter{221E}{\ensuremath{\infty}} - \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} - \DeclareUnicodeCharacter{2228}{\ensuremath{\vee}} - \DeclareUnicodeCharacter{2229}{\ensuremath{\cap}} - \DeclareUnicodeCharacter{222A}{\ensuremath{\cup}} - \DeclareUnicodeCharacter{222B}{\ensuremath{\int}} - \DeclareUnicodeCharacter{2248}{\ensuremath{\approx}} - \DeclareUnicodeCharacter{2260}{\ensuremath{\neq}} - \DeclareUnicodeCharacter{2264}{\ensuremath{\leq}} - \DeclareUnicodeCharacter{2265}{\ensuremath{\geq}} - \DeclareUnicodeCharacter{2293}{\ensuremath{\sqcap}} - \DeclareUnicodeCharacter{2294}{\ensuremath{\sqcup}} - \DeclareUnicodeCharacter{22C0}{\ensuremath{\bigwedge}} - \DeclareUnicodeCharacter{22C1}{\ensuremath{\bigvee}} - \DeclareUnicodeCharacter{22C2}{\ensuremath{\bigcap}} - \DeclareUnicodeCharacter{22C3}{\ensuremath{\bigcup}} - \DeclareUnicodeCharacter{2323}{\ensuremath{\smile}} % cup product - \DeclareUnicodeCharacter{00B1}{\ensuremath{\pm}} - \DeclareUnicodeCharacter{2A02}{\ensuremath{\bigotimes}} - \DeclareUnicodeCharacter{2297}{\ensuremath{\otimes}} - \DeclareUnicodeCharacter{2A01}{\ensuremath{\oplus}} - \DeclareUnicodeCharacter{00BD}{\ensuremath{\nicefrac{1}{2}}} - \DeclareUnicodeCharacter{00D7}{\ensuremath{\times}} - \DeclareUnicodeCharacter{00B7}{\ensuremath{\cdot}} - \DeclareUnicodeCharacter{230A}{\ensuremath{\lfloor}} - \DeclareUnicodeCharacter{230B}{\ensuremath{\rfloor}} - \DeclareUnicodeCharacter{2308}{\ensuremath{\lceil}} - \DeclareUnicodeCharacter{2309}{\ensuremath{\rceil}} - \DeclareUnicodeCharacter{22C5}{\ensuremath{\cdot}} - \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} - \DeclareUnicodeCharacter{22C0}{\ensuremath{\bigwedge}} - \DeclareUnicodeCharacter{2192}{\ensuremath{\to}} - \DeclareUnicodeCharacter{21A6}{\ensuremath{\mapsto}} - \DeclareUnicodeCharacter{2102}{\ensuremath{\mathbb{C}}} - \DeclareUnicodeCharacter{211A}{\ensuremath{\mathbb{Q}}} - \DeclareUnicodeCharacter{211D}{\ensuremath{\mathbb{R}}} - \DeclareUnicodeCharacter{2124}{\ensuremath{\mathbb{Z}}} - \DeclareUnicodeCharacter{2202}{\ensuremath{\partial}} - - \DeclareUnicodeCharacter{2070}{\ensuremath{{}^0}} - \DeclareUnicodeCharacter{00B9}{\ensuremath{{}^1}} - \DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}} - \DeclareUnicodeCharacter{00B3}{\ensuremath{{}^3}} - \DeclareUnicodeCharacter{2074}{\ensuremath{{}^4}} - \DeclareUnicodeCharacter{2075}{\ensuremath{{}^5}} - \DeclareUnicodeCharacter{2076}{\ensuremath{{}^6}} - \DeclareUnicodeCharacter{2077}{\ensuremath{{}^7}} - \DeclareUnicodeCharacter{2078}{\ensuremath{{}^8}} - \DeclareUnicodeCharacter{2079}{\ensuremath{{}^9}} - \DeclareUnicodeCharacter{207A}{\ensuremath{{}^+}} - \DeclareUnicodeCharacter{207B}{\ensuremath{{}^-}} - \DeclareUnicodeCharacter{141F}{\ensuremath{{}^/}} - \DeclareUnicodeCharacter{2080}{\ensuremath{{}_0}} - \DeclareUnicodeCharacter{2081}{\ensuremath{{}_1}} - \DeclareUnicodeCharacter{2082}{\ensuremath{{}_2}} - \DeclareUnicodeCharacter{2083}{\ensuremath{{}_3}} - \DeclareUnicodeCharacter{2084}{\ensuremath{{}_4}} - \DeclareUnicodeCharacter{2085}{\ensuremath{{}_5}} - \DeclareUnicodeCharacter{2086}{\ensuremath{{}_6}} - \DeclareUnicodeCharacter{2087}{\ensuremath{{}_7}} - \DeclareUnicodeCharacter{2088}{\ensuremath{{}_8}} - \DeclareUnicodeCharacter{2089}{\ensuremath{{}_9}} - \DeclareUnicodeCharacter{208A}{\ensuremath{{}_+}} - \DeclareUnicodeCharacter{208B}{\ensuremath{{}_-}} - \DeclareUnicodeCharacter{1D62}{\ensuremath{{}_i}} - \DeclareUnicodeCharacter{2C7C}{\ensuremath{{}_j}} - - \newcommand{\sageMexSymbol}[1] - {{\fontencoding{OMX}\fontfamily{cmex}\selectfont\raisebox{0.75em}{\symbol{#1}}}} - \DeclareUnicodeCharacter{239B}{\sageMexSymbol{"30}} % parenlefttp - \DeclareUnicodeCharacter{239C}{\sageMexSymbol{"42}} % parenleftex - \DeclareUnicodeCharacter{239D}{\sageMexSymbol{"40}} % parenleftbt - \DeclareUnicodeCharacter{239E}{\sageMexSymbol{"31}} % parenrighttp - \DeclareUnicodeCharacter{239F}{\sageMexSymbol{"43}} % parenrightex - \DeclareUnicodeCharacter{23A0}{\sageMexSymbol{"41}} % parenrightbt - \DeclareUnicodeCharacter{23A1}{\sageMexSymbol{"32}} % bracketlefttp - \DeclareUnicodeCharacter{23A2}{\sageMexSymbol{"36}} % bracketleftex - \DeclareUnicodeCharacter{23A3}{\sageMexSymbol{"34}} % bracketleftbt - \DeclareUnicodeCharacter{23A4}{\sageMexSymbol{"33}} % bracketrighttp - \DeclareUnicodeCharacter{23A5}{\sageMexSymbol{"37}} % bracketrightex - \DeclareUnicodeCharacter{23A6}{\sageMexSymbol{"35}} % bracketrightbt - - \DeclareUnicodeCharacter{23A7}{\sageMexSymbol{"38}} % curly brace left top - \DeclareUnicodeCharacter{23A8}{\sageMexSymbol{"3C}} % curly brace left middle - \DeclareUnicodeCharacter{23A9}{\sageMexSymbol{"3A}} % curly brace left bottom - \DeclareUnicodeCharacter{23AA}{\sageMexSymbol{"3E}} % curly brace extension - \DeclareUnicodeCharacter{23AB}{\sageMexSymbol{"39}} % curly brace right top - \DeclareUnicodeCharacter{23AC}{\sageMexSymbol{"3D}} % curly brace right middle - \DeclareUnicodeCharacter{23AD}{\sageMexSymbol{"3B}} % curly brace right bottom - \DeclareUnicodeCharacter{23B0}{\{} % 2-line curly brace left top half (not in cmex) - \DeclareUnicodeCharacter{23B1}{\}} % 2-line curly brace right top half (not in cmex) - - \DeclareUnicodeCharacter{2320}{\ensuremath{\int}} % top half integral - \DeclareUnicodeCharacter{2321}{\ensuremath{\int}} % bottom half integral - \DeclareUnicodeCharacter{23AE}{\ensuremath{\|}} % integral extenison - - % Box drawings light - \DeclareUnicodeCharacter{2500}{-} % h - \DeclareUnicodeCharacter{2502}{|} % v - \DeclareUnicodeCharacter{250C}{+} % dr - \DeclareUnicodeCharacter{2510}{+} % dl - \DeclareUnicodeCharacter{2514}{+} % ur - \DeclareUnicodeCharacter{2518}{+} % ul - \DeclareUnicodeCharacter{251C}{+} % vr - \DeclareUnicodeCharacter{2524}{+} % vl - \DeclareUnicodeCharacter{252C}{+} % dh - \DeclareUnicodeCharacter{2534}{+} % uh - \DeclareUnicodeCharacter{253C}{+} % vh - \DeclareUnicodeCharacter{2571}{/} % upper right to lower left - \DeclareUnicodeCharacter{2571}{\setminus} % upper left to lower right - - \DeclareUnicodeCharacter{25CF}{\ensuremath{\bullet}} % medium black circle - \DeclareUnicodeCharacter{26AC}{\ensuremath{\circ}} % medium small white circle - \DeclareUnicodeCharacter{256D}{+} - \DeclareUnicodeCharacter{256E}{+} - \DeclareUnicodeCharacter{256F}{+} - \DeclareUnicodeCharacter{2570}{+} -\fi - -\let\textLaTeX\LaTeX -\AtBeginDocument{\renewcommand*{\LaTeX}{\hbox{\textLaTeX}}} - -% Workaround for a LaTeX bug -- see trac #31397 and -% https://tex.stackexchange.com/questions/583391/mactex-2020-error-with-report-hyperref-mathbf-in-chapter. -\makeatletter -\pdfstringdefDisableCommands{% - \let\mathbf\@firstofone -} -\makeatother -""" - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_use_modindex = True - -##################################################### -# add LaTeX macros for Sage - -from sage.misc.latex_macros import sage_latex_macros - -try: - pngmath_latex_preamble # check whether this is already defined -except NameError: - pngmath_latex_preamble = "" - -for macro in sage_latex_macros(): - # used when building latex and pdf versions - latex_elements['preamble'] += macro + '\n' - # used when building html version - pngmath_latex_preamble += macro + '\n' - -##################################################### -# add custom context variables for templates - -def add_page_context(app, pagename, templatename, context, doctree): - # # The template function - # def template_function(arg): - # return "Your string is " + arg - # # Add it to the page's context - # context['template_function'] = template_function - path1 = os.path.dirname(app.builder.get_outfilename(pagename)) - path2 = os.path.join(SAGE_DOC, 'html', 'en') - relpath = os.path.relpath(path2, path1) - context['release'] = release - context['documentation_title'] = 'Sage {}'.format(release) + ' Documentation' - context['documentation_root'] = os.path.join(relpath, 'index.html') - if 'website' in path1: - context['title'] = 'Documentation' - context['website'] = True - - if 'reference' in path1 and not path1.endswith('reference'): - path2 = os.path.join(SAGE_DOC, 'html', 'en', 'reference') - relpath = os.path.relpath(path2, path1) - context['reference_title'] = 'Reference Manual' - context['reference_root'] = os.path.join(relpath, 'index.html') - context['refsub'] = True - -##################################################### - -def process_docstring_aliases(app, what, name, obj, options, docstringlines): - """ - Change the docstrings for aliases to point to the original object. - """ - basename = name.rpartition('.')[2] - if hasattr(obj, '__name__') and obj.__name__ != basename: - docstringlines[:] = ['See :obj:`%s`.' % name] - -def process_directives(app, what, name, obj, options, docstringlines): - """ - Remove 'nodetex' and other directives from the first line of any - docstring where they appear. - """ - if len(docstringlines) == 0: - return - first_line = docstringlines[0] - directives = [ d.lower() for d in first_line.split(',') ] - if 'nodetex' in directives: - docstringlines.pop(0) - -def process_docstring_cython(app, what, name, obj, options, docstringlines): - """ - Remove Cython's filename and location embedding. - """ - if len(docstringlines) <= 1: - return - - first_line = docstringlines[0] - if first_line.startswith('File:') and '(starting at' in first_line: - #Remove the first two lines - docstringlines.pop(0) - docstringlines.pop(0) - -def process_docstring_module_title(app, what, name, obj, options, docstringlines): - """ - Removes the first line from the beginning of the module's docstring. This - corresponds to the title of the module's documentation page. - """ - if what != "module": - return - - #Remove any additional blank lines at the beginning - title_removed = False - while len(docstringlines) > 1 and not title_removed: - if docstringlines[0].strip() != "": - title_removed = True - docstringlines.pop(0) - - #Remove any additional blank lines at the beginning - while len(docstringlines) > 1: - if docstringlines[0].strip() == "": - docstringlines.pop(0) - else: - break - -skip_picklability_check_modules = [ - #'sage.misc.test_nested_class', # for test only - 'sage.misc.latex', - 'sage.misc.explain_pickle', - '__builtin__', -] - -def check_nested_class_picklability(app, what, name, obj, skip, options): - """ - Print a warning if pickling is broken for nested classes. - """ - if hasattr(obj, '__dict__') and hasattr(obj, '__module__'): - # Check picklability of nested classes. Adapted from - # sage.misc.nested_class.modify_for_nested_pickle. - module = sys.modules[obj.__module__] - for (nm, v) in obj.__dict__.items(): - if (isinstance(v, type) and - v.__name__ == nm and - v.__module__ == module.__name__ and - getattr(module, nm, None) is not v and - v.__module__ not in skip_picklability_check_modules): - # OK, probably this is an *unpicklable* nested class. - app.warn('Pickling of nested class %r is probably broken. ' - 'Please set the metaclass of the parent class to ' - 'sage.misc.nested_class.NestedClassMetaclass.' % ( - v.__module__ + '.' + name + '.' + nm)) - - -def skip_member(app, what, name, obj, skip, options): - """ - To suppress Sphinx warnings / errors, we - - - Don't include [aliases of] builtins. - - - Don't include the docstring for any nested class which has been - inserted into its module by - :class:`sage.misc.NestedClassMetaclass` only for pickling. The - class will be properly documented inside its surrounding class. - - - Optionally, check whether pickling is broken for nested classes. - - - Optionally, include objects whose name begins with an underscore - ('_'), i.e., "private" or "hidden" attributes, methods, etc. - - Otherwise, we abide by Sphinx's decision. Note: The object - ``obj`` is excluded (included) if this handler returns True - (False). - """ - if 'SAGE_CHECK_NESTED' in os.environ: - check_nested_class_picklability(app, what, name, obj, skip, options) - - if getattr(obj, '__module__', None) == '__builtin__': - return True - - objname = getattr(obj, "__name__", None) - if objname is not None: - # check if name was inserted to the module by NestedClassMetaclass - if name.find('.') != -1 and objname.find('.') != -1: - if objname.split('.')[-1] == name.split('.')[-1]: - return True - - if 'SAGE_DOC_UNDERSCORE' in os.environ: - if name.split('.')[-1].startswith('_'): - return False - - return skip - - -def process_dollars(app, what, name, obj, options, docstringlines): - r""" - Replace dollar signs with backticks. - - See sage.misc.sagedoc.process_dollars for more information. - """ - if len(docstringlines) and name.find("process_dollars") == -1: - from sage.misc.sagedoc import process_dollars as sagedoc_dollars - s = sagedoc_dollars("\n".join(docstringlines)) - lines = s.split("\n") - for i in range(len(lines)): - docstringlines[i] = lines[i] - -def process_inherited(app, what, name, obj, options, docstringlines): - """ - If we're including inherited members, omit their docstrings. - """ - if not options.get('inherited-members'): - return - - if what in ['class', 'data', 'exception', 'function', 'module']: - return - - name = name.split('.')[-1] - - if what == 'method' and hasattr(obj, 'im_class'): - if name in obj.im_class.__dict__.keys(): - return - - if what == 'attribute' and hasattr(obj, '__objclass__'): - if name in obj.__objclass__.__dict__.keys(): - return - - for i in range(len(docstringlines)): - docstringlines.pop() - -dangling_debug = False - -def debug_inf(app, message): - if dangling_debug: - app.info(message) - -def call_intersphinx(app, env, node, contnode): - r""" - Call intersphinx and make links between Sage manuals relative. - - TESTS: - - Check that the link from the thematic tutorials to the reference - manual is relative, see :trac:`20118`:: - - sage: from sage.env import SAGE_DOC - sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html") - sage: for line in open(thematic_index).readlines(): # optional - sagemath_doc_html - ....: if "padics" in line: - ....: _ = sys.stdout.write(line) -
  • Introduction to the p-adics

  • - """ - debug_inf(app, "???? Trying intersphinx for %s" % node['reftarget']) - builder = app.builder - res = intersphinx.missing_reference( - app, env, node, contnode) - if res: - # Replace absolute links to $SAGE_DOC by relative links: this - # allows to copy the whole documentation tree somewhere else - # without breaking links, see Trac #20118. - if res['refuri'].startswith(SAGE_DOC): - here = os.path.dirname(os.path.join(builder.outdir, - node['refdoc'])) - res['refuri'] = os.path.relpath(res['refuri'], here) - debug_inf(app, "++++ Found at %s" % res['refuri']) - else: - debug_inf(app, "---- Intersphinx: %s not Found" % node['reftarget']) - return res - -def find_sage_dangling_links(app, env, node, contnode): - r""" - Try to find dangling link in local module imports or all.py. - """ - debug_inf(app, "==================== find_sage_dangling_links ") - - reftype = node['reftype'] - reftarget = node['reftarget'] - try: - doc = node['refdoc'] - except KeyError: - debug_inf(app, "-- no refdoc in node %s" % node) - return None - - debug_inf(app, "Searching %s from %s"%(reftarget, doc)) - - # Workaround: in Python's doc 'object', 'list', ... are documented as a - # function rather than a class - if reftarget in base_class_as_func and reftype == 'class': - node['reftype'] = 'func' - - res = call_intersphinx(app, env, node, contnode) - if res: - debug_inf(app, "++ DONE %s"%(res['refuri'])) - return res - - if node.get('refdomain') != 'py': # not a python file - return None - - try: - module = node['py:module'] - cls = node['py:class'] - except KeyError: - debug_inf(app, "-- no module or class for :%s:%s"%(reftype, reftarget)) - return None - - basename = reftarget.split(".")[0] - try: - target_module = getattr(sys.modules['sage.all'], basename).__module__ - debug_inf(app, "++ found %s using sage.all in %s" % (basename, target_module)) - except AttributeError: - try: - target_module = getattr(sys.modules[node['py:module']], basename).__module__ - debug_inf(app, "++ found %s in this module" % (basename,)) - except AttributeError: - debug_inf(app, "-- %s not found in sage.all or this module" % (basename)) - return None - except KeyError: - target_module = None - if target_module is None: - target_module = "" - debug_inf(app, "?? found in None !!!") - - newtarget = target_module+'.'+reftarget - node['reftarget'] = newtarget - - # adapted from sphinx/domains/python.py - builder = app.builder - searchmode = node.hasattr('refspecific') and 1 or 0 - matches = builder.env.domains['py'].find_obj( - builder.env, module, cls, newtarget, reftype, searchmode) - if not matches: - debug_inf(app, "?? no matching doc for %s"%newtarget) - return call_intersphinx(app, env, node, contnode) - elif len(matches) > 1: - env.warn(target_module, - 'more than one target found for cross-reference ' - '%r: %s' % (newtarget, - ', '.join(match[0] for match in matches)), - node.line) - name, obj = matches[0] - debug_inf(app, "++ match = %s %s"%(name, obj)) - - from docutils import nodes - newnode = nodes.reference('', '', internal=True) - if name == target_module: - newnode['refid'] = name - else: - newnode['refuri'] = builder.get_relative_uri(node['refdoc'], obj[0]) - newnode['refuri'] += '#' + name - debug_inf(app, "++ DONE at URI %s"%(newnode['refuri'])) - newnode['reftitle'] = name - newnode.append(contnode) - return newnode - -# lists of basic Python class which are documented as functions -base_class_as_func = [ - 'bool', 'complex', 'dict', 'file', 'float', - 'frozenset', 'int', 'list', 'long', 'object', - 'set', 'slice', 'str', 'tuple', 'type', 'unicode', 'xrange'] - -# Nit picky option configuration: Put here broken links we want to ignore. For -# link to the Python documentation several links where broken because there -# where class listed as functions. Expand the list 'base_class_as_func' above -# instead of marking the link as broken. -nitpick_ignore = [ - ('py:class', 'twisted.web2.resource.Resource'), - ('py:class', 'twisted.web2.resource.PostableResource')] - -def nitpick_patch_config(app): - """ - Patch the default config for nitpicky - - Calling path_config ensure that nitpicky is not considered as a Sphinx - environment variable but rather as a Sage environment variable. As a - consequence, changing it doesn't force the recompilation of the entire - documentation. - """ - app.config.values['nitpicky'] = (False, 'sage') - app.config.values['nitpick_ignore'] = ([], 'sage') - -def skip_TESTS_block(app, what, name, obj, options, docstringlines): - """ - Skip blocks labeled "TESTS:". - - See sage.misc.sagedoc.skip_TESTS_block for more information. - """ - from sage.misc.sagedoc import skip_TESTS_block as sagedoc_skip_TESTS - if not docstringlines: - # No docstring, so don't do anything. See Trac #19932. - return - s = sagedoc_skip_TESTS("\n".join(docstringlines)) - lines = s.split("\n") - for i in range(len(lines)): - docstringlines[i] = lines[i] - while len(docstringlines) > len(lines): - del docstringlines[len(lines)] - -class SagemathTransform(Transform): - """ - Transform for code-blocks. - - This allows Sphinx to treat code-blocks with prompt "sage:" as - associated with the pycon lexer, and in particular, to change - "" to a blank line. - """ - default_priority = 500 - - def apply(self): - for node in self.document.traverse(nodes.literal_block): - if node.get('language') is None and node.astext().startswith('sage:'): - node['language'] = 'ipycon' - source = node.rawsource - source = blankline_re.sub('', source) - node.rawsource = source - node[:] = [nodes.Text(source)] - -from sage.misc.sageinspect import sage_getargspec -autodoc_builtin_argspec = sage_getargspec - -def setup(app): - app.connect('autodoc-process-docstring', process_docstring_cython) - app.connect('autodoc-process-docstring', process_directives) - app.connect('autodoc-process-docstring', process_docstring_module_title) - app.connect('autodoc-process-docstring', process_dollars) - app.connect('autodoc-process-docstring', process_inherited) - if os.environ.get('SAGE_SKIP_TESTS_BLOCKS', False): - app.connect('autodoc-process-docstring', skip_TESTS_block) - app.connect('autodoc-skip-member', skip_member) - app.add_transform(SagemathTransform) - - # When building the standard docs, app.srcdir is set to SAGE_DOC_SRC + - # 'LANGUAGE/DOCNAME', but when doing introspection, app.srcdir is - # set to a temporary directory. We don't want to use intersphinx, - # etc., when doing introspection. - if app.srcdir.startswith(SAGE_DOC_SRC): - app.add_config_value('intersphinx_mapping', {}, False) - app.add_config_value('intersphinx_cache_limit', 5, False) - app.add_config_value('intersphinx_disabled_reftypes', [], False) - app.connect('config-inited', set_intersphinx_mappings) - app.connect('builder-inited', intersphinx.load_mappings) - # We do *not* fully initialize intersphinx since we call it by hand - # in find_sage_dangling_links. - # app.connect('missing-reference', missing_reference) - app.connect('missing-reference', find_sage_dangling_links) - app.connect('builder-inited', nitpick_patch_config) - app.connect('html-page-context', add_page_context) +from sage_docbuild.conf import * diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index a9d11d0863e..2726a18c41f 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -284,7 +284,7 @@ def skipfile(filename, tested_optional_tags=False): return False -class Logger(object): +class Logger(): r""" File-like object which implements writing to multiple files at once. diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py index 546835698e2..f21f5917890 100644 --- a/src/sage/doctest/external.py +++ b/src/sage/doctest/external.py @@ -370,7 +370,7 @@ def external_software(): external_software = external_software() -class AvailableSoftware(object): +class AvailableSoftware(): """ This class keeps the set of available software whose availability is detected lazily from the list of external software. diff --git a/src/sage/doctest/fixtures.py b/src/sage/doctest/fixtures.py index 13b3fb40f19..815ee825f50 100644 --- a/src/sage/doctest/fixtures.py +++ b/src/sage/doctest/fixtures.py @@ -14,7 +14,7 @@ You can use :func:`trace_method` to see how a method communicates with its surroundings:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self): ....: self.y = self.g(self.x) ....: def g(self, arg): @@ -111,7 +111,7 @@ def sorted_pairs(iterable, pairs=False): return repr(val) -class AttributeAccessTracerHelper(object): +class AttributeAccessTracerHelper(): def __init__(self, delegate, prefix=" ", reads=True): r""" @@ -134,7 +134,7 @@ def __init__(self, delegate, prefix=" ", reads=True): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -166,7 +166,7 @@ def get(self, name): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -208,7 +208,7 @@ def set(self, name, val): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: pass ....: sage: foo = Foo() @@ -224,7 +224,7 @@ def set(self, name, val): setattr(self.delegate, name, val) -class AttributeAccessTracerProxy(object): +class AttributeAccessTracerProxy(): def __init__(self, delegate, **kwds): r""" @@ -247,7 +247,7 @@ def __init__(self, delegate, **kwds): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -281,7 +281,7 @@ def __getattribute__(self, name): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, *args): ....: return self.x*self.x ....: @@ -307,7 +307,7 @@ def __setattr__(self, name, val): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: pass ....: sage: foo = Foo() @@ -344,7 +344,7 @@ def trace_method(obj, meth, **kwds): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def f(self, arg=None): ....: self.y = self.g(self.x) ....: if arg: return arg*arg diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index 39967cfbbe6..435fdfe0dcf 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -131,10 +131,10 @@ def init_sage(controller=None): Check that SymPy equation pretty printer is limited in doctest mode to default width (80 chars):: - sage: from sympy import sympify - sage: from sympy.printing.pretty.pretty import PrettyPrinter - sage: s = sympify('+x^'.join(str(i) for i in range(30))) - sage: print(PrettyPrinter(settings={'wrap_line':True}).doprint(s)) + sage: from sympy import sympify # optional - sage.symbolic + sage: from sympy.printing.pretty.pretty import PrettyPrinter # optional - sage.symbolic + sage: s = sympify('+x^'.join(str(i) for i in range(30))) # optional - sage.symbolic + sage: print(PrettyPrinter(settings={'wrap_line': True}).doprint(s)) # optional - sage.symbolic 29 28 27 26 25 24 23 22 21 20 19 18 17 x + x + x + x + x + x + x + x + x + x + x + x + x + @@ -1705,8 +1705,8 @@ def parallel_dispatch(self): canceled:: sage: from tempfile import NamedTemporaryFile as NTF - sage: with ( NTF(suffix=".py", mode="w+t") as f1, - ....: NTF(suffix=".py", mode="w+t") as f2 ): + sage: with NTF(suffix=".py", mode="w+t") as f1, \ + ....: NTF(suffix=".py", mode="w+t") as f2: ....: _ = f1.write("'''\nsage: import time; time.sleep(60)\n'''") ....: f1.flush() ....: _ = f2.write("'''\nsage: True\nFalse\n'''") @@ -2116,7 +2116,7 @@ def run(self): TESTS:: - sage: run_doctests(sage.symbolic.units) # indirect doctest + sage: run_doctests(sage.symbolic.units) # indirect doctest # optional - sage.symbolic Running doctests with ID ... Doctesting 1 file. sage -t .../sage/symbolic/units.py @@ -2361,7 +2361,7 @@ def kill(self): return True -class DocTestTask(object): +class DocTestTask(): """ This class encapsulates the tests from a single source. diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py index 8c8f48bd827..064414befbc 100644 --- a/src/sage/doctest/parsing.py +++ b/src/sage/doctest/parsing.py @@ -388,7 +388,7 @@ def make_marked_output(s, D): return ans -class OriginalSource(object): +class OriginalSource(): r""" Context swapping out the pre-parsed source with the original for better reporting. diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py index f9470e14d2e..d0f2103c203 100644 --- a/src/sage/doctest/sources.py +++ b/src/sage/doctest/sources.py @@ -109,7 +109,7 @@ def get_basename(path): return fully_qualified_path.replace(os.path.sep, '.') -class DocTestSource(object): +class DocTestSource(): """ This class provides a common base class for different sources of doctests. @@ -1065,7 +1065,7 @@ def starting_docstring(self, line): sage: FDS.ending_docstring("'''") <...Match object...> sage: FDS.qualified_name = NestedName(FDS.basename) - sage: FDS.starting_docstring("class MyClass(object):") + sage: FDS.starting_docstring("class MyClass():") sage: FDS.starting_docstring(" def hello_world(self):") sage: FDS.starting_docstring(" '''") <...Match object...> @@ -1073,7 +1073,7 @@ def starting_docstring(self, line): sage.doctest.sources.MyClass.hello_world sage: FDS.ending_docstring(" '''") <...Match object...> - sage: FDS.starting_docstring("class NewClass(object):") + sage: FDS.starting_docstring("class NewClass():") sage: FDS.starting_docstring(" '''") <...Match object...> sage: FDS.ending_docstring(" '''") diff --git a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py index ec130e75a3b..bfa5e7f685d 100644 --- a/src/sage/dynamics/arithmetic_dynamics/affine_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/affine_ds.py @@ -193,7 +193,7 @@ class DynamicalSystem_affine(SchemeMorphism_polynomial_affine_space, sage: DynamicalSystem_affine(x^2+1) Traceback (most recent call last): ... - TypeError: Symbolic Ring cannot be the base ring + TypeError: symbolic ring cannot be the base ring """ @staticmethod @@ -230,7 +230,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None): sage: f = DynamicalSystem_affine([x+y+z, y*z]) Traceback (most recent call last): ... - ValueError: Number of polys does not match dimension of Affine Space of dimension 3 over Rational Field + ValueError: number of polys does not match dimension of Affine Space of dimension 3 over Rational Field :: @@ -276,7 +276,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None): polys = [PR(poly) for poly in polys] if domain is None: if isinstance(PR, sage.rings.abc.SymbolicRing): - raise TypeError("Symbolic Ring cannot be the base ring") + raise TypeError("symbolic ring cannot be the base ring") if fraction_field: PR = PR.ring() domain = AffineSpace(PR) @@ -290,17 +290,17 @@ def __classcall_private__(cls, morphism_or_polys, domain=None): except TypeError: raise TypeError('coefficients of polynomial not in {}'.format(domain.base_ring())) if len(polys) != domain.ambient_space().coordinate_ring().ngens(): - raise ValueError('Number of polys does not match dimension of {}'.format(domain)) + raise ValueError(f'number of polys does not match dimension of {domain}') R = domain.base_ring() if isinstance(R, sage.rings.abc.SymbolicRing): - raise TypeError("Symbolic Ring cannot be the base ring") + raise TypeError("symbolic ring cannot be the base ring") if not is_AffineSpace(domain) and not isinstance(domain, AlgebraicScheme_subscheme_affine): raise ValueError('"domain" must be an affine scheme') if R not in Fields(): return typecall(cls, polys, domain) if is_FiniteField(R): - return DynamicalSystem_affine_finite_field(polys, domain) + return DynamicalSystem_affine_finite_field(polys, domain) return DynamicalSystem_affine_field(polys, domain) def __init__(self, polys_or_rat_fncts, domain): diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py index ce540d77f73..0301d68b8c9 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -858,8 +858,8 @@ def __call__(self, x, type_3_pole_check=True): num = fraction[0].quo_rem(gcd)[0] dem = fraction[1].quo_rem(gcd)[0] if dem.is_zero(): - f = DynamicalSystem_affine(F[0]/F[1]).homogenize(1) - f = f.conjugate(Matrix([[0, 1], [1 , 0]])) + f = DynamicalSystem_affine(F[0] / F[1]).homogenize(1) + f = f.conjugate(Matrix([[0, 1], [1, 0]])) g = DynamicalSystem_Berkovich(f) return g(self.domain()(QQ(0), QQ(1))).involution_map() # if the reduction is not constant, the image is the Gauss point diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py index 93948cf6014..91af87e49dd 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py @@ -197,8 +197,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, [(alpha - zeta*beta), - (alpha*beta)*(1 - zeta), (1 - zeta), (alpha*zeta - beta)])) - - #now consider 2-periodic points + # now consider 2-periodic points psi = phi(phi(z)) f2 = psi.numerator() g2 = psi.denominator() @@ -252,7 +251,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, a = F(a) d = F(d) b = F(-alpha*beta) - s = ( a*z + b)/(z + d) + s = (a * z + b) / (z + d) if s(phi(z)) == phi(s(z)): if return_functions: elements.append(K(s)) @@ -268,7 +267,7 @@ def automorphism_group_QQ_fixedpoints(rational_function, return_functions=False, a = F(a) d = F(d) b = F(-alpha*beta) - s = ( a*z + b)/(z + d) + s = (a * z + b) / (z + d) if s(phi(z)) == phi(s(z)): if return_functions: elements.append(K(s)) @@ -534,7 +533,7 @@ def valid_automorphisms(automorphisms_CRT, rational_function, ht_bound, M, for x in init_lift] g = gcd(new_lift) new_lift = [x // g for x in new_lift] - if all(abs(x) <= ht_bound for x in new_lift): + if all(abs(x) <= ht_bound for x in new_lift): a, b, c, d = new_lift f = (a*z + b) / (c*z + d) if rational_function(f(z)) == f(rational_function(z)): @@ -1004,9 +1003,10 @@ def rational_function_coefficient_descent(rational_function, sigma, poly_ring): return z = poly_ring.gen(0) - numer = sum( poly_ring(ff[i])*z**fe[i] for i in range(len(ff)) ) - denom = sum( poly_ring(gg[i])*z**ge[i] for i in range(len(gg)) ) - return numer / denom + numer = sum(poly_ring(ff[i]) * z**fe[i] for i in range(len(ff))) + denom = sum(poly_ring(gg[i]) * z**ge[i] for i in range(len(gg))) + return numer / denom + def rational_function_coerce(rational_function, sigma, S_polys): r""" @@ -1626,7 +1626,7 @@ def automorphism_group_FF_alg3(rational_function): if n%p == 1: automorphisms = automorphisms + order_p_automorphisms(phi, pre_images) - ## nontrivial elements with order prime to p ## + # nontrivial elements with order prime to p # # case of 2 F-rational fixed points for pt_pair in combinations(linear_fix_pts, 2): x = pt_pair[0] @@ -1756,7 +1756,7 @@ def which_group(list_of_elements): for i in range(n-1): h = g(H[-1]) H.append(h) - H = list(set(H)) + H = list(set(H)) if len(H) == n: return 'Cyclic of order {0}'.format(n) if len(H) > max_reg_cyclic[0] and gcd(len(H), p) != p: @@ -2017,7 +2017,7 @@ def conjugating_set_initializer(f, g): # in which all subsets of size n+1 are linearly independent, # then we fail as we cannot specify conjugations if more: - raise ValueError('no more rational preimages. try extending the base field and trying again.') + raise ValueError('no more rational preimages; try extending the base field and trying again') # if we need to add more preimages, we update loop dictionaries if more: diff --git a/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py b/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py index 06890a8eb02..9c6d5a2dd52 100644 --- a/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py +++ b/src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py @@ -548,7 +548,7 @@ def BM_all_minimal(vp, return_transformation=False, D=None): z = aff_map.domain().gen(0) Res = mp.resultant() - ##### because of how the bound is compute in lemma 3.3 + # because of how the bound is compute in lemma 3.3 from sage.dynamics.arithmetic_dynamics.affine_ds import DynamicalSystem_affine h = f - z*g A = AffineSpace(BR, 1, h.parent().variable_name()) @@ -1121,14 +1121,14 @@ def coshdelta(z): G, g, v, rep, M, D, label = pts.pop() # apply ST and keep z, Sz if D > R: - break #all remaining pts are too far away + break # all remaining pts are too far away # check if it is smaller. If so, we can improve the bound count += 1 new_size = e**g.global_height(prec=prec) if new_size < current_size: - current_min = [G ,g, v, rep, M, coshdelta(v)] + current_min = [G, g, v, rep, M, coshdelta(v)] current_size = new_size - if new_size == 1: # early exit + if new_size == 1: # early exit return [current_min[1], current_min[4]] new_R = get_bound_dynamical(G, g, m=n, dynatomic=dynatomic, prec=prec, emb=emb) if new_R < R: @@ -1156,4 +1156,3 @@ def coshdelta(z): pts = insert_item(pts, new_pt, 5) return [current_min[1], current_min[4]] - diff --git a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py index b3b66856b5c..3e227942256 100644 --- a/src/sage/dynamics/arithmetic_dynamics/generic_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/generic_ds.py @@ -401,7 +401,7 @@ def field_of_definition_critical(self, return_embedding=False, simplify_all=Fals space = ds.domain().ambient_space() K = ds.base_ring() if space.dimension() != 1: - raise ValueError('Ambient space of dynamical system must be either the affine line or projective line') + raise ValueError('ambient space of dynamical system must be either the affine line or projective line') if isinstance(K, (AlgebraicClosureFiniteField_generic, AlgebraicField_common)): if return_embedding: return (K, K.hom(K)) diff --git a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py index 825fdf9187a..867d571db0d 100644 --- a/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/product_projective_ds.py @@ -278,18 +278,18 @@ def nth_iterate_map(self, n): PHI = list(Coord_ring.gens()) while D: - if D&1: + if D & 1: PHI = [poly(*F) for poly in PHI] - if D > 1: #avoid extra iterate - F = [poly(*F) for poly in F] #'square' + if D > 1: # avoid extra iterate + F = [poly(*F) for poly in F] # 'square' D >>= 1 return DynamicalSystem_projective(PHI, domain=self.domain()) class DynamicalSystem_product_projective_field(DynamicalSystem_product_projective): - pass + class DynamicalSystem_product_projective_finite_field(DynamicalSystem_product_projective_field): def cyclegraph(self): @@ -331,6 +331,6 @@ def cyclegraph(self): Q = self(P) E.append([str(Q)]) else: - raise NotImplementedError("Cyclegraph for product projective spaces not implemented for subschemes") + raise NotImplementedError("cyclegraph for product projective spaces not implemented for subschemes") from sage.graphs.digraph import DiGraph return DiGraph(dict(zip(V, E)), loops=True) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index c78a7e83472..07575dc2754 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -334,7 +334,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None, names=None): sage: DynamicalSystem_projective([y, x, y], domain=P1) Traceback (most recent call last): ... - ValueError: Number of polys does not match dimension of Projective Space of dimension 1 over Rational Field + ValueError: number of polys does not match dimension of Projective Space of dimension 1 over Rational Field :: @@ -419,7 +419,7 @@ def __classcall_private__(cls, morphism_or_polys, domain=None, names=None): except TypeError: raise TypeError('coefficients of polynomial not in {}'.format(domain.base_ring())) if len(polys) != domain.ambient_space().coordinate_ring().ngens(): - raise ValueError('Number of polys does not match dimension of {}'.format(domain)) + raise ValueError(f'number of polys does not match dimension of {domain}') R = domain.base_ring() if isinstance(R, sage.rings.abc.SymbolicRing): raise TypeError("the base ring cannot be the Symbolic Ring or a symbolic subring") @@ -973,7 +973,7 @@ def nth_iterate_map(self, n, normalize=False): else: PHI = H([Coord_ring.gen(i) for i in range(N)]) while D: - if D&1: + if D & 1: PHI = PHI*F if normalize: PHI.normalize_coordinates() @@ -2029,7 +2029,7 @@ def canonical_height(self, P, **kwds): # this looks different than Wells' Algorithm because of the difference # between what Wells' calls H_infty, # and what Green's Function returns for the infinite place - h = f.green_function(Q, 0 , **kwds) - H + R(t).log() + h = f.green_function(Q, 0, **kwds) - H + R(t).log() # The value returned by Well's algorithm may be negative. As the canonical height # is always nonnegative, so if this value is within -err of 0, return 0. if h < 0: @@ -3150,10 +3150,10 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): """ n = ZZ(n) if n < 1: - raise ValueError('Period must be positive') + raise ValueError('period must be positive') m = ZZ(m) if m < 0: - raise ValueError('Preperiod must be non-negative') + raise ValueError('preperiod must be non-negative') f = self CR = f.coordinate_ring() dom = f.domain() @@ -3359,11 +3359,11 @@ def automorphism_group(self, **kwds): num_cpus = kwds.get('num_cpus', 2) if self.domain().dimension_relative() != 1: return self.conjugating_set(self, num_cpus) - if self.base_ring() != QQ and self.base_ring() != ZZ: + if self.base_ring() != QQ and self.base_ring() != ZZ: return self.conjugating_set(self, num_cpus) self.normalize_coordinates() if (self.degree() == 1) or (self.degree() == 0): - raise NotImplementedError("Rational function of degree 1 not implemented.") + raise NotImplementedError("rational function of degree 1 not implemented") f = self.dehomogenize(1) R = PolynomialRing(f.base_ring(),'x') if is_FractionFieldElement(f[0]): @@ -3748,7 +3748,6 @@ def is_dynamical_belyi_map(self): return False return True - def critical_point_portrait(self, check=True, use_algebraic_closure=True): r""" If this dynamical system is post-critically finite, return its @@ -4187,8 +4186,8 @@ def preperiodic_points(self, m, n, **kwds): f_sub = self.change_ring(R) R = f_sub.base_ring() #in the case when R is an embedding if isinstance(R, FractionField_1poly_field) or is_FunctionField(R): - raise NotImplementedError('Periodic points not implemented for function fields.' - + 'Clear denominators and use the polynomial ring instead.') + raise NotImplementedError('Periodic points not implemented for function fields; ' + 'clear denominators and use the polynomial ring instead') CR = f_sub.coordinate_ring() dom = f_sub.domain() PS = f_sub.codomain().ambient_space() @@ -4518,12 +4517,12 @@ def periodic_points(self, n, minimal=True, formal=False, R=None, algorithm='vari f_sub = self.change_ring(R) R = f_sub.base_ring() #in the case when R is an embedding if isinstance(R, FractionField_1poly_field) or is_FunctionField(R): - raise NotImplementedError('Periodic points not implemented for fraction function fields.' - + 'Clear denominators and use the polynomial ring instead.') + raise NotImplementedError('periodic points not implemented for fraction function fields; ' + 'clear denominators and use the polynomial ring instead') if is_FractionField(R): if is_MPolynomialRing(R.ring()): - raise NotImplementedError('Periodic points not implemented for fraction function fields.' - + 'Clear denominators and use the polynomial ring instead.') + raise NotImplementedError('periodic points not implemented for fraction function fields; ' + 'clear denominators and use the polynomial ring instead') CR = f_sub.coordinate_ring() dom = f_sub.domain() PS = f_sub.codomain().ambient_space() @@ -5165,7 +5164,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', Traceback (most recent call last): .. ValueError: sigma polynomial dropped degree, as multiplicities were not accounted - for correctly. try setting chow=True and/or deform=True + for correctly; try setting chow=True and/or deform=True :: @@ -5175,7 +5174,7 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', Traceback (most recent call last): .. ValueError: sigma polynomial dropped degree, as multiplicities were not accounted - for correctly. try setting chow=True and/or deform=True + for correctly; try setting chow=True and/or deform=True """ n = ZZ(n) @@ -5310,8 +5309,8 @@ def sigma_invariants(self, n, formal=False, embedding=None, type='point', else: expected_degree = sum(d**(n*i) for i in range(N+1)) if degree_w != expected_degree: - raise ValueError('sigma polynomial dropped degree, as multiplicities were not accounted for correctly.'+ - ' try setting chow=True and/or deform=True') + raise ValueError('sigma polynomial dropped degree, as multiplicities were not accounted for correctly; ' + 'try setting chow=True and/or deform=True') if return_polynomial: return sigma_polynomial # if we are returing a numerical list, read off the coefficients @@ -6932,7 +6931,7 @@ def conjugating_set(self, other, R=None, num_cpus=2): sage: D8.conjugating_set(D8) Traceback (most recent call last): ... - ValueError: no more rational preimages. try extending the base field and trying again. + ValueError: no more rational preimages; try extending the base field and trying again :: @@ -8328,7 +8327,7 @@ def automorphism_group(self, **kwds): z = f[0].parent().gen() self.normalize_coordinates() if (self.degree() == 1) or (self.degree() == 0): - raise NotImplementedError("Rational function of degree 1 not implemented.") + raise NotImplementedError("rational function of degree 1 not implemented") if f[0].denominator() != 1: F = f[0].numerator().polynomial(z) / f[0].denominator().polynomial(z) else: diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index 7e4ae461348..8f5f1f6a690 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -747,15 +747,12 @@ def is_degenerate(self): self.Hpoly(0, 0, 2), self.Hpoly(0, 1, 2)) phi = R.hom([0, 0, 0] + vars, R0) I = phi(I) - if I.dimension() != 0: - return True - return False - + return I.dimension() != 0 def degenerate_fibers(self): r""" - Function will return the (rational) degenerate fibers of the surface - defined over the base ring, or the fraction field of the base ring if it is not a field. + Return the (rational) degenerate fibers of the surface defined over + the base ring, or the fraction field of the base ring if it is not a field. ALGORITHM: @@ -828,7 +825,7 @@ def degenerate_fibers(self): J = phi1(I) if (J.dimension() == 0): Var = J.variety() - if Var != [{}]: + if Var != [{}]: for d in Var: #iterate through dictionaries P = [] #new point for z in mapvars: #assign coordinate values @@ -859,7 +856,7 @@ def degenerate_fibers(self): J = phi1(I) if (J.dimension() == 0): Var = J.variety() - if Var != [{}]: + if Var != [{}]: for d in Var: #iterate through dictionaries P = [] #new point for z in mapvars: #assign coordinate values @@ -1170,7 +1167,7 @@ def sigmaX(self, P, **kwds): e += 1 maxexp.append(e) - e = min(maxexp) + e = min(maxexp) #Fix L and Q for i in range(0,2): @@ -1423,10 +1420,10 @@ def sigmaY(self,P, **kwds): T[i] = T[i]/t**e T[i] = T[i].subs({w1:t1}) - #Defines the ideal whose solution gives `(s0,s1)` and the two points - #on the fiber - RR = PolynomialRing(BR ,5, 's0, s1, z0, z1, z2', order = 'lex') - s0,s1,z0,z1,z2 = RR.gens() + # Defines the ideal whose solution gives `(s0,s1)` and the two points + # on the fiber + RR = PolynomialRing(BR, 5, 's0, s1, z0, z1, z2', order='lex') + s0, s1, z0, z1, z2 = RR.gens() I = RR.ideal([RR(T[0]), \ RR(T[1]), \ RR(T[2]) - P[0][0]*z0, \ @@ -1448,11 +1445,11 @@ def sigmaY(self,P, **kwds): #the corresponding point on the surface if len(V) > 2: raise ValueError("cannot distinguish points in the degenerate fiber") - #We always expect to have the trivial solution (0, 0, 0) - if len(V) == 2: + # We always expect to have the trivial solution (0, 0, 0) + if len(V) == 2: for D in V: if D[s] != 0: - [a, b, c] = [D[z0], D[z1], D[z2]] + a, b, c = [D[z0], D[z1], D[z2]] else: newT = [phi(tee) for tee in T] for i in range(2): @@ -1478,10 +1475,10 @@ def sigmaY(self,P, **kwds): SS(newT[5]) - (P[0][0]*z1 + P[0][1]*z0), \ SS(newT[6]) - (P[0][0]*z2 + P[0][2]*z0), \ SS(newT[7]) - (P[0][1]*z2 + P[0][2]*z1)]) - #Find the points - SSS = PolynomialRing(BR, 3, 'z0, z1, z2',order = 'lex') - z0,z1,z2 = SSS.gens() - phi = SS.hom([0, z0, z1 ,z2], SSS) + # Find the points + SSS = PolynomialRing(BR, 3, 'z0, z1, z2', order='lex') + z0, z1, z2 = SSS.gens() + phi = SS.hom([0, z0, z1, z2], SSS) J2 = phi(II) if J2.dimension() > 0: raise ValueError("cannot distinguish points in the degenerate fiber") @@ -2101,21 +2098,27 @@ def fiber(self, p, component): elif self.Hpoly(component, 0, 1)(P0) != 0: if component == 1: Points.append(P+[Zero, One, Zero]) - Points.append(P+[-self.Hpoly(component, 0, 1)(P0),Zero,-self.Hpoly(component, 1, 2)(P0)]) + Points.append(P+[-self.Hpoly(component, 0, 1)(P0),Zero, + -self.Hpoly(component, 1, 2)(P0)]) Points.append(P+[One,Zero,Zero]) - Points.append(P+[Zero,-self.Hpoly(component, 0, 1)(P0),-self.Hpoly(component, 0, 2)(P0)]) + Points.append(P+[Zero,-self.Hpoly(component, 0, 1)(P0), + -self.Hpoly(component, 0, 2)(P0)]) else: Points.append([Zero,One,Zero]+P) - Points.append([-self.Hpoly(component, 0, 1)(P0),Zero,-self.Hpoly(component, 1, 2)(P0)] + P) + Points.append([-self.Hpoly(component, 0, 1)(P0),Zero, + -self.Hpoly(component, 1, 2)(P0)] + P) Points.append([One,Zero,Zero]+P) - Points.append([Zero,-self.Hpoly(component, 0, 1)(P0),-self.Hpoly(component, 0, 2)(P0)] + P) + Points.append([Zero,-self.Hpoly(component, 0, 1)(P0), + -self.Hpoly(component, 0, 2)(P0)] + P) elif self.Hpoly(component, 0, 2)(P0) != 0: if component == 1: Points.append(P+[Zero, Zero, One]) - Points.append(P+[-self.Hpoly(component, 0, 2)(P0),-self.Hpoly(component, 1, 2)(P0), Zero]) + Points.append(P+[-self.Hpoly(component, 0, 2)(P0), + -self.Hpoly(component, 1, 2)(P0), Zero]) else: Points.append([Zero, Zero, One]+P) - Points.append([-self.Hpoly(component, 0, 2)(P0),-self.Hpoly(component, 1, 2)(P0), Zero]+ P) + Points.append([-self.Hpoly(component, 0, 2)(P0), + -self.Hpoly(component, 1, 2)(P0), Zero] + P) elif self.Hpoly(component, 1, 2)(P0) != 0: if component == 1: Points.append(P + [Zero, Zero, One]) @@ -2487,12 +2490,13 @@ def cardinality( self): """ def getPx1(): return ([x, y, 1] for x in self.base_ring() for y in self.base_ring()) + def getPx2(): return ([x, 1, 0] for x in self.base_ring()) Count = 0 Xpoint = [1, 0, 0] Ypoint = [1, 0, 0] - #Create all possible Px1 Values + # Create all possible Px1 Values for i in getPx1(): for j in getPx1(): A = i + j diff --git a/src/sage/dynamics/cellular_automata/all.py b/src/sage/dynamics/cellular_automata/all.py index 792411f5b75..9f13ad1c13a 100644 --- a/src/sage/dynamics/cellular_automata/all.py +++ b/src/sage/dynamics/cellular_automata/all.py @@ -3,4 +3,3 @@ from sage.misc.lazy_import import lazy_import lazy_import("sage.dynamics.cellular_automata.solitons", ["SolitonCellularAutomata", "PeriodicSolitonCellularAutomata"]) - diff --git a/src/sage/dynamics/cellular_automata/elementary.py b/src/sage/dynamics/cellular_automata/elementary.py index c51b7d3377e..cd0915cdde7 100644 --- a/src/sage/dynamics/cellular_automata/elementary.py +++ b/src/sage/dynamics/cellular_automata/elementary.py @@ -388,12 +388,13 @@ def evolve(self, number=None): X X XX """ if number is not None: - for k in range(number): + for _ in range(number): self.evolve() return prev_state = self._states[-1] next_state = [None] * self._width + def to_int(triple): return ZZ(list(reversed(triple)), base=2) if self._bdry is None: @@ -582,7 +583,7 @@ def _unicode_art_(self): █ █ █ █ █ █ █ █ ███ ███ ███ ███ ███ ███ ███ ██ """ - return UnicodeArt([u''.join(u'█' if x else u' ' for x in state) + return UnicodeArt([''.join('█' if x else ' ' for x in state) for state in self._states]) def plot(self, number=None): diff --git a/src/sage/dynamics/cellular_automata/glca.py b/src/sage/dynamics/cellular_automata/glca.py index af47f66d360..46b24619ac2 100644 --- a/src/sage/dynamics/cellular_automata/glca.py +++ b/src/sage/dynamics/cellular_automata/glca.py @@ -196,14 +196,14 @@ def evolve(self, number=None): o o o o o o o """ if number is not None: - for k in range(number): + for _ in range(number): self.evolve() return prev_state = self._states[-1] next_state = [0] * (len(prev_state) + 2) - for i,val in enumerate(prev_state): + for i, val in enumerate(prev_state): next_state[i] += self._rule[val] & 0x1 next_state[i+1] += self._rule[val] & 0x2 next_state[i+2] += self._rule[val] & 0x4 @@ -475,4 +475,3 @@ def _latex_(self): x -= 1 ret += "\\end{tikzpicture}" return ret - diff --git a/src/sage/dynamics/cellular_automata/solitons.py b/src/sage/dynamics/cellular_automata/solitons.py index 5113084f8d6..7ae254ed69f 100644 --- a/src/sage/dynamics/cellular_automata/solitons.py +++ b/src/sage/dynamics/cellular_automata/solitons.py @@ -515,7 +515,7 @@ def evolve(self, carrier_capacity=None, carrier_index=None, number=None): carrier_index = self._vacuum if number is not None: - for k in range(number): + for _ in range(number): self.evolve(carrier_capacity, carrier_index) return @@ -1398,7 +1398,7 @@ def evolve(self, carrier_capacity=None, carrier_index=None, number=None): carrier_index = self._vacuum if number is not None: - for k in range(number): + for _ in range(number): self.evolve(carrier_capacity, carrier_index) return if carrier_capacity is None: diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia.py b/src/sage/dynamics/complex_dynamics/mandel_julia.py index 0dcee498874..224a484c7bb 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia.py +++ b/src/sage/dynamics/complex_dynamics/mandel_julia.py @@ -185,7 +185,7 @@ def mandelbrot_plot(f=None, **kwds): sage: mandelbrot_plot(f, interact=True) Traceback (most recent call last): ... - NotImplementedError: Interact only implemented for z^2 + c + NotImplementedError: interact only implemented for z^2 + c """ parameter = kwds.pop("parameter", None) x_center = kwds.pop("x_center", 0.0) @@ -275,7 +275,7 @@ def mandelbrot_plot(f=None, **kwds): base_color) else: if interacts: - raise NotImplementedError("Interact only implemented for z^2 + c") + raise NotImplementedError("interact only implemented for z^2 + c") else: # Set default of max_iteration to 50 for general polynomial maps # This prevents the function from being very slow by default @@ -694,11 +694,9 @@ def julia_plot(f=None, **kwds): R = f.parent() if not (R.is_integral_domain() and (CC.is_subring(R) or CDF.is_subring(R))): - raise ValueError('Given `f` must be a complex polynomial.') - else: - raise NotImplementedError( - 'Julia sets not implemented for rational functions.' - ) + raise ValueError('given `f` must be a complex polynomial') + raise NotImplementedError( + 'Julia sets not implemented for rational functions') if (f_poly - z*z) in CC: # f is specified and of the form z^2 + c. f_is_default_after_all = True @@ -757,13 +755,12 @@ def julia_plot(f=None, **kwds): return interact(**widgets).widget(julia_helper) else: return interact(**widgets).widget(fast_julia_plot) - elif mandelbrot: # non-interactive with mandelbrot + elif mandelbrot: # non-interactive with mandelbrot return julia_helper(c_real, c_imag, x_center, y_center, image_width, max_iteration, pixel_count, level_sep, number_of_colors, base_color, point_color) - else: # non-interactive without mandelbrot + else: # non-interactive without mandelbrot return fast_julia_plot(c_real, c_imag, x_center, y_center, image_width, max_iteration, pixel_count, level_sep, number_of_colors, base_color) - diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx index 882cc6ada08..1189b55fec9 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +++ b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx @@ -746,7 +746,7 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, # Split function into real and imaginary parts R = PolynomialRing(CC, [variable,parameter]) if len(R.gens()) > 2: - raise NotImplementedError("Base ring must have only 2 variables") + raise NotImplementedError("base ring must have only 2 variables") z, c = R.gens() f = R(str(f)) S = PolynomialRing(f.base_ring(), 'x,y,J,cr,ci') diff --git a/src/sage/dynamics/finite_dynamical_system.py b/src/sage/dynamics/finite_dynamical_system.py index b7710f0e8ae..e5fbf568b7e 100644 --- a/src/sage/dynamics/finite_dynamical_system.py +++ b/src/sage/dynamics/finite_dynamical_system.py @@ -459,6 +459,7 @@ def evolution_power(self, n): if n not in NN: raise ValueError("the n-th power of evolution is only defined for nonnegative integers n") ev = self.evolution() + def evn(x): y = x for _ in range(n): @@ -820,6 +821,7 @@ def evolution_power(self, n): else: ev = self.inverse_evolution() n = -n + def evn(x): y = x for _ in range(n): @@ -1249,4 +1251,3 @@ def orbit_lengths(self): [2, 2, 2] """ return [len(orb) for orb in self.orbits()] - diff --git a/src/sage/dynamics/finite_dynamical_system_catalog.py b/src/sage/dynamics/finite_dynamical_system_catalog.py index fc925c2d5cf..3ba09eb9948 100755 --- a/src/sage/dynamics/finite_dynamical_system_catalog.py +++ b/src/sage/dynamics/finite_dynamical_system_catalog.py @@ -83,12 +83,14 @@ def one_line(xs): [2] """ n = len(xs) - X = range(1, n+1) + X = range(1, n + 1) xs2 = tuple(xs) + def pi(i): return xs2[i - 1] return FiniteDynamicalSystem(X, pi, create_tuple=True) + def bitstring_rotation(n, ones=None): r""" Return the invertible finite discrete dynamical system @@ -231,12 +233,14 @@ def striker_sweep(E, predicate, elements, lazy=False): from sage.combinat.subset import Subsets from sage.sets.set import Set X = [F for F in Subsets(E) if predicate(F)] + def phi(F): for e in elements: G = F.symmetric_difference(Set([e])) if predicate(G): F = G return F + def psi(F): for e in reversed(elements): G = F.symmetric_difference(Set([e])) @@ -245,6 +249,7 @@ def psi(F): return F return InvertibleFiniteDynamicalSystem(X, phi, inverse=psi) + def syt_promotion(lam): r""" Return the invertible finite discrete dynamical system @@ -266,10 +271,12 @@ def syt_promotion(lam): True """ from sage.combinat.partition import Partition - lam = Partition(lam) from sage.combinat.tableau import StandardTableaux + lam = Partition(lam) X = StandardTableaux(lam) - return InvertibleFiniteDynamicalSystem(X, lambda T : T.promotion(), inverse=lambda T : T.promotion_inverse()) + return InvertibleFiniteDynamicalSystem(X, lambda T: T.promotion(), + inverse=lambda T: T.promotion_inverse()) + def order_ideal_rowmotion(P): r""" @@ -361,9 +368,9 @@ def bulgarian_solitaire(n): """ from sage.combinat.partition import Partition, Partitions X = Partitions(n) + def phi(lam): mu = [p - 1 for p in lam if p > 0] nu = sorted(mu + [len(lam)], reverse=True) return Partition(nu) return FiniteDynamicalSystem(X, phi) - diff --git a/src/sage/ext/fast_callable.pyx b/src/sage/ext/fast_callable.pyx index 888275e7a78..8582818697e 100644 --- a/src/sage/ext/fast_callable.pyx +++ b/src/sage/ext/fast_callable.pyx @@ -443,6 +443,7 @@ def fast_callable(x, domain=None, vars=None, vars = ['EXTRA_VAR0'] else: raise ValueError("list of variables must be specified for symbolic expressions") + def to_var(var): if isinstance(var, Expression_abc) and var.is_symbol(): return var diff --git a/src/sage/features/csdp.py b/src/sage/features/csdp.py index d08c0089cf9..e86ec415d09 100644 --- a/src/sage/features/csdp.py +++ b/src/sage/features/csdp.py @@ -6,7 +6,6 @@ import os import re import subprocess -from sage.cpython.string import bytes_to_str from . import Executable, FeatureTestResult @@ -44,6 +43,8 @@ def is_functional(self): FeatureTestResult('csdp', True) """ from sage.misc.temporary_file import tmp_filename + from sage.cpython.string import bytes_to_str + tf_name = tmp_filename() with open(tf_name, 'wb') as tf: tf.write("2\n1\n1 1".encode()) diff --git a/src/sage/geometry/integral_points.pyx b/src/sage/geometry/integral_points.pyx index dbacf395c9c..f8325eea1ed 100644 --- a/src/sage/geometry/integral_points.pyx +++ b/src/sage/geometry/integral_points.pyx @@ -49,12 +49,12 @@ from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense ## # R*Rinv == diagonal_matrix([d]*D.ncols() + [0]*(D.nrows()-D.ncols())) ## # If R is full rank, this is Rinv = matrix(ZZ, R.inverse() * d) ## Dinv = D.transpose() -## for i in range(0,D.ncols()): +## for i in range(D.ncols()): ## Dinv[i,i] = d/D[i,i] ## Rinv = V * Dinv * U ## ## gens = [] -## for b in CartesianProduct(*[ range(0,i) for i in e ]): +## for b in CartesianProduct(*[ range(i) for i in e ]): ## # this is our generator modulo the lattice spanned by the rays ## gen_mod_rays = sum( b_i*u_i for b_i, u_i in zip(b,u) ) ## q_times_d = Rinv * gen_mod_rays @@ -175,7 +175,7 @@ cpdef tuple ray_matrix_normal_form(R): if d == ZZ.zero(): raise ValueError('The spanning points are not linearly independent!') cdef int i - Dinv = diagonal_matrix(ZZ, [ d // e[i] for i in range(0,D.ncols()) ]) + Dinv = diagonal_matrix(ZZ, [ d // e[i] for i in range(D.ncols()) ]) VDinv = V * Dinv return (e, d, VDinv) @@ -224,20 +224,20 @@ cpdef tuple loop_over_parallelotope_points(e, d, Matrix_integer_dense VDinv, cdef list gens = [] gen = lattice(ZZ.zero()) cdef Vector_integer_dense q_times_d = vector(ZZ, dim) - for base in itertools.product(*[ range(0,i) for i in e ]): - for i in range(0, dim): + for base in itertools.product(*[ range(i) for i in e ]): + for i in range(dim): s = ZZ.zero() - for j in range(0, dim): + for j in range(dim): s += VDinv.get_unsafe(i,j) * base[j] q_times_d.set_unsafe(i, s % d) - for i in range(0, ambient_dim): + for i in range(ambient_dim): s = ZZ.zero() - for j in range(0, dim): + for j in range(dim): s += R.get_unsafe(i,j) * q_times_d.get_unsafe(j) gen[i] = s / d if A is not None: s = ZZ.zero() - for i in range(0, ambient_dim): + for i in range(ambient_dim): s += A[i] * gen[i] if s > b: continue @@ -341,7 +341,7 @@ cdef translate_points(v_list, Vector_integer_dense delta): cdef int dim = delta.degree() cdef int i for v in v_list: - for i in range(0,dim): + for i in range(dim): v[i] -= delta.get_unsafe(i) @@ -549,7 +549,7 @@ cpdef rectangular_box_points(list box_min, list box_max, assert not (count_only and return_saturated) cdef int d = len(box_min) cdef int i, j - cdef list diameter = sorted([ (box_max[i]-box_min[i], i) for i in range(0,d) ], + cdef list diameter = sorted([ (box_max[i]-box_min[i], i) for i in range(d) ], reverse=True) cdef list diameter_value = [x[0] for x in diameter] cdef list diameter_index = [x[1] for x in diameter] @@ -790,7 +790,7 @@ cdef class Inequality_generic: 'generic: (2, 3, 7) x + -5 >= 0' """ s = 'generic: (' - s += ', '.join([str(self.A[i]) for i in range(0,len(self.A))]) + s += ', '.join(str(self.A[i]) for i in range(len(self.A))) s += ') x + ' + str(self.b) + ' >= 0' return s diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 02ebcf1c79d..9811970ed29 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -1247,6 +1247,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Getting the indices of the `i`-th edge. def vertex_one(size_t i): return f(self._get_edge(self._edges, i, 0)) + def vertex_two(size_t i): return f(self._get_edge(self._edges, i, 1)) @@ -1472,6 +1473,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Getting the indices of the `i`-th ridge. def facet_one(size_t i): return f(self._get_edge(self._ridges, i, 0)) + def facet_two(size_t i): return f(self._get_edge(self._ridges, i, 1)) @@ -2916,6 +2918,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Getting the indices of the `i`-th incidence. def face_one(size_t i): return smallInteger(self._get_edge(incidences, i, 0)) + def face_two(size_t i): return smallInteger(self._get_edge(incidences, i, 1)) diff --git a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py index e3b55989563..cd97821a951 100644 --- a/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py +++ b/src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py @@ -83,6 +83,13 @@ def __classcall__(cls, base_ring, dimension, basis, category=None): """ if isinstance(basis, list): basis = tuple(basis) + if isinstance(basis, tuple): #To make sure it only check for finite input + from sage.geometry.polyhedron.base import Polyhedron_base + for P in basis: + if not isinstance(P, Polyhedron_base): + raise TypeError(f"{P} is not a polyhedron") + if P.ambient_space().dimension() != dimension: + raise TypeError(f"{P} does not belong to the ambient space") if category is None: category = GradedModulesWithBasis(base_ring) return super(FormalPolyhedraModule, cls).__classcall__(cls, diff --git a/src/sage/geometry/toric_lattice.py b/src/sage/geometry/toric_lattice.py index de6880174aa..203f7f63223 100644 --- a/src/sage/geometry/toric_lattice.py +++ b/src/sage/geometry/toric_lattice.py @@ -431,7 +431,7 @@ def __call__(self, *args, **kwds): sage: N2( Q.an_element() ) N2(1, 0) """ - supercall = super(ToricLattice_generic, self).__call__ + supercall = super().__call__ if args == (0, ): # Special treatment for N(0) to return (0,...,0) return supercall(*args, **kwds) @@ -474,7 +474,7 @@ def _coerce_map_from_(self, other): if (is_ToricLattice(other) and other.ambient_module() is not self.ambient_module()): return None - return super(ToricLattice_generic, self)._convert_map_from_(other) + return super()._convert_map_from_(other) def __contains__(self, point): r""" @@ -578,7 +578,7 @@ def direct_sum(self, other): [0 0 0 0 1] """ if not isinstance(other, ToricLattice_generic): - return super(ToricLattice_generic, self).direct_sum(other) + return super().direct_sum(other) def make_name(N1, N2, use_latex=False): if use_latex: @@ -630,7 +630,7 @@ def intersection(self, other): raise ValueError("%s and %s have different ambient lattices!" % (self, other)) # Construct a generic intersection, but make sure to return a lattice. - I = super(ToricLattice_generic, self).intersection(other) + I = super().intersection(other) if not is_ToricLattice(I): I = self.ambient_module().submodule(I.basis()) return I @@ -755,7 +755,7 @@ def saturation(self): sage: Ns_sat is Ns_sat.saturation() True """ - S = super(ToricLattice_generic, self).saturation() + S = super().saturation() return S if is_ToricLattice(S) else self.ambient_module().submodule(S) def span(self, gens, base_ring=ZZ, *args, **kwds): @@ -803,8 +803,7 @@ def span(self, gens, base_ring=ZZ, *args, **kwds): if is_ToricLatticeElement(g) and g not in A: raise ValueError("%s cannot generate a sublattice of %s" % (g, A)) - return super(ToricLattice_generic, self).span(gens, base_ring, - *args, **kwds) + return super().span(gens, base_ring, *args, **kwds) def span_of_basis(self, basis, base_ring=ZZ, *args, **kwds): r""" @@ -858,8 +857,7 @@ def span_of_basis(self, basis, base_ring=ZZ, *args, **kwds): if is_ToricLatticeElement(g) and g not in A: raise ValueError("%s cannot generate a sublattice of %s" % (g, A)) - return super(ToricLattice_generic, self).span_of_basis( - basis, base_ring, *args, **kwds) + return super().span_of_basis(basis, base_ring, *args, **kwds) @richcmp_method @@ -895,7 +893,7 @@ def __init__(self, rank, name, dual_name, latex_name, latex_dual_name): sage: ToricLattice(3, "N", "M", "N", "M") 3-d lattice N """ - super(ToricLattice_ambient, self).__init__(ZZ, rank) + super().__init__(ZZ, rank) self._name = name self._dual_name = dual_name self._latex_name = latex_name @@ -1490,7 +1488,7 @@ def __init__(self, V, W, check=True, positive_point=None, positive_dual_point=No W = V.submodule(W) except (TypeError, ArithmeticError): raise ArithmeticError("W must be a sublattice of V") - super(ToricLattice_quotient, self).__init__(V, W, check, **kwds) + super().__init__(V, W, check, **kwds) if (positive_point, positive_dual_point) == (None, None): self._flip_sign_of_generator = False return @@ -1799,7 +1797,7 @@ def coordinate_vector(self, x, reduce=False): sage: Q.coordinate_vector(q) (1) """ - coordinates = super(ToricLattice_quotient, self).coordinate_vector(x,reduce) + coordinates = super().coordinate_vector(x, reduce) if self._flip_sign_of_generator: assert len(coordinates) == 1, "Sign flipped for a multi-dimensional quotient!" return -coordinates diff --git a/src/sage/graphs/base/boost_graph.pyx b/src/sage/graphs/base/boost_graph.pyx index 13fc6f4d83f..fe3c6b94d6f 100644 --- a/src/sage/graphs/base/boost_graph.pyx +++ b/src/sage/graphs/base/boost_graph.pyx @@ -580,7 +580,7 @@ cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee'): # Tests for errors and trivial cases if not isinstance(g, Graph): raise TypeError("the input must be a Sage Graph") - if not algorithm in ['cuthill_mckee', 'king']: + if algorithm not in ['cuthill_mckee', 'king']: raise ValueError(f"unknown algorithm {algorithm!r}") if not g.num_edges(): return (0, list(g)) @@ -690,7 +690,7 @@ cpdef min_spanning_tree(g, if not isinstance(g, Graph): raise TypeError("the input must be a Sage Graph") - if not algorithm in ['Kruskal', 'Prim']: + if algorithm not in ['Kruskal', 'Prim']: raise ValueError("algorithm '%s' not yet implemented, please contribute" %(algorithm)) if g.allows_loops() or g.allows_multiple_edges(): @@ -2567,7 +2567,7 @@ cpdef diameter(G, algorithm=None, source=None, if algorithm is None: # default algorithm for diameter computation algorithm = 'DiFUB' - if not algorithm in ['2Dsweep', 'DiFUB']: + if algorithm not in ['2Dsweep', 'DiFUB']: raise ValueError("unknown algorithm for computing the diameter of directed graph") if source is None: diff --git a/src/sage/graphs/base/static_sparse_backend.pyx b/src/sage/graphs/base/static_sparse_backend.pyx index e6da26ea5f7..2e85c2290fe 100644 --- a/src/sage/graphs/base/static_sparse_backend.pyx +++ b/src/sage/graphs/base/static_sparse_backend.pyx @@ -1376,7 +1376,7 @@ cdef class StaticSparseBackend(CGraphBackend): for i in range(out_degree(cg.g, v)): u = cg.g.neighbors[v][i] - if not u in seen: + if u not in seen: yield self._vertex_to_labels[u] seen.add(u) @@ -1412,13 +1412,13 @@ cdef class StaticSparseBackend(CGraphBackend): if cg._directed: for i in range(out_degree(cg.g_rev, v)): u = cg.g_rev.neighbors[v][i] - if not u in seen: + if u not in seen: yield self._vertex_to_labels[u] seen.add(u) else: for i in range(out_degree(cg.g, v)): u = cg.g.neighbors[v][i] - if not u in seen: + if u not in seen: yield self._vertex_to_labels[u] seen.add(u) diff --git a/src/sage/graphs/base/static_sparse_graph.pyx b/src/sage/graphs/base/static_sparse_graph.pyx index b5b07c1fa89..2ca7956654d 100644 --- a/src/sage/graphs/base/static_sparse_graph.pyx +++ b/src/sage/graphs/base/static_sparse_graph.pyx @@ -1215,7 +1215,9 @@ def spectral_radius(G, prec=1e-10): v2[i] += v1[p[0]] p += 1 s += v2[i] - v3 = v1; v1 = v2; v2 = v3 + v3 = v1 + v1 = v2 + v2 = v3 sig_off() finally: diff --git a/src/sage/graphs/bipartite_graph.py b/src/sage/graphs/bipartite_graph.py index 6d95e9c07c1..2ec92b073a1 100644 --- a/src/sage/graphs/bipartite_graph.py +++ b/src/sage/graphs/bipartite_graph.py @@ -11,7 +11,7 @@ - Ryan W. Hinton (2010-03-04): overrides for adding and deleting vertices and edges -- Enjeck M. Cleopatra(2022): fixes incorrect partite sets and adds graph +- Enjeck M. Cleopatra (2022): fixes incorrect partite sets and adds graph creation from graph6 string TESTS:: @@ -20,16 +20,13 @@ sage: loads(dumps(B)) == B True -:: - sage: B = BipartiteGraph(graphs.CycleGraph(4)) sage: B == B.copy() True sage: type(B.copy()) """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008 Robert L. Miller # 2018 Julian Rüth # 2022 Enjeck M. Cleopatra @@ -40,7 +37,6 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** - from collections import defaultdict from collections.abc import Iterable import itertools @@ -48,9 +44,9 @@ from .generic_graph import GenericGraph from .graph import Graph from sage.rings.integer import Integer - from sage.misc.decorators import rename_keyword + class BipartiteGraph(Graph): r""" Bipartite graph. @@ -259,7 +255,7 @@ class BipartiteGraph(Graph): sage: B = BipartiteGraph(file_name) sage: B.is_isomorphic(H) True - + #. From a ``graph6`` string:: sage: B = BipartiteGraph('Bo') @@ -282,14 +278,14 @@ class BipartiteGraph(Graph): {0, 1, 2, 3} sage: B.right {4, 5, 6} - + :: sage: B = BipartiteGraph('Bo', partition=[[0], [1, 2]]) sage: B.left {0} sage: B.right {1, 2} - + :: sage: B = BipartiteGraph('F?^T_\n', partition=[[0, 1, 2], [3, 4, 5, 6]]) @@ -423,12 +419,12 @@ def __init__(self, data=None, partition=None, check=True, *args, **kwds): # methods; initialize left and right attributes self.left = set() self.right = set() - + # determine partitions and populate self.left and self.right if not alist_file: if partition is not None: left, right = set(partition[0]), set(partition[1]) - + # Some error checking. if left & right: raise ValueError("the parts are not disjoint") @@ -1321,7 +1317,7 @@ def matching_polynomial(self, algorithm="Godsil", name=None): n = A.ncols() b = [0] * (m + n + 1) for i in range(min(m, n) + 1): - b[m + n - 2*i] = a[i] * (-1) ** i + b[m + n - 2 * i] = a[i] * (-1)**i if name is None: name = 'x' K = PolynomialRing(A.base_ring(), name) @@ -1528,7 +1524,8 @@ def load_afile(self, fname): # read header information num_cols, num_rows = [int(_) for _ in fi.readline().split()] - max_col_degree, max_row_degree = [int(_) for _ in fi.readline().split()] + # next are max_col_degree, max_row_degree, not used + _ = [int(_) for _ in fi.readline().split()] col_degrees = [int(_) for _ in fi.readline().split()] row_degrees = [int(_) for _ in fi.readline().split()] @@ -1636,8 +1633,12 @@ def save_afile(self, fname): max_cdeg = max(self.degree(cnodes)) vnode_to_str = {v: str(i + 1) for i, v in enumerate(vnodes)} cnode_to_str = {v: str(i + 1) for i, v in enumerate(cnodes)} - vnbr_str = lambda idx: cnode_to_str[idx] - cnbr_str = lambda idx: vnode_to_str[idx] + + def vnbr_str(idx): + return cnode_to_str[idx] + + def cnbr_str(idx): + return vnode_to_str[idx] # write header information fi.write("%d %d\n" % (len(vnodes), len(cnodes))) @@ -1962,7 +1963,8 @@ class :class:`MixedIntegerLinearProgram m = networkx.bipartite.hopcroft_karp_matching(h) else: m = networkx.bipartite.eppstein_matching(h) - d.extend((u, v, g.edge_label(u,v)) for u,v in m.items() if v2int[u] < v2int[v]) + d.extend((u, v, g.edge_label(u, v)) for u, v in m.items() + if v2int[u] < v2int[v]) if value_only: return Integer(len(d)) @@ -2087,11 +2089,13 @@ def vertex_cover(self, algorithm="Konig", value_only=False, sage: all(B.vertex_cover(algorithm=algo, value_only=True) == 0 for algo in algorithms) True """ - if not algorithm == "Konig": - return Graph.vertex_cover(self, algorithm=algorithm, value_only=value_only, - reduction_rules=reduction_rules, solver=solver, - verbose=verbose, - integrality_tolerance=integrality_tolerance) + if algorithm != "Konig": + return Graph.vertex_cover(self, algorithm=algorithm, + value_only=value_only, + reduction_rules=reduction_rules, + solver=solver, + verbose=verbose, + integrality_tolerance=integrality_tolerance) if not self.is_connected(): VC = [] @@ -2346,9 +2350,9 @@ class by some canonization function `c`. If `G` and `H` are graphs, EXAMPLES:: - sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), + sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), ....: (1, 7), (1, 8), (2, 6), (2, 7), (2, 8), - ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), + ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), ....: (6, 9), (7, 9)] ) sage: C = B.canonical_label(partition=(B.left,B.right), algorithm='sage') sage: C @@ -2360,9 +2364,9 @@ class by some canonization function `c`. If `G` and `H` are graphs, :: - sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), + sage: B = BipartiteGraph( [(0, 4), (0, 5), (0, 6), (0, 8), (1, 5), ....: (1, 7), (1, 8), (2, 6), (2, 7), (2, 8), - ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), + ....: (3, 4), (3, 7), (3, 8), (4, 9), (5, 9), ....: (6, 9), (7, 9)] ) sage: C, cert = B.canonical_label(partition=(B.left,B.right), certificate=True, algorithm='sage') sage: C @@ -2389,10 +2393,10 @@ class by some canonization function `c`. If `G` and `H` are graphs, :meth:`~sage.graphs.generic_graph.GenericGraph.canonical_label()` """ - + if certificate: C, cert = GenericGraph.canonical_label(self, partition=partition, certificate=certificate, edge_labels=edge_labels, algorithm=algorithm, return_graph=return_graph) - + else: from sage.groups.perm_gps.partn_ref.refinement_graphs import search_tree from sage.graphs.graph import Graph @@ -2400,25 +2404,25 @@ class by some canonization function `c`. If `G` and `H` are graphs, from itertools import chain cert = {} - + if edge_labels or self.has_multiple_edges(): G, partition, relabeling = graph_isom_equivalent_non_edge_labeled_graph(self, partition, return_relabeling=True) G_vertices = list(chain(*partition)) - G_to = {u: i for i,u in enumerate(G_vertices)} + G_to = {u: i for i, u in enumerate(G_vertices)} H = Graph(len(G_vertices)) HB = H._backend - for u,v in G.edge_iterator(labels=False): + for u, v in G.edge_iterator(labels=False): HB.add_edge(G_to[u], G_to[v], None, False) GC = HB.c_graph()[0] partition = [[G_to[vv] for vv in cell] for cell in partition] a, b, c = search_tree(GC, partition, certificate=True, dig=False) - # c is a permutation to the canonical label of G, + # c is a permutation to the canonical label of G, # which depends only on isomorphism class of self. cert = {v: c[G_to[relabeling[v]]] for v in self} - + else: G_vertices = list(chain(*partition)) - G_to = {u: i for i,u in enumerate(G_vertices)} + G_to = {u: i for i, u in enumerate(G_vertices)} H = Graph(len(G_vertices)) HB = H._backend for u, v in self.edge_iterator(labels=False): diff --git a/src/sage/graphs/connectivity.pyx b/src/sage/graphs/connectivity.pyx index df6af77ce0d..2a17674bf4e 100644 --- a/src/sage/graphs/connectivity.pyx +++ b/src/sage/graphs/connectivity.pyx @@ -481,7 +481,7 @@ def blocks_and_cut_vertices(G, algorithm="Tarjan_Boost", sort=False): seen.add(v) # The first time we meet v - if not v in number: + if v not in number: # We number the vertices in the order they are reached # during DFS number[v] = num @@ -495,7 +495,7 @@ def blocks_and_cut_vertices(G, algorithm="Tarjan_Boost", sort=False): # If we never met w before, we remember the direction of # edge vw, and add w to the stack. - if not w in number: + if w not in number: edge_stack.append((v,w)) stack.append(w) @@ -730,7 +730,7 @@ def is_cut_edge(G, u, v=None, label=None): if g.is_directed(): # (u,v) is a cut-edge if u is not in the connected # component containing v of self-(u,v) - sol = not u in connected_component_containing_vertex(g,v) + sol = u not in connected_component_containing_vertex(g, v) else: # (u,v) is a cut-edge if there is no path from u to v in # self-(u,v) @@ -809,7 +809,7 @@ def is_cut_vertex(G, u, weak=False): if not isinstance(G, GenericGraph): raise TypeError("the input must be a Sage graph") - if not u in G: + if u not in G: raise ValueError("vertex ({0}) is not a vertex of the graph".format(repr(u))) # Initialization @@ -2118,7 +2118,7 @@ def cleave(G, cut_vertices=None, virtual_edges=True, solver=None, verbose=0, else: cut_vertices = list(cut_vertices) for u in cut_vertices: - if not u in G: + if u not in G: raise ValueError("vertex {} is not a vertex of the input graph".format(u)) H = G.copy(immutable=False) diff --git a/src/sage/graphs/digraph_generators.py b/src/sage/graphs/digraph_generators.py index 9b6209ffc2f..d464c0e090d 100644 --- a/src/sage/graphs/digraph_generators.py +++ b/src/sage/graphs/digraph_generators.py @@ -65,13 +65,14 @@ # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.cpython.string import bytes_to_str - import sys +import subprocess + +from sage.cpython.string import bytes_to_str from sage.misc.randstate import current_randstate from sage.graphs.digraph import DiGraph from sage.graphs.graph import Graph -import subprocess + class DiGraphGenerators(): r""" @@ -345,7 +346,7 @@ def Path(self, n): if n: g.add_path(list(range(n))) - g.set_pos({i: (i,0) for i in range(n)}) + g.set_pos({i: (i, 0) for i in range(n)}) return g def Paley(self, q): @@ -397,8 +398,10 @@ def Paley(self, q): raise ValueError("parameter q must be a prime power") if not mod(q, 4) == 3: raise ValueError("parameter q must be congruent to 3 mod 4") - g = DiGraph([FiniteField(q,'a'), lambda i,j: (i!=j) and (j-i).is_square()], - loops=False, name="Paley digraph with parameter {}".format(q)) + g = DiGraph([FiniteField(q, 'a'), + lambda i, j: (i != j) and (j - i).is_square()], + loops=False, + name="Paley digraph with parameter {}".format(q)) return g def TransitiveTournament(self, n): @@ -545,7 +548,7 @@ def tournaments_nauty(self, n, if strongly_connected: nauty_input += " -c" - nauty_input += " " + str(n) + " " + nauty_input += " " + str(n) + " " import shlex from sage.features.nauty import NautyExecutable @@ -979,7 +982,6 @@ def GeneralizedDeBruijn(self, n, d): GB.add_edge(u, a % n) return GB - def ImaseItoh(self, n, d): r""" Return the Imase-Itoh digraph of order `n` and degree `d`. @@ -1045,7 +1047,6 @@ def ImaseItoh(self, n, d): II.add_edge(u, a % n) return II - def Kautz(self, k, D, vertices='strings'): r""" Return the Kautz digraph of degree `d` and diameter `D`. @@ -1251,7 +1252,7 @@ def RandomDirectedAcyclicGraph(self, n, p, weight_max=None): # integers are on 31 bits. We thus set the pivot value to p*2^31 from sage.misc.prandom import randint from sage.misc.randstate import random - RAND_MAX_f = float(1<<31) + RAND_MAX_f = float(1 << 31) pp = int(round(float(p * RAND_MAX_f))) if weight_max is None: @@ -1265,11 +1266,11 @@ def RandomDirectedAcyclicGraph(self, n, p, weight_max=None): D = DiGraph(n, name=f"RandomWeightedDAG({n}, {p}, {weight_max})") D.add_edges((i, j, randint(1, weight_max)) - for i in range(n) for j in range(i) if random() < pp) + for i in range(n) for j in range(i) if random() < pp) return D - def RandomDirectedGN(self, n, kernel=lambda x:x, seed=None): + def RandomDirectedGN(self, n, kernel=lambda x: x, seed=None): r""" Return a random growing network (GN) digraph with `n` vertices. @@ -1376,7 +1377,7 @@ def RandomDirectedGNP(self, n, p, loops=False, seed=None): if seed is None: seed = current_randstate().long_seed() - return RandomGNP(n, p, directed=True, loops=loops) + return RandomGNP(n, p, directed=True, loops=loops, seed=seed) def RandomDirectedGNM(self, n, m, loops=False): r""" @@ -1672,9 +1673,11 @@ def __call__(self, vertices=None, property=lambda x: True, augment='edges', """ from copy import copy as copyfun if size is not None: - extra_property = lambda x: x.size() == size + def extra_property(x): + return x.size() == size else: - extra_property = lambda x: True + def extra_property(x): + return True if augment == 'vertices': if vertices is None: raise NotImplementedError diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 9457a8be9fa..efdb9e9b44f 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -7588,7 +7588,7 @@ def cores(self, k=None, with_labels=False): return list(core.values()) @doc_index("Leftovers") - def modular_decomposition(self, algorithm='habib', style='tuple'): + def modular_decomposition(self, algorithm=None, style='tuple'): r""" Return the modular decomposition of the current graph. @@ -7597,18 +7597,10 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): module or to none of them. Every graph that has a nontrivial module can be partitioned into modules, and the increasingly fine partitions into modules form a tree. The ``modular_decomposition`` function returns - that tree. + that tree, using an `O(n^3)` algorithm of [HM1979]_. INPUT: - - ``algorithm`` -- string (default: ``'habib'``); specifies the - algorithm to use among: - - - ``'tedder'`` -- linear time algorithm of [TCHP2008]_ - - - ``'habib'`` -- `O(n^3)` algorithm of [HM1979]_. This algorithm is - much simpler and so possibly less prone to errors. - - ``style`` -- string (default: ``'tuple'``); specifies the output format: @@ -7688,14 +7680,9 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): sage: g = graphs.CompleteGraph(5) sage: g.add_edge(0,5) sage: g.add_edge(0,6) - sage: g.modular_decomposition(algorithm='habib') + sage: g.modular_decomposition() (SERIES, [(PARALLEL, [(SERIES, [1, 2, 3, 4]), 5, 6]), 0]) - We get an equivalent tree when we use the algorithm of [TCHP2008]_:: - - sage: g.modular_decomposition(algorithm='tedder') - (SERIES, [(PARALLEL, [(SERIES, [4, 3, 2, 1]), 5, 6]), 0]) - We can choose output to be a :class:`~sage.combinat.rooted_tree.LabelledRootedTree`:: @@ -7712,10 +7699,7 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): ALGORITHM: - When ``algorithm='tedder'`` this function uses python implementation of - algorithm published by Marc Tedder, Derek Corneil, Michel Habib and - Christophe Paul [TCHP2008]_. When ``algorithm='habib'`` this function - uses the algorithm of M. Habib and M. Maurer [HM1979]_. + This function uses the algorithm of M. Habib and M. Maurer [HM1979]_. .. SEEALSO:: @@ -7723,28 +7707,25 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): - :class:`~sage.combinat.rooted_tree.LabelledRootedTree`. + .. NOTE:: + + A buggy implementation of linear time algorithm from [TCHP2008]_ was + removed in Sage 9.7, see :trac:`25872`. + TESTS: Empty graph:: - sage: graphs.EmptyGraph().modular_decomposition(algorithm='habib') - () - sage: graphs.EmptyGraph().modular_decomposition(algorithm='tedder') + sage: graphs.EmptyGraph().modular_decomposition() () - sage: graphs.EmptyGraph().modular_decomposition(algorithm='habib', style='tree') - None[] - sage: graphs.EmptyGraph().modular_decomposition(algorithm='tedder', style='tree') + sage: graphs.EmptyGraph().modular_decomposition(style='tree') None[] Singleton Vertex:: - sage: Graph(1).modular_decomposition(algorithm='habib') + sage: Graph(1).modular_decomposition() (PRIME, [0]) - sage: Graph(1).modular_decomposition(algorithm='tedder') - (PRIME, [0]) - sage: Graph(1).modular_decomposition(algorithm='habib', style='tree') - PRIME[0[]] - sage: Graph(1).modular_decomposition(algorithm='tedder', style='tree') + sage: Graph(1).modular_decomposition(style='tree') PRIME[0[]] Vertices may be arbitrary --- check that :trac:`24898` is fixed:: @@ -7755,26 +7736,32 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): sage: sorted(md[1]) [(1, 2), (2, 3)] - Unknown algorithm:: - - sage: graphs.PathGraph(2).modular_decomposition(algorithm='abc') - Traceback (most recent call last): - ... - ValueError: algorithm must be 'habib' or 'tedder' - Unknown style:: sage: graphs.PathGraph(2).modular_decomposition(style='xyz') Traceback (most recent call last): ... ValueError: style must be 'tuple' or 'tree' + + Check that :trac:`25872` is fixed:: + + sage: G1 = Graph('FwA]w') + sage: G2 = Graph('F@Nfg') + sage: G1.is_isomorphic(G2) + True + sage: G1.modular_decomposition() + (PRIME, [1, 2, 5, 6, 0, (PARALLEL, [3, 4])]) + sage: G2.modular_decomposition() + (PRIME, [5, 6, 3, 4, 2, (PARALLEL, [0, 1])]) """ - from sage.graphs.graph_decompositions.modular_decomposition import (modular_decomposition, - NodeType, + from sage.graphs.graph_decompositions.modular_decomposition import (NodeType, habib_maurer_algorithm, create_prime_node, create_normal_node) + if algorithm is not None: + from sage.misc.superseded import deprecation + deprecation(25872, "algorithm=... parameter is obsolete and has no effect.") self._scream_if_not_simple() if not self.order(): @@ -7783,12 +7770,7 @@ def modular_decomposition(self, algorithm='habib', style='tuple'): D = create_prime_node() D.children.append(create_normal_node(self.vertices()[0])) else: - if algorithm == 'habib': - D = habib_maurer_algorithm(self) - elif algorithm == 'tedder': - D = modular_decomposition(self) - else: - raise ValueError("algorithm must be 'habib' or 'tedder'") + D = habib_maurer_algorithm(self) if style == 'tuple': if D is None: @@ -8049,23 +8031,13 @@ def is_inscribable(self, solver="ppl", verbose=0): return self.planar_dual().is_circumscribable(solver=solver, verbose=verbose) @doc_index("Graph properties") - def is_prime(self, algorithm='habib'): + def is_prime(self, algorithm=None): r""" Test whether the current graph is prime. - INPUT: - - - ``algorithm`` -- (default: ``'tedder'``) specifies the algorithm to - use among: - - - ``'tedder'`` -- Use the linear algorithm of [TCHP2008]_. - - - ``'habib'`` -- Use the $O(n^3)$ algorithm of [HM1979]_. This is - probably slower, but is much simpler and so possibly less error - prone. - A graph is prime if all its modules are trivial (i.e. empty, all of the graph or singletons) -- see :meth:`modular_decomposition`. + Use the `O(n^3)` algorithm of [HM1979]_. EXAMPLES: @@ -8086,12 +8058,15 @@ def is_prime(self, algorithm='habib'): sage: graphs.EmptyGraph().is_prime() True """ + if algorithm is not None: + from sage.misc.superseded import deprecation + deprecation(25872, "algorithm=... parameter is obsolete and has no effect.") from sage.graphs.graph_decompositions.modular_decomposition import NodeType if self.order() <= 1: return True - D = self.modular_decomposition(algorithm=algorithm) + D = self.modular_decomposition() return D[0] == NodeType.PRIME and len(D[1]) == self.order() diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index 8d6416be3bd..1fba8c13e2c 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -1501,6 +1501,7 @@ def round_robin(n): """ if n <= 1: raise ValueError("there must be at least two vertices in the graph") + def my_mod(x, y): return x - y * (x // y) if not n % 2: @@ -1701,12 +1702,14 @@ def linear_arboricity(g, plus_one=None, hex_colors=False, value_only=False, if hex_colors: answer = [[] for i in range(k)] + def add(uv, i): return answer[i].append(uv) else: gg = copy(g) gg.delete_edges(g.edge_iterator()) answer = [copy(gg) for i in range(k)] + def add(uv, i): return answer[i].add_edge(uv) @@ -1952,12 +1955,14 @@ def acyclic_edge_coloring(g, hex_colors=False, value_only=False, k=0, if hex_colors: answer = [[] for i in range(k)] + def add(uv, i): return answer[i].append(uv) else: gg = copy(g) gg.delete_edges(g.edge_iterator()) answer = [copy(gg) for i in range(k)] + def add(uv, i): return answer[i].add_edge(uv) diff --git a/src/sage/graphs/graph_decompositions/cutwidth.pyx b/src/sage/graphs/graph_decompositions/cutwidth.pyx index 9b1711107e9..3a329fbe3d3 100644 --- a/src/sage/graphs/graph_decompositions/cutwidth.pyx +++ b/src/sage/graphs/graph_decompositions/cutwidth.pyx @@ -388,7 +388,7 @@ def cutwidth(G, algorithm="exponential", cut_off=0, solver=None, verbose=False, if not isinstance(G, Graph): raise ValueError('the first parameter must be a Graph') - if not cut_off in ZZ: + if cut_off not in ZZ: raise ValueError("the specified cut off parameter must be an integer") elif G.size() <= cut_off: # We have a trivial solution @@ -502,7 +502,7 @@ def cutwidth_dyn(G, lower_bound=0): if G.order() >= 32: raise ValueError("the graph should have at most 31 vertices") - if not lower_bound in ZZ: + if lower_bound not in ZZ: raise ValueError("the specified lower bound must be an integer") cdef FastDigraph g = FastDigraph(G) diff --git a/src/sage/graphs/graph_decompositions/modular_decomposition.py b/src/sage/graphs/graph_decompositions/modular_decomposition.py index 941aaa26b29..2b96578c95b 100644 --- a/src/sage/graphs/graph_decompositions/modular_decomposition.py +++ b/src/sage/graphs/graph_decompositions/modular_decomposition.py @@ -277,2055 +277,6 @@ def __eq__(self, other): self.children == other.children) -def modular_decomposition(graph): - """ - Compute the modular decomposition tree of ``graph``. - - The tree structure is represented in form of nested lists. A tree node is - an object of type Node. The Node object further contains a list of its - children - - INPUT: - - - ``graph`` -- the graph for which modular decomposition tree needs to be - computed - - OUTPUT: - - A nested list representing the modular decomposition tree computed for the - graph - - EXAMPLES: - - The Icosahedral graph is Prime:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: print_md_tree(modular_decomposition(graphs.IcosahedralGraph())) - PRIME - 5 - 7 - 11 - 1 - 8 - 0 - 9 - 4 - 10 - 6 - 2 - 3 - - The Octahedral graph is not Prime:: - - sage: print_md_tree(modular_decomposition(graphs.OctahedralGraph())) - SERIES - PARALLEL - 2 - 3 - PARALLEL - 1 - 4 - PARALLEL - 0 - 5 - - Tetrahedral Graph is Series:: - - sage: print_md_tree(modular_decomposition(graphs.TetrahedralGraph())) - SERIES - 3 - 2 - 1 - 0 - - Modular Decomposition tree containing both parallel and series modules:: - - sage: d = {2:[4,3,5], 1:[4,3,5], 5:[3,2,1,4], 3:[1,2,5], 4:[1,2,5]} - sage: g = Graph(d) - sage: print_md_tree(modular_decomposition(g)) - SERIES - 5 - PARALLEL - 3 - 4 - PARALLEL - 1 - 2 - - TESTS: - - Bad Input:: - - sage: g = DiGraph() - sage: modular_decomposition(g) - Traceback (most recent call last): - ... - ValueError: Graph must be undirected - - Empty Graph is Prime:: - - sage: g = Graph() - sage: modular_decomposition(g) - PRIME [] - - Graph from Marc Tedder implementation of modular decomposition:: - - sage: d = {1:[5,4,3,24,6,7,8,9,2,10,11,12,13,14,16,17], 2:[1], - ....: 3:[24,9,1], 4:[5,24,9,1], 5:[4,24,9,1], 6:[7,8,9,1], - ....: 7:[6,8,9,1], 8:[6,7,9,1], 9:[6,7,8,5,4,3,1], 10:[1], - ....: 11:[12,1], 12:[11,1], 13:[14,16,17,1], 14:[13,17,1], - ....: 16:[13,17,1], 17:[13,14,16,18,1], 18:[17], 24:[5,4,3,1]} - sage: g = Graph(d) - sage: test_modular_decomposition(modular_decomposition(g), g) - True - - Graph from the :wikipedia:`Modular_decomposition`:: - - sage: d2 = {1:[2,3,4], 2:[1,4,5,6,7], 3:[1,4,5,6,7], 4:[1,2,3,5,6,7], - ....: 5:[2,3,4,6,7], 6:[2,3,4,5,8,9,10,11], - ....: 7:[2,3,4,5,8,9,10,11], 8:[6,7,9,10,11], 9:[6,7,8,10,11], - ....: 10:[6,7,8,9], 11:[6,7,8,9]} - sage: g = Graph(d2) - sage: test_modular_decomposition(modular_decomposition(g), g) - True - """ - if graph.is_directed(): - raise ValueError("Graph must be undirected") - - if not graph.order(): # Empty Graph - return create_prime_node() - - if graph.order() == 1: # Single vertex graph - root = create_normal_node(next(graph.vertex_iterator())) - return root - - if not graph.is_connected(): - - # Parallel case: the tree contains the MD trees of its connected - # components as subtrees - components = graph.connected_components() - root = create_parallel_node() - for component in components: - root.children.append(modular_decomposition(graph.subgraph(component))) - return root - elif graph.complement().is_connected(): # Prime Graph - root = create_prime_node() - else: - root = create_series_node() # Series Graph - - bfs_generator = graph.breadth_first_search(next(graph.vertex_iterator()), - report_distance=True) - - prev_level_distance = -1 # used as a demarker for different levels in bfs - prev_level_list = [] # stores the vertices in previous level - - # dictionary stores the distance of vertices from the SOURCE - vertex_dist = {} - - # dictionary stores the position of vertices w.r.t SOURCE - vertex_status = {} - vertex_status[next(graph.vertex_iterator())] = VertexPosition.SOURCE - - # Different distances from the source vertex are considered - # as different levels in the algorithm - for (vertex, distance) in bfs_generator: - vertex_dist[vertex] = distance - - # Mark the neighbours of source as LEFT_OF_SOURCE as they appear to - # left of source in the forest, other vertices are marked as - # RIGHT_OF_SOURCE - if distance == 1: - vertex_status[vertex] = VertexPosition.LEFT_OF_SOURCE - elif distance != 0: - vertex_status[vertex] = VertexPosition.RIGHT_OF_SOURCE - - if distance != prev_level_distance: # On start of new level in BFS - if prev_level_list: - # MD Tree is computed for each level and added to the forest - root.children.append(modular_decomposition(graph.subgraph(prev_level_list))) - prev_level_list = [] - prev_level_distance = distance - prev_level_list.append(vertex) - - # The last level is left out in the above loop - root.children.append(modular_decomposition(graph.subgraph(prev_level_list))) - - # The MD tree for the neighbours of source marked as LEFT_OF_SOURCE - # are placed left of Source in the forest. root.children[1] is required to - # be source and root.children[0] is required to be the MD tree for the - # neighbours therefore, the first two elements in the list are replaced - root.children[0], root.children[1] = root.children[1], root.children[0] - - root.node_type = NodeType.FOREST - clear_node_split_info(root) - number_cocomponents(root, vertex_status) - number_components(root, vertex_status) - refine(graph, root, vertex_dist, vertex_status) - promote_left(root) - promote_right(root) - promote_child(root) - assembly(graph, root, vertex_status, vertex_dist) - - if root.node_type == NodeType.FOREST: - return root.children[0] - else: - return root - - -def number_components(root, vertex_status): - """ - Number the components to the right of SOURCE vertex in the forest input to - the assembly phase - - INPUT: - - - ``root`` -- the forest which contains the components and cocomponents - - - ``vertex_status`` -- dictionary which stores the position of vertex - w.r.t SOURCE - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.append(series_node) - sage: forest.children.append(parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.RIGHT_OF_SOURCE, - ....: 5: VertexPosition.RIGHT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: number_components(forest, vertex_status) - sage: forest.children[-1].children[0].comp_num - 2 - sage: forest.children[-1].children[1].comp_num - 3 - - TESTS:: - - sage: (forest.children[-1].children[0].comp_num == 2 and - ....: forest.children[-1].children[1].comp_num == 3) - True - sage: (forest.children[-2].children[0].comp_num == 1 and - ....: forest.children[-2].children[1].comp_num == 1) - True - """ - comp_num = 0 - flag = False - - if not root: # root is empty - return ValueError("Input forest {} is empty".format(root)) - - for node in root.children: - - # flag set to True after source vertex is encountered - if (node.node_type == NodeType.NORMAL and - vertex_status[node.children[0]] == VertexPosition.SOURCE): - flag = True - continue - - if not flag: # Cocomponents are skipped - continue - - comp_num += recursively_number_parts(node, comp_num, NodeType.PARALLEL) - - -def number_cocomponents(root, vertex_status): - """ - Number the cocomponents to the left of SOURCE vertex in the forest input to - the assembly phase - - INPUT: - - - ``root`` -- the forest which contains the cocomponents and components - - - ``vertex_status`` -- dictionary which stores the position of vertex - w.r.t SOURCE - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(2, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.LEFT_OF_SOURCE, - ....: 7: VertexPosition.LEFT_OF_SOURCE} - sage: number_cocomponents(forest, vertex_status) - sage: forest.children[1].children[0].comp_num - 1 - sage: forest.children[1].children[1].comp_num - 2 - - TESTS:: - - sage: (forest.children[1].children[0].comp_num and - ....: forest.children[1].children[1].comp_num == 2) - True - sage: (forest.children[2].children[0].comp_num == 3 and - ....: forest.children[2].children[1].comp_num == 3) - True - """ - cocomp_num = 0 - for node in root.children: - # Only cocomponents are numbered - if (node.node_type == NodeType.NORMAL and - vertex_status[node.children[0]] == VertexPosition.SOURCE): - break - cocomp_num += recursively_number_parts(node, cocomp_num, NodeType.SERIES) - - -def recursively_number_parts(part_root, part_num, by_type): - """ - Recursively number the nodes in the (co)components(parts). - - If the ``node_type`` of ``part_root`` is same as ``by_type`` then - ``part_num`` is incremented for subtree at each child of ``part_root`` else - part is numbered by ``part_num``. - - INPUT: - - - ``part_root`` -- root of the part to be numbered - - - ``part_num`` -- input number to be used as reference for numbering - the (co)components - - - ``by_type`` -- type which determines how numbering is done - - OUTPUT: - - The value incremented to ``part_num``. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: recursively_number_parts(series_node, 1, NodeType.SERIES) - 2 - sage: series_node.comp_num - 1 - sage: series_node.children[0].comp_num - 1 - sage: series_node.children[1].comp_num - 2 - - TESTS:: - - sage: (series_node.comp_num == 1 and - ....: series_node.children[0].comp_num == 1 and - ....: series_node.children[1].comp_num == 2) - True - """ - # inner function - def number_subtree(subtree_root, number): - """ - set the ``comp_num`` for all the nodes in the subtree to ``number`` - - INPUT: - - - ``subtree_root`` -- root of the subtree to be numbered - - - ``number`` -- number assigned to the subtree - """ - subtree_root.comp_num = number - if subtree_root.node_type != NodeType.NORMAL: - for child in subtree_root.children: - number_subtree(child, number) - - orig_part_num = part_num - - if part_root.node_type == by_type: - # if node_type is same as tree's node_type then cocomp_num is - # incremented before assigning to each subtree - part_root.comp_num = part_num - for child in part_root.children: - number_subtree(child, part_num) - part_num += 1 - else: - # entire tree is numbered by cocomp_num - number_subtree(part_root, part_num) - part_num += 1 - return part_num - orig_part_num - - -def assembly(graph, root, vertex_status, vertex_dist): - """ - Assemble the forest obtained after the promotion phase into a modular - decomposition tree. - - INPUT: - - - ``graph`` -- graph whose MD tree is to be computed - - - ``root`` -- Forest which would be assembled into a MD tree - - - ``vertex_status`` -- Dictionary which stores the position of vertex with - respect to the source - - - ``vertex_dist`` -- Dictionary which stores the distance of vertex from - source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: forest.children[0].comp_num = 1 - sage: forest.children[1].comp_num = 1 - sage: forest.children[1].children[0].comp_num = 1 - sage: forest.children[1].children[1].comp_num = 1 - sage: number_components(forest, vertex_status) - sage: assembly(g, forest, vertex_status, vertex_dist) - sage: forest.children - [PRIME [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]]] - - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: number_cocomponents(forest, vertex_status) - sage: assembly(g, forest, vertex_status, vertex_dist) - sage: forest.children - [PRIME [NORMAL [2], SERIES [NORMAL [4], NORMAL [5], NORMAL [3]], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]]] - """ - # Maps index to the mu computed for the (co)component at the index - mu = {} - - # Stores index in the forest containing the source vertex - source_index = -1 - - # Maps index to list of vertices in the (co)component at the index - vertices_in_component = {} - - # comp_num of parent should be equal to comp_num of its first child - update_comp_num(root) - - for index, component in enumerate(root.children): - - if (component.node_type == NodeType.NORMAL and - vertex_status[component.children[0]] == VertexPosition.SOURCE): - source_index = root.children.index(component) - - vertices_in_component[index] = get_vertices(component) - component.index_in_root = index - - # compute mu values for (co)components - for index, component in enumerate(root.children): - if index < source_index: - mu[index] = compute_mu_for_co_component(graph, index, - source_index, root, - vertices_in_component) - elif index > source_index: - mu[index] = compute_mu_for_component(graph, index, - source_index, root, - vertices_in_component) - - mu[source_index] = root.children[source_index] - - # stores the leftmost cocomponent included in the module containing - # source_index - left = root.children[source_index] - - # stores the rightmost component included in the module containing - # source_index - right = root.children[source_index] - - while len(root.children) != 1: - # source_index is changed every time a new module is formed therefore - # updated. left or right are also updated every time module is formed. - - # First series module is attempted - result, source_index = check_series(root, left, right, - source_index, mu) - if result: - left = root.children[source_index].children[0] - continue - - # If series module can't be formed, parallel is tried - result, source_index = check_parallel(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component) - if result: - right = root.children[source_index].children[-1] - continue - - # Finally a prime module is formed if both - # series and parallel can not be created - result, source_index = check_prime(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component) - if result: - if root.children[source_index].children[0].index_in_root != -1: - left = root.children[source_index].children[0] - if root.children[source_index].children[-1].index_in_root != -1: - right = root.children[source_index].children[-1] - - -def update_comp_num(node): - """ - Set the ``comp_num`` of ``node`` to the ``comp_num`` of its first child. - - INPUT: - - - ``node`` -- node whose comp_num needs to be updated - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.comp_num = 2 - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: series_node.children[0].comp_num = 3 - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(0, series_node) - sage: forest.children.insert(3, parallel_node) - sage: update_comp_num(forest) - sage: series_node.comp_num - 3 - sage: forest.comp_num - 2 - """ - if node.node_type != NodeType.NORMAL: - node.comp_num = node.children[0].comp_num - for child in node.children: - update_comp_num(child) - - -def check_prime(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component): - """ - Assemble the forest to create a prime module. - - INPUT: - - - ``root`` -- forest which needs to be assembled - - - ``left`` -- the leftmost fragment of the last module - - - ``right`` -- the rightmost fragment of the last module - - - ``source_index`` -- index of the tree containing the source vertex - - - ``mu`` -- dictionary which maps the (co)components with their mu values - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``[module_formed, source_index]`` where ``module_formed`` is ``True`` if - module is formed else ``False`` and ``source_index`` is the index of the - new module which contains the source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: source_index = 2 - sage: vertices_in_component = {} - sage: mu = {} - sage: left = right = forest.children[2] - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: for index, component in enumerate(forest.children): - ....: if index < source_index: - ....: mu[index] = compute_mu_for_co_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - ....: elif index > source_index: - ....: mu[index] = compute_mu_for_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - sage: forest.children[0].comp_num = 1 - sage: forest.children[1].comp_num = 1 - sage: forest.children[1].children[0].comp_num = 1 - sage: forest.children[1].children[1].comp_num = 1 - sage: number_components(forest, vertex_status) - sage: check_prime(g, forest, left, right, - ....: source_index, mu, vertex_dist, - ....: vertices_in_component) - [True, 0] - sage: forest.children - [PRIME [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]]] - """ - # stores the index of rightmost component included in the prime module - new_right_index = source_index - if source_index + 1 < len(root.children): - new_right_index += 1 - - # stores the index of leftmost component included in the prime module - new_left_index = source_index - if source_index >= 1: - new_left_index -= 1 - - # stores the indices of the cocomponents included in the prime module - # the cocomponents are extracted one by one from left_queue for adding - # more components - left_queue = deque() - - # stores the indices of the components included in the prime module - # the components are extracted one by one from right_queue for adding - # more cocomponents - right_queue = deque() - - if new_left_index != source_index: - left_queue.append(new_left_index) - if new_right_index != source_index: - right_queue.append(new_right_index) - - while left_queue or right_queue: - - if left_queue: - - # cocomponent indices extracted from the queue - left_index = left_queue.popleft() - - # more components added based on the below condition - while (new_right_index < len(root.children) - 1 and - root.children[new_right_index].index_in_root < mu[left_index].index_in_root): - new_right_index += 1 - right_queue.append(new_right_index) - - # cocomponent added while cocomponent at left_index - # has cocomponent to its left with same comp_num - while has_left_cocomponent_fragment(root, left_index): - if left_index >= 1: - left_index -= 1 - if new_left_index > left_index: - left_queue.append(left_index) - new_left_index = min(left_index, new_left_index) - - if right_queue: - - # component indices extracted from the queue - right_index = right_queue.popleft() - - # more cocomponents added based on the below condition - while (new_left_index > 0 and - root.children[new_left_index].index_in_root > mu[right_index].index_in_root): - new_left_index -= 1 - left_queue.append(new_left_index) - - # component is added while component at right_index - # has component to its right with same comp_num - # or has a connected component with vertices at different - # level from the source vertex - while (has_right_component_fragment(root, right_index) or - has_right_layer_neighbor(graph, root, - right_index, vertex_dist, - vertices_in_component)): - - if has_right_layer_neighbor(graph, root, - right_index, vertex_dist, - vertices_in_component): - new_left_index = 0 - new_right_index = len(root.children) - 1 - break - - if right_index + 1 < len(root.children): - right_index += 1 - if new_right_index < right_index: - right_queue.append(right_index) - new_right_index = max(right_index, new_right_index) - - node = create_prime_node() - - # vertices or modules are added in the prime_module - for temp in range(new_left_index, new_right_index + 1): - node.children.append(root.children[temp]) - - # list elements included in the prime module - # are removed from the forest - root.children[new_left_index:new_right_index + 1] = [] - - #insert the newly created prime module in the forest - root.children.insert(new_left_index, node) - - return [True, new_left_index] - - -def check_parallel(graph, root, left, right, - source_index, mu, vertex_dist, - vertices_in_component): - """ - Assemble the forest to create a parallel module. - - INPUT: - - - ``root`` -- forest which needs to be assembled - - - ``left`` -- the leftmost fragment of the last module - - - ``right`` -- the rightmost fragment of the last module - - - ``source_index`` -- index of the tree containing the source vertex - - - ``mu`` -- dictionary which maps the (co)components with their mu values - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``[module_formed, source_index]`` where ``module_formed`` is ``True`` if - module is formed else ``False`` and ``source_index`` is the index of the - new module which contains the source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(4, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7), create_normal_node(1)] - sage: forest.children.insert(1, series_node) - sage: forest.children.append(parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 2} - sage: source_index = 2 - sage: vertices_in_component = {} - sage: mu = {} - sage: left = right = forest.children[2] - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: for index, component in enumerate(forest.children): - ....: if index < source_index: - ....: mu[index] = compute_mu_for_co_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - ....: elif index > source_index: - ....: mu[index] = compute_mu_for_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - sage: number_components(forest, vertex_status) - sage: check_parallel(g, forest, left, right, - ....: source_index, mu, vertex_dist, - ....: vertices_in_component) - [True, 2] - sage: forest.children - [NORMAL [2], - SERIES [NORMAL [4], NORMAL [5]], - PARALLEL [NORMAL [3], NORMAL [6], NORMAL [7], NORMAL [1]]] - """ - # stores the index of rightmost component included in the parallel module - new_right_index = source_index - - while new_right_index + 1 < len(root.children): - - # component at new_right_index + 1 is added only if it doesn't have - # a component to its right with same comp_num - if has_right_component_fragment(root, new_right_index + 1): - break - - # component at new_right_index + 1 is added only if it doesn't have a - # connected component to its right with vertices at different level - # from its vertices - if has_right_layer_neighbor(graph, root, new_right_index + 1, - vertex_dist, vertices_in_component): - break - - # stores the index in root of new component to be added in the - # parallel module - i = root.children[new_right_index + 1].index_in_root - - # condition for adding more components in the parallel module - if mu[i].index_in_root >= left.index_in_root: - new_right_index += 1 - else: - break - - # if new_right_index > source_index then only parallel - # module can be formed - if source_index != new_right_index: - node = create_parallel_node() - for temp in range(source_index, new_right_index + 1): - - # if module X to be included in the new parallel module Y is also - # parallel then children of X and not X are included in Y - if root.children[temp].node_type == NodeType.PARALLEL: - for child in root.children[temp].children: - node.children.append(child) - child.index_in_root = root.children[temp].index_in_root - else: - node.children.append(root.children[temp]) - - # list elements included in the parallel module are removed from the - # forest - root.children[source_index:new_right_index + 1] = [] - - # insert the newly created parallel module into the forest - root.children.insert(source_index, node) - - return [True, source_index] - - # no parallel module was formed - return [False, source_index] - - -def check_series(root, left, right, source_index, mu): - """ - Assemble the forest to create a series module. - - INPUT: - - - ``root`` -- forest which needs to be assembled - - - ``left`` -- The leftmost fragment of the last module - - - ``right`` -- The rightmost fragment of the last module - - - ``source_index`` -- index of the tree containing the source vertex - - - ``mu`` -- dictionary which maps the (co)components with their mu values - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``[module_formed, source_index]`` where ``module_formed`` is ``True`` if - module is formed else ``False`` and ``source_index`` is the index of the - new module which contains the source vertex - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: source_index = 2 - sage: vertices_in_component = {} - sage: mu = {} - sage: left = right = forest.children[2] - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: for index, component in enumerate(forest.children): - ....: if index < source_index: - ....: mu[index] = compute_mu_for_co_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - ....: elif index > source_index: - ....: mu[index] = compute_mu_for_component(g, index, - ....: source_index, forest, - ....: vertices_in_component) - sage: number_cocomponents(forest, vertex_status) - sage: number_components(forest, vertex_status) - sage: check_series(forest, left, right, - ....: source_index, mu) - [True, 1] - sage: forest.children - [NORMAL [2], - SERIES [NORMAL [4], NORMAL [5], NORMAL [3]], - PARALLEL [NORMAL [6], NORMAL [7]], - NORMAL [1]] - """ - # stores the index of leftmost component included in the parallel module - new_left_index = source_index - - while new_left_index > 0: - - # cocomponent at new_left_index - 1 is added only if it doesn't have - # a cocomponent to its left with same comp_num - if has_left_cocomponent_fragment(root, new_left_index - 1): - break - - # stores the index in root of new cocomponent to be added in the - # series module - i = root.children[new_left_index - 1].index_in_root - - # condition for adding more cocomponents in the series module - if mu[i].index_in_root <= right.index_in_root: - new_left_index -= 1 - else: - break - - # if new_left_index < source_index then only series module can be formed - if source_index != new_left_index: - node = create_series_node() - for temp in range(new_left_index, source_index + 1): - - if root.children[temp].node_type == NodeType.SERIES: - # if module X to be included in the new series module Y is - # also series then children of X and not X are included in Y - for child in root.children[temp].children: - child.index_in_root = root.children[temp].index_in_root - node.children.append(child) - else: - node.children.append(root.children[temp]) - - # list elements included in the series module - # are removed from the forest - root.children[new_left_index:source_index + 1] = [] - - # insert the newly created series module into the forest - root.children.insert(new_left_index, node) - - return [True, new_left_index] - - # no series module could be formed - return [False, new_left_index] - - -def has_left_cocomponent_fragment(root, cocomp_index): - """ - Check whether cocomponent at ``cocomp_index`` has a cocomponent to its left - with same ``comp_num``. - - INPUT: - - - ``root`` -- the forest to which cocomponent belongs - - - ``cocomp_index`` -- index at which cocomponent is present in root - - OUTPUT: - - ``True`` if cocomponent at ``cocomp_index`` has a cocomponent to its left with - same ``comp_num``, and ``False`` otherwise. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: forest.children[0].comp_num = 1 - sage: forest.children[1].comp_num = 1 - sage: forest.children[1].children[0].comp_num = 1 - sage: forest.children[1].children[1].comp_num = 1 - sage: has_left_cocomponent_fragment(forest, 1) - True - sage: has_left_cocomponent_fragment(forest, 0) - False - """ - return any(root.children[index].comp_num == root.children[cocomp_index].comp_num - for index in range(cocomp_index)) - -def has_right_component_fragment(root, comp_index): - """ - Check whether component at ``comp_index`` has a component to its right with - same ``comp_num``. - - INPUT: - - - ``root`` -- the forest to which component belongs - - - ``comp_index`` -- index at which component is present in root - - OUTPUT: - - ``True`` if component at ``comp_index`` has a component to its right with - same ``comp_num``, and ``False`` otherwise. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: forest.children[3].comp_num = 1 - sage: forest.children[4].comp_num = 1 - sage: has_right_component_fragment(forest, 3) - True - sage: has_right_component_fragment(forest, 4) - False - """ - return any(root.children[index].comp_num == root.children[comp_index].comp_num - for index in range(comp_index + 1, len(root.children))) - -def has_right_layer_neighbor(graph, root, comp_index, - vertex_dist, vertices_in_component): - """ - Check whether component at ``comp_index`` has a connected component to its - right with vertices at different level from the source vertex. - - INPUT: - - - ``root`` -- the forest to which component belongs - - - ``comp_index`` -- index at which component is present in root - - - ``vertex_dist`` -- dictionary which stores the distance of vertex from - source vertex - - - ``vertices_in_component`` -- dictionary which stores a list of various - vertices in a (co)component - - OUTPUT: - - ``True`` if component at ``comp_index`` has a right layer neighbor, and - ``False`` otherwise. - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - ....: component.index_in_root = index - sage: has_right_layer_neighbor(g, forest, 3, vertex_dist, - ....: vertices_in_component) - True - - """ - for index in range(comp_index + 1, len(root.children)): - - # check vertex in component at index has different level from vertex - # in component at comp_index and are connected to each other - if ((vertex_dist[get_vertex_in(root.children[index])] > - vertex_dist[get_vertex_in(root.children[comp_index])] - ) and - (is_component_connected(graph, root.children[index].index_in_root, - root.children[comp_index].index_in_root, - vertices_in_component) - )): - return True - - return False - - -def get_vertex_in(node): - """ - Return the first vertex encountered in the depth-first traversal of the - tree rooted at node - - INPUT: - - - ``tree`` -- input modular decomposition tree - - OUTPUT: - - Return the first vertex encountered in recursion - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: forest.children.insert(1, series_node) - sage: get_vertex_in(forest) - 2 - """ - while node.node_type != NodeType.NORMAL: - node = node.children[0] - return node.children[0] - -def compute_mu_for_co_component(graph, component_index, source_index, - root, vertices_in_component): - """ - Compute the mu value for co-component - - INPUT: - - - ``graph`` -- Graph whose MD tree needs to be computed - - - ``component_index`` -- index of the co-component - - - ``source_index`` -- index of the source in the forest - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``vertices_in_component`` -- dictionary which maps index i to list of - vertices in the tree at index i in the forest - - OUTPUT: - - The mu value (component in the forest) for the co-component - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - sage: compute_mu_for_co_component(g, 0, 2, forest, - ....: vertices_in_component) - NORMAL [1] - sage: compute_mu_for_co_component(g, 1, 2, forest, - ....: vertices_in_component) - NORMAL [3] - """ - for index in range(len(root.children) - 1, source_index, -1): - if is_component_connected(graph, component_index, - index, vertices_in_component): - return root.children[index] - - # return the default value - return root.children[source_index] - -def compute_mu_for_component(graph, component_index, source_index, - root, vertices_in_component): - """ - Compute the mu value for component - - INPUT: - - - ``graph`` -- Graph whose MD tree needs to be computed - - - ``component_index`` -- index of the component - - - ``source_index`` -- index of the source in the forest - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``vertices_in_component`` -- dictionary which maps index i to list of - vertices in the tree at the index i in the forest - - OUTPUT: - - The mu value (co-component in the forest) for the component - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - sage: compute_mu_for_component(g, 3, 2, forest, - ....: vertices_in_component) - SERIES [NORMAL [4], NORMAL [5]] - sage: compute_mu_for_component(g, 4, 2, forest, - ....: vertices_in_component) - NORMAL [2] - """ - # default mu value for a component - mu_for_component = root.children[0] - - for index in range(source_index): - if (mu_for_component == root.children[index] and - is_component_connected(graph, component_index, - index, vertices_in_component)): - mu_for_component = root.children[index + 1] - - # return the default value - return mu_for_component - - -def is_component_connected(graph, index1, index2, vertices_in_component): - """ - Check whether the two specified (co)components are connected. - - INPUT: - - - ``graph`` -- Graph whose MD tree needs to be computed - - - ``index1`` -- index of the first (co)component - - - ``index2`` -- index of the second (co)component - - - ``vertices_in_component`` -- dictionary which maps index i to list of - vertices in the tree at the index i in the forest - - OUTPUT: - - ``True`` if the (co)components are connected else ``False`` - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(6, 1) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertices_in_component = {} - sage: for index, component in enumerate(forest.children): - ....: vertices_in_component[index] = get_vertices(component) - sage: is_component_connected(g, 0, 1, vertices_in_component) - False - sage: is_component_connected(g, 0, 3, vertices_in_component) - True - """ - V1 = vertices_in_component[index1] - V2 = frozenset(vertices_in_component[index2]) - - return any(u in V2 for v in V1 for u in graph.neighbor_iterator(v)) - -def get_vertices(component_root): - """ - Compute the list of vertices in the (co)component - - INPUT: - - - ``component_root`` -- root of the (co)component whose vertices need to be - returned as a list - - OUTPUT: - - list of vertices in the (co)component - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: get_vertices(forest) - [2, 4, 5, 3, 6, 7, 1] - """ - vertices = [] - - # inner recursive function to recurse over the elements in the - # ``component`` - def recurse_component(node, vertices): - if node.node_type == NodeType.NORMAL: - vertices.append(node.children[0]) - return - for child in node.children: - recurse_component(child, vertices) - - recurse_component(component_root, vertices) - return vertices - -def promote_left(root): - """ - Perform the promotion phase on the forest root. - - If child and parent both are marked by LEFT_SPLIT then child is removed - and placed just before the parent - - INPUT: - - - ``root`` -- The forest which needs to be promoted - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(4, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: x = {u for u in g.neighbor_iterator(2) - ....: if vertex_dist[u] != vertex_dist[2]} - sage: maximal_subtrees_with_leaves_in_x(forest, 2, x, vertex_status, - ....: False, 0) - sage: promote_left(forest) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6]], PARALLEL [NORMAL [7]], - PARALLEL [], NORMAL [1]] - """ - q = deque() - - # q has [parent, child] elements as parent needs to be modified - for child in root.children: - q.append([root, child]) - - while q: - - parent, child = q.popleft() - - if child.node_type == NodeType.NORMAL: - continue - - # stores the elements to be removed from the child - to_remove = [] - - # stores the index of child in parent list - index = parent.children.index(child) - - for grand_child in child.children: - - # if tree and child both have LEFT_SPLIT then tree from - # child is inserted just before child in the parent - if grand_child.has_left_split() and child.has_left_split(): - parent.children.insert(index, grand_child) - index += 1 - to_remove.append(grand_child) - q.append([parent, grand_child]) - else: - q.append([child, grand_child]) - - for grand_child in to_remove: - child.children.remove(grand_child) - - -def promote_right(root): - """ - Perform the promotion phase on the forest root. - - If child and parent both are marked by RIGHT_SPLIT then child is removed - and placed just after the parent - - INPUT: - - - ``root`` -- the forest which needs to be promoted - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(4, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: refine(g, forest, vertex_dist, vertex_status) - sage: promote_right(forest) - sage: forest - FOREST [NORMAL [2], SERIES [SERIES [NORMAL [4]], SERIES [NORMAL [5]]], - NORMAL [3], PARALLEL [], PARALLEL [NORMAL [7]], - PARALLEL [NORMAL [6]], NORMAL [1]] - """ - q = deque() - - # q has [parent, child] elements as parent needs to be modified - for child in root.children: - q.append([root, child]) - - while q: - - parent, child = q.popleft() - - if child.node_type == NodeType.NORMAL: - continue - - # stores the elements to be removed from the child - to_remove = [] - - # stores the index of child in parent list - index = parent.children.index(child) - - for grand_child in child.children: - - # if tree and child both have RIGHT_SPLIT then tree from - # child is inserted just after child in the parent - if grand_child.has_right_split() and child.has_right_split(): - parent.children.insert(index + 1, grand_child) - to_remove.append(grand_child) - q.append([parent, grand_child]) - else: - q.append([child, grand_child]) - - for grand_child in to_remove: - child.children.remove(grand_child) - - -def promote_child(root): - """ - Perform the promotion phase on the forest `root`. - - If marked parent has no children it is removed, if it has one child then - it is replaced by its child - - INPUT: - - - ``root`` -- the forest which needs to be promoted - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(4, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: refine(g, forest, vertex_dist, vertex_status) - sage: promote_right(forest) - sage: promote_child(forest) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - NORMAL [7], NORMAL [6], NORMAL [1]] - """ - q = deque() - - # q has [parent, child] elements as parent needs to be modified - for child in root.children: - q.append([root, child]) - - while q: - - parent, child = q.popleft() - - if child.node_type == NodeType.NORMAL: - continue - - # if child node itself has only one child - if (len(child.children) == 1 and - (child.node_split != NodeSplit.NO_SPLIT or - child.node_type == NodeType.FOREST)): - # replace child node by its own child - - grand_child = child.children[0] - index = parent.children.index(child) - parent.children.insert(index, grand_child) - parent.children.remove(child) - q.append([parent, grand_child]) - # if child node has no children - elif ((not child.children) and child.node_split != NodeSplit.NO_SPLIT): - # remove the child node - parent.children.remove(child) - else: - for grand_child in child.children: - q.append([child, grand_child]) - - -def clear_node_split_info(root): - """ - Set the node_split of nodes to NO_SPLIT - - INPUT: - - - ``root`` -- the forest which needs to be cleared of split information - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: series_node.children[0].node_split = NodeSplit.LEFT_SPLIT - sage: series_node.node_split = NodeSplit.RIGHT_SPLIT - sage: forest.children.insert(1, series_node) - sage: clear_node_split_info(forest) - sage: series_node.node_split == NodeSplit.NO_SPLIT - True - sage: series_node.children[0].node_split == NodeSplit.NO_SPLIT - True - """ - root.node_split = NodeSplit.NO_SPLIT - - if root.node_type != NodeType.NORMAL: - for node in root.children: - clear_node_split_info(node) - - -def refine(graph, root, vertex_dist, vertex_status): - """ - Refine the forest based on the active edges - - INPUT: - - - ``graph`` -- graph whose MD tree needs to be computed - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``vertex_dist`` -- dictionary mapping the vertex with distance from the - source - - - ``vertex_status`` -- dictionary mapping the vertex to the position w.r.t. - source - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: refine(g, forest, vertex_dist, vertex_status) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [PARALLEL [NORMAL [6]], PARALLEL [NORMAL [7]]], - NORMAL [1]] - """ - x_used = [] - - # active edges of each vertex in the graph is used to refine the forest - for v in graph.vertices(): - if v in vertex_status and vertex_status[v] == VertexPosition.SOURCE: - continue - - # set of vertices connected through active edges to v - x = {u for u in graph.neighbor_iterator(v) - if vertex_dist[u] != vertex_dist[v]} - - if x not in x_used: - x_used.append(x) - maximal_subtrees_with_leaves_in_x(root, v, x, - vertex_status, False, 0) - - get_child_splits(root) - - -def get_child_splits(root): - """ - Add the node_split of children to the parent node - - INPUT: - - - ``root`` -- input modular decomposition tree - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: series_node.children[0].node_split = NodeSplit.LEFT_SPLIT - sage: series_node.node_split = NodeSplit.RIGHT_SPLIT - sage: forest.children.insert(1, series_node) - sage: get_child_splits(forest) - sage: series_node.node_split == NodeSplit.BOTH_SPLIT - True - sage: forest.node_split == NodeSplit.BOTH_SPLIT - True - """ - if root.node_type != NodeType.NORMAL: - for node in root.children: - get_child_splits(node) - root.set_node_split(node.node_split) - - -def maximal_subtrees_with_leaves_in_x(root, v, x, vertex_status, - tree_left_of_source, level): - """ - Refine the forest based on the active edges(x) of vertex v - - INPUT: - - - ``root`` -- the forest which needs to be assembled into a MD tree - - - ``v`` -- the vertex used to refine - - - ``x`` -- set of vertices connected to v and at different distance - from source compared to v - - - ``vertex_status`` -- dictionary mapping the vertex to the position - w.r.t source - - - ``tree_left_of_source`` -- flag indicating whether tree is - - - ``level`` -- indicates the recursion level, 0 for root - - OUTPUT: - - ``[contained_in_x, split]`` where ``contained_in_x`` is ``True`` if all - vertices in root are subset of x else ``False`` and ``split`` is the - split which occurred at any node in root - - EXAMPLES:: - - sage: from sage.graphs.graph_decompositions.modular_decomposition import * - sage: g = Graph() - sage: g.add_vertices([1, 2, 3, 4, 5, 6, 7]) - sage: g.add_edge(2, 3) - sage: g.add_edge(4, 3) - sage: g.add_edge(5, 3) - sage: g.add_edge(2, 6) - sage: g.add_edge(2, 7) - sage: g.add_edge(2, 1) - sage: g.add_edge(6, 1) - sage: g.add_edge(4, 2) - sage: g.add_edge(5, 2) - sage: forest = Node(NodeType.FOREST) - sage: forest.children = [create_normal_node(2), - ....: create_normal_node(3), create_normal_node(1)] - sage: series_node = Node(NodeType.SERIES) - sage: series_node.children = [create_normal_node(4), - ....: create_normal_node(5)] - sage: parallel_node = Node(NodeType.PARALLEL) - sage: parallel_node.children = [create_normal_node(6), - ....: create_normal_node(7)] - sage: forest.children.insert(1, series_node) - sage: forest.children.insert(3, parallel_node) - sage: vertex_status = {2: VertexPosition.LEFT_OF_SOURCE, - ....: 3: VertexPosition.SOURCE, - ....: 1: VertexPosition.RIGHT_OF_SOURCE, - ....: 4: VertexPosition.LEFT_OF_SOURCE, - ....: 5: VertexPosition.LEFT_OF_SOURCE, - ....: 6: VertexPosition.RIGHT_OF_SOURCE, - ....: 7: VertexPosition.RIGHT_OF_SOURCE} - sage: vertex_dist = {2: 1, 4: 1, 5: 1, 3: 0, 6: 2, 7: 2, 1: 3} - sage: x = {u for u in g.neighbor_iterator(2) - ....: if vertex_dist[u] != vertex_dist[2]} - sage: maximal_subtrees_with_leaves_in_x(forest, 2, x, vertex_status, - ....: False, 0) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [NORMAL [6], NORMAL [7]], NORMAL [1]] - sage: x = {u for u in g.neighbor_iterator(1) - ....: if vertex_dist[u] != vertex_dist[1]} - sage: maximal_subtrees_with_leaves_in_x(forest, 1, x, vertex_status, - ....: False, 0) - sage: forest - FOREST [NORMAL [2], SERIES [NORMAL [4], NORMAL [5]], NORMAL [3], - PARALLEL [PARALLEL [NORMAL [6]], PARALLEL [NORMAL [7]]], - NORMAL [1]] - """ - def update_node_info(node, node_type, node_split, comp_num, subtree_list): - """ - Set the various fields for a tree node and update its subtrees - - - ``node`` -- node whose fields need to be updated - - ``node_type`` -- node_type to be set - - ``node_split`` -- node_split to be set - - ``comp_num`` -- comp_num to be set - - ``subtree_list`` -- list containing the subtrees - - """ - node.node_type = node_type - node.node_split = node_split - node.comp_num = comp_num - node.children = subtree_list - - return_split = NodeSplit.NO_SPLIT # initialize split to NO_SPLIT - - # all trees in a forest are refined using x - if root.node_type == NodeType.FOREST: - - # indicates whether tree is left of source, True if left of source - left_flag = True - - for node in root.children: - if (node.node_type == NodeType.NORMAL and - node.children[0] in vertex_status and - vertex_status[node.children[0]] == VertexPosition.SOURCE): - left_flag = False - subtree_result = maximal_subtrees_with_leaves_in_x(node, v, x, - vertex_status, - left_flag, - level) - if subtree_result: - # Mark the ancestors - root.set_node_split(subtree_result[1]) - - # handles the prime, series and parallel cases - elif root.node_type != NodeType.NORMAL: - - flag = True # indicates the entire root is contained in x - split_flag = False # indicates a split is required - Ta = [] # contains subtrees with leaves in x - Tb = [] # contains subtrees with leaves not in x - - for node in root.children: - - # refines the children of root - subtree_result = maximal_subtrees_with_leaves_in_x(node, v, x, - vertex_status, - tree_left_of_source, - level + 1) - - if subtree_result: - flag = flag and subtree_result[0] - - # add the node split of children to root - root.set_node_split(subtree_result[1]) - - if subtree_result[0]: - Ta.append(node) - split_flag = True - else: - Tb.append(node) - - if root.node_type == NodeType.PRIME: - # mark all the children of prime nodes - for node in root.children: - node.set_node_split(root.node_split) - - if flag: - # return if all subtrees are in x, no split required - return [True, root.node_split] - elif split_flag: # split required` - - split = NodeSplit.LEFT_SPLIT - - # if v is right of source and tree is also right of source then - # RIGHT_SPLIT - if (vertex_status[v] == VertexPosition.RIGHT_OF_SOURCE and - not tree_left_of_source): - split = NodeSplit.RIGHT_SPLIT - - # add the split to root node_split - root.set_node_split(split) - - if root.node_type == NodeType.PRIME: - # mark all the children of prime nodes - for node in root.children: - node.set_node_split(split) - return [False, split] - - if root.is_separated: - # if root has already been split then further split not - # required - return [flag, root.node_split] - - node_type = root.node_type - root.is_separated = True - - # root[1] would now contain Ta and Tb - root.children = [] - - # add two nodes for Ta and Tb - a = create_parallel_node() - update_node_info(a, node_type, root.node_split, - Ta[0].comp_num, Ta) - b = create_parallel_node() - update_node_info(b, node_type, root.node_split, - Tb[0].comp_num, Tb) - root.children.append(a) - root.children.append(b) - - return_split = root.node_split - return [flag, return_split] - # root is a vertex and is contained in x - elif root.children[0] in x: - return [True, root.node_split] - # root is a vertex and is not contained in x - else: - return [False, root.node_split] - def create_prime_node(): """ @@ -2417,18 +368,18 @@ def print_md_tree(root): sage: from sage.graphs.graph_decompositions.modular_decomposition import * sage: print_md_tree(modular_decomposition(graphs.IcosahedralGraph())) PRIME + 1 5 7 - 11 - 1 8 + 11 0 + 2 + 6 + 3 9 4 10 - 6 - 2 - 3 """ def recursive_print_md_tree(root, level): @@ -2699,6 +650,7 @@ def habib_maurer_algorithm(graph, g_classes=None): for sg in g_comp.connected_components()] return root +modular_decomposition = habib_maurer_algorithm #============================================================================= # Below functions are implemented to test the modular decomposition tree @@ -2797,6 +749,49 @@ def test_maximal_modules(tree_root, graph): return False return True +def get_vertices(component_root): + """ + Compute the list of vertices in the (co)component + + INPUT: + + - ``component_root`` -- root of the (co)component whose vertices need to be + returned as a list + + OUTPUT: + + list of vertices in the (co)component + + EXAMPLES:: + + sage: from sage.graphs.graph_decompositions.modular_decomposition import * + sage: forest = Node(NodeType.FOREST) + sage: forest.children = [create_normal_node(2), + ....: create_normal_node(3), create_normal_node(1)] + sage: series_node = Node(NodeType.SERIES) + sage: series_node.children = [create_normal_node(4), + ....: create_normal_node(5)] + sage: parallel_node = Node(NodeType.PARALLEL) + sage: parallel_node.children = [create_normal_node(6), + ....: create_normal_node(7)] + sage: forest.children.insert(1, series_node) + sage: forest.children.insert(3, parallel_node) + sage: get_vertices(forest) + [2, 4, 5, 3, 6, 7, 1] + """ + vertices = [] + + # inner recursive function to recurse over the elements in the + # ``component`` + def recurse_component(node, vertices): + if node.node_type == NodeType.NORMAL: + vertices.append(node.children[0]) + return + for child in node.children: + recurse_component(child, vertices) + + recurse_component(component_root, vertices) + return vertices # Function implemented for testing def get_module_type(graph): @@ -2977,15 +972,15 @@ def children_node_type(module, node_type): sage: tree_root = modular_decomposition(g) sage: print_md_tree(modular_decomposition(g)) SERIES - PARALLEL - 2 - 3 - PARALLEL - 1 - 4 - PARALLEL - 0 - 5 + PARALLEL + 0 + 5 + PARALLEL + 1 + 4 + PARALLEL + 2 + 3 sage: children_node_type(tree_root, NodeType.SERIES) False sage: children_node_type(tree_root, NodeType.PARALLEL) @@ -3014,15 +1009,15 @@ def either_connected_or_not_connected(v, vertices_in_module, graph): sage: g = graphs.OctahedralGraph() sage: print_md_tree(modular_decomposition(g)) SERIES - PARALLEL - 2 - 3 - PARALLEL - 1 - 4 - PARALLEL - 0 - 5 + PARALLEL + 0 + 5 + PARALLEL + 1 + 4 + PARALLEL + 2 + 3 sage: either_connected_or_not_connected(2, [1, 4], g) True sage: either_connected_or_not_connected(2, [3, 4], g) @@ -3054,7 +1049,7 @@ def tree_to_nested_tuple(root): sage: from sage.graphs.graph_decompositions.modular_decomposition import * sage: g = graphs.OctahedralGraph() sage: tree_to_nested_tuple(modular_decomposition(g)) - (SERIES, [(PARALLEL, [2, 3]), (PARALLEL, [1, 4]), (PARALLEL, [0, 5])]) + (SERIES, [(PARALLEL, [0, 5]), (PARALLEL, [1, 4]), (PARALLEL, [2, 3])]) """ if root.node_type == NodeType.NORMAL: return root.children[0] diff --git a/src/sage/graphs/hyperbolicity.pyx b/src/sage/graphs/hyperbolicity.pyx index 06f2eb1ba58..40f934cfb08 100644 --- a/src/sage/graphs/hyperbolicity.pyx +++ b/src/sage/graphs/hyperbolicity.pyx @@ -351,8 +351,8 @@ def _greedy_dominating_set(H, verbose=False): reverse=True, key=lambda x: x[0]) cdef list DOM = [] cdef set seen = set() - for _,u in V: - if not u in seen: + for _, u in V: + if u not in seen: seen.add(u) DOM.append(u) seen.update(H.neighbor_iterator(u)) @@ -1277,14 +1277,14 @@ def hyperbolicity(G, from sage.graphs.graph import Graph if not isinstance(G, Graph): raise ValueError("the input parameter must be a Graph") - if not algorithm in ['basic', 'CCL', 'CCL+FA', 'BCCM', 'dom']: + if algorithm not in ['basic', 'CCL', 'CCL+FA', 'BCCM', 'dom']: raise ValueError("algorithm '%s' not yet implemented, please contribute" %(algorithm)) if approximation_factor is None: approximation_factor = 1.0 elif approximation_factor == 1.0: pass elif algorithm in ['CCL', 'CCL+FA', 'BCCM']: - if not approximation_factor in RR or approximation_factor < 1.0: + if approximation_factor not in RR or approximation_factor < 1.0: raise ValueError("the approximation factor must be >= 1.0") else: raise ValueError("the approximation_factor is ignored when using" @@ -1294,7 +1294,7 @@ def hyperbolicity(G, elif additive_gap == 0.0: pass elif algorithm in ['CCL', 'CCL+FA', 'BCCM']: - if not additive_gap in RR or additive_gap < 0.0: + if additive_gap not in RR or additive_gap < 0.0: raise ValueError("the additive gap must be a real positive number") else: raise ValueError("the additive_gap is ignored when using the '%s' algorithm." %(algorithm)) @@ -1431,7 +1431,7 @@ def hyperbolicity(G, # We set null distances to vertices outside DOM. This way these # vertices will not be considered anymore. for i in range(N): - if not i in DOM_int: + if i not in DOM_int: for j in range(N): distances[i][j] = 0 distances[j][i] = 0 diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index d98a5f553c4..16b2506e545 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -956,9 +956,11 @@ def is_complete_multipartite(int v,int k,int l,int mu): r = v//(v-k) # number of parts (of size v-k each) if l==(v-k)*(r-2) and k==mu and v == r*(v-k): from sage.graphs.generators.basic import CompleteMultipartiteGraph + def CompleteMultipartiteSRG(nparts, partsize): - return CompleteMultipartiteGraph([partsize]*nparts) - return (CompleteMultipartiteSRG, r, v-k) + return CompleteMultipartiteGraph([partsize] * nparts) + return (CompleteMultipartiteSRG, r, v - k) + @cached_function def is_polhill(int v,int k,int l,int mu): @@ -1484,6 +1486,7 @@ def is_twograph_descendant_of_srg(int v, int k0, int l, int mu): strongly_regular_graph(v+1, k, l - 2*mu + k , k - mu, existence=True) is True: try: g = strongly_regular_graph_lazy(v+1, k, l - 2*mu + k) # Sage might not know how to build g + def la(*gr): from sage.combinat.designs.twographs import twograph_descendant gg = g[0](*gr) @@ -2075,10 +2078,12 @@ def SRG_210_99_48_45(): """ from sage.libs.gap.libgap import libgap from sage.combinat.permutation import Permutation - def ekg(g0): # return arcs of the Cayley digraph of on {g,g^4} + + def ekg(g0): + # return arcs of the Cayley digraph of on {g,g^4} g = Permutation(g0) - return libgap.Set([(x, g(x)) for x in range(1,8)] + - [(x, g(g(g(g(x))))) for x in range(1,8)]) + return libgap.Set([(x, g(x)) for x in range(1, 8)] + + [(x, g(g(g(g(x))))) for x in range(1, 8)]) kd = list(map(ekg, [(7, 1, 2, 3, 4, 5), (7, 1, 3, 4, 5, 6), diff --git a/src/sage/groups/misc_gps/argument_groups.py b/src/sage/groups/misc_gps/argument_groups.py index 708d06c6998..c2e2de81e77 100644 --- a/src/sage/groups/misc_gps/argument_groups.py +++ b/src/sage/groups/misc_gps/argument_groups.py @@ -86,7 +86,7 @@ def __init__(self, parent, element, normalize=True): """ if parent is None: raise ValueError('parent must be provided') - super(AbstractArgument, self).__init__(parent=parent) + super().__init__(parent=parent) try: element = parent.base()(element) @@ -324,8 +324,7 @@ def __classcall__(cls, base, category=None): Category of commutative groups """ category = cls._determine_category_(category) - return super(AbstractArgumentGroup, cls).__classcall__( - cls, base, category) + return super().__classcall__(cls, base, category) @staticmethod def _determine_category_(category): @@ -364,8 +363,7 @@ def __init__(self, base, category): sage: UnitCircleGroup(RR).base() # indirect doctest Real Field with 53 bits of precision """ - super(AbstractArgumentGroup, self).__init__(category=category, - base=base) + super().__init__(category=category, base=base) def __hash__(self): r""" @@ -1024,7 +1022,7 @@ def __init__(self, category): Rational Field """ from sage.rings.rational_field import QQ - return super(RootsOfUnityGroup, self).__init__(base=QQ, + return super().__init__(base=QQ, category=category) def _repr_(self): r""" @@ -1075,7 +1073,7 @@ def __init__(self, parent, element, normalize=True): sage: C(1+2*I) # indirect doctest e^(I*arg(1.00000000000000 + 2.00000000000000*I)) """ - super(ArgumentByElement, self).__init__(parent, element, normalize=normalize) + super().__init__(parent, element, normalize=normalize) if self._element_ == 0: raise ValueError('{} is not allowed'.format(element)) @@ -1422,7 +1420,7 @@ def __init__(self, parent, element, normalize=True): sage: S.an_element() # indirect doctest -1 """ - super(Sign, self).__init__(parent, int(element), normalize=normalize) + super().__init__(parent, int(element), normalize=normalize) if self._element_ not in (-1, 1): raise ValueError('{} is not allowed ' '(only -1 or 1 is)'.format(element)) @@ -1643,8 +1641,7 @@ def __init__(self, category): sage: S.base() # indirect doctest """ - return super(SignGroup, self).__init__(base=int, - category=category) + return super().__init__(base=int, category=category) def _repr_(self): r""" diff --git a/src/sage/groups/perm_gps/partn_ref/double_coset.pyx b/src/sage/groups/perm_gps/partn_ref/double_coset.pyx index b197321e084..6daef964ebc 100644 --- a/src/sage/groups/perm_gps/partn_ref/double_coset.pyx +++ b/src/sage/groups/perm_gps/partn_ref/double_coset.pyx @@ -436,9 +436,11 @@ cdef int double_coset(void *S1, void *S2, PartitionStack *partition1, int *order j = refine_also_by_orbits(current_ps, S2, refine_and_return_invariant, cells_to_refine_by, j, group, perm_stack) if k != j: - possible = 0; unknown = 0 + possible = 0 + unknown = 0 elif not stacks_are_equivalent(left_ps, current_ps): - possible = 0; unknown = 0 + possible = 0 + unknown = 0 else: PS_move_all_mins_to_front(current_ps) diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py index 17c56551fed..739431a5005 100644 --- a/src/sage/interfaces/expect.py +++ b/src/sage/interfaces/expect.py @@ -87,7 +87,7 @@ # "return", "break", or "continue", raising an exception, ...) -class gc_disabled(object): +class gc_disabled(): """ This is a "with" statement context manager. Garbage collection is disabled within its scope. Nested usage is properly handled. diff --git a/src/sage/interfaces/four_ti_2.py b/src/sage/interfaces/four_ti_2.py index 72afddd70f1..92de8d2d478 100644 --- a/src/sage/interfaces/four_ti_2.py +++ b/src/sage/interfaces/four_ti_2.py @@ -41,7 +41,7 @@ import os -class FourTi2(object): +class FourTi2(): r""" This object defines an interface to the program 4ti2. Each command 4ti2 has is exposed as one method. diff --git a/src/sage/interfaces/gfan.py b/src/sage/interfaces/gfan.py index 0e5b4046f4e..686564dbdc0 100644 --- a/src/sage/interfaces/gfan.py +++ b/src/sage/interfaces/gfan.py @@ -46,7 +46,7 @@ from sage.misc.decorators import rename_keyword -class Gfan(object): +class Gfan(): """ Interface to Anders Jensen's Groebner Fan program. """ diff --git a/src/sage/interfaces/giac.py b/src/sage/interfaces/giac.py index 73601ca7ff2..59fb8f54158 100644 --- a/src/sage/interfaces/giac.py +++ b/src/sage/interfaces/giac.py @@ -1,5 +1,6 @@ r""" Pexpect Interface to Giac + (You should prefer the cython interface: giacpy_sage and its libgiac command) (adapted by F. Han from William Stein and Gregg Musiker maple's interface) @@ -247,7 +248,8 @@ from sage.structure.richcmp import rich_to_bool -COMMANDS_CACHE = '%s/giac_commandlist_cache.sobj'%DOT_SAGE +COMMANDS_CACHE = '%s/giac_commandlist_cache.sobj' % DOT_SAGE + class Giac(Expect): r""" @@ -328,16 +330,17 @@ def __init__(self, maxread=None, script_subdirectory=None, server=None, server_t True """ Expect.__init__(self, - name = 'giac', - prompt = '[0-9]*>> ', - command = "giac --sage", - env = {"LANG": "C"}, - init_code= ['maple_mode(0);I:=i;'], # coercion could be broken in maple_mode - script_subdirectory = script_subdirectory, - restart_on_ctrlc = False, server = server, - server_tmpdir = server_tmpdir, - verbose_start = False, - logfile = logfile, + name='giac', + prompt='[0-9]*>> ', + command="giac --sage", + env={"LANG": "C"}, + init_code=['maple_mode(0);I:=i;'], # coercion could be broken in maple_mode + script_subdirectory=script_subdirectory, + restart_on_ctrlc=False, + server=server, + server_tmpdir=server_tmpdir, + verbose_start=False, + logfile=logfile, eval_using_file_cutoff=1000) def _function_class(self): @@ -362,7 +365,7 @@ def _keyboard_interrupt(self): self._expect.sendline(chr(3)) # send ctrl-c self._expect.expect(self._prompt) # self._expect.expect(self._prompt) - raise RuntimeError("Ctrl-c pressed while running %s"%self) + raise RuntimeError("Ctrl-c pressed while running %s" % self) def __reduce__(self): """ @@ -378,7 +381,7 @@ def __reduce__(self): def _read_in_file_command(self, filename): r""" - Returns the string used to read filename into Giac. + Return the string used to read filename into Giac. EXAMPLES:: @@ -450,7 +453,7 @@ def _install_hints(self): def expect(self): """ - Returns the pexpect object for this Giac session. + Return the pexpect object for this Giac session. EXAMPLES:: @@ -483,7 +486,6 @@ def console(self): """ giac_console() - def completions(self, s): """ Return all commands that complete the command starting with the @@ -500,7 +502,7 @@ def completions(self, s): E = self._expect E.sendline('%s%s%s' % (s, chr(63), chr(13))) t = E.timeout - E.timeout=0.3 # since some things have no completion + E.timeout = 0.3 # since some things have no completion try: E.expect('----') except pexpect.TIMEOUT: @@ -525,8 +527,8 @@ def _commands(self): True """ try: - v = sum([self.completions(chr(65+n)) for n in range(26)], []) + \ - sum([self.completions(chr(97+n)) for n in range(26)], []) + v = sum([self.completions(chr(65 + n)) for n in range(26)], []) + \ + sum([self.completions(chr(97 + n)) for n in range(26)], []) except RuntimeError: print("\n" * 3) print("*" * 70) @@ -538,7 +540,7 @@ def _commands(self): def _tab_completion(self, verbose=True, use_disk_cache=True): """ - Returns a list of all the commands defined in Giac and optionally + Return a list of all the commands defined in Giac and optionally (per default) store them to disk. EXAMPLES:: @@ -570,11 +572,11 @@ def _tab_completion(self, verbose=True, use_disk_cache=True): sage.misc.persist.save(v, COMMANDS_CACHE) return v - def cputime(self, t=None): r""" - Returns the amount of CPU time that the Giac session has used. If - ``t`` is not None, then it returns the difference + Return the amount of CPU time that the Giac session has used. + + If ``t`` is not None, then it returns the difference between the current CPU time and ``t``. EXAMPLES:: @@ -590,8 +592,7 @@ def cputime(self, t=None): """ if t is None: return float(self('time()')) - else: - return float(self('time() - %s'%float(t))) + return float(self('time() - %s' % float(t))) def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if_needed=False): """ @@ -614,9 +615,9 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if """ with gc_disabled(): z = Expect._eval_line(self, line, allow_use_file=allow_use_file, - wait_for_prompt=wait_for_prompt) + wait_for_prompt=wait_for_prompt) if z.lower().find("error") != -1: - raise RuntimeError("An error occurred running a Giac command:\nINPUT:\n%s\nOUTPUT:\n%s"%(line, z)) + raise RuntimeError("an error occurred running a Giac command:\nINPUT:\n%s\nOUTPUT:\n%s" % (line, z)) lines = (line for line in z.splitlines() if not line.startswith('Evaluation time:')) return "\n".join(lines) @@ -660,10 +661,10 @@ def set(self, var, value): sage: giac.get('xx') '2' """ - cmd = '%s:=%s:;' % (var, value) #if giac is not in maple mode ( maple_mode(0)) + cmd = '%s:=%s:;' % (var, value) # if giac is not in maple mode ( maple_mode(0)) out = self.eval(cmd) if out.find("error") != -1: - raise TypeError("Error executing code in Giac\nCODE:\n\t%s\nGiac ERROR:\n\t%s"%(cmd, out)) + raise TypeError("error executing code in Giac\nCODE:\n\t%s\nGiac ERROR:\n\t%s" % (cmd, out)) def get(self, var): """ @@ -679,7 +680,7 @@ def get(self, var): def _object_class(self): """ - Returns the class of GiacElements. + Return the class of GiacElements. EXAMPLES:: @@ -696,7 +697,7 @@ def _object_class(self): def _function_element_class(self): """ - Returns the GiacFunctionElement class. + Return the GiacFunctionElement class. EXAMPLES:: @@ -713,7 +714,7 @@ def _function_element_class(self): def _equality_symbol(self): """ - Returns the symbol used for equality testing in Giac. + Return the symbol used for equality testing in Giac. EXAMPLES:: @@ -727,7 +728,7 @@ def _equality_symbol(self): def _true_symbol(self): """ - Returns the symbol used for truth in Giac. + Return the symbol used for truth in Giac. EXAMPLES:: @@ -743,7 +744,7 @@ def _true_symbol(self): def _assign_symbol(self): """ - Returns the symbol used for assignment in Giac. + Return the symbol used for assignment in Giac. EXAMPLES:: @@ -794,7 +795,7 @@ def clear(self, var): sage: giac.get('xx') 'xx' """ - self.eval('purge(%s)'%var) + self.eval('purge(%s)' % var) def version(self): """ @@ -813,7 +814,7 @@ def version(self): class GiacFunction(ExpectFunction): def _instancedoc_(self): """ - Returns the Giac help for this function. This gets called when + Return the Giac help for this function. This gets called when doing "?" on self. EXAMPLES:: @@ -829,7 +830,7 @@ def _instancedoc_(self): class GiacFunctionElement(FunctionElement): def _instancedoc_(self): """ - Returns the Giac help for this function. This gets called when + Return the Giac help for this function. This gets called when doing "?" on self. EXAMPLES:: @@ -845,7 +846,7 @@ def _instancedoc_(self): class GiacElement(ExpectElement): def __float__(self): """ - Returns a floating point version of self. + Return a floating point version of self. EXAMPLES:: @@ -869,15 +870,14 @@ def unapply(self, var): sage: g(1,2) 4 """ - return giac('unapply(%s,%s)'%(self,var)) - + return giac('unapply(%s,%s)' % (self, var)) def __hash__(self): """ - Returns a integer representing the hash of self. + Return an integer representing the hash of ``self``. These examples are optional, and require Giac to be installed. You - don't need to install any Sage packages for this. + do not need to install any Sage packages for this. EXAMPLES:: @@ -885,7 +885,7 @@ def __hash__(self): sage: hash(m) # random 4614285348919569149 """ - return hash(giac.eval('string(%s);'%self.name())) + return hash(giac.eval('string(%s);' % self.name())) def _richcmp_(self, other, op): """ @@ -926,14 +926,15 @@ def _richcmp_(self, other, op): False """ P = self.parent() - if P.eval("evalb(%s %s %s)"%(self.name(), P._equality_symbol(), - other.name())) == P._true_symbol(): + if P.eval("evalb(%s %s %s)" % (self.name(), P._equality_symbol(), + other.name())) == P._true_symbol(): return rich_to_bool(op, 0) - # (to be tested with giac). Maple does not allow comparing objects of different types and - # it raises an error in this case. + # (to be tested with giac). Maple does not allow comparing objects + # of different types and it raises an error in this case. # We catch the error, and return True for < try: - if P.eval("evalb(%s %s %s)"%(self.name(), P._lessthan_symbol(), other.name())) == P._true_symbol(): + if P.eval("evalb(%s %s %s)" % (self.name(), P._lessthan_symbol(), + other.name())) == P._true_symbol(): return rich_to_bool(op, -1) except RuntimeError as e: msg = str(e) @@ -944,7 +945,7 @@ def _richcmp_(self, other, op): return rich_to_bool(op, 1) else: raise RuntimeError(e) - if P.eval("evalb(%s %s %s)"%(self.name(), P._greaterthan_symbol(), other.name())) == P._true_symbol(): + if P.eval("evalb(%s %s %s)" % (self.name(), P._greaterthan_symbol(), other.name())) == P._true_symbol(): return rich_to_bool(op, 1) return NotImplemented @@ -1018,18 +1019,17 @@ def _latex_(self): \frac{...x^{4}...-...y...}{...y^{2}-3...x...} """ - s = self.parent().eval('latex(%s)'%self.name()) + s = self.parent().eval('latex(%s)' % self.name()) if s.startswith('"'): s = s[1:] if s.endswith('"'): s = s[:-1] - s = s.strip() - return s + return s.strip() def _matrix_(self, R): r""" Return matrix over the (Sage) ring R determined by self, where self - should be a Giac matrix. + should be a Giac matrix. .. WARNING:: It is slow, do not convert big matrices. @@ -1057,7 +1057,7 @@ def _matrix_(self, R): entries = [[R(self[r, c]) for c in range(m)] for r in range(n)] return M(entries) - def _sage_(self, locals={}): + def _sage_(self, locals=None): r""" Convert a giac expression back to a Sage expression, if possible. @@ -1126,7 +1126,10 @@ def _sage_(self, locals={}): from sage.symbolic.expression import symbol_table from sage.calculus.calculus import symbolic_expression_from_string, SR_parser_giac - result = repr(self) # string representation + if locals is None: + locals = {} + + result = repr(self) # string representation if str(self.type()) not in ['DOM_LIST', 'vector', 'vecteur']: @@ -1137,10 +1140,10 @@ def _sage_(self, locals={}): try: return symbolic_expression_from_string(result, lsymbols, - accept_sequence=True, parser=SR_parser_giac) - + accept_sequence=True, + parser=SR_parser_giac) except Exception: - raise NotImplementedError("Unable to parse Giac output: %s" % result) + raise NotImplementedError("unable to parse Giac output: %s" % result) else: return [entry.sage() for entry in self] @@ -1158,8 +1161,8 @@ def integral(self, var='x', min=None, max=None): - ``max`` - default: None - Returns the definite integral if xmin is not None, otherwise - returns an indefinite integral. + This returns the definite integral if xmin is not None, otherwise + an indefinite integral. EXAMPLES:: @@ -1177,9 +1180,8 @@ def integral(self, var='x', min=None, max=None): """ if min is None: return giac('int(%s,%s)' % (self.name(), var)) - else: - if max is None: - raise ValueError("neither or both of min/max must be specified.") + if max is None: + raise ValueError("neither or both of min/max must be specified") return giac('int(%s,%s,%s,%s)' % (self.name(), var, giac(min), giac(max))) @@ -1197,8 +1199,8 @@ def sum(self, var, min=None, max=None): - ``max`` - default: None - Returns the definite integral if xmin is not None, otherwise - returns an indefinite integral. + This returns the definite integral if xmin is not None, otherwise + an indefinite integral. EXAMPLES:: @@ -1207,19 +1209,19 @@ def sum(self, var, min=None, max=None): """ if min is None: return giac('sum(%s,%s)' % (self.name(), var)) - else: - if max is None: - raise ValueError("neither or both of min/max must be specified.") - return giac('sum(%s,%s,%s,%s)' % (self.name(), var, - giac(min), giac(max))) + if max is None: + raise ValueError("neither or both of min/max must be specified") + return giac('sum(%s,%s,%s,%s)' % (self.name(), var, + giac(min), giac(max))) # An instance giac = Giac() + def reduce_load_Giac(): """ - Returns the giac object created in sage.interfaces.giac. + Return the giac object created in sage.interfaces.giac. EXAMPLES:: diff --git a/src/sage/interfaces/gp.py b/src/sage/interfaces/gp.py index 6d95499640e..ff925b0ac8e 100644 --- a/src/sage/interfaces/gp.py +++ b/src/sage/interfaces/gp.py @@ -138,7 +138,9 @@ # http://www.gnu.org/licenses/ # ########################################################################## +import os +from sage.env import DOT_SAGE from .expect import Expect, ExpectElement, ExpectFunction, FunctionElement from sage.misc.verbose import verbose from sage.interfaces.tab_completion import ExtraTabCompletion @@ -200,16 +202,16 @@ def __init__(self, stacksize=10000000, # 10MB True """ Expect.__init__(self, - name = 'pari', - prompt = '\\? ', + name='pari', + prompt='\\? ', # --fast so the system gprc isn't read (we configure below) - command = "gp --fast --emacs --quiet --stacksize %s"%stacksize, - maxread = maxread, + command=f"gp --fast --emacs --quiet --stacksize {stacksize}", + maxread=maxread, server=server, server_tmpdir=server_tmpdir, - script_subdirectory = script_subdirectory, - restart_on_ctrlc = False, - verbose_start = False, + script_subdirectory=script_subdirectory, + restart_on_ctrlc=False, + verbose_start=False, logfile=logfile, eval_using_file_cutoff=1024) self.__seq = 0 @@ -332,7 +334,7 @@ def _read_in_file_command(self, filename): sage: gp.get('x').strip() '22' """ - return 'read("%s")'%filename + return 'read("%s")' % filename def _tab_completion(self): """ @@ -508,7 +510,7 @@ def set_default(self, var, value): 38 # 64-bit """ old = self.get_default(var) - self._eval_line('default(%s,%s)'%(var,value)) + self._eval_line('default(%s,%s)' % (var, value)) return old def get_default(self, var): @@ -536,7 +538,7 @@ def get_default(self, var): 28 # 32-bit 38 # 64-bit """ - return eval(self._eval_line('default(%s)'%var)) + return eval(self._eval_line('default(%s)' % var)) def set(self, var, value): """ @@ -553,11 +555,10 @@ def set(self, var, value): sage: gp.get('x') '2' """ - cmd = '%s=%s;'%(var,value) + cmd = '%s=%s;' % (var, value) out = self.eval(cmd) if out.find('***') != -1: - raise TypeError("Error executing code in GP:\nCODE:\n\t%s\nPARI/GP ERROR:\n%s"%(cmd, out)) - + raise TypeError("Error executing code in GP:\nCODE:\n\t%s\nPARI/GP ERROR:\n%s" % (cmd, out)) def get(self, var): """ @@ -573,7 +574,7 @@ def get(self, var): sage: gp.get('x') '2' """ - return self.eval('print(%s)'%var) + return self.eval('print(%s)' % var) def kill(self, var): """ @@ -592,20 +593,7 @@ def kill(self, var): sage: gp.get('xx') 'xx' """ - self.eval('kill(%s)'%var) - - #def xclear(self, var): - #""" - #Clear the variable named var. - #""" - #for varname based memory -- only 65000 variables and then dead. - #self.eval('kill(%s)'%var) - # for array-based memory this is best: - #self.eval('%s=0'%var) - # However, I've commented it out, since PARI doesn't seem - # to ever free any memory on its stack anyways. - # Killing variables as above takes a lot of time in some - # cases, also. + self.eval('kill(%s)' % var) def _next_var_name(self): """ @@ -631,20 +619,19 @@ def _next_var_name(self): ....: a = g(n) # long time sage: g('length(sage)') # long time 24000 - """ self.__seq += 1 if self.__seq >= self.__var_store_len: if self.__var_store_len == 0: - self.eval('sage=vector(%s,k,0);'%self.__init_list_length) + self.eval('sage=vector(%s,k,0);' % self.__init_list_length) self.__var_store_len = self.__init_list_length else: - self.eval('sage0=concat(sage, vector(%s,k,0));'%self.__var_store_len) + self.eval('sage0=concat(sage, vector(%s,k,0));' % self.__var_store_len) self.eval('sage=sage0;') self.eval('kill(sage0);') self.__var_store_len *= 2 - verbose("doubling PARI/sage object vector: %s"%self.__var_store_len) - return 'sage[%s]'%self.__seq + verbose("doubling PARI/sage object vector: %s" % self.__var_store_len) + return 'sage[%s]' % self.__seq def _reset_expect(self): """ @@ -788,9 +775,9 @@ def help(self, command): sage: gp.help('gcd') 'gcd(x,{y}): greatest common divisor of x and y.' """ - return self.eval('?%s'%command).strip() + return self.eval('?%s' % command).strip() - def new_with_bits_prec(self, s, precision = 0): + def new_with_bits_prec(self, s, precision=0): r""" Creates a GP object from s with ``precision`` bits of precision. GP actually automatically increases this precision to @@ -824,7 +811,7 @@ def new_with_bits_prec(self, s, precision = 0): """ if precision: old_prec = self.get_real_precision() - prec = int(precision/3.321928095) + prec = int(precision / 3.321928095) self.set_real_precision(prec) x = self(s) self.set_real_precision(old_prec) @@ -955,9 +942,7 @@ def __bool__(self): False """ P = self._check_valid() - return P.eval('%s != 0'%(self.name())) == '1' - - + return P.eval('%s != 0' % (self.name())) == '1' def _complex_mpfr_field_(self, CC): """ @@ -983,7 +968,7 @@ def _complex_mpfr_field_(self, CC): # Multiplying by CC(1) is necessary here since # sage: pari(gp(1+I)).sage().parent() # Maximal Order in Number Field in i with defining polynomial x^2 + 1 - return CC((CC(1)*pari(self)).sage()) + return CC((CC.one() * pari(self)).sage()) def _complex_double_(self, CDF): """ @@ -1031,9 +1016,9 @@ def __del__(self): # out of date, e.g., for matrices it uses \pmatrix (which # causes an error if amsmath is loaded) and for rationals # it does nothing, etc. - #def _latex_(self): - # P = self._check_valid() - # return P.eval('printtex(%s)'%self.name()) + # def _latex_(self): + # P = self._check_valid() + # return P.eval('printtex(%s)'%self.name()) def _tab_completion(self): """ @@ -1063,11 +1048,11 @@ def is_GpElement(x): """ return isinstance(x, GpElement) -from sage.env import DOT_SAGE -import os # An instance -gp = Gp(logfile=os.path.join(DOT_SAGE,'gp-expect.log')) # useful for debugging! +gp = Gp(logfile=os.path.join(DOT_SAGE, 'gp-expect.log')) +# useful for debugging! + def reduce_load_GP(): """ @@ -1081,6 +1066,7 @@ def reduce_load_GP(): """ return gp + def gp_console(): """ Spawn a new GP command-line session. @@ -1108,7 +1094,7 @@ def gp_version(): """ v = gp.eval(r'\v') i = v.find("Version ") - w = v[i+len("Version "):] + w = v[i + len("Version "):] i = w.find(' ') w = w[:i] t = tuple([int(n) for n in w.split('.')]) diff --git a/src/sage/interfaces/process.pxd b/src/sage/interfaces/process.pxd index 03d9a55e533..3f1ae3f0dc8 100644 --- a/src/sage/interfaces/process.pxd +++ b/src/sage/interfaces/process.pxd @@ -1,4 +1,4 @@ -cdef class ContainChildren(object): +cdef class ContainChildren(): cdef int parentpid cdef int exitcode, exceptcode cdef bint silent diff --git a/src/sage/interfaces/process.pyx b/src/sage/interfaces/process.pyx index 3e51eb0c95c..ea90d5b0de4 100644 --- a/src/sage/interfaces/process.pyx +++ b/src/sage/interfaces/process.pyx @@ -24,7 +24,7 @@ from cysignals.pselect import PSelecter from cysignals.pysignals import changesignal -cdef class ContainChildren(object): +cdef class ContainChildren(): """ Context manager which will ensure that all forked child processes will be forced to exit if they try to exit the context. diff --git a/src/sage/interfaces/tab_completion.py b/src/sage/interfaces/tab_completion.py index 0182e4c1d6d..ca106a67273 100644 --- a/src/sage/interfaces/tab_completion.py +++ b/src/sage/interfaces/tab_completion.py @@ -27,7 +27,7 @@ import builtins -class ExtraTabCompletion(object): +class ExtraTabCompletion(): def __dir__(self): """ diff --git a/src/sage/libs/coxeter3/coxeter.pyx b/src/sage/libs/coxeter3/coxeter.pyx index 603261f7661..533c35b6a40 100644 --- a/src/sage/libs/coxeter3/coxeter.pyx +++ b/src/sage/libs/coxeter3/coxeter.pyx @@ -1144,7 +1144,7 @@ cdef LFlags_to_list(CoxGroup parent, LFlags f): f1 = f1 & (f1-1) return l -class CoxGroupIterator(object): +class CoxGroupIterator(): def __init__(self, group): """ A class used to iterate over all of the elements of a Coxeter group. diff --git a/src/sage/libs/gap/element.pxd b/src/sage/libs/gap/element.pxd index 84dc49d8110..a1bf8118d4f 100644 --- a/src/sage/libs/gap/element.pxd +++ b/src/sage/libs/gap/element.pxd @@ -89,7 +89,7 @@ cdef class GapElement_MethodProxy(GapElement_Function): cdef class GapElement_Record(GapElement): cpdef UInt record_name_to_index(self, name) -cdef class GapElement_RecordIterator(object): +cdef class GapElement_RecordIterator(): cdef GapElement_Record rec cdef UInt i diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index 0c12bc4d9e7..be43c4c3ee0 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -3246,7 +3246,7 @@ cdef class GapElement_Record(GapElement): return result -cdef class GapElement_RecordIterator(object): +cdef class GapElement_RecordIterator(): r""" Iterator for :class:`GapElement_Record` diff --git a/src/sage/libs/gap/util.pxd b/src/sage/libs/gap/util.pxd index 986a2db45c2..118146133f4 100644 --- a/src/sage/libs/gap/util.pxd +++ b/src/sage/libs/gap/util.pxd @@ -14,7 +14,7 @@ from .gap_includes cimport Obj ### Hooking into the GAP memory management ################################# ############################################################################ -cdef class ObjWrapper(object): +cdef class ObjWrapper(): cdef Obj value cdef ObjWrapper wrap_obj(Obj obj) diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx index 08c4c40cc01..9d5d793a57f 100644 --- a/src/sage/libs/gap/util.pyx +++ b/src/sage/libs/gap/util.pyx @@ -36,7 +36,7 @@ from sage.interfaces.gap_workspace import prepare_workspace_dir ############################################################################ -cdef class ObjWrapper(object): +cdef class ObjWrapper(): """ Wrapper for GAP master pointers diff --git a/src/sage/libs/linkages/padics/unram_shared.pxi b/src/sage/libs/linkages/padics/unram_shared.pxi index bcd76ad3123..10a2f5adde8 100644 --- a/src/sage/libs/linkages/padics/unram_shared.pxi +++ b/src/sage/libs/linkages/padics/unram_shared.pxi @@ -28,6 +28,10 @@ def frobenius_unram(self, arithmetic=True): sage: a a + O(5^3) + sage: R. = Zq(5^4,3) + sage: a.frobenius(arithmetic=False) + (3*a^3 + 3*a^2 + a) + (a^3 + 4*a^2 + a + 4)*5 + (3*a^2 + 2*a + 3)*5^2 + O(5^3) + sage: K. = Qq(7^3,4) sage: b = (a+1)/7 sage: c = b.frobenius(); c @@ -42,13 +46,22 @@ def frobenius_unram(self, arithmetic=True): Traceback (most recent call last): ... NotImplementedError: Frobenius automorphism only implemented for unramified extensions + + TESTS:: + + We check that :trac:`23575` is resolved: + + sage: x = R.random_element() + sage: x.frobenius(arithmetic=false).frobenius() == x + True + """ if self == 0: return self R = self.parent() p = R.prime() a = R.gen() - frob_a = R._frob_gen() + frob_a = R._frob_gen(arithmetic) ppow = self.valuation() unit = self.unit_part() coefs = unit.expansion() diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index 7a8c8ae73ed..f9b0ff2d42c 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -2036,7 +2036,7 @@ cdef MPF_hypsum(MPF *a, MPF *b, int p, int q, param_types, str ztype, coeffs, z, mpz_set_complex_tuple_fixed(ZRE, ZIM, z, wp) else: mpz_set_tuple_fixed(ZRE, z, wp) - for i in range(0,p): + for i in range(p): sig_check() if param_types[i] == 'Z': mpz_init(AINT[aint]) diff --git a/src/sage/libs/mpmath/ext_main.pyx b/src/sage/libs/mpmath/ext_main.pyx index 7ba4fb1c17b..81abdf0cd4b 100644 --- a/src/sage/libs/mpmath/ext_main.pyx +++ b/src/sage/libs/mpmath/ext_main.pyx @@ -76,9 +76,12 @@ cdef MPF MPF_C_0 cdef MPF MPF_C_1 cdef MPF MPF_C_2 -MPF_init(&MPF_C_0); MPF_set_zero(&MPF_C_0) -MPF_init(&MPF_C_1); MPF_set_si(&MPF_C_1, 1) -MPF_init(&MPF_C_2); MPF_set_si(&MPF_C_2, 2) +MPF_init(&MPF_C_0) +MPF_set_zero(&MPF_C_0) +MPF_init(&MPF_C_1) +MPF_set_si(&MPF_C_1, 1) +MPF_init(&MPF_C_2) +MPF_set_si(&MPF_C_2, 2) # Temporaries used for operands in binary operations cdef mpz_t tmp_mpz diff --git a/src/sage/libs/ntl/ntl_GF2.pxd b/src/sage/libs/ntl/ntl_GF2.pxd index 16fb73e8f10..0eff25dd32c 100644 --- a/src/sage/libs/ntl/ntl_GF2.pxd +++ b/src/sage/libs/ntl/ntl_GF2.pxd @@ -1,4 +1,4 @@ from .types cimport GF2_c -cdef class ntl_GF2(object): +cdef class ntl_GF2(): cdef GF2_c x diff --git a/src/sage/libs/ntl/ntl_GF2.pyx b/src/sage/libs/ntl/ntl_GF2.pyx index 605bd3ad936..c88034ff5c4 100644 --- a/src/sage/libs/ntl/ntl_GF2.pyx +++ b/src/sage/libs/ntl/ntl_GF2.pyx @@ -34,7 +34,7 @@ from sage.rings.integer_ring cimport IntegerRing_class # GF2: Bits ############################################################################## -cdef class ntl_GF2(object): +cdef class ntl_GF2(): r""" The \class{GF2} represents the field GF(2). Computationally speaking, it is not a particularly useful class. Its main use is diff --git a/src/sage/libs/ntl/ntl_GF2E.pxd b/src/sage/libs/ntl/ntl_GF2E.pxd index 267330c813d..8977f711078 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pxd +++ b/src/sage/libs/ntl/ntl_GF2E.pxd @@ -1,7 +1,7 @@ from .types cimport GF2E_c from .ntl_GF2EContext cimport ntl_GF2EContext_class -cdef class ntl_GF2E(object): +cdef class ntl_GF2E(): cdef GF2E_c x cdef ntl_GF2EContext_class c cdef ntl_GF2E _new(self) diff --git a/src/sage/libs/ntl/ntl_GF2E.pyx b/src/sage/libs/ntl/ntl_GF2E.pyx index 252851d40ed..bc6a32ce0d3 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_GF2E.pyx @@ -71,7 +71,7 @@ def ntl_GF2E_random(ntl_GF2EContext_class ctx): r.x = GF2E_random() return r -cdef class ntl_GF2E(object): +cdef class ntl_GF2E(): r""" The \\class{GF2E} represents a finite extension field over GF(2) using NTL. Elements are represented as polynomials over GF(2) diff --git a/src/sage/libs/ntl/ntl_GF2EContext.pxd b/src/sage/libs/ntl/ntl_GF2EContext.pxd index 73beae27eb5..44ab9891713 100644 --- a/src/sage/libs/ntl/ntl_GF2EContext.pxd +++ b/src/sage/libs/ntl/ntl_GF2EContext.pxd @@ -1,7 +1,7 @@ from .types cimport GF2EContext_c from .ntl_GF2X cimport ntl_GF2X -cdef class ntl_GF2EContext_class(object): +cdef class ntl_GF2EContext_class(): cdef GF2EContext_c x cdef ntl_GF2X m cdef void restore_c(self) diff --git a/src/sage/libs/ntl/ntl_GF2EContext.pyx b/src/sage/libs/ntl/ntl_GF2EContext.pyx index d31f8fc6e10..11d06893505 100644 --- a/src/sage/libs/ntl/ntl_GF2EContext.pyx +++ b/src/sage/libs/ntl/ntl_GF2EContext.pyx @@ -27,7 +27,7 @@ import weakref GF2EContextDict = {} -cdef class ntl_GF2EContext_class(object): +cdef class ntl_GF2EContext_class(): def __init__(self, ntl_GF2X v): """ EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_GF2EX.pxd b/src/sage/libs/ntl/ntl_GF2EX.pxd index 11e8cc2193d..70e06122753 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pxd +++ b/src/sage/libs/ntl/ntl_GF2EX.pxd @@ -2,7 +2,7 @@ from .types cimport GF2EX_c from .ntl_GF2EContext cimport ntl_GF2EContext_class from .ntl_GF2E cimport ntl_GF2E -cdef class ntl_GF2EX(object): +cdef class ntl_GF2EX(): cdef GF2EX_c x cdef ntl_GF2EContext_class c cdef ntl_GF2E _new_element(self) diff --git a/src/sage/libs/ntl/ntl_GF2EX.pyx b/src/sage/libs/ntl/ntl_GF2EX.pyx index be37ec0313a..e9dfbab4668 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pyx +++ b/src/sage/libs/ntl/ntl_GF2EX.pyx @@ -41,7 +41,7 @@ from .ntl_GF2E cimport ntl_GF2E # ############################################################################## -cdef class ntl_GF2EX(object): +cdef class ntl_GF2EX(): r""" Minimal wrapper of NTL's GF2EX class. """ diff --git a/src/sage/libs/ntl/ntl_GF2X.pxd b/src/sage/libs/ntl/ntl_GF2X.pxd index 4015771577d..5af874d0b9e 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pxd +++ b/src/sage/libs/ntl/ntl_GF2X.pxd @@ -1,4 +1,4 @@ from .types cimport GF2X_c -cdef class ntl_GF2X(object): +cdef class ntl_GF2X(): cdef GF2X_c x diff --git a/src/sage/libs/ntl/ntl_GF2X.pyx b/src/sage/libs/ntl/ntl_GF2X.pyx index 8aa4c43d348..58f536a9c8b 100644 --- a/src/sage/libs/ntl/ntl_GF2X.pyx +++ b/src/sage/libs/ntl/ntl_GF2X.pyx @@ -87,7 +87,7 @@ def GF2XHexOutput(have_hex=None): GF2XHexOutput_c[0] = 0 -cdef class ntl_GF2X(object): +cdef class ntl_GF2X(): """ Univariate Polynomials over GF(2) via NTL. """ diff --git a/src/sage/libs/ntl/ntl_ZZ.pxd b/src/sage/libs/ntl/ntl_ZZ.pxd index 2ecf42c100d..31a23b29d46 100644 --- a/src/sage/libs/ntl/ntl_ZZ.pxd +++ b/src/sage/libs/ntl/ntl_ZZ.pxd @@ -1,6 +1,6 @@ from sage.libs.ntl.types cimport ZZ_c -cdef class ntl_ZZ(object): +cdef class ntl_ZZ(): cdef ZZ_c x cdef int get_as_int(ntl_ZZ self) cdef void set_from_int(ntl_ZZ self, int value) diff --git a/src/sage/libs/ntl/ntl_ZZ.pyx b/src/sage/libs/ntl/ntl_ZZ.pyx index 5a124ef47cf..39a98da2101 100644 --- a/src/sage/libs/ntl/ntl_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_ZZ.pyx @@ -46,7 +46,7 @@ cdef make_ZZ(ZZ_c* x): # ZZ: Arbitrary precision integers ############################################################################## -cdef class ntl_ZZ(object): +cdef class ntl_ZZ(): r""" The \class{ZZ} class is used to represent signed, arbitrary length integers. diff --git a/src/sage/libs/ntl/ntl_ZZX.pxd b/src/sage/libs/ntl/ntl_ZZX.pxd index 8fae49f585b..c15a3f2d1e4 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pxd +++ b/src/sage/libs/ntl/ntl_ZZX.pxd @@ -1,6 +1,6 @@ from .types cimport ZZX_c -cdef class ntl_ZZX(object): +cdef class ntl_ZZX(): cdef ZZX_c x cdef void setitem_from_int(ntl_ZZX self, long i, int value) cdef int getitem_as_int(ntl_ZZX self, long i) diff --git a/src/sage/libs/ntl/ntl_ZZX.pyx b/src/sage/libs/ntl/ntl_ZZX.pyx index 8c596bd23a6..c431864a853 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pyx +++ b/src/sage/libs/ntl/ntl_ZZX.pyx @@ -79,7 +79,7 @@ cdef proof_flag(t): ############################################################################## -cdef class ntl_ZZX(object): +cdef class ntl_ZZX(): r""" The class \class{ZZX} implements polynomials in $\Z[X]$, i.e., univariate polynomials with integer coefficients. diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pxd b/src/sage/libs/ntl/ntl_ZZ_p.pxd index 472587744db..4863afeb2c2 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_p.pxd @@ -1,7 +1,7 @@ from .types cimport ZZ_p_c from .ntl_ZZ_pContext cimport ntl_ZZ_pContext_class -cdef class ntl_ZZ_p(object): +cdef class ntl_ZZ_p(): cdef ZZ_p_c x cdef ntl_ZZ_pContext_class c cdef int get_as_int(ntl_ZZ_p self) diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pyx b/src/sage/libs/ntl/ntl_ZZ_p.pyx index 114963b1882..7c4b024b82a 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_p.pyx @@ -74,7 +74,7 @@ def ntl_ZZ_p_random_element(v): # ZZ_p_c: integers modulo p # ############################################################################## -cdef class ntl_ZZ_p(object): +cdef class ntl_ZZ_p(): r""" The \class{ZZ_p} class is used to represent integers modulo $p$. The modulus $p$ may be any positive integer, not necessarily prime. diff --git a/src/sage/libs/ntl/ntl_ZZ_pContext.pxd b/src/sage/libs/ntl/ntl_ZZ_pContext.pxd index 124ba102ac8..171776d85d7 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pContext.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pContext.pxd @@ -3,7 +3,7 @@ from .ntl_ZZ cimport ntl_ZZ from .types cimport ZZ_c -cdef class ntl_ZZ_pContext_class(object): +cdef class ntl_ZZ_pContext_class(): cdef ZZ_pContext_c x cdef void restore_c(self) cdef ntl_ZZ p @@ -12,7 +12,7 @@ cdef class ntl_ZZ_pContext_class(object): cpdef void _assert_is_current_modulus(self) except * -cdef class ntl_ZZ_pContext_factory(object): +cdef class ntl_ZZ_pContext_factory(): cdef object context_dict cdef ntl_ZZ_pContext_class make_c(self, ntl_ZZ v) diff --git a/src/sage/libs/ntl/ntl_ZZ_pContext.pyx b/src/sage/libs/ntl/ntl_ZZ_pContext.pyx index 008e6abd8eb..dbcc8af1441 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pContext.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pContext.pyx @@ -28,7 +28,7 @@ from sage.ext.cplusplus cimport ccrepr from sage.rings.integer cimport Integer -cdef class ntl_ZZ_pContext_class(object): +cdef class ntl_ZZ_pContext_class(): def __init__(self, ntl_ZZ v): """ EXAMPLES:: @@ -157,7 +157,7 @@ cdef class ntl_ZZ_pContext_class(object): ccrepr(ntl_ZZ_p_current_modulus()))) -cdef class ntl_ZZ_pContext_factory(object): +cdef class ntl_ZZ_pContext_factory(): def __init__(self): self.context_dict = {} diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pxd b/src/sage/libs/ntl/ntl_ZZ_pE.pxd index d7d265b437d..267608a016d 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pxd @@ -2,7 +2,7 @@ from .types cimport ZZ_pE_c from .ntl_ZZ_pEContext cimport ntl_ZZ_pEContext_class from .ntl_ZZ_pX cimport ntl_ZZ_pX -cdef class ntl_ZZ_pE(object): +cdef class ntl_ZZ_pE(): cdef ZZ_pE_c x cdef ntl_ZZ_pEContext_class c cdef ntl_ZZ_pX get_as_ZZ_pX(ntl_ZZ_pE self) diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pyx b/src/sage/libs/ntl/ntl_ZZ_pE.pyx index 6e3684521de..82fbb086127 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pyx @@ -54,7 +54,7 @@ ZZ_sage = IntegerRing() # ZZ_pE_c: An extension of the integers modulo p # ############################################################################## -cdef class ntl_ZZ_pE(object): +cdef class ntl_ZZ_pE(): r""" The \class{ZZ_pE} class is used to model $\Z / p\Z [x] / (f(x))$. The modulus $p$ may be any positive integer, not necessarily prime, diff --git a/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd b/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd index 0e4f679218e..72c9ec42eab 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pEContext.pxd @@ -9,7 +9,7 @@ cdef struct ZZ_pEContext_ptrs: ZZ_pContext_c *zzpc -cdef class ntl_ZZ_pEContext_class(object): +cdef class ntl_ZZ_pEContext_class(): cdef ZZ_pEContext_ptrs ptrs cdef ZZ_pEContext_c x cdef ntl_ZZ_pContext_class pc diff --git a/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx b/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx index 69dcbff7469..bef581722bd 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEContext.pyx @@ -32,7 +32,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ ZZ_pEContextDict = {} -cdef class ntl_ZZ_pEContext_class(object): +cdef class ntl_ZZ_pEContext_class(): def __init__(self, ntl_ZZ_pX f): """ EXAMPLES: diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pxd b/src/sage/libs/ntl/ntl_ZZ_pEX.pxd index a07403c1842..b00e87bbcec 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pxd @@ -1,7 +1,7 @@ from .types cimport ZZ_pEX_c from .ntl_ZZ_pEContext cimport ntl_ZZ_pEContext_class -cdef class ntl_ZZ_pEX(object): +cdef class ntl_ZZ_pEX(): cdef ZZ_pEX_c x cdef ntl_ZZ_pEContext_class c #cdef void setitem_from_int(ntl_ZZ_pX self, long i, int value) diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx index a23d84bd4ad..6b874b6d41e 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx @@ -51,7 +51,7 @@ from sage.arith.power cimport generic_power_pos # ############################################################################## -cdef class ntl_ZZ_pEX(object): +cdef class ntl_ZZ_pEX(): r""" The class \class{ZZ_pEX} implements polynomials over finite ring extensions of $\Z / p\Z$. diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pxd b/src/sage/libs/ntl/ntl_ZZ_pX.pxd index 907285b2bdd..6dfed011120 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pxd @@ -1,13 +1,13 @@ from .ZZ_pX cimport * from sage.libs.ntl.ntl_ZZ_pContext cimport ntl_ZZ_pContext_class -cdef class ntl_ZZ_pX(object): +cdef class ntl_ZZ_pX(): cdef ZZ_pX_c x cdef ntl_ZZ_pContext_class c cdef void setitem_from_int(ntl_ZZ_pX self, long i, int value) cdef int getitem_as_int(ntl_ZZ_pX self, long i) cdef ntl_ZZ_pX _new(self) -cdef class ntl_ZZ_pX_Modulus(object): +cdef class ntl_ZZ_pX_Modulus(): cdef ZZ_pX_Modulus_c x cdef ntl_ZZ_pX poly diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pyx b/src/sage/libs/ntl/ntl_ZZ_pX.pyx index fd70c0bbce5..2d03c23a88f 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pyx @@ -63,7 +63,7 @@ cdef make_ZZ_pX(ZZ_pX_c* x, ntl_ZZ_pContext_class ctx): # ############################################################################## -cdef class ntl_ZZ_pX(object): +cdef class ntl_ZZ_pX(): r""" The class \class{ZZ_pX} implements polynomial arithmetic modulo `p`. @@ -1415,7 +1415,7 @@ cdef class ntl_ZZ_pX(object): #ZZ_pX_preallocate_space(&self.x, n) sig_off() -cdef class ntl_ZZ_pX_Modulus(object): +cdef class ntl_ZZ_pX_Modulus(): """ Thin holder for ZZ_pX_Moduli. """ diff --git a/src/sage/libs/ntl/ntl_lzz_p.pxd b/src/sage/libs/ntl/ntl_lzz_p.pxd index 567345427e0..ec74b46d447 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pxd +++ b/src/sage/libs/ntl/ntl_lzz_p.pxd @@ -1,7 +1,7 @@ from .lzz_p cimport * from .ntl_lzz_pContext cimport ntl_zz_pContext_class -cdef class ntl_zz_p(object): +cdef class ntl_zz_p(): cdef zz_p_c x cdef ntl_zz_pContext_class c cdef ntl_zz_p _new(ntl_zz_p self) diff --git a/src/sage/libs/ntl/ntl_lzz_p.pyx b/src/sage/libs/ntl/ntl_lzz_p.pyx index 2152f299967..bd25c536ec3 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pyx +++ b/src/sage/libs/ntl/ntl_lzz_p.pyx @@ -59,7 +59,7 @@ ZZ_sage = IntegerRing() # ############################################################################## -cdef class ntl_zz_p(object): +cdef class ntl_zz_p(): r""" The class \class{zz_p} implements arithmetic modulo $p$, for p smaller than a machine word. diff --git a/src/sage/libs/ntl/ntl_lzz_pContext.pxd b/src/sage/libs/ntl/ntl_lzz_pContext.pxd index b5b436672c9..058d2842ecc 100644 --- a/src/sage/libs/ntl/ntl_lzz_pContext.pxd +++ b/src/sage/libs/ntl/ntl_lzz_pContext.pxd @@ -1,6 +1,6 @@ from .types cimport zz_pContext_c -cdef class ntl_zz_pContext_class(object): +cdef class ntl_zz_pContext_class(): cdef zz_pContext_c x cdef void restore_c(self) cdef long p diff --git a/src/sage/libs/ntl/ntl_lzz_pContext.pyx b/src/sage/libs/ntl/ntl_lzz_pContext.pyx index 9f69dce88b0..64301157702 100644 --- a/src/sage/libs/ntl/ntl_lzz_pContext.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pContext.pyx @@ -23,7 +23,7 @@ from sage.rings.integer cimport Integer zz_pContextDict = {} -cdef class ntl_zz_pContext_class(object): +cdef class ntl_zz_pContext_class(): def __init__(self, long v): """ EXAMPLES:: diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pxd b/src/sage/libs/ntl/ntl_lzz_pX.pxd index e96c44c6ae0..3ab79084299 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pxd +++ b/src/sage/libs/ntl/ntl_lzz_pX.pxd @@ -3,7 +3,7 @@ from sage.libs.ntl.lzz_pX cimport * from sage.libs.ntl.ntl_lzz_pContext cimport ntl_zz_pContext_class -cdef class ntl_zz_pX(object): +cdef class ntl_zz_pX(): cdef zz_pX_c x cdef ntl_zz_pContext_class c cdef ntl_zz_pX _new(self) diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pyx b/src/sage/libs/ntl/ntl_lzz_pX.pyx index d7a88da82fd..c181a7eae59 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pX.pyx @@ -52,7 +52,7 @@ ZZ_sage = IntegerRing() # ############################################################################## -cdef class ntl_zz_pX(object): +cdef class ntl_zz_pX(): r""" The class \class{zz_pX} implements polynomial arithmetic modulo $p$, for p smaller than a machine word. diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pxd b/src/sage/libs/ntl/ntl_mat_GF2.pxd index cae49b8313e..b900d2f9e3f 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pxd +++ b/src/sage/libs/ntl/ntl_mat_GF2.pxd @@ -1,7 +1,7 @@ from .types cimport mat_GF2_c from .ntl_GF2 cimport ntl_GF2 -cdef class ntl_mat_GF2(object): +cdef class ntl_mat_GF2(): cdef mat_GF2_c x cdef ntl_GF2 _new_element(self) cdef ntl_mat_GF2 _new(self) diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pyx b/src/sage/libs/ntl/ntl_mat_GF2.pyx index 6967d469cef..acdf12dc4dd 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2.pyx @@ -45,7 +45,7 @@ from sage.rings.integer cimport Integer from sage.libs.ntl.ntl_ZZ import unpickle_class_args -cdef class ntl_mat_GF2(object): +cdef class ntl_mat_GF2(): r""" The \class{mat_GF2} class implements arithmetic with matrices over $F_2$. """ diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pxd b/src/sage/libs/ntl/ntl_mat_GF2E.pxd index 3a30fca6dd6..5c8aacd5cef 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pxd +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pxd @@ -2,7 +2,7 @@ from .types cimport mat_GF2E_c from .ntl_GF2EContext cimport ntl_GF2EContext_class from .ntl_GF2E cimport ntl_GF2E -cdef class ntl_mat_GF2E(object): +cdef class ntl_mat_GF2E(): cdef mat_GF2E_c x cdef ntl_GF2EContext_class c cdef ntl_GF2E _new_element(self) diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pyx b/src/sage/libs/ntl/ntl_mat_GF2E.pyx index 85fd9d6d46f..6cc41e9318a 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pyx @@ -45,7 +45,7 @@ from sage.misc.randstate cimport randstate, current_randstate from sage.libs.ntl.ntl_ZZ import unpickle_class_args -cdef class ntl_mat_GF2E(object): +cdef class ntl_mat_GF2E(): r""" The \class{mat_GF2E} class implements arithmetic with matrices over $GF(2**x)$. """ diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pxd b/src/sage/libs/ntl/ntl_mat_ZZ.pxd index af3ada9e97a..f766e82c187 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pxd +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pxd @@ -1,5 +1,5 @@ from .types cimport mat_ZZ_c -cdef class ntl_mat_ZZ(object): +cdef class ntl_mat_ZZ(): cdef mat_ZZ_c x cdef long __nrows, __ncols diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pyx b/src/sage/libs/ntl/ntl_mat_ZZ.pyx index c9f054602e8..6f7cc3da0b9 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pyx @@ -67,7 +67,7 @@ cdef inline ntl_mat_ZZ make_mat_ZZ_sig_off(mat_ZZ_c* x): # ############################################################################## -cdef class ntl_mat_ZZ(object): +cdef class ntl_mat_ZZ(): # see ntl_mat_ZZ.pxd for data members r""" The \class{mat_ZZ} class implements arithmetic with matrices over $\Z$. diff --git a/src/sage/libs/singular/function_factory.py b/src/sage/libs/singular/function_factory.py index c3ba54dd371..c4b0b52372f 100644 --- a/src/sage/libs/singular/function_factory.py +++ b/src/sage/libs/singular/function_factory.py @@ -15,7 +15,7 @@ from sage.libs.singular.function import singular_function, lib, list_of_functions -class SingularFunctionFactory(object): +class SingularFunctionFactory(): """ A convenient interface to libsingular functions. """ diff --git a/src/sage/libs/singular/ring.pyx b/src/sage/libs/singular/ring.pyx index d49cf529073..04bd16e8784 100644 --- a/src/sage/libs/singular/ring.pyx +++ b/src/sage/libs/singular/ring.pyx @@ -505,7 +505,7 @@ cdef ring *singular_ring_new(base_ring, n, names, term_order) except NULL: ring_refcount_dict = defaultdict(int) -cdef class ring_wrapper_Py(object): +cdef class ring_wrapper_Py(): r""" Python object wrapping the ring pointer. diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 90d87b6e49d..da5b4cf9da4 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -1639,7 +1639,7 @@ cdef class Matrix(Matrix1): Q = (At * A) * (B * Bt) return Bt * ~Q * At - def rook_vector(self, algorithm="ButeraPernici", complement=False, use_complement=None): + def rook_vector(self, algorithm=None, complement=False, use_complement=None): r""" Return the rook vector of this matrix. @@ -1794,6 +1794,9 @@ cdef class Matrix(Matrix1): zero = self.base_ring().zero() one = self.base_ring().one() + if algorithm is None: + algorithm = "ButeraPernici" + # we first run through the coefficients of the matrix to compute the # number of non-zero coefficients and to see whether or not it contains # only elements in {0,1}... but this is not always needed @@ -4407,7 +4410,7 @@ cdef class Matrix(Matrix1): algorithm = kwds.pop('algorithm', None) if algorithm is None: algorithm = 'default' - elif not algorithm in ['default', 'generic', 'flint', 'pari', 'padic', 'pluq']: + elif algorithm not in ['default', 'generic', 'flint', 'pari', 'padic', 'pluq']: raise ValueError("matrix kernel algorithm '%s' not recognized" % algorithm ) elif algorithm == 'padic' and not (is_IntegerRing(R) or is_RationalField(R)): raise ValueError("'padic' matrix kernel algorithm only available over the rationals and the integers, not over %s" % R) @@ -4424,7 +4427,7 @@ cdef class Matrix(Matrix1): basis = kwds.pop('basis', None) if basis is None: basis = 'echelon' - elif not basis in ['computed', 'echelon', 'pivot', 'LLL']: + elif basis not in ['computed', 'echelon', 'pivot', 'LLL']: raise ValueError("matrix kernel basis format '%s' not recognized" % basis ) elif basis == 'pivot' and R not in _Fields: raise ValueError('pivot basis only available over a field, not over %s' % R) @@ -5956,7 +5959,7 @@ cdef class Matrix(Matrix1): sage: A._eigenspace_format(None) == 'all' True """ - if not format in [None, 'all', 'galois']: + if format not in [None, 'all', 'galois']: msg = "format keyword must be None, 'all' or 'galois', not {0}" raise ValueError(msg.format(format)) @@ -6244,7 +6247,7 @@ cdef class Matrix(Matrix1): ... ValueError: algebraic_multiplicity keyword must be True or False """ - if not algebraic_multiplicity in [True, False]: + if algebraic_multiplicity not in [True, False]: msg = 'algebraic_multiplicity keyword must be True or False' raise ValueError(msg.format(algebraic_multiplicity)) if not self.is_square(): @@ -6486,7 +6489,7 @@ cdef class Matrix(Matrix1): ... ValueError: algebraic_multiplicity keyword must be True or False """ - if not algebraic_multiplicity in [True, False]: + if algebraic_multiplicity not in [True, False]: msg = 'algebraic_multiplicity keyword must be True or False' raise ValueError(msg.format(algebraic_multiplicity)) if not self.is_square(): @@ -8163,7 +8166,7 @@ cdef class Matrix(Matrix1): ... TypeError: subdivide must be True or False, not junk """ - if not subdivide in [True, False]: + if subdivide not in [True, False]: raise TypeError("subdivide must be True or False, not %s" % subdivide) R = self.base_ring() ident = self.matrix_space(self.nrows(), self.nrows()).one() @@ -12357,7 +12360,7 @@ cdef class Matrix(Matrix1): raise TypeError('polynomial variable must be a string or polynomial ring generator, not {0}'.format(var)) elif var.base_ring() != R: raise TypeError('polynomial generator must be over the same ring as the matrix entries') - if not basis in ['echelon', 'iterates']: + if basis not in ['echelon', 'iterates']: raise ValueError("basis format must be 'echelon' or 'iterates', not {0}".format(basis)) if not self.is_square(): raise TypeError('matrix must be square, not {0} x {1}'.format(self.nrows(), self.ncols())) @@ -13249,10 +13252,10 @@ cdef class Matrix(Matrix1): sage: P.base_ring() Finite Field of size 11 """ - if not pivot in [None, 'partial', 'nonzero']: + if pivot not in [None, 'partial', 'nonzero']: msg = "pivot strategy must be None, 'partial' or 'nonzero', not {0}" raise ValueError(msg.format(pivot)) - if not format in ['compact', 'plu']: + if format not in ['compact', 'plu']: msg = "format must be 'plu' or 'compact', not {0}" raise ValueError(msg.format(format)) @@ -13541,7 +13544,7 @@ cdef class Matrix(Matrix1): cdef Py_ssize_t m, i, j, k cdef Matrix L - if not algorithm in ['symmetric', 'hermitian']: + if algorithm not in ['symmetric', 'hermitian']: msg = "'algorithm' must be 'symmetric' or 'hermitian', not {0}" raise ValueError(msg.format(algorithm)) cache_string = 'indefinite_factorization_' + algorithm @@ -13551,7 +13554,7 @@ cdef class Matrix(Matrix1): if not self.is_square(): msg = "matrix must be square, not {0} x {1}" raise ValueError(msg.format(self.nrows(), self.ncols())) - if not algorithm in ['symmetric', 'hermitian']: + if algorithm not in ['symmetric', 'hermitian']: msg = "'algorithm' must be 'symmetric' or 'hermitian', not {0}" raise ValueError(msg.format(algorithm)) if not R.is_exact(): diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index d62c2f2c14b..d21e6713cc4 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -689,7 +689,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): p = sage.rings.integer.Integer(p) except TypeError: raise ValueError("matrix norm 'p' must be +/- infinity, 'frob' or an integer, not %s" % p) - if not p in [-2,-1,1,2]: + if p not in [-2, -1, 1, 2]: raise ValueError("matrix norm integer values of 'p' must be -2, -1, 1 or 2, not %s" % p) return sage.rings.real_double.RDF(numpy.linalg.norm(self._matrix_numpy, ord=p)) @@ -1301,7 +1301,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): tol = algorithm algorithm = other other = None - if not algorithm in ['default', 'symmetric', 'hermitian']: + if algorithm not in ['default', 'symmetric', 'hermitian']: msg = "algorithm must be 'default', 'symmetric', or 'hermitian', not {0}" raise ValueError(msg.format(algorithm)) if not self.is_square(): @@ -2347,7 +2347,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): raise TypeError('tolerance must be a real number, not {0}'.format(tol)) if tol <= 0: raise ValueError('tolerance must be positive, not {0}'.format(tol)) - if not algorithm in ['naive', 'orthonormal']: + if algorithm not in ['naive', 'orthonormal']: raise ValueError("algorithm must be 'naive' or 'orthonormal', not {0}".format(algorithm)) key = 'unitary_{0}_{1}'.format(algorithm, tol) b = self.fetch(key) @@ -2905,7 +2905,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): tol = float(tol) if tol <= 0: raise ValueError('tolerance must be positive, not {0}'.format(tol)) - if not algorithm in ['naive', 'orthonormal']: + if algorithm not in ['naive', 'orthonormal']: raise ValueError("algorithm must be 'naive' or 'orthonormal', not {0}".format(algorithm)) key = 'normal_{0}_{1}'.format(algorithm, tol) @@ -3200,7 +3200,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): raise ValueError('Schur decomposition requires a square matrix, not a {0} x {1} matrix'.format(self.nrows(), self.ncols())) if base_ring is None: base_ring = self.base_ring() - if not base_ring in [RDF, CDF]: + if base_ring not in [RDF, CDF]: raise ValueError('base ring of Schur decomposition matrices must be RDF or CDF, not {0}'.format(base_ring)) if self.base_ring() != base_ring: diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 9e35ce8395c..734f1b01964 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -4740,7 +4740,7 @@ cdef class Matrix_integer_dense(Matrix_dense): # Step 5: Apply p-adic solver C = B.matrix_from_columns(pivots) pivots_ = set(pivots) - non_pivots = [i for i in range(B.ncols()) if not i in pivots_] + non_pivots = [i for i in range(B.ncols()) if i not in pivots_] D = B.matrix_from_columns(non_pivots) t = verbose('calling %s solver'%solver, level=2, caller_name='p-adic echelon') if solver == 'iml': diff --git a/src/sage/matrix/strassen.pyx b/src/sage/matrix/strassen.pyx index cd7fe1fc684..cd343bd92e8 100644 --- a/src/sage/matrix/strassen.pyx +++ b/src/sage/matrix/strassen.pyx @@ -802,9 +802,11 @@ def test(n, m, R, c=2): 4 True """ from sage.matrix.constructor import matrix - A = matrix(R,n,m,range(n*m)) - B = A.__copy__(); B._echelon_in_place_classical() - C = A.__copy__(); C._echelon_strassen(c) + A = matrix(R, n, m, range(n * m)) + B = A.__copy__() + B._echelon_in_place_classical() + C = A.__copy__() + C._echelon_strassen(c) return B == C diff --git a/src/sage/matroids/lean_matrix.pyx b/src/sage/matroids/lean_matrix.pyx index 8ea413b9dd8..01aaefc2f27 100644 --- a/src/sage/matroids/lean_matrix.pyx +++ b/src/sage/matroids/lean_matrix.pyx @@ -397,7 +397,7 @@ cdef class LeanMatrix: return (left)._matrix_times_matrix_(right) else: return NotImplemented - if not left in (right).base_ring(): + if left not in (right).base_ring(): try: left = (right).base_ring()(left) except (TypeError, NotImplemented, ValueError): diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index bdc88768dde..917017f6afe 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -321,7 +321,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): if keep_initial_representation: self._representation = A.copy() # Deprecated Sage matrix operation P = gauss_jordan_reduce(A, xrange(A.ncols())) - self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if not c in P]) + self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if c not in P]) else: reduced = True if not isinstance(reduced_matrix, LeanMatrix): @@ -5785,7 +5785,7 @@ cdef class RegularMatroid(LinearMatroid): if keep_initial_representation: self._representation = A.copy() # Deprecated Sage matrix operation P = gauss_jordan_reduce(A, xrange(A.ncols())) - self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if not c in P]) + self._A = A.matrix_from_rows_and_columns(range(len(P)), [c for c in xrange(matrix.ncols()) if c not in P]) else: reduced = True if not isinstance(reduced_matrix, PlusMinusOneMatrix): diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index da767ea18f5..302644c190c 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -133,6 +133,7 @@ additional functionality (e.g. linear extensions). - Construction - :meth:`union() ` + - :math:`direct_sum() ` - Misc - :meth:`broken_circuit_complex() ` @@ -1527,7 +1528,7 @@ cdef class Matroid(SageObject): B = frozenset(B) if not self.is_basis(B): raise ValueError("input B is not a basis of the matroid.") - if not e in self.groundset(): + if e not in self.groundset(): raise ValueError("input e is not an element of the groundset.") return self._fundamental_circuit(B, e) @@ -1897,7 +1898,7 @@ cdef class Matroid(SageObject): B = frozenset(B) if not self.is_basis(B): raise ValueError("input B is not a basis of the matroid.") - if not e in B: + if e not in B: raise ValueError("input e is not an element of B.") return self._fundamental_cocircuit(B, e) @@ -2351,7 +2352,7 @@ cdef class Matroid(SageObject): False """ E = list(self.groundset()) - for i in xrange(0, len(E) + 1): + for i in range(len(E) + 1): for X in combinations(E, i): XX = frozenset(X) rX = self._rank(XX) @@ -4390,13 +4391,13 @@ cdef class Matroid(SageObject): rH = self._rank(H) if rH < r: if rH + self._rank(FF.union(F)) == self._rank(FF) + r: - if not H in final_list: + if H not in final_list: temp_list.add(H) # Check upper closure (going just one level up) if r < self.full_rank() - 1: for e in self.groundset().difference(F): FF = self.closure(F.union([e])) - if self._rank(FF) > r and not FF in final_list: + if self._rank(FF) > r and FF not in final_list: temp_list.add(FF) final_list.add(F) return final_list @@ -7091,7 +7092,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = other._circuit(Y.union([u])) - set([u]) # if u in X2 then out_neighbors[u] was set to empty for y in out_neighbors[u]: m2 = m + weights[y] - if not y in w or w[y] > m2: + if y not in w or w[y] > m2: predecessor[y] = u w[y] = m2 next_layer.add(y) @@ -7104,7 +7105,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = X - self._closure(Y - set([u])) for x in out_neighbors[u]: m2 = m - weights[x] - if not x in w or w[x] > m2: + if x not in w or w[x] > m2: predecessor[x] = u w[x] = m2 next_layer.add(x) @@ -7256,7 +7257,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = other._circuit(Y.union([u])) - set([u]) # if u in X2 then out_neighbors[u] was set to empty for y in out_neighbors[u]: m2 = m + 1 - if not y in w or w[y] > m2: + if y not in w or w[y] > m2: w[y] = m2 next_layer.add(y) todo = next_layer @@ -7275,7 +7276,7 @@ cdef class Matroid(SageObject): out_neighbors[u] = X - self._closure(Y - set([u])) for x in out_neighbors[u]: m2 = m - 1 - if not x in w or w[x] > m2: + if x not in w or w[x] > m2: w[x] = m2 next_layer.add(x) todo = next_layer @@ -8011,7 +8012,8 @@ cdef class Matroid(SageObject): OUTPUT: - An instance of MatroidUnion. + An instance of + :class:`MatroidUnion `. EXAMPLES:: @@ -8035,3 +8037,53 @@ cdef class Matroid(SageObject): # place this matroid at the beginning of the list matroids.insert(0, self) return union_matroid.MatroidUnion(iter(matroids)) + + def direct_sum(self, matroids): + r""" + Return the matroid direct sum with another matroid or list of + matroids. + + Let `(M_1, M_2, \ldots, M_k)` be a list of matroids where each `M_i` + has ground set `E_i`. The matroid sum `(E_1,I_1),\ldots,(E_n,I_n)` + is a matroid `(E,I)` where `E= \bigsqcup_{i=1}^n E_i` and + `I= \bigsqcup_{i=1}^n I_i`. + + INPUT: + + - ``matroids`` - a matroid or list of matroids + + OUTPUT: + + An instance of + :class:`MatroidSum ` + + EXAMPLES:: + + sage: M = matroids.named_matroids.Pappus() + sage: N = matroids.named_matroids.Fano().direct_sum(M); N + Matroid of rank 6 on 16 elements as matroid sum of + Binary matroid of rank 3 on 7 elements, type (3, 0) + Matroid of rank 3 on 9 elements with circuit-closures + {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, + {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'}, + {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}}, + 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}} + sage: len(N.independent_sets()) + 6897 + sage: len(N.bases()) + 2100 + """ + from . import union_matroid + if isinstance(matroids, Matroid): + matroids = [matroids] + else: + for M in matroids: + if not isinstance(M, Matroid): + raise TypeError("can only take the sum with a " + "matroid or list of matroids") + matroids = [M for M in matroids if M] + if not matroids: + return self + # place this matroid at the beginning of the list + matroids.insert(0, self) + return union_matroid.MatroidSum(iter(matroids)) diff --git a/src/sage/misc/abstract_method.py b/src/sage/misc/abstract_method.py index 49dc59ba9fa..99604777c08 100644 --- a/src/sage/misc/abstract_method.py +++ b/src/sage/misc/abstract_method.py @@ -33,7 +33,7 @@ def abstract_method(f=None, optional=False): We create a class with an abstract method:: - sage: class A(object): + sage: class A(): ....: ....: @abstract_method ....: def my_method(self): @@ -60,7 +60,7 @@ def abstract_method(f=None, optional=False): It is also possible to mark abstract methods as optional:: - sage: class A(object): + sage: class A(): ....: ....: @abstract_method(optional = True) ....: def my_method(self): @@ -138,7 +138,7 @@ def abstract_method(f=None, optional=False): return AbstractMethod(f, optional) -class AbstractMethod(object): +class AbstractMethod(): def __init__(self, f, optional=False): """ Constructor for abstract methods @@ -193,7 +193,7 @@ def _sage_src_lines_(self): sage: src[0] 'def banner():\n' sage: lines - 81 + 89 """ from sage.misc.sageinspect import sage_getsourcelines return sage_getsourcelines(self._f) diff --git a/src/sage/misc/all.py b/src/sage/misc/all.py index 56d66f0f5f0..c5b9120da9a 100644 --- a/src/sage/misc/all.py +++ b/src/sage/misc/all.py @@ -2,6 +2,8 @@ from .lazy_import import lazy_import from .all__sagemath_objects import * +from .all__sagemath_environment import * +from .all__sagemath_repl import * from .misc import (BackslashOperator, cputime, @@ -17,8 +19,6 @@ from .banner import version, banner -from .temporary_file import tmp_dir, tmp_filename - from .dev_tools import runsnake, import_statements from .html import html, pretty_print_default @@ -64,10 +64,6 @@ from .defaults import (set_default_variable_name, series_precision, set_series_precision) -from .sage_eval import sage_eval, sageobj - -from .sage_input import sage_input - lazy_import("sage.misc.cython", "cython_lambda") lazy_import("sage.misc.cython", "cython_compile", "cython") diff --git a/src/sage/misc/all__sagemath_environment.py b/src/sage/misc/all__sagemath_environment.py new file mode 100644 index 00000000000..f25faa1289d --- /dev/null +++ b/src/sage/misc/all__sagemath_environment.py @@ -0,0 +1 @@ +from .temporary_file import tmp_dir, tmp_filename diff --git a/src/sage/misc/all__sagemath_repl.py b/src/sage/misc/all__sagemath_repl.py new file mode 100644 index 00000000000..f5891ff1242 --- /dev/null +++ b/src/sage/misc/all__sagemath_repl.py @@ -0,0 +1,3 @@ +from .sage_eval import sage_eval, sageobj + +from .sage_input import sage_input diff --git a/src/sage/misc/banner.py b/src/sage/misc/banner.py index 990fc9a12d4..bae5db95d29 100644 --- a/src/sage/misc/banner.py +++ b/src/sage/misc/banner.py @@ -67,13 +67,21 @@ def banner_text(full=True): a(u"│ %-66s │\n" % 'Using Python {}.{}.{}. Type "help()" for help.'.format(*python_version)) a(u'└' + bars + u'┘') pre = version_dict()['prerelease'] - if pre: + try: + import sage.all + have_sage_all = True + except ImportError: + have_sage_all = False + if pre or not have_sage_all: red_in = '\033[31m' red_out = '\033[0m' bars2 = bars.replace(u'─', u'━') a('\n') a(red_in + u'┏' + bars2 + u'┓' + '\n') - a(u"┃ %-66s ┃\n" % 'Warning: this is a prerelease version, and it may be unstable.') + if pre: + a(u"┃ %-66s ┃\n" % 'Warning: this is a prerelease version, and it may be unstable.') + if not have_sage_all: + a(u"┃ %-66s ┃\n" % 'Warning: sage.all is not available; this is a limited REPL.') a(u'┗' + bars2 + u'┛' + red_out) return u''.join(s) diff --git a/src/sage/misc/c3.pyx b/src/sage/misc/c3.pyx index 77eb223c250..d777a0e25ca 100644 --- a/src/sage/misc/c3.pyx +++ b/src/sage/misc/c3.pyx @@ -123,9 +123,9 @@ cpdef list C3_algorithm(object start, str bases, str attribute, bint proper): Regression test for bug #1 of :trac:`13501`:: - sage: class C(object): pass - sage: class F(object): pass - sage: class G(object): pass + sage: class C(): pass + sage: class F(): pass + sage: class G(): pass sage: class B(C,F): pass sage: class D(F,G): pass sage: class E(F): pass @@ -147,7 +147,7 @@ cpdef list C3_algorithm(object start, str bases, str attribute, bint proper): fail since ``A`` asks for ``B`` to come before ``C``, where as ``B`` is a super class of ``C``:: - sage: class B(object): pass + sage: class B(): pass sage: class C(B): pass sage: class A(B, C): pass Traceback (most recent call last): diff --git a/src/sage/misc/c3_controlled.pyx b/src/sage/misc/c3_controlled.pyx index 1b16dd62b8e..ebadb070d1d 100644 --- a/src/sage/misc/c3_controlled.pyx +++ b/src/sage/misc/c3_controlled.pyx @@ -31,11 +31,11 @@ The problem Consider the following hierarchy of classes:: - sage: class A1(object): pass - sage: class A2(object): + sage: class A1(): pass + sage: class A2(): ....: def foo(self): return 2 - sage: class A3(object): pass - sage: class A4(object): + sage: class A3(): pass + sage: class A4(): ....: def foo(self): return 4 sage: class A5(A2, A1): ....: def foo(self): return 5 @@ -1071,6 +1071,7 @@ class HierarchyElement(object, metaclass=ClasscallMetaclass): succ = succ.neighbors_out if key is None: key = identity + @cached_function def f(x): return typecall(cls, x, [f(y) for y in succ(x)], key, f) diff --git a/src/sage/misc/cachefunc.pxd b/src/sage/misc/cachefunc.pxd index e77d6e305fd..d3cc677dece 100644 --- a/src/sage/misc/cachefunc.pxd +++ b/src/sage/misc/cachefunc.pxd @@ -3,7 +3,7 @@ from .function_mangling cimport ArgumentFixer cpdef dict_key(o) cpdef cache_key(o) -cdef class CachedFunction(object): +cdef class CachedFunction(): cdef public str __name__ cdef public str __module__ cdef ArgumentFixer _argument_fixer @@ -17,7 +17,7 @@ cdef class CachedFunction(object): cdef key cdef bint do_pickle -cdef class CachedMethod(object): +cdef class CachedMethod(): cdef str _cache_name cdef public str __name__ cdef public str __module__ diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx index c74d9d83fd0..d76126c3472 100644 --- a/src/sage/misc/cachefunc.pyx +++ b/src/sage/misc/cachefunc.pyx @@ -599,7 +599,7 @@ cdef cache_key_unhashable(o): return cache_key(k) -cdef class CachedFunction(object): +cdef class CachedFunction(): """ Create a cached version of a function, which only recomputes values it hasn't already computed. Synonyme: ``cached_function`` @@ -1435,7 +1435,7 @@ cdef class WeakCachedFunction(CachedFunction): weak_cached_function = decorator_keywords(WeakCachedFunction) -class CachedMethodPickle(object): +class CachedMethodPickle(): """ This class helps to unpickle cached methods. @@ -1798,7 +1798,7 @@ cdef class CachedMethodCaller(CachedFunction): :: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, x): ....: self._x = x ....: @cached_method @@ -1829,7 +1829,7 @@ cdef class CachedMethodCaller(CachedFunction): TESTS:: - sage: class A(object): + sage: class A(): ....: def _f_normalize(self, x, algorithm): return x ....: @cached_method(key=_f_normalize) ....: def f(self, x, algorithm='default'): return x @@ -1913,7 +1913,7 @@ cdef class CachedMethodCaller(CachedFunction): :meth:`sage.structure.sage_object.SageObject._cache_key`:: sage: K. = Qq(4) # optional - sage.rings.padics - sage: class A(object): + sage: class A(): ....: @cached_method ....: def f(self, x): return x+x sage: a = A() @@ -1956,7 +1956,7 @@ cdef class CachedMethodCaller(CachedFunction): EXAMPLES:: - sage: class CachedMethodTest(object): + sage: class CachedMethodTest(): ....: @cached_method ....: def f(self, x): ....: return x @@ -2110,7 +2110,7 @@ cdef class CachedMethodCaller(CachedFunction): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: @cached_method ....: def f(self, i): ....: return i^2 @@ -2495,7 +2495,7 @@ cdef class GloballyCachedMethodCaller(CachedMethodCaller): sage: class MyParent(Parent): ....: pass - sage: class MyElement(object): + sage: class MyElement(): ....: def __init__(self, x): ....: self.x = x ....: def parent(self): @@ -2513,7 +2513,7 @@ cdef class GloballyCachedMethodCaller(CachedMethodCaller): return (self._instance, k) -cdef class CachedMethod(object): +cdef class CachedMethod(): """ A decorator that creates a cached version of an instance method of a class. @@ -2527,7 +2527,7 @@ cdef class CachedMethod(object): EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: @cached_method ....: def f(self, t, x=2): ....: print('computing') @@ -2561,7 +2561,7 @@ cdef class CachedMethod(object): custom cache key for inputs. In the following example, this parameter is used to ignore the ``algorithm`` keyword for caching:: - sage: class A(object): + sage: class A(): ....: def _f_normalize(self, x, algorithm): return x ....: @cached_method(key=_f_normalize) ....: def f(self, x, algorithm='default'): return x @@ -2572,7 +2572,7 @@ cdef class CachedMethod(object): The parameter ``do_pickle`` can be used to enable pickling of the cache. Usually the cache is not stored when pickling:: - sage: class A(object): + sage: class A(): ....: @cached_method ....: def f(self, x): return None sage: import __main__ @@ -2587,7 +2587,7 @@ cdef class CachedMethod(object): When ``do_pickle`` is set, the pickle contains the contents of the cache:: - sage: class A(object): + sage: class A(): ....: @cached_method(do_pickle=True) ....: def f(self, x): return None sage: __main__.A = A @@ -2624,7 +2624,7 @@ cdef class CachedMethod(object): """ EXAMPLES:: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, x): ....: self._x = x ....: @cached_method @@ -2699,7 +2699,7 @@ cdef class CachedMethod(object): sage: from sage.misc.superseded import deprecated_function_alias - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, x): ....: self._x = x ....: @cached_method @@ -3163,7 +3163,7 @@ cdef class CachedInParentMethod(CachedMethod): Test that ``key`` works:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self._parent = MyParent() ....: def parent(self): return self._parent @@ -3177,7 +3177,7 @@ cdef class CachedInParentMethod(CachedMethod): Test that ``do_pickle`` works. Usually the contents of the cache are not pickled:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self._parent = MyParent() ....: def parent(self): return self._parent @@ -3197,7 +3197,7 @@ cdef class CachedInParentMethod(CachedMethod): Pickling can be enabled with ``do_pickle``:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self._parent = MyParent() ....: def parent(self): return self._parent @@ -3308,7 +3308,7 @@ cdef class CachedInParentMethod(CachedMethod): cached_in_parent_method = decorator_keywords(CachedInParentMethod) -class FileCache(object): +class FileCache(): """ :class:`FileCache` is a dictionary-like class which stores keys and values on disk. The keys take the form of a tuple ``(A,K)`` diff --git a/src/sage/misc/call.py b/src/sage/misc/call.py index 7b579f45a4d..71368bbadd5 100644 --- a/src/sage/misc/call.py +++ b/src/sage/misc/call.py @@ -18,7 +18,7 @@ ############################################# # Operators ############################################# -class AttrCallObject(object): +class AttrCallObject(): def __init__(self, name, args, kwds): """ TESTS:: diff --git a/src/sage/misc/classcall_metaclass.pyx b/src/sage/misc/classcall_metaclass.pyx index 2f7038e9a9f..191534f76ee 100644 --- a/src/sage/misc/classcall_metaclass.pyx +++ b/src/sage/misc/classcall_metaclass.pyx @@ -460,7 +460,7 @@ def typecall(pytype cls, *args, **kwds): EXAMPLES:: sage: from sage.misc.classcall_metaclass import typecall - sage: class Foo(object): pass + sage: class Foo(): pass sage: typecall(Foo) <__main__.Foo object at 0x...> sage: typecall(list) @@ -473,7 +473,7 @@ def typecall(pytype cls, *args, **kwds): # Class for timing:: -class CRef(object): +class CRef(): def __init__(self, i): """ TESTS:: @@ -538,7 +538,7 @@ def timeCall(T, int n, *args): 625 loops, best of 3: 41.4 µs per loop sage: i1 = int(1); i3 = int(3) # don't use Sage's Integer - sage: class PRef(object): + sage: class PRef(): ....: def __init__(self, i): ....: self.i = i+i1 diff --git a/src/sage/misc/converting_dict.py b/src/sage/misc/converting_dict.py index 48f3f5de3a5..7476555e210 100644 --- a/src/sage/misc/converting_dict.py +++ b/src/sage/misc/converting_dict.py @@ -93,7 +93,7 @@ def __init__(self, key_conversion_function, data=None): sage: list(KeyConvertingDict(int, [("9", 99)]).items()) [(9, 99)] """ - super(KeyConvertingDict, self).__init__() + super().__init__() self.key_conversion_function = key_conversion_function if data: self.update(data) @@ -115,7 +115,7 @@ def __getitem__(self, key): 42 """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__getitem__(key) + return super().__getitem__(key) def __setitem__(self, key, value): r""" @@ -135,7 +135,7 @@ def __setitem__(self, key, value): [(3, 42)] """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__setitem__(key, value) + return super().__setitem__(key, value) def __delitem__(self, key): r""" @@ -155,7 +155,7 @@ def __delitem__(self, key): 0 """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__delitem__(key) + return super().__delitem__(key) def __contains__(self, key): r""" @@ -176,7 +176,7 @@ def __contains__(self, key): False """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).__contains__(key) + return super().__contains__(key) def pop(self, key, *args): r""" @@ -202,7 +202,7 @@ def pop(self, key, *args): KeyError: ... """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).pop(key, *args) + return super().pop(key, *args) def setdefault(self, key, default=None): r""" @@ -223,7 +223,7 @@ def setdefault(self, key, default=None): [(3, None)] """ key = self.key_conversion_function(key) - return super(KeyConvertingDict, self).setdefault(key, default) + return super().setdefault(key, default) def update(self, *args, **kwds): r""" @@ -253,7 +253,7 @@ def update(self, *args, **kwds): {x: 42} """ f = self.key_conversion_function - u = super(KeyConvertingDict, self).update + u = super().update if args: if len(args) != 1: raise TypeError("update expected at most 1 argument") diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index 4e98d4adb42..75148523b4e 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -341,7 +341,7 @@ def cython(filename, verbose=0, compile_message=False, libraries=standard_libs, library_dirs=standard_libdirs) - directives = dict(language_level=sys.version_info[0], cdivision=True) + directives = dict(language_level=3, cdivision=True) try: # Change directories to target_dir so that Cython produces the correct diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py index a41c8413bb8..28c52448813 100644 --- a/src/sage/misc/decorators.py +++ b/src/sage/misc/decorators.py @@ -175,7 +175,7 @@ def f(wrapper, assigned=assigned, updated=updated): # Infix operator decorator -class infix_operator(object): +class infix_operator(): """ A decorator for functions which allows for a hack that makes the function behave like an infix operator. @@ -256,7 +256,7 @@ def __call__(self, func): return wrapper_inst -class _infix_wrapper(object): +class _infix_wrapper(): function = None def __init__(self, left=None, right=None): @@ -345,7 +345,7 @@ def my_wrap(*args, **kwds): return my_wrap -class suboptions(object): +class suboptions(): def __init__(self, name, **options): """ A decorator for functions which collects all keywords @@ -428,7 +428,7 @@ def listForNone(l): return wrapper -class options(object): +class options(): def __init__(self, **options): """ A decorator for functions which allows for default options to be @@ -566,7 +566,7 @@ def reset(): return wrapper -class rename_keyword(object): +class rename_keyword(): def __init__(self, deprecated=None, deprecation=None, **renames): """ A decorator which renames keyword arguments and optionally diff --git a/src/sage/misc/element_with_label.py b/src/sage/misc/element_with_label.py index c2f513bdab8..2410851c7de 100644 --- a/src/sage/misc/element_with_label.py +++ b/src/sage/misc/element_with_label.py @@ -15,7 +15,7 @@ from sage.misc.latex import latex -class ElementWithLabel(object): +class ElementWithLabel(): """ Auxiliary class for showing/viewing :class:`Poset`s with non-injective labelings. diff --git a/src/sage/misc/explain_pickle.py b/src/sage/misc/explain_pickle.py index 946dd8057c0..b8fe3e93fe4 100644 --- a/src/sage/misc/explain_pickle.py +++ b/src/sage/misc/explain_pickle.py @@ -320,7 +320,7 @@ def name_is_valid(name): # This string is used as the representation of a mark. the_mark = 'mark' -class PickleObject(object): +class PickleObject(): r""" Pickles have a stack-based virtual machine. The explain_pickle pickle interpreter mostly uses SageInputExpressions, from sage_input, @@ -374,7 +374,7 @@ def _sage_input_(self, sib, coerced): self.immutable = True return self.expression -class PickleDict(object): +class PickleDict(): r""" An object which can be used as the value of a PickleObject. The items is a list of key-value pairs, where the keys and values are @@ -394,7 +394,7 @@ def __init__(self, items): """ self.items = items -class PickleInstance(object): +class PickleInstance(): r""" An object which can be used as the value of a PickleObject. Unlike other possible values of a PickleObject, a PickleInstance doesn't represent @@ -412,7 +412,7 @@ def __init__(self, klass): """ self.klass = klass -class PickleExplainer(object): +class PickleExplainer(): r""" An interpreter for the pickle virtual machine, that executes symbolically and constructs SageInputExpressions instead of @@ -2697,7 +2697,7 @@ def __hash__(self): return 0 -class EmptyNewstyleClass(object): +class EmptyNewstyleClass(): r""" A featureless new-style class (inherits from object); used for testing explain_pickle. @@ -2858,7 +2858,7 @@ def extend(self): raise NotImplementedError -class TestAppendNonlist(object): +class TestAppendNonlist(): r""" A list-like class, carefully designed to test exact unpickling behavior. Used for testing explain_pickle. @@ -2942,7 +2942,7 @@ def __repr__(self): return repr(self.list) -class TestBuild(object): +class TestBuild(): r""" A simple class with a __getstate__ but no __setstate__. Used for testing explain_pickle. @@ -3001,7 +3001,7 @@ def __setstate__(self, state): self.x = state[1]['y'] self.y = state[0]['x'] -class TestGlobalOldName(object): +class TestGlobalOldName(): r""" A featureless new-style class. When you try to unpickle an instance of this class, it is redirected to create a TestGlobalNewName instead. @@ -3016,7 +3016,7 @@ class TestGlobalOldName(object): pass -class TestGlobalNewName(object): +class TestGlobalNewName(): r""" A featureless new-style class. When you try to unpickle an instance of TestGlobalOldName, it is redirected to create an instance of this @@ -3048,7 +3048,7 @@ def __repr__(self): register_unpickle_override('sage.misc.explain_pickle', 'TestGlobalOldName', TestGlobalNewName, call_name=('sage.misc.explain_pickle', 'TestGlobalNewName')) -class TestGlobalFunnyName(object): +class TestGlobalFunnyName(): r""" A featureless new-style class which has a name that's not a legal Python identifier. diff --git a/src/sage/misc/inherit_comparison.pyx b/src/sage/misc/inherit_comparison.pyx index fc360533cad..a8306e83453 100644 --- a/src/sage/misc/inherit_comparison.pyx +++ b/src/sage/misc/inherit_comparison.pyx @@ -54,7 +54,7 @@ cdef class InheritComparisonMetaclass(type): sage: cython(''' ....: from sage.misc.inherit_comparison cimport InheritComparisonMetaclass ....: - ....: cdef class Base(object): + ....: cdef class Base(): ....: def __richcmp__(left, right, int op): ....: print("Calling Base.__richcmp__") ....: return left is right diff --git a/src/sage/misc/instancedoc.pyx b/src/sage/misc/instancedoc.pyx index a58fde0e081..574287fefe9 100644 --- a/src/sage/misc/instancedoc.pyx +++ b/src/sage/misc/instancedoc.pyx @@ -24,7 +24,7 @@ EXAMPLES:: sage: from sage.misc.instancedoc import instancedoc sage: @instancedoc - ....: class X(object): + ....: class X(): ....: "Class docstring" ....: def _instancedoc_(self): ....: return "Instance docstring" @@ -89,7 +89,7 @@ Check that inheritance works (after passing the subclass to :func:`instancedoc`):: sage: @instancedoc - ....: class A(object): + ....: class A(): ....: "Class A docstring" ....: def _instancedoc_(self): ....: return "Instance docstring" @@ -148,7 +148,7 @@ cdef class InstanceDocDescriptor: sage: def instancedoc(self): ....: return "Instance doc" sage: docattr = InstanceDocDescriptor("Class doc", instancedoc) - sage: class Z(object): + sage: class Z(): ....: __doc__ = InstanceDocDescriptor("Class doc", instancedoc) sage: Z.__doc__ 'Class doc' @@ -218,7 +218,7 @@ cdef class InstanceDocDescriptor: sage: def instancedoc(self): ....: return "Doc for {!r}".format(self) sage: descr = InstanceDocDescriptor("Class doc", instancedoc) - sage: class X(object): pass + sage: class X(): pass sage: obj = X() sage: descr.__set__(obj, "Custom doc") sage: obj.__doc__ @@ -246,7 +246,7 @@ cdef class InstanceDocDescriptor: sage: def instancedoc(self): ....: return "Doc for {!r}".format(self) sage: descr = InstanceDocDescriptor("Class doc", instancedoc) - sage: class X(object): pass + sage: class X(): pass sage: obj = X() sage: obj.__doc__ = "Custom doc" sage: descr.__delete__(obj) @@ -297,7 +297,7 @@ def instancedoc(cls): We get a useful error message if ``_instancedoc_`` is not defined:: sage: from sage.misc.instancedoc import instancedoc - sage: class X(object): pass + sage: class X(): pass sage: instancedoc(X) Traceback (most recent call last): ... diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index d4fcca9e5d0..8f698ffc2e6 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -728,7 +728,8 @@ def pdf(self, filename=None, view=True, program=None): # move the pdf into the good location if filename: filename = os.path.abspath(filename) - os.rename(temp_filename_pdf, filename) + import shutil + shutil.move(temp_filename_pdf, filename) return filename # open the tmp pdf @@ -816,7 +817,8 @@ def png(self, filename=None, density=150, view=True): # move the png into the good location if filename: filename = os.path.abspath(filename) - os.rename(temp_filename_png, filename) + import shutil + shutil.move(temp_filename_png, filename) return filename # open the tmp png @@ -915,7 +917,8 @@ def svg(self, filename=None, view=True, program='pdftocairo'): # move the svg into the good location if filename: filename = os.path.abspath(filename) - os.rename(temp_filename_svg, filename) + import shutil + shutil.move(temp_filename_svg, filename) return filename # open the tmp svg diff --git a/src/sage/misc/lazy_attribute.pyx b/src/sage/misc/lazy_attribute.pyx index c6e7b5110bb..8a1f02b249a 100644 --- a/src/sage/misc/lazy_attribute.pyx +++ b/src/sage/misc/lazy_attribute.pyx @@ -22,7 +22,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -cdef class _lazy_attribute(object): +cdef class _lazy_attribute(): """ Cython base class for lazy attributes. @@ -87,7 +87,7 @@ cdef class _lazy_attribute(object): sage: src[0] 'def banner():\n' sage: lines - 81 + 89 """ from sage.misc.sageinspect import sage_getsourcelines return sage_getsourcelines(self.f) @@ -163,7 +163,7 @@ class lazy_attribute(_lazy_attribute): We create a class whose instances have a lazy attribute ``x``:: - sage: class A(object): + sage: class A(): ....: def __init__(self): ....: self.a=2 # just to have some data to calculate from ....: @@ -262,7 +262,7 @@ class lazy_attribute(_lazy_attribute): all possible without a special implementation of hasattr, so as to allow for something like:: - sage: class A (object): + sage: class A (): ....: @lazy_attribute ....: def x(self, existence_only=False): ....: if existence_only: @@ -366,11 +366,11 @@ class lazy_attribute(_lazy_attribute): w.r.t. inheritance, and maybe even ill-implemented. We illustrate this on a simple class hierarchy, with an instrumented descriptor:: - sage: class descriptor(object): + sage: class descriptor(): ....: def __get__(self, obj, cls): ....: print(cls) ....: return 1 - sage: class A(object): + sage: class A(): ....: x = descriptor() sage: class B(A): ....: pass @@ -402,7 +402,7 @@ class lazy_attribute(_lazy_attribute): Due to this, the natural implementation runs into an infinite loop in the following example:: - sage: class A(object): + sage: class A(): ....: @lazy_attribute ....: def unimplemented_A(self): ....: return NotImplemented @@ -518,7 +518,7 @@ class lazy_class_attribute(lazy_attribute): attribute is stored in the class rather than in the object. The lazy class attribute is only computed once for all the objects:: - sage: class Cl(object): + sage: class Cl(): ....: @lazy_class_attribute ....: def x(cls): ....: print("computing x") @@ -538,7 +538,7 @@ class lazy_class_attribute(lazy_attribute): First access from an object also properly triggers the computation:: - sage: class Cl1(object): + sage: class Cl1(): ....: @lazy_class_attribute ....: def x(cls): ....: print("computing x") @@ -554,7 +554,7 @@ class lazy_class_attribute(lazy_attribute): The behavior of lazy class attributes with respect to inheritance is not specified. It currently depends on the evaluation order:: - sage: class A(object): + sage: class A(): ....: @lazy_class_attribute ....: def x(cls): ....: print("computing x") diff --git a/src/sage/misc/lazy_format.py b/src/sage/misc/lazy_format.py index 88eb8798841..4a529aa1bc6 100644 --- a/src/sage/misc/lazy_format.py +++ b/src/sage/misc/lazy_format.py @@ -29,7 +29,7 @@ class LazyFormat(str): To demonstrate the lazyness, let us build an object with a broken ``__repr__`` method:: - sage: class IDontLikeBeingPrinted(object): + sage: class IDontLikeBeingPrinted(): ....: def __repr__(self): ....: raise ValueError("Don't ever try to print me !") diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx index bc6078d24f2..ffb53ac3d59 100644 --- a/src/sage/misc/lazy_import.pyx +++ b/src/sage/misc/lazy_import.pyx @@ -161,7 +161,7 @@ cpdef test_fake_startup(): @cython.final -cdef class LazyImport(object): +cdef class LazyImport(): """ EXAMPLES:: @@ -477,7 +477,7 @@ cdef class LazyImport(object): Now we lazy import it as a method of a new class ``Foo``:: sage: from sage.misc.lazy_import import LazyImport - sage: class Foo(object): + sage: class Foo(): ....: my_method = LazyImport('sage.all', 'my_method') Now we can use it as a usual method:: @@ -503,7 +503,7 @@ cdef class LazyImport(object): definition is not the one that actually gets used. Thus, ``__get__`` needs to manually modify the class dict:: - sage: class Foo(object): + sage: class Foo(): ....: lazy_import('sage.all', 'plot') sage: class Bar(Foo): ....: pass @@ -1013,7 +1013,7 @@ def lazy_import(module, names, as_=None, *, We check that :func:`lazy_import` also works for methods:: - sage: class Foo(object): + sage: class Foo(): ....: lazy_import('sage.all', 'plot') sage: class Bar(Foo): ....: pass diff --git a/src/sage/misc/lazy_list.pxd b/src/sage/misc/lazy_list.pxd index 944edbf9684..f8b51b47835 100644 --- a/src/sage/misc/lazy_list.pxd +++ b/src/sage/misc/lazy_list.pxd @@ -1,4 +1,4 @@ -cdef class lazy_list_generic(object): +cdef class lazy_list_generic(): cdef list cache # the cache cdef lazy_list_generic master # a reference if self is a slice cdef Py_ssize_t start, stop, step diff --git a/src/sage/misc/lazy_list.pyx b/src/sage/misc/lazy_list.pyx index b1698ddd4bc..4e25ee39299 100644 --- a/src/sage/misc/lazy_list.pyx +++ b/src/sage/misc/lazy_list.pyx @@ -348,7 +348,7 @@ def lazy_list_formatter(L, name='lazy list', return s -cdef class lazy_list_generic(object): +cdef class lazy_list_generic(): r""" A lazy list diff --git a/src/sage/misc/lazy_string.pxd b/src/sage/misc/lazy_string.pxd index cde0aa1e73d..7f7354e03ca 100644 --- a/src/sage/misc/lazy_string.pxd +++ b/src/sage/misc/lazy_string.pxd @@ -1,4 +1,4 @@ -cdef class _LazyString(object): +cdef class _LazyString(): cdef func cdef args cdef kwargs diff --git a/src/sage/misc/lazy_string.pyx b/src/sage/misc/lazy_string.pyx index bfb5b29501b..9eaa0c8c8e5 100644 --- a/src/sage/misc/lazy_string.pyx +++ b/src/sage/misc/lazy_string.pyx @@ -136,7 +136,7 @@ def _make_lazy_string(ftype, fpickle, args, kwargs): f = fpickle return _LazyString(f, args, kwargs) -cdef class _LazyString(object): +cdef class _LazyString(): """ Lazy class for strings created by a function call or a format string. diff --git a/src/sage/misc/misc.py b/src/sage/misc/misc.py index 93f2bebdb55..da354511413 100644 --- a/src/sage/misc/misc.py +++ b/src/sage/misc/misc.py @@ -176,7 +176,7 @@ def try_read(obj, splitlines=False): Custom readable:: - sage: class MyFile(object): + sage: class MyFile(): ....: def read(self): return 'Hello world!' sage: try_read(MyFile()) 'Hello world!' diff --git a/src/sage/misc/namespace_package.py b/src/sage/misc/namespace_package.py index 75d9f1d8dcc..eaa05bdfd71 100644 --- a/src/sage/misc/namespace_package.py +++ b/src/sage/misc/namespace_package.py @@ -18,3 +18,17 @@ def install_doc(package, doc): pkg = import_module(package) pkg.__doc__ = doc # enable sage.package? pkg.getdoc = lambda: doc # enable help(sage.package) + +def install_dict(package, dic): + """ + Install ``dic`` to the ``__dict__`` of the package. + + TESTS: + + sage: from sage.misc.namespace_package import install_dict + sage: install_dict('sage', {'greeting': 'hello'}) + sage: sage.greeting + 'hello' + """ + pkg = import_module(package) + pkg.__dict__.update(dic) diff --git a/src/sage/misc/nested_class.pyx b/src/sage/misc/nested_class.pyx index d27ec59923b..f30eec835ee 100644 --- a/src/sage/misc/nested_class.pyx +++ b/src/sage/misc/nested_class.pyx @@ -118,8 +118,8 @@ cpdef modify_for_nested_pickle(cls, str name_prefix, module, first_run=True): EXAMPLES:: sage: from sage.misc.nested_class import * - sage: class A(object): - ....: class B(object): + sage: class A(): + ....: class B(): ....: pass sage: module = sys.modules['__main__'] sage: A.B.__name__ @@ -220,7 +220,7 @@ def nested_pickle(cls): sage: from sage.misc.nested_class import nested_pickle sage: module = sys.modules['__main__'] - sage: class A(object): + sage: class A(): ....: class B: ....: pass sage: nested_pickle(A) @@ -238,7 +238,7 @@ def nested_pickle(cls): should work as a decorator:: sage: @nested_pickle # todo: not implemented - ....: class A2(object): + ....: class A2(): ....: class B: ....: pass sage: A2.B.__name__ # todo: not implemented @@ -267,7 +267,7 @@ cdef class NestedClassMetaclass(type): sage: class ASuperClass(object, metaclass=NestedClassMetaclass): ....: pass sage: class A3(ASuperClass): - ....: class B(object): + ....: class B(): ....: pass sage: A3.B.__name__ 'A3.B' @@ -282,7 +282,7 @@ cdef class NestedClassMetaclass(type): sage: from sage.misc.nested_class import NestedClassMetaclass sage: class A(object, metaclass=NestedClassMetaclass): - ....: class B(object): + ....: class B(): ....: pass sage: A.B @@ -303,7 +303,7 @@ class MainClass(object, metaclass=NestedClassMetaclass): """ - class NestedClass(object): + class NestedClass(): r""" EXAMPLES:: @@ -312,7 +312,7 @@ class MainClass(object, metaclass=NestedClassMetaclass): """ - class NestedSubClass(object): + class NestedSubClass(): r""" EXAMPLES:: @@ -362,7 +362,7 @@ nested_pickle(SubClass) def _provide_SubClass(): return SubClass -class CopiedClass(object): +class CopiedClass(): r""" A simple class to test nested_pickle. diff --git a/src/sage/misc/object_multiplexer.py b/src/sage/misc/object_multiplexer.py index dcb482b8df2..d4e811ef16e 100644 --- a/src/sage/misc/object_multiplexer.py +++ b/src/sage/misc/object_multiplexer.py @@ -21,7 +21,7 @@ # **************************************************************************** -class MultiplexFunction(object): +class MultiplexFunction(): """ A simple wrapper object for functions that are called on a list of objects. @@ -57,7 +57,7 @@ def __call__(self, *args, **kwds): return tuple(l) -class Multiplex(object): +class Multiplex(): """ Object for a list of children such that function calls on this new object implies that the same function is called on all diff --git a/src/sage/misc/parser.pyx b/src/sage/misc/parser.pyx index 8a563c8af2d..a365c3c79ea 100644 --- a/src/sage/misc/parser.pyx +++ b/src/sage/misc/parser.pyx @@ -272,11 +272,11 @@ cdef class Tokenizer: return NOT_EQ elif s[pos] == '=': self.pos += 2 - return '=' + return ord('=') elif s[pos] == '*' and s[pos+1] == '*': self.pos += 2 - return '^' + return ord('^') # simple tokens if s[pos] in "+-*/^()=><,[]{}!": @@ -609,13 +609,13 @@ cdef class Parser: """ cdef int token all = [] - if tokens.next() == '(': - token = ',' - while token == ',': + if tokens.next() == c'(': + token = c',' + while token == c',': all.append(self.p_list(tokens)) token = tokens.next() - if token == ')': + if token == c')': from sage.matrix.constructor import matrix return matrix(all) else: @@ -637,8 +637,8 @@ cdef class Parser: [(1, 2, 3), [a + 1, b + 2, c + 3, (d + 4,)]] """ all = [] - cdef int token = ',' - while token == ',': + cdef int token = c',' + while token == c',': token = tokens.peek() if token == MATRIX: tokens.next() @@ -651,14 +651,14 @@ cdef class Parser: else: tokens.backtrack() obj = self.p_eqn(tokens) - elif token == '[': + elif token == c'[': obj = self.p_list(tokens) - elif token == '(': + elif token == c'(': obj = self.p_tuple(tokens) elif token == EOS: return all - elif token == ']' or token == ')': - tokens.token = ',' + elif token == c']' or token == c')': + tokens.token = c',' return all else: obj = self.p_eqn(tokens) @@ -682,11 +682,11 @@ cdef class Parser: [] """ cdef int token = tokens.next() - if token != '[': + if token != c'[': self.parse_error(tokens, "Malformed list") all = self.p_sequence(tokens) token = tokens.next() - if token != ']': + if token != c']': self.parse_error(tokens, "Malformed list") return all @@ -704,20 +704,20 @@ cdef class Parser: cdef int start = tokens.pos cdef int token = tokens.next() cdef bint real_tuple = True - if token != '(': + if token != c'(': self.parse_error(tokens, "Malformed tuple") all = self.p_sequence(tokens) if len(all) == 1: if tokens.last() != c',': real_tuple = False token = tokens.next() - if token != ')': + if token != c')': self.parse_error(tokens, "Malformed tuple") if real_tuple: return tuple(all) else: token = tokens.peek() - if token == ',' or token == EOS: + if token == c',' or token == EOS: return all[0] else: # we have to reparse the entire thing as an expression @@ -753,15 +753,15 @@ cdef class Parser: """ lhs = self.p_expr(tokens) cdef int op = tokens.next() - if op == '=': + if op == c'=': return lhs == self.p_expr(tokens) elif op == NOT_EQ: return lhs != self.p_expr(tokens) - elif op == '<': + elif op == c'<': return lhs < self.p_expr(tokens) elif op == LESS_EQ: return lhs <= self.p_expr(tokens) - elif op == '>': + elif op == c'>': return lhs > self.p_expr(tokens) elif op == GREATER_EQ: return lhs >= self.p_expr(tokens) @@ -793,9 +793,9 @@ cdef class Parser: cdef int op operand1 = self.p_term(tokens) op = tokens.next() - while op == '+' or op == '-': + while op == c'+' or op == c'-': operand2 = self.p_term(tokens) - if op == '+': + if op == c'+': operand1 = operand1 + operand2 else: operand1 = operand1 - operand2 @@ -828,17 +828,17 @@ cdef class Parser: operand1 = self.p_factor(tokens) op = tokens.next() if op == NAME and self.implicit_multiplication: - op = '*' + op = c'*' tokens.backtrack() - while op == '*' or op == '/': + while op == c'*' or op == c'/': operand2 = self.p_factor(tokens) - if op == '*': + if op == c'*': operand1 = operand1 * operand2 else: operand1 = operand1 / operand2 op = tokens.next() if op == NAME and self.implicit_multiplication: - op = '*' + op = c'*' tokens.backtrack() tokens.backtrack() return operand1 @@ -862,9 +862,9 @@ cdef class Parser: t^11 """ cdef int token = tokens.next() - if token == '+': + if token == c'+': return self.p_factor(tokens) - elif token == '-': + elif token == c'-': return -self.p_factor(tokens) else: tokens.backtrack() @@ -898,13 +898,13 @@ cdef class Parser: """ operand1 = self.p_atom(tokens) cdef int token = tokens.next() - if token == '^': + if token == c'^': operand2 = self.p_factor(tokens) return operand1 ** operand2 - elif token == "!": + elif token == c"!": from sage.functions.all import factorial operand1 = factorial(operand1) - if tokens.peek() == '^': + if tokens.peek() == c'^': tokens.next() operand2 = self.p_factor(tokens) return operand1 ** operand2 @@ -949,20 +949,20 @@ cdef class Parser: elif token == NAME: name = tokens.last_token_string() token = tokens.next() - if token == '(': + if token == c'(': func = self.callable_constructor(name) args, kwds = self.p_args(tokens) token = tokens.next() - if token != ')': + if token != c')': self.parse_error(tokens, "Bad function call") return func(*args, **kwds) else: tokens.backtrack() return self.variable_constructor(name) - elif token == '(': + elif token == c'(': expr = self.p_expr(tokens) token = tokens.next() - if token != ')': + if token != c')': self.parse_error(tokens, "Mismatched parentheses") return expr else: @@ -984,10 +984,10 @@ cdef class Parser: """ args = [] kwds = {} - if tokens.peek() == ')': + if tokens.peek() == c')': return args, kwds - cdef int token = ',' - while token == ',': + cdef int token = c',' + while token == c',': arg = self.p_arg(tokens) if isinstance(arg, tuple): name, value = arg @@ -1029,11 +1029,11 @@ cdef class Parser: """ cdef int token = tokens.next() - if token == NAME and tokens.peek() == '=': + if token == NAME and tokens.peek() == c'=': name = tokens.last_token_string() tokens.next() return name, self.p_expr(tokens) - if token == "[" : + if token == c"[": tokens.backtrack() return self.p_list(tokens) else: diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx index b71d7a32fc5..3ac5f1cc2b0 100644 --- a/src/sage/misc/persist.pyx +++ b/src/sage/misc/persist.pyx @@ -449,12 +449,12 @@ def register_unpickle_override(module, name, callable, call_name=None): :: - sage: class A(object): + sage: class A(): ....: def __init__(self,value): ....: self.original_attribute = value ....: def __repr__(self): ....: return 'A(%s)' % self.original_attribute - sage: class B(object): + sage: class B(): ....: def __init__(self,value): ....: self.new_attribute = value ....: def __setstate__(self,state): @@ -759,7 +759,7 @@ class SagePickler(_BasePickler): The following is an indirect doctest. :: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, s): ....: self.bar = s ....: def __reduce__(self): @@ -949,7 +949,7 @@ def loads(s, compress=True, **kwargs): in a pickle. See :trac:`28444` for details. :: - sage: class Foo(object): + sage: class Foo(): ....: def __init__(self, s): ....: self.bar = s ....: def __reduce__(self): diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py index 56286232257..2a71bc1b665 100644 --- a/src/sage/misc/sage_input.py +++ b/src/sage/misc/sage_input.py @@ -1200,7 +1200,7 @@ def result(self, e): _prec_funcall = 40 _prec_atomic = 42 -class SageInputExpression(object): +class SageInputExpression(): r""" Subclasses of this class represent expressions for :func:`sage_input`. \sage classes should define a \method{_sage_input_} method, which @@ -1774,7 +1774,7 @@ def __init__(self, sib, n): sage: sib(3)._sie_value '3' """ - super(SIE_literal_stringrep, self).__init__(sib) + super().__init__(sib) self._sie_value = str(n) self._sie_share = False @@ -1851,7 +1851,7 @@ def __init__(self, sib, func, args, kwargs): sage: sib = SageInputBuilder() sage: sie = sib('RealField')(53, rnd='RNDZ') """ - super(SIE_call, self).__init__(sib) + super().__init__(sib) self._sie_func = func self._sie_args = args self._sie_kwargs = kwargs @@ -1959,7 +1959,7 @@ def __init__(self, sib, coll, key): sage: sib.empty_subscript(sib.name('QQ')) {subscr: {atomic:QQ}[]} """ - super(SIE_subscript, self).__init__(sib) + super().__init__(sib) self._sie_coll = coll self._sie_key = key @@ -2058,7 +2058,7 @@ def __init__(self, sib, obj, attr): sage: sib.name('QQbar').zeta(5) {call: {getattr: {atomic:QQbar}.zeta}({atomic:5})} """ - super(SIE_getattr, self).__init__(sib) + super().__init__(sib) self._sie_obj = obj self._sie_attr = attr @@ -2153,7 +2153,7 @@ def __init__(self, sib, values, is_list): sage: sib(["Hello", "world"]) {list: ({atomic:'Hello'}, {atomic:'world'})} """ - super(SIE_tuple, self).__init__(sib) + super().__init__(sib) self._sie_values = values self._sie_is_list = is_list @@ -2259,7 +2259,7 @@ def __init__(self, sib, entries): sage: sib.dict([(10, 'PS2'), (12, 'PS2'), (13, 'PS3')]) {dict: {{atomic:10}:{atomic:'PS2'}, {atomic:12}:{atomic:'PS2'}, {atomic:13}:{atomic:'PS3'}}} """ - super(SIE_dict, self).__init__(sib) + super().__init__(sib) self._sie_entries = entries def __repr__(self): @@ -2349,9 +2349,8 @@ def __init__(self, sib, op, lhs, rhs): sage: sib = SageInputBuilder() sage: sib(3)*5 {binop:* {atomic:3} {atomic:5}} - """ - super(SIE_binary, self).__init__(sib) + super().__init__(sib) self._sie_op = op self._sie_operands = (lhs, rhs) @@ -2498,7 +2497,7 @@ def __init__(self, sib, op, operand): sage: -sib(3) {unop:- {atomic:3}} """ - super(SIE_unary, self).__init__(sib) + super().__init__(sib) self._sie_op = op self._sie_operand = operand @@ -2691,7 +2690,7 @@ def __init__(self, sib, constr, gen_names, gens_syntax=None): ....: gens_syntax=sib.empty_subscript(qq)) {constr_parent: {subscr: {atomic:QQ}[{atomic:'x'}]} with gens: ('x',)} """ - super(SIE_gens_constructor, self).__init__(sib) + super().__init__(sib) self._sie_constr = constr self._sie_gen_names = gen_names self._sie_gens = None # will be overwritten from .parent_with_gens() @@ -2909,7 +2908,7 @@ def __init__(self, sib, parent, name): sage: sib.gen(ZZ['x']) # indirect doctest {gen:x {constr_parent: {subscr: {atomic:ZZ}[{atomic:'x'}]} with gens: ('x',)}} """ - super(SIE_gen, self).__init__(sib) + super().__init__(sib) self._sie_parent = parent self._sie_preferred_varname = name @@ -2960,7 +2959,7 @@ def _sie_prepare(self, sif): sage: sie._sie_parent._sie_assign_gens True """ - super(SIE_gen, self)._sie_prepare(sif) + super()._sie_prepare(sif) self._sie_parent._sie_gens_referenced(sif) def _sie_format(self, sif): @@ -3065,7 +3064,7 @@ def __init__(self, sib, module, name, alt_name=None): sage: sib.import_name('sage.foo', 'happy', 'sad') {import:sage.foo/happy as sad} """ - super(SIE_import_name, self).__init__(sib) + super().__init__(sib) self._sie_formatted = False self._sie_module_name = module self._sie_object_name = name @@ -3123,7 +3122,7 @@ def _sie_prepare(self, sif): sage: sie._sie_requested_varname True """ - super(SIE_import_name, self)._sie_prepare(sif) + super()._sie_prepare(sif) self._sie_require_varname(sif) def _sie_format(self, sif): @@ -3193,7 +3192,7 @@ def __init__(self, sib, lhs, rhs): sage: sib.assign(sib.name('foo').x, sib.name('pi')) {assign: {getattr: {atomic:foo}.x} {atomic:pi}} """ - super(SIE_assign, self).__init__(sib) + super().__init__(sib) self._sie_lhs = lhs self._sie_rhs = rhs diff --git a/src/sage/misc/sage_timeit.py b/src/sage/misc/sage_timeit.py index f2542ad5144..8250b461dd4 100644 --- a/src/sage/misc/sage_timeit.py +++ b/src/sage/misc/sage_timeit.py @@ -18,7 +18,7 @@ """ -class SageTimeitResult(object): +class SageTimeitResult(): r""" Represent the statistics of a timeit() command. diff --git a/src/sage/misc/sage_unittest.py b/src/sage/misc/sage_unittest.py index c6c6d2741dc..da99c3ea92d 100644 --- a/src/sage/misc/sage_unittest.py +++ b/src/sage/misc/sage_unittest.py @@ -17,7 +17,7 @@ import traceback -class TestSuite(object): +class TestSuite(): """ Test suites for Sage objects. @@ -576,7 +576,7 @@ def some_elements(self, S=None, repeat=None): return list(some_tuples(S, repeat, self._max_runs, self._max_samples)) -class PythonObjectWithTests(object): +class PythonObjectWithTests(): """ Utility class for running basis tests on a plain Python object (that is not in SageObject). More test methods can be added here. diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 37fd5d8b6e6..0dfc5dd952c 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -609,10 +609,10 @@ def format(s, embedded=False): EXAMPLES:: sage: from sage.misc.sagedoc import format - sage: identity_matrix(2).rook_vector.__doc__[202:274] + sage: identity_matrix(2).rook_vector.__doc__[191:263] 'Let `A` be an `m` by `n` (0,1)-matrix. We identify `A` with a chessboard' - sage: format(identity_matrix(2).rook_vector.__doc__[202:274]) + sage: format(identity_matrix(2).rook_vector.__doc__[191:263]) 'Let A be an m by n (0,1)-matrix. We identify A with a chessboard\n' If the first line of the string is 'nodetex', remove 'nodetex' but @@ -710,7 +710,11 @@ def format(s, embedded=False): if 'noreplace' in directives or 'nodetex' in directives: s = s[first_newline + len(os.linesep):] - import sage.all + try: + import sage.all + except ImportError: + pass + docs = set([]) if 'noreplace' not in directives: i_0 = 0 @@ -774,7 +778,12 @@ def format_src(s): if not isinstance(s, str): raise TypeError("s must be a string") docs = set([]) - import sage.all + + try: + import sage.all + except ImportError: + pass + while True: i = s.find("<<<") if i == -1: diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 87df80ef514..67fc9165af8 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -1885,7 +1885,7 @@ def _sage_getdoc_unformatted(obj): ``__doc__`` attribute. This should not give an error in ``_sage_getdoc_unformatted``, see :trac:`19671`:: - sage: class NoSageDoc(object): + sage: class NoSageDoc(): ....: @property ....: def __doc__(self): ....: raise Exception("no doc here") @@ -2270,7 +2270,7 @@ def sage_getsourcelines(obj): sage: sage_getsourcelines(cachedfib)[0][0] 'def fibonacci(n, algorithm="pari") -> Integer:\n' sage: sage_getsourcelines(type(cachedfib))[0][0] - 'cdef class CachedFunction(object):\n' + 'cdef class CachedFunction():\n' TESTS:: @@ -2323,13 +2323,13 @@ def sage_getsourcelines(obj): (, ) sage: print(sage_getsource(E)) - class Element(object): + class Element(): "This is a dummy element class" pass sage: print(sage_getsource(P)) class TestNestedParent(UniqueRepresentation, Parent): ... - class Element(object): + class Element(): "This is a dummy element class" pass diff --git a/src/sage/misc/session.pyx b/src/sage/misc/session.pyx index c842369c4b3..63b7fd735a3 100644 --- a/src/sage/misc/session.pyx +++ b/src/sage/misc/session.pyx @@ -218,6 +218,7 @@ def show_identifiers(hidden=False): # Ignore extra variables injected into the global namespace by the doctest # runner _none = object() + def _in_extra_globals(name, val): return val == DocTestTask.extra_globals.get(name, _none) diff --git a/src/sage/misc/stopgap.pyx b/src/sage/misc/stopgap.pyx index 555d80915b6..9ed9c4ec4dc 100644 --- a/src/sage/misc/stopgap.pyx +++ b/src/sage/misc/stopgap.pyx @@ -77,8 +77,10 @@ def stopgap(message, int ticket_no): return # We reset show_warning so that the message is not printed twice. old_format = warnings.formatwarning + def my_format(message, category, filename, lineno, line=None): - return "%s:%s:\n%s\n%s\n%s\n" % (filename, lineno, "*"*80, message, "*"*80) + return "%s:%s:\n%s\n%s\n%s\n" % (filename, lineno, + "*" * 80, message, "*" * 80) warnings.formatwarning = my_format message = message + "\nThis issue is being tracked at https://trac.sagemath.org/sage_trac/ticket/%s." % ticket_no warnings.warn(StopgapWarning(message), stacklevel=2) diff --git a/src/sage/misc/superseded.py b/src/sage/misc/superseded.py index 0d20e025a23..f3599b00fd9 100644 --- a/src/sage/misc/superseded.py +++ b/src/sage/misc/superseded.py @@ -215,7 +215,7 @@ def experimental_warning(trac_number, message, stacklevel=4): warning(trac_number, message, FutureWarning, stacklevel) -class experimental(object): +class experimental(): def __init__(self, trac_number, stacklevel=4): """ A decorator which warns about the experimental/unstable status of @@ -320,7 +320,7 @@ def wrapper(*args, **kwds): return wrapper -class __experimental_self_test(object): +class __experimental_self_test(): r""" This is a class only to demonstrate with a doc-test that the @experimental decorator only issues a warning message once (see :trac:`20601`). @@ -341,7 +341,7 @@ def __init__(self, x): print("I'm " + x) -class DeprecatedFunctionAlias(object): +class DeprecatedFunctionAlias(): """ A wrapper around methods or functions which automatically prints a deprecation message. See :func:`deprecated_function_alias`. @@ -391,7 +391,7 @@ def __name__(self): 'g' sage: from sage.misc.superseded import deprecated_function_alias - sage: class cls(object): + sage: class cls(): ....: def new_meth(self): return 42 ....: old_meth = deprecated_function_alias(13109, new_meth) sage: cls.old_meth.__name__ @@ -401,7 +401,7 @@ def __name__(self): sage: cython('\n'.join([ ....: r"from sage.misc.superseded import deprecated_function_alias", - ....: r"cdef class cython_cls(object):", + ....: r"cdef class cython_cls():", ....: r" def new_cython_meth(self):", ....: r" return 1", ....: r" old_cython_meth = deprecated_function_alias(13109, new_cython_meth)" @@ -464,7 +464,7 @@ def __get__(self, inst, cls=None): TESTS:: sage: from sage.misc.superseded import deprecated_function_alias - sage: class cls(object): + sage: class cls(): ....: def new_meth(self): return 42 ....: old_meth = deprecated_function_alias(13109, new_meth) sage: obj = cls() @@ -526,7 +526,7 @@ def deprecated_function_alias(trac_number, func): This also works for methods:: - sage: class cls(object): + sage: class cls(): ....: def new_meth(self): return 42 ....: old_meth = deprecated_function_alias(13109, new_meth) sage: cls().old_meth() diff --git a/src/sage/misc/temporary_file.py b/src/sage/misc/temporary_file.py index 461776e82f4..506bc925784 100644 --- a/src/sage/misc/temporary_file.py +++ b/src/sage/misc/temporary_file.py @@ -166,7 +166,7 @@ def tmp_filename(name="tmp_", ext=""): ################################################################# # write to a temporary file and move it in place ################################################################# -class atomic_write(object): +class atomic_write(): """ Write to a given file using a temporary file and then rename it to the target file. This renaming should be atomic on modern @@ -445,7 +445,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): ################################################################# # write to a temporary directory and move it in place ################################################################# -class atomic_dir(object): +class atomic_dir(): """ Write to a given directory using a temporary directory and then rename it to the target directory. This is for creating a directory whose contents diff --git a/src/sage/misc/test_nested_class.py b/src/sage/misc/test_nested_class.py index 8e0c1ddf0c1..55973bd05b3 100644 --- a/src/sage/misc/test_nested_class.py +++ b/src/sage/misc/test_nested_class.py @@ -150,15 +150,15 @@ class Element(ElementWrapper): # Class for tests: -class B(object): +class B(): """ A normal external class. """ pass -class ABB(object): - class B(object): +class ABB(): + class B(): """ This class is broken and can't be pickled. A warning is emmited during compilation. @@ -166,18 +166,18 @@ class B(object): pass -class ABL(object): +class ABL(): """ There is no problem here. """ B = B -class ALB(object): +class ALB(): """ There is a nested class just below. Which can't be properly sphinxed. """ - class C(object): + class C(): """ Internal C class. @@ -190,7 +190,7 @@ class C(object): class ABBMeta(metaclass=NestedClassMetaclass): - class B(object): + class B(): """ B interne """ @@ -205,7 +205,7 @@ class ALBMeta(metaclass=NestedClassMetaclass): """ There is a nested class just below which is properly sphinxed. """ - class CMeta(object): + class CMeta(): """ B interne """ @@ -222,6 +222,6 @@ class TestNestedParent(UniqueRepresentation, Parent): See the test in ``sage.misc.sageinspect.sage_getsourcelines``. """ - class Element(object): + class Element(): "This is a dummy element class" pass diff --git a/src/sage/misc/weak_dict.pyx b/src/sage/misc/weak_dict.pyx index 77a3c626bbe..ac7bf3bbbd2 100644 --- a/src/sage/misc/weak_dict.pyx +++ b/src/sage/misc/weak_dict.pyx @@ -18,7 +18,7 @@ However, a problem arises if hash and comparison of the key depend on the value that is being garbage collected:: sage: import weakref - sage: class Vals(object): pass + sage: class Vals(): pass sage: class Keys: ....: def __init__(self, val): ....: self.val = weakref.ref(val) @@ -239,7 +239,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: sage: import weakref - sage: class Vals(object): pass + sage: class Vals(): pass sage: class Keys: ....: def __init__(self, val): ....: self.val = weakref.ref(val) @@ -289,7 +289,7 @@ cdef class WeakValueDictionary(dict): The following is a stress test for weak value dictionaries:: - sage: class C(object): + sage: class C(): ....: def __init__(self, n): ....: self.n = n ....: def __lt__(self, other): @@ -383,7 +383,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: - sage: class C(object): pass + sage: class C(): pass sage: V = [C(),C()] sage: D = sage.misc.weak_dict.WeakValueDictionary() sage: D[C()] = V[0] @@ -714,7 +714,7 @@ cdef class WeakValueDictionary(dict): TESTS:: sage: import sage.misc.weak_dict - sage: class Vals(object): pass + sage: class Vals(): pass sage: L = [Vals() for _ in range(10)] sage: D = sage.misc.weak_dict.WeakValueDictionary(enumerate(L)) sage: 3 in D # indirect doctest @@ -762,7 +762,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: sage: import sage.misc.weak_dict - sage: class Vals(object): pass + sage: class Vals(): pass sage: L = [Vals() for _ in range(10)] sage: D = sage.misc.weak_dict.WeakValueDictionary(enumerate(L)) sage: del L[4] @@ -795,7 +795,7 @@ cdef class WeakValueDictionary(dict): EXAMPLES:: sage: import sage.misc.weak_dict - sage: class Vals(object): pass + sage: class Vals(): pass sage: L = [Vals() for _ in range(10)] sage: D = sage.misc.weak_dict.WeakValueDictionary(enumerate(L)) sage: del L[4] @@ -922,7 +922,7 @@ cdef class WeakValueDictionary(dict): ....: return self.n == other.n ....: def __ne__(self, other): ....: return self.val() != other.val() - sage: class Keys(object): + sage: class Keys(): ....: def __init__(self, n): ....: self.n = n ....: def __hash__(self): @@ -988,7 +988,7 @@ cdef class WeakValueDictionary(dict): ....: return self.n == other.n ....: def __ne__(self, other): ....: return self.val() != other.val() - sage: class Keys(object): + sage: class Keys(): ....: def __init__(self, n): ....: self.n = n ....: def __hash__(self): @@ -1098,7 +1098,7 @@ cdef class CachedWeakValueDictionary(WeakValueDictionary): sage: from sage.misc.weak_dict import WeakValueDictionary sage: D = WeakValueDictionary() - sage: class Test(object): pass + sage: class Test(): pass sage: tmp = Test() sage: D[0] = tmp sage: 0 in D @@ -1116,7 +1116,7 @@ cdef class CachedWeakValueDictionary(WeakValueDictionary): sage: from sage.misc.weak_dict import CachedWeakValueDictionary sage: D = CachedWeakValueDictionary(cache=4) - sage: class Test(object): pass + sage: class Test(): pass sage: tmp = Test() sage: D[0] = tmp sage: 0 in D @@ -1172,7 +1172,7 @@ cdef class CachedWeakValueDictionary(WeakValueDictionary): :class:`WeakValueDictionary`:: sage: D = CachedWeakValueDictionary(cache=0) - sage: class Test(object): pass + sage: class Test(): pass sage: tmp = Test() sage: D[0] = tmp sage: del tmp diff --git a/src/sage/modular/arithgroup/arithgroup_element.pyx b/src/sage/modular/arithgroup/arithgroup_element.pyx index 847252780d5..86ef0e933aa 100644 --- a/src/sage/modular/arithgroup/arithgroup_element.pyx +++ b/src/sage/modular/arithgroup/arithgroup_element.pyx @@ -194,7 +194,7 @@ cdef class ArithmeticSubgroupElement(MultiplicativeGroupElement): return richcmp(self.__x, right.__x, op) def __bool__(self): - """ + r""" Return ``True``, since the ``self`` lives in SL(2,\Z), which does not contain the zero matrix. diff --git a/src/sage/modular/arithgroup/congroup.pyx b/src/sage/modular/arithgroup/congroup.pyx index 3cb2a84b334..9554ebbc11d 100644 --- a/src/sage/modular/arithgroup/congroup.pyx +++ b/src/sage/modular/arithgroup/congroup.pyx @@ -1,4 +1,4 @@ -""" +r""" Cython helper functions for congruence subgroups This file contains optimized Cython implementations of a few functions related @@ -6,13 +6,13 @@ to the standard congruence subgroups `\Gamma_0, \Gamma_1, \Gamma_H`. These functions are for internal use by routines elsewhere in the Sage library. """ -#***************************************************************************** +# **************************************************************************** # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from cysignals.memory cimport check_allocarray, sig_free @@ -28,7 +28,7 @@ from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense from sage.modular.modsym.p1list import lift_to_sl2z from sage.matrix.matrix_space import MatrixSpace from sage.rings.integer_ring import ZZ -Mat2Z = MatrixSpace(ZZ,2) +Mat2Z = MatrixSpace(ZZ, 2) cdef Matrix_integer_dense genS, genT, genI genS = Matrix_integer_dense(Mat2Z, [0,-1, 1, 0], True, True) @@ -124,9 +124,11 @@ def degeneracy_coset_representatives_gamma0(int N, int M, int t): cc = M*random.randrange(-halfmax, halfmax+1) dd = random.randrange(-halfmax, halfmax+1) g = arith_int.c_xgcd_int(-cc,dd,&bb,&aa) - if g == 0: continue + if g == 0: + continue cc = cc / g - if cc % M != 0: continue + if cc % M != 0: + continue dd = dd / g # Test if we've found a new coset representative. is_new = 1 @@ -212,7 +214,6 @@ def degeneracy_coset_representatives_gamma1(int N, int M, int t): cdef int d, g, i, j, k, n, aa, bb, cc, dd, Ndivt, halfmax, is_new cdef int* R - # total number of coset representatives that we'll find n = Gamma1(N).index() / Gamma1(M).index() d = arith_int.c_gcd_int(t, N/t) @@ -226,11 +227,14 @@ def degeneracy_coset_representatives_gamma1(int N, int M, int t): cc = M*random.randrange(-halfmax, halfmax+1) dd = 1 + M*random.randrange(-halfmax, halfmax+1) g = arith_int.c_xgcd_int(-cc,dd,&bb,&aa) - if g == 0: continue + if g == 0: + continue cc = cc / g - if cc % M != 0: continue + if cc % M != 0: + continue dd = dd / g - if M != 1 and dd % M != 1: continue + if M != 1 and dd % M != 1: + continue # Test if we've found a new coset representative. is_new = 1 for i from 0 <= i < k: diff --git a/src/sage/modular/arithgroup/farey_symbol.pyx b/src/sage/modular/arithgroup/farey_symbol.pyx index 18ba31ae5dc..01b3db0b019 100644 --- a/src/sage/modular/arithgroup/farey_symbol.pyx +++ b/src/sage/modular/arithgroup/farey_symbol.pyx @@ -610,7 +610,7 @@ cdef class Farey: if forced_format == 'plain': # output not using xymatrix s = r'\left( -\infty' - a = [x._latex_() for x in self.fractions()] + ['\infty'] + a = [x._latex_() for x in self.fractions()] + [r'\infty'] b = self.pairings() for i in xrange(len(a)): u = b[i] @@ -623,7 +623,7 @@ cdef class Farey: else: # output using xymatrix s = r'\begin{xy}\xymatrix{& -\infty ' - f = [x._latex_() for x in self.fractions()]+[r'\infty'] + f = [x._latex_() for x in self.fractions()] + [r'\infty'] f.reverse() for p in self.pairings(): if p >= 0: diff --git a/src/sage/modular/modform_hecketriangle/graded_ring.py b/src/sage/modular/modform_hecketriangle/graded_ring.py index 42325e3423e..13d00dbbef6 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring.py @@ -75,9 +75,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiMeromorphicModularFormsRing(4, ZZ, 1) == QuasiMeromorphicModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -138,9 +137,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiWeakModularFormsRing(5, CC, 0) == QuasiWeakModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -198,9 +196,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiModularFormsRing(6, ZZ, True) == QuasiModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -258,9 +255,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: QuasiCuspFormsRing(7, ZZ, 1) == QuasiCuspFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -318,9 +314,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: MeromorphicModularFormsRing(4, ZZ, 1) == MeromorphicModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -378,9 +373,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: WeakModularFormsRing(5, ZZ, 0) == WeakModularFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -437,9 +431,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: ModularFormsRing(3, ZZ, 0) == ModularFormsRing() True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" @@ -497,9 +490,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, red_hom = sage: CuspFormsRing(5, CC, True) == CuspFormsRing(group, base_ring, red_hom, n) True """ - (group, base_ring, red_hom, n) = canonical_parameters(group, base_ring, red_hom, n) - return super(FormsRing_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, red_hom=red_hom, n=n) def __init__(self, group, base_ring, red_hom, n): r""" diff --git a/src/sage/modular/modform_hecketriangle/space.py b/src/sage/modular/modform_hecketriangle/space.py index 84323cf0ab9..beae939854d 100644 --- a/src/sage/modular/modform_hecketriangle/space.py +++ b/src/sage/modular/modform_hecketriangle/space.py @@ -96,9 +96,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e sage: QuasiMeromorphicModularForms(5, ZZ, 20/3, int(1)) == QuasiMeromorphicModularForms(group, base_ring, k, ep, n) True """ - (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -145,7 +144,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -192,7 +191,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -354,7 +353,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -526,7 +525,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -573,7 +572,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -618,7 +617,7 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e """ (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -769,9 +768,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e sage: CuspForms(6, ZZ, 6, 1) == CuspForms(group, base_ring, k, ep, n) True """ - (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" @@ -922,9 +920,8 @@ def __classcall__(cls, group = HeckeTriangleGroup(3), base_ring = ZZ, k=QQ(0), e sage: ZeroForm(6, CC, 3, -1) == ZeroForm(group, base_ring, k, ep, n) True """ - (group, base_ring, k, ep, n) = canonical_parameters(group, base_ring, k, ep, n) - return super(FormsSpace_abstract,cls).__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) + return super().__classcall__(cls, group=group, base_ring=base_ring, k=k, ep=ep, n=n) def __init__(self, group, base_ring, k, ep, n): r""" diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index 3bfd5ffafe1..2ba337dddc4 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -211,7 +211,7 @@ cdef class Heilbronn: sig_off() cdef apply_to_polypart(self, fmpz_poly_t* ans, int i, int k): - """ + r""" INPUT: - ``ans`` - fmpz_poly_t\*; pre-allocated an @@ -402,7 +402,11 @@ cdef class HeilbronnCremona(Heilbronn): a = -b b = c x3 = q*x2 - x1 - x1 = x2; x2 = x3; y3 = q*y2 - y1; y1 = y2; y2 = y3 + x1 = x2 + x2 = x3 + y3 = q*y2 - y1 + y1 = y2 + y2 = y3 list_append4(L, x1,x2, y1,y2) self.length = L.i/4 sig_off() @@ -573,9 +577,11 @@ def hecke_images_gamma0_weight2(int u, int v, int N, indices, R): # Allocate memory to hold images of (u,v) under all Heilbronn matrices a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError # Compute images of (u,v) under all Heilbronn matrices H.apply_only(u, v, N, a, b) @@ -708,9 +714,11 @@ def hecke_images_nonquad_character_weight2(int u, int v, int N, indices, chi, R) # Allocate memory to hold images of (u,v) under all Heilbronn matrices a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError # Compute images of (u,v) under all Heilbronn matrices H.apply_only(u, v, N, a, b) @@ -798,16 +806,19 @@ def hecke_images_quad_character_weight2(int u, int v, int N, indices, chi, R): # are the values of the character chi. _chivals = chi.values() cdef int *chi_vals = sig_malloc(sizeof(int)*len(_chivals)) - if not chi_vals: raise MemoryError + if not chi_vals: + raise MemoryError for i in range(len(_chivals)): chi_vals[i] = _chivals[i] for i, n in enumerate(indices): H = HeilbronnCremona(n) if is_prime(n) else HeilbronnMerel(n) a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError H.apply_only(u, v, N, a, b) for j in range(H.length): @@ -893,9 +904,11 @@ def hecke_images_gamma0_weight_k(int u, int v, int i, int N, int k, indices, R): # Allocate memory to hold images of (u,v) under all Heilbronn matrices a = sig_malloc(sizeof(int)*H.length) - if not a: raise MemoryError + if not a: + raise MemoryError b = sig_malloc(sizeof(int)*H.length) - if not b: raise MemoryError + if not b: + raise MemoryError # Compute images of (u,v) under all Heilbronn matrices H.apply_only(u, v, N, a, b) diff --git a/src/sage/modular/modsym/manin_symbol.pyx b/src/sage/modular/modsym/manin_symbol.pyx index 0a4944b4ad8..86927b91959 100644 --- a/src/sage/modular/modsym/manin_symbol.pyx +++ b/src/sage/modular/modsym/manin_symbol.pyx @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" +r""" Manin symbols This module defines the class ManinSymbol. A Manin symbol of @@ -19,9 +19,7 @@ monomial Manin symbols to monomial Manin symbols, up to a scalar factor. For general matrices (such as `T=[0,1,-1,-1]` and `T^2=[-1,-1;0,1]`) the image of a monomial Manin symbol is expressed as a formal sum of monomial Manin symbols, with integer coefficients. - """ - from sage.modular.cusps import Cusp from sage.rings.all import Infinity, ZZ from sage.rings.integer cimport Integer diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index 7ec9aa65394..05ef4951f8c 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -68,8 +68,10 @@ cdef int c_p1_normalize_int(int N, int u, int v, u = u % N v = v % N - if u<0: u = u + N - if v<0: v = v + N + if u < 0: + u += N + if v < 0: + v += N if u == 0: uu[0] = 0 if arith_int.c_gcd_int(v,N) == 1: @@ -81,7 +83,8 @@ cdef int c_p1_normalize_int(int N, int u, int v, g = arith_int.c_xgcd_int(u, N, &s, &t) s = s % N - if s<0: s = s + N + if s < 0: + s += N if arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -99,7 +102,8 @@ cdef int c_p1_normalize_int(int N, int u, int v, u = g v = (s*v) % N - min_v = v; min_t = 1 + min_v = v + min_t = 1 if g!=1: Ng = N/g vNg = (v*Ng) % N @@ -108,10 +112,13 @@ cdef int c_p1_normalize_int(int N, int u, int v, v = (v + vNg) % N t = (t + Ng) % N if v(ll_s % ll_N) t = (ll_t % ll_N) s = s % N - if s<0: s = s + N + if s < 0: + s += N if arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -355,7 +366,8 @@ cdef int c_p1_normalize_llong(int N, int u, int v, # v = (s*v) % N v = ( ((s) * (v)) % ll_N ) - min_v = v; min_t = 1 + min_v = v + min_t = 1 if g!=1: Ng = N/g vNg = ((v * Ng) % ll_N) @@ -364,16 +376,20 @@ cdef int c_p1_normalize_llong(int N, int u, int v, v = (v + vNg) % N t = (t + Ng) % N if v (arith_llong.c_inverse_mod_longlong(( s)*( min_t), N) % ll_N) return 0 + def p1_normalize_llong(N, u, v): r""" Computes the canonical representative of @@ -449,7 +465,8 @@ def p1list_llong(int N): [(0, 1), (34603, 1), (34603, 2), (34603, 3)] """ cdef int g, u, v, s, c, d, h, d1, cmax - if N==1: return [(0,0)] + if N == 1: + return [(0, 0)] lst = [(0,1)] c = 1 @@ -478,8 +495,9 @@ def p1list_llong(int N): lst.sort() return lst + def p1list(N): - """ + r""" Return the elements of the projective line modulo `N`, `\mathbb{P}^1(\ZZ/N\ZZ)`, as a plain list of 2-tuples. @@ -600,8 +618,10 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, u = u % N v = v % N - if u<0: u = u + N - if v<0: v = v + N + if u < 0: + u += N + if v < 0: + v += N if u == 0: uu[0] = 0 if t_g[v] == 1: # "if arith_int.c_gcd_int(v,N) == 1" @@ -616,7 +636,8 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, s = t_a[u] t = t_b[u] s = s % N - if s<0: s = s + N + if s < 0: + s += N if g != 1 and arith_int.c_gcd_int(g, v) != 1: uu[0] = 0 vv[0] = 0 @@ -634,7 +655,8 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, u = g v = (s*v) % N - min_v = v; min_t = 1 + min_v = v + min_t = 1 if g!=1: Ng = N/g vNg = (v*Ng) % N @@ -643,10 +665,13 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v, v = (v + vNg) % N t = (t + Ng) % N if vcheck_allocarray(N, sizeof(int)) self.s = check_allocarray(N, sizeof(int)) self.t = check_allocarray(N, sizeof(int)) @@ -822,10 +847,10 @@ cdef class P1List(): 'The projective line over the integers modulo 8' """ - return "The projective line over the integers modulo %s"%self.__N + return "The projective line over the integers modulo %s" % self.__N def lift_to_sl2z(self, int i): - """ + r""" Lift the `i`'th element of this P1list to an element of `SL(2,\ZZ)`. @@ -836,7 +861,6 @@ cdef class P1List(): INPUT: - - ``i`` - integer (the index of the element to lift). EXAMPLES:: @@ -1187,8 +1211,9 @@ cdef class export: int compute_s) except -1: return c_p1_normalize_llong(N, u, v, uu, vv, ss, compute_s) + def lift_to_sl2z_int(int c, int d, int N): - """ + r""" Lift a pair `(c, d)` to an element of `SL(2, \ZZ)`. `(c,d)` is assumed to be an element of @@ -1249,7 +1274,7 @@ def lift_to_sl2z_int(int c, int d, int N): if g == 1: break m = m / g - d = d + N*m + d += N * m g = arith_int.c_xgcd_int(c, d, &z1, &z2) if g != 1: @@ -1319,7 +1344,7 @@ def lift_to_sl2z_llong(llong c, llong d, int N): if g == 1: break m = m / g - d = d + N*m + d += N * m g = arith_llong.c_xgcd_longlong(c, d, &z1, &z2) if g != 1: diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 9bc5a5c25e2..de627d5939a 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -2103,7 +2103,8 @@ cdef class FreeModuleElement(Vector): # abstract base class '(theta^3 + sqrt(2) + 1/2, 1/2)' """ cdef Py_ssize_t d = self._degree - if d == 0: return "()" + if d == 0: + return "()" # compute column widths S = [repr(x) for x in self.list(copy=False)] #width = max([len(x) for x in S]) diff --git a/src/sage/modules/vector_integer_sparse.pyx b/src/sage/modules/vector_integer_sparse.pyx index 7f94092a286..01c45059880 100644 --- a/src/sage/modules/vector_integer_sparse.pyx +++ b/src/sage/modules/vector_integer_sparse.pyx @@ -287,7 +287,8 @@ cdef int add_mpz_vector_init(mpz_vector* sum, # 1. Allocate memory: nz = v.num_nonzero + w.num_nonzero - if nz > v.degree: nz = v.degree + if nz > v.degree: + nz = v.degree mpz_vector_init(z, v.degree, nz) # 2. Merge entries i = 0 # index into entries of v diff --git a/src/sage/modules/vector_modn_sparse.pyx b/src/sage/modules/vector_modn_sparse.pyx index 5258c9a141a..746f9897db2 100644 --- a/src/sage/modules/vector_modn_sparse.pyx +++ b/src/sage/modules/vector_modn_sparse.pyx @@ -244,7 +244,8 @@ cdef int add_c_vector_modint_init(c_vector_modint* sum, c_vector_modint* v, # 1. Allocate memory: nz = v.num_nonzero + w.num_nonzero - if nz > v.degree: nz = v.degree + if nz > v.degree: + nz = v.degree init_c_vector_modint(z, v.p, v.degree, nz) # 2. Merge entries i = 0 # index into entries of v diff --git a/src/sage/modules/vector_rational_sparse.pyx b/src/sage/modules/vector_rational_sparse.pyx index 8b204b40e4f..78002a1a75f 100644 --- a/src/sage/modules/vector_rational_sparse.pyx +++ b/src/sage/modules/vector_rational_sparse.pyx @@ -294,7 +294,8 @@ cdef int add_mpq_vector_init(mpq_vector* sum, # 1. Allocate memory: nz = v.num_nonzero + w.num_nonzero - if nz > v.degree: nz = v.degree + if nz > v.degree: + nz = v.degree mpq_vector_init(z, v.degree, nz) # 2. Merge entries i = 0 # index into entries of v diff --git a/src/sage/numerical/backends/generic_backend.pyx b/src/sage/numerical/backends/generic_backend.pyx index 94d0e0e9d9d..083492018fe 100644 --- a/src/sage/numerical/backends/generic_backend.pyx +++ b/src/sage/numerical/backends/generic_backend.pyx @@ -1241,11 +1241,13 @@ cdef class GenericBackend: """ tester.assertEqual(type(self), type(cp), "Classes do not match") + def assert_equal_problem_data(method): tester.assertEqual(getattr(self, method)(), getattr(cp, method)(), "{} does not match".format(method)) for method in ("ncols", "nrows", "objective_constant_term", "problem_name", "is_maximization"): assert_equal_problem_data(method) + def assert_equal_col_data(method): for i in range(self.ncols()): tester.assertEqual(getattr(self, method)(i), getattr(cp, method)(i), @@ -1256,6 +1258,7 @@ cdef class GenericBackend: # TODO: Add a test elsewhere to ensure that variable_lower_bound, variable_upper_bound # are consistent with col_bounds. assert_equal_col_data(method) + def assert_equal_row_data(method): for i in range(self.nrows()): tester.assertEqual(getattr(self, method)(i), getattr(cp, method)(i), diff --git a/src/sage/numerical/backends/glpk_graph_backend.pxd b/src/sage/numerical/backends/glpk_graph_backend.pxd index 3eebb4dc08b..1b63765de7f 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pxd +++ b/src/sage/numerical/backends/glpk_graph_backend.pxd @@ -25,7 +25,7 @@ ctypedef struct c_a_data: double x -cdef class GLPKGraphBackend(object): +cdef class GLPKGraphBackend(): cdef glp_graph * graph cpdef add_vertex(self, name = ?) cpdef list add_vertices(self, vertices) diff --git a/src/sage/numerical/backends/glpk_graph_backend.pyx b/src/sage/numerical/backends/glpk_graph_backend.pyx index e3dd95841e8..564c108fdf4 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pyx +++ b/src/sage/numerical/backends/glpk_graph_backend.pyx @@ -76,7 +76,7 @@ from sage.libs.glpk.constants cimport * from sage.libs.glpk.graph cimport * from sage.numerical.mip import MIPSolverException -cdef class GLPKGraphBackend(object): +cdef class GLPKGraphBackend(): """ GLPK Backend for access to GLPK graph functions diff --git a/src/sage/numerical/backends/interactivelp_backend.pyx b/src/sage/numerical/backends/interactivelp_backend.pyx index f48853e7115..e431c604b0c 100644 --- a/src/sage/numerical/backends/interactivelp_backend.pyx +++ b/src/sage/numerical/backends/interactivelp_backend.pyx @@ -487,8 +487,10 @@ cdef class InteractiveLPBackend: """ A, b, c, x, constraint_types, variable_types, problem_type, ring, d = self._AbcxCVPRd() A = A.delete_rows((i,)) - b = list(b); del b[i] - constraint_types=list(constraint_types); del constraint_types[i] + b = list(b) + del b[i] + constraint_types = list(constraint_types) + del constraint_types[i] self.lp = InteractiveLPProblem(A, b, c, x, constraint_types, variable_types, problem_type, ring, objective_constant_term=d) diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py index 94f882ee933..1f2aeb27692 100644 --- a/src/sage/repl/configuration.py +++ b/src/sage/repl/configuration.py @@ -36,7 +36,7 @@ SAGE_EXTENSION = 'sage' -class SageIpythonConfiguration(object): +class SageIpythonConfiguration(): def _doctest_mode(self): """ diff --git a/src/sage/repl/display/fancy_repr.py b/src/sage/repl/display/fancy_repr.py index a606b5ef277..5c1191dc4f1 100644 --- a/src/sage/repl/display/fancy_repr.py +++ b/src/sage/repl/display/fancy_repr.py @@ -24,7 +24,7 @@ _baseclass_reprs = (object.__repr__,) -class ObjectReprABC(object): +class ObjectReprABC(): """ The abstract base class of an object representer. @@ -248,7 +248,7 @@ def __call__(self, obj, p, cycle): trailing newline, and if we don't display it you can't fix it:: - sage: class Newline(object): + sage: class Newline(): ....: def __repr__(self): ....: return 'newline\n' sage: n = Newline() @@ -317,7 +317,7 @@ def __call__(self, obj, p, cycle): Check that :trac:`18743` is fixed:: - sage: class Foo(object): + sage: class Foo(): ....: def __repr__(self): ....: return '''BBB AA RRR ....: B B A A R R diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py index 9cb0bd661ea..adde08d27d2 100644 --- a/src/sage/repl/display/formatter.py +++ b/src/sage/repl/display/formatter.py @@ -177,7 +177,7 @@ def format(self, obj, include=None, exclude=None): Test that ``__repr__`` is only called once when generating text output:: - sage: class Repper(object): + sage: class Repper(): ....: def __repr__(self): ....: print('__repr__ called') ....: return 'I am repper' diff --git a/src/sage/repl/display/util.py b/src/sage/repl/display/util.py index 7f6997211fd..ee99782b6fa 100644 --- a/src/sage/repl/display/util.py +++ b/src/sage/repl/display/util.py @@ -16,7 +16,7 @@ #***************************************************************************** -class TallListFormatter(object): +class TallListFormatter(): """ Special representation for lists with tall entries (e.g. matrices) diff --git a/src/sage/repl/interface_magic.py b/src/sage/repl/interface_magic.py index a93e1c9e04c..856bdcd120d 100644 --- a/src/sage/repl/interface_magic.py +++ b/src/sage/repl/interface_magic.py @@ -79,7 +79,7 @@ """ -class InterfaceMagic(object): +class InterfaceMagic(): @classmethod def all_iter(cls): @@ -92,7 +92,10 @@ def all_iter(cls): sage: next(InterfaceMagic.all_iter()) """ - import sage.interfaces.all + try: + import sage.interfaces.all + except ImportError: + return for name, obj in sage.interfaces.all.__dict__.items(): if isinstance(obj, sage.interfaces.interface.Interface): yield cls(name, obj) diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py index 84f90fca75d..d7ba014361d 100644 --- a/src/sage/repl/interpreter.py +++ b/src/sage/repl/interpreter.py @@ -185,7 +185,7 @@ def preparser(on=True): ############################## # Sage[Terminal]InteractiveShell ############################## -class SageShellOverride(object): +class SageShellOverride(): """ Mixin to override methods in IPython's [Terminal]InteractiveShell classes. diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py index eb508b067f5..798671aab42 100644 --- a/src/sage/repl/ipython_extension.py +++ b/src/sage/repl/ipython_extension.py @@ -416,7 +416,7 @@ def fortran(self, line, cell): return fortran(cell) -class SageCustomizations(object): +class SageCustomizations(): def __init__(self, shell=None): """ @@ -427,13 +427,15 @@ def __init__(self, shell=None): self.auto_magics = SageMagics(shell) self.shell.register_magics(self.auto_magics) - import sage.misc.edit_module as edit_module - self.shell.set_hook('editor', edit_module.edit_devel) + self.shell.set_hook('editor', LazyImport("sage.misc.edit_module", "edit_devel")) self.init_inspector() self.init_line_transforms() - import sage.all # until sage's import hell is fixed + try: + import sage.all # until sage's import hell is fixed + except ImportError: + import sage.all__sagemath_repl self.shell.verbose_quit = True @@ -461,7 +463,10 @@ def all_globals(): sage: SageCustomizations.all_globals() """ - from sage import all_cmdline + try: + from sage import all_cmdline + except ImportError: + from sage import all__sagemath_repl as all_cmdline return all_cmdline def init_environment(self): diff --git a/src/sage/repl/ipython_kernel/install.py b/src/sage/repl/ipython_kernel/install.py index 684139afb66..cfb11b51bcf 100644 --- a/src/sage/repl/ipython_kernel/install.py +++ b/src/sage/repl/ipython_kernel/install.py @@ -25,7 +25,7 @@ ) -class SageKernelSpec(object): +class SageKernelSpec(): def __init__(self, prefix=None): """ diff --git a/src/sage/repl/ipython_kernel/widgets.py b/src/sage/repl/ipython_kernel/widgets.py index d28594cd24d..dfe126a2760 100644 --- a/src/sage/repl/ipython_kernel/widgets.py +++ b/src/sage/repl/ipython_kernel/widgets.py @@ -83,7 +83,7 @@ def description(self, value): pass -class TransformWidget(object): +class TransformWidget(): """ A mixin class for a widget to transform the bare widget value for use in interactive functions. diff --git a/src/sage/repl/preparse.py b/src/sage/repl/preparse.py index 7c0b63c53ae..37b3b36d042 100644 --- a/src/sage/repl/preparse.py +++ b/src/sage/repl/preparse.py @@ -82,18 +82,18 @@ Symbolic functional notation:: - sage: a=10; f(theta, beta) = theta + beta; b = x^2 + theta - sage: f + sage: a=10; f(theta, beta) = theta + beta; b = x^2 + theta # optional - sage.symbolic + sage: f # optional - sage.symbolic (theta, beta) |--> beta + theta - sage: a + sage: a # optional - sage.symbolic 10 - sage: b + sage: b # optional - sage.symbolic x^2 + theta - sage: f(theta,theta) + sage: f(theta,theta) # optional - sage.symbolic 2*theta - sage: a = 5; f(x,y) = x*y*sqrt(a) - sage: f + sage: a = 5; f(x,y) = x*y*sqrt(a) # optional - sage.symbolic + sage: f # optional - sage.symbolic (x, y) |--> sqrt(5)*x*y This involves an =-, but should still be turned into a symbolic @@ -101,8 +101,8 @@ sage: preparse('a(x) =- 5') '__tmp__=var("x"); a = symbolic_expression(- Integer(5)).function(x)' - sage: f(x)=-x - sage: f(10) + sage: f(x)=-x # optional - sage.symbolic + sage: f(10) # optional - sage.symbolic -10 This involves -=, which should not be turned into a symbolic diff --git a/src/sage/repl/rich_output/display_manager.py b/src/sage/repl/rich_output/display_manager.py index 62a3adf05c4..f022335f8e6 100644 --- a/src/sage/repl/rich_output/display_manager.py +++ b/src/sage/repl/rich_output/display_manager.py @@ -118,7 +118,7 @@ class RichReprWarning(UserWarning): pass -class restricted_output(object): +class restricted_output(): def __init__(self, display_manager, output_classes): """ diff --git a/src/sage/repl/rich_output/pretty_print.py b/src/sage/repl/rich_output/pretty_print.py index f45ca3d126b..154f17b8290 100644 --- a/src/sage/repl/rich_output/pretty_print.py +++ b/src/sage/repl/rich_output/pretty_print.py @@ -12,7 +12,7 @@ sage: pretty_print(1, 2, 3) 1 2 3 - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic x^2/(x + 1) TESTS:: @@ -23,7 +23,7 @@ EXAMPLES:: sage: %display ascii_art # not tested - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic 2 x ----- @@ -41,9 +41,9 @@ :func:`pretty_print` does not print anything and just shows the graphics instead:: - sage: print(plot(sin)) + sage: print(plot(sin)) # optional - sage.symbolic # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: pretty_print(plot(sin)) + sage: pretty_print(plot(sin)) # optional - sage.symbolic # optional - sage.plot """ # **************************************************************************** @@ -117,10 +117,10 @@ def _concatenate_graphs(self): EXAMPLES:: sage: from sage.repl.rich_output.pretty_print import SequencePrettyPrinter - sage: plt = SequencePrettyPrinter(*list(graphs(3)))._concatenate_graphs() - sage: type(plt) + sage: plt = SequencePrettyPrinter(*list(graphs(3)))._concatenate_graphs() # optional - sage.graphs # optional - sage.plot + sage: type(plt) # optional - sage.graphs # optional - sage.plot - sage: plt + sage: plt # optional - sage.graphs # optional - sage.plot Graphics Array of size 1 x 4 """ import sage.graphs.graph_list as graphs_list @@ -137,10 +137,10 @@ def _concatenate_graphics(self): EXAMPLES:: sage: from sage.repl.rich_output.pretty_print import SequencePrettyPrinter - sage: ga = SequencePrettyPrinter(*[Graphics()]*5)._concatenate_graphics() - sage: type(ga) + sage: ga = SequencePrettyPrinter(*[Graphics()]*5)._concatenate_graphics() # optional - sage.plot + sage: type(ga) # optional - sage.plot - sage: ga.nrows(), ga.ncols() + sage: ga.nrows(), ga.ncols() # optional - sage.plot (2, 4) """ from sage.plot.plot import graphics_array @@ -159,15 +159,21 @@ def pretty_print(self): The keyword arguments are only used the first time graphics output is generated:: - sage: seq = SequencePrettyPrinter(Graph(), Graph(), edge_labels=True) - sage: seq.pretty_print() # does not pass edge_labels to graphics object - sage: seq._concatenate_graphs().show(edge_labels=True) + sage: seq = SequencePrettyPrinter(Graph(), Graph(), edge_labels=True) # optional - sage.plot + sage: seq.pretty_print() # does not pass edge_labels to graphics object # optional - sage.plot + sage: seq._concatenate_graphs().show(edge_labels=True) # optional - sage.plot Traceback (most recent call last): ... TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels' """ - from sage.plot.plot import Graphics - from sage.graphs.graph import GenericGraph + try: + from sage.plot.plot import Graphics + except ImportError: + Graphics = () + try: + from sage.graphs.graph import GenericGraph + except ImportError: + GenericGraph = () if self.is_homogeneous(GenericGraph): args = self._concatenate_graphs() kwds = dict() @@ -237,13 +243,13 @@ def pretty_print(*args, **kwds): For text-based backends, the default text display preference is to output plain text which is usually the same as using ``print()``:: - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic x^2/(x + 1) - sage: t = BinaryTrees(3).first() - sage: pretty_print(t) + sage: t = BinaryTrees(3).first() # optional - sage.combinat + sage: pretty_print(t) # optional - sage.combinat [., [., [., .]]] - sage: print(t) + sage: print(t) # optional - sage.combinat [., [., [., .]]] TESTS:: @@ -257,7 +263,7 @@ def pretty_print(*args, **kwds): The following illustrates a possible use-case:: sage: %display ascii_art # not tested - sage: for t in BinaryTrees(3)[:3]: + sage: for t in BinaryTrees(3)[:3]: # optional - sage.combinat ....: pretty_print(t) o \ @@ -273,7 +279,7 @@ def pretty_print(*args, **kwds): / \ o o - sage: pretty_print(x^2 / (x + 1)) + sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic 2 x ----- @@ -287,10 +293,10 @@ def pretty_print(*args, **kwds): :: - sage: plt = plot(sin) - sage: pretty_print(plt) # graphics output - sage: pretty_print(plt, plt) # graphics output - sage: pretty_print(ZZ, 123, plt) + sage: plt = plot(sin) # optional - sage.symbolic # optional - sage.plot + sage: pretty_print(plt) # graphics output # optional - sage.symbolic # optional - sage.plot + sage: pretty_print(plt, plt) # graphics output # optional - sage.symbolic # optional - sage.plot + sage: pretty_print(ZZ, 123, plt) # optional - sage.symbolic # optional - sage.plot Integer Ring 123 Graphics object consisting of 1 graphics primitive """ dm = get_display_manager() @@ -324,7 +330,10 @@ def show(*args, **kwds): sage: show(1) 1 """ - from sage.graphs.generic_graph import GenericGraph + try: + from sage.graphs.generic_graph import GenericGraph + except ImportError: + GenericGraph = () if len(args) == 1 and isinstance(args[0], GenericGraph): # Graphs are special, they ride the short bus... # Please, somebody help me get rid of this! #18289 diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py index a91ec314486..98f40457f07 100644 --- a/src/sage/rings/asymptotic/growth_group.py +++ b/src/sage/rings/asymptotic/growth_group.py @@ -665,7 +665,7 @@ def __init__(self, element, *args, **kwds): ... PartialConversionValueError: wrong value """ - super(PartialConversionValueError, self).__init__(*args, **kwds) + super().__init__(*args, **kwds) self.element = element @@ -1172,7 +1172,7 @@ def __init__(self, parent, raw_element): """ if parent is None: raise ValueError('The parent must be provided') - super(GenericGrowthElement, self).__init__(parent=parent) + super().__init__(parent=parent) try: self._raw_element_ = parent.base()(raw_element) @@ -1777,8 +1777,7 @@ def __classcall__(cls, base, var=None, category=None, ignore_variables=None): cls._determine_category_axiom_mapping_, initial_category=cls._initial_category_(base)) - return super(GenericGrowthGroup, cls).__classcall__( - cls, base, var, category) + return super().__classcall__(cls, base, var, category) @staticmethod def _initial_category_(base): @@ -1888,8 +1887,7 @@ def __init__(self, base, var, category): """ self._var_ = var - super(GenericGrowthGroup, self).__init__(category=category, - base=base) + super().__init__(category=category, base=base) def _repr_short_(self): r""" @@ -2714,8 +2712,7 @@ def __init__(self, var, domain): elif not isinstance(var, Variable): var = Variable(var) self.var = var - super(ConstructionFunctor, self).__init__( - domain, Monoids() & Posets()) + super().__init__(domain, Monoids() & Posets()) def _repr_(self): r""" @@ -3896,9 +3893,7 @@ def __init__(self, var): MonomialGrowthGroup[x] """ from sage.categories.commutative_additive_monoids import CommutativeAdditiveMonoids - - super(MonomialGrowthGroupFunctor, self).__init__(var, - CommutativeAdditiveMonoids()) + super().__init__(var, CommutativeAdditiveMonoids()) def _apply_functor(self, base): r""" @@ -4420,7 +4415,7 @@ def __init__(self, base, *args, **kwds): """ from warnings import warn - super(ExponentialGrowthGroup, self).__init__(base, *args, **kwds) + super().__init__(base, *args, **kwds) if isinstance(base, sage.rings.abc.SymbolicRing) and not self._an_element_base_() > 0: warn("When using the Exponential {}, make " "assumptions on the used symbolic elements.\n" @@ -4947,9 +4942,7 @@ def __init__(self, var): ExponentialGrowthGroup[x] """ from sage.categories.monoids import Monoids - - super(ExponentialGrowthGroupFunctor, self).__init__(var, - Monoids()) + super().__init__(var, Monoids()) def _apply_functor(self, base): r""" diff --git a/src/sage/rings/asymptotic/term_monoid.py b/src/sage/rings/asymptotic/term_monoid.py index 35064d10b18..53dfbc621a1 100644 --- a/src/sage/rings/asymptotic/term_monoid.py +++ b/src/sage/rings/asymptotic/term_monoid.py @@ -389,7 +389,7 @@ def __init__(self, parent, growth): raise ValueError('The parent must be provided') self.growth = parent.growth_group(growth) - super(GenericTerm, self).__init__(parent=parent) + super().__init__(parent=parent) def construction(self): r""" @@ -1469,7 +1469,7 @@ def __classcall__(cls, term_monoid_factory, from sage.categories.posets import Posets category = Monoids() & Posets() - return super(GenericTermMonoid, cls).__classcall__( + return super().__classcall__( cls, term_monoid_factory, growth_group, coefficient_ring, category) def __init__(self, term_monoid_factory, growth_group, coefficient_ring, category): @@ -1513,7 +1513,7 @@ def __init__(self, term_monoid_factory, growth_group, coefficient_ring, category self._term_monoid_factory_ = term_monoid_factory self._growth_group_ = growth_group self._coefficient_ring_ = coefficient_ring - super(GenericTermMonoid, self).__init__(category=category) + super().__init__(category=category) @property def term_monoid_factory(self): @@ -3092,7 +3092,7 @@ def _coerce_map_from_(self, S): self.coefficient_ring.has_coerce_map_from(S.coefficient_ring): return True else: - return super(OTermMonoid, self)._coerce_map_from_(S) + return super()._coerce_map_from_(S) def _repr_(self): r""" @@ -3191,7 +3191,7 @@ def __init__(self, parent, growth, coefficient): sage: CT_ZZ(x^42, coefficient=42) Term with coefficient 42 and growth x^42 """ - super(TermWithCoefficient, self).__init__(parent=parent, growth=growth) + super().__init__(parent=parent, growth=growth) try: coefficient = parent.coefficient_ring(coefficient) except (ValueError, TypeError): @@ -3416,7 +3416,7 @@ def _calculate_pow_(self, exponent): ArithmeticError('Cannot take %s to the exponent %s in %s since its ' 'coefficient %s cannot be taken to this exponent.' % (self, exponent, self.parent(), self.coefficient)), e) - return super(TermWithCoefficient, self)._calculate_pow_(exponent, new_coefficient=c) + return super()._calculate_pow_(exponent, new_coefficient=c) def _log_coefficient_(self, base=None, locals=None): r""" @@ -3507,8 +3507,7 @@ def _eq_(self, other): sage: t == T(x^2, coefficient=1) False """ - return super(TermWithCoefficient, self)._eq_(other) and \ - self.coefficient == other.coefficient + return super()._eq_(other) and self.coefficient == other.coefficient class TermWithCoefficientMonoid(GenericTermMonoid): diff --git a/src/sage/rings/bernoulli_mod_p.pyx b/src/sage/rings/bernoulli_mod_p.pyx index 514d32d6ec9..b46c6b41da1 100644 --- a/src/sage/rings/bernoulli_mod_p.pyx +++ b/src/sage/rings/bernoulli_mod_p.pyx @@ -39,10 +39,9 @@ from sage.rings.finite_rings.integer_mod_ring import Integers from sage.rings.bernmm import bernmm_bern_modp - def verify_bernoulli_mod_p(data): - """ - Computes checksum for Bernoulli numbers. + r""" + Compute checksum for Bernoulli numbers. It checks the identity diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index 38fcafd313c..c993ac687b2 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -732,7 +732,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): return x def norm(self): - """ + r""" Return the norm of this complex number. If `c = a + bi` is a complex number, then the norm of `c` is defined as diff --git a/src/sage/rings/continued_fraction_gosper.py b/src/sage/rings/continued_fraction_gosper.py index 07b2dcc852b..08d5dd34658 100644 --- a/src/sage/rings/continued_fraction_gosper.py +++ b/src/sage/rings/continued_fraction_gosper.py @@ -35,7 +35,7 @@ from sage.rings.infinity import Infinity from sage.rings.integer import Integer -class gosper_iterator(object): +class gosper_iterator(): r""" Iterable for the partial quotients of `(a*x+b)/(c*x+d)`, where `a, b, c, d` are integers, and `x` is a continued fraction. diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 582f59971f6..5c3d7492c7a 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1497,9 +1497,18 @@ cdef class FiniteField(Field): sage: F.extension(int(3), 'a') Finite Field in a of size 2^3 - sage: F = GF(2 ** 4, 'a') + sage: F = GF((2,4), 'a') sage: F.extension(int(3), 'aa') Finite Field in aa of size 2^12 + + Randomized test for :trac:`33937`:: + + sage: p = random_prime(100) + sage: a,b = (randrange(1,10) for _ in 'ab') + sage: K. = GF((p,a)) + sage: L. = K.extension(b) + sage: L(u).minpoly() == u.minpoly() + True """ from .finite_field_constructor import GF from sage.rings.polynomial.polynomial_element import is_Polynomial @@ -1510,22 +1519,22 @@ cdef class FiniteField(Field): latex_name = latex_names if self.degree() == 1: if isinstance(modulus, (int, Integer)): - E = GF(self.characteristic()**modulus, name=name, **kwds) + E = GF((self.characteristic(), modulus), name=name, **kwds) elif isinstance(modulus, (list, tuple)): - E = GF(self.characteristic()**(len(modulus) - 1), name=name, modulus=modulus, **kwds) + E = GF((self.characteristic(), len(modulus) - 1), name=name, modulus=modulus, **kwds) elif is_Polynomial(modulus): if modulus.change_ring(self).is_irreducible(): - E = GF(self.characteristic()**(modulus.degree()), name=name, modulus=modulus, **kwds) + E = GF((self.characteristic(), modulus.degree()), name=name, modulus=modulus, **kwds) else: E = Field.extension(self, modulus, name=name, embedding=embedding, **kwds) elif isinstance(modulus, (int, Integer)): - E = GF(self.order()**modulus, name=name, **kwds) + E = GF((self.characteristic(), self.degree() * modulus), name=name, **kwds) if E is self: pass # coercion map (identity map) is automatically found elif hasattr(E, '_prefix') and hasattr(self, '_prefix'): pass # coercion map is automatically found else: - if self.is_conway(): # and E is Conway + if self.is_conway() and E.is_conway(): alpha = E.gen()**((E.order()-1)//(self.order()-1)) else: alpha = self.modulus().any_root(E) @@ -1577,6 +1586,7 @@ cdef class FiniteField(Field): d = self.degree() D = list(reversed(d.divisors()[:-1])) P = d.support() + def make_family(gen, poly): if poly.degree() != d: return False, {} diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx index 698c54e71b5..d79ea68fc25 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx @@ -82,8 +82,12 @@ cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_ cdef long sb, sy while b != 0: q = a // b - sb = b; b = a-q*b; a = sb - sy = y; y = x-q*y; x = sy + sb = b + b = a - q * b + a = sb + sy = y + y = x - q * y + x = sy self._gcd = a if x < 0: diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 0489e50b1bc..714d796ec90 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -1,4 +1,3 @@ -# cython: language_level=2 r""" Elements of `\ZZ/n\ZZ` @@ -1559,7 +1558,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): if nval >= plog.valuation() + (-1 if p == 2 else 0): if self == 1: if all: - return [s*K(p*k+m.lift()) for k in range(p**(k-(2 if p==2 else 1))) for m in modp for s in sign] + return [s*K(p*a+m.lift()) for a in range(p**(k-(2 if p==2 else 1))) for m in modp for s in sign] else: return K(modp.lift()) else: diff --git a/src/sage/rings/function_field/function_field_valuation.py b/src/sage/rings/function_field/function_field_valuation.py index 3747cdb6668..2573df22267 100644 --- a/src/sage/rings/function_field/function_field_valuation.py +++ b/src/sage/rings/function_field/function_field_valuation.py @@ -615,7 +615,7 @@ def element_with_valuation(self, s): """ constant_valuation = self.restriction(self.domain().constant_base_field()) if constant_valuation.is_trivial(): - return super(RationalFunctionFieldValuation_base, self).element_with_valuation(s) + return super().element_with_valuation(s) a, b = self.value_group()._element_with_valuation(constant_valuation.value_group(), s) ret = self.uniformizer()**a * constant_valuation.element_with_valuation(constant_valuation.value_group().gen()*b) @@ -672,7 +672,7 @@ def _ge_(self, other): return other.is_discrete_valuation() if isinstance(other, ClassicalFunctionFieldValuation_base): return self == other - super(ClassicalFunctionFieldValuation_base, self)._ge_(other) + super()._ge_(other) class InducedRationalFunctionFieldValuation_base(FunctionFieldValuation_base): @@ -845,7 +845,7 @@ def extensions(self, L): W = self._base_valuation.extensions(L._ring) return [L.valuation(w) for w in W] - return super(InducedRationalFunctionFieldValuation_base, self).extensions(L) + return super().extensions(L) def _call_(self, f): r""" @@ -887,7 +887,7 @@ def restriction(self, ring): """ if ring.is_subring(self._base_valuation.domain()): return self._base_valuation.restriction(ring) - return super(InducedRationalFunctionFieldValuation_base, self).restriction(ring) + return super().restriction(ring) def simplify(self, f, error=None, force=False): r""" @@ -1096,7 +1096,7 @@ def residue_ring(self): """ if not self.is_discrete_valuation(): # A pseudo valuation attaining negative infinity does typically not have a function field as its residue ring - return super(NonClassicalRationalFunctionFieldValuation, self).residue_ring() + return super().residue_ring() return self._base_valuation.residue_ring().fraction_field().function_field() @@ -1166,7 +1166,7 @@ def scale(self, scalar): """ if scalar in QQ and scalar > 0 and scalar != 1: return self.domain().valuation(self._base_valuation._initial_approximation.scale(scalar)) - return super(FunctionFieldFromLimitValuation, self).scale(scalar) + return super().scale(scalar) class FunctionFieldMappedValuation_base(FunctionFieldValuation_base, MappedValuation_base): @@ -1250,7 +1250,7 @@ def scale(self, scalar): from sage.rings.rational_field import QQ if scalar in QQ and scalar > 0 and scalar != 1: return self.domain().valuation((self._base_valuation.scale(scalar), self._to_base, self._from_base)) - return super(FunctionFieldMappedValuation_base, self).scale(scalar) + return super().scale(scalar) def _repr_(self): r""" @@ -1330,7 +1330,7 @@ def restriction(self, ring): """ if ring.is_subring(self.domain().constant_base_field()): return self._base_valuation.restriction(ring) - return super(FunctionFieldMappedValuation_base, self).restriction(ring) + return super().restriction(ring) class RationalFunctionFieldMappedValuation(FunctionFieldMappedValuationRelative_base, RationalFunctionFieldValuation_base): @@ -1461,7 +1461,7 @@ def _repr_(self): assert(self.domain().base() is not self.domain()) if repr(self._base_valuation) == repr(self.restriction(self.domain().base())): return repr(self._base_valuation) - return super(FunctionFieldExtensionMappedValuation, self)._repr_() + return super()._repr_() def restriction(self, ring): r""" @@ -1476,8 +1476,7 @@ def restriction(self, ring): sage: w = v.extension(L) sage: w.restriction(K) is v True - """ if ring.is_subring(self.domain().base()): return self._base_valuation.restriction(ring) - return super(FunctionFieldExtensionMappedValuation, self).restriction(ring) + return super().restriction(ring) diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 18adea7ca8b..c30004c8d5a 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -227,7 +227,7 @@ import sage.rings.integer_ring _obj = {} -class _uniq(object): +class _uniq(): def __new__(cls, *args): """ This ensures uniqueness of these objects. @@ -243,7 +243,7 @@ def __new__(cls, *args): return O -class AnInfinity(object): +class AnInfinity(): """ TESTS:: diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 682fa8cba64..a4399439015 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -7099,7 +7099,7 @@ cdef int mpz_set_str_python(mpz_ptr z, char* s, int base) except -1: x += 1 # Strip spaces # Disallow a sign here - if x[0] == '-' or x[0] == '+': + if x[0] == c'-' or x[0] == c'+': x = "" # Force an error below assert base >= 2 diff --git a/src/sage/rings/invariants/invariant_theory.py b/src/sage/rings/invariants/invariant_theory.py index 7478093452d..c37af37cc7c 100644 --- a/src/sage/rings/invariants/invariant_theory.py +++ b/src/sage/rings/invariants/invariant_theory.py @@ -4058,7 +4058,7 @@ def syzygy(self, Delta, Theta, Phi, Theta_prime, Delta_prime, U, V, T, T_prime, ###################################################################### -class InvariantTheoryFactory(object): +class InvariantTheoryFactory(): """ Factory object for invariants of multilinear forms. diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 2cdd0ce4476..96a55bffd69 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -3132,6 +3132,7 @@ def _tensor_product_ring(B, A): else: names = (['y%d' % d for d in range(B.ngens())] + ['x%d' % d for d in range(A.ngens())]) + def term_order(A): # univariate rings do not have a term order if (is_PolynomialRing(A) or is_PolynomialQuotientRing(A) diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 9ce75c73c42..b1c1a3ffb67 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -2080,7 +2080,7 @@ def laurent_series(self): raise NotImplementedError("laurent_series not defined for multivariate power series.") -class MO(object): +class MO(): """ Object representing a zero element with given precision. diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py index 4e440c36ea0..fd1a5fe824c 100644 --- a/src/sage/rings/number_field/S_unit_solver.py +++ b/src/sage/rings/number_field/S_unit_solver.py @@ -142,7 +142,7 @@ def c3_func(SUK, prec=106): REFERENCES: - - [AKMRVW]_ arXiv:1903.00977 + - [AKMRVW]_ :arxiv:`1903.00977` """ @@ -541,7 +541,7 @@ def Omega_prime(dK, v, mu_list, prec=106): REFERENCES: - - [AKMRVW]_ arXiv:1903:.00977 + - [AKMRVW]_ :arxiv:`1903.00977` """ R = RealField(prec) @@ -645,8 +645,7 @@ def Yu_bound(SUK, v, prec=106): - [Sma1995]_ p. 825 - [Yu2007]_ p. 189--193 esp. Theorem 1 - - [AKMRVW]_ arXiv:1903.00977 - + - [AKMRVW]_ :arxiv:`1903.00977` """ # We are using Theorem 1 of "p-adic logarithmic forms and group varieties III" by Kunrui Yu. @@ -727,7 +726,7 @@ def K0_func(SUK, A, prec=106): REFERENCES: - [Sma1995]_ p. 824 - - [AKMRVW]_ arXiv:1903.00977 + - [AKMRVW]_ :arxiv:`1903.00977` """ R = RealField(prec) diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 21e19618896..3585eee09f5 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -5451,7 +5451,7 @@ cdef class OrderElement_relative(NumberFieldElement_relative): -class CoordinateFunction(object): +class CoordinateFunction(): r""" This class provides a callable object which expresses elements in terms of powers of a fixed field generator `\alpha`. diff --git a/src/sage/rings/padics/lattice_precision.py b/src/sage/rings/padics/lattice_precision.py index 40c5bb04edd..a041394d635 100644 --- a/src/sage/rings/padics/lattice_precision.py +++ b/src/sage/rings/padics/lattice_precision.py @@ -2741,7 +2741,7 @@ def precision_lattice(self, elements=None): M *= self._p ** val return M -class pAdicLatticeElementWeakProxy(object): +class pAdicLatticeElementWeakProxy(): r""" The implementations of :class:`DifferentialPrecisionGeneric` hold weak references to :class:`pAdicLatticeElement`. They are stored in diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx index eca79a2d8aa..463cc371031 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx @@ -2780,7 +2780,22 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): [] sage: list(A(0,4).expansion()) [] + + TESTS: + + We check that :trac:`24949` is fixed:: + + sage: R = Zp(2) + sage: S. = R[] + sage: A. = R.extension(x^10 + 2) + sage: u = a^4 + a^5 + sage: v = a^2 + a^3 + sage: w = u - v^2 + sage: w.expansion(4) + 0 + """ + self._normalize() if lift_mode == 'teichmuller': zero = self.parent()(0) elif self.prime_pow.e == 1: diff --git a/src/sage/rings/padics/padic_ZZ_pX_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_element.pyx index eed82ac8031..a450f28de65 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_element.pyx @@ -483,6 +483,17 @@ cdef class pAdicZZpXElement(pAdicExtElement): 4*5 + 5^2 + 5^3 + 2*5^4 sage: (a+b).trace() 4*5 + 5^2 + 5^3 + 2*5^4 + + TESTS: + + We check that :trac:`32072` is resolved:: + + sage: F = Qp(2) + sage: S. = F[] + sage: L. = F.ext(x^2 - 2) + sage: L(0, 20).trace() + O(2^10) + """ if base is not None: if base is self.parent(): @@ -492,7 +503,7 @@ cdef class pAdicZZpXElement(pAdicExtElement): if self._is_exact_zero(): return self.parent().ground_ring()(0) elif self._is_inexact_zero(): - return self.ground_ring(0, (self.valuation() - 1) // self.parent().e() + 1) + return self.parent().ground_ring()(0, (self.valuation() - 1) // self.parent().e() + 1) if self.valuation() >= 0: return self.parent().ground_ring()(self.matrix_mod_pn().trace()) else: diff --git a/src/sage/rings/padics/padic_generic_element.pyx b/src/sage/rings/padics/padic_generic_element.pyx index 9bacb7ce43a..5cf7d8a04f3 100644 --- a/src/sage/rings/padics/padic_generic_element.pyx +++ b/src/sage/rings/padics/padic_generic_element.pyx @@ -814,7 +814,8 @@ cdef class pAdicGenericElement(LocalGenericElement): p = R.prime() pow = self.add_bigoh(prec) arg = pow - denom = 1; trunc = prec + denom = 1 + trunc = prec if R.absolute_degree() == 1: # Special code for Zp and Qp while pow != 0: @@ -946,7 +947,8 @@ cdef class pAdicGenericElement(LocalGenericElement): # We compute b = 1 + x + x^p/p + x^(p^2)/p^2 + ... pow = self.add_bigoh(prec) b = 1 + pow - denom = 1; trunc = prec + denom = 1 + trunc = prec while pow != 0: trunc += e pow = (pow**p).add_bigoh(trunc) diff --git a/src/sage/rings/padics/padic_template_element.pxi b/src/sage/rings/padics/padic_template_element.pxi index b30d8cf0ae9..80c33df881b 100644 --- a/src/sage/rings/padics/padic_template_element.pxi +++ b/src/sage/rings/padics/padic_template_element.pxi @@ -73,6 +73,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): sage: Zp(17)(17^3, 8, 4) 17^3 + O(17^7) + """ def __init__(self, parent, x, absprec=infinity, relprec=infinity): """ @@ -107,6 +108,13 @@ cdef class pAdicTemplateElement(pAdicGenericElement): ... TypeError: p does not divide modulus 9 + :: + + sage: Zp(2)(Zp(5)(1)) + Traceback (most recent call last): + ... + TypeError: no conversion between padics when prime numbers differ + """ self.prime_pow = parent.prime_pow pAdicGenericElement.__init__(self, parent) @@ -122,6 +130,8 @@ cdef class pAdicTemplateElement(pAdicGenericElement): elif typ(pari_tmp) == t_FRAC: x = Rational(x) elif isinstance(x, pAdicGenericElement): + if self.prime_pow.prime != x.parent().prime(): + raise TypeError("no conversion between padics when prime numbers differ") if not ((x)._is_base_elt(self.prime_pow.prime) or x.parent() is self.parent()): if x.parent().modulus().change_ring(self.base_ring()) == self.parent().modulus(): x = x.polynomial().change_ring(self.base_ring()).list() @@ -870,7 +880,7 @@ cdef _zero(expansion_mode mode, teich_ring): else: return _expansion_zero -cdef class ExpansionIter(object): +cdef class ExpansionIter(): """ An iterator over a `p`-adic expansion. @@ -999,7 +1009,7 @@ cdef class ExpansionIter(object): else: return cexpansion_next(self.curvalue, self.mode, self.curpower, pp) -cdef class ExpansionIterable(object): +cdef class ExpansionIterable(): r""" An iterable storing a `p`-adic expansion of an element. diff --git a/src/sage/rings/padics/relaxed_template.pxi b/src/sage/rings/padics/relaxed_template.pxi index 7269da0f8f2..f87034e56e3 100644 --- a/src/sage/rings/padics/relaxed_template.pxi +++ b/src/sage/rings/padics/relaxed_template.pxi @@ -4030,7 +4030,7 @@ cdef class RelaxedElement_zeroone(RelaxedElementWithDigits): return ERROR_NOTDEFINED -cdef class ExpansionIter(object): +cdef class ExpansionIter(): """ An iterator over a `p`-adic expansion. diff --git a/src/sage/rings/padics/relaxed_template_header.pxi b/src/sage/rings/padics/relaxed_template_header.pxi index 4e3f7f825df..5425c11c45d 100644 --- a/src/sage/rings/padics/relaxed_template_header.pxi +++ b/src/sage/rings/padics/relaxed_template_header.pxi @@ -141,7 +141,7 @@ cdef class RelaxedElement_zeroone(RelaxedElementWithDigits): cdef void _setdigit_to_zero(self) cdef void _setdigit_to_one(self) -cdef class ExpansionIter(object): +cdef class ExpansionIter(): cdef RelaxedElement elt cdef expansion_mode mode cdef long start diff --git a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py index 6eac70126dc..b58c485ec50 100644 --- a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +++ b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py @@ -2,12 +2,12 @@ p-adic Capped Relative Dense Polynomials """ -#***************************************************************************** +# **************************************************************************** # Distributed under the terms of the GNU General Public License (GPL) # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** import sage.rings.polynomial.polynomial_element_generic from sage.rings.polynomial.polynomial_element import Polynomial @@ -17,7 +17,7 @@ import sage.rings.integer_ring import sage.rings.padics.misc as misc import sage.rings.padics.precision_error as precision_error -import sage.rings.fraction_field_element as fraction_field_element +from sage.rings.fraction_field_element import FractionFieldElement import copy from sage.libs.pari.all import pari, pari_gen @@ -33,7 +33,7 @@ class Polynomial_padic_capped_relative_dense(Polynomial_generic_cdv, Polynomial_padic): - def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, absprec = infinity, relprec = infinity): + def __init__(self, parent, x=None, check=True, is_gen=False, construct=False, absprec=infinity, relprec=infinity): """ TESTS:: @@ -65,7 +65,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, parentbr = parent.base_ring() from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if construct: - (self._poly, self._valbase, self._relprecs, self._normalized, self._valaddeds, self._list) = x #the last two of these may be None + (self._poly, self._valbase, self._relprecs, self._normalized, self._valaddeds, self._list) = x # the last two of these may be None return elif is_gen: self._poly = PolynomialRing(ZZ, parent.variable_name()).gen() @@ -76,15 +76,14 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, self._list = None return - #First we list the types that are turned into Polynomials + # First we list the types that are turned into Polynomials if isinstance(x, ZZX): - x = Polynomial_integer_dense(PolynomialRing(ZZ, parent.variable_name()), x, construct = True) - elif isinstance(x, fraction_field_element.FractionFieldElement) and \ - x.denominator() == 1: - #Currently we ignore precision information in the denominator. This should be changed eventually + x = Polynomial_integer_dense(PolynomialRing(ZZ, parent.variable_name()), x, construct=True) + elif isinstance(x, FractionFieldElement) and x.denominator() == 1: + # Currently we ignore precision information in the denominator. This should be changed eventually x = x.numerator() - #We now coerce various types into lists of coefficients. There are fast pathways for some types of polynomials + # We now coerce various types into lists of coefficients. There are fast pathways for some types of polynomials if isinstance(x, Polynomial): if x.parent() is self.parent(): if absprec is not infinity or relprec is not infinity: @@ -104,7 +103,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, p = parentbr.prime() self._relprecs = [c.valuation(p) + parentbr.precision_cap() for c in x.list()] self._comp_valaddeds() - self._normalized = len(self._valaddeds) == 0 or (min(self._valaddeds) == 0) + self._normalized = not self._valaddeds or min(self._valaddeds) == 0 self._list = None if absprec is not infinity or relprec is not infinity: self._adjust_prec_info(absprec, relprec) @@ -114,7 +113,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, check = False elif isinstance(x, dict): zero = parentbr.zero() - n = max(x.keys()) if x else 0 + n = max(x) if x else 0 v = [zero] * (n + 1) for i, z in x.items(): v[i] = z @@ -126,7 +125,7 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, # the type is, is to assume it coerces into the base_ring as a # constant polynomial elif not isinstance(x, list): - x = [x] # constant polynomial + x = [x] # constant polynomial # In contrast to other polynomials, the zero element is not distinguished # by having its list empty. Instead, it has list [0] @@ -136,8 +135,8 @@ def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, x = [parentbr(z) for z in x] # Remove this -- for p-adics this is terrible, since it kills any non exact zero. - #if len(x) == 1 and not x[0]: - # x = [] + # if len(x) == 1 and not x[0]: + # x = [] self._list = x self._valaddeds = [a.valuation() for a in x] @@ -185,13 +184,13 @@ def _normalize(self): if val is infinity: pass elif val != 0: - self._relprecs = [max(prec - val,0) for prec in self._relprecs] - v = [Integer(0) if (e is infinity) else ((c // prime_pow(val)) % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)] + self._relprecs = [max(prec - val, 0) for prec in self._relprecs] + v = [Integer(0) if (e is infinity) else ((c // prime_pow(val)) % prime_pow(e)) for c, e in zip(selflist, self._relprecs)] self._poly = self._poly.parent()(v, check=False) self._valbase += val self._valaddeds = [c - val for c in self._valaddeds] else: - self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)], check=False) + self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for c, e in zip(selflist, self._relprecs)], check=False) self._normalized = True def _reduce_poly(self): @@ -223,14 +222,15 @@ def _comp_list(self): polylist = self._poly.list() polylen = len(polylist) self._list = [self.base_ring()(polylist[i], absprec=self._relprecs[i]) << self._valbase for i in range(polylen)] \ - + [self.base_ring()(0, absprec=self._relprecs[i] + self._valbase) for i in range(polylen, len(self._relprecs))] + + [self.base_ring()(0, absprec=self._relprecs[i] + self._valbase) for i in range(polylen, len(self._relprecs))] while self._list and self._list[-1]._is_exact_zero(): self._list.pop() def _comp_valaddeds(self): self._valaddeds = [] - for i in range(self._poly.degree() + 1): - tmp = self._poly.list()[i].valuation(self.parent().base_ring().prime()) + prime = self.parent().base_ring().prime() + for i, pli in enumerate(self._poly.list()): + tmp = pli.valuation(prime) if tmp is infinity or tmp > self._relprecs[i]: self._valaddeds.append(self._relprecs[i]) else: @@ -287,7 +287,7 @@ def _adjust_prec_info(self, absprec=infinity, relprec=infinity): # else: # relprec = relprec + [parent.base_ring().precision_cap()] * (preclen - len(relprec)) # self._relprec = [min(a, v + r) - self._val for (a, r, v) in zip(absprec, relprec, vallist)] -#Remember to normalize at the end if self._normalized is true because you need to reduce mod p^n +# Remember to normalize at the end if self._normalized is true because you need to reduce mod p^n def _getprecpoly(self, n): one = Integer(1) @@ -297,7 +297,7 @@ def _getvalpoly(self, n): one = Integer(1) if self._valaddeds is None: self._comp_valaddeds() - return self._poly.parent()([(0 if (c is infinity) else (one << (n * c))) for c in self._valaddeds] + \ + return self._poly.parent()([(0 if (c is infinity) else (one << (n * c))) for c in self._valaddeds] + [(0 if (c is infinity) else (one << (n * c))) for c in self._relprecs[len(self._valaddeds):]]) def list(self, copy=True): @@ -413,7 +413,7 @@ def __getitem__(self, n): if self._list is not None: return self._list[n] return self.base_ring()(self.base_ring().prime_pow(self._valbase) - * self._poly[n], absprec = self._valbase + self._relprecs[n]) + * self._poly[n], absprec=self._valbase + self._relprecs[n]) def _add_(self, right): """ @@ -441,13 +441,13 @@ def _add_(self, right): else: baseval = self._valbase # Currently we don't reduce the coefficients of the answer modulo the appropriate power of p or normalize - return Polynomial_padic_capped_relative_dense(self.parent(), \ - (selfpoly + rightpoly, \ - baseval, \ - [min(a + self._valbase - baseval, b + right._valbase - baseval) for (a, b) in - zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), \ - _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], \ - False, None, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), + (selfpoly + rightpoly, + baseval, + [min(a + self._valbase - baseval, b + right._valbase - baseval) + for (a, b) in zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), + _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], + False, None, None), construct=True) def _sub_(self, right): """ @@ -475,13 +475,13 @@ def _sub_(self, right): else: baseval = self._valbase # Currently we don't reduce the coefficients of the answer modulo the appropriate power of p or normalize - return Polynomial_padic_capped_relative_dense(self.parent(), \ - (selfpoly - rightpoly, \ - baseval, \ - [min(a + self._valbase - baseval, b + right._valbase - baseval) for (a, b) in - zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), \ - _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], \ - False, None, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), + (selfpoly - rightpoly, + baseval, + [min(a + self._valbase - baseval, b + right._valbase - baseval) + for (a, b) in zip(_extend_by_infinity(self._relprecs, max(len(self._relprecs), len(right._relprecs))), + _extend_by_infinity(right._relprecs, max(len(self._relprecs), len(right._relprecs))))], + False, None, None), construct=True) def _mul_(self, right): r""" @@ -549,7 +549,7 @@ def _mul_(self, right): self._normalize() right._normalize() zzpoly = self._poly * right._poly - if len(self._relprecs) == 0 or len(right._relprecs) == 0: + if not self._relprecs or len(right._relprecs) == 0: return self.parent()(0) n = Integer(len(self._relprecs) + len(right._relprecs) - 1).exact_log(2) + 1 precpoly1 = self._getprecpoly(n) * right._getvalpoly(n) @@ -557,7 +557,7 @@ def _mul_(self, right): # These two will be the same length tn = Integer(1) << n preclist = [min(a.valuation(tn), b.valuation(tn)) for (a, b) in zip(precpoly1.list(), precpoly2.list())] - answer = Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase + right._valbase, preclist, False, None, None), construct = True) + answer = Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase + right._valbase, preclist, False, None, None), construct=True) answer._reduce_poly() return answer @@ -588,8 +588,8 @@ def _rmul_(self, left): elif left._is_exact_zero(): return Polynomial_padic_capped_relative_dense(self.parent(), []) else: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(0), self._valbase + left.valuation(), self._valaddeds, False, self._valaddeds, None), construct = True) - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly._rmul_(unit), self._valbase + val, relprecs, False, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(0), self._valbase + left.valuation(), self._valaddeds, False, self._valaddeds, None), construct=True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly._rmul_(unit), self._valbase + val, relprecs, False, self._valaddeds, None), construct=True) def _neg_(self): """ @@ -603,9 +603,9 @@ def _neg_(self): sage: -a (12 + 12*13 + O(13^2))*t^4 + (12*13 + 12*13^2 + O(13^3))*t^2 + 9 + 12*13 + O(13^2) """ - return Polynomial_padic_capped_relative_dense(self.parent(), (-self._poly, self._valbase, self._relprecs, False, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (-self._poly, self._valbase, self._relprecs, False, self._valaddeds, None), construct=True) - def lshift_coeffs(self, shift, no_list = False): + def lshift_coeffs(self, shift, no_list=False): """ Return a new polynomials whose coefficients are multiplied by p^shift. @@ -620,9 +620,9 @@ def lshift_coeffs(self, shift, no_list = False): if shift < 0: return self.rshift_coeffs(-shift, no_list) if no_list or self._list is None: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, None), construct=True) else: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, [c.__lshift__(shift) for c in self._list]), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase + shift, self._relprecs, False, self._valaddeds, [c.__lshift__(shift) for c in self._list]), construct=True) def rshift_coeffs(self, shift, no_list=False): """ @@ -649,25 +649,25 @@ def rshift_coeffs(self, shift, no_list=False): [1 + O(13^4), O(13), O(13^2)] """ if shift < 0: - return self.lshift_coeffs(-shift, no_list) # We can't just absorb this into the next if statement because we allow rshift to preserve _normalized + return self.lshift_coeffs(-shift, no_list) # We can't just absorb this into the next if statement because we allow rshift to preserve _normalized if self.base_ring().is_field() or shift <= self._valbase: if no_list or self._list is None: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, None), construct=True) else: - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, [c.__rshift__(shift) for c in self._list]), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly, self._valbase - shift, self._relprecs, self._normalized, self._valaddeds, [c.__rshift__(shift) for c in self._list]), construct=True) else: shift = shift - self._valbase fdiv = self.base_ring().prime_pow(shift) - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly // fdiv, 0, [0 if a <= shift else a - shift for a in self._relprecs], False, None, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly // fdiv, 0, [0 if a <= shift else a - shift for a in self._relprecs], False, None, None), construct=True) - #def __floordiv__(self, right): - # if is_Polynomial(right) and right.is_constant() and right[0] in self.base_ring(): - # d = self.base_ring()(right[0]) - # elif (right in self.base_ring()): - # d = self.base_ring()(right) - # else: - # raise NotImplementedError - # return self._rmul_(self.base_ring()(~d.unit_part())).rshift_coeffs(d.valuation()) + # def __floordiv__(self, right): + # if is_Polynomial(right) and right.is_constant() and right[0] in self.base_ring(): + # d = self.base_ring()(right[0]) + # elif (right in self.base_ring()): + # d = self.base_ring()(right) + # else: + # raise NotImplementedError + # return self._rmul_(self.base_ring()(~d.unit_part())).rshift_coeffs(d.valuation()) def _unsafe_mutate(self, n, value): """ @@ -747,7 +747,7 @@ def __copy__(self): """ Return a copy of ``self``. """ - return Polynomial_padic_capped_relative_dense(self.parent(), (copy.copy(self._poly), self._valbase, copy.copy(self._relprecs), self._normalized, copy.copy(self._valaddeds), copy.copy(self._list)), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (copy.copy(self._poly), self._valbase, copy.copy(self._relprecs), self._normalized, copy.copy(self._valaddeds), copy.copy(self._list)), construct=True) def degree(self, secure=False): """ @@ -817,7 +817,7 @@ def prec_degree(self): """ return len(self._relprecs) - 1 - def precision_absolute(self, n = None): + def precision_absolute(self, n=None): """ Return absolute precision information about ``self``. @@ -846,7 +846,7 @@ def precision_absolute(self, n = None): return [c + self._valbase for c in self._relprecs] return self._relprecs[n] + self._valbase - def precision_relative(self, n = None): + def precision_relative(self, n=None): """ Return relative precision information about ``self``. @@ -910,7 +910,7 @@ def valuation_of_coefficient(self, n=None): self._comp_valaddeds() if n is None: self._normalize() - return [ c + self._valbase for c in self._valaddeds ] + return [c + self._valbase for c in self._valaddeds] n = int(n) if n < 0 or n >= len(self._relprecs): return infinity @@ -999,7 +999,7 @@ def reverse(self, degree=None): else: L = self._list[:(n + 1)] + [self.base_ring()(0)] * (n - self.prec_degree()) L.reverse() - return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(zzlist), self._valbase, relprec, self._normalized, valadded, L), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (self._poly.parent()(zzlist), self._valbase, relprec, self._normalized, valadded, L), construct=True) def rescale(self, a): r""" @@ -1041,7 +1041,7 @@ def rescale(self, a): zzpoly = self._poly.parent()(0) else: zzpoly = self._poly.rescale(Integer(a)) - return Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase, relprec, False, valadded, None), construct = True) + return Polynomial_padic_capped_relative_dense(self.parent(), (zzpoly, self._valbase, relprec, False, valadded, None), construct=True) def quo_rem(self, right, secure=False): """ @@ -1070,7 +1070,7 @@ def quo_rem(self, right, secure=False): def _quo_rem_naive(self, right): """ - An implementation of quo_rem that doesn't have good run-time + An implementation of quo_rem that does not have good run-time or precision characteristics. A better one is :meth:`_quo_rem_list`. @@ -1107,7 +1107,7 @@ def _quo_rem_list(self, right, secure): b = right.list() db = right.degree(secure=secure) inv = ~b[db] - q = [ ] + q = [] for i in range(da, db - 1, -1): c = inv * a[i] q.append(c) @@ -1119,20 +1119,20 @@ def _quo_rem_list(self, right, secure): parent = PolynomialRing(K, name=self.parent().variable_name()) return parent(q), parent(a[:db]) - #def gcd(self, right): - # raise NotImplementedError + # def gcd(self, right): + # raise NotImplementedError - #def lcm(self, right): - # raise NotImplementedError + # def lcm(self, right): + # raise NotImplementedError - #def discriminant(self): - # raise NotImplementedError + # def discriminant(self): + # raise NotImplementedError def disc(self): return self.discriminant() - #def resultant(self): - # raise NotImplementedError + # def resultant(self): + # raise NotImplementedError def newton_polygon(self): r""" @@ -1325,6 +1325,6 @@ def _extend_by_infinity(L, n): def make_padic_poly(parent, x, version): if version == 0: - return parent(x, construct = True) + return parent(x, construct=True) else: raise ValueError("unknown pickling version") diff --git a/src/sage/rings/polynomial/pbori/__init__.py b/src/sage/rings/polynomial/pbori/__init__.py index f168ecd4617..8fe962e2275 100644 --- a/src/sage/rings/polynomial/pbori/__init__.py +++ b/src/sage/rings/polynomial/pbori/__init__.py @@ -14,17 +14,18 @@ The PolyBoRi Team, 2007-2011 REFERENCES: + M. Brickenstein, A. Dreyer, G. Greuel, M. Wedler, O. Wienand, -New developments in the theory of Groebner bases and applications -to formal Verification, Preprint at http://arxiv.org/abs/0801.1177 +*New developments in the theory of Groebner bases and applications +to formal Verification*, Preprint at :arxiv:`0801.1177` M. Brickenstein, A. Dreyer, PolyBoRi: -A Groebner Basis Framework for Boolean Polynomials, +*A Groebner Basis Framework for Boolean Polynomials*, Reports of Fraunhofer ITWM, No. 122, Kaiserslautern, Germany, 2007. http://www.itwm.fraunhofer.de/zentral/download/berichte/bericht122.pdf M. Brickenstein, A. Dreyer, PolyBoRi: -A framework for Groebner basis computations with Boolean polynomials, +*A framework for Groebner basis computations with Boolean polynomials*, Electronic Proceedings of the MEGA 2007 - Effective Methods in Algebraic Geometry, Strobl, Austria, June 2007. http://www.ricam.oeaw.ac.at/mega2007/electronic/electronic.html """ diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 4bf9538f12f..feb7483f5a7 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -57,7 +57,6 @@ from sage.structure.factory import UniqueFactory from sage.rings.polynomial.infinite_polynomial_ring import GenDictWithBasering -from sage.all import sage_eval from sage.structure.richcmp import richcmp @@ -520,6 +519,7 @@ def _element_constructor_(self, x): # resort to sage_eval. # Interpretation in self has priority over interpretation in self.__ring try: + from sage.misc.sage_eval import sage_eval out = sage_eval(x, GenDictWithBasering(self,self.gens_dict())) if out.parent() is not self: return self(out) diff --git a/src/sage/rings/polynomial/polynomial_ring.py b/src/sage/rings/polynomial/polynomial_ring.py index f88d12201da..34f25975963 100644 --- a/src/sage/rings/polynomial/polynomial_ring.py +++ b/src/sage/rings/polynomial/polynomial_ring.py @@ -1321,7 +1321,7 @@ def random_element(self, degree=(-1,2), *args, **kwds): INPUT: - - ``degree`` - optional integer for fixing the degree or + - ``degree`` - optional integer for fixing the degree or a tuple of minimum and maximum degrees. By default set to ``(-1,2)``. diff --git a/src/sage/rings/polynomial/polynomial_template.pxi b/src/sage/rings/polynomial/polynomial_template.pxi index 959b5b38c8e..78a98122051 100644 --- a/src/sage/rings/polynomial/polynomial_template.pxi +++ b/src/sage/rings/polynomial/polynomial_template.pxi @@ -597,9 +597,10 @@ cdef class Polynomial_template(Polynomial): elif e < 0: recip = 1 # delay because powering frac field elements is slow e = -e + if not self: - if e == 0: - raise ArithmeticError("0^0 is undefined.") + return (self)._parent(int(not e)) + cdef type T = type(self) cdef Polynomial_template r = T.__new__(T) diff --git a/src/sage/rings/polynomial/real_roots.pyx b/src/sage/rings/polynomial/real_roots.pyx index 870588a3923..05196dead27 100644 --- a/src/sage/rings/polynomial/real_roots.pyx +++ b/src/sage/rings/polynomial/real_roots.pyx @@ -2109,14 +2109,14 @@ def bernstein_up(d1, d2, s=None): MS = MatrixSpace(QQ, s, d1+1, sparse=False) m = MS() scale = factorial(d2)/factorial(d2-d1) - for b in range(0, d1+1): + for b in range(d1 + 1): scale2 = scale / binomial(d1, b) if (d1 - b) & 1 == 1: scale2 = -scale2 scale2 = ~scale2 - for a in range(0, s): + for a in range(s): ra = ZZ(subsample_vec(a, s, d2 + 1)) - m[a, b] = prod([ra-i for i in range(0, b)]) * prod([ra-i for i in range(d2-d1+b+1, d2+1)]) * scale2 + m[a, b] = prod([ra-i for i in range(b)]) * prod([ra-i for i in range(d2-d1+b+1, d2+1)]) * scale2 return m @@ -4369,7 +4369,7 @@ def to_bernstein(p, low=0, high=1, degree=None): raise ValueError('Bernstein degree must be at least polynomial degree') vs = ZZ ** (degree + 1) c = vs(0) - for i in range(0, p.degree() + 1): + for i in range(p.degree() + 1): c[i] = p[i] scale = ZZ(1) if low == 0: @@ -4385,7 +4385,8 @@ def to_bernstein(p, low=0, high=1, degree=None): reverse_intvec(c) taylor_shift1_intvec(c) reverse_intvec(c) - return ([c[k] / binomial(degree, k) for k in range(0, degree+1)], scale) + return ([c[k] / binomial(degree, k) for k in range(degree + 1)], scale) + def to_bernstein_warp(p): """ @@ -4399,14 +4400,12 @@ def to_bernstein_warp(p): sage: to_bernstein_warp(1 + x + x^2 + x^3 + x^4 + x^5) [1, 1/5, 1/10, 1/10, 1/5, 1] """ - c = p.list() - for i in range(len(c)): c[i] = c[i] / binomial(len(c) - 1, i) - return c + def bernstein_expand(Vector_integer_dense c, int d2): """ Given an integer vector representing a Bernstein polynomial p, and diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx index bb7fd4275cd..220c9b87c1d 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx @@ -1091,17 +1091,17 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): """ if self.is_zero(): raise ValueError("factorization of 0 not defined") + def factorizations_rec(P): if P.is_irreducible(): - yield [ (P,1) ] + yield [(P, 1)] else: for div in P._irreducible_divisors(True): Q = P // div # Here, we should update Q._norm, Q._norm_factor for factors in factorizations_rec(Q): - factors.append((div,1)) + factors.append((div, 1)) yield factors unit = self.leading_coefficient() - for factors in factorizations_rec(~unit*self): + for factors in factorizations_rec(~unit * self): yield Factorization(factors, sort=False, unit=unit) - diff --git a/src/sage/rings/puiseux_series_ring_element.pyx b/src/sage/rings/puiseux_series_ring_element.pyx index d5a23016e53..aff90ee1f89 100644 --- a/src/sage/rings/puiseux_series_ring_element.pyx +++ b/src/sage/rings/puiseux_series_ring_element.pyx @@ -272,8 +272,10 @@ cdef class PuiseuxSeries(AlgebraElement): exponents = [ZZ(exp) for exp in set(laurent.exponents() + [laurent.prec()])] # sort exponents such that the largest will be replaced first - exp_pos = [exp for exp in exponents if exp >= 0]; exp_pos.sort(reverse=True) - exp_neg = [exp for exp in exponents if exp < 0]; exp_neg.sort() + exp_pos = [exp for exp in exponents if exp >= 0] + exp_pos.sort(reverse=True) + exp_neg = [exp for exp in exponents if exp < 0] + exp_neg.sort() exponents = exp_neg + exp_pos # replacing exponents diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 1f01ff8ac55..9eada6a2bc0 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1943,12 +1943,12 @@ cdef class RealIntervalFieldElement(RingElement): cdef long digits digits = strlen(lower_s) - if lower_s[0] == '-': + if lower_s[0] == b'-': digits -= 1 lower_expo -= digits digits = strlen(upper_s) - if upper_s[0] == '-': + if upper_s[0] == b'-': digits -= 1 upper_expo -= digits @@ -2117,7 +2117,7 @@ cdef class RealIntervalFieldElement(RingElement): raise MemoryError("Unable to allocate memory for the mantissa of an interval") mpz_get_str(tmp_cstr, base, lower_mpz) digits = strlen(tmp_cstr) - if tmp_cstr[0] == '-': + if tmp_cstr[0] == b'-': digits -= 1 mant_string = bytes_to_str(tmp_cstr+1) sign_string = bytes_to_str(b'-') diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index e9c94e4eba2..3ea8c1dee1f 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -2092,12 +2092,12 @@ cdef class RealNumber(sage.structure.element.RingElement): if s is NULL: raise RuntimeError("unable to convert an mpfr number to a string") # t contains just digits (no sign, decimal point or exponent) - if s[0] == '-': + t = char_to_str(s) + if t[0] == '-': sgn = "-" t = char_to_str(s + 1) else: sgn = "" - t = char_to_str(s) mpfr_free_str(s) if skip_zeroes: diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index 0edd33209d3..2b649359ad4 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -643,6 +643,7 @@ cdef class RingExtension_generic(CommutativeAlgebra): method = getattr(self._backend, name) if not callable(method): raise AttributeError(AttributeErrorMessage(self, name)) + def wrapper(*args, **kwargs): output = method(*to_backend(args), **to_backend(kwargs)) return from_backend(output, self) diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 9970e2b5ca3..04d0f1033a9 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -122,6 +122,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): method = getattr(self._backend, name) if not callable(method): raise AttributeError(AttributeErrorMessage(self, name)) + def wrapper(*args, **kwargs): output = method(*to_backend(args), **to_backend(kwargs)) return from_backend(output, self._parent) diff --git a/src/sage/rings/sum_of_squares.pyx b/src/sage/rings/sum_of_squares.pyx index ccf8657df79..a1d3edcedef 100644 --- a/src/sage/rings/sum_of_squares.pyx +++ b/src/sage/rings/sum_of_squares.pyx @@ -66,7 +66,8 @@ cdef int two_squares_c(uint_fast32_t n, uint_fast32_t res[2]): # j = (j+nn/j)/2 jj = j*j if jj == nn: - res[0] = i<x)[0]: + if exists(rec, lambda x: r > x)[0]: rec.remove(r) self._min_recurrents = rec @@ -1669,7 +1668,6 @@ def tutte_polynomial(self): else: raise UserWarning("The underlying graph must be undirected.") - def _set_avalanche_polynomial(self): """ Compute the avalanche polynomial. See ``self.avalanche_polynomial`` for details. @@ -1682,7 +1680,7 @@ def _set_avalanche_polynomial(self): True """ n = self.num_verts() - 1 - R = PolynomialRing(QQ,"x",n) + R = PolynomialRing(QQ, "x", n) A = R(0) V = [] for i in range(n): @@ -1692,7 +1690,7 @@ def _set_avalanche_polynomial(self): for r in self.recurrents(): for i in range(n): e = tuple((r + V[i]).stabilize(True)[1].values()) - A += R({e:1}) + A += R({e: 1}) self._avalanche_polynomial = A def avalanche_polynomial(self, multivariable=True): @@ -1731,11 +1729,9 @@ def avalanche_polynomial(self, multivariable=True): """ if multivariable: return deepcopy(self._avalanche_polynomial) - else: - R = self._avalanche_polynomial.parent() - X = R.gens() - return self._avalanche_polynomial.subs({X[i]:X[0] for i in range(1,self.num_verts()-1)}) - + X = self._avalanche_polynomial.parent().gens() + return self._avalanche_polynomial.subs({X[i]: X[0] + for i in range(1, self.num_verts() - 1)}) def nonspecial_divisors(self, verbose=True): r""" @@ -1810,9 +1806,8 @@ def canonical_divisor(self): The underlying graph must be undirected. """ if self.is_undirected(): - return SandpileDivisor(self,[self.laplacian()[i][i] - 2 for i in range(self.num_verts())]) - else: - raise UserWarning("Only for undirected graphs.") + return SandpileDivisor(self, [self.laplacian()[i][i] - 2 for i in range(self.num_verts())]) + raise UserWarning("Only for undirected graphs.") def _set_invariant_factors(self): r""" @@ -1863,11 +1858,11 @@ def _set_hilbert_function(self): """ v = [i.deg() for i in self._superstables] self._postulation = max(v) - self._h_vector = [v.count(i) for i in range(self._postulation+1)] + self._h_vector = [v.count(i) for i in range(self._postulation + 1)] self._hilbert_function = [1] for i in range(self._postulation): self._hilbert_function.append(self._hilbert_function[i] - +self._h_vector[i+1]) + + self._h_vector[i + 1]) def h_vector(self): r""" @@ -1879,7 +1874,6 @@ def h_vector(self): list of nonnegative integers - EXAMPLES:: sage: s = sandpiles.Grid(2,2) @@ -1986,21 +1980,18 @@ def reorder_vertices(self): sage: T.dict() {0: {1: 1}, 1: {0: 1, 2: 1}, 2: {0: 1}} """ - - # first order the vertices according to their distance from the sink - verts = sorted(self.vertices(), - key=lambda v: self.distance(v, self._sink), reverse=True) - perm = {} - for i in range(len(verts)): - perm[verts[i]]=i + # first order the vertices according to their distance to the sink + distance_to_sink = self.reverse().shortest_path_lengths(self._sink) + verts = sorted(self, key=lambda v: distance_to_sink[v], reverse=True) + perm = {v: i for i, v in enumerate(verts)} old = self.dict() new = {} for i in old: entry = {} for j in old[i]: - entry[perm[j]]=old[i][j] + entry[perm[j]] = old[i][j] new[perm[i]] = entry - return Sandpile(new,len(verts)-1) + return Sandpile(new, len(verts) - 1) def _set_jacobian_representatives(self): r""" @@ -2018,26 +2009,23 @@ def _set_jacobian_representatives(self): else: ker = self.laplacian().left_kernel().basis() tau = abs(ker[self._sink_ind]) - if tau==1: - easy = True - else: - easy = False + easy = bool(tau == 1) if easy: result = [] for r in self.superstables(): - D = {v:r[v] for v in self._nonsink_vertices} + D = {v: r[v] for v in self._nonsink_vertices} D[self._sink] = - r.deg() result.append(SandpileDivisor(self, D)) self._jacobian_representatives = result else: result = [] sr = self.superstables() - order = self.group_order()/tau - while len(result) ' + lin_sys_log) # process the results - zhom_file = open(lin_sys_zhom,'r') + zhom_file = open(lin_sys_zhom, 'r') except IOError: print(""" ********************************** @@ -5182,22 +5167,21 @@ def _set_linear_system(self): ********************************** """) return - ## first, the cone generators (the homogeneous points) + # first, the cone generators (the homogeneous points) a = zhom_file.read() zhom_file.close() a = a.split('\n') # a starts with two numbers. We are interested in the first one num_homog = int(a[0].split()[0]) - homog = [map(int,i.split()) for i in a[1:-1]] - ## second, the inhomogeneous points - zinhom_file = open(lin_sys_zinhom,'r') - b = zinhom_file.read() - zinhom_file.close() + homog = [map(int, i.split()) for i in a[1:-1]] + # second, the inhomogeneous points + with open(lin_sys_zinhom, 'r') as zinhom_file: + b = zinhom_file.read() b = b.split('\n') num_inhomog = int(b[0].split()[0]) - inhomog = [map(int,i.split()) for i in b[1:-1]] - self._linear_system = {'num_homog':num_homog, 'homog':homog, - 'num_inhomog':num_inhomog, 'inhomog':inhomog} + inhomog = [map(int, i.split()) for i in b[1:-1]] + self._linear_system = {'num_homog': num_homog, 'homog': homog, + 'num_inhomog': num_inhomog, 'inhomog': inhomog} def _set_polytope(self): r""" @@ -5376,9 +5360,9 @@ def effective_div(self, verbose=True, with_firing_vectors=False): return list(zip(eff, fv)) elif verbose: # verbose without firing vectors return eff - elif with_firing_vectors: # not verbose but with firing vectors + elif with_firing_vectors: # not verbose but with firing vectors return list(zip([i.values() for i in eff], fv)) - else: # not verbose, no firing vectors + else: # not verbose, no firing vectors return [i.values() for i in eff] def _set_rank(self, set_witness=False): @@ -5414,14 +5398,15 @@ def _set_rank(self, set_witness=False): """ S = self.sandpile() # If undirected and D has high degree, use Riemann-Roch. - if S.is_undirected() and not set_witness: # We've been careful about loops - g = sum(S.laplacian().diagonal())/2 - S.num_verts() + 1 - if self.deg() > 2*g - 2: + if S.is_undirected() and not set_witness: + # We've been careful about loops + g = sum(S.laplacian().diagonal()) / 2 - S.num_verts() + 1 + if self.deg() > 2 * g - 2: self._rank = self.deg() - g return # return early # If S is a complete sandpile graph and a witness is not needed, use # the Cori-Le Borgne algorithm - if S.name()=='Complete sandpile graph' and not set_witness: + if S.name() == 'Complete sandpile graph' and not set_witness: # Cori-LeBorgne algorithm n = S.num_verts() rk = -1 @@ -5446,9 +5431,9 @@ def _set_rank(self, set_witness=False): else: rk = -1 while True: - for e in integer_vectors_nk_fast_iter(rk+1,S.num_verts()): + for e in integer_vectors_nk_fast_iter(rk + 1, S.num_verts()): E = SandpileDivisor(S, e) - if (self - E).effective_div() == []: + if not (self - E).effective_div(): self._rank = rk self._rank_witness = E return @@ -5534,7 +5519,7 @@ def _set_r_of_D(self, verbose=False): eff = self.effective_div() n = self._sandpile.num_verts() r = -1 - if eff == []: + if not eff: self._r_of_D = (r, self) return else: @@ -5559,7 +5544,7 @@ def _set_r_of_D(self, verbose=False): C = d - w C = SandpileDivisor(self._sandpile,list(C)) eff = C.effective_div() - if eff == []: + if not eff: self._r_of_D = (r, SandpileDivisor(self._sandpile,list(w))) return level = new_level @@ -5643,10 +5628,10 @@ def weierstrass_gap_seq(self, v='sink', weight=True): `\mathrm{rank}(D), \mathrm{rank}(D - v), \mathrm{rank}(D - 2v), \dots` """ L = self.weierstrass_rank_seq(v) - gaps = [i for i in range(1,len(L)) if L[i]!=L[i-1]] + gaps = [i for i in range(1, len(L)) if L[i] != L[i - 1]] gaps = tuple(gaps) if weight: - return gaps, sum(gaps)-binomial(len(gaps)+1,2) + return gaps, sum(gaps) - binomial(len(gaps) + 1, 2) else: return gaps @@ -5811,7 +5796,7 @@ def _set_Dcomplex(self): simp.append(supp_E) result = [] simp.reverse() - while simp != []: + while simp: supp = simp.pop() test = True for s in simp: @@ -5955,7 +5940,7 @@ def _set_life(self): oldD = deepcopy(self) result = [oldD] while True: - if oldD.unstable()==[]: + if oldD.unstable() == []: self._life = [] return newD = oldD.fire_unstable() @@ -5989,10 +5974,7 @@ def is_alive(self, cycle=False): sage: D.is_alive(True) [{0: 4, 1: 3, 2: 3, 3: 2}, {0: 3, 1: 2, 2: 2, 3: 5}, {0: 1, 1: 4, 2: 4, 3: 3}] """ - if cycle: - return self._life - else: - return self._life != [] + return self._life if cycle else bool(self._life) def _set_stabilize(self): r""" @@ -6069,9 +6051,7 @@ def show(self, heights=True, directed=None, **kwds): T = Graph(self.sandpile()) if heights: - a = {} - for i in T.vertices(): - a[i] = str(i) + ":" + str(T[i]) + a = {i: str(i) + ":" + str(T[i]) for i in T} T.relabel(a) T.show(**kwds) @@ -6079,8 +6059,9 @@ def show(self, heights=True, directed=None, **kwds): # See note about this after the definition of SandpileConfig pretty.for_type(SandpileDivisor, pretty.for_type(dict, None)) + ####################################### -######### Some test graphs ############ +# Some test graphs # ####################################### def sandlib(selector=None): @@ -6114,54 +6095,37 @@ def sandlib(selector=None): """ # The convention is for the sink to be zero. sandpiles = { - 'generic':{ - 'description':'generic digraph with 6 vertices', - 'graph':{0:{},1:{0:1,3:1,4:1},2:{0:1,3:1,5:1},3:{2:1,5:1},4:{1:1,3:1},5:{2:1,3:1}} - }, - 'kite':{ - 'description':'generic undirected graphs with 5 vertices', - 'graph':{0:{}, 1:{0:1,2:1,3:1}, 2:{1:1,3:1,4:1}, 3:{1:1,2:1,4:1}, - 4:{2:1,3:1}} - }, - 'riemann-roch1':{ - 'description':'directed graph with postulation 9 and 3 maximal weight superstables', - 'graph':{0: {1: 3, 3: 1}, - 1: {0: 2, 2: 2, 3: 2}, - 2: {0: 1, 1: 1}, - 3: {0: 3, 1: 1, 2: 1} - } - }, - 'riemann-roch2':{ - 'description':'directed graph with a superstable not majorized by a maximal superstable', - 'graph':{ - 0: {}, - 1: {0: 1, 2: 1}, - 2: {0: 1, 3: 1}, - 3: {0: 1, 1: 1, 2: 1} - } - }, - 'gor':{ - 'description':'Gorenstein but not a complete intersection', - 'graph':{ - 0: {}, - 1: {0:1, 2: 1, 3: 4}, - 2: {3: 5}, - 3: {1: 1, 2: 1} - } - }, - 'ci1':{ - 'description':'complete intersection, non-DAG but equivalent to a DAG', - 'graph':{0:{}, 1: {2: 2}, 2: {0: 4, 1: 1}} - }, - 'genus2':{ - 'description':'Undirected graph of genus 2', - 'graph':{ - 0:[1,2], - 1:[0,2,3], - 2:[0,1,3], - 3:[1,2] - } - }, + 'generic': {'description': 'generic digraph with 6 vertices', + 'graph': {0: {}, 1: {0: 1, 3: 1, 4: 1}, + 2: {0: 1, 3: 1, 5: 1}, + 3: {2: 1, 5: 1}, 4: {1: 1, 3: 1}, + 5: {2: 1, 3: 1}}}, + 'kite': {'description': 'generic undirected graphs with 5 vertices', + 'graph': {0: {}, 1: {0: 1, 2: 1, 3: 1}, + 2: {1: 1, 3: 1, 4: 1}, 3: {1: 1, 2: 1, 4: 1}, + 4: {2: 1, 3: 1}}}, + 'riemann-roch1': {'description': 'directed graph with postulation 9 and 3 maximal weight superstables', + 'graph': {0: {1: 3, 3: 1}, + 1: {0: 2, 2: 2, 3: 2}, + 2: {0: 1, 1: 1}, + 3: {0: 3, 1: 1, 2: 1}}}, + 'riemann-roch2': {'description': 'directed graph with a superstable not majorized by a maximal superstable', + 'graph': {0: {}, + 1: {0: 1, 2: 1}, + 2: {0: 1, 3: 1}, + 3: {0: 1, 1: 1, 2: 1}}}, + 'gor': {'description': 'Gorenstein but not a complete intersection', + 'graph': {0: {}, + 1: {0: 1, 2: 1, 3: 4}, + 2: {3: 5}, + 3: {1: 1, 2: 1}}}, + 'ci1': {'description': 'complete intersection, non-DAG but equivalent to a DAG', + 'graph': {0: {}, 1: {2: 2}, 2: {0: 4, 1: 1}}}, + 'genus2': {'description': 'Undirected graph of genus 2', + 'graph': {0: [1, 2], + 1: [0, 2, 3], + 2: [0, 1, 3], + 3: [1, 2]}}, } if selector is None: print('') @@ -6174,11 +6138,11 @@ def sandlib(selector=None): else: return Sandpile(sandpiles[selector]['graph'], 0) + ################################################# -########## Some useful functions ################ +# Some useful functions # ################################################# - def triangle_sandpile(n): r""" A triangular sandpile. Each nonsink vertex has out-degree six. The @@ -6283,6 +6247,7 @@ def aztec_sandpile(n): aztec_sandpile[(0, 0)][vert] = out_degree return aztec_sandpile + def glue_graphs(g, h, glue_g, glue_h): r""" Glue two graphs together. @@ -6405,6 +6370,7 @@ def firing_graph(S, eff): g.add_edge((i,eff.index(new_div))) return g + def parallel_firing_graph(S, eff): r""" Creates a digraph with divisors as vertices and edges between two divisors @@ -6442,6 +6408,7 @@ def parallel_firing_graph(S, eff): g.add_edge((i,eff.index(new_div))) return g + def admissible_partitions(S, k): r""" The partitions of the vertices of `S` into `k` parts, each of which is @@ -6534,18 +6501,19 @@ def partition_sandpile(S, p): ------------------------------ total: 1 6 8 3 """ - from sage.combinat.combination import Combinations + from itertools import combinations g = Graph() - g.add_vertices([tuple(i) for i in p]) - for u,v in Combinations(g.vertices(), 2): + g.add_vertices(tuple(i) for i in p) + for u, v in combinations(g, 2): for i in u: for j in v: - if (i,j,1) in S.edges(): + if (i, j, 1) in S.edges(): g.add_edge((u, v)) break for i in g.vertices(): if S.sink() in i: - return Sandpile(g,i) + return Sandpile(g, i) + def min_cycles(G, v): r""" @@ -6572,6 +6540,7 @@ def min_cycles(G, v): sp = G.shortest_paths(v) return [sp[i] for i in pr if i in sp] + def wilmes_algorithm(M): r""" Computes an integer matrix `L` with the same integer row span as `M` and diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 77768439227..8b74de31935 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2768,6 +2768,39 @@ def x_rational_map(self): self.__initialize_rational_maps() return self.__X_coord_rational_map + def scaling_factor(self): + r""" + Return the Weierstrass scaling factor associated to this + elliptic-curve isogeny. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this isogeny and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. + + EXAMPLES:: + + sage: E = EllipticCurve(GF(257^2), [0,1]) + sage: phi = E.isogeny(E.lift_x(240)) + sage: phi.degree() + 43 + sage: phi.scaling_factor() + 1 + sage: phi.dual().scaling_factor() + 43 + + ALGORITHM: The "inner" isogeny is normalized by construction, + so we only need to account for the scaling factors of a pre- + and post-isomorphism. + """ + sc = Integer(1) + if self.__pre_isomorphism is not None: + sc *= self.__pre_isomorphism.scaling_factor() + if self.__post_isomorphism is not None: + sc *= self.__post_isomorphism.scaling_factor() + return sc + def kernel_polynomial(self): r""" Return the kernel polynomial of this isogeny. @@ -3320,7 +3353,7 @@ def dual(self): # trac 7096 # this should take care of the case when the isogeny is not normalized. - u = self.formal(prec=2)[1] + u = self.scaling_factor() isom = WeierstrassIsomorphism(E2pr, (u/F(d), 0, 0, 0)) E2 = isom.codomain() @@ -3343,7 +3376,7 @@ def dual(self): # the composition has the degree as a leading coefficient in # the formal expansion. - phihat_sc = phi_hat.formal(prec=2)[1] + phihat_sc = phi_hat.scaling_factor() sc = u * phihat_sc/F(d) diff --git a/src/sage/schemes/elliptic_curves/hom.py b/src/sage/schemes/elliptic_curves/hom.py index 8133410e365..4ab0210fc61 100644 --- a/src/sage/schemes/elliptic_curves/hom.py +++ b/src/sage/schemes/elliptic_curves/hom.py @@ -266,6 +266,36 @@ def x_rational_map(self): raise NotImplementedError('children must implement') + def scaling_factor(self): + r""" + Return the Weierstrass scaling factor associated to this + elliptic-curve morphism. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this morphism and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. + + Implemented by child classes. For examples, see: + + - :meth:`EllipticCurveIsogeny.scaling_factor` + - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.scaling_factor` + - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.scaling_factor` + + TESTS:: + + sage: from sage.schemes.elliptic_curves.hom import EllipticCurveHom + sage: EllipticCurveHom.scaling_factor(None) + Traceback (most recent call last): + ... + NotImplementedError: ... + """ + #TODO: could have a default implementation that simply + # returns .formal()[1], but it seems safer to fail + # visibly to make sure we would notice regressions + raise NotImplementedError('children must implement') + def formal(self, prec=20): r""" Return the formal isogeny associated to this elliptic-curve @@ -326,11 +356,6 @@ def is_normalized(self): `\omega_2` are the invariant differentials on `E_1` and `E_2` corresponding to the given equation. - ALGORITHM: - - The method checks if the leading term of the formal series - associated to this isogeny equals `1`. - EXAMPLES:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism @@ -393,9 +418,10 @@ def is_normalized(self): sage: phi = isom * phi sage: phi.is_normalized() True + + ALGORITHM: We check if :meth:`scaling_factor` returns `1`. """ - phi_formal = self.formal(prec=5) - return phi_formal[1] == 1 + return self.scaling_factor() == 1 def is_separable(self): diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 2098c7d8ee1..147d1b3eb5c 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -765,6 +765,36 @@ def formal(self, prec=20): res = res(phi.formal(prec=prec)) return res + def scaling_factor(self): + r""" + Return the Weierstrass scaling factor associated to this + composite morphism. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this morphism and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. + + EXAMPLES:: + + sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite + sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) + sage: P = E.lift_x(7321) + sage: phi = EllipticCurveHom_composite(E, P) + sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi + sage: phi.formal() + 7*t + 65474*t^2 + 511*t^3 + 61316*t^4 + 20548*t^5 + 45511*t^6 + 37285*t^7 + 48414*t^8 + 9022*t^9 + 24025*t^10 + 35986*t^11 + 55397*t^12 + 25199*t^13 + 18744*t^14 + 46142*t^15 + 9078*t^16 + 18030*t^17 + 47599*t^18 + 12158*t^19 + 50630*t^20 + 56449*t^21 + 43320*t^22 + O(t^23) + sage: phi.scaling_factor() + 7 + + ALGORITHM: The scaling factor is multiplicative under + composition, so we return the product of the individual + scaling factors associated to each factor. + """ + return prod(phi.scaling_factor() for phi in self._phis) + def is_injective(self): """ Determine whether this composite morphism has trivial kernel. diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index bbc86766663..f9fbcb0dd76 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -898,3 +898,26 @@ def __neg__(self): w = baseWI(-1, 0, -a1, -a3) urst = baseWI.__mul__(self, w).tuple() return WeierstrassIsomorphism(self._domain, urst, self._codomain) + + def scaling_factor(self): + r""" + Return the Weierstrass scaling factor associated to this + Weierstrass isomorphism. + + The scaling factor is the constant `u` (in the base field) + such that `\varphi^* \omega_2 = u \omega_1`, where + `\varphi: E_1\to E_2` is this isomorphism and `\omega_i` are + the standard Weierstrass differentials on `E_i` defined by + `\mathrm dx/(2y+a_1x+a_3)`. + + EXAMPLES:: + + sage: E = EllipticCurve(QQbar, [0,1]) + sage: all(f.scaling_factor() == f.formal()[1] for f in E.automorphisms()) + True + + ALGORITHM: The scaling factor equals the `u` component of + the tuple `(u,r,s,t)` defining the isomorphism. + """ + return self.u + diff --git a/src/sage/sets/finite_set_map_cy.pyx b/src/sage/sets/finite_set_map_cy.pyx index ab23b221391..a06dc0a2bd9 100644 --- a/src/sage/sets/finite_set_map_cy.pyx +++ b/src/sage/sets/finite_set_map_cy.pyx @@ -463,7 +463,8 @@ cdef class FiniteSetMap_Set(FiniteSetMap_MN): for i, el in enumerate(parent.domain().list()): self._setitem(i, parent._rank_codomain(fun(el))) self.set_immutable() - if check: self.check() + if check: + self.check() from_list = classmethod(FiniteSetMap_Set_from_list) from_dict = classmethod(FiniteSetMap_Set_from_dict) diff --git a/src/sage/sets/recursively_enumerated_set.pyx b/src/sage/sets/recursively_enumerated_set.pyx index d2193c4ada7..073e7c6e95e 100644 --- a/src/sage/sets/recursively_enumerated_set.pyx +++ b/src/sage/sets/recursively_enumerated_set.pyx @@ -273,7 +273,7 @@ convention is that the generated elements are the ``s := f(n)``, except when ....: st = set(st) # make a copy ....: if st: ....: el = st.pop() - ....: for i in range(0, len(lst)+1): + ....: for i in range(len(lst)+1): ....: yield (lst[0:i]+[el]+lst[i:], st) sage: list(children(([1,2], {3,7,9}))) [([9, 1, 2], {3, 7}), ([1, 9, 2], {3, 7}), ([1, 2, 9], {3, 7})] diff --git a/src/sage/stats/distributions/discrete_gaussian_integer.pyx b/src/sage/stats/distributions/discrete_gaussian_integer.pyx index 328c34756d8..87fbe6ca5cd 100644 --- a/src/sage/stats/distributions/discrete_gaussian_integer.pyx +++ b/src/sage/stats/distributions/discrete_gaussian_integer.pyx @@ -219,16 +219,16 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+online") - Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+table") - Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+logtable") - Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 Note that ``"sigma2+logtable"`` adjusts `σ`:: sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="sigma2+logtable") - Discrete Gaussian sampler over the Integers with sigma = 3.397287 and c = 0 + Discrete Gaussian sampler over the Integers with sigma = 3.397287 and c = 0.000000 TESTS: @@ -491,6 +491,6 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler sage: repr(DiscreteGaussianDistributionIntegerSampler(3.0, 2)) - 'Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 2' + 'Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 2.000000' """ - return "Discrete Gaussian sampler over the Integers with sigma = %f and c = %d"%(self.sigma, self.c) + return f"Discrete Gaussian sampler over the Integers with sigma = {self.sigma:.6f} and c = {self.c:.6f}" diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx index 7045ed8b09d..bd084040825 100644 --- a/src/sage/stats/time_series.pyx +++ b/src/sage/stats/time_series.pyx @@ -1885,7 +1885,8 @@ cdef class TimeSeries: else: # Return everything between min and max j = 0 - mn = min; mx = max + mn = min + mx = max for i from 0 <= i < self._length: x = self._values[i] if x >= mn and x <= mx: diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 884e14b5ed7..2ee2548cf59 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -1142,7 +1142,7 @@ cdef class CoercionModel: TESTS:: - sage: class Foo(object): + sage: class Foo(): ....: def __rmul__(self, left): ....: return 'hello' sage: H = Foo() @@ -1155,7 +1155,7 @@ cdef class CoercionModel: ... TypeError: unsupported operand parent(s) for *: '' and 'Integer Ring' - sage: class Nonsense(object): + sage: class Nonsense(): ....: def __init__(self, s): ....: self.s = s ....: def __repr__(self): @@ -1945,7 +1945,7 @@ cdef class CoercionModel: We support non-Sage types with the usual Python convention:: - sage: class AlwaysEqual(object): + sage: class AlwaysEqual(): ....: def __eq__(self, other): ....: return True sage: x = AlwaysEqual() diff --git a/src/sage/structure/dynamic_class.py b/src/sage/structure/dynamic_class.py index 434c2968f8d..cf165745243 100644 --- a/src/sage/structure/dynamic_class.py +++ b/src/sage/structure/dynamic_class.py @@ -166,7 +166,7 @@ def dynamic_class(name, bases, cls=None, reduction=None, doccls=None, sage: from sage.misc.lazy_attribute import lazy_attribute sage: from sage.misc.cachefunc import cached_function sage: from sage.structure.dynamic_class import dynamic_class - sage: class Foo(object): + sage: class Foo(): ....: "The Foo class" ....: def __init__(self, x): ....: self._x = x diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index dfd6583b149..e302e6661b8 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -823,8 +823,8 @@ cdef class Element(SageObject): variables=[] # use "gen" instead of "gens" as a ParentWithGens is not # required to have the latter - for i in xrange(0,ngens): - gen=parent.gen(i) + for i in range(ngens): + gen = parent.gen(i) if str(gen) in kwds: variables.append(kwds[str(gen)]) elif in_dict and gen in in_dict: diff --git a/src/sage/structure/factory.pyx b/src/sage/structure/factory.pyx index 9a7f762646b..76fcc698bf7 100644 --- a/src/sage/structure/factory.pyx +++ b/src/sage/structure/factory.pyx @@ -590,7 +590,7 @@ def register_factory_unpickle(name, callable): sage: from sage.structure.factory import UniqueFactory, register_factory_unpickle sage: import __main__ - sage: class OldStuff(object): + sage: class OldStuff(): ....: def __init__(self, n, **extras): ....: self.n = n ....: def __repr__(self): @@ -661,7 +661,7 @@ def generic_factory_unpickle(factory, *args): sage: from sage.structure.factory import UniqueFactory sage: import __main__ - sage: class OldStuff(object): + sage: class OldStuff(): ....: def __init__(self, n, **extras): ....: self.n = n ....: def __repr__(self): diff --git a/src/sage/structure/global_options.py b/src/sage/structure/global_options.py index e2ee4834050..6a47ba55b1d 100644 --- a/src/sage/structure/global_options.py +++ b/src/sage/structure/global_options.py @@ -105,7 +105,7 @@ illustrated by an example:: sage: from sage.structure.global_options import GlobalOptions - sage: class Menu(object): + sage: class Menu(): ....: class options(GlobalOptions): ....: ''' ....: Fancy documentation @@ -393,7 +393,7 @@ class options(GlobalOptions): Check that the old call syntax still works:: - sage: class Menu(object): + sage: class Menu(): ....: options = GlobalOptions('menu', ....: doc='Fancy documentation\n'+'-'*19, end_doc='The END!', ....: entree=dict(default='soup', @@ -514,7 +514,7 @@ class options(GlobalOptions): from sage.misc.instancedoc import instancedoc -class Option(object): +class Option(): r""" An option. @@ -884,7 +884,7 @@ class GlobalOptions(metaclass=GlobalOptionsMeta): EXAMPLES:: sage: from sage.structure.global_options import GlobalOptions - sage: class Menu(object): + sage: class Menu(): ....: class options(GlobalOptions): ....: ''' ....: Fancy documentation @@ -1707,7 +1707,7 @@ def _reset(self, option=None): EXAMPLES:: sage: from sage.structure.global_options import GlobalOptions - sage: class Meal(object): + sage: class Meal(): ....: class options(GlobalOptions): ....: NAME = 'daily meal' ....: food = dict(default='bread', values=dict(bread='rye bread', salmon='a fish')) diff --git a/src/sage/structure/graphics_file.py b/src/sage/structure/graphics_file.py index d4adefba9e9..50c200804fe 100644 --- a/src/sage/structure/graphics_file.py +++ b/src/sage/structure/graphics_file.py @@ -16,7 +16,7 @@ deprecation(32988, 'the module sage.structure.graphics_file is deprecated') -class Mime(object): +class Mime(): TEXT = 'text/plain' HTML = 'text/html' LATEX = 'text/latex' diff --git a/src/sage/structure/indexed_generators.py b/src/sage/structure/indexed_generators.py index 2abac83fcea..da04658324f 100644 --- a/src/sage/structure/indexed_generators.py +++ b/src/sage/structure/indexed_generators.py @@ -14,7 +14,7 @@ from sage.structure.category_object import normalize_names -class IndexedGenerators(object): +class IndexedGenerators(): r"""nodetex Abstract base class for parents whose elements consist of generators indexed by an arbitrary set. diff --git a/src/sage/structure/mutability.pyx b/src/sage/structure/mutability.pyx index 3d54c790263..b35d26a3ccb 100644 --- a/src/sage/structure/mutability.pyx +++ b/src/sage/structure/mutability.pyx @@ -257,7 +257,7 @@ def require_mutable(f): EXAMPLES:: sage: from sage.structure.mutability import require_mutable, require_immutable - sage: class A(object): + sage: class A(): ....: def __init__(self, val): ....: self._m = val ....: @require_mutable @@ -309,7 +309,7 @@ def require_immutable(f): EXAMPLES:: sage: from sage.structure.mutability import require_mutable, require_immutable - sage: class A(object): + sage: class A(): ....: def __init__(self, val): ....: self._m = val ....: @require_mutable diff --git a/src/sage/structure/nonexact.py b/src/sage/structure/nonexact.py index 913f42c9b19..4157295be90 100644 --- a/src/sage/structure/nonexact.py +++ b/src/sage/structure/nonexact.py @@ -1,8 +1,8 @@ r""" Precision management for non-exact objects -Manage the default precision for non-exact objects such as power series rings or -laurent series rings. +Manage the default precision for non-exact objects such as power series rings +or Laurent series rings. EXAMPLES:: @@ -25,12 +25,11 @@ .. NOTE:: Subclasses of :class:`Nonexact` which require to change the default - precision should implement a method `set_default_prec`. - + precision should implement a method ``set_default_prec``. """ - from sage.rings.integer import Integer + class Nonexact: r""" A non-exact object with default precision. @@ -39,7 +38,6 @@ class Nonexact: - ``prec`` -- a non-negative integer representing the default precision of ``self`` (default: ``20``) - """ def __init__(self, prec=20): if prec < 0: @@ -61,30 +59,9 @@ def default_prec(self): sage: R. = PowerSeriesRing(QQ, default_prec=10) sage: R.default_prec() 10 - """ try: return self._default_prec except AttributeError: self._default_prec = 20 return self._default_prec - - def set_default_prec(self, prec): - r""" - Set the default precision for ``self`` - - .. WARNING:: - - This method is outdated. If a subclass of class:`Nonexact` requires - this method, please overload it instead. - - """ - # TODO: remove in Sage 9.4 - from sage.misc.superseded import deprecation - msg = "The method set_default_prec() is deprecated and will be removed " - msg += "in a future version of Sage. The default precision is set " - msg += "during construction." - deprecation(18416, msg) - self._default_prec = Integer(prec) - - diff --git a/src/sage/structure/proof/proof.py b/src/sage/structure/proof/proof.py index cef06ab460d..c667704db92 100644 --- a/src/sage/structure/proof/proof.py +++ b/src/sage/structure/proof/proof.py @@ -190,7 +190,7 @@ def get_flag(t = None, subsystem = None): return t -class WithProof(object): +class WithProof(): """ Use WithProof to temporarily set the value of one of the proof systems for a block of code, with a guarantee that it will be set diff --git a/src/sage/structure/richcmp.pyx b/src/sage/structure/richcmp.pyx index f4a52c3e87f..80dab931ba9 100644 --- a/src/sage/structure/richcmp.pyx +++ b/src/sage/structure/richcmp.pyx @@ -325,7 +325,7 @@ def richcmp_method(cls): sage: C("left") == C("right") # Calls __eq__ from class A left == right - sage: class Base(object): + sage: class Base(): ....: def __eq__(self, other): ....: return False sage: @richcmp_method @@ -343,7 +343,7 @@ def richcmp_method(cls): TypeError: None is not a class sage: @richcmp_method - ....: class X(object): + ....: class X(): ....: def __eq__(self, other): ....: pass ....: def __richcmp__(self, other, op): @@ -444,7 +444,7 @@ def richcmp_by_eq_and_lt(eq_attr, lt_attr): sage: from sage.structure.richcmp import richcmp_method, richcmp_by_eq_and_lt sage: @richcmp_method - ....: class C(object): + ....: class C(): ....: __richcmp__ = richcmp_by_eq_and_lt("_eq", "_lt") ....: def _eq(self, other): ....: return True @@ -455,7 +455,7 @@ def richcmp_by_eq_and_lt(eq_attr, lt_attr): True sage: a > b # Calls b._lt(a) True - sage: class X(object): pass + sage: class X(): pass sage: x = X() sage: a == x # Does not call a._eq(x) because x does not have _eq False diff --git a/src/sage/structure/test_factory.py b/src/sage/structure/test_factory.py index 77a2ac80641..b45996c5a80 100644 --- a/src/sage/structure/test_factory.py +++ b/src/sage/structure/test_factory.py @@ -20,7 +20,7 @@ from sage.structure.factory import UniqueFactory -class A(object): +class A(): # something we can weakref pass diff --git a/src/sage/structure/unique_representation.py b/src/sage/structure/unique_representation.py index 5d8d4ad758b..7d30c39d66c 100644 --- a/src/sage/structure/unique_representation.py +++ b/src/sage/structure/unique_representation.py @@ -179,7 +179,7 @@ class will by default also be used as keys for the cache:: sage: class WrongUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(WrongUsage,cls).__classcall__(cls, n^2) + ....: return super().__classcall__(cls, n^2) ....: def __init__(self, n): ....: self.n = n ....: def __repr__(self): @@ -205,7 +205,7 @@ class will by default also be used as keys for the cache:: sage: class BetterUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(BetterUsage, cls).__classcall__(cls, abs(n)) + ....: return super().__classcall__(cls, abs(n)) ....: def __init__(self, n): ....: self.n = n^2 ....: def __repr__(self): @@ -249,8 +249,8 @@ class will by default also be used as keys for the cache:: ....: @staticmethod ....: def __classcall__(cls, n, implementation=0): ....: if implementation: - ....: return super(C2, cls).__classcall__(cls, (n,)*implementation) - ....: return super(C2, cls).__classcall__(cls, n) + ....: return super().__classcall__(cls, (n,)*implementation) + ....: return super().__classcall__(cls, n) ....: def __init__(self, t): ....: self.t = t ....: def __repr__(self): @@ -326,7 +326,7 @@ class will by default also be used as keys for the cache:: An example:: - sage: class C(object): + sage: class C(): ....: def __init__(self, t): ....: self.t = t ....: def __repr__(self): @@ -640,7 +640,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): ....: @staticmethod ....: def __classcall__(cls, iterable): ....: t = tuple(iterable) - ....: return super(MyClass2, cls).__classcall__(cls, t) + ....: return super().__classcall__(cls, t) ....: ....: def __init__(self, value): ....: self.value = value @@ -667,7 +667,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): sage: class MyClass3(UniqueRepresentation): ....: @staticmethod ....: def __classcall__(cls, value = 3): - ....: return super(MyClass3, cls).__classcall__(cls, value) + ....: return super().__classcall__(cls, value) ....: ....: def __init__(self, value): ....: self.value = value @@ -716,7 +716,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): sage: class WrongUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(WrongUsage,cls).__classcall__(cls, n^2) + ....: return super().__classcall__(cls, n^2) ....: def __init__(self, n): ....: self.n = n ....: def __repr__(self): @@ -742,7 +742,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): sage: class BetterUsage(CachedRepresentation): ....: @staticmethod ....: def __classcall__(cls, n): - ....: return super(BetterUsage, cls).__classcall__(cls, abs(n)) + ....: return super().__classcall__(cls, abs(n)) ....: def __init__(self, n): ....: self.n = n^2 ....: def __repr__(self): @@ -883,7 +883,7 @@ class CachedRepresentation(metaclass=ClasscallMetaclass): older pickles can still be reasonably unpickled. Let us create a (new style) class, and pickle one of its instances:: - sage: class MyClass4(object): + sage: class MyClass4(): ....: def __init__(self, value): ....: self.value = value sage: import __main__; __main__.MyClass4 = MyClass4 # Fake MyClass4 being defined in a python module @@ -1028,7 +1028,7 @@ def _clear_cache_(cls): sage: class B(A): ....: @staticmethod ....: def __classcall__(cls, *args, **kwds): - ....: return super(B,cls).__classcall__(cls,*args,**kwds) + ....: return super().__classcall__(cls,*args,**kwds) sage: class C(B): pass sage: a = A(1) sage: b = B(2) @@ -1061,7 +1061,7 @@ def _clear_cache_(cls): ....: @staticmethod ....: def __classcall_private__(cls, *args, **kwds): ....: print("Private B") - ....: return super(B,cls).__classcall__(cls,*args,**kwds) + ....: return super().__classcall__(cls,*args,**kwds) sage: class C(B): pass sage: a = A(1) sage: b = B(2) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index eb50443ff29..5d4fba06ab2 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -14071,7 +14071,7 @@ cdef class hold_class: sage: SR(2)^5 32 """ - g_set_state('hold', True) + g_set_state(b'hold', True) def __exit__(self, *args): """ @@ -14084,7 +14084,7 @@ cdef class hold_class: sage: SR(2)^5 32 """ - g_set_state('hold', False) + g_set_state(b'hold', False) def start(self): """ diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index fccba3f12fb..1570b9c9b6a 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -165,7 +165,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False Test help:: sage: (out, err, ret) = test_executable(["sage", "-h"]) - sage: out.find("Optional arguments:") >= 0 + sage: out.find("evaluate cmd as sage") >= 0 True sage: err '' @@ -173,7 +173,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False 0 sage: (out, err, ret) = test_executable(["sage", "--help"]) - sage: out.find("Optional arguments:") >= 0 + sage: out.find("evaluate cmd as sage") >= 0 True sage: err '' diff --git a/src/sage/topology/simplicial_set_constructions.py b/src/sage/topology/simplicial_set_constructions.py index 5b192d019bc..5a737558c9c 100644 --- a/src/sage/topology/simplicial_set_constructions.py +++ b/src/sage/topology/simplicial_set_constructions.py @@ -120,7 +120,7 @@ def __classcall__(self, data, ambient=None): L.append((x, None)) else: L.append((x, tuple(data[x]))) - return super(SubSimplicialSet, self).__classcall__(self, tuple(L), ambient) + return super().__classcall__(self, tuple(L), ambient) def __init__(self, data, ambient=None): r""" @@ -239,8 +239,8 @@ def __classcall_private__(self, maps=None): True """ if maps: - return super(PullbackOfSimplicialSets, self).__classcall__(self, tuple(maps)) - return super(PullbackOfSimplicialSets, self).__classcall__(self) + return super().__classcall__(self, tuple(maps)) + return super().__classcall__(self) def __init__(self, maps=None): r""" @@ -423,8 +423,8 @@ def __classcall_private__(self, maps=None): True """ if maps: - return super(PullbackOfSimplicialSets_finite, self).__classcall__(self, tuple(maps)) - return super(PullbackOfSimplicialSets_finite, self).__classcall__(self) + return super().__classcall__(self, tuple(maps)) + return super().__classcall__(self) def __init__(self, maps=None): r""" @@ -763,8 +763,8 @@ def __classcall__(cls, factors=None): True """ if factors: - return super(ProductOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) - return super(ProductOfSimplicialSets, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" @@ -1129,9 +1129,9 @@ def __classcall_private__(cls, maps=None, vertex_name=None): True """ if maps: - return super(PushoutOfSimplicialSets, cls).__classcall__(cls, maps=tuple(maps), - vertex_name=vertex_name) - return super(PushoutOfSimplicialSets, cls).__classcall__(cls, vertex_name=vertex_name) + return super().__classcall__(cls, maps=tuple(maps), + vertex_name=vertex_name) + return super().__classcall__(cls, vertex_name=vertex_name) def __init__(self, maps=None, vertex_name=None): r""" @@ -1392,9 +1392,9 @@ def __classcall_private__(cls, maps=None, vertex_name=None): True """ if maps: - return super(PushoutOfSimplicialSets_finite, cls).__classcall__(cls, maps=tuple(maps), - vertex_name=vertex_name) - return super(PushoutOfSimplicialSets_finite, cls).__classcall__(cls, vertex_name=vertex_name) + return super().__classcall__(cls, maps=tuple(maps), + vertex_name=vertex_name) + return super().__classcall__(cls, vertex_name=vertex_name) def __init__(self, maps=None, vertex_name=None): r""" @@ -1888,8 +1888,8 @@ def __classcall__(cls, factors=None): True """ if factors: - return super(SmashProductOfSimplicialSets_finite, cls).__classcall__(cls, factors=tuple(factors)) - return super(SmashProductOfSimplicialSets_finite, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" @@ -1964,8 +1964,8 @@ def __classcall__(cls, factors=None): True """ if factors: - return super(WedgeOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) - return super(WedgeOfSimplicialSets, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" @@ -2159,8 +2159,8 @@ def __classcall__(cls, factors=None): # Discard any empty factors. factors = [F for F in factors if F != Empty()] if factors: - return super(DisjointUnionOfSimplicialSets, cls).__classcall__(cls, factors=tuple(factors)) - return super(DisjointUnionOfSimplicialSets, cls).__classcall__(cls) + return super().__classcall__(cls, factors=tuple(factors)) + return super().__classcall__(cls) def __init__(self, factors=None): r""" diff --git a/src/sage/version.py b/src/sage/version.py index 6671c264512..3ea94539369 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,5 +1,5 @@ # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '9.7.beta1' -date = '2022-05-26' -banner = 'SageMath version 9.7.beta1, Release Date: 2022-05-26' +version = '9.7.beta2' +date = '2022-06-12' +banner = 'SageMath version 9.7.beta2, Release Date: 2022-06-12' diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 13c969a0ec8..c0866c0af75 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -1,3 +1,4 @@ +import importlib import sys import os import sphinx @@ -162,10 +163,6 @@ def sphinx_plot(graphics, **kwds): # output. They are ignored by default. #show_authors = False -# The name of the Pygments (syntax highlighting) style to use. NOTE: -# This overrides a HTML theme's corresponding setting (see below). -pygments_style = 'sphinx' - # Default lexer to use when highlighting code blocks, using the IPython # console lexers. 'ipycon' is the IPython console, which is what we want # for most code blocks: anything with "sage:" prompts. For other IPython, @@ -224,19 +221,46 @@ def set_intersphinx_mappings(app, config): # Options for HTML output # ----------------------- - -# Sage default HTML theme. We use a custom theme to set a Pygments style, -# stylesheet, and insert MathJax macros. See the directory -# doc/common/themes/sage-classic/ for files comprising the custom theme. -html_theme = 'sage-classic' - -# Theme options are theme-specific and customize the look and feel of -# a theme further. For a list of options available for each theme, -# see the documentation. -html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [os.path.join(SAGE_DOC_SRC, 'common', 'themes')] +if importlib.util.find_spec("furo") is not None: + html_theme = "furo" + + # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path + html_static_path = [ + os.path.join(SAGE_DOC_SRC, "common", "themes", "sage-classic", "static") + ] + + html_theme_options = { + # Hide project’s name in the sidebar of the documentation; + # the logo is enough. + # https://pradyunsg.me/furo/customisation/#sidebar-hide-name + "sidebar_hide_name": True, + # Change accent (used for stylising links, sidebar’s content etc) + "light_css_variables": { + "color-brand-primary": "#0f0fff", + "color-brand-content": "#0f0fff", + }, + # Add sage logo to sidebar + # https://pradyunsg.me/furo/customisation/logo/#different-logos-for-light-and-dark-mode + "light_logo": "logo_sagemath_black.svg", + "dark_logo": "logo_sagemath.svg", + } +else: + # Sage default HTML theme. We use a custom theme to set a Pygments style, + # stylesheet, and insert MathJax macros. See the directory + # doc/common/themes/sage-classic/ for files comprising the custom theme. + html_theme = "sage-classic" + + # Add any paths that contain custom themes here, relative to this directory. + html_theme_path = [os.path.join(SAGE_DOC_SRC, "common", "themes")] + + # Theme options are theme-specific and customize the look and feel of + # a theme further. For a list of options available for each theme, + # see the documentation. + html_theme_options = {} + + # The name of the Pygments (syntax highlighting) style to use. NOTE: + # This overrides a HTML theme's corresponding setting (see below). + pygments_style = "sphinx" # HTML style sheet NOTE: This overrides a HTML theme's corresponding # setting. diff --git a/src/sage_setup/cython_options.py b/src/sage_setup/cython_options.py index a02401c4d23..086aa070ca9 100644 --- a/src/sage_setup/cython_options.py +++ b/src/sage_setup/cython_options.py @@ -1,5 +1,6 @@ import sys + def compiler_directives(profile: bool): """ Return a list of Cython directives used for compilation. @@ -15,13 +16,14 @@ def compiler_directives(profile: bool): embedsignature=True, fast_getattr=True, # Use Python 3 (including source code semantics) for module compilation - language_level="3str", + language_level="3", # Enable support for late includes (make declarations in Cython code available to C include files) preliminary_late_includes_cy28=True, # Add hooks for Python profilers into the compiled C code profile=profile, ) + def compile_time_env_variables(): """ Return a list of environmental variables used for compilation. diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 index aff2e5d7cf8..8f4cdd8ab0d 100644 --- a/src/setup.cfg.m4 +++ b/src/setup.cfg.m4 @@ -19,14 +19,14 @@ classifiers = Operating System :: POSIX Operating System :: MacOS :: MacOS X Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Mathematics [options] -python_requires = >=3.7, <3.11 +python_requires = >=3.8, <3.11 install_requires = esyscmd(`sage-get-system-packages install-requires \ sage_conf \ diff --git a/src/tox.ini b/src/tox.ini index 7e78ad2abee..15cc6d181e0 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -107,7 +107,7 @@ description = # See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes deps = pycodestyle commands = pycodestyle --select E111,E401,E701,E702,E703,W605,E711,E712,E713,E721,E722 {posargs:{toxinidir}/sage/} - pycodestyle --select E703 --filename *.pyx {posargs:{toxinidir}/sage/} + pycodestyle --select E111,E401,E703,E712,E713,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/} [pycodestyle] max-line-length = 160 diff --git a/tox.ini b/tox.ini index 47c10c364ef..e2a15a5dad2 100644 --- a/tox.ini +++ b/tox.ini @@ -286,7 +286,6 @@ setenv = # gentoo: SYSTEM=gentoo gentoo: BASE_IMAGE=sheerluck/sage-on-gentoo-stage4 - gentoo-python3.7: BASE_TAG=latest-py37 gentoo-python3.9: BASE_TAG=latest-py39 gentoo-python3.10: BASE_TAG=latest-py10 gentoo: IGNORE_MISSING_SYSTEM_PACKAGES=no @@ -438,22 +437,6 @@ setenv = ubuntu-bionic-nvidia-cuda: BASE_TAG=ubuntu18.04 ubuntu-xenial-nvidia-cuda: BASE_TAG=ubuntu16.04 # - # https://hub.docker.com/r/gitpod/ - # - gitpod: SYSTEM=debian - gitpod: BASE_IMAGE=gitpod/workspace-base - gitpod-full: BASE_IMAGE=gitpod/workspace-full - gitpod: CONFIG_CONFIGURE_ARGS_ROOT=--prefix=/home/gitpod/sage-local --with-sage-venv - gitpod: __SUDO=--sudo - gitpod: __CHOWN=--chown=gitpod:gitpod - # Play safe and make sure that the image build succeeds even - # if packages that do not exist on ubuntu-focal are added to debian.txt - gitpod: IGNORE_MISSING_SYSTEM_PACKAGES=yes - # As of 2022-01, gitpod/workspace-base is based on ubuntu-focal. - # To save space, we filter out some packages that are too old and - # will be rejected by our configure script. - gitpod-standard: SAGE_PACKAGE_LIST_ARGS=--has-file=spkg-configure.m4 :standard: --exclude pari --exclude eclib --exclude lcalc --exclude giac --exclude singular - # # Resulting full image:tag name # docker: FULL_BASE_IMAGE_AND_TAG={env:ARCH_IMAGE_PREFIX:}{env:BASE_IMAGE}{env:ARCH_IMAGE_SUFFIX:}:{env:ARCH_TAG_PREFIX:}{env:BASE_TAG}{env:ARCH_TAG_SUFFIX:} @@ -506,8 +489,7 @@ setenv = # Setting "--with-system-python3=yes" explicitly in case we change the configure default # to "--with-system-python3=force" as originally proposed in #32060 PYTHON_MAJOR=3 - PYTHON_MINOR=9 - python3.7: PYTHON_MINOR=7 + PYTHON_MINOR=10 python3.8: PYTHON_MINOR=8 python3.9: PYTHON_MINOR=9 python3.10: PYTHON_MINOR=10 @@ -515,15 +497,14 @@ setenv = CONFIG_CONFIGURE_ARGS_1=--with-system-python3=yes python3_spkg: CONFIG_CONFIGURE_ARGS_1=--without-system-python3 macos-python3_xcode: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/usr/bin/python3 - macos-{python3_xcode,nohomebrew}-{python3.7,python3.8}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 + macos-{python3_xcode,nohomebrew}-{python3.8}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # Homebrew keg installs - homebrew-{python3.7,python3.8,python3.9,python3.10,python3.11}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 + homebrew-{python3.8,python3.9,python3.10,python3.11}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # Installers from https://www.python.org/downloads/macos/ (must manually download and install) macos-python3_pythonorg: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Frameworks/Python.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # https://github.com/pypa/manylinux manylinux-standard: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}-cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}/bin/python3 - manylinux-python3.7: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp37-cp37m/bin/python3 - manylinux-{python3.7,python3.8,python3.9,python3.10,python3.11}: EXTRA_SAGE_PACKAGES=_bootstrap xz bzip2 libffi libpng + manylinux-{python3.8,python3.9,python3.10,python3.11}: EXTRA_SAGE_PACKAGES=_bootstrap xz bzip2 libffi libpng conda: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python3 # # - toolchain