From 21e90fda71fca36ddc470d3c9eb1c33cc448abf6 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Thu, 10 Mar 2016 13:52:18 -0300 Subject: [PATCH] Ajusta script de uso do redbaron --- scripts/redbaron.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/redbaron.py b/scripts/redbaron.py index 250e92c14..9b29f6890 100644 --- a/scripts/redbaron.py +++ b/scripts/redbaron.py @@ -23,15 +23,14 @@ filenames = [os.path.join(path, name) if name.endswith('.py') and not ignorado(path, name)] -def build_reds(): - for filename in filenames: - with open(filename, "r") as source_code: - red = RedBaron(source_code.read()) - if red.data: - red.__filename__ = filename - yield red - -reds = list(build_reds()) +def build_red(filename): + with open(filename, "r") as source_code: + red = RedBaron(source_code.read()) + if red.data: + red.__filename__ = filename + return red + +reds = [build_red(f) for f in filenames] reds_without_tests = [r for r in reds if not re.match('.*/test_.*\.py', r.__filename__)] @@ -50,7 +49,7 @@ def flat(ll): def inter(n): - 'Se a string n está dentro de uma chamada de tradução' + 'Se a string n esta dentro de uma chamada de traducao' try: assert not n.next or n.next.type == 'string' assert n.parent_find('call').parent.value[0].value == '_'