diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2cd99caa7cd..8456f3666dc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,3 +36,19 @@ jobs: run: pip install tox relint - name: Lint using relint run: tox -e relint src/sage/ + lint-rst: + name: Validate docstring markup as RST + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install tox + run: pip install tox + - name: Lint using tox -e rst + run: tox -e rst + # Until all errors are fixed: + continue-on-error: true diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index b9cb2aa2722..e9faa85ab57 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -2352,7 +2352,7 @@ def __reduce__(self): additive magma is implemented as ``MagmasAndAdditiveMagmas.Distributive.AdditiveAssociative.AdditiveCommutative`` and not - ``MagmasAndAdditiveMagmas.Distributive.AdditiveCommutative.AdditiveAssociative``:: + ``MagmasAndAdditiveMagmas.Distributive.AdditiveCommutative.AdditiveAssociative``. EXAMPLES:: diff --git a/src/sage/categories/chain_complexes.py b/src/sage/categories/chain_complexes.py index 1cf64c011d7..531fc48e4cd 100644 --- a/src/sage/categories/chain_complexes.py +++ b/src/sage/categories/chain_complexes.py @@ -235,7 +235,7 @@ def _apply_functor_to_morphism(self, f): r""" Apply ``self`` to a chain map. - TESTS: + TESTS:: sage: E3 = EuclideanSpace(3) # optional - sage.symbolic sage: C = E3.de_rham_complex() # optional - sage.symbolic diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py index 7b36a19c4bd..563a8025e6d 100644 --- a/src/sage/categories/enumerated_sets.py +++ b/src/sage/categories/enumerated_sets.py @@ -179,7 +179,7 @@ def __iter__(self): If none of these are provided, raise a ``NotImplementedError``. - EXAMPLES:: + EXAMPLES: We start with an example where nothing is implemented:: diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index e616ce19241..49d91c17049 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -2166,7 +2166,7 @@ def __call_on_basis__(self, **options): sage: phi(x[1] + x[2] + x[3]) B[1] + 4*B[2] + 9*B[3] - TESTS:: + TESTS: As for usual homsets, the argument can be a Python function:: diff --git a/src/sage/categories/sets_cat.py b/src/sage/categories/sets_cat.py index ea95ab2e527..09a57770a3b 100644 --- a/src/sage/categories/sets_cat.py +++ b/src/sage/categories/sets_cat.py @@ -1471,10 +1471,10 @@ def construction(self): def _test_construction(self, **options): """ - Test that the construction returned by self really yields self. + Test that the construction returned by ``self`` really yields ``self``. - :meth:`construction` either returns None or a pair ``(F,O)``, - and if it returns the latter, then it is supposed that ``F(O)==self`. + :meth:`construction` either returns None or a pair ``(F, O)``, + and if it returns the latter, then it is supposed that ``F(O) == self``. The test verifies this assumption. EXAMPLES: diff --git a/src/sage/coding/delsarte_bounds.py b/src/sage/coding/delsarte_bounds.py index f2c7ae86f26..15d5ade7887 100644 --- a/src/sage/coding/delsarte_bounds.py +++ b/src/sage/coding/delsarte_bounds.py @@ -678,29 +678,29 @@ def delsarte_bound_Q_matrix(q, d, return_data=False, solver="PPL", isinteger=Fal (ILP), rather that an LP solver. Can be very slow if set to ``True``. - EXAMPLES: + EXAMPLES: - The bound on dimension of linear `F_2`-codes of length 10 and minimal distance 6:: + The bound on dimension of linear `F_2`-codes of length 10 and minimal distance 6:: - sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) - sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) - 2 + sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) + sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) + 2 - sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) - sage: [j for i,j in p.get_values(a).items()] - [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) + sage: [j for i,j in p.get_values(a).items()] + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] - TESTS: + TESTS: - cases for using Hamming scheme Q matrix:: + Cases for using Hamming scheme Q matrix:: - sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) - sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) - 2 + sage: q_matrix = Matrix([[codes.bounds.krawtchouk(10,2,i,j) for i in range(11)] for j in range(11)]) + sage: codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6) + 2 - sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) - sage: [j for i,j in p.get_values(a).items()] - [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + sage: a,p,val = codes.bounds.delsarte_bound_Q_matrix(q_matrix, 6, return_data=True) + sage: [j for i,j in p.get_values(a).items()] + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] """ diff --git a/src/sage/coding/gabidulin_code.py b/src/sage/coding/gabidulin_code.py index 353f76c6ee4..dc1c319dc62 100644 --- a/src/sage/coding/gabidulin_code.py +++ b/src/sage/coding/gabidulin_code.py @@ -45,13 +45,13 @@ class GabidulinCode(AbstractLinearRankMetricCode): EXAMPLES: - A Gabidulin Code can be constructed in the following way: + A Gabidulin Code can be constructed in the following way:: - sage: Fqm = GF(16) - sage: Fq = GF(4) - sage: C = codes.GabidulinCode(Fqm, 2, 2, Fq) - sage: C - [2, 2, 1] linear Gabidulin code over GF(16)/GF(4) + sage: Fqm = GF(16) + sage: Fq = GF(4) + sage: C = codes.GabidulinCode(Fqm, 2, 2, Fq) + sage: C + [2, 2, 1] linear Gabidulin code over GF(16)/GF(4) """ _registered_encoders = {} _registered_decoders = {} @@ -113,7 +113,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, ValueError: 'length' can be at most the degree of the extension, 3 If the number of evaluation points is not equal to the length - of the code, an error is raised: + of the code, an error is raised:: sage: Fqm = GF(5^20) sage: Fq = GF(5) @@ -125,7 +125,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, ValueError: the number of evaluation points should be equal to the length of the code If evaluation points are not linearly independent over the ``base_field``, - an error is raised: + an error is raised:: sage: evals = [ aa*i for i in range(2) ] sage: C = codes.GabidulinCode(Fqm, 2, 2, Fq, None, evals) @@ -134,7 +134,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, ValueError: the evaluation points provided are not linearly independent If an evaluation point does not belong to the ``base_field``, an error - is raised: + is raised:: sage: a = GF(3).gen() sage: evals = [ a*i for i in range(2) ] @@ -146,7 +146,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, Given that both ``sub_field`` and ``twisting_homomorphism`` are specified and ``twisting_homomorphism`` has a fixed field method. If the fixed field of ``twisting_homomorphism`` is not ``sub_field``, an error is - raised: + raised:: sage: Fqm = GF(64) sage: Fq = GF(8) @@ -158,7 +158,7 @@ def __init__(self, base_field, length, dimension, sub_field=None, If ``twisting_homomorphism`` is given, but ``sub_field`` is not. In case ``twisting_homomorphism`` does not have a fixed field method, and error - is raised: + is raised:: sage: Fqm. = GF(64) sage: sigma = Hom(Fqm, Fqm)[1]; sigma @@ -417,7 +417,7 @@ def __init__(self, code): TESTS: - If the code is not a Gabidulin code, an error is raised: + If the code is not a Gabidulin code, an error is raised:: sage: C = codes.HammingCode(GF(4), 2) sage: E = codes.encoders.GabidulinVectorEvaluationEncoder(C) @@ -433,7 +433,7 @@ def _repr_(self): """ Return a string representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -447,7 +447,7 @@ def _latex_(self): r""" Return a latex representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -571,7 +571,7 @@ def __init__(self, code): TESTS: - If the code is not a Gabidulin code, an error is raised: + If the code is not a Gabidulin code, an error is raised:: sage: C = codes.HammingCode(GF(4), 2) sage: E = codes.encoders.GabidulinPolynomialEvaluationEncoder(C) @@ -587,7 +587,7 @@ def _repr_(self): """ Return a string representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -601,7 +601,7 @@ def _latex_(self): r""" Return a latex representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -648,7 +648,7 @@ def message_space(self): r""" Return the message space of the associated code of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -680,7 +680,7 @@ def encode(self, p, form="vector"): - a codeword corresponding to `p` in vector or matrix form - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -749,7 +749,7 @@ def unencode_nocheck(self, c): - a skew polynomial of degree less than ``self.code().dimension()`` - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -800,7 +800,7 @@ def __init__(self, code): TESTS: - If the code is not a Gabidulin code, an error is raised: + If the code is not a Gabidulin code, an error is raised:: sage: C = codes.HammingCode(GF(4), 2) sage: D = codes.decoders.GabidulinGaoDecoder(C) @@ -816,7 +816,7 @@ def _repr_(self): """ Return a string representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -830,7 +830,7 @@ def _latex_(self): r""" Return a latex representation of ``self``. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5^4) @@ -894,7 +894,7 @@ def _partial_xgcd(self, a, b, d_stop): - ``u_c`` -- right linearized quotient of `a` and `b` - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -942,7 +942,7 @@ def _decode_to_code_and_message(self, r): - the decoded codeword and decoded message corresponding to the received codeword `r` - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -993,7 +993,7 @@ def decode_to_code(self, r): - the decoded codeword corresponding to the received codeword - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(3^20) sage: Fq = GF(3) @@ -1026,7 +1026,7 @@ def decode_to_message(self, r): - the message corresponding to the received codeword - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(2^9) sage: Fq = GF(2^3) @@ -1047,7 +1047,7 @@ def decoding_radius(self): """ Return the decoding radius of the Gabidulin Gao Decoder. - EXAMPLES: + EXAMPLES:: sage: Fqm = GF(5^20) sage: Fq = GF(5) diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index cfd84e86e5c..3fe439bb848 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -2274,9 +2274,10 @@ def __init__(self, generator, d=None): sage: C.minimum_distance() 3 - We can construct a linear code directly from a vector space - sage: VS = matrix(GF(2), [[1,0,1],\ - [1,0,1]]).row_space() + We can construct a linear code directly from a vector space:: + + sage: VS = matrix(GF(2), [[1,0,1], + ....: [1,0,1]]).row_space() sage: C = LinearCode(VS); C [3, 1] linear code over GF(2) diff --git a/src/sage/cpython/_py2_random.py b/src/sage/cpython/_py2_random.py index b1a4cf37ba9..745834f0cd1 100644 --- a/src/sage/cpython/_py2_random.py +++ b/src/sage/cpython/_py2_random.py @@ -471,7 +471,7 @@ def gammavariate(self, alpha, beta): Conditions on the parameters are alpha > 0 and beta > 0. - The probability distribution function is: + The probability distribution function is:: x ** (alpha - 1) * math.exp(-x / beta) pdf(x) = -------------------------------------- diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index beccbeacf1f..db40b1e7b49 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -301,7 +301,7 @@ class Logger(): 'hello world\n' """ def __init__(self, *files): - """ + r""" Initialize the logger for writing to all files in ``files``. TESTS:: diff --git a/src/sage/functions/piecewise.py b/src/sage/functions/piecewise.py index b9a5156c534..688db13a3b8 100644 --- a/src/sage/functions/piecewise.py +++ b/src/sage/functions/piecewise.py @@ -108,7 +108,7 @@ def __call__(self, function_pieces, **kwds): domain and a symbolic function. - ``var=x`` -- a symbolic variable or ``None`` (default). The - real variable in which the function is piecewise in. + real variable in which the function is piecewise in. OUTPUT: diff --git a/src/sage/game_theory/normal_form_game.py b/src/sage/game_theory/normal_form_game.py index 2e27caa4a60..f1adc424e3e 100644 --- a/src/sage/game_theory/normal_form_game.py +++ b/src/sage/game_theory/normal_form_game.py @@ -1137,7 +1137,7 @@ def _gambit_(self, as_integer=False, maximization=True): { "" 3, 5, 8 } { "" 2, 6, 4 } } - 1 2 3 4 5 6 7 8 + 1 2 3 4 5 6 7 8 """ from decimal import Decimal diff --git a/src/sage/geometry/polyhedron/backend_cdd.py b/src/sage/geometry/polyhedron/backend_cdd.py index e7f9afbf8e3..442aabbd328 100644 --- a/src/sage/geometry/polyhedron/backend_cdd.py +++ b/src/sage/geometry/polyhedron/backend_cdd.py @@ -244,19 +244,19 @@ def _init_from_cdd_output(self, cddout): Check that :trac:`31253` is fixed:: - sage: P = polytopes.permutahedron(2, backend='cdd') - sage: P.Hrepresentation() - (An inequality (0, 1) x - 1 >= 0, - An inequality (1, 0) x - 1 >= 0, - An equation (1, 1) x - 3 == 0) - sage: Q = Polyhedron(P.vertices(), backend='cdd') - sage: Q.Hrepresentation() - (An inequality (-1, 0) x + 2 >= 0, - An inequality (1, 0) x - 1 >= 0, - An equation (1, 1) x - 3 == 0) - sage: [x.ambient_Hrepresentation() for x in P.facets()] - [(An inequality (1, 0) x - 1 >= 0, An equation (1, 1) x - 3 == 0), - (An inequality (0, 1) x - 1 >= 0, An equation (1, 1) x - 3 == 0)] + sage: P = polytopes.permutahedron(2, backend='cdd') + sage: P.Hrepresentation() + (An inequality (0, 1) x - 1 >= 0, + An inequality (1, 0) x - 1 >= 0, + An equation (1, 1) x - 3 == 0) + sage: Q = Polyhedron(P.vertices(), backend='cdd') + sage: Q.Hrepresentation() + (An inequality (-1, 0) x + 2 >= 0, + An inequality (1, 0) x - 1 >= 0, + An equation (1, 1) x - 3 == 0) + sage: [x.ambient_Hrepresentation() for x in P.facets()] + [(An inequality (1, 0) x - 1 >= 0, An equation (1, 1) x - 3 == 0), + (An inequality (0, 1) x - 1 >= 0, An equation (1, 1) x - 3 == 0)] """ cddout = cddout.splitlines() diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py index af24552e062..86b89632a51 100644 --- a/src/sage/geometry/polyhedron/backend_normaliz.py +++ b/src/sage/geometry/polyhedron/backend_normaliz.py @@ -1250,30 +1250,30 @@ def __getstate__(self): TESTS:: - sage: P = polytopes.simplex(backend='normaliz') # optional - pynormaliz - sage: P.__getstate__() # optional - pynormaliz - (Polyhedra in ZZ^4, - {'_Hrepresentation': (An inequality (0, 0, 0, 1) x + 0 >= 0, - An inequality (0, 0, 1, 0) x + 0 >= 0, - An inequality (0, 1, 0, 0) x + 0 >= 0, - An inequality (1, 0, 0, 0) x + 0 >= 0, - An equation (1, 1, 1, 1) x - 1 == 0), - '_Vrepresentation': (A vertex at (0, 0, 0, 1), - A vertex at (0, 0, 1, 0), - A vertex at (0, 1, 0, 0), - A vertex at (1, 0, 0, 0)), - '_normaliz_field': Rational Field, - '_pickle_equations': [(-1, 1, 1, 1, 1)], - '_pickle_inequalities': [(0, 0, 0, 0, 1), - (0, 0, 0, 1, 0), - (0, 0, 1, 0, 0), - (0, 1, 0, 0, 0)], - '_pickle_lines': [], - '_pickle_rays': [], - '_pickle_vertices': [(0, 0, 0, 1), - (0, 0, 1, 0), - (0, 1, 0, 0), - (1, 0, 0, 0)]}) + sage: P = polytopes.simplex(backend='normaliz') # optional - pynormaliz + sage: P.__getstate__() # optional - pynormaliz + (Polyhedra in ZZ^4, + {'_Hrepresentation': (An inequality (0, 0, 0, 1) x + 0 >= 0, + An inequality (0, 0, 1, 0) x + 0 >= 0, + An inequality (0, 1, 0, 0) x + 0 >= 0, + An inequality (1, 0, 0, 0) x + 0 >= 0, + An equation (1, 1, 1, 1) x - 1 == 0), + '_Vrepresentation': (A vertex at (0, 0, 0, 1), + A vertex at (0, 0, 1, 0), + A vertex at (0, 1, 0, 0), + A vertex at (1, 0, 0, 0)), + '_normaliz_field': Rational Field, + '_pickle_equations': [(-1, 1, 1, 1, 1)], + '_pickle_inequalities': [(0, 0, 0, 0, 1), + (0, 0, 0, 1, 0), + (0, 0, 1, 0, 0), + (0, 1, 0, 0, 0)], + '_pickle_lines': [], + '_pickle_rays': [], + '_pickle_vertices': [(0, 0, 0, 1), + (0, 0, 1, 0), + (0, 1, 0, 0), + (1, 0, 0, 0)]}) """ state = super().__getstate__() state = (state[0], state[1].copy()) @@ -2247,8 +2247,8 @@ def _Hstar_function_normaliz(self, acting_group=None, output=None): - ``acting_group`` -- (default=None) a permgroup object. A subgroup of ``self``'s ``restricted_automorphism_group`` output as a permutation. - If ``None``, it is set to the full ``restricted_automorphism_group`` - of ``self``. The acting group should always use output='permutation'. + If ``None``, it is set to the full ``restricted_automorphism_group`` + of ``self``. The acting group should always use output='permutation'. - ``output`` -- string. an output option. The allowed values are: diff --git a/src/sage/geometry/polyhedron/backend_polymake.py b/src/sage/geometry/polyhedron/backend_polymake.py index 024ee5da232..97dfdc2c63e 100644 --- a/src/sage/geometry/polyhedron/backend_polymake.py +++ b/src/sage/geometry/polyhedron/backend_polymake.py @@ -600,29 +600,29 @@ def __getstate__(self): TESTS:: - sage: P = polytopes.simplex(backend='polymake') # optional - polymake - sage: P.__getstate__() # optional - polymake - (Polyhedra in QQ^4, - {'_Hrepresentation': (An inequality (0, -1, -1, -1) x + 1 >= 0, - An inequality (0, 1, 0, 0) x + 0 >= 0, - An inequality (0, 0, 1, 0) x + 0 >= 0, - An inequality (0, 0, 0, 1) x + 0 >= 0, - An equation (1, 1, 1, 1) x - 1 == 0), - '_Vrepresentation': (A vertex at (1, 0, 0, 0), - A vertex at (0, 1, 0, 0), - A vertex at (0, 0, 1, 0), - A vertex at (0, 0, 0, 1)), - '_pickle_equations': [(-1, 1, 1, 1, 1)], - '_pickle_inequalities': [(1, 0, -1, -1, -1), - (0, 0, 1, 0, 0), - (0, 0, 0, 1, 0), - (0, 0, 0, 0, 1)], - '_pickle_lines': [], - '_pickle_rays': [], - '_pickle_vertices': [(1, 0, 0, 0), - (0, 1, 0, 0), - (0, 0, 1, 0), - (0, 0, 0, 1)]}) + sage: P = polytopes.simplex(backend='polymake') # optional - polymake + sage: P.__getstate__() # optional - polymake + (Polyhedra in QQ^4, + {'_Hrepresentation': (An inequality (0, -1, -1, -1) x + 1 >= 0, + An inequality (0, 1, 0, 0) x + 0 >= 0, + An inequality (0, 0, 1, 0) x + 0 >= 0, + An inequality (0, 0, 0, 1) x + 0 >= 0, + An equation (1, 1, 1, 1) x - 1 == 0), + '_Vrepresentation': (A vertex at (1, 0, 0, 0), + A vertex at (0, 1, 0, 0), + A vertex at (0, 0, 1, 0), + A vertex at (0, 0, 0, 1)), + '_pickle_equations': [(-1, 1, 1, 1, 1)], + '_pickle_inequalities': [(1, 0, -1, -1, -1), + (0, 0, 1, 0, 0), + (0, 0, 0, 1, 0), + (0, 0, 0, 0, 1)], + '_pickle_lines': [], + '_pickle_rays': [], + '_pickle_vertices': [(1, 0, 0, 0), + (0, 1, 0, 0), + (0, 0, 1, 0), + (0, 0, 0, 1)]}) """ state = super().__getstate__() state = (state[0], state[1].copy()) diff --git a/src/sage/geometry/polyhedron/base3.py b/src/sage/geometry/polyhedron/base3.py index 3a70cf79afc..0b85c4f944c 100644 --- a/src/sage/geometry/polyhedron/base3.py +++ b/src/sage/geometry/polyhedron/base3.py @@ -1100,7 +1100,7 @@ def a_maximal_chain(self): sage: [face.ambient_V_indices() for face in chain] [(), (5,), (0, 5), (0, 3, 4, 5), (0, 1, 2, 3, 4, 5, 6, 7)] - TESTS:: + TESTS: Check output for the empty polyhedron:: diff --git a/src/sage/graphs/digraph.py b/src/sage/graphs/digraph.py index a17d008e6b1..5b4c53e6f2c 100644 --- a/src/sage/graphs/digraph.py +++ b/src/sage/graphs/digraph.py @@ -3941,9 +3941,10 @@ def _rec_out_branchings(depth): This function makes use of the following to keep track of partial out branchings: - list_edges -- list of edges in self. - list_merged_edges -- list of edges that are currently merged - graph -- a copy of self where edges have an appropriate label + + - ``list_edges`` -- list of edges in self. + - ``list_merged_edges`` -- list of edges that are currently merged + - ``graph`` -- a copy of self where edges have an appropriate label """ if not depth: # We have enough merged edges to form a out_branching @@ -4158,9 +4159,10 @@ def _rec_in_branchings(depth): This function makes use of the following to keep track of partial in branchings: - list_edges -- list of edges in self. - list_merged_edges -- list of edges that are currently merged - graph -- a copy of self where edges have an appropriate label + + - ``list_edges`` -- list of edges in self. + - ``list_merged_edges`` -- list of edges that are currently merged + - ``graph`` -- a copy of self where edges have an appropriate label """ if not depth: # We have enough merged edges to form a in_branching diff --git a/src/sage/graphs/domination.py b/src/sage/graphs/domination.py index 25e9a687790..69648d66658 100644 --- a/src/sage/graphs/domination.py +++ b/src/sage/graphs/domination.py @@ -513,7 +513,7 @@ def _aux_with_rep(H, to_dom, u_next): .. WARNING:: - The same output may be output several times (up to |H| times). + The same output may be output several times (up to `|H|` times). In order to later remove duplicates, we here output pairs ``(ext, i)`` where ``ext`` is the output candidate extension and ``i`` counts how @@ -593,7 +593,7 @@ def minimal_dominating_sets(G, to_dominate=None, work_on_copy=True): - ``work_on_copy`` -- boolean (default: ``True``); whether or not to work on a copy of the input graph; if set to ``False``, the input graph will be modified (relabeled). - + OUTPUT: An iterator over the inclusion-minimal sets of vertices of ``G``. diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index da854f73b1d..e6ca8a4c09c 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2244,7 +2244,7 @@ def distance_matrix(self, vertices=None, *, base_ring=None, **kwds): * :meth:`~sage.graphs.generic_graph.GenericGraph.distance_all_pairs` -- computes the distance between any two vertices. - TESTS:: + TESTS: Asking for an immutable matrix:: diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index c2068ac0842..dafb088c24b 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -3963,7 +3963,7 @@ def get_knotinfo(self, mirror_version=True, unique=True): sage: Ks10_83.sage_link().get_knotinfo() # optional - snappy (, False) - TESTS: + TESTS:: sage: L = KnotInfo.L10a171_1_1_0 # optional - database_knotinfo sage: l = L.link(L.items.braid_notation) # optional - database_knotinfo diff --git a/src/sage/libs/singular/standard_options.py b/src/sage/libs/singular/standard_options.py index 4756a6ec1db..6797cb05001 100644 --- a/src/sage/libs/singular/standard_options.py +++ b/src/sage/libs/singular/standard_options.py @@ -100,7 +100,7 @@ def __exit__(self, typ, value, tb): self.libsingular_option_context.__exit__(typ,value,tb) def libsingular_gb_standard_options(func): - """ + r""" Decorator to force a reduced Singular groebner basis. TESTS:: diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py index d14addb5bfb..c29bcc64260 100644 --- a/src/sage/matrix/matrix_space.py +++ b/src/sage/matrix/matrix_space.py @@ -538,7 +538,7 @@ def __classcall__(cls, base_ring, nrows, ncols=None, sparse=False, implementatio ... ValueError: unknown matrix implementation 'foobar' over Integer Ring - Check that :trac:`29466`is fixed:: + Check that :trac:`29466` is fixed:: sage: class MyMatrixSpace(MatrixSpace): ....: @staticmethod @@ -580,7 +580,7 @@ def __init__(self, base_ring, nrows, ncols, sparse, implementation): r""" INPUT: - - ``base_ring` + - ``base_ring`` - ``nrows`` - (positive integer) the number of rows @@ -1107,7 +1107,7 @@ def _coerce_map_from_base_ring(self): return self._generic_coerce_map(self.base_ring()) def _coerce_map_from_(self, S): - """ + r""" Canonical coercion from ``S`` to this matrix space. EXAMPLES:: diff --git a/src/sage/misc/abstract_method.py b/src/sage/misc/abstract_method.py index 99604777c08..720f7f5a7f0 100644 --- a/src/sage/misc/abstract_method.py +++ b/src/sage/misc/abstract_method.py @@ -182,7 +182,7 @@ def __repr__(self): return "<" + ("optional " if self._optional else "") + "abstract method %s at %s>" % (self.__name__, hex(id(self._f))) def _sage_src_lines_(self): - """ + r""" Returns the source code location for the wrapped function. EXAMPLES:: diff --git a/src/sage/misc/inline_fortran.py b/src/sage/misc/inline_fortran.py index d7ed02fe92b..6e71016c427 100644 --- a/src/sage/misc/inline_fortran.py +++ b/src/sage/misc/inline_fortran.py @@ -47,7 +47,7 @@ def _import_module_from_path(name, path=None): def _import_module_from_path_impl(name, path): - """Implement ``_import_module_from_path for Python 3.4+.""" + """Implement ``_import_module_from_path`` for Python 3.4+.""" # This is remarkably tricky to do right, considering that the new # importlib is supposed to make direct interaction with the import diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 13f0fc1bec3..9add0610149 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -886,7 +886,7 @@ def visit_UnaryOp(self, node): def _grep_first_pair_of_parentheses(s): - """ + r""" Return the first matching pair of parentheses in a code string. INPUT: diff --git a/src/sage/misc/superseded.py b/src/sage/misc/superseded.py index eb2ff9c2b27..2bc69b0ffb8 100644 --- a/src/sage/misc/superseded.py +++ b/src/sage/misc/superseded.py @@ -383,7 +383,7 @@ def __init__(self, trac_number, func, module, instance=None, unbound=None): @lazy_attribute def __name__(self): - """ + r""" TESTS:: sage: from sage.misc.superseded import deprecated_function_alias diff --git a/src/sage/misc/viewer.py b/src/sage/misc/viewer.py index 9bdde290365..de84f31ddf4 100644 --- a/src/sage/misc/viewer.py +++ b/src/sage/misc/viewer.py @@ -161,7 +161,7 @@ def _set(self, app=None, TYPE='browser'): - ``app`` -- ``None`` or a string, the program to use - ``TYPE`` -- a string, must be in the list ``VIEWERS`` defined in - :module:`sage.misc.viewer`. Default 'browser'. + :mod:`sage.misc.viewer`. Default 'browser'. EXAMPLES:: diff --git a/src/sage/modular/btquotients/pautomorphicform.py b/src/sage/modular/btquotients/pautomorphicform.py index b0e5e1cf9da..540da704d3f 100644 --- a/src/sage/modular/btquotients/pautomorphicform.py +++ b/src/sage/modular/btquotients/pautomorphicform.py @@ -672,7 +672,7 @@ def __classcall__(cls, X, k, prec=None, basis_matrix=None, base_field=None): - ``k`` - integer - The weight. It must be even. - ``prec`` - integer (default: None). If specified, the - precision for the coefficient module + precision for the coefficient module - ``basis_matrix`` - a matrix (default: None). @@ -2223,12 +2223,12 @@ def __classcall__(cls, domain, U, prec=None, t=None, R=None, it automatically from ``prec``, ``U`` and the ``overconvergent`` flag. - ``R`` -- (default : None). If specified, coefficient field of the automorphic forms. - If not specified it defaults to the base ring of the distributions ``U``, or to `Q_p` - with the working precision ``prec``. + If not specified it defaults to the base ring of the distributions ``U``, or to `Q_p` + with the working precision ``prec``. - ``overconvergent`` -- Boolean (default = False). If True, will construct overconvergent - `p`-adic automorphic forms. Otherwise it constructs the finite dimensional space of - `p`-adic automorphic forms which is isomorphic to the space of harmonic cocycles. + `p`-adic automorphic forms. Otherwise it constructs the finite dimensional space of + `p`-adic automorphic forms which is isomorphic to the space of harmonic cocycles. EXAMPLES: diff --git a/src/sage/modular/hecke/algebra.py b/src/sage/modular/hecke/algebra.py index e840b306d3e..646f0ecb2cb 100644 --- a/src/sage/modular/hecke/algebra.py +++ b/src/sage/modular/hecke/algebra.py @@ -206,9 +206,9 @@ def __call__(self, x, check=True): - something that can be converted into an element of the underlying matrix space. - In the last case, the parameter ``check'' controls whether or + In the last case, the parameter ``check`` controls whether or not to check that this element really does lie in the - appropriate algebra. At present, setting ``check=True'' raises + appropriate algebra. At present, setting ``check=True`` raises a NotImplementedError unless x is a scalar (or a diagonal matrix). diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index 67b0b236fbb..db1c76ab382 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -202,7 +202,7 @@ def __init__(self, group, base_ring=QQ): - ``base_ring`` (ring, default: `\QQ`) -- a base ring, which should be `\QQ`, `\ZZ`, or the integers mod `p` for some prime `p` - TESTS:: + TESTS: Check that :trac:`15037` is fixed:: diff --git a/src/sage/modular/modform_hecketriangle/abstract_ring.py b/src/sage/modular/modform_hecketriangle/abstract_ring.py index ed30e5e7af1..52922f6a1f2 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_ring.py +++ b/src/sage/modular/modform_hecketriangle/abstract_ring.py @@ -52,7 +52,7 @@ def __init__(self, group, base_ring, red_hom, n): - ``group`` -- The Hecke triangle group (default: ``HeckeTriangleGroup(3)``) - - ``base_ring`` -- The base_ring (default: `\Z). + - ``base_ring`` -- The base_ring (default: `\Z`). - ``red_hom`` -- If ``True`` then results of binary operations are considered homogeneous whenever it makes sense (default: ``False``). diff --git a/src/sage/modular/pollack_stevens/modsym.py b/src/sage/modular/pollack_stevens/modsym.py index 7c71fd24a13..1b6b2164b1a 100644 --- a/src/sage/modular/pollack_stevens/modsym.py +++ b/src/sage/modular/pollack_stevens/modsym.py @@ -1283,7 +1283,7 @@ def _lift_to_OMS(self, p, M, new_base_ring, algorithm = 'greenberg'): OUTPUT: - An overconvergent modular symbol whose specialization - equals self up to some Eisenstein error. + equals self up to some Eisenstein error. EXAMPLES:: diff --git a/src/sage/modular/pollack_stevens/sigma0.py b/src/sage/modular/pollack_stevens/sigma0.py index fa2f4ac7d81..88d86a7a06b 100644 --- a/src/sage/modular/pollack_stevens/sigma0.py +++ b/src/sage/modular/pollack_stevens/sigma0.py @@ -9,6 +9,7 @@ Over `\QQ` or `\ZZ`, it is the monoid of matrices `2\times2` matrices `\begin{pmatrix} a & b \\ c & d \end{pmatrix}` such that + - `ad - bc \ne 0`, - `a` is integral and invertible at the primes dividing `N`, - `c` has valuation at least `v_p(N)` for each `p` dividing `N` (but may be diff --git a/src/sage/modules/fp_graded/free_morphism.py b/src/sage/modules/fp_graded/free_morphism.py index ab1bd91015b..8044fb3883b 100755 --- a/src/sage/modules/fp_graded/free_morphism.py +++ b/src/sage/modules/fp_graded/free_morphism.py @@ -55,7 +55,7 @@ class FreeGradedModuleMorphism(FPModuleMorphism): Defn: b[4] |--> (Sq(0,2)+Sq(3,1)+Sq(6))*d[2] b[5] |--> (Sq(1,2)+Sq(7))*d[2] + (Sq(0,2)+Sq(3,1)+Sq(6))*d[3] - TESTS:: + TESTS: A non-example because the degree is not well-defined:: diff --git a/src/sage/modules/fp_graded/steenrod/morphism.py b/src/sage/modules/fp_graded/steenrod/morphism.py index d55b51faf4a..595db1a33aa 100755 --- a/src/sage/modules/fp_graded/steenrod/morphism.py +++ b/src/sage/modules/fp_graded/steenrod/morphism.py @@ -280,7 +280,7 @@ def _resolve_kernel(self, top_dim=None, verbose=False): OUTPUT: A homomorphism `j: F \rightarrow D` where `D` is the domain of this homomorphism, `F` is free and such that `\ker(self) = \operatorname{im}(j)`. - TESTS: + TESTS:: sage: from sage.modules.fp_graded.steenrod.module import SteenrodFPModule sage: A = SteenrodAlgebra(2) @@ -328,7 +328,7 @@ def _resolve_image(self, top_dim=None, verbose=False): of this homomorphism, `F` is free, and `\operatorname{im}(self) = \operatorname{im}(j)`. - TESTS: + TESTS:: sage: from sage.modules.fp_graded.steenrod.module import SteenrodFPModule sage: A = SteenrodAlgebra(2) @@ -348,7 +348,7 @@ def _action(self, method, *args, **kwds): Changes the ground ring to a finite algebra, acts by the given method and changes back into the original ground ring before returning. - TESTS: + TESTS:: sage: from sage.modules.fp_graded.steenrod.module import SteenrodFPModule sage: from sage.modules.fp_graded.morphism import FPModuleMorphism diff --git a/src/sage/modules/free_module.py b/src/sage/modules/free_module.py index 628ffb636c8..deb966b9e7f 100644 --- a/src/sage/modules/free_module.py +++ b/src/sage/modules/free_module.py @@ -5321,7 +5321,7 @@ def echelonized_basis_matrix(self): def _echelon_matrix_richcmp(self, other, op): r""" - Compare the free module ``self`` with ``other`. + Compare the free module ``self`` with ``other``. This compares modules by their ambient spaces, then by dimension, then in order by their echelon matrices. However, if diff --git a/src/sage/modules/quotient_module.py b/src/sage/modules/quotient_module.py index fbb370a018c..f7aa99210a1 100644 --- a/src/sage/modules/quotient_module.py +++ b/src/sage/modules/quotient_module.py @@ -155,7 +155,7 @@ def _coerce_map_from_(self, M): """ Return a coercion map from `M` to ``self``, or ``None``. - TESTS: + TESTS:: sage: S. = PolynomialRing(QQ) sage: M = S**2 diff --git a/src/sage/modules/vector_space_homspace.py b/src/sage/modules/vector_space_homspace.py index 75727ba261d..13004ea14ce 100644 --- a/src/sage/modules/vector_space_homspace.py +++ b/src/sage/modules/vector_space_homspace.py @@ -249,14 +249,17 @@ def __call__(self, A, check=True, **kwds): - ``A`` - one of several possible inputs representing a morphism from this vector space homspace. + - a vector space morphism in this homspace - a matrix representation relative to the bases of the vector spaces, which acts on a vector placed to the left of the matrix - a list or tuple containing images of the domain's basis vectors - a function from the domain to the codomain + - ``check`` (default: True) - ``True`` or ``False``, required for compatibility with calls from :meth:`sage.structure.parent.Parent.hom`. + - the keyword ``side`` can be assigned the values ``"left"`` or ``"right"``. It corresponds to the side of vectors relative to the matrix. diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py index bde55df0df4..c14518af570 100644 --- a/src/sage/parallel/decorate.py +++ b/src/sage/parallel/decorate.py @@ -232,7 +232,7 @@ def _sage_argspec_(self): """ Returns the argument specification for this object, which is just the argument specification for the underlying function. - See :module:`sage.misc.sageinspect` for more information on + See :mod:`sage.misc.sageinspect` for more information on this convention. EXAMPLES:: @@ -252,7 +252,7 @@ def _sage_src_(self): """ Returns the source code for this object, which is just the source code for the underlying function. See - :module:`sage.misc.sageinspect` for more information on this + :mod:`sage.misc.sageinspect` for more information on this convention. EXAMPLES:: @@ -269,10 +269,10 @@ def _sage_src_(self): return sage_getsource(self.func) def _instancedoc_(self): - """ + r""" Returns the docstring for this object, which is just the docstring for the underlying function. See - :module:`sage.misc.sageinspect` for more information on this + :mod:`sage.misc.sageinspect` for more information on this convention. EXAMPLES:: diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py index b80f61dc3c2..e779e1210e3 100644 --- a/src/sage/plot/graphics.py +++ b/src/sage/plot/graphics.py @@ -1331,6 +1331,7 @@ def _set_scale(self, subplot, scale=None, base=None): only for internal use. INPUT: + - ``subplot`` -- matplotlib Axes instance. - ``scale`` -- the scale of the figure. Values it can take are ``"linear"``, ``"loglog"``, ``"semilogx"``, ``"semilogy"``. See @@ -2482,13 +2483,13 @@ def _get_vmin_vmax(self, vmin, vmax, basev, axes_pad): plot; otherwise the reader may assume that the scale is linear. For internal use only. - We check if this case occurs (for e.g. assuming xmin < xmax): + We check if this case occurs (for e.g. assuming xmin < xmax):: floor(logxmin) ceil(logxmax) ----|---------+----------+----------|----------------------|-- logxmin logxmax - Or if this case occurs (assuming xmin < xmax): + Or if this case occurs (assuming xmin < xmax):: floor(logxmin) floor(logxmax) ceil(logxmax) ----|---------+---------------------|-----+----------------|-- diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py index ba571ef5f92..95735332b72 100644 --- a/src/sage/plot/plot.py +++ b/src/sage/plot/plot.py @@ -2064,7 +2064,7 @@ def _plot(funcs, xrange, parametric=False, OUTPUT: a ``Graphics`` object - EXAMPLES:: + EXAMPLES: See :func:`plot` for many, many implicit examples. Here is an explicit one:: @@ -2106,8 +2106,6 @@ def _plot(funcs, xrange, parametric=False, sage: q2 Graphics object consisting of 2 graphics primitives - :: - Make sure that we don't get multiple legend labels for plot segments (:trac:`11998`):: diff --git a/src/sage/plot/plot3d/list_plot3d.py b/src/sage/plot/plot3d/list_plot3d.py index 4c04f5f99ef..417b9a3528a 100644 --- a/src/sage/plot/plot3d/list_plot3d.py +++ b/src/sage/plot/plot3d/list_plot3d.py @@ -506,6 +506,7 @@ def list_plot3d_tuples(v, interpolation_type, **kwds): pi = float(pi) m = matrix(RDF, 6, [sin(i**2 + j**2) for i in np.linspace(0,pi,6) for j in np.linspace(0,pi,6)]) sphinx_plot(list_plot3d(m, color='yellow', interpolation_type='spline', frame_aspect_ratio=[1, 1, 1/3])) + :: sage: show(list_plot3d([[1, 1, 1], [1, 2, 1], [0, 1, 3], [1, 0, 4]], point_list=True)) diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py index 615390ebb8c..8e34bcc297b 100644 --- a/src/sage/plot/streamline_plot.py +++ b/src/sage/plot/streamline_plot.py @@ -108,7 +108,7 @@ def _repr_(self): sage: P[0] StreamlinePlot defined by a 20 x 20 vector grid - TESTS: + TESTS:: sage: x, y = var('x y') sage: P = streamline_plot((sin(x), cos(y)), (x,-3,3), (y,-3,3), wrong_option='nonsense') diff --git a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py index 4ca4a0d0910..bce9d38ed3f 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py +++ b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py @@ -210,7 +210,7 @@ def __init__(self, Q): def __repr__(self): - """ + r""" Print the local conditions. INPUT: diff --git a/src/sage/repl/rich_output/backend_emacs.py b/src/sage/repl/rich_output/backend_emacs.py index 820682a046c..c1c54a27ea6 100644 --- a/src/sage/repl/rich_output/backend_emacs.py +++ b/src/sage/repl/rich_output/backend_emacs.py @@ -78,7 +78,7 @@ def default_preferences(self): return DisplayPreferences() def displayhook(self, plain_text, rich_output): - """ + r""" Backend implementation of the displayhook INPUT: diff --git a/src/sage/rings/asymptotic/term_monoid.py b/src/sage/rings/asymptotic/term_monoid.py index 53dfbc621a1..36b3d2e4f33 100644 --- a/src/sage/rings/asymptotic/term_monoid.py +++ b/src/sage/rings/asymptotic/term_monoid.py @@ -1916,7 +1916,7 @@ def _validate_growth_or_error_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -1976,7 +1976,7 @@ def _validate_coefficient_or_error_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -2068,7 +2068,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -2991,7 +2991,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -3588,7 +3588,7 @@ def _validate_coefficient_or_error_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -3676,7 +3676,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -4453,7 +4453,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: @@ -4995,7 +4995,7 @@ def _convert_construction_(self, kwds_construction): - ``kwds_construction`` -- a dictionary representing the keyword arguments of a term in its construction (see also :meth:`GenericTerm.construction` and - :meth:`TermWithCoefficient.construction`) + :meth:`TermWithCoefficient.construction`) OUTPUT: diff --git a/src/sage/rings/complex_interval_field.py b/src/sage/rings/complex_interval_field.py index b27b8905c94..f5a4693c98a 100644 --- a/src/sage/rings/complex_interval_field.py +++ b/src/sage/rings/complex_interval_field.py @@ -12,7 +12,7 @@ - Carl Witty (2007-10-24): rewrite for intervals -- Niles Johnson (2010-08): :Trac:`3893`: ``random_element()`` +- Niles Johnson (2010-08): :trac:`3893`: ``random_element()`` should pass on ``*args`` and ``**kwds``. - Travis Scrimshaw (2012-10-18): Added documentation to get full coverage. diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index 190d0329efc..a05d9ae3fae 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -941,7 +941,7 @@ def _residue_field(self, name=None): def to_V(e): """ - An example to show the idea: Suppose that + An example to show the idea: Suppose that:: [x 0 0] M = [0 1 0] and v = (x^10, x^7 + x^3, x^7 + x^4 + x^3 + 1) diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py index 39ab3ceca09..7e863142524 100644 --- a/src/sage/rings/number_field/bdd_height.py +++ b/src/sage/rings/number_field/bdd_height.py @@ -454,14 +454,14 @@ def rational_in(x, y): def delta_approximation(x, delta): r""" - Compute a rational number in range (x-delta, x+delta) + Compute a rational number in range `(x-delta, x+delta)` """ return rational_in(x - delta, x + delta) def vector_delta_approximation(v, delta): r""" - Compute a rational vector w=(w1, ..., wn) - such that |vi-wi| 1`, although the algorithm works fine for the case `M = 1` - - ``invariant`` -- string (default: "both"``); options are: + - ``invariant`` -- string (default: ``"both"``); options are: - "both" -- both modular degree and congruence number at level `MN` are computed diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 8b5c41356fe..8184e86a7dc 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -414,7 +414,7 @@ def _eval(self, P): INPUT: a sequence of 3 coordinates defining a point on ``self`` - OUTPUT: the result of evaluating ``self'' at the given point + OUTPUT: the result of evaluating ``self`` at the given point EXAMPLES:: diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 4df16edf3b2..13617317e4b 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -586,7 +586,7 @@ def _eval(self, P): INPUT: a sequence of 3 coordinates defining a point on ``self`` - OUTPUT: the result of evaluating ``self'' at the given point + OUTPUT: the result of evaluating ``self`` at the given point EXAMPLES:: diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py index 287cab4a49f..f7b0a1f67f0 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py @@ -76,13 +76,13 @@ def __call__(self, P): 0. A point P in J = Jac(C), returning P; 1. A point P on the curve C such that J = Jac(C), where C is - an odd degree model, returning [P - oo]; + an odd degree model, returning [P - oo]; 2. A pair of points (P, Q) on the curve C such that J = Jac(C), - returning [P-Q]; + returning [P-Q]; 3. A list of polynomials (a,b) such that `b^2 + h*b - f = 0 mod a`, - returning [(a(x),y-b(x))]. + returning [(a(x),y-b(x))]. EXAMPLES:: diff --git a/src/sage/structure/global_options.py b/src/sage/structure/global_options.py index 57c3cb74b00..a529d39cd5e 100644 --- a/src/sage/structure/global_options.py +++ b/src/sage/structure/global_options.py @@ -1384,7 +1384,7 @@ def __getstate__(self): def __eq__(self, other): r""" - Two options classes are equal if they return the same :meth:`__getstate__. + Two options classes are equal if they return the same :meth:`__getstate__`. EXAMPLES:: diff --git a/src/sage/structure/sequence.py b/src/sage/structure/sequence.py index 49fa26c7490..6cdaa84e4ef 100644 --- a/src/sage/structure/sequence.py +++ b/src/sage/structure/sequence.py @@ -405,7 +405,7 @@ class Sequence_generic(sage.structure.sage_object.SageObject, list): """ def __init__(self, x, universe=None, check=True, immutable=False, cr=False, cr_str=None, use_sage_types=False): - """ + r""" Create a sequence. EXAMPLES:: @@ -685,7 +685,7 @@ def _latex_(self): return list_latex_function(self) def __str__(self): - """ + r""" EXAMPLES:: sage: s = Sequence([1,2,3], cr=False) diff --git a/src/sage/symbolic/expression_conversions.py b/src/sage/symbolic/expression_conversions.py index 112e0d0f494..e681f480589 100644 --- a/src/sage/symbolic/expression_conversions.py +++ b/src/sage/symbolic/expression_conversions.py @@ -2108,7 +2108,7 @@ def __init__(self, ex, *args): sage: s(1/foo(foo(x)) + foo(2)) 1/bar(bar(x)) + bar(2) - TESTS:: + TESTS: Check that the old syntax still works:: diff --git a/src/sage/symbolic/integration/external.py b/src/sage/symbolic/integration/external.py index 7e91380de60..0760f20920b 100644 --- a/src/sage/symbolic/integration/external.py +++ b/src/sage/symbolic/integration/external.py @@ -94,8 +94,6 @@ def mma_free_integrator(expression, v, a=None, b=None): sage: result.simplify_trig() # optional - internet -1/2*cos(y)*sin(y) + 1/2*y - :: - Check that :trac:`14764` is resolved:: sage: integrate(x^2, x, 0, 1, algorithm="mathematica_free") # optional - internet diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index 17de6efc581..fc6f9c36f71 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -2233,7 +2233,7 @@ def _homology_(self, dim=None, base_ring=ZZ, subcomplex=None, :type reduced: boolean; optional, default ``True`` :param generators: If ``True``, return the homology groups and - also generators for them. + also generators for them. :type reduced: boolean; optional, default ``False`` diff --git a/src/tox.ini b/src/tox.ini index f5ade5edd2d..4d46c4f5ff3 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -21,7 +21,7 @@ ## in a virtual environment. ## [tox] -envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell +envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst # When adding environments above, also update the delegations in SAGE_ROOT/tox.ini skipsdist = true @@ -173,6 +173,49 @@ commands = codespell \ --ignore-words={toxinidir}/.codespell-ignore.txt \ {posargs:{toxinidir}/sage/} +[testenv:rst] +description = + validate Python docstrings markup as reStructuredText +deps = flake8-rst-docstrings +commands = flake8 --select=RST {posargs:{toxinidir}/sage/} + +[flake8] +rst-roles = + # Sphinx + doc, + file, + ref, + # Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#the-standard-domain (selection) + envvar, + # Sphinx - https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects + attr, + class, + const, + data, + exc, + func, + meth, + mod, + obj, + # from src/sage/misc/sagedoc.py + arxiv, + doi, + mathscinet, + oeis, + pari, + python, + trac, + wikipedia +rst-directives = + automethod, + ONLY, + PLOT, + SEEALSO, + TODO +extend-ignore = + # Ignore RST306 Unknown target name -- because of references to the global bibliography + RST306 + [pytest] python_files = *_test.py norecursedirs = local prefix venv build pkgs .git src/doc src/bin diff --git a/tox.ini b/tox.ini index e445ad45d2d..ff0f1b690b4 100644 --- a/tox.ini +++ b/tox.ini @@ -750,3 +750,11 @@ passenv = {[sage_src]passenv} envdir = {[sage_src]envdir} commands = {[sage_src]commands} whitelist_externals = {[sage_src]whitelist_externals} + +[testenv:rst] +description = + validate Python docstrings markup as reStructuredText +passenv = {[sage_src]passenv} +envdir = {[sage_src]envdir} +commands = {[sage_src]commands} +whitelist_externals = {[sage_src]whitelist_externals}