# HG changeset patch # User cmlenz # Date 1182442358 0 # Node ID 212d8469ec8cafd7fb91a1f170b76bed1cf95259 # Parent 23005b4efc991a65283d4dce20e47b730efe765c Slightly simplified CLI-frontend class. diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -411,8 +411,7 @@ usage = '%%prog %s [options] %s' version = '%%prog %s' % VERSION - commands = ['compile', 'extract', 'init'] - command_descriptions = { + commands = { 'compile': 'compile a message catalog to a MO file', 'extract': 'extract messages from source files and generate a POT file', 'init': 'create new message catalogs from a template' @@ -442,9 +441,10 @@ print "commands:" longest = max([len(command) for command in self.commands]) format = " %%-%ds %%s" % max(11, longest) - self.commands.sort() - for command in self.commands: - print format % (command, self.command_descriptions[command]) + commands = self.commands.items() + commands.sort() + for name, description in commands: + print format % (name, description) def compile(self, argv): """Subcommand for compiling a message catalog to a MO file. @@ -452,7 +452,7 @@ :param argv: the command arguments """ parser = OptionParser(usage=self.usage % ('init',''), - description=self.command_descriptions['init']) + description=self.commands['init']) parser.add_option('--domain', '-D', dest='domain', help="domain of MO and PO files (default '%default')") parser.add_option('--directory', '-d', dest='directory', @@ -519,7 +519,7 @@ :param argv: the command arguments """ parser = OptionParser(usage=self.usage % ('extract', 'dir1 ...'), - description=self.command_descriptions['extract']) + description=self.commands['extract']) parser.add_option('--charset', dest='charset', help='charset to use in the output (default ' '"%default")') @@ -637,7 +637,7 @@ :param argv: the command arguments """ parser = OptionParser(usage=self.usage % ('init',''), - description=self.command_descriptions['init']) + description=self.commands['init']) parser.add_option('--domain', '-D', dest='domain', help="domain of PO file (default '%default')") parser.add_option('--input-file', '-i', dest='input_file', diff --git a/babel/messages/mofile.py b/babel/messages/mofile.py --- a/babel/messages/mofile.py +++ b/babel/messages/mofile.py @@ -20,6 +20,9 @@ import array import struct +__all__ = ['write_mo'] +__docformat__ = 'restructuredtext en' + def write_mo(fileobj, catalog, use_fuzzy=False): """Write a catalog to the specified file-like object using the GNU MO file format. diff --git a/babel/messages/pofile.py b/babel/messages/pofile.py --- a/babel/messages/pofile.py +++ b/babel/messages/pofile.py @@ -33,6 +33,7 @@ __all__ = ['unescape', 'denormalize', 'read_po', 'escape', 'normalize', 'write_po'] +__docformat__ = 'restructuredtext en' def unescape(string): r"""Reverse `escape` the given string.