[commands/cache] Minor clean-up.

- 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/.
This commit is contained in:
Ellen Marie Dash 2020-01-13 17:53:16 -05:00
parent 554133a90e
commit 2d978309a2
5 changed files with 10 additions and 10 deletions

View File

@ -2,7 +2,7 @@
.. _`pip cache`:
pip cache
------------
---------
.. contents::

View File

@ -1,8 +1,8 @@
:orphan:
==========
=========
pip-cache
==========
=========
Description
***********

View File

@ -66,7 +66,7 @@ commands_dict = OrderedDict([
)),
('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',

View File

@ -20,12 +20,12 @@ logger = logging.getLogger(__name__)
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:
@ -107,7 +107,7 @@ class CacheCommand(Command):
files = self._find_wheels(options, pattern)
if not files:
logger.info('Nothing is currently cached.')
logger.info('Nothing cached.')
return
results = []
@ -115,7 +115,7 @@ class CacheCommand(Command):
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):
@ -133,7 +133,7 @@ class CacheCommand(Command):
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

View File

@ -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.