Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _fix_py3_plus(contents_text): # type: (str) -> str
try:
ast_obj = ast_parse(contents_text)
except SyntaxError:
return contents_text
visitor = FindPy3Plus()
visitor.visit(ast_obj)
if not any((
visitor.bases_to_remove,
visitor.encode_calls,
visitor.if_py2_blocks,
visitor.if_py3_blocks,
visitor.native_literals,
visitor.io_open_calls,
visitor.os_error_alias_calls,
visitor.os_error_alias_simple,
visitor.os_error_alias_excepts,
visitor.six_add_metaclass,
visitor.six_b,
visitor.six_calls,
visitor.six_iter,
def generic_visit(self, node): # type: (ast.AST) -> None
self._previous_node = node
super(FindPy3Plus, self).generic_visit(node)