Return early from the function
Why: Allows reducing indentation of the function body.
@@ -630,13 +630,15 @@ class InstallRequirement(object):
@property
def egg_info_path(self):
# type: () -> str
+ if self._egg_info_path is not None:
+ return self._egg_info_path
+
def looks_like_virtual_env(path):
return (
os.path.lexists(os.path.join(path, 'bin', 'python')) or
os.path.exists(os.path.join(path, 'Scripts', 'Python.exe'))
)
- if self._egg_info_path is None:
if self.editable:
base = self.source_dir
filenames = []
@@ -673,6 +675,7 @@ class InstallRequirement(object):
(os.path.altsep and x.count(os.path.altsep) or 0)
)
self._egg_info_path = os.path.join(base, filenames[0])
+
return self._egg_info_path
@property
