launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00214
[Merge] lp:~jtv/launchpad/translations-lint into lp:launchpad/devel
Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/translations-lint into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers): code
= Translations lint =
Cleans up bits of lint and general non-prettiness that were in the way of another branch.
Jeroen
--
https://code.launchpad.net/~jtv/launchpad/translations-lint/+merge/30633
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/translations-lint into lp:launchpad/devel.
=== modified file 'lib/lp/translations/interfaces/pofile.py'
--- lib/lp/translations/interfaces/pofile.py 2010-05-27 14:38:56 +0000
+++ lib/lp/translations/interfaces/pofile.py 2010-07-22 10:52:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
@@ -147,22 +147,12 @@
translations for.
"""
- def translated():
- """
- Return an iterator over translated message sets in this PO file.
- """
-
def untranslatedCount():
"""
Return the number of messages which this PO file has no translation
for.
"""
- def untranslated():
- """
- Return an iterator over untranslated message sets in this PO file.
- """
-
def getHeader():
"""Return an `ITranslationHeaderData` representing its header."""
=== modified file 'lib/lp/translations/interfaces/translationexporter.py'
--- lib/lp/translations/interfaces/translationexporter.py 2009-07-17 00:26:05 +0000
+++ lib/lp/translations/interfaces/translationexporter.py 2010-07-22 10:52:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py 2010-07-20 18:10:08 +0000
+++ lib/lp/translations/model/pofile.py 2010-07-22 10:52:49 +0000
@@ -605,21 +605,6 @@
"Calling prepareTranslationCredits on a message with "
"unknown credits type '%s'." % credits_type.title)
- def translated(self):
- """See `IPOFile`."""
- raise NotImplementedError
- # return iter(TranslationMessage.select('''
- # POMsgSet.pofile = %d AND
- # POMsgSet.iscomplete=TRUE AND
- # POMsgSet.potmsgset = POTMsgSet.id AND
- # POTMsgSet.sequence > 0''' % self.id,
- # clauseTables = ['POMsgSet']
- # ))
-
- def untranslated(self):
- """See `IPOFile`."""
- raise NotImplementedError
-
def _getLanguageVariantClause(self, table='TranslationMessage'):
if self.variant is None:
clause = '%(table)s.variant IS NULL' % dict(table=table)
@@ -1460,14 +1445,6 @@
"""See `IPOFile`."""
raise NotImplementedError
- def translated(self):
- """See `IPOFile`."""
- raise NotImplementedError
-
- def untranslated(self):
- """See `IPOFile`."""
- raise NotImplementedError
-
def getStatistics(self):
"""See `IPOFile`."""
return (0, 0, 0, )
@@ -1528,9 +1505,10 @@
assert productseries is None or distroseries is None, (
'productseries and sourcepackagename/distroseries cannot be used'
' at the same time.')
- assert ((sourcepackagename is None and distroseries is None) or
- (sourcepackagename is not None and distroseries is not None)
- ), ('sourcepackagename and distroseries must be None or not'
+ assert (
+ (sourcepackagename is None and distroseries is None) or
+ (sourcepackagename is not None and distroseries is not None)), (
+ 'sourcepackagename and distroseries must be None or not'
' None at the same time.')
store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
=== modified file 'lib/lp/translations/scripts/po_export_queue.py'
--- lib/lp/translations/scripts/po_export_queue.py 2010-03-05 20:40:40 +0000
+++ lib/lp/translations/scripts/po_export_queue.py 2010-07-22 10:52:49 +0000
@@ -176,7 +176,6 @@
return export_requested_at
-
def _getRequestedExportsNames(self):
"""Return a list of display names for requested exports."""
requested_names = []
@@ -194,8 +193,8 @@
template = helpers.get_email_template(
'poexport-failure.txt', 'translations')
return template % {
- 'person' : self.person.displayname,
- 'request_url' : self.request_url,
+ 'person': self.person.displayname,
+ 'request_url': self.request_url,
}
def _getFailedRequestsDescription(self):
@@ -212,15 +211,14 @@
def _getAdminFailureNotificationEmailBody(self):
"""Send an email notification about failed export to admins."""
template = helpers.get_email_template(
- 'poexport-failure-admin-notification.txt',
- 'translations')
+ 'poexport-failure-admin-notification.txt', 'translations')
failed_requests = self._getFailedRequestsDescription()
return template % {
- 'person' : self.person.displayname,
- 'person_id' : self.person.name,
- 'request_url' : self.request_url,
- 'failure_message' : self.failure,
- 'failed_requests' : failed_requests,
+ 'person': self.person.displayname,
+ 'person_id': self.person.name,
+ 'request_url': self.request_url,
+ 'failure_message': self.failure,
+ 'failed_requests': failed_requests,
}
def _getUnicodeDecodeErrorEmailBody(self):
@@ -230,10 +228,10 @@
'translations')
failed_requests = self._getFailedRequestsDescription()
return template % {
- 'person' : self.person.displayname,
- 'person_id' : self.person.name,
- 'request_url' : self.request_url,
- 'failed_requests' : failed_requests,
+ 'person': self.person.displayname,
+ 'person_id': self.person.name,
+ 'request_url': self.request_url,
+ 'failed_requests': failed_requests,
}
def _getSuccessEmailBody(self):
@@ -241,9 +239,9 @@
template = helpers.get_email_template(
'poexport-success.txt', 'translations')
return template % {
- 'person' : self.person.displayname,
- 'download_url' : self.url,
- 'request_url' : self.request_url,
+ 'person': self.person.displayname,
+ 'download_url': self.url,
+ 'request_url': self.request_url,
}
def notify(self):
=== modified file 'lib/lp/translations/utilities/doc/kde-po-file-format.txt'
--- lib/lp/translations/utilities/doc/kde-po-file-format.txt 2009-07-02 17:16:50 +0000
+++ lib/lp/translations/utilities/doc/kde-po-file-format.txt 2010-07-22 10:52:49 +0000
@@ -127,7 +127,8 @@
Messages which are preceded with just '_n:' and no space after it are
not considered plural forms messages.
- >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText(u'_n:bar\nbars')
+ >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText(
+ ... u'_n:bar\nbars')
>>> print potmsgset.singular_text
_n:bar
bars
@@ -181,7 +182,8 @@
... msgid "_n: %%d foo\n%%d foos"
... msgstr "%%d translation\n%%d translationes\n%%d translations"
...
- ... # Legacy KDE PO files allow multiple messages with same singular msgid.
+ ... # Legacy KDE PO files allow multiple messages with the same
+ ... # singular msgid.
... msgid "%%d foo"
... msgstr "no-plural translation %%d"
...
@@ -193,8 +195,8 @@
... ''' % ISO_FORMATTED_DATE
Importing this file succeeds, even if the number of %d printf specifications
-doesn't match: this is because this is now specially handled with KDE PO format
-support.
+doesn't match: this is because this is now specially handled with KDE PO
+format support.
>>> entry = import_pofile_or_potemplate(firefox_serbian_pofile_contents,
... carlos,
=== modified file 'lib/lp/translations/utilities/kde_po_exporter.py'
--- lib/lp/translations/utilities/kde_po_exporter.py 2009-07-17 00:26:05 +0000
+++ lib/lp/translations/utilities/kde_po_exporter.py 2010-07-22 10:52:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Export module for KDE legacy .po file format.
@@ -14,7 +14,7 @@
__metaclass__ = type
__all__ = [
- 'KdePOExporter'
+ 'KdePOExporter',
]
from zope.interface import implements
=== modified file 'lib/lp/translations/utilities/tests/test_gettext_po_exporter.py'
--- lib/lp/translations/utilities/tests/test_gettext_po_exporter.py 2010-07-21 15:43:25 +0000
+++ lib/lp/translations/utilities/tests/test_gettext_po_exporter.py 2010-07-22 10:52:49 +0000
@@ -45,11 +45,16 @@
if (not line.startswith('"X-Launchpad-Export-Date:') and
not line.startswith('"X-Generator: Launchpad'))]
- for i in range(len(import_lines)):
+ line_pairs = zip(export_lines, import_lines)
+ debug_diff = test_diff(import_lines, export_lines)
+ for lineno, export_line, import_line in line_pairs:
self.assertEqual(
- export_lines[i], import_lines[i],
- "Output doesn't match:\n\n %s" % test_diff(
- import_lines, export_lines))
+ export_line, import_line,
+ "Output doesn't match:\n\n %s" % debug_diff)
+
+ self.assertEqual(
+ len(export_lines), len(import_lines),
+ "Output has excess lines:\n\n %s" % debug_diff)
def testInterface(self):
"""Check whether the object follows the interface."""
=== modified file 'lib/lp/translations/utilities/xpi_po_exporter.py'
--- lib/lp/translations/utilities/xpi_po_exporter.py 2009-07-17 00:26:05 +0000
+++ lib/lp/translations/utilities/xpi_po_exporter.py 2010-07-22 10:52:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=W0231
@@ -7,7 +7,7 @@
__metaclass__ = type
__all__ = [
- 'XPIPOExporter'
+ 'XPIPOExporter',
]
from zope.interface import implements