Skip to content

Commit 4f3a9b0

Browse files
author
Release Manager
committed
Trac #34468: fix W605 in all pyx files inside matroids/
this is about W605 invalid escape sequence namely, missing r prefix in some docstrings using latex code, mostly URL: https://trac.sagemath.org/34468 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): David Coudert
2 parents bfa6342 + b7ddb8f commit 4f3a9b0

7 files changed

+37
-36
lines changed

src/sage/algebras/exterior_algebra_groebner.pyx

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ AUTHORS:
99
- Trevor K. Karn, Travis Scrimshaw (July 2022): Initial implementation
1010
"""
1111

12-
#*****************************************************************************
12+
# ****************************************************************************
1313
# Copyright (C) 2022 Trevor K. Karn <karnx018 at umn.edu>
1414
# (C) 2022 Travis Scrimshaw <tcscrims at gmail.com>
1515
#
1616
# This program is free software: you can redistribute it and/or modify
1717
# it under the terms of the GNU General Public License as published by
1818
# the Free Software Foundation, either version 2 of the License, or
1919
# (at your option) any later version.
20-
# http://www.gnu.org/licenses/
21-
#*****************************************************************************
20+
# https://www.gnu.org/licenses/
21+
# ****************************************************************************
2222

2323
from cysignals.signals cimport sig_check
2424
from sage.libs.gmp.mpz cimport mpz_sizeinbase, mpz_setbit, mpz_tstbit, mpz_cmp_si, mpz_sgn
@@ -137,7 +137,7 @@ cdef class GroebnerStrategy:
137137
return self.int_to_bitset(max(self.bitset_to_int(k) for k in mc))
138138

139139
cdef inline partial_S_poly_left(self, GBElement f, GBElement g):
140-
"""
140+
r"""
141141
Compute one half of the `S`-polynomial for ``f`` and ``g``.
142142
143143
This computes:
@@ -154,7 +154,7 @@ cdef class GroebnerStrategy:
154154
return ret
155155

156156
cdef inline partial_S_poly_right(self, GBElement f, GBElement g):
157-
"""
157+
r"""
158158
Compute one half of the `S`-polynomial for ``f`` and ``g``.
159159
160160
This computes:

src/sage/matroids/basis_exchange_matroid.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2115,7 +2115,7 @@ cdef class BasisExchangeMatroid(Matroid):
21152115
return EQ[0]
21162116

21172117
cpdef _is_isomorphism(self, other, morphism):
2118-
"""
2118+
r"""
21192119
Version of is_isomorphism() that does no type checking.
21202120
21212121
INPUT:

src/sage/matroids/basis_matroid.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1280,8 +1280,9 @@ cdef long set_to_index(bitset_t S):
12801280
s = bitset_next(S, s + 1)
12811281
return index
12821282

1283+
12831284
cdef index_to_set(bitset_t S, long index, long k, long n):
1284-
"""
1285+
r"""
12851286
Compute the k-subset of `\{0, ..., n-1\}` of rank index
12861287
"""
12871288
bitset_clear(S)

src/sage/matroids/extension.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ cdef class LinearSubclassesIter:
248248

249249

250250
cdef class LinearSubclasses:
251-
"""
251+
r"""
252252
An iterable set of linear subclasses of a matroid.
253253
254254
Enumerate linear subclasses of a given matroid. A *linear subclass* is a
@@ -412,7 +412,7 @@ cdef class LinearSubclasses:
412412

413413

414414
cdef class MatroidExtensions(LinearSubclasses):
415-
"""
415+
r"""
416416
An iterable set of single-element extensions of a given matroid.
417417
418418
INPUT:

src/sage/matroids/linear_matroid.pyx

+15-15
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ cdef class LinearMatroid(BasisExchangeMatroid):
761761
return {e: R[self._idx[e]] for e in self.groundset()}
762762

763763
cpdef LeanMatrix _reduced_representation(self, B=None):
764-
"""
764+
r"""
765765
Return a reduced representation of the matroid, i.e. a matrix `R` such
766766
that `[I\ \ R]` represents the matroid.
767767
@@ -800,7 +800,7 @@ cdef class LinearMatroid(BasisExchangeMatroid):
800800
# (field) isomorphism
801801

802802
cpdef bint _is_field_isomorphism(self, LinearMatroid other, morphism): # not safe if self == other
803-
"""
803+
r"""
804804
Version of :meth:`<LinearMatroid.is_field_isomorphism>` that does no
805805
type checking.
806806
@@ -966,7 +966,7 @@ cdef class LinearMatroid(BasisExchangeMatroid):
966966
return self._is_field_isomorphism(other, morphism)
967967

