Skip to content

Instantly share code, notes, and snippets.

@fabiocerqueira
Last active February 6, 2019 17:12
Show Gist options
  • Save fabiocerqueira/ff0f08c477cb89a4db750577f36a249a to your computer and use it in GitHub Desktop.
Save fabiocerqueira/ff0f08c477cb89a4db750577f36a249a to your computer and use it in GitHub Desktop.
In [82]: stdlib = set(open("stdlib").read().split("\n"))
In [83]: result = set()
In [84]: p = Path('.')
In [85]: for src in p.glob('**/*.py'):
...: with open(src) as src_file:
...: code = src_file.read()
...: red = RedBaron(code)
...: result |= {node[0].dumps() for node in red.find_all("FromImportNode") + red.find_all("ImportNode")}
...:
In [86]: result - stdlib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment