Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 191b830

Browse files
committed
fix doctests and a few details
1 parent 42046d0 commit 191b830

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/sage/categories/signed_tensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
Signed Tensor Product Functorial Construction
34

src/sage/categories/tensor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
Tensor Product Functorial Construction
34
45
AUTHORS:
56
6-
- Nicolas M. Thiery (2008-2010): initial revision and refactorization
7+
- Nicolas M. Thiéry (2008-2010): initial revision and refactorization
78
"""
89
# ****************************************************************************
9-
# Copyright (C) 2008-2010 Nicolas M. Thiery <nthiery at users.sf.net>
10+
# Copyright (C) 2008-2010 Nicolas M. Thiéry <nthiery at users.sf.net>
1011
#
1112
# Distributed under the terms of the GNU General Public License (GPL)
1213
# https://www.gnu.org/licenses/

src/sage/combinat/free_module.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def element_class(self):
351351
'sage.combinat.free_module'
352352
"""
353353
return self.__make_element_class__(self.Element,
354-
name="%s.element_class"%self.__class__.__name__,
354+
name="%s.element_class" % self.__class__.__name__,
355355
module=self.__class__.__module__,
356356
inherit=True)
357357

@@ -669,7 +669,7 @@ def _element_constructor_(self, x):
669669
if x == 0:
670670
return self.zero()
671671
else:
672-
raise TypeError("do not know how to make x (= %s) an element of %s"%(x, self))
672+
raise TypeError("do not know how to make x (= %s) an element of %s" % (x, self))
673673
#x is an element of the basis enumerated set;
674674
# This is a very ugly way of testing this
675675
elif ((hasattr(self._indices, 'element_class') and
@@ -685,7 +685,7 @@ def _element_constructor_(self, x):
685685
return self._coerce_end(x)
686686
except TypeError:
687687
pass
688-
raise TypeError("do not know how to make x (= %s) an element of self (=%s)"%(x,self))
688+
raise TypeError("do not know how to make x (= %s) an element of self (=%s)" % (x, self))
689689

690690
def _convert_map_from_(self, S):
691691
"""
@@ -1297,15 +1297,13 @@ def __classcall_private__(cls, modules, **options):
12971297
options['category'] = options['category'].FiniteDimensional()
12981298
return super(CombinatorialFreeModule.Tensor, cls).__classcall__(cls, modules, **options)
12991299

1300-
13011300
def __init__(self, modules, **options):
13021301
"""
13031302
TESTS::
13041303
13051304
sage: F = CombinatorialFreeModule(ZZ, [1,2]); F
13061305
F
13071306
"""
1308-
from sage.categories.tensor import tensor
13091307
self._sets = modules
13101308
indices = CartesianProduct_iters(*[module.basis().keys()
13111309
for module in modules]).map(tuple)
@@ -1496,10 +1494,11 @@ def tensor_constructor(self, modules):
14961494
# a list l such that l[i] is True if modules[i] is readily a tensor product
14971495
is_tensor = [isinstance(module, CombinatorialFreeModule_Tensor) for module in modules]
14981496
# the tensor_constructor, on basis elements
1499-
result = self.monomial * CartesianProductWithFlattening(is_tensor) #.
1497+
result = self.monomial * CartesianProductWithFlattening(is_tensor)
15001498
# TODO: make this into an element of Hom( A x B, C ) when those will exist
1501-
for i in range(0, len(modules)):
1502-
result = modules[i]._module_morphism(result, position = i, codomain = self)
1499+
for i in range(len(modules)):
1500+
result = modules[i]._module_morphism(result, position=i,
1501+
codomain=self)
15031502
return result
15041503

15051504
def _tensor_of_elements(self, elements):
@@ -1594,6 +1593,7 @@ def _coerce_map_from_(self, R):
15941593

15951594
return super(CombinatorialFreeModule_Tensor, self)._coerce_map_from_(R)
15961595

1596+
15971597
class CartesianProductWithFlattening(object):
15981598
"""
15991599
A class for Cartesian product constructor, with partial flattening
@@ -1755,7 +1755,7 @@ def cartesian_embedding(self, i):
17551755
"""
17561756
assert i in self._sets_keys()
17571757
return self._sets[i]._module_morphism(lambda t: self.monomial((i, t)),
1758-
codomain = self)
1758+
codomain=self)
17591759

17601760
summand_embedding = cartesian_embedding
17611761

@@ -1786,7 +1786,7 @@ def cartesian_projection(self, i):
17861786
"""
17871787
assert i in self._sets_keys()
17881788
module = self._sets[i]
1789-
return self._module_morphism(lambda j_t: module.monomial(j_t[1]) if i == j_t[0] else module.zero(), codomain = module)
1789+
return self._module_morphism(lambda j_t: module.monomial(j_t[1]) if i == j_t[0] else module.zero(), codomain=module)
17901790

17911791
summand_projection = cartesian_projection
17921792

@@ -1832,4 +1832,5 @@ def cartesian_factors(self):
18321832
class Element(CombinatorialFreeModule.Element): # TODO: get rid of this inheritance
18331833
pass
18341834

1835+
18351836
CombinatorialFreeModule.CartesianProduct = CombinatorialFreeModule_CartesianProduct

0 commit comments

Comments
 (0)