Skip to content

Commit

Permalink
fix bug where 'from ... import *' tries to import flog
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyyyan committed Sep 7, 2019
1 parent 1491f68 commit ab8388b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flor/complete_capture/transformer/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ def generic_visit(self, node):
if isinstance(value, ast.Assign) or \
isinstance(value, ast.AugAssign) or \
isinstance(value, ast.AnnAssign):
if isinstance(value, ast.Assign) and \
isinstance(value.targets[0], ast.Name) and \
value.targets[0].id == '__all__' and \
'dir()' in astor.to_source(value.value):
value.value.generators[0].ifs = [ast.parse(astor.to_source(value.value.generators[0].ifs[0]).replace('\n', '') + "and s != 'flog'").body[0].value]
# OUTPUT ASSIGN STATEMENT
value = self.visit(
Assign(value, self.relative_counter).parse())
value = self.visit(Assign(value, self.relative_counter).parse())
new_values.append(value)
old_value[:] = new_values
if header_obj is not None:
Expand Down

0 comments on commit ab8388b

Please sign in to comment.