-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
This strips per-argument type comments (example taken from PEP 484):
code = '''
def send_email(address, # type: Union[str, List[str]]
sender, # type: str
cc, # type: Optional[List[str]]
bcc, # type: Optional[List[str]]
subject='',
body=None # type: List[str]
):
# type: (...) -> bool
"""Send an email message. Return True if successful."""
pass
'''
import typed_ast.ast3
import typed_astunparse
print(typed_astunparse.unparse(typed_ast.ast3.parse(code)))
Output is:
def send_email(address, sender, cc, bcc, subject='', body=None):
# type: (...) -> bool
'Send an email message. Return True if successful.'
pass
Metadata
Metadata
Assignees
Labels
No labels