1. Tomohiro Nakamura
  2. nwdiag

Commits

Takeshi Komiya  committed 83e8eec

Fix pep8 violations

  • Participants
  • Parent commits 7cee610
  • Branches default

Comments (0)

Files changed (6)

File src/nwdiag/builder.py

View file
         networks = self.diagram.networks
 
         if group:
-            nodes = (n for n in self.diagram.nodes  if n.group == group)
+            nodes = (n for n in self.diagram.nodes if n.group == group)
         else:
             nodes = self.diagram.nodes
 
             if node.layouted:
                 continue
 
-            joined = [g for g in node.networks if g.hidden == False]
+            joined = [g for g in node.networks if g.hidden is False]
             y1 = min(networks.index(g) for g in node.networks)
             if joined:
                 y2 = max(networks.index(g) for g in joined)
             else:
                 nw = [n for n in node.networks if n.xy.y == y1][0]
                 nodes = [n for n in self.diagram.nodes if nw in n.networks]
-                layouted = [n for n in nodes  if n.xy.x > 0]
+                layouted = [n for n in nodes if n.xy.x > 0]
 
                 starts = 0
                 if layouted:
                     if basenode.xy.y == y1:
                         starts = basenode.xy.x + 1
                     elif commonnw and \
-                         list(commonnw)[0].hidden == True:
+                         list(commonnw)[0].hidden is True:
                         starts = basenode.xy.x
                     else:
                         starts = basenode.xy.x + 1 - len(nodes)
 
     def set_network_size(self):
         for network in self.diagram.networks:
-            nodes = [n for n in self.diagram.nodes  if network in n.networks]
+            nodes = [n for n in self.diagram.nodes if network in n.networks]
             nodes.sort(lambda a, b: cmp(a.xy.x, b.xy.x))
 
             x0 = min(n.xy.x for n in nodes)
     @classmethod
     def update_network_status(klass, diagram):
         for node in diagram.nodes:
-            above = [nw for nw in node.networks  if nw.xy.y <= node.xy.y]
-            if len(above) > 1 and [nw for nw in above  if nw.hidden]:
+            above = [nw for nw in node.networks if nw.xy.y <= node.xy.y]
+            if len(above) > 1 and [nw for nw in above if nw.hidden]:
                 for nw in above:
                     nw.hidden = False
 
-            below = [nw for nw in node.networks  if nw.xy.y > node.xy.y]
-            if len(below) > 1 and [nw for nw in below  if nw.hidden]:
+            below = [nw for nw in node.networks if nw.xy.y > node.xy.y]
+            if len(below) > 1 and [nw for nw in below if nw.hidden]:
                 for nw in below:
                     nw.hidden = False
 

File src/nwdiag/drawer.py

View file
 
     def trunklines_shadow(self):
         for network in self.diagram.networks:
-            if network.hidden == False and network.color != 'none':
+            if network.hidden is False and network.color != 'none':
                 self.trunkline(network, shadow=True)
 
     def trunklines(self):
         metrics = self.metrics
         for network in self.diagram.networks:
-            if network.hidden == False:
+            if network.hidden is False:
                 self.trunkline(network)
 
                 # FIXME: first network links to global network

File src/rackdiag/builder.py

View file
                 else:
                     y = item.number - 1
 
-                nodes = [n for n in rack.nodes  if n.xy.y == y]
+                nodes = [n for n in rack.nodes if n.xy.y == y]
                 if nodes:
                     x = max(n.xy.x for n in nodes) + 1
                 else:

File src/rackdiag/elements.py

View file
     def _update_colwidth(self):
         widths = []
         for i in range(self.colheight):
-            nodes = [n for n in self.nodes  if n.xy.y == i]
+            nodes = [n for n in self.nodes if n.xy.y == i]
             if len(nodes) > 1:
                 widths.append(len(nodes))
 
         self.colwidth = lcm(*widths) or 1
         for i in range(self.colheight):
-            nodes = [n for n in self.nodes  if n.xy.y == i]
+            nodes = [n for n in self.nodes if n.xy.y == i]
             if nodes:
                 width = self.colwidth / len(nodes)
                 for i, node in enumerate(nodes):

File src/rackdiag/metrics.py

View file
         self.span_width = 0
         super(DiagramMetrics, self).__init__(diagram, **kwargs)
 
-        labelsize = [self.textsize(r.display_label, font=self.font_for(r)) \
-                     for r in diagram.racks  if r.display_label]
+        labelsize = [self.textsize(r.display_label, font=self.font_for(r))
+                     for r in diagram.racks if r.display_label]
         if labelsize:
             labelheight = max(size.y for size in labelsize) + \
                           self.line_spacing * 2

File src/rackdiag/utils/rst/directives.py

View file
 
         # records for total
         total = ['-', 'Total'] + [''] * (len(RackItem.desctable) - 2)
-        total[2] = u"%dU" % sum(n.colheight for n in nodes()  if n.colheight)
-        total[3] = u"%.1fA" % sum(n.ampere for n in nodes()  if n.ampere)
-        total[4] = u"%.1fkg" % sum(n.weight for n in nodes()  if n.weight)
+        total[2] = u"%dU" % sum(n.colheight for n in nodes() if n.colheight)
+        total[3] = u"%.1fA" % sum(n.ampere for n in nodes() if n.ampere)
+        total[4] = u"%.1fkg" % sum(n.weight for n in nodes() if n.weight)
         descriptions.append(total)
 
         for i in range(len(headers) - 1, -1, -1):