Skip to content

Commit

Permalink
gh-36968: fix alignment in documentation (ruff D207 and D208)
Browse files Browse the repository at this point in the history
    
this used ruff with code D207 and D208 to auto-fix many alignement
issues in our documentation

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
    
URL: #36968
Reported by: Frédéric Chapoton
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Jan 12, 2024
2 parents 5f8cf2f + 18bfaa9 commit 9e160d3
Show file tree
Hide file tree
Showing 109 changed files with 196 additions and 192 deletions.
2 changes: 1 addition & 1 deletion src/sage/algebras/free_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def _element_constructor_(self, x):
sage: (F.1*L.2).parent() is F
True
::
::
sage: # needs sage.libs.singular sage.rings.finite_rings
sage: K.<z> = GF(25)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/free_algebra_quotient.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def monoid(self):
"""
The free monoid of generators of the algebra.
EXAMPLES::
EXAMPLES::
sage: sage.algebras.free_algebra_quotient.hamilton_quatalg(QQ)[0].monoid()
Free monoid on 3 generators (i0, i1, i2)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/additive_magmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ def __bool__(self):
False
sage: bool(S.an_element())
True
"""
"""

def _test_nonzero_equal(self, **options):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/algebra_functor.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def group(self):
sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
sage: GroupAlgebraFunctor(CyclicPermutationGroup(17)).group() == CyclicPermutationGroup(17)
True
"""
"""
return self.__group

def _apply_functor(self, base_ring):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ def has_full_support(self):
sage: w = W.from_reduced_word([1,2,1,0,1])
sage: w.has_full_support()
True
"""
"""
return self.support() == set(self.parent().index_set())

def reduced_word_graph(self):
Expand Down Expand Up @@ -3155,7 +3155,7 @@ def kazhdan_lusztig_cell(self, side='left'):
sage: s1.kazhdan_lusztig_cell()
{[1], [2, 1], [3, 2, 1]}
Next, we compute a right cell and a two-sided cell in `A_3`::
Next, we compute a right cell and a two-sided cell in `A_3`::
sage: # optional - coxeter3, needs sage.combinat sage.groups sage.modules
sage: W = CoxeterGroup('A3', implementation='coxeter3')
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/enumerated_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ def random_element(self):
Traceback (most recent call last):
...
NotImplementedError: unknown cardinality
"""
"""
raise NotImplementedError("unknown cardinality")

def map(self, f, name=None, *, is_injective=True):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/examples/finite_weyl_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def product(self, x, y):
sage: s = FiniteWeylGroups().example().simple_reflections()
sage: s[1] * s[2]
(0, 2, 3, 1)
"""
"""
assert x in self
assert y in self
return self(tuple(x.value[i] for i in y.value))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/finite_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def conjugacy_classes_representatives(self):
sage: G = SymmetricGroup(3)
sage: G.conjugacy_classes_representatives()
[(), (1,2), (1,2,3)]
"""
"""
return [C.representative() for C in self.conjugacy_classes()]

class ElementMethods:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/magmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def FinitelyGenerated(self):
The use of this shorthand should be reserved for casual
interactive use or when there is no risk of ambiguity.
"""
"""
from sage.categories.additive_magmas import AdditiveMagmas
if self.is_subcategory(AdditiveMagmas()):
raise ValueError("FinitelyGenerated is ambiguous for {}.\nPlease use explicitly one of the FinitelyGeneratedAsXXX methods".format(self))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/modules_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ def __call_on_basis__(self, **options):
sage: phi(x[1] + x[3]) # needs sage.modules
0
We check that the homset category is properly set up::
We check that the homset category is properly set up::
sage: # needs sage.modules
sage: X = CombinatorialFreeModule(QQ, [1,2,3]); X.rename("X")
Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/unital_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ def one_from_one_basis(self):
sage: Aone is Bone
False
Even if called in the wrong order, they should returns their
respective one::
Even if called in the wrong order, they should returns their
respective one::
sage: Bone().parent() is B # needs sage.combinat sage.modules
True
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/alternating_sign_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ def to_semistandard_tableau(self):
[[1, 1, 2], [2, 3], [3]]
sage: parent(t)
Semistandard tableaux
"""
"""
from sage.combinat.tableau import SemistandardTableau
mt = self.to_monotone_triangle()
ssyt = [[0]*(len(mt) - j) for j in range(len(mt))]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/binary_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4099,7 +4099,7 @@ def __init__(self):
sage: B is BinaryTrees_all()
True
sage: TestSuite(B).run() # long time
"""
"""
DisjointUnionEnumeratedSets.__init__(
self, Family(NonNegativeIntegers(), BinaryTrees_size),
facade=True, keepkey=False)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/crystals/generalized_young_walls.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def Phi(self):
sage: x = crystals.infinity.GeneralizedYoungWalls(3)([[],[1,0,3,2],[2,1],[3,2,1,0,3,2],[],[],[2]])
sage: x.Phi()
2*Lambda[0] + Lambda[1] - Lambda[2] + Lambda[3]
"""
"""
La = self.cartan_type().root_system().weight_lattice(extended=True).fundamental_weights()
return sum(self.phi(i)*La[i] for i in self.index_set())

Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/diagram_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -2671,7 +2671,7 @@ def _coerce_map_from_(self, R):
-3*P{{-4, 4}, {-3, -2, -1, 1, 2, 3}}
+ 2*P{{-4, 4}, {-3, -2, 1, 2, 3}, {-1}}
+ 3*P{{-4, 4}, {-3, -1, 1, 2, 3}, {-2}}
"""
"""
# coerce from Orbit basis.
if isinstance(R, OrbitBasis):
if R._k <= self._k and self.base_ring().has_coerce_map_from(R.base_ring()):
Expand Down
6 changes: 3 additions & 3 deletions src/sage/combinat/finite_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -5564,7 +5564,7 @@ def transition(self, transition):
Transition from 'A' to 'B': 0|-
sage: id(t) == id(F.transition(('A', 'B', 0)))
True
"""
"""
if not is_FSMTransition(transition):
transition = FSMTransition(*transition)
for s in self.iter_transitions(transition.from_state):
Expand Down Expand Up @@ -13662,7 +13662,7 @@ def _transition_possible_test_(self, word_in):
False
sage: TC2._transition_possible_test_([(None, None)])
False
"""
"""
if self._transition_possible_epsilon_(word_in):
return False
word_in_transposed = wordoftuples_to_tupleofwords(word_in)
Expand Down Expand Up @@ -15170,7 +15170,7 @@ def __init__(self, *args, **kwargs):
sage: T.determine_alphabets()
sage: list(T.language(2)) # indirect doctest
[[], ['a'], ['a', 'b']]
"""
"""
max_length = kwargs.get('max_length')
if max_length is None:
kwargs['input_tape'] = itertools.count()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/interval_posets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3625,7 +3625,7 @@ def __init__(self):
sage: S is TamariIntervalPosets_all()
True
sage: TestSuite(S).run() # long time (7s)
"""
"""
DisjointUnionEnumeratedSets.__init__(
self, Family(NonNegativeIntegers(), TamariIntervalPosets_size),
facade=True, keepkey=False,
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/k_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -3984,7 +3984,7 @@ def _repr_( self ):
Set of strong 3-tableaux of shape [[2, 2], [1]] and of weight (0, 0, 2, 1)
sage: StrongTableaux(3, [[],[]], weight=[])
Set of strong 3-tableaux of shape [] and of weight ()
"""
"""
if self._inner_shape == Core([],self.k+1):
s = "Set of strong %s-tableaux" % self.k
s += " of shape %s" % self._outer_shape
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/ncsf_qsym/qsym.py
Original file line number Diff line number Diff line change
Expand Up @@ -2932,7 +2932,7 @@ def _from_monomial_on_basis(self, comp):
QS[1, 1, 1, 1, 1] - QS[1, 1, 2, 1] + QS[1, 3, 1] - QS[2, 2, 1]
sage: QS._from_monomial_on_basis(Composition([2]))
-QS[1, 1] + QS[2]
"""
"""
comp = Composition(comp)
if not comp._list:
return self.one()
Expand Down Expand Up @@ -3089,7 +3089,7 @@ def _to_monomial_on_basis(self, comp):
M[1, 1] + M[2]
sage: YQS._to_monomial_on_basis(Composition([1,3,1]))
2*M[1, 1, 1, 1, 1] + 2*M[1, 1, 2, 1] + M[1, 2, 1, 1] + M[1, 3, 1] + M[2, 1, 1, 1] + M[2, 2, 1]
"""
"""
return self._M(self._QS.monomial(comp.reversed())).star_involution()

@cached_method
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/ordered_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def __init__(self):
sage: B is OrderedTrees_all()
True
sage: TestSuite(B).run() # long time
"""
"""
DisjointUnionEnumeratedSets.__init__(
self, Family(NonNegativeIntegers(), OrderedTrees_size),
facade=True, keepkey=False)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/partition_kleshchev.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ def multicharge(self):
sage: KP = KleshchevPartitions(5, [3,0,1], 1, convention='LS')
sage: KP.multicharge()
(3, 0, 1)
"""
"""
return self._multicharge

def convention(self):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/partition_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,8 +1642,8 @@ def prime_degree(self, p):
sage: PartitionTuple([[2,1],[2,2]]).prime_degree(7)
0
Therefore, the Gram determinant of `S(2,1|2,2)` when `q=1` is
`2^{728} 3^{259}5^{105}`. Compare with :meth:`degree`.
Therefore, the Gram determinant of `S(2,1|2,2)` when `q=1` is
`2^{728} 3^{259}5^{105}`. Compare with :meth:`degree`.
"""
ps = [p]

