-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drastically improve dependency resolution speed
- Loading branch information
Showing
10 changed files
with
92 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
class Dependencies: | ||
""" | ||
Proxy to package dependencies to only require them when needed. | ||
""" | ||
|
||
def __init__(self, package, provider): | ||
self._package = package | ||
self._provider = provider | ||
self._dependencies = None | ||
|
||
@property | ||
def dependencies(self): | ||
if self._dependencies is None: | ||
self._dependencies = self._get_dependencies() | ||
|
||
return self._dependencies | ||
|
||
def _get_dependencies(self): | ||
self._provider.debug( | ||
'Getting dependencies for {}'.format(self._package), 0 | ||
) | ||
dependencies = self._provider._dependencies_for(self._package) | ||
|
||
if dependencies is None: | ||
dependencies = [] | ||
|
||
return dependencies | ||
|
||
def __len__(self): | ||
return len(self.dependencies) | ||
|
||
def __iter__(self): | ||
return self.dependencies.__iter__() | ||
|
||
def __add__(self, other): | ||
return self.dependencies + other | ||
|
||
__radd__ = __add__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters