Skip to content

Commit

Permalink
pycodestyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mantepse committed Apr 9, 2024
1 parent a2e2fd5 commit 31956d2
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/sage/categories/modules_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _call_(self, x):
if M.base_ring() != self.base_ring():
M = M.change_ring(self.base_ring())
except (TypeError, AttributeError) as msg:
raise TypeError("%s\nunable to coerce x (=%s) into %s" % (msg,x,self))
raise TypeError("%s\nunable to coerce x (=%s) into %s" % (msg, x, self))
return M

def is_abelian(self):
Expand Down Expand Up @@ -582,7 +582,7 @@ def module_morphism(self, on_basis=None, matrix=None, function=None,
return ModuleMorphismByLinearity(
domain=self, on_basis=on_basis, **keywords)
else:
return ModuleMorphismFromFunction( # Or just SetMorphism?
return ModuleMorphismFromFunction( # Or just SetMorphism?
domain=self, function=function, **keywords)

_module_morphism = module_morphism
Expand Down Expand Up @@ -1265,7 +1265,7 @@ def _apply_module_morphism(self, x, on_basis, codomain=False):
except Exception:
raise ValueError('codomain could not be determined')

if hasattr( codomain, 'linear_combination' ):
if hasattr(codomain, 'linear_combination'):
mc = x.monomial_coefficients(copy=False)
return codomain.linear_combination((on_basis(key), coeff)
for key, coeff in mc.items())
Expand All @@ -1289,8 +1289,8 @@ def _apply_module_endomorphism(self, x, on_basis):
2*s[2, 1] + 2*s[3]
"""
mc = x.monomial_coefficients(copy=False)
return self.linear_combination( (on_basis(key), coeff)
for key, coeff in mc.items())
return self.linear_combination((on_basis(key), coeff)
for key, coeff in mc.items())

def dimension(self):
"""
Expand Down Expand Up @@ -2183,7 +2183,7 @@ def map_support(self, f):
sage: y.parent() is B # needs sage.modules
True
"""
return self.parent().sum_of_terms( (f(m), c) for m,c in self )
return self.parent().sum_of_terms((f(m), c) for m, c in self)

def map_support_skip_none(self, f):
"""
Expand Down Expand Up @@ -2217,7 +2217,9 @@ def map_support_skip_none(self, f):
sage: y.parent() is B # needs sage.modules
True
"""
return self.parent().sum_of_terms( (fm,c) for (fm,c) in ((f(m), c) for m,c in self) if fm is not None)
return self.parent().sum_of_terms((fm, c)
for fm, c in ((f(m), c) for m, c in self)
if fm is not None)

def map_item(self, f):
"""
Expand Down Expand Up @@ -2251,7 +2253,7 @@ def map_item(self, f):
sage: a.map_item(f) # needs sage.combinat sage.modules
2*s[2, 1] + 2*s[3]
"""
return self.parent().sum_of_terms( f(m,c) for m,c in self )
return self.parent().sum_of_terms(f(m, c) for m, c in self)

def tensor(*elements):
"""
Expand Down Expand Up @@ -2587,11 +2589,13 @@ def apply_multilinear_morphism(self, f, codomain=None):
except AttributeError:
codomain = f(*[module.zero() for module in modules]).parent()
if codomain in ModulesWithBasis(K):
return codomain.linear_combination((f(*[module.monomial(t) for (module,t) in zip(modules, m)]), c)
for m,c in self)
return codomain.linear_combination((f(*[module.monomial(t)
for module, t in zip(modules, m)]), c)
for m, c in self)
else:
return sum((c * f(*[module.monomial(t) for (module,t) in zip(modules, m)])
for m,c in self),
return sum((c * f(*[module.monomial(t)
for module, t in zip(modules, m)])
for m, c in self),
codomain.zero())

class DualObjects(DualObjectsCategory):
Expand Down

0 comments on commit 31956d2

Please sign in to comment.