mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 12:05:33 +00:00
improve(pipreqs): Remove unnecessary if statements
This commit is contained in:
parent
084a82c7b7
commit
50470f7836
@ -84,8 +84,6 @@ def get_imports_info(imports):
|
|||||||
except HTTPError:
|
except HTTPError:
|
||||||
logging.debug('Package does not exist or network problems')
|
logging.debug('Package does not exist or network problems')
|
||||||
continue
|
continue
|
||||||
if not data or not data.release_ids:
|
|
||||||
continue
|
|
||||||
last_release = data.latest_release_id
|
last_release = data.latest_release_id
|
||||||
result.append({'name': item, 'version': last_release})
|
result.append({'name': item, 'version': last_release})
|
||||||
return result
|
return result
|
||||||
@ -100,16 +98,9 @@ def get_locally_installed_packages():
|
|||||||
with open(os.path.join(root, item), "r") as f:
|
with open(os.path.join(root, item), "r") as f:
|
||||||
package = root.split("/")[-1].split("-")
|
package = root.split("/")[-1].split("-")
|
||||||
package_import = f.read().strip().split("\n")
|
package_import = f.read().strip().split("\n")
|
||||||
package_import_name = ""
|
|
||||||
for item in package_import:
|
for item in package_import:
|
||||||
if item not in ["tests", "_tests"]:
|
if item not in ["tests", "_tests"]:
|
||||||
package_import_name = item
|
packages[item] = {
|
||||||
break
|
|
||||||
if package_import_name == "":
|
|
||||||
logging.debug(
|
|
||||||
'Could not determine import name for package ' + str(package_import))
|
|
||||||
else:
|
|
||||||
packages[package_import_name] = {
|
|
||||||
'version': package[1].replace(".dist", ""),
|
'version': package[1].replace(".dist", ""),
|
||||||
'name': package[0]
|
'name': package[0]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user