From 1b38fff5cef24d4bafb4abfa53cf0000b9d0f598 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sun, 21 Feb 2010 12:20:47 +0100 Subject: [PATCH] Better names for some functions and values --- patoolib/__init__.py | 12 ++++++------ tests/test_config.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 4e8e7e3..ea4860c 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -18,8 +18,8 @@ import shutil from distutils.spawn import find_executable from . import util -# Supported command modes -CommandModes = ('list', 'extract') +# Supported archive commands +ArchiveCommands = ('list', 'extract') # Supported archive formats ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar', @@ -136,8 +136,8 @@ def check_archive_format (format, encoding): raise util.PatoolError("unkonwn archive encoding `%s'" % encoding) -def check_command_mode (mode): - if mode not in CommandModes: +def check_archive_command (mode): + if mode not in ArchiveCommands: raise util.PatoolError("invalid command mode `%s'" % mode) @@ -161,7 +161,7 @@ def find_archive_program (format, mode): def list_formats (): for format in ArchiveFormats: print format, "files:" - for mode in CommandModes: + for mode in ArchiveCommands: program = find_archive_program(format, mode) if program: print " %8s: %s" % (mode, program) @@ -259,7 +259,7 @@ def _handle_archive (archive, mode, **kwargs): encoding = None format, encoding = get_archive_format(archive) check_archive_format(format, encoding) - check_command_mode(mode) + check_archive_command(mode) config = parse_config(format, mode, **kwargs) cmd = config['cmd'] # get python module for given archive program diff --git a/tests/test_config.py b/tests/test_config.py index 0babc07..4dfca3b 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -27,7 +27,7 @@ class TestConfiguration (unittest.TestCase): # test that the key is an archive format self.assertEqual(set(patoolib.ArchiveFormats), set(patoolib.ArchivePrograms.keys())) - for modes in patoolib.ArchivePrograms.values(): - for mode in modes: - if mode is not None: - self.assertTrue(mode in patoolib.CommandModes) + for commands in patoolib.ArchivePrograms.values(): + for command in commands: + if command is not None: + self.assertTrue(command in patoolib.ArchiveCommands)