Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for E302 #38920

Merged
merged 2 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def pytest_addoption(parser):
dest="doctest",
)


@pytest.fixture(autouse=True, scope="session")
def add_imports(doctest_namespace: dict[str, Any]):
"""
Expand Down
2 changes: 2 additions & 0 deletions src/doc/ja/tutorial/japanesesupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
__RGX = re.compile(r'([^!-~])[\n\r\t]+([^!-~])')


def trunc_whitespace(app, doctree, docname):
from docutils.nodes import Text, paragraph
if not app.config.japanesesupport_trunc_whitespace:
Expand All @@ -15,6 +16,7 @@ def trunc_whitespace(app, doctree, docname):
#newtext = newtext.strip()
node.parent.replace(node, Text(newtext))


def setup(app):
app.add_config_value('japanesesupport_trunc_whitespace', True, True)
app.connect("doctree-resolved", trunc_whitespace)
2 changes: 2 additions & 0 deletions src/sage/algebras/splitting_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def monomial_coefficients(self):
# ------------------------------------------------------------------------------------------------------------------
# Parent class of the splitting algebra
# --------------------------------------------------------------------------------------------------------


class SplittingAlgebra(PolynomialQuotientRing_domain):
r"""
For a given monic polynomial `p(t)` of degree `n` over a commutative
Expand Down
2 changes: 2 additions & 0 deletions src/sage/arith/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6375,6 +6375,7 @@ def dedekind_psi(N):
N = Integer(N)
return Integer(N * prod(1 + 1 / p for p in N.prime_divisors()))


def smooth_part(x, base):
r"""
Given an element ``x`` of a Euclidean domain and a factor base ``base``,
Expand Down Expand Up @@ -6423,6 +6424,7 @@ def smooth_part(x, base):
from sage.structure.factorization import Factorization
return Factorization(fs)


def coprime_part(x, base):
r"""
Given an element ``x`` of a Euclidean domain and a factor base ``base``,
Expand Down
1 change: 1 addition & 0 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

auto_optional_tags = set()


class DocTestDefaults(SageObject):
"""
This class is used for doctesting the Sage doctest module.
Expand Down
24 changes: 24 additions & 0 deletions src/sage/doctest/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
# software xxx is available to Sage.
prefix = 'has_'


def has_internet():
"""
Test if Internet is available.
Expand All @@ -61,6 +62,7 @@ def has_internet():
from sage.features.internet import Internet
return Internet().is_present()


def has_latex():
"""
Test if Latex is available.
Expand All @@ -74,6 +76,7 @@ def has_latex():
from sage.features.latex import latex
return latex().is_present()


def has_xelatex():
"""
Test if xelatex is available.
Expand All @@ -87,6 +90,7 @@ def has_xelatex():
from sage.features.latex import xelatex
return xelatex().is_present()


def has_pdflatex():
"""
Test if pdflatex is available.
Expand All @@ -100,6 +104,7 @@ def has_pdflatex():
from sage.features.latex import pdflatex
return pdflatex().is_present()


def has_lualatex():
"""
Test if lualatex is available.
Expand All @@ -113,6 +118,7 @@ def has_lualatex():
from sage.features.latex import lualatex
return lualatex().is_present()


def has_magma():
"""
Test if Magma is available.
Expand All @@ -126,6 +132,7 @@ def has_magma():
from sage.features.interfaces import Magma
return Magma().is_present()


def has_matlab():
"""
Test if Matlab is available.
Expand All @@ -139,6 +146,7 @@ def has_matlab():
from sage.features.interfaces import Matlab
return Matlab().is_present()


def has_mathematica():
"""
Test if Mathematica is available.
Expand All @@ -152,6 +160,7 @@ def has_mathematica():
from sage.features.interfaces import Mathematica
return Mathematica().is_present()


def has_maple():
"""
Test if Maple is available.
Expand All @@ -165,6 +174,7 @@ def has_maple():
from sage.features.interfaces import Maple
return Maple().is_present()


def has_macaulay2():
"""
Test if Macaulay2 is available.
Expand All @@ -178,6 +188,7 @@ def has_macaulay2():
from sage.features.interfaces import Macaulay2
return Macaulay2().is_present()


def has_octave():
"""
Test if Octave is available.
Expand All @@ -191,6 +202,7 @@ def has_octave():
from sage.features.interfaces import Octave
return Octave().is_present()


def has_pandoc():
"""
Test if pandoc is available.
Expand All @@ -204,6 +216,7 @@ def has_pandoc():
from sage.features.pandoc import Pandoc
return Pandoc().is_present()


def has_scilab():
"""
Test if Scilab is available.
Expand All @@ -221,6 +234,7 @@ def has_scilab():
except Exception:
return False


def has_cplex():
"""
Test if CPLEX is available.
Expand All @@ -234,6 +248,7 @@ def has_cplex():
from sage.features.mip_backends import CPLEX
return CPLEX().is_present()


def has_gurobi():
"""
Test if Gurobi is available.
Expand All @@ -247,6 +262,7 @@ def has_gurobi():
from sage.features.mip_backends import Gurobi
return Gurobi().is_present()


def has_graphviz():
"""
Test if graphviz (dot, twopi, neato) are available.
Expand All @@ -260,6 +276,7 @@ def has_graphviz():
from sage.features.graphviz import Graphviz
return Graphviz().is_present()


def has_ffmpeg():
"""
Test if ffmpeg is available.
Expand All @@ -273,6 +290,7 @@ def has_ffmpeg():
from sage.features.ffmpeg import FFmpeg
return FFmpeg().is_present()


