-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
Description
Humble suggestion: add new code to suggest a replacement of Union[...] types with the | chain, e.g. Y093 Use PEP 604 union types. A simple implementation start could be e.g.
class PyVisitor(ast.NodeVisitor):
...
def visit_FunctionDef(self, node):
if node.returns.value is not None and node.returns.value.id in ("Optional", "Union"):
self.error(node.returns, Y093)
...
def visit_arguments(self, node):
if arg.annotation.value.id in ("Optional", "Union"):
self.error(arg, Y093)
...