Skip to content

Commit ea18381

Browse files
committed
small fixes in yang baxter
1 parent 209ae4c commit ea18381

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/sage/combinat/yang_baxter_graph.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def YangBaxterGraph(partition=None, root=None, operators=None):
4545
4646
OUTPUT: either:
4747
48-
- :class:`YangBaxterGraph_partition` -- if partition is defined
49-
- :class:`YangBaxterGraph_generic` -- if partition is ``None``
48+
- :class:`YangBaxterGraph_partition` -- if partition is defined
49+
- :class:`YangBaxterGraph_generic` -- if partition is ``None``
5050
5151
EXAMPLES:
5252
@@ -108,8 +108,7 @@ def YangBaxterGraph(partition=None, root=None, operators=None):
108108
"""
109109
if partition is None:
110110
return YangBaxterGraph_generic(root=root, operators=operators)
111-
else:
112-
return YangBaxterGraph_partition(partition=Partition(partition))
111+
return YangBaxterGraph_partition(partition=Partition(partition))
113112

114113
# *********** General class for Yang-Baxter Graphs ***********
115114

@@ -203,7 +202,7 @@ def _digraph(self):
203202
digraph.add_edge(u, v, l)
204203
return digraph
205204

206-
def __hash__(self):
205+
def __hash__(self) -> int:
207206
r"""
208207
TESTS::
209208
@@ -236,7 +235,7 @@ def __eq__(self, other) -> bool:
236235
sage: Y3.__eq__(Y2)
237236
False
238237
"""
239-
return type(self) is type(other) and self._digraph == other._digraph
238+
return isinstance(other, YangBaxterGraph_generic) and self._digraph == other._digraph
240239

241240
def __ne__(self, other) -> bool:
242241
r"""
@@ -634,7 +633,7 @@ def _digraph(self):
634633
[((0, 1, 0), (1, 0, 0), Swap positions 0 and 1)]
635634
"""
636635
digraph = super()._digraph
637-
for (u, v, op) in digraph.edges(sort=True):
636+
for u, v, op in digraph.edges(sort=True):
638637
digraph.set_edge_label(u, v, SwapOperator(op.position()))
639638
return digraph
640639

@@ -777,7 +776,7 @@ def __init__(self, i):
777776
"""
778777
self._position = i
779778

780-
def __hash__(self):
779+
def __hash__(self) -> int:
781780
r"""
782781
TESTS::
783782

0 commit comments

Comments
 (0)