init
This commit is contained in:
commit
38355d2442
9083 changed files with 1225834 additions and 0 deletions
40
.venv/bin/find-import
Executable file
40
.venv/bin/find-import
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/home/walkers/git/creeper-adventure/.venv/bin/python3
|
||||
"""
|
||||
Usage: find-import names...
|
||||
|
||||
Prints how to import given name(s).
|
||||
"""
|
||||
# pyflyby/find-import
|
||||
# Copyright (C) 2011, 2014 Karl Chen.
|
||||
# License: MIT http://opensource.org/licenses/MIT
|
||||
|
||||
from __future__ import absolute_import, division, with_statement
|
||||
from __future__ import print_function
|
||||
|
||||
from pyflyby._cmdline import parse_args, syntax
|
||||
from pyflyby._importdb import ImportDB
|
||||
from pyflyby._log import logger
|
||||
|
||||
|
||||
def main():
|
||||
options, args = parse_args(import_format_params=True)
|
||||
if not args:
|
||||
syntax()
|
||||
db = ImportDB.get_default(".")
|
||||
known = db.known_imports.by_import_as
|
||||
errors = 0
|
||||
for arg in args:
|
||||
try:
|
||||
imports = known[arg]
|
||||
except KeyError:
|
||||
errors += 1
|
||||
logger.error("Can't find import for %r", arg)
|
||||
else:
|
||||
for imp in imports:
|
||||
print(imp.pretty_print(params=options.params), end=' ')
|
||||
if errors:
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue