From 5b40968a85e39dc634aeb834e6f433468fd6a762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 24 Jun 2018 10:54:33 +0200 Subject: [PATCH] fixing some invalid escape sequences in algebras and rings --- src/sage/algebras/commutative_dga.py | 2 +- .../finite_dimensional_algebra.py | 2 +- src/sage/algebras/group_algebra.py | 3 ++- src/sage/algebras/iwahori_hecke_algebra.py | 4 ++-- src/sage/algebras/lie_algebras/examples.py | 3 ++- src/sage/algebras/lie_algebras/heisenberg.py | 3 ++- src/sage/algebras/lie_algebras/verma_module.py | 3 ++- src/sage/algebras/lie_algebras/virasoro.py | 3 ++- src/sage/algebras/orlik_solomon.py | 4 ++-- src/sage/algebras/q_system.py | 2 +- src/sage/algebras/quatalg/quaternion_algebra.py | 5 +++-- src/sage/algebras/rational_cherednik_algebra.py | 4 ++-- src/sage/algebras/schur_algebra.py | 2 +- src/sage/algebras/steenrod/steenrod_algebra_misc.py | 6 ++++-- src/sage/algebras/yangian.py | 8 ++++---- src/sage/combinat/posets/incidence_algebras.py | 2 +- src/sage/combinat/posets/moebius_algebra.py | 4 ++-- src/sage/rings/polynomial/laurent_polynomial_ring.py | 2 +- src/sage/rings/polynomial/multi_polynomial_element.py | 3 +-- src/sage/rings/polynomial/term_order.py | 6 +++--- 20 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 340b80a96ff..cdddb520b13 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -1,4 +1,4 @@ -""" +r""" Commutative Differential Graded Algebras An algebra is said to be *graded commutative* if it is endowed with a diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index 87ac4129eb2..04f2dd1f2d7 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -32,7 +32,7 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Algebra): - """ + r""" Create a finite-dimensional `k`-algebra from a multiplication table. INPUT: diff --git a/src/sage/algebras/group_algebra.py b/src/sage/algebras/group_algebra.py index 9ea3f1a70ed..bb2f757b8e6 100644 --- a/src/sage/algebras/group_algebra.py +++ b/src/sage/algebras/group_algebra.py @@ -43,8 +43,9 @@ from sage.categories.morphism import SetMorphism from sage.combinat.free_module import CombinatorialFreeModule + def GroupAlgebra(G, R=IntegerRing()): - """ + r""" Return the group algebra of `G` over `R`. INPUT: diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index c8fa9f67f11..91488247bc8 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -1,4 +1,4 @@ -""" +r""" Iwahori-Hecke Algebras AUTHORS: @@ -911,7 +911,7 @@ def hash_involution_on_basis(self, w): class ElementMethods: def bar(self): - """ + r""" Return the bar involution of ``self``. The bar involution `\overline{\phantom{x}}` is an antilinear diff --git a/src/sage/algebras/lie_algebras/examples.py b/src/sage/algebras/lie_algebras/examples.py index 2eb193fc8e0..31fbea0f944 100644 --- a/src/sage/algebras/lie_algebras/examples.py +++ b/src/sage/algebras/lie_algebras/examples.py @@ -96,8 +96,9 @@ def cross_product(R, names=['X', 'Y', 'Z']): L.rename("Lie algebra of RR^3 under cross product over {}".format(R)) return L + def three_dimensional_by_rank(R, n, a=None, names=['X', 'Y', 'Z']): - """ + r""" Return a 3-dimensional Lie algebra of rank ``n``, where `0 \leq n \leq 3`. Here, the *rank* of a Lie algebra `L` is defined as the dimension diff --git a/src/sage/algebras/lie_algebras/heisenberg.py b/src/sage/algebras/lie_algebras/heisenberg.py index 4efdab825cc..8b9d171292b 100644 --- a/src/sage/algebras/lie_algebras/heisenberg.py +++ b/src/sage/algebras/lie_algebras/heisenberg.py @@ -294,9 +294,10 @@ def _coerce_map_from_(self, H): return None # Otherwise no coercion return super(HeisenbergAlgebra_fd, self)._coerce_map_from_(H) + class HeisenbergAlgebra(HeisenbergAlgebra_fd, HeisenbergAlgebra_abstract, LieAlgebraWithGenerators): - """ + r""" A Heisenberg algebra defined using structure coefficients. The `n`-th Heisenberg algebra (where `n` is a nonnegative diff --git a/src/sage/algebras/lie_algebras/verma_module.py b/src/sage/algebras/lie_algebras/verma_module.py index b452bcd14d3..56411700ce3 100644 --- a/src/sage/algebras/lie_algebras/verma_module.py +++ b/src/sage/algebras/lie_algebras/verma_module.py @@ -1278,8 +1278,9 @@ def basis(self): Element = VermaModuleMorphism + def _convert_wt_to_root(wt): - """ + r""" Helper function to express ``wt`` as a linear combination of simple roots. diff --git a/src/sage/algebras/lie_algebras/virasoro.py b/src/sage/algebras/lie_algebras/virasoro.py index 6a2b0814150..180dc394d6e 100644 --- a/src/sage/algebras/lie_algebras/virasoro.py +++ b/src/sage/algebras/lie_algebras/virasoro.py @@ -686,8 +686,9 @@ def _acted_upon_(self, scalar, self_on_left=False): _rmul_ = _lmul_ = _acted_upon_ + class VermaModule(CombinatorialFreeModule): - """ + r""" A Verma module of the Virasoro algebra. The Virasoro algebra admits a triangular decomposition diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index d90d0fed334..3a1fb0725c1 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -193,7 +193,7 @@ def one_basis(self): @cached_method def algebra_generators(self): - """ + r""" Return the algebra generators of ``self``. These form a family indexed by the ground set `X` of `M`. For @@ -221,7 +221,7 @@ def algebra_generators(self): @cached_method def product_on_basis(self, a, b): - """ + r""" Return the product in ``self`` of the basis elements indexed by ``a`` and ``b``. diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index 2789d2e4afa..d6de08cc5d7 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -404,7 +404,7 @@ def gens(self): return tuple(self.algebra_generators()) def dimension(self): - """ + r""" Return the dimension of ``self``, which is `\infty`. EXAMPLES:: diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 78b084f93b4..10d2a3dea18 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -75,8 +75,9 @@ # Constructor ######################################################## + class QuaternionAlgebraFactory(UniqueFactory): - """ + r""" There are three input formats: - ``QuaternionAlgebra(a, b)``: quaternion algebra generated by ``i``, ``j`` @@ -1691,7 +1692,7 @@ def quadratic_form(self): return self.unit_ideal().quadratic_form() def ternary_quadratic_form(self, include_basis=False): - """ + r""" Return the ternary quadratic form associated to this order. INPUT: diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index 92ed2e234f1..537a4444c67 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -139,7 +139,7 @@ def __init__(self, ct, c, t, base_ring, prefix): sorting_key=self._genkey) def _genkey(self, t): - """ + r""" Construct a key for comparison for a term indexed by ``t``. The key we create is the tuple in the following order: @@ -447,7 +447,7 @@ def degree_on_basis(self, m): @cached_method def trivial_idempotent(self): - """ + r""" Return the trivial idempotent of ``self``. Let `e = |W|^{-1} \sum_{w \in W} w` is the trivial idempotent. diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index 42030b44915..d67cbb09c9e 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -148,7 +148,7 @@ def schur_representative_indices(n, r): def schur_representative_from_index(i0, i1): - """ + r""" Simultaneously reorder a pair of tuples to obtain the equivalent element of the distinguished basis of the Schur algebra. diff --git a/src/sage/algebras/steenrod/steenrod_algebra_misc.py b/src/sage/algebras/steenrod/steenrod_algebra_misc.py index 358b3755c0a..b85e893da42 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_misc.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_misc.py @@ -183,8 +183,9 @@ def get_basis_name(basis, p, generic=None): ###################################################### # profile functions + def is_valid_profile(profile, truncation_type, p=2, generic=None): - """ + r""" True if ``profile``, together with ``truncation_type``, is a valid profile at the prime `p`. @@ -294,8 +295,9 @@ def is_valid_profile(profile, truncation_type, p=2, generic=None): return False return True + def normalize_profile(profile, precision=None, truncation_type='auto', p=2, generic=None): - """ + r""" Given a profile function and related data, return it in a standard form, suitable for hashing and caching as data defining a sub-Hopf algebra of the Steenrod algebra. diff --git a/src/sage/algebras/yangian.py b/src/sage/algebras/yangian.py index 4c6eb987f56..940c5d06b6f 100644 --- a/src/sage/algebras/yangian.py +++ b/src/sage/algebras/yangian.py @@ -617,7 +617,7 @@ def graded_algebra(self): return GradedYangianLoop(self) def dimension(self): - """ + r""" Return the dimension of ``self``, which is `\infty`. EXAMPLES:: @@ -732,7 +732,7 @@ def product_on_gens(self, a, b): for x in range(2, b[0]+1)) def coproduct_on_basis(self, m): - """ + r""" Return the coproduct on the basis element indexed by ``m``. The coproduct `\Delta\colon Y(\mathfrak{gl}_n) \longrightarrow @@ -904,7 +904,7 @@ def level(self): return self._level def defining_polynomial(self, i, j, u=None): - """ + r""" Return the defining polynomial of ``i`` and ``j``. The defining polynomial is given by: @@ -928,7 +928,7 @@ def defining_polynomial(self, i, j, u=None): return sum(self.gen(k, i, j) * u**(ell-k) for k in range(ell+1)) def quantum_determinant(self, u=None): - """ + r""" Return the quantum determinant of ``self``. The quantum determinant is defined by: diff --git a/src/sage/combinat/posets/incidence_algebras.py b/src/sage/combinat/posets/incidence_algebras.py index a8428df24aa..a4933671fc6 100644 --- a/src/sage/combinat/posets/incidence_algebras.py +++ b/src/sage/combinat/posets/incidence_algebras.py @@ -184,7 +184,7 @@ def product_on_basis(self, A, B): @cached_method def one(self): - """ + r""" Return the element `1` in ``self`` (which is the Kronecker delta `\delta(x, y)`). diff --git a/src/sage/combinat/posets/moebius_algebra.py b/src/sage/combinat/posets/moebius_algebra.py index 30f0f56ac64..79ae50ab287 100644 --- a/src/sage/combinat/posets/moebius_algebra.py +++ b/src/sage/combinat/posets/moebius_algebra.py @@ -234,7 +234,7 @@ def one(self): natural = E class I(BasisAbstract): - """ + r""" The (orthogonal) idempotent basis of a Möbius algebra. Let `I_x` and `I_y` be basis elements of `M_L` for some lattice `L`. @@ -592,7 +592,7 @@ def _to_natural_basis(self, x): characteristic_basis = C class KL(BasisAbstract): - """ + r""" The Kazhdan-Lusztig basis of a quantum Möbius algebra. The Kazhdan-Lusztig basis `\{ B_x \mid x \in L \}` of `M_L` diff --git a/src/sage/rings/polynomial/laurent_polynomial_ring.py b/src/sage/rings/polynomial/laurent_polynomial_ring.py index ee9d7e9256c..452fef2ee9f 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_ring.py +++ b/src/sage/rings/polynomial/laurent_polynomial_ring.py @@ -689,7 +689,7 @@ def _latex_(self): sage: latex(LaurentPolynomialRing(QQ,2,'x')) \Bold{Q}[x_{0}^{\pm 1}, x_{1}^{\pm 1}] """ - vars = ', '.join([a + '^{\pm 1}' for a in self.latex_variable_names()]) + vars = ', '.join([a + r'^{\pm 1}' for a in self.latex_variable_names()]) return "%s[%s]"%(latex(self.base_ring()), vars) def _ideal_class_(self, n=0): diff --git a/src/sage/rings/polynomial/multi_polynomial_element.py b/src/sage/rings/polynomial/multi_polynomial_element.py index 9158d067953..4ba5276ad46 100644 --- a/src/sage/rings/polynomial/multi_polynomial_element.py +++ b/src/sage/rings/polynomial/multi_polynomial_element.py @@ -1412,7 +1412,7 @@ def lc(self): return self.__lc def lt(self): - """ + r""" Returns the leading term of self i.e., self.lc()\*self.lm(). The notion of "leading term" depends on the ordering defined in the parent ring. @@ -1435,7 +1435,6 @@ def lt(self): sage: f=x+y sage: f.lt() x - """ try: return self.__lt diff --git a/src/sage/rings/polynomial/term_order.py b/src/sage/rings/polynomial/term_order.py index 6d701db613e..58d4d2d1d15 100644 --- a/src/sage/rings/polynomial/term_order.py +++ b/src/sage/rings/polynomial/term_order.py @@ -716,14 +716,14 @@ def __init__(self, name='lex', n=0, force=False): self._macaulay2_str = macaulay2_name_mapping.get(name,name) self._magma_str = magma_name_mapping.get(name,name) else: - split_pattern = "([^(),]+(?:\([^()]*\)[^(),]*)*)" # split by outermost commas + split_pattern = r"([^(),]+(?:\([^()]*\)[^(),]*)*)" # split by outermost commas block_names = re.findall(split_pattern,name) if len(block_names) == 0: raise ValueError("no term order specified") elif len(block_names) == 1: name = block_names[0] - match = re.match('m\(([-+0-9,]+)\)$',name) + match = re.match(r'm\(([-+0-9,]+)\)$',name) if match: # matrix term order m = [int(_) for _ in match.groups()[0].split(',')] # replace match.groups()[0] with match.group(1) later self.__copy(TermOrder(m)) @@ -741,7 +741,7 @@ def __init__(self, name='lex', n=0, force=False): singular_str = [] macaulay2_str = [] - length_pattern = re.compile("\(([0-9]+)\)$") # match with parenthesized block length at end + length_pattern = re.compile(r"\(([0-9]+)\)$") # match with parenthesized block length at end for block in block_names: try: block_name, block_length, _ = re.split(length_pattern,block.strip())