Return early and reduce indentation
@@ -112,8 +112,9 @@ class RequirementSet(object):
# Assume there's no need to scan, and that we've already
# encountered this for scanning.
- result = []
- if not install_req.constraint and existing_req.constraint:
+ if install_req.constraint and not existing_req.constraint:
+ return [], existing_req
+
does_not_satisfy_constraint = install_req.link and not (
existing_req.link and
install_req.link.path == existing_req.link.path
@@ -135,12 +136,9 @@ class RequirementSet(object):
"Setting %s extras to: %s",
existing_req, existing_req.extras,
)
- # And now we need to scan this.
- result = [existing_req]
-
# We return install_req here to allow for the caller to add it to
# the dependency information for the parent package.
- return result, existing_req
+ return [existing_req], existing_req
def has_requirement(self, project_name):
name = project_name.lower()
