Permalink
Browse files

DiagramGrid.__init__: Rearrange the code in a big if statement.

This commit makes the code in the constructor of DiagramGrid more
orderly and easy to extend later.
  • Loading branch information...
scolobb committed Jul 3, 2012
1 parent b173213 commit 1dfd0e470a264b5ef4d192f10971723372c95e50
Showing with 7 additions and 8 deletions.
  1. +7 −8 sympy/categories/diagram_drawing.py
@@ -796,15 +796,14 @@ def __init__(self, diagram, groups=None, **hints):
if groups and (groups != diagram.objects):
# Lay out the diagram according to the groups.
- self._grid = DiagramGrid._handle_groups(diagram, groups, merged_morphisms)
- return
-
- if "shape" in hints:
+ self._grid = DiagramGrid._handle_groups(
+ diagram, groups, merged_morphisms)
+ elif "shape" in hints:
if hints["shape"] == "sequential":
- self._grid = DiagramGrid._sequential_layout(diagram, merged_morphisms)
- return
-
- self._grid = DiagramGrid._generic_layout(diagram, merged_morphisms)
+ self._grid = DiagramGrid._sequential_layout(
+ diagram, merged_morphisms)
+ else:
+ self._grid = DiagramGrid._generic_layout(diagram, merged_morphisms)
@property
def width(self):

0 comments on commit 1dfd0e4

Please sign in to comment.