Skip to content

Commit f8d7d6d

Browse files
author
Release Manager
committed
gh-36897: some ruff fixes (UP034 and UP039 codes) and error links in categories Adding a few links on errors in the doc Also fixing a few ruff UP details ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36897 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents f3b3945 + fae6798 commit f8d7d6d

21 files changed

+59
-52
lines changed

src/sage/categories/algebras_with_basis.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
r"""
22
Algebras With Basis
33
"""
4-
#*****************************************************************************
4+
# ****************************************************************************
55
# Copyright (C) 2008 Teresa Gomez-Diaz (CNRS) <[email protected]>
66
# 2008-2013 Nicolas M. Thiery <nthiery at users.sf.net>
77
#
88
# Distributed under the terms of the GNU General Public License (GPL)
99
# https://www.gnu.org/licenses/
10-
#******************************************************************************
10+
# *****************************************************************************
1111

1212
from sage.categories.cartesian_product import CartesianProductsCategory
1313
from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring
@@ -106,7 +106,7 @@ class AlgebrasWithBasis(CategoryWithAxiom_over_base_ring):
106106
sage: TestSuite(AlgebrasWithBasis(QQ)).run()
107107
"""
108108

109-
def example(self, alphabet=('a','b','c')):
109+
def example(self, alphabet=('a', 'b', 'c')):
110110
"""
111111
Return an example of algebra with basis.
112112
@@ -259,7 +259,7 @@ def one_from_cartesian_product_of_one_basis(self):
259259
....: SymmetricGroupAlgebra(QQ, 4)]).one()
260260
B[(0, [1, 2, 3])] + B[(1, [1, 2, 3, 4])]
261261
"""
262-
return self.sum_of_monomials( zip( self._sets_keys(), (set.one_basis() for set in self._sets)) )
262+
return self.sum_of_monomials(zip(self._sets_keys(), (set.one_basis() for set in self._sets)))
263263

264264
@lazy_attribute
265265
def one(self):
@@ -370,7 +370,8 @@ def product_on_basis(self, t1, t2):
370370
371371
TODO: optimize this implementation!
372372
"""
373-
return tensor( (module.monomial(x1)*module.monomial(x2) for (module, x1, x2) in zip(self._sets, t1, t2)) ) #.
373+
return tensor(module.monomial(x1) * module.monomial(x2)
374+
for module, x1, x2 in zip(self._sets, t1, t2))
374375

375376
class ElementMethods:
376377
"""

src/sage/categories/category.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def an_instance(cls):
565565
def __call__(self, x, *args, **opts):
566566
"""
567567
Construct an object in this category from the data in ``x``,
568-
or throw ``TypeError`` or ``NotImplementedError``.
568+
or throw :class:`TypeError` or :class:`NotImplementedError`.
569569
570570
If ``x`` is readily in ``self`` it is returned unchanged.
571571
Categories wishing to extend this minimal behavior should
@@ -583,7 +583,7 @@ def __call__(self, x, *args, **opts):
583583
def _call_(self, x):
584584
"""
585585
Construct an object in this category from the data in ``x``,
586-
or throw ``NotImplementedError``.
586+
or throw :class:`NotImplementedError`.
587587
588588
EXAMPLES::
589589

src/sage/categories/coxeter_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ def _test_reduced_word(self, **options):
701701
for x in tester.some_elements():
702702
red = x.reduced_word()
703703
tester.assertEqual(self.from_reduced_word(red), x)
704-
tester.assertEqual(self.prod((s[i] for i in red)), x)
704+
tester.assertEqual(self.prod(s[i] for i in red), x)
705705

706706
def simple_projection(self, i, side='right', length_increasing=True):
707707
r"""

src/sage/categories/crystals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def _Hom_(self, Y, category=None, **options):
578578
The sole purpose of this method is to construct the homset
579579
as a :class:`~sage.categories.crystals.CrystalHomset`. If
580580
``category`` is specified and is not a subcategory of
581-
:class:`Crystals`, a ``TypeError`` is raised instead.
581+
:class:`Crystals`, a :class:`TypeError` is raised instead.
582582
583583
This method is not meant to be called directly. Please use
584584
:func:`sage.categories.homset.Hom` instead.