968968
cpdef is_field_isomorphism(self, other, morphism):
969-
"""
969+
r"""
970970
Test if a provided morphism induces a bijection between represented
971971
matroids.
972972
@@ -1322,7 +1322,7 @@ cdef class LinearMatroid(BasisExchangeMatroid):
13221322
return type(self)(reduced_matrix=M, groundset=rows + cols)
13231323

13241324
cpdef dual(self):
1325-
"""
1325+
r"""
13261326
Return the dual of the matroid.
13271327
13281328
Let `M` be a matroid with ground set `E`. If `B` is the set of bases
@@ -1354,7 +1354,7 @@ cdef class LinearMatroid(BasisExchangeMatroid):
13541354
return type(self)(reduced_matrix=R, groundset=cols + rows)
13551355

13561356
cpdef has_line_minor(self, k, hyperlines=None, certificate=False):
1357-
"""
1357+
r"""
13581358
Test if the matroid has a `U_{2, k}`-minor.
13591359
13601360
The matroid `U_{2, k}` is a matroid on `k` elements in which every
@@ -3130,7 +3130,7 @@ cdef class BinaryMatroid(LinearMatroid):
31303130
self._one = GF2_one
31313131

31323132
cpdef base_ring(self):
3133-
"""
3133+
r"""
31343134
Return the base ring of the matrix representing the matroid,
31353135
in this case `\GF{2}`.
31363136
@@ -3308,7 +3308,7 @@ cdef class BinaryMatroid(LinearMatroid):
33083308
return self._A.copy() # Deprecated Sage matrix operation
33093309

33103310
cpdef LeanMatrix _reduced_representation(self, B=None):
3311-
"""
3311+
r"""
33123312
Return a reduced representation of the matroid, i.e. a matrix `R` such
33133313
that `[I\ \ R]` represents the matroid.
33143314
@@ -4197,7 +4197,7 @@ cdef class TernaryMatroid(LinearMatroid):
41974197
self._two = GF3_minus_one
41984198

41994199
cpdef base_ring(self):
4200-
"""
4200+
r"""
42014201
Return the base ring of the matrix representing the matroid, in this
42024202
case `\GF{3}`.
42034203
@@ -4381,7 +4381,7 @@ cdef class TernaryMatroid(LinearMatroid):
43814381
return self._A.copy() # Deprecated Sage matrix operation
43824382

43834383
cpdef LeanMatrix _reduced_representation(self, B=None):
4384-
"""
4384+
r"""
43854385
Return a reduced representation of the matroid, i.e. a matrix `R`
43864386
such that `[I\ \ R]` represents the matroid.
43874387
@@ -4563,7 +4563,7 @@ cdef class TernaryMatroid(LinearMatroid):
45634563
return self._t_invariant
45644564

45654565
cpdef bicycle_dimension(self):
4566-
"""
4566+
r"""
45674567
Return the bicycle dimension of the ternary matroid.
45684568
45694569
The bicycle dimension of a linear subspace `V` is
@@ -5096,7 +5096,7 @@ cdef class QuaternaryMatroid(LinearMatroid):
50965096
self._x_one = (<QuaternaryMatrix>self._A)._x_one
50975097

50985098
cpdef base_ring(self):
5099-
"""
5099+
r"""
51005100
Return the base ring of the matrix representing the matroid, in this
51015101
case `\GF{4}`.
51025102
@@ -5273,7 +5273,7 @@ cdef class QuaternaryMatroid(LinearMatroid):
52735273
return self._A.copy() # Deprecated Sage matrix operation
52745274

52755275
cpdef LeanMatrix _reduced_representation(self, B=None):
5276-
"""
5276+
r"""
52775277
Return a reduced representation of the matroid, i.e. a matrix `R` such
52785278
that `[I\ \ R]` represents the matroid.
52795279
@@ -5413,7 +5413,7 @@ cdef class QuaternaryMatroid(LinearMatroid):
54135413
return self._q_invariant
54145414

54155415
cpdef bicycle_dimension(self):
5416-
"""
5416+
r"""
54175417
Return the bicycle dimension of the quaternary matroid.
54185418
54195419
The bicycle dimension of a linear subspace `V` is
@@ -5810,7 +5810,7 @@ cdef class RegularMatroid(LinearMatroid):
58105810
return P
58115811

58125812
cpdef base_ring(self):
5813-
"""
5813+
r"""
58145814
Return the base ring of the matrix representing the matroid, in this
58155815
case `\ZZ`.
58165816
@@ -6230,7 +6230,7 @@ cdef class RegularMatroid(LinearMatroid):
62306230
return {e:idx[m[str(e)]] for e in self.groundset() if str(e) in m}
62316231

62326232
cpdef has_line_minor(self, k, hyperlines=None, certificate=False):
6233-
"""
6233+
r"""
62346234
Test if the matroid has a `U_{2, k}`-minor.
62356235
62366236
The matroid `U_{2, k}` is a matroid on `k` elements in which every

