Skip to content

Commit

Permalink
Fixed Lines too long
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSchweizer committed Jun 3, 2018
1 parent 6aefa98 commit 13c122e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions flowpipe/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,16 @@ def node_repr(self):
width = len(max(list(self.inputs) +
list(self.outputs) +
[self.name] +
list(plug.name + "".join([s for i, s in enumerate(str(plug.value)) if i < max_value_length]) for plug in self.inputs.values() if plug.value is not None) +
list(plug.name + "".join([s for i, s in enumerate(str(plug.value)) if i < max_value_length]) for plug in self.outputs.values() if plug.value is not None),
list(plug.name + "".join([
s for i, s in enumerate(str(plug.value))
if i < max_value_length])
for plug in self.inputs.values()
if plug.value is not None) +
list(plug.name + "".join([
s for i, s in enumerate(str(plug.value))
if i < max_value_length])
for plug in self.outputs.values()
if plug.value is not None),
key=len)) + 5
pretty = offset + '+' + '-' * width + '+'
pretty += '\n{offset}|{name:^{width}}|'.format(
Expand All @@ -198,7 +206,10 @@ def node_repr(self):
value = ""
if self.inputs[input_].value is not None:
value = json.dumps(self.inputs[input_].value)
plug = 'o {input_}<{value}>'.format(input_=input_, value="".join([s for i, s in enumerate(str(value)) if i < max_value_length]))
plug = 'o {input_}<{value}>'.format(
input_=input_,
value="".join([s for i, s in enumerate(str(value))
if i < max_value_length]))
pretty += '{plug:{width}}|'.format(plug=plug, width=width + 1)

# Outputs
Expand Down Expand Up @@ -232,7 +243,8 @@ def list_repr(self):
pretty.append(' [o] {0}'.format(name))
return '\n'.join(pretty)

def _sort_plugs(self, plugs):
@staticmethod
def _sort_plugs(plugs):
sorted_plugs = OrderedDict()
for i in sorted(plugs, key=lambda x: x.lower()):
sorted_plugs[i] = plugs[i]
Expand Down

0 comments on commit 13c122e

Please sign in to comment.