remove relative imports
This commit is contained in:
parent
6950680ee9
commit
cf757847ad
1 changed files with 6 additions and 0 deletions
|
|
@ -49,6 +49,10 @@ def main(
|
|||
callback=verbose_callback,
|
||||
help="show the log messages",
|
||||
),
|
||||
relative_imports: bool = typer.Option(
|
||||
False,
|
||||
help="include relative imports",
|
||||
),
|
||||
) -> None:
|
||||
|
||||
lines = []
|
||||
|
|
@ -58,6 +62,8 @@ def main(
|
|||
files = Path(".").glob("**/*.py")
|
||||
files = [file for file in files if not spec.match_file(str(file))]
|
||||
imports = more_itertools.flatten([get_imports(p.read_text()) for p in files])
|
||||
if not relative_imports:
|
||||
imports = [i for i in imports if "from ." not in i]
|
||||
print("\n".join(set(imports)))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue