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

Commit 08cc7dc

Browse files
committed
pep cleanup for the quivers folder
1 parent 4583b40 commit 08cc7dc

File tree

9 files changed

+145
-133
lines changed

9 files changed

+145
-133
lines changed

src/sage/quivers/algebra.py

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
from __future__ import absolute_import
55

6-
#*****************************************************************************
6+
# ****************************************************************************
77
# Copyright (C) 2012 Jim Stark <[email protected]>
88
# 2013 Simon King <[email protected]>
99
# 2014 Simon King <[email protected]>
@@ -17,14 +17,15 @@
1717
# See the GNU General Public License for more details; the full text
1818
# is available at:
1919
#
20-
# http://www.gnu.org/licenses/
21-
#*****************************************************************************
20+
# https://www.gnu.org/licenses/
21+
# ****************************************************************************
2222

2323
import six
2424
from sage.misc.cachefunc import cached_method
2525
from sage.combinat.free_module import CombinatorialFreeModule
2626
from .algebra_elements import PathAlgebraElement
2727

28+
2829
class PathAlgebra(CombinatorialFreeModule):
2930
r"""
3031
Create the path algebra of a :class:`quiver <DiGraph>` over a given field.
@@ -50,9 +51,9 @@ class PathAlgebra(CombinatorialFreeModule):
5051
5152
- the path algebra `kP` with the given monomial order
5253
53-
NOTE:
54+
.. NOTE::
5455
55-
Monomial orders that are not degree orders are not supported.
56+
Monomial orders that are not degree orders are not supported.
5657
5758
EXAMPLES::
5859
@@ -133,10 +134,11 @@ class PathAlgebra(CombinatorialFreeModule):
133134
# #
134135
###########################################################################
135136

136-
def __init__(self, k, P, order = "negdegrevlex"):
137+
def __init__(self, k, P, order="negdegrevlex"):
137138
"""
138-
Creates a :class:`PathAlgebra` object. Type ``PathAlgebra?`` for
139-
more information.
139+
Create a :class:`PathAlgebra` object.
140+
141+
Type ``PathAlgebra?`` for more information.
140142
141143
INPUT:
142144
@@ -166,10 +168,10 @@ def __init__(self, k, P, order = "negdegrevlex"):
166168
self._semigroup = P
167169
self._ordstr = order
168170
super(PathAlgebra, self).__init__(k, self._semigroup,
169-
prefix='',
170-
#element_class=self.Element,
171-
category=GradedAlgebrasWithBasis(k),
172-
bracket=False)
171+
prefix='',
172+
# element_class=self.Element,
173+
category=GradedAlgebrasWithBasis(k),
174+
bracket=False)
173175
self._assign_names(self._semigroup.variable_names())
174176