src/sage/categories/enumerated_sets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ def __iter__(self):
182182
It is also possible to override ``__iter__`` method itself. Then
183183
the methods of the first column are defined using ``__iter__``
184184
185-
If none of these are provided, raise a ``NotImplementedError``.
185+
If none of these are provided, this raises
186+
a :class:`NotImplementedError`.
186187
187188
EXAMPLES:
188189
@@ -928,7 +929,7 @@ def random_element(self):
928929
the probability is uniform.
929930
930931
This is a generic implementation from the category
931-
``EnumeratedSets()``. It raise a ``NotImplementedError``
932+
``EnumeratedSets()``. It raises a :class:`NotImplementedError`
932933
since one does not know whether the set is finite.
933934
934935
EXAMPLES::

src/sage/categories/facade_sets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ def _an_element_(self):
209209
210210
For each parent ``self`` is a facade for, this default
211211
implementation tries the method ``an_element`` until it finds an
212-
element in ``self``. If none is found raise a
213-
``NotImplementedError``.
212+
element in ``self``. If none is found, this raises a
213+
:class:`NotImplementedError`.
214214
215215
EXAMPLES::
216216

src/sage/categories/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ def inverse_of_unit(self):
808808
1/2
809809
810810
Trying to invert the zero element typically raises a
811-
``ZeroDivisionError``::
811+
:class:`ZeroDivisionError`::
812812
813813
sage: QQ(0).inverse_of_unit()
814814
Traceback (most recent call last):

src/sage/categories/filtered_modules_with_basis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def basis(self, d=None):
156156
over Integer Ring(i))_{i in Partitions}
157157
158158
Checking this method on a filtered algebra. Note that this
159-
will typically raise a ``NotImplementedError`` when this
159+
will typically raise a :class:`NotImplementedError` when this
160160
feature is not implemented. ::
161161
162162
sage: A = AlgebrasWithBasis(ZZ).Filtered().example()

src/sage/categories/finite_groups.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ def conjugacy_classes(self):
153153
Return a list with all the conjugacy classes of the group.
154154
155155
This will eventually be a fall-back method for groups not defined
156-
over GAP. Right now just raises a ``NotImplementedError``, until
157-
we include a non-GAP way of listing the conjugacy classes
158-
representatives.
156+
over GAP. Right now, it just raises a
157+
:class:`NotImplementedError`, until we include a non-GAP
158+
way of listing the conjugacy classes representatives.
159159
160160
EXAMPLES::
161161

src/sage/categories/finite_posets.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ def birational_toggle(self, v, labelling):
906906
encoded to be understood by Sage. This implementation allows
907907
`\mathbf{K}` to be a semifield, not just a field. The birational
908908
`v`-toggle is only a rational map, so an exception (most
909-
likely, ``ZeroDivisionError``) will be thrown if the
909+
likely, :class:`ZeroDivisionError`) will be thrown if the
910910
denominator is zero.
911911
912912
INPUT:
@@ -1121,7 +1121,7 @@ def birational_toggles(self, vs, labelling):
11211121
encoded to be understood by Sage. This implementation allows
11221122
`\mathbf{K}` to be a semifield, not just a field. The birational
11231123
`v`-toggle is only a rational map, so an exception (most
1124-
likely, ``ZeroDivisionError``) will be thrown if the
1124+
likely, :class:`ZeroDivisionError`) will be thrown if the
11251125
denominator is zero.
11261126
11271127
INPUT:
@@ -1194,9 +1194,10 @@ def birational_rowmotion(self, labelling):
11941194
`\mathbf{K}`-labellings and for an explanation of how
11951195
`\mathbf{K}`-labellings are to be encoded to be understood
11961196
by Sage. This implementation allows `\mathbf{K}` to be a
1197-
semifield, not just a field. Birational rowmotion is only a
1198-
rational map, so an exception (most likely, ``ZeroDivisionError``)
1199-
will be thrown if the denominator is zero.
1197+
semifield, not just a field. Birational rowmotion is only
1198+
a rational map, so an exception (most likely,
1199+
:class:`ZeroDivisionError`) will be thrown if the
1200+
denominator is zero.
12001201
12011202
INPUT:
12021203

0 commit comments

Comments
 (0)