diff options
author | Maurits van Rees <maurits@vanrees.org> | 2021-09-02 10:50:47 +0200 |
---|---|---|
committer | Maurits van Rees <maurits@vanrees.org> | 2021-09-03 10:18:34 +0200 |
commit | 332629aa14660a10d1e37f02d35847f3229f0844 (patch) | |
tree | 233d299d9a3ae64079a67d6ba6ce07457d0e1041 | |
parent | 55532a6b34e9aafc7cd44044c0fbb762351b147c (diff) | |
download | zope-i18n-332629aa14660a10d1e37f02d35847f3229f0844.tar.gz |
Manually fix other lint errors.
-rw-r--r-- | src/zope/i18n/__init__.py | 4 | ||||
-rw-r--r-- | src/zope/i18n/compile.py | 11 | ||||
-rw-r--r-- | src/zope/i18n/interfaces/__init__.py | 6 | ||||
-rw-r--r-- | src/zope/i18n/locales/__init__.py | 4 | ||||
-rw-r--r-- | src/zope/i18n/locales/tests/test_xmlfactory.py | 13 | ||||
-rw-r--r-- | src/zope/i18n/locales/xmlfactory.py | 6 | ||||
-rw-r--r-- | src/zope/i18n/negotiator.py | 4 | ||||
-rw-r--r-- | src/zope/i18n/tests/test_zcml.py | 3 |
8 files changed, 31 insertions, 20 deletions
diff --git a/src/zope/i18n/__init__.py b/src/zope/i18n/__init__.py index dd525ea..aed9ded 100644 --- a/src/zope/i18n/__init__.py +++ b/src/zope/i18n/__init__.py @@ -16,7 +16,9 @@ import re from zope.component import queryUtility -from zope.i18nmessageid import MessageFactory, Message +from zope.i18nmessageid import Message +# I expect that MessageFactory might be there for BBB reasons, but not sure. +from zope.i18nmessageid import MessageFactory # noqa from zope.i18n.config import ALLOWED_LANGUAGES from zope.i18n.interfaces import INegotiator diff --git a/src/zope/i18n/compile.py b/src/zope/i18n/compile.py index 441523d..81a6a17 100644 --- a/src/zope/i18n/compile.py +++ b/src/zope/i18n/compile.py @@ -36,11 +36,12 @@ def compile_mo_file(domain, lc_messages_path): if po_mtime > mo_mtime: try: - # Msgfmt.getAsFile returns io.BytesIO on Python 3, and cStringIO.StringIO - # on Python 2; sadly StringIO isn't a proper context manager, so we have to - # wrap it with `closing`. Also, Msgfmt doesn't properly close a file - # it opens for reading if you pass the path, but it does if you pass - # the file. + # Msgfmt.getAsFile returns io.BytesIO on Python 3, + # and cStringIO.StringIO on Python 2; + # sadly StringIO isn't a proper context manager, so we have to + # wrap it with `closing`. Also, Msgfmt doesn't properly close a + # file it opens for reading if you pass the path, + # but it does if you pass the file. with open(pofile, 'rb') as pofd: with closing(Msgfmt(pofd, domain).getAsFile()) as mo: with open(mofile, 'wb') as fd: diff --git a/src/zope/i18n/interfaces/__init__.py b/src/zope/i18n/interfaces/__init__.py index e717108..025c477 100644 --- a/src/zope/i18n/interfaces/__init__.py +++ b/src/zope/i18n/interfaces/__init__.py @@ -370,9 +370,9 @@ class INumberFormat(IFormat): \u00A4 This is the currency sign. it will be replaced by a currency symbol. If it is present in a pattern, the monetary decimal separator is used instead of the decimal separator. - \u00A4\u00A4 This is the international currency sign. It will be replaced - by an international currency symbol. If it is present in a - pattern, the monetary decimal separator is used instead of + \u00A4\u00A4 This is the international currency sign. It will be + replaced by an international currency symbol. If it is present + in a pattern, the monetary decimal separator is used instead of the decimal separator. X Any other characters can be used in the prefix or suffix ' Used to quote special characters in a prefix or suffix diff --git a/src/zope/i18n/locales/__init__.py b/src/zope/i18n/locales/__init__.py index 82159ff..12009a6 100644 --- a/src/zope/i18n/locales/__init__.py +++ b/src/zope/i18n/locales/__init__.py @@ -30,7 +30,9 @@ from zope.i18n.interfaces.locales import ILocaleDayContext, ILocaleMonthContext from zope.i18n.format import NumberFormat, DateTimeFormat from zope.i18n.locales.inheritance import \ AttributeInheritance, InheritingDictionary, NoParentException -from zope.i18n.locales.provider import LocaleProvider, LoadLocaleError +# LoadLocaleError is not used, but might be imported from here by others. +from zope.i18n.locales.provider import LoadLocaleError # noqa +from zope.i18n.locales.provider import LocaleProvider # Setup the locale directory diff --git a/src/zope/i18n/locales/tests/test_xmlfactory.py b/src/zope/i18n/locales/tests/test_xmlfactory.py index 6b52dd2..0dc070e 100644 --- a/src/zope/i18n/locales/tests/test_xmlfactory.py +++ b/src/zope/i18n/locales/tests/test_xmlfactory.py @@ -42,11 +42,14 @@ class LocaleXMLFileTestCase(TestCase): # Making sure all datetime patterns parse # for calendar in locale.dates.calendars.values(): - # for category in ('date', 'time', 'dateTime'): - # for length in getattr(calendar, category+'Formats').values(): - # for format in length.formats.values(): - # self.assert_( - # parseDateTimePattern(format.pattern) is not None) + # for category in ('date', 'time', 'dateTime'): + # for length in getattr( + # calendar, category + 'Formats' + # ).values(): + # for format in length.formats.values(): + # self.assert_( + # parseDateTimePattern(format.pattern) is not None + # ) def test_suite(): diff --git a/src/zope/i18n/locales/xmlfactory.py b/src/zope/i18n/locales/xmlfactory.py index 5710d19..0520c2d 100644 --- a/src/zope/i18n/locales/xmlfactory.py +++ b/src/zope/i18n/locales/xmlfactory.py @@ -345,7 +345,8 @@ class LocaleFactory(object): >>> names[7:] [u'August', u'September', u'Oktober', u'November', u'Dezember'] - >>> abbrs = [ctx.months[u"abbreviated"][type] for type in range(1,13)] + >>> abbrs = [ctx.months[u"abbreviated"][type] + ... for type in range(1,13)] >>> abbrs[:6] [u'Jan', u'Feb', u'Mrz', u'Apr', u'Mai', u'Jun'] >>> abbrs[6:] @@ -1312,7 +1313,8 @@ class LocaleFactory(object): >>> xml = u''' ... <ldml> ... <layout> - ... <orientation lines="bottom-to-top" characters="right-to-left" /> + ... <orientation lines="bottom-to-top" + ... characters="right-to-left" /> ... </layout> ... </ldml>''' >>> dom = parseString(xml) diff --git a/src/zope/i18n/negotiator.py b/src/zope/i18n/negotiator.py index 3c5fa17..3ece221 100644 --- a/src/zope/i18n/negotiator.py +++ b/src/zope/i18n/negotiator.py @@ -29,8 +29,8 @@ def normalize_langs(langs): # Make a mapping from normalized->original so we keep can match # the normalized lang and return the original string. n_langs = {} - for l in langs: - n_langs[normalize_lang(l)] = l + for lang in langs: + n_langs[normalize_lang(lang)] = lang return n_langs diff --git a/src/zope/i18n/tests/test_zcml.py b/src/zope/i18n/tests/test_zcml.py index e04362d..0467a40 100644 --- a/src/zope/i18n/tests/test_zcml.py +++ b/src/zope/i18n/tests/test_zcml.py @@ -157,7 +157,8 @@ class DirectivesTest(PlacelessSetup, unittest.TestCase): xmlconfig.string( template % ''' <configure package="zope.i18n.tests"> - <i18n:registerTranslations directory="locale3" domain="zope-i18n" /> + <i18n:registerTranslations directory="locale3" + domain="zope-i18n" /> </configure> ''', self.context) path = os.path.join(os.path.dirname(zope.i18n.tests.__file__), |