Skip to content

Commit

Permalink
[commands/cache] Minor clean-up.
Browse files Browse the repository at this point in the history
- Consistently use singular 'cache' (not plural 'caches').
- Remove unnecessary uses of the word 'currently'.
- Use 'file(s)' instead of 'files', to account for case of only one file.
- Use .format() when appropriate.
- Minor cleanup of `pip cache`-related files in docs/.
  • Loading branch information
duckinator committed Apr 1, 2020
1 parent 554133a commit 2d97830
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/html/reference/pip_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. _`pip cache`:

pip cache
------------
---------

.. contents::

Expand Down
4 changes: 2 additions & 2 deletions docs/man/commands/cache.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
:orphan:

==========
=========
pip-cache
==========
=========

Description
***********
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
)),
('cache', CommandInfo(
'pip._internal.commands.cache', 'CacheCommand',
"Inspect and manage pip's caches.",
"Inspect and manage pip's cache.",
)),
('wheel', CommandInfo(
'pip._internal.commands.wheel', 'WheelCommand',
Expand Down
10 changes: 5 additions & 5 deletions src/pip/_internal/commands/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

class CacheCommand(Command):
"""
Inspect and manage pip's caches.
Inspect and manage pip's cache.
Subcommands:
info:
Show information about the caches.
Show information about the cache.
list:
List filenames of packages stored in the cache.
remove:
Expand Down Expand Up @@ -107,15 +107,15 @@ def list_cache_items(self, options, args):
files = self._find_wheels(options, pattern)

if not files:
logger.info('Nothing is currently cached.')
logger.info('Nothing cached.')
return

results = []
for filename in files:
wheel = os.path.basename(filename)
size = filesystem.friendly_file_size(filename)
results.append(' - {} ({})'.format(wheel, size))
logger.info('Current cache contents:\n')
logger.info('Cache contents:\n')
logger.info('\n'.join(sorted(results)))

def remove_cache_items(self, options, args):
Expand All @@ -133,7 +133,7 @@ def remove_cache_items(self, options, args):
for filename in files:
os.unlink(filename)
logger.debug('Removed %s', filename)
logger.info('Removed %s files', len(files))
logger.info('Removed %s file(s)', len(files))

def purge_cache(self, options, args):
# type: (Values, List[Any]) -> None
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_cache_info(script, monkeypatch):
result = script.pip('cache', 'info')
cache_dir = _cache_dir(script)

assert 'Location: %s' % cache_dir in result.stdout
assert 'Location: {}'.format(cache_dir) in result.stdout
# TODO(@duckinator): This should probably test that the number of
# packages is actually correct, but I'm not sure how to do that
# without pretty much re-implementing the entire cache info command.
Expand Down

0 comments on commit 2d97830

Please sign in to comment.