Skip to content

Commit

Permalink
Handle updates to flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
dstufft committed Feb 11, 2015
1 parent 04c8dd3 commit c1c638b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pip/__main__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from __future__ import absolute_import

import os
import sys

# If we are running from a wheel, add the wheel to sys.path
# This allows the usage python pip-*.whl/pip install pip-*.whl
if __package__ == '':
import os
# __file__ is pip-*.whl/pip/__main__.py
# first dirname call strips of '/__main__.py', second strips off '/pip'
# Resulting path is the name of the wheel itself
# Add that to sys.path so we can import pip
path = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, path)

import pip
import pip # noqa

if __name__ == '__main__':
sys.exit(pip.main())
6 changes: 5 additions & 1 deletion pip/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ def _get_hash_from_file(target_file, link):
return download_hash


def _progress_indicator(iterable, *args, **kwargs):
return iterable


def _download_url(resp, link, content_file):
download_hash = None
if link.hash and link.hash_name:
Expand Down Expand Up @@ -587,7 +591,7 @@ def resp_read(chunk_size):
break
yield chunk

progress_indicator = lambda x, *a, **k: x
progress_indicator = _progress_indicator

if link.netloc == PyPI.netloc:
url = show_url
Expand Down
18 changes: 12 additions & 6 deletions pip/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,22 +397,28 @@ def get_installed_distributions(local_only=True,
if local_only:
local_test = dist_is_local
else:
local_test = lambda d: True
def local_test(d):
return True

if include_editables:
editable_test = lambda d: True
def editable_test(d):
return True
else:
editable_test = lambda d: not dist_is_editable(d)
def editable_test(d):
return not dist_is_editable(d)

if editables_only:
editables_only_test = lambda d: dist_is_editable(d)
def editables_only_test(d):
return dist_is_editable(d)
else:
editables_only_test = lambda d: True
def editables_only_test(d):
return True

if user_only:
user_test = dist_in_usersite
else:
user_test = lambda d: True
def user_test(d):
return True

return [d for d in pkg_resources.working_set
if local_test(d)
Expand Down

0 comments on commit c1c638b

Please sign in to comment.