mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 03:55:22 +00:00
styling: pep8
This commit is contained in:
parent
0f622de27c
commit
9035a2eb5b
@ -38,7 +38,8 @@ def get_all_imports(path):
|
|||||||
candidates += [os.path.splitext(fn)[0] for fn in files]
|
candidates += [os.path.splitext(fn)[0] for fn in files]
|
||||||
for file_name in files:
|
for file_name in files:
|
||||||
with open(os.path.join(root, file_name), "r") as f:
|
with open(os.path.join(root, file_name), "r") as f:
|
||||||
lines = filter(filter_line, map(lambda l: l.partition("#")[0].strip(), f))
|
lines = filter(
|
||||||
|
filter_line, map(lambda l: l.partition("#")[0].strip(), f))
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if "(" in line:
|
if "(" in line:
|
||||||
break
|
break
|
||||||
@ -127,9 +128,9 @@ def get_pkg_names(pkgs):
|
|||||||
|
|
||||||
def get_name_without_alias(name):
|
def get_name_without_alias(name):
|
||||||
if "import " in name:
|
if "import " in name:
|
||||||
match = REGEXP[0].match(name.strip())
|
match = REGEXP[0].match(name.strip())
|
||||||
if match:
|
if match:
|
||||||
name = match.groups(0)[0]
|
name = match.groups(0)[0]
|
||||||
return name.partition(' as ')[0].partition('.')[0].strip()
|
return name.partition(' as ')[0].partition('.')[0].strip()
|
||||||
|
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ def init(args):
|
|||||||
local = get_import_local(candidates)
|
local = get_import_local(candidates)
|
||||||
# Get packages that were not found locally
|
# Get packages that were not found locally
|
||||||
difference = [x for x in candidates if x.lower() not in [z['name'].lower()
|
difference = [x for x in candidates if x.lower() not in [z['name'].lower()
|
||||||
for z in local]]
|
for z in local]]
|
||||||
imports = local + get_imports_info(difference)
|
imports = local + get_imports_info(difference)
|
||||||
|
|
||||||
path = args[
|
path = args[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user