Expand Down
54 changes: 27 additions & 27 deletions src/sage/combinat/regular_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,9 +1105,9 @@ def tensor_product(left, right):

def linear_representation_morphism_recurrence_order_1(C, D):
r"""
Return the morphism of a linear representation
for the sequence `z_n` satisfying
`z_{kn+r} = C_r z_n + D_r z_{n-1}`.
Return the morphism of a linear representation
for the sequence `z_n` satisfying
`z_{kn+r} = C_r z_n + D_r z_{n-1}`.
"""
Z = zero_matrix(C[0].dimensions()[0])

Expand Down Expand Up @@ -1870,8 +1870,8 @@ def guess(self, f, n_verify=100, max_exponent=10, sequence=None):

def values(m, lines):
"""
Return current (as defined by ``lines``) right vector valued
sequence for argument ``m``.
Return current (as defined by ``lines``) right vector valued
sequence for argument ``m``.
"""
return tuple(seq(m)) + tuple(f(k**t_R * m + r_R) for t_R, r_R in lines)

Expand All @@ -1880,12 +1880,12 @@ def values(m, lines):
# (we allow appending of new lines)
def some_inverse_U_matrix(lines):
r"""
Find an invertible `d \times d` submatrix of the matrix
``A`` described in the algorithm section of the docstring.
Find an invertible `d \times d` submatrix of the matrix
``A`` described in the algorithm section of the docstring.
The output is the inverse of the invertible submatrix and
the corresponding list of column indices (i.e., arguments to
the current right vector valued sequence).
The output is the inverse of the invertible submatrix and
the corresponding list of column indices (i.e., arguments to
the current right vector valued sequence).
"""
d = len(seq(0)) + len(lines)

Expand All @@ -1905,30 +1905,30 @@ def some_inverse_U_matrix(lines):

def linear_combination_candidate(t_L, r_L, lines):
r"""
Based on an invertible submatrix of ``A`` as described in the
algorithm section of the docstring, find a candidate for a
linear combination of the rows of ``A`` yielding the subsequence
with parameters ``t_L`` and ``r_L``, i.e.,
`m \mapsto f(k**t_L * m + r_L)`.
Based on an invertible submatrix of ``A`` as described in the
algorithm section of the docstring, find a candidate for a
linear combination of the rows of ``A`` yielding the subsequence
with parameters ``t_L`` and ``r_L``, i.e.,
`m \mapsto f(k**t_L * m + r_L)`.
"""
iU, m_indices = some_inverse_U_matrix(lines)
X_L = vector(f(k**t_L * m + r_L) for m in m_indices)
return X_L * iU

def verify_linear_combination(t_L, r_L, linear_combination, lines):
r"""
Determine whether the subsequence with parameters ``t_L`` and
``r_L``, i.e., `m \mapsto f(k**t_L * m + r_L)`, is the linear
combination ``linear_combination`` of the current vector valued
sequence.
Note that we only evaluate the subsequence of ``f`` where arguments
of ``f`` are at most ``n_verify``. This might lead to detection of
linear dependence which would not be true for higher values, but this
coincides with the documentation of ``n_verify``.
However, this is not a guarantee that the given function will never
be evaluated beyond ``n_verify``, determining an invertible submatrix
in ``some_inverse_U_matrix`` might require us to do so.
Determine whether the subsequence with parameters ``t_L`` and
``r_L``, i.e., `m \mapsto f(k**t_L * m + r_L)`, is the linear
combination ``linear_combination`` of the current vector valued
sequence.
Note that we only evaluate the subsequence of ``f`` where arguments
of ``f`` are at most ``n_verify``. This might lead to detection of
linear dependence which would not be true for higher values, but this
coincides with the documentation of ``n_verify``.
However, this is not a guarantee that the given function will never
be evaluated beyond ``n_verify``, determining an invertible submatrix
in ``some_inverse_U_matrix`` might require us to do so.
"""
return all(f(k**t_L * m + r_L) ==
linear_combination * vector(values(m, lines))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/rigged_configurations/rc_crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def __init__(self, vct, wt, WLR):
sage: La = RootSystem(['C', 3]).weight_lattice().fundamental_weights()
sage: RC = crystals.RiggedConfigurations(La[1])
sage: TestSuite(RC).run()
"""
"""
self._folded_ct = vct
CrystalOfRiggedConfigurations.__init__(self, wt, WLR)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/rigged_configurations/rc_infinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def __init__(self, vct):
sage: vct = CartanType(['C', 2, 1]).as_folding()
sage: RC = crystals.infinity.RiggedConfigurations(vct)
sage: TestSuite(RC).run() # long time
"""
"""
self._folded_ct = vct
InfinityCrystalOfRiggedConfigurations.__init__(self, vct._cartan_type)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ def __init__(self, cartan_type, dims):
sage: TestSuite(RC).run() # long time
sage: RC = RiggedConfigurations(['A',5,2], [[2,1]])
sage: TestSuite(RC).run() # long time
"""
"""
self._folded_ct = cartan_type.as_folding()
RiggedConfigurations.__init__(self, cartan_type, dims)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/cartan_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ def symmetrizer(self):
O=<=O---O---O---O=<=O
1 2 2 2 2 4
Here is the symmetrizer of some reducible Cartan types::
Here is the symmetrizer of some reducible Cartan types::
sage: T = CartanType(["D", 2])
sage: print(T.ascii_art(T.symmetrizer().__getitem__)) # needs sage.graphs
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/root_system/reflection_group_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ def conjugacy_classes(self):
sage: W = ReflectionGroup(23)
sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality()
True
"""
"""
return Family(self.conjugacy_classes_representatives(),
lambda w: w.conjugacy_class())

Expand Down Expand Up @@ -1160,7 +1160,7 @@ def reflection_eigenvalues_family(self):
(1,23,26,29,22,16,8,11,14,7)(2,10,4,9,18,17,25,19,24,3)(5,21,27,30,28,20,6,12,15,13) [1/10, 1/2, 9/10]
(1,24,17,16,9,2)(3,12,13,18,27,28)(4,21,29,19,6,14)(5,25,26,20,10,11)(7,23,30,22,8,15) [1/6, 1/2, 5/6]
(1,29,8,7,26,16,14,23,22,11)(2,9,25,3,4,17,24,10,18,19)(5,30,6,13,27,20,15,21,28,12) [3/10, 1/2, 7/10]
"""
"""
class_representatives = self.conjugacy_classes_representatives()
Ev_list = self._gap_group.ReflectionEigenvalues().sage()
return Family(class_representatives,
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/type_E.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, root_system, baseRing):
sage: e = RootSystem(['E',8]).ambient_space()
sage: [e.weyl_dimension(v) for v in e.fundamental_weights()]
[3875, 147250, 6696000, 6899079264, 146325270, 2450240, 30380, 248]
"""
"""
v = ZZ(1)/ZZ(2)
self.rank = root_system.cartan_type().rank()
ambient_space.AmbientSpace.__init__(self, root_system, baseRing)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/type_G.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def simple_root(self, i):
sage: CartanType(['G',2]).root_system().ambient_space().simple_roots()
Finite family {1: (0, 1, -1), 2: (1, -2, 1)}
"""
"""
return self.monomial(1)-self.monomial(2) if i == 1 else self.monomial(0)-2*self.monomial(1)+self.monomial(2)

def positive_roots(self):
Expand Down
Loading

0 comments on commit 9e160d3

Please sign in to comment.