launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19629
[Merge] lp:~cjwatson/launchpad/translations-lint into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/translations-lint into lp:launchpad.
Commit message:
Remove lots of lint from lp.translations.
Requested reviews:
Colin Watson (cjwatson)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/translations-lint/+merge/274432
Remove lots of lint from lp.translations.
--
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/translations/browser/tests/test_pofile_view.py'
--- lib/lp/translations/browser/tests/test_pofile_view.py 2015-10-13 16:58:20 +0000
+++ lib/lp/translations/browser/tests/test_pofile_view.py 2015-10-14 16:29:12 +0000
@@ -3,7 +3,6 @@
__metaclass__ = type
-from testtools.matchers import Equals
from zope.component import getUtility
from lp.app.errors import UnexpectedFormData
=== modified file 'lib/lp/translations/browser/translationlinksaggregator.py'
--- lib/lp/translations/browser/translationlinksaggregator.py 2011-12-24 17:49:30 +0000
+++ lib/lp/translations/browser/translationlinksaggregator.py 2015-10-14 16:29:12 +0000
@@ -116,7 +116,7 @@
products = set(series.product for series in productseries)
sourcepackagenames = set(
- template.sourcepackagename
+ template.sourcepackagename
for template in templates
if template.sourcepackagename)
@@ -171,8 +171,8 @@
def aggregate(self, sheets):
"""Aggregate `sheets` into a list of translation target descriptions.
- Targets are aggregated into "sensible" chunks first.c
-
+ Targets are aggregated into "sensible" chunks first.
+
:return: A list of whatever the implementation for `describe`
returns for the sensible chunks.
"""
=== modified file 'lib/lp/translations/interfaces/customlanguagecode.py'
--- lib/lp/translations/interfaces/customlanguagecode.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/customlanguagecode.py 2015-10-14 16:29:12 +0000
@@ -82,6 +82,6 @@
def removeCustomLanguageCode(language_code):
"""Remove `CustomLanguageCode`.
-
+
:param language_code: A `CustomLanguageCode` object.
"""
=== modified file 'lib/lp/translations/interfaces/distroserieslanguage.py'
--- lib/lp/translations/interfaces/distroserieslanguage.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/distroserieslanguage.py 2015-10-14 16:29:12 +0000
@@ -16,6 +16,7 @@
'IDistroSeriesLanguageSet',
]
+
class IDistroSeriesLanguage(IRosettaStats):
"""A placeholder for the statistics in the translation of a
distroseries into a language, for example, Ubuntu Hoary into French.
@@ -58,4 +59,3 @@
"""Return a new DummyDistroSeriesLanguage for the given
distroseries and language.
"""
-
=== modified file 'lib/lp/translations/interfaces/pomsgid.py'
--- lib/lp/translations/interfaces/pomsgid.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/pomsgid.py 2015-10-14 16:29:12 +0000
@@ -14,6 +14,7 @@
__all__ = ('IPOMsgID', )
+
class IPOMsgID(Interface):
"""A PO message ID."""
=== modified file 'lib/lp/translations/interfaces/potemplate.py'
--- lib/lp/translations/interfaces/potemplate.py 2015-09-28 17:38:45 +0000
+++ lib/lp/translations/interfaces/potemplate.py 2015-10-14 16:29:12 +0000
@@ -15,7 +15,6 @@
)
from zope.schema import (
Bool,
- Bytes,
Choice,
Datetime,
Int,
=== modified file 'lib/lp/translations/interfaces/potranslation.py'
--- lib/lp/translations/interfaces/potranslation.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/potranslation.py 2015-10-14 16:29:12 +0000
@@ -11,6 +11,7 @@
__all__ = ('IPOTranslation', )
+
class IPOTranslation(Interface):
"""A translation in a PO file."""
=== modified file 'lib/lp/translations/interfaces/rosettastats.py'
--- lib/lp/translations/interfaces/rosettastats.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/rosettastats.py 2015-10-14 16:29:12 +0000
@@ -8,6 +8,7 @@
__all__ = ('IRosettaStats', )
+
class IRosettaStats(Interface):
"""Rosetta-related statistics."""
=== modified file 'lib/lp/translations/interfaces/translationexporter.py'
--- lib/lp/translations/interfaces/translationexporter.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/translationexporter.py 2015-10-14 16:29:12 +0000
@@ -73,7 +73,6 @@
"""
-
class ITranslationFormatExporter(Interface):
"""Translation file format exporter."""
=== modified file 'lib/lp/translations/interfaces/translationfileformat.py'
--- lib/lp/translations/interfaces/translationfileformat.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/translationfileformat.py 2015-10-14 16:29:12 +0000
@@ -59,4 +59,3 @@
Gettext's standard text file format but contains only those msgids
that were changed compared to the imported version.
""")
-
=== modified file 'lib/lp/translations/interfaces/translationpolicy.py'
--- lib/lp/translations/interfaces/translationpolicy.py 2011-12-24 16:54:44 +0000
+++ lib/lp/translations/interfaces/translationpolicy.py 2015-10-14 16:29:12 +0000
@@ -36,8 +36,8 @@
"""
translationgroup = exported(ReferenceChoice(
- title = _("Translation group"),
- description = _("The translation group that helps review "
+ title=_("Translation group"),
+ description=_("The translation group that helps review "
" translations for this project or distribution. The group's "
" role depends on the permissions policy selected below."),
required=False,
=== modified file 'lib/lp/translations/interfaces/vpoexport.py'
--- lib/lp/translations/interfaces/vpoexport.py 2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/vpoexport.py 2015-10-14 16:29:12 +0000
@@ -146,4 +146,3 @@
title=u"Translation in plural form 5",
description=u"As in ITranslationMessage.",
readonly=True, required=False)
-
=== modified file 'lib/lp/translations/model/distroserieslanguage.py'
--- lib/lp/translations/model/distroserieslanguage.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/model/distroserieslanguage.py 2015-10-14 16:29:12 +0000
@@ -95,7 +95,7 @@
''' % sqlvalues(self.distroseries.distribution.id,
self.language.id),
orderBy=['id'],
- clauseTables=['TranslationGroup', 'Distribution',],
+ clauseTables=['TranslationGroup', 'Distribution'],
distinct=True)
@property
@@ -231,4 +231,3 @@
def getDummy(self, distroseries, language):
"""See IDistroSeriesLanguageSet."""
return DummyDistroSeriesLanguage(distroseries, language)
-
=== modified file 'lib/lp/translations/model/pomsgid.py'
--- lib/lp/translations/model/pomsgid.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/model/pomsgid.py 2015-10-14 16:29:12 +0000
@@ -40,4 +40,3 @@
raise SQLObjectNotFound(key)
return r
byMsgid = classmethod(byMsgid)
-
=== modified file 'lib/lp/translations/model/potranslation.py'
--- lib/lp/translations/model/potranslation.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/model/potranslation.py 2015-10-14 16:29:12 +0000
@@ -62,4 +62,3 @@
return cls(translation=key)
getOrCreateTranslation = classmethod(getOrCreateTranslation)
-
=== modified file 'lib/lp/translations/model/translationgroup.py'
--- lib/lp/translations/model/translationgroup.py 2015-10-13 13:22:08 +0000
+++ lib/lp/translations/model/translationgroup.py 2015-10-14 16:29:12 +0000
@@ -131,11 +131,11 @@
found = len(projects)
if found < goal:
projects.extend(
- list(self.projects[:goal-found]))
+ list(self.projects[:goal - found]))
found = len(projects)
if found < goal:
projects.extend(
- list(self.products[:goal-found]))
+ list(self.products[:goal - found]))
return projects
@property
=== modified file 'lib/lp/translations/model/translationsperson.py'
--- lib/lp/translations/model/translationsperson.py 2015-07-09 12:18:51 +0000
+++ lib/lp/translations/model/translationsperson.py 2015-10-14 16:29:12 +0000
@@ -270,7 +270,7 @@
tables=[
DistroSeries,
Join(
- Distribution,
+ Distribution,
And(
Distribution.id == DistroSeries.distributionID,
Distribution.translations_usage ==
=== modified file 'lib/lp/translations/model/vpotexport.py'
--- lib/lp/translations/model/vpotexport.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/model/vpotexport.py 2015-10-14 16:29:12 +0000
@@ -5,7 +5,9 @@
__metaclass__ = type
-__all__ = [ 'VPOTExport' ]
+__all__ = [
+ 'VPOTExport',
+ ]
from zope.interface import implementer
=== modified file 'lib/lp/translations/scripts/fix_plural_forms.py'
--- lib/lp/translations/scripts/fix_plural_forms.py 2011-12-30 06:14:56 +0000
+++ lib/lp/translations/scripts/fix_plural_forms.py 2015-10-14 16:29:12 +0000
@@ -87,4 +87,3 @@
fix_pofile_plurals(pofile, logger, ztm)
except SQLObjectNotFound:
pass
-
=== modified file 'lib/lp/translations/scripts/tests/test_packaging_translations.py'
--- lib/lp/translations/scripts/tests/test_packaging_translations.py 2014-08-22 08:01:26 +0000
+++ lib/lp/translations/scripts/tests/test_packaging_translations.py 2015-10-14 16:29:12 +0000
@@ -15,7 +15,6 @@
TestCaseWithFactory,
)
from lp.testing.layers import ZopelessAppServerLayer
-from lp.translations.model.translationpackagingjob import TranslationSplitJob
from lp.translations.tests.test_translationpackagingjob import (
make_translation_merge_job,
)
=== modified file 'lib/lp/translations/scripts/upload_translations.py'
--- lib/lp/translations/scripts/upload_translations.py 2011-05-27 19:53:20 +0000
+++ lib/lp/translations/scripts/upload_translations.py 2015-10-14 16:29:12 +0000
@@ -58,8 +58,8 @@
content = open(filename).read()
queue.addOrUpdateEntry(
filename, content, True, rosetta_team,
- sourcepackagename = self.sourcepackagename,
- distroseries = self.distroseries)
+ sourcepackagename=self.sourcepackagename,
+ distroseries=self.distroseries)
self._commit()
self.logger.info("Done.")
=== modified file 'lib/lp/translations/scripts/validate_translations_file.py'
--- lib/lp/translations/scripts/validate_translations_file.py 2012-06-29 08:40:05 +0000
+++ lib/lp/translations/scripts/validate_translations_file.py 2015-10-14 16:29:12 +0000
@@ -57,12 +57,12 @@
name = 'validate-translations-file'
validators = {
- 'dtd': validate_dtd,
- 'manifest': validate_xpi_manifest,
- 'po': validate_po,
- 'pot': validate_po,
- 'xpi': validate_xpi,
- }
+ 'dtd': validate_dtd,
+ 'manifest': validate_xpi_manifest,
+ 'po': validate_po,
+ 'pot': validate_po,
+ 'xpi': validate_xpi,
+ }
def __init__(self, test_args=None):
"""Set up basic facilities, similar to `LaunchpadScript`."""
=== modified file 'lib/lp/translations/tests/test_clearcurrenttranslation.py'
--- lib/lp/translations/tests/test_clearcurrenttranslation.py 2011-12-30 06:14:56 +0000
+++ lib/lp/translations/tests/test_clearcurrenttranslation.py 2015-10-14 16:29:12 +0000
@@ -150,7 +150,7 @@
traits.setFlag(tm, True)
other_template = self.makeOtherPOTemplate()
- other_pofile = self._makePOFile(potemplate=other_template)
+ self._makePOFile(potemplate=other_template)
other_tm = self._makeTranslationMessage(potmsgset, pofile)
traits.other_side_traits.setFlag(other_tm, True)
=== modified file 'lib/lp/translations/tests/test_generate_translation_templates.py'
--- lib/lp/translations/tests/test_generate_translation_templates.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_generate_translation_templates.py 2015-10-14 16:29:12 +0000
@@ -92,10 +92,11 @@
workdir = self.makeTemporaryDirectory()
branchdir = os.path.join(workdir, 'branchdir')
dummy_tar = os.path.join(
- os.path.dirname(__file__),'dummy_templates.tar.gz')
+ os.path.dirname(__file__), 'dummy_templates.tar.gz')
tar = tarfile.open(dummy_tar, 'r|*')
tar.extractall(branchdir)
- potnames = [member.name for member in tar.getmembers() if not member.isdir()]
+ potnames = [
+ member.name for member in tar.getmembers() if not member.isdir()]
tar.close()
generator = GenerateTranslationTemplates(
=== modified file 'lib/lp/translations/tests/test_potmsgset.py'
--- lib/lp/translations/tests/test_potmsgset.py 2015-09-28 17:38:45 +0000
+++ lib/lp/translations/tests/test_potmsgset.py 2015-10-14 16:29:12 +0000
@@ -261,7 +261,7 @@
shared_translation)
# Adding a diverged translation doesn't break getSharedTM.
- diverged_translation = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset, diverged=True)
self.assertEquals(
self.potmsgset.getSharedTranslation(
@@ -333,7 +333,7 @@
# An empty suggestion is never returned.
self.potmsgset.setSequence(self.stable_potemplate, 1)
pofile = self.factory.makePOFile('sr', self.stable_potemplate)
- empty_suggestion = self.factory.makeSuggestion(
+ self.factory.makeSuggestion(
pofile=pofile, potmsgset=self.potmsgset, translations=[None])
self.assertContentEqual(
[],
@@ -369,7 +369,7 @@
# If there are only suggestions on the external POTMsgSet,
# no externally used suggestions are returned.
- external_suggestion = self.factory.makeSuggestion(
+ self.factory.makeSuggestion(
pofile=external_pofile, potmsgset=external_potmsgset)
transaction.commit()
@@ -475,7 +475,7 @@
# A current translation on the external POTMsgSet is not
# considered an external suggestion.
- current_translation = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=external_pofile, potmsgset=external_potmsgset)
transaction.commit()
@@ -503,7 +503,7 @@
# If only a current, non-imported translation exists, it's not
# changed in Ubuntu.
- current_shared = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset)
self.assertEquals(
self.potmsgset.hasTranslationChangedInLaunchpad(
@@ -522,7 +522,7 @@
# If there's a current, diverged translation, and an imported
# non-current one, it's changed in Ubuntu.
- current_diverged = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=sr_pofile, potmsgset=self.potmsgset, diverged=True)
self.assertEquals(
self.potmsgset.hasTranslationChangedInLaunchpad(
@@ -945,7 +945,7 @@
other_pofile = self.factory.makePOFile(
self.pofile.language.code, potemplate=other_potemplate)
- message_this = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=self.pofile, potmsgset=self.potmsgset)
self.potmsgset.setSequence(
other_potemplate, self.factory.getUniqueInteger())
@@ -1193,7 +1193,7 @@
]
for sequence, credits_string in enumerate(gnome_credits):
credits = self.factory.makePOTMsgSet(
- self.potemplate, credits_string, sequence=sequence+1)
+ self.potemplate, credits_string, sequence=sequence + 1)
self.assertTrue(credits.is_translation_credit)
self.assertEqual(TranslationCreditsType.GNOME,
credits.translation_credits_type)
@@ -1372,7 +1372,7 @@
shared_message = self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset, translator=owner,
translations=translation)
- diverged_message = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset, translator=owner,
translations=translation2, diverged=True)
@@ -1418,7 +1418,7 @@
translation = {0: self.factory.getUniqueString()}
karma_listener = self._listenForKarma(pofile)
- suggestion = potmsgset.submitSuggestion(pofile, owner, translation)
+ potmsgset.submitSuggestion(pofile, owner, translation)
self.assertEqual([], karma_listener.karma_events)
@@ -1517,7 +1517,7 @@
lock_timestamp = datetime.now(pytz.UTC) - timedelta(minutes=5)
# Meanwhile someone else changes the same message's translation.
- newer_translation = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
# This raises a translation conflict.
@@ -1561,7 +1561,7 @@
translations = {
0: self.factory.getUniqueString('translation'), }
origin = RosettaTranslationOrigin.SCM
- message = potmsgset.setCurrentTranslation(
+ potmsgset.setCurrentTranslation(
pofile_other_language, pofile.potemplate.owner,
translations, origin)
@@ -1628,7 +1628,7 @@
translations_diverged = {
0: self.factory.getUniqueString('diverged'), }
origin = RosettaTranslationOrigin.SCM
- shared_message = potmsgset.setCurrentTranslation(
+ potmsgset.setCurrentTranslation(
pofile, pofile.potemplate.owner, translations_shared, origin)
diverged_message = potmsgset.submitSuggestion(
pofile, pofile.potemplate.owner, translations_diverged)
@@ -1933,8 +1933,6 @@
flagscomment=self.factory.getUniqueString('flagscomment'),
)
new_msgset = msgset.clone()
- naked_msgset = removeSecurityProxy(msgset)
- naked_new_msgset = removeSecurityProxy(new_msgset)
self.assertNotEqual(msgset.id, new_msgset.id)
self.assertEqual(msgset.context, new_msgset.context)
self.assertEqual(msgset.msgid_singular, new_msgset.msgid_singular)
=== modified file 'lib/lp/translations/tests/test_pottery_detect_intltool.py'
--- lib/lp/translations/tests/test_pottery_detect_intltool.py 2012-06-29 08:40:05 +0000
+++ lib/lp/translations/tests/test_pottery_detect_intltool.py 2015-10-14 16:29:12 +0000
@@ -478,7 +478,7 @@
""")
self.assertEqual(
['param1', 'param2'], configfile.getFunctionParams('ML_FUNC_2'))
-
+
def test_getFunctionParams_strips_quotes(self):
# Quotes get stripped off function parameters.
configfile = self._makeConfigFile('FUNC("param")')
=== modified file 'lib/lp/translations/tests/test_productserieslanguage.py'
--- lib/lp/translations/tests/test_productserieslanguage.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_productserieslanguage.py 2015-10-14 16:29:12 +0000
@@ -69,11 +69,11 @@
# Add a Serbian translation.
serbian = getUtility(ILanguageSet).getLanguageByCode('sr')
- sr_pofile = self.factory.makePOFile(serbian.code, potemplate)
+ self.factory.makePOFile(serbian.code, potemplate)
# Add another translation (eg. "Albanian", so it sorts
# it before Serbian).
albanian = getUtility(ILanguageSet).getLanguageByCode('sq')
- sq_pofile = self.factory.makePOFile(albanian.code, potemplate)
+ self.factory.makePOFile(albanian.code, potemplate)
languages = [psl.language for psl in
self.productseries.productserieslanguages]
@@ -90,7 +90,7 @@
# Add Serbian translation for one POTemplate.
serbian = getUtility(ILanguageSet).getLanguageByCode('sr')
- pofile1 = self.factory.makePOFile(serbian.code, potemplate1)
+ self.factory.makePOFile(serbian.code, potemplate1)
psls = list(self.productseries.productserieslanguages)
# `pofile` is not set when there's more than one template.
@@ -107,7 +107,7 @@
potemplate = self.factory.makePOTemplate(
productseries=self.productseries)
for sequence in range(number_of_potmsgsets):
- self.factory.makePOTMsgSet(potemplate, sequence=sequence+1)
+ self.factory.makePOTMsgSet(potemplate, sequence=sequence + 1)
removeSecurityProxy(potemplate).messagecount = number_of_potmsgsets
return potemplate
@@ -153,7 +153,7 @@
# Adding a single template with 10 messages makes the total
# count of messages go up to 10.
- potemplate = self.createPOTemplateWithPOTMsgSets(10)
+ self.createPOTemplateWithPOTMsgSets(10)
psl = self.psl_set.getProductSeriesLanguage(
self.productseries, self.language)
psl.recalculateCounts()
@@ -247,8 +247,8 @@
def test_recalculateCounts_no_pofiles(self):
# Test that recalculateCounts works correctly even when there
# are no POFiles returned.
- potemplate1 = self.createPOTemplateWithPOTMsgSets(1)
- potemplate2 = self.createPOTemplateWithPOTMsgSets(2)
+ self.createPOTemplateWithPOTMsgSets(1)
+ self.createPOTemplateWithPOTMsgSets(2)
psl = self.psl_set.getProductSeriesLanguage(self.productseries,
self.language)
psl.recalculateCounts()
=== modified file 'lib/lp/translations/tests/test_suggestions.py'
--- lib/lp/translations/tests/test_suggestions.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_suggestions.py 2015-10-14 16:29:12 +0000
@@ -102,7 +102,7 @@
text = "error message 936"
foomsg = self.factory.makePOTMsgSet(self.foo_template, text)
barmsg = self.factory.makePOTMsgSet(self.bar_template, text)
- translation = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=self.bar_nl, current_other=False, potmsgset=barmsg)
transaction.commit()
@@ -111,8 +111,10 @@
used_suggestions = foomsg.getExternallyUsedTranslationMessages(
self.nl)
self.assertEquals(len(used_suggestions), 1)
- used_suggestions = foomsg.getExternallySuggestedOrUsedTranslationMessages(
- used_languages=[self.nl], suggested_languages=[self.nl])[self.nl].used
+ used_suggestions = (
+ foomsg.getExternallySuggestedOrUsedTranslationMessages(
+ used_languages=[self.nl],
+ suggested_languages=[self.nl])[self.nl].used)
self.assertEquals(len(used_suggestions), 1)
# Override the config option to disable global suggestions.
@@ -189,8 +191,10 @@
self.nl)
self.assertEquals(len(suggestions), 1)
self.assertEquals(suggestions[0], suggestion1)
- suggestions = oof_potmsgset.getExternallySuggestedOrUsedTranslationMessages(
- suggested_languages=[self.nl], used_languages=[self.nl])[self.nl].used
+ suggestions = (
+ oof_potmsgset.getExternallySuggestedOrUsedTranslationMessages(
+ suggested_languages=[self.nl],
+ used_languages=[self.nl])[self.nl].used)
self.assertEquals(len(suggestions), 1)
self.assertEquals(suggestions[0], suggestion1)
@@ -201,11 +205,11 @@
translated_in_ubuntu = "Ubuntu translation."
translated_upstream = "Upstream translation."
potmsgset = self.factory.makePOTMsgSet(self.foo_template)
- suggestion1 = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=self.foo_nl, potmsgset=potmsgset,
translations={0: translated_in_ubuntu},
current_other=False)
- suggestion2 = self.factory.makeCurrentTranslationMessage(
+ self.factory.makeCurrentTranslationMessage(
pofile=self.foo_nl, potmsgset=potmsgset,
translations={0: translated_upstream},
current_other=True)
=== modified file 'lib/lp/translations/tests/test_translatedlanguage.py'
--- lib/lp/translations/tests/test_translatedlanguage.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_translatedlanguage.py 2015-10-14 16:29:12 +0000
@@ -31,7 +31,7 @@
# Create a productseries that uses translations.
TestCaseWithFactory.setUp(self)
product = self.factory.makeProduct(
- translations_usage = ServiceUsage.LAUNCHPAD)
+ translations_usage=ServiceUsage.LAUNCHPAD)
self.productseries = self.factory.makeProductSeries(
product=product)
self.parent = self.productseries
@@ -46,7 +46,7 @@
potemplate = self.factory.makePOTemplate(
productseries=self.productseries)
for sequence in range(number_of_potmsgsets):
- self.factory.makePOTMsgSet(potemplate, sequence=sequence+1)
+ self.factory.makePOTMsgSet(potemplate, sequence=sequence + 1)
removeSecurityProxy(potemplate).messagecount = number_of_potmsgsets
potemplate.priority = priority
return potemplate
@@ -139,7 +139,7 @@
# appropriately.
potemplate1 = self.addPOTemplate(priority=2)
pofile1 = self.addPOFile(potemplate1)
- potemplate2 = self.addPOTemplate(priority=1)
+ self.addPOTemplate(priority=1)
pofiles = translated_language.pofiles
self.assertEqual(pofile1, pofiles[0])
dummy_pofile = removeSecurityProxy(pofiles[1])
@@ -179,7 +179,7 @@
translated_language = self.getTranslatedLanguage(self.language)
# Three templates with different priorities so they get sorted
# appropriately.
- pofile1 = self.addPOFile(self.addPOTemplate(priority=2))
+ self.addPOFile(self.addPOTemplate(priority=2))
pofile2 = self.addPOFile(self.addPOTemplate(priority=1))
self.addPOTemplate(priority=0)
@@ -245,7 +245,7 @@
def test_recalculateCounts_total_one_pofile(self):
translated_language = self.getTranslatedLanguage(self.language)
potemplate = self.addPOTemplate(number_of_potmsgsets=5)
- pofile = self.addPOFile(potemplate)
+ self.addPOFile(potemplate)
translated_language.recalculateCounts()
self.assertEqual(
@@ -254,13 +254,13 @@
def test_recalculateCounts_total_two_pofiles(self):
translated_language = self.getTranslatedLanguage(self.language)
potemplate1 = self.addPOTemplate(number_of_potmsgsets=5)
- pofile1 = self.addPOFile(potemplate1)
+ self.addPOFile(potemplate1)
potemplate2 = self.addPOTemplate(number_of_potmsgsets=3)
- pofile2 = self.addPOFile(potemplate2)
+ self.addPOFile(potemplate2)
translated_language.recalculateCounts()
self.assertEqual(
- 5+3, translated_language.translation_statistics['total_count'])
+ 5 + 3, translated_language.translation_statistics['total_count'])
def test_recalculateCounts_translated_one_pofile(self):
translated_language = self.getTranslatedLanguage(self.language)
@@ -473,7 +473,7 @@
naked_pofile1.unreviewed_count = 3
# Set up second template with a single PO file.
- potemplate2 = self.addPOTemplate(number_of_potmsgsets=3)
+ self.addPOTemplate(number_of_potmsgsets=3)
translated_language.recalculateCounts()
=== modified file 'lib/lp/translations/tests/test_translationmessage.py'
--- lib/lp/translations/tests/test_translationmessage.py 2014-07-10 05:30:29 +0000
+++ lib/lp/translations/tests/test_translationmessage.py 2015-10-14 16:29:12 +0000
@@ -12,11 +12,9 @@
from pytz import UTC
from storm.locals import Store
-import transaction
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
-from lp.services.propertycache import clear_property_cache
from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.testing import (
TestCaseWithFactory,
@@ -345,7 +343,7 @@
potmsgset = self.factory.makePOTMsgSet(potemplate=template)
upstream_pofile = self.factory.makePOFile('nl')
ubuntu_pofile = self.factory.makePOFile('nl', potemplate=template)
- diverged_tm = self.factory.makeDivergedTranslationMessage(
+ self.factory.makeDivergedTranslationMessage(
pofile=upstream_pofile, potmsgset=potmsgset)
ubuntu_tm = self.factory.makeSuggestion(
pofile=ubuntu_pofile, potmsgset=potmsgset)
@@ -373,7 +371,6 @@
# An untranslated message receives an imported translation.
pofile = self.factory.makePOFile()
suggestion = self.factory.makeSuggestion(pofile=pofile)
- reviewer = self.factory.makePerson()
self.assertFalse(suggestion.is_current_upstream)
self.assertFalse(suggestion.is_current_ubuntu)
@@ -390,7 +387,6 @@
# side, subject to the share_with_other_side parameter.
pofile = self.factory.makePOFile()
suggestion = self.factory.makeSuggestion(pofile=pofile)
- reviewer = self.factory.makePerson()
self.assertFalse(suggestion.is_current_upstream)
self.assertFalse(suggestion.is_current_ubuntu)
@@ -404,7 +400,6 @@
# Accepting a suggestion does not update its review fields.
pofile = self.factory.makePOFile()
suggestion = self.factory.makeSuggestion(pofile=pofile)
- reviewer = self.factory.makePerson()
self.assertIs(None, suggestion.reviewer)
self.assertIs(None, suggestion.date_reviewed)
@@ -604,7 +599,7 @@
self._getStates(suggestion, ubuntu_message, upstream_message))
def test_accept_detects_conflict(self):
- ubuntu_message = self._makeUbuntuMessage()
+ self._makeUbuntuMessage()
suggestion = self._makeSuggestion()
old = datetime.now(UTC) - timedelta(days=1)
=== modified file 'lib/lp/translations/tests/test_translationtemplatescollection.py'
--- lib/lp/translations/tests/test_translationtemplatescollection.py 2012-01-01 02:58:52 +0000
+++ lib/lp/translations/tests/test_translationtemplatescollection.py 2015-10-14 16:29:12 +0000
@@ -187,8 +187,7 @@
def test_joinPOFile(self):
trunk = self.factory.makeProduct().getSeries('trunk')
translated_template = self.factory.makePOTemplate(productseries=trunk)
- untranslated_template = self.factory.makePOTemplate(
- productseries=trunk)
+ self.factory.makePOTemplate(productseries=trunk)
nl = translated_template.newPOFile('nl')
de = translated_template.newPOFile('de')
@@ -226,7 +225,7 @@
untranslated_template = self.factory.makePOTemplate(
productseries=trunk)
nl = translated_template.newPOFile('nl')
- de = translated_template.newPOFile('de')
+ translated_template.newPOFile('de')
collection = TranslationTemplatesCollection()
by_series = collection.restrictProductSeries(trunk)
=== modified file 'lib/lp/translations/utilities/gettext_po_exporter.py'
--- lib/lp/translations/utilities/gettext_po_exporter.py 2015-09-28 17:38:45 +0000
+++ lib/lp/translations/utilities/gettext_po_exporter.py 2015-10-14 16:29:12 +0000
@@ -177,7 +177,7 @@
escaped_line_len = escaped_new_block_len
while escaped_line_len > wrap_width:
escaped_line_len -= (
- escaped_length.get(line[line_len-1], 1))
+ escaped_length.get(line[line_len - 1], 1))
line_len -= 1
line = line[:line_len]
new_block = new_block[line_len:]
=== modified file 'lib/lp/translations/utilities/mozilla_dtd_parser.py'
--- lib/lp/translations/utilities/mozilla_dtd_parser.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/utilities/mozilla_dtd_parser.py 2015-10-14 16:29:12 +0000
@@ -136,7 +136,7 @@
try:
content = content.decode('utf-8')
except UnicodeDecodeError:
- raise TranslationFormatInvalidInputError, (
+ raise TranslationFormatInvalidInputError(
'Content is not valid UTF-8 text')
error_handler = DtdErrorHandler()
=== modified file 'lib/lp/translations/utilities/mozilla_xpi_importer.py'
--- lib/lp/translations/utilities/mozilla_xpi_importer.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/utilities/mozilla_xpi_importer.py 2015-10-14 16:29:12 +0000
@@ -159,8 +159,6 @@
self.messages.append(message)
-
-
def valid_property_msgid(msgid):
"""Whether the given msgid follows the restrictions to be valid.
@@ -208,7 +206,7 @@
try:
content = content.decode('utf-8')
except UnicodeDecodeError:
- raise TranslationFormatInvalidInputError, (
+ raise TranslationFormatInvalidInputError(
'Content is not valid unicode-escaped text')
line_num = 0
@@ -423,4 +421,3 @@
def getHeaderFromString(self, header_string):
"""See `ITranslationFormatImporter`."""
return XpiHeader(header_string)
-
=== modified file 'lib/lp/translations/utilities/mozilla_zip.py'
--- lib/lp/translations/utilities/mozilla_zip.py 2012-06-29 08:40:05 +0000
+++ lib/lp/translations/utilities/mozilla_zip.py 2015-10-14 16:29:12 +0000
@@ -168,5 +168,3 @@
"""Overridable hook: post-traversal actions."""
raise NotImplementedError(
"XPI traversal class provides no _finish().")
-
-
=== modified file 'lib/lp/translations/utilities/pluralforms.py'
--- lib/lp/translations/utilities/pluralforms.py 2012-06-29 08:40:05 +0000
+++ lib/lp/translations/utilities/pluralforms.py 2015-10-14 16:29:12 +0000
@@ -46,7 +46,7 @@
"but we found forms %s." % (expected_forms, found_forms))
return [
- {'form' : form, 'examples' : examples}
+ {'form': form, 'examples': examples}
for (form, examples) in forms.iteritems()
]
=== modified file 'lib/lp/translations/utilities/rosettastats.py'
--- lib/lp/translations/utilities/rosettastats.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/utilities/rosettastats.py 2015-10-14 16:29:12 +0000
@@ -5,6 +5,7 @@
from lp.translations.interfaces.rosettastats import IRosettaStats
+
# XXX: Carlos Perello Marin 2005-04-14 bug=396:
# This code should be change to be an adaptor.
=== modified file 'lib/lp/translations/utilities/tests/test_gettext_po_parser.py'
--- lib/lp/translations/utilities/tests/test_gettext_po_parser.py 2012-06-29 08:40:05 +0000
+++ lib/lp/translations/utilities/tests/test_gettext_po_parser.py 2015-10-14 16:29:12 +0000
@@ -19,6 +19,7 @@
"Content-Type: text/plain; charset=ASCII\\n"
'''
+
class POBasicTestCase(unittest.TestCase):
def setUp(self):
@@ -418,9 +419,9 @@
for n in range(1, foos):
msgidn = "foo%d" % n
self.assertEqual(
- messages[n-1].msgid_singular, msgidn, "incorrect msgid")
+ messages[n - 1].msgid_singular, msgidn, "incorrect msgid")
self.assertEqual(
- messages[n-1].translations[
+ messages[n - 1].translations[
TranslationConstants.SINGULAR_FORM],
"bar", "incorrect msgstr")
=== modified file 'lib/lp/translations/utilities/tests/test_gettext_pochanged_exporter.py'
--- lib/lp/translations/utilities/tests/test_gettext_pochanged_exporter.py 2011-12-28 17:03:06 +0000
+++ lib/lp/translations/utilities/tests/test_gettext_pochanged_exporter.py 2015-10-14 16:29:12 +0000
@@ -41,7 +41,7 @@
"Expected GettextPOChangedExporter to provide POCHANGED format "
"but got %r instead." % self.translation_exporter.format)
self.failUnlessEqual(
- self.translation_exporter.supported_source_formats ,
+ self.translation_exporter.supported_source_formats,
[],
"Expected GettextPOChangedExporter to support no source formats "
"but got %r instead." % (
=== modified file 'lib/lp/translations/utilities/tests/test_syntax_errors.py'
--- lib/lp/translations/utilities/tests/test_syntax_errors.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/utilities/tests/test_syntax_errors.py 2015-10-14 16:29:12 +0000
@@ -63,7 +63,6 @@
self.assertEqual(representation, "ro-\\u179a: hok baay heuy?")
-
class TranslationFormatSyntaxErrorTest(TestCase):
"""Test `TranslationFormatSyntaxError`."""
@@ -97,4 +96,3 @@
if __name__ == '__main__':
TextTestRunner().run(test_suite())
-
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_header.py'
--- lib/lp/translations/utilities/tests/test_xpi_header.py 2012-11-29 05:52:36 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_header.py 2015-10-14 16:29:12 +0000
@@ -104,7 +104,7 @@
self.assertEqual(header.getLastTranslator(), (None, None))
def test_WeirdContributor(self):
- # Contributor entries without well-formed email addresses are
+ # Contributor entries without well-formed email addresses are
# also ignored.
header = self._produceHeader(['Hello Mom!'])
self.assertEqual(header.getLastTranslator(), (None, None))
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_properties_format.py'
--- lib/lp/translations/utilities/tests/test_xpi_properties_format.py 2011-08-12 11:19:40 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_properties_format.py 2015-10-14 16:29:12 +0000
@@ -285,7 +285,7 @@
/* Escaped backslashes */
f\\\\oo=b\\\\ar
""").strip()
-
+
self.assertEqual(self.exporter.export(file).strip(), expected)
def test_escape_comment(self):
=== modified file 'lib/lp/translations/utilities/translation_common_format.py'
--- lib/lp/translations/utilities/translation_common_format.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/utilities/translation_common_format.py 2015-10-14 16:29:12 +0000
@@ -89,4 +89,3 @@
def resetAllTranslations(self):
"""See `ITranslationMessageData`."""
self._translations = []
-
=== modified file 'lib/lp/translations/utilities/xpi_header.py'
--- lib/lp/translations/utilities/xpi_header.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/utilities/xpi_header.py 2015-10-14 16:29:12 +0000
@@ -45,7 +45,7 @@
try:
self._text = header_content.decode(self.charset)
except UnicodeDecodeError:
- raise TranslationFormatInvalidInputError, (
+ raise TranslationFormatInvalidInputError(
"XPI header is not encoded in %s." % self.charset)
else:
assert isinstance(header_content, unicode), (
@@ -92,4 +92,3 @@
"""
# Nothing to do for this format.
return
-
References