175177
def order_string(self):
@@ -223,8 +225,8 @@ def arrows(self):
223225
sage: A.arrows()
224226
(a, b, c)
225227
"""
226-
return tuple(self._from_dict( {index: self.base_ring().one()},
227-
remove_zeros=False )
228+
return tuple(self._from_dict({index: self.base_ring().one()},
229+
remove_zeros=False)
228230
for index in self._semigroup.arrows())
229231

230232
@cached_method
@@ -240,8 +242,8 @@ def idempotents(self):
240242
sage: A.idempotents()
241243
(e_1, e_2, e_3, e_4)
242244
"""
243-
return tuple(self._from_dict( {index: self.base_ring().one()},
244-
remove_zeros=False )
245+
return tuple(self._from_dict({index: self.base_ring().one()},
246+
remove_zeros=False)
245247
for index in self._semigroup.idempotents())
246248

247249
@cached_method
@@ -264,8 +266,8 @@ def gen(self, i):
264266
sage: A.gen(5)
265267
b
266268
"""
267-
return self._from_dict( {self._semigroup.gen(i): self.base_ring().one()},
268-
remove_zeros = False )
269+
return self._from_dict({self._semigroup.gen(i): self.base_ring().one()},
270+
remove_zeros=False)
269271

270272
def ngens(self):
271273
"""
@@ -445,7 +447,7 @@ def _repr_monomial(self, data):
445447
# gives the component in the module, and mid gives the length of the
446448
# left factor in a two-sided module.
447449
arrows = self.variable_names()
448-
return '*'.join( [arrows[n] for n in data] )
450+
return '*'.join(arrows[n] for n in data)
449451

450452
def _latex_monomial(self, data):
451453
"""
@@ -465,7 +467,7 @@ def _latex_monomial(self, data):
465467
466468
"""
467469
arrows = self.variable_names()
468-
return '\\cdot '.join( [arrows[n] for n in data] )
470+
return '\\cdot '.join(arrows[n] for n in data)
469471

470472
@cached_method
471473
def one(self):
@@ -482,8 +484,8 @@ def one(self):
482484
e_1 + e_2 + e_3
483485
"""
484486
one = self.base_ring().one()
485-
D = dict((index,one) for index in self._semigroup.idempotents())
486-
return self._from_dict( D )
487+
D = {index: one for index in self._semigroup.idempotents()}
488+
return self._from_dict(D)
487489

488490
###########################################################################
489491
# #
@@ -563,19 +565,19 @@ def degree_on_basis(self, x):
563565

564566
def sum(self, iter_of_elements):
565567
"""
566-
Returns the sum of all elements in ``iter_of_elements``
568+
Return the sum of all elements in ``iter_of_elements``
567569
568570
INPUT:
569571
570572
- ``iter_of_elements``: iterator of elements of ``self``
571573
572-
NOTE:
574+
.. NOTE::
573575
574-
It overrides a method inherited from
575-
:class:`~sage.combinat.free_module.CombinatorialFreeModule`, which
576-
relies on a private attribute of elements---an implementation
577-
detail that is simply not available for
578-
:class:`~sage.quivers.algebra_elements.PathAlgebraElement`.
576+
It overrides a method inherited from
577+
:class:`~sage.combinat.free_module.CombinatorialFreeModule`,
578+
which relies on a private attribute of elements---an
579+
implementation detail that is simply not available for
580+
:class:`~sage.quivers.algebra_elements.PathAlgebraElement`.
579581
580582
EXAMPLES::
581583

src/sage/quivers/algebra_elements.pxd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
22
Cython types for elements of path algebras
33
"""
4-
#*****************************************************************************
4+
# ****************************************************************************
55
# Copyright (C) 2015 Simon King <[email protected]>
66
#
77
# Distributed under the terms of the GNU General Public License (GPL)
88
# as published by the Free Software Foundation; either version 2 of
99
# the License, or (at your option) any later version.
10-
# http://www.gnu.org/licenses/
11-
#*****************************************************************************
10+
# https://www.gnu.org/licenses/
11+
# ****************************************************************************
1212

1313
# This file declares the types. The implementation of the basic on these types
1414
# is in algebra_elements.pxi, the implementation of the Python class is in

src/sage/quivers/algebra_elements.pxi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ AUTHORS:
77
88
"""
99

10-
#*****************************************************************************
10+
# ****************************************************************************
1111
# Copyright (C) 2015 Simon King <[email protected]>
1212
#
1313
# Distributed under the terms of the GNU General Public License (GPL)
1414
# as published by the Free Software Foundation; either version 2 of
1515
# the License, or (at your option) any later version.
16-
# http://www.gnu.org/licenses/
17-
#*****************************************************************************
16+
# https://www.gnu.org/licenses/
17+
# ****************************************************************************
1818

1919
from cysignals.memory cimport check_malloc, check_allocarray, sig_free
2020
from cysignals.signals cimport sig_check, sig_on, sig_off

src/sage/quivers/algebra_elements.pyx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ AUTHORS:
77
88
"""
99

10-
#*****************************************************************************
10+
# ****************************************************************************
1111
# Copyright (C) 2015 Simon King <[email protected]>
1212
#
1313
# Distributed under the terms of the GNU General Public License (GPL)
1414
# as published by the Free Software Foundation; either version 2 of
1515
# the License, or (at your option) any later version.
16-
# http://www.gnu.org/licenses/
17-
#*****************************************************************************
16+
# https://www.gnu.org/licenses/
17+
# ****************************************************************************
1818
from __future__ import division, print_function
1919

2020
include "algebra_elements.pxi"
@@ -27,11 +27,12 @@ cdef class PathAlgebraElement(RingElement):
2727
"""
2828
Elements of a :class:`~sage.quivers.algebra.PathAlgebra`.
2929
30-
NOTE:
30+
.. NOTE::
3131
32-
Upon creation of a path algebra, one can choose among several monomial
33-
orders, which are all positive or negative degree orders. Monomial orders
34-
that are not degree orders are not supported.
32+
Upon creation of a path algebra, one can choose among several
33+
monomial orders, which are all positive or negative degree
34+
orders. Monomial orders that are not degree orders are not
35+
supported.
3536
3637
EXAMPLES:
3738
@@ -148,9 +149,9 @@ cdef class PathAlgebraElement(RingElement):
148149
:class:`~sage.quivers.paths.QuiverPath`, the value giving its
149150
coefficient.
150151
151-
NOTE:
152+
.. NOTE::
152153
153-
Monomial orders that are not degree orders are not supported.
154+
Monomial orders that are not degree orders are not supported.
154155
155156
EXAMPLES::
156157
@@ -261,10 +262,10 @@ cdef class PathAlgebraElement(RingElement):
261262
"""
262263
String representation.
263264
264-
NOTE:
265+
.. NOTE::
265266
266-
The terms are first sorted by initial and terminal vertices, and only
267-
then by the given monomial order.
267+
The terms are first sorted by initial and terminal
268+
vertices, and only then by the given monomial order.
268269
269270
EXAMPLES::
270271
@@ -463,7 +464,7 @@ cdef class PathAlgebraElement(RingElement):
463464

464465
cpdef list coefficients(self):
465466
"""
466-
Returns the list of coefficients.
467+
Return the list of coefficients.
467468
468469
.. NOTE::
469470
@@ -498,7 +499,7 @@ cdef class PathAlgebraElement(RingElement):
498499

499500
cpdef list monomials(self):
500501
"""
501-
Returns the list of monomials appearing in this element.
502+
Return the list of monomials appearing in this element.
502503
503504
.. NOTE::
504505
@@ -561,7 +562,7 @@ cdef class PathAlgebraElement(RingElement):
561562

562563
cpdef list terms(self):
563564
"""
564-
Returns the list of terms.
565+
Return the list of terms.
565566
566567
.. NOTE::
567568
@@ -616,7 +617,7 @@ cdef class PathAlgebraElement(RingElement):
616617

617618
cpdef list support(self):
618619
"""
619-
Returns the list of monomials, as elements of the underlying partial semigroup.
620+
Return the list of monomials, as elements of the underlying partial semigroup.
620621
621622
.. NOTE::
622623
@@ -966,12 +967,12 @@ cdef class PathAlgebraElement(RingElement):
966967
"""
967968
Helper for comparison of path algebra elements.
968969
969-
NOTE:
970+
.. NOTE::
970971
971-
First, the comparison is by initial vertices of monomials. Then, the
972-
terminal vertices are compared. Last, the given monomial order is
973-
applied for monomials that have the same initial and terminal
974-
vertices.
972+
First, the comparison is by initial vertices of
973+
monomials. Then, the terminal vertices are compared. Last,
974+
the given monomial order is applied for monomials that
975+
have the same initial and terminal vertices.
975976
976977
EXAMPLES::
977978

0 commit comments

Comments
 (0)