Fri, 24 Jan 2014 20:23:53 +0100

Detlev Offenbach <detlev@die-offenbachs.de>
Fri, 24 Jan 2014 20:23:53 +0100
changeset 3229
parent 3208

Fixed a typo in the coding line of translations.py of pyflakes.

# -*- coding: utf-8 -*-

# Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>

Module implementing message translations for pyflakes warning messages.

from PyQt4.QtCore import QCoreApplication

__all__ = ["getTranslatedFlakesMessage"]

_messages = {
    'F01': QCoreApplication.translate(
        '{0!r} imported but unused.'),
    'F02': QCoreApplication.translate(
        'Redefinition of unused {0!r} from line {1!r}.'),
    'F03': QCoreApplication.translate(
        'Import {0!r} from line {1!r} shadowed by loop variable.'),
    'F04': QCoreApplication.translate(
        "'from {0} import *' used; unable to detect undefined names."),
    'F05': QCoreApplication.translate(
        'Undefined name {0!r}.'),
    'F06': QCoreApplication.translate(
        'Undefined name {0!r} in __all__.'),
    'F07': QCoreApplication.translate(
        "Local variable {0!r} (defined in enclosing scope on line {1!r})"
        " referenced before assignment."),
    'F08': QCoreApplication.translate(
        'Duplicate argument {0!r} in function definition.'),
    'F09': QCoreApplication.translate(
        'Redefinition of {0!r} from line {1!r}.'),
    'F10': QCoreApplication.translate(
        'Future import(s) {0!r} after other statements.'),
    'F11': QCoreApplication.translate(
        'Local variable {0!r} is assigned to but never used.'),
    'F12': QCoreApplication.translate(
        'List comprehension redefines {0!r} from line {1!r}.'),
    'F13': QCoreApplication.translate(
        'Syntax error detected in doctest.'),

def getTranslatedFlakesMessage(message_id, message_args):
    Module function to get a translated and formatted message for a
    given pyflakes message ID.
    @param message_id message ID (string)
    @param message_args arguments for a formatted message (list)
    @return translated and formatted message (string)
    if message_id in _messages:
        return QCoreApplication.translate(
            "pyFlakes", _messages[message_id]).format(*message_args)
        return QCoreApplication.translate(
            "pyFlakes", "no message defined for code '{0}'")\

eric ide