From 33ae13313142d23774367a1925cc45684b44d00d Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Mon, 29 Jan 2018 17:42:41 +0800 Subject: [PATCH] refine indent --- python/paddle/v2/fluid/framework.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/paddle/v2/fluid/framework.py b/python/paddle/v2/fluid/framework.py index ff9bc7239cc..cd4179fb12a 100644 --- a/python/paddle/v2/fluid/framework.py +++ b/python/paddle/v2/fluid/framework.py @@ -14,6 +14,7 @@ import collections import contextlib +import re import numpy as np @@ -643,14 +644,15 @@ class Block(object): assert isinstance(throw_on_error, bool) and isinstance(with_details, bool) if with_details: + re_add_indent = re.compile(r"\n(.)") res_str = "blocks {\n idx: %d\n parent_idx: %d" % ( self.idx, self.parent_idx) for var in self.vars.itervalues(): - res_str += "\n vars {\n %s }" % var.to_string( - throw_on_error).replace("\n", "\n ") + res_str += "\n vars {\n %s }" % re_add_indent.sub( + r"\n \1", var.to_string(throw_on_error)) for op in self.ops: - res_str += "\n ops {\n %s }" % op.to_string( - throw_on_error).replace("\n", "\n ") + res_str += "\n ops {\n %s }" % re_add_indent.sub( + r"\n \1", op.to_string(throw_on_error)) res_str += "\n}" else: protostr = self.desc.serialize_to_string() -- GitLab