def has_imagemagick():
"""
Test if ImageMagick (command magick or convert) is available.
Expand All @@ -286,6 +304,7 @@ def has_imagemagick():
from sage.features.imagemagick import ImageMagick
return ImageMagick().is_present()


def has_dvipng():
"""
Test if dvipng is available.
Expand All @@ -299,6 +318,7 @@ def has_dvipng():
from sage.features.dvipng import dvipng
return dvipng().is_present()


def has_pdf2svg():
"""
Test if pdf2svg is available.
Expand All @@ -312,6 +332,7 @@ def has_pdf2svg():
from sage.features.pdf2svg import pdf2svg
return pdf2svg().is_present()


def has_rubiks():
"""
Test if the rubiks package (``cu2``, ``cubex``, ``dikcube``,
Expand All @@ -326,6 +347,7 @@ def has_rubiks():
from sage.features.rubiks import Rubiks
return Rubiks().is_present()


def has_4ti2():
"""
Test if the 4ti2 package is available.
Expand All @@ -339,6 +361,7 @@ def has_4ti2():
from sage.features.four_ti_2 import FourTi2
return FourTi2().is_present()


def external_features():
r"""
Generate the features that are only to be tested if ``--optional=external`` is used.
Expand All @@ -363,6 +386,7 @@ def external_features():
yield CPLEX()
yield Gurobi()


def external_software() -> list[str]:
"""
Return the alphabetical list of external software supported by this module.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/doctest/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from sage.doctest.sources import DictAsObject
from .external import available_software


def signal_name(sig):
"""
Return a string describing a signal number.
Expand Down Expand Up @@ -91,6 +92,7 @@ def signal_name(sig):
return "bus error"
return "signal %s" % sig


class DocTestReporter(SageObject):
"""
This class reports to the users on the results of doctests.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/doctest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from time import time as walltime
from os import sysconf, times


def count_noun(number, noun, plural=None, pad_number=False, pad_noun=False):
"""
EXAMPLES::
Expand Down Expand Up @@ -614,6 +615,7 @@ def make_recording_dict(D, st, gt):
ans.got = gt
return ans


class NestedName:
"""
Class used to construct fully qualified names based on indentation level.
Expand Down
1 change: 1 addition & 0 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def is_hidden(self):
return True
return False


class FeatureNotPresentError(RuntimeError):
r"""
A missing feature error.
Expand Down
1 change: 1 addition & 0 deletions src/sage/features/dvipng.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from . import Executable


class dvipng(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``dvipng``.
Expand Down
1 change: 1 addition & 0 deletions src/sage/features/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from . import Executable, FeatureTestResult


class FFmpeg(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of :ref:`ffmpeg <spkg_ffmpeg>`.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/features/fricas.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import subprocess
from . import Executable, FeatureTestResult


class FriCAS(Executable):
r"""
A :class:`~sage.features.Feature` which checks for the :ref:`fricas <fricas>` binary.
Expand Down Expand Up @@ -62,5 +63,6 @@ def is_functional(self):

return FeatureTestResult(self, True)


def all_features():
return [FriCAS()]
1 change: 1 addition & 0 deletions src/sage/features/gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .join_feature import JoinFeature
from .sagemath import sage__libs__gap


class GapPackage(Feature):
r"""
A :class:`~sage.features.Feature` describing the presence of a GAP package.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/features/giac.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from . import Executable, FeatureTestResult


class Giac(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of :ref:`giac <spkg_giac>`.
Expand All @@ -26,5 +27,6 @@ def __init__(self):
Executable.__init__(self, 'giac', executable='giac',
spkg='giac', type='standard')


def all_features():
return [Giac()]
1 change: 1 addition & 0 deletions src/sage/features/igraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ def __init__(self):
[PythonModule('igraph', spkg='python_igraph',
url='http://igraph.org')])


def all_features():
return [python_igraph()]
2 changes: 2 additions & 0 deletions src/sage/features/imagemagick.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from . import Executable, FeatureTestResult
from .join_feature import JoinFeature


class Magick(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``magick`` or the deprecated ``convert``.
Expand Down Expand Up @@ -134,5 +135,6 @@ def __init__(self):
spkg='imagemagick',
url='https://www.imagemagick.org/')


def all_features():
return [ImageMagick()]
1 change: 1 addition & 0 deletions src/sage/features/kenzo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from . import Feature, FeatureTestResult


class Kenzo(Feature):
r"""
A :class:`~sage.features.Feature` describing the presence of :ref:`Kenzo <spkg_kenzo>`.
Expand Down
1 change: 1 addition & 0 deletions src/sage/features/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def __init__(self):
Executable.__init__(self, 'dvips', executable='dvips',
url='https://tug.org/texinfohtml/dvips.html')


class TeXFile(StaticFile):
r"""
A :class:`sage.features.Feature` describing the presence of a TeX file.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/features/msolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from . import Executable
from . import FeatureTestResult


class msolve(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of :ref:`msolve <spkg_msolve>`.
Expand Down Expand Up @@ -64,5 +65,6 @@ def is_functional(self):
reason="output of msolve -h not recognized")
return FeatureTestResult(self, True)


def all_features():
return [msolve()]
Loading
Loading