src/sage/matroids/matroid.pyx

+11-11
Original file line numberDiff line numberDiff line change
@@ -3150,7 +3150,7 @@ cdef class Matroid(SageObject):
31503150
return Polyhedron(vertices)
31513151

31523152
def independence_matroid_polytope(self):
3153-
"""
3153+
r"""
31543154
Return the independence matroid polytope of ``self``.
31553155
31563156
This is defined as the convex hull of the vertices
@@ -3430,7 +3430,7 @@ cdef class Matroid(SageObject):
34303430
return self._is_isomorphism(other, morphism)
34313431

34323432
cpdef is_isomorphism(self, other, morphism):
3433-
"""
3433+
r"""
34343434
Test if a provided morphism induces a matroid isomorphism.
34353435
34363436
A *morphism* is a map from the groundset of ``self`` to the groundset
@@ -3553,7 +3553,7 @@ cdef class Matroid(SageObject):
35533553
return self._is_isomorphism(other, mf)
35543554

35553555
cpdef _is_isomorphism(self, other, morphism):
3556-
"""
3556+
r"""
35573557
Version of is_isomorphism() that does no type checking.
35583558
35593559
INPUT:
@@ -3942,7 +3942,7 @@ cdef class Matroid(SageObject):
39423942
return self.delete(X)
39433943

39443944
cpdef dual(self):
3945-
"""
3945+
r"""
39463946
Return the dual of the matroid.
39473947
39483948
Let `M` be a matroid with ground set `E`. If `B` is the set of bases
@@ -4054,7 +4054,7 @@ cdef class Matroid(SageObject):
40544054
return self._has_minor(N, certificate)
40554055

40564056
cpdef has_line_minor(self, k, hyperlines=None, certificate=False):
4057-
"""
4057+
r"""
40584058
Test if the matroid has a `U_{2, k}`-minor.
40594059
40604060
The matroid `U_{2, k}` is a matroid on `k` elements in which every
@@ -4125,7 +4125,7 @@ cdef class Matroid(SageObject):
41254125
return self._has_line_minor(k, hyperlines, certificate)
41264126

41274127
cpdef _has_line_minor(self, k, hyperlines, certificate=False):
4128-
"""
4128+
r"""
41294129
Test if the matroid has a `U_{2, k}`-minor.
41304130
41314131
Internal version that does no input checking.
@@ -4313,7 +4313,7 @@ cdef class Matroid(SageObject):
43134313
return self.dual().extension(element, subsets).dual()
43144314

43154315
cpdef modular_cut(self, subsets):
4316-
"""
4316+
r"""
43174317
Compute the modular cut generated by ``subsets``.
43184318
43194319
A *modular cut* is a collection `C` of flats such that
@@ -4403,7 +4403,7 @@ cdef class Matroid(SageObject):
44034403
return final_list
44044404

44054405
cpdef linear_subclasses(self, line_length=None, subsets=None):
4406-
"""
4406+
r"""
44074407
Return an iterable set of linear subclasses of the matroid.
44084408
44094409
A *linear subclass* is a set of hyperplanes (i.e. closed sets of rank
@@ -4714,7 +4714,7 @@ cdef class Matroid(SageObject):
47144714
return True
47154715

47164716
cpdef is_cosimple(self):
4717-
"""
4717+
r"""
47184718
Test if the matroid is cosimple.
47194719
47204720
A matroid is *cosimple* if it contains no cocircuits of length 1 or 2.
@@ -4791,7 +4791,7 @@ cdef class Matroid(SageObject):
47914791
return components
47924792

47934793
cpdef is_connected(self, certificate=False):
4794-
"""
4794+
r"""
47954795
Test if the matroid is connected.
47964796
47974797
A *separation* in a matroid is a partition `(X, Y)` of the
@@ -7480,7 +7480,7 @@ cdef class Matroid(SageObject):
74807480
return A
74817481

74827482
cpdef tutte_polynomial(self, x=None, y=None):
7483-
"""
7483+
r"""
74847484
Return the Tutte polynomial of the matroid.
74857485
74867486
The *Tutte polynomial* of a matroid is the polynomial

src/sage/modules/free_module_element.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3743,7 +3743,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
37433743
from sage.misc.latex import latex
37443744
vector_delimiters = latex.vector_delimiters()
37453745
s = '\\left' + vector_delimiters[0]
3746-
s += ',\,'.join(latex(a) for a in self.list())
3746+
s += r',\,'.join(latex(a) for a in self.list())
37473747
return s + '\\right' + vector_delimiters[1]
37483748
37493749
def dense_vector(self):

0 commit comments

Comments
 (0)