Module rulebook-pylint.rulebook_pylint.internals.messages

Classes

class Messages
Expand source code
class Messages:
    FILENAME: str = '../resources/messages.json'
    counter: int = 6142  # arbitrary number to distinguish from PEP

    with open(join(dirname(__file__), FILENAME), 'r', encoding='UTF-8') as file:
        bundle: dict = load(file)

    @staticmethod
    def get(key: str) -> str:
        return Messages.bundle[key]

    @staticmethod
    def of(*keys: str) -> dict[str, MessageDefinitionTuple]:
        result: dict[str, MessageDefinitionTuple] = {}
        key: str
        for key in keys:
            Messages.counter = Messages.counter + 1
            result[f'E{Messages.counter:04d}'] = (
                Messages.bundle[key],
                key,
                'https://github.com/hanggrian/rulebook',
            )
        return result

Class variables

var FILENAME : str

The type of the None singleton.

var bundle : dict

The type of the None singleton.

var counter : int

The type of the None singleton.

var file

The type of the None singleton.

Static methods

def get(key: str) ‑> str
Expand source code
@staticmethod
def get(key: str) -> str:
    return Messages.bundle[key]
def of(*keys: str) ‑> dict[str, tuple[str, str, str] | tuple[str, str, str, pylint.typing.ExtraMessageOptions]]
Expand source code
@staticmethod
def of(*keys: str) -> dict[str, MessageDefinitionTuple]:
    result: dict[str, MessageDefinitionTuple] = {}
    key: str
    for key in keys:
        Messages.counter = Messages.counter + 1
        result[f'E{Messages.counter:04d}'] = (
            Messages.bundle[key],
            key,
            'https://github.com/hanggrian/rulebook',
        )
    return result