# Path: KPC/classes.py
# class Error:
#     '''An individual error from a check against an entry. One check
#     usually returns list of errors or empty list if there's no error.
#     '''
#     SUCCESS = 0
#     DEPRECATED = 1
#     WARNING = 2
#     ERROR = 3
# 
#     def __init__(self, message):
#         self.pos = 0
#         self.level = Error.ERROR
#         self.message = message
# 
# class BaseCheck:
#     '''Base class to check an entry from PO files. Subclasses should
#     implement check() function. check() returns list of errors if any.
#     '''
#     def _get_context(self, entry):
#         if not hasattr(self, 'get_context'):
#             return {}
#         fields = {}
#         # parse msgstr
#         for line in entry.msgstr.split('\n'):
#             try:
#                 k, v = line.split(': ', 1)
#                 fields[k] = v
#             except ValueError:
#                 pass
#         return self.get_context(entry, fields)
# 
#     def _check(self, entry, context):
#         return self.check(entry, context)


import re
from KPC.classes import Error, BaseCheck
        msgstr = entry.msgstr
        gnome_mo = re_accesskey_gnome.match(msgid)
        kde_mo = re_accesskey_kde.match(msgid)

        # doubts if the string really contains a access key
        if gnome_mo and re_accesskey_gnome_unlikely.match(msgid):
            gnome_mo = None
        if kde_mo and re_accesskey_kde_unlikely.match(msgid):
            kde_mo = None

        if gnome_mo or kde_mo:
            # too long string to be a label string
            if len(msgid) > 60:
                return []
            # GConf schema or GSettings schema file
            if entry.references and ('.schemas' in entry.references[0] or
                                     '.gschema' in entry.references[0]):
                return []

            if gnome_mo:
                letter = gnome_mo.group(1).upper()
            else:
                letter = kde_mo.group(1).upper()
            # check 1: if it's translated with the access key
            mo = re_accesskey.match(msgstr)
            if not mo:
                return [Error(errstr_no_accesskey)]

            # check 2: check if it's same
            if letter != mo.group(1).upper():

# Path: KPC/classes.py
# class Error:
#     '''An individual error from a check against an entry. One check
#     usually returns list of errors or empty list if there's no error.
#     '''
#     SUCCESS = 0
#     DEPRECATED = 1
#     WARNING = 2
#     ERROR = 3
# 
#     def __init__(self, message):
#         self.pos = 0
#         self.level = Error.ERROR
#         self.message = message
# 
# class BaseCheck:
#     '''Base class to check an entry from PO files. Subclasses should
#     implement check() function. check() returns list of errors if any.
#     '''
#     def _get_context(self, entry):
#         if not hasattr(self, 'get_context'):
#             return {}
#         fields = {}
#         # parse msgstr
#         for line in entry.msgstr.split('\n'):
#             try:
#                 k, v = line.split(': ', 1)
#                 fields[k] = v
#             except ValueError:
#                 pass
#         return self.get_context(entry, fields)
# 
#     def _check(self, entry, context):
#         return self.check(entry, context)


# Path: KPC/checks/convention/access-key.py
import re
from KPC.classes import Error, BaseCheck

        msgstr = entry.msgstr
        gnome_mo = re_accesskey_gnome.match(msgid)
        kde_mo = re_accesskey_kde.match(msgid)

        # doubts if the string really contains a access key
        if gnome_mo and re_accesskey_gnome_unlikely.match(msgid):
            gnome_mo = None
        if kde_mo and re_accesskey_kde_unlikely.match(msgid):
            kde_mo = None

        if gnome_mo or kde_mo:
            # too long string to be a label string
            if len(msgid) > 60:
                return []
            # GConf schema or GSettings schema file
            if entry.references and ('.schemas' in entry.references[0] or
                                     '.gschema' in entry.references[0]):
                return []

            if gnome_mo:
                letter = gnome_mo.group(1).upper()
            else:
                letter = kde_mo.group(1).upper()
            # check 1: if it's translated with the access key
            mo = re_accesskey.match(msgstr)
            if not mo:
                return [Error(errstr_no_accesskey)]

            # check 2: check if it's same
            if letter != mo.group(1).upper():

                return [Error(errstr_wrong % (letter, mo.group(1)))]