# Path: pylama/errors.py
# class Error:
#     """Store an error's information."""
# 
#     __slots__ = "source", "col", "lnum", "etype", "message", "filename", "number"
# 
#     def __init__(
#         self,
#         source="pylama",
#         col=1,
#         lnum=1,
#         type=None,  # pylint: disable=R0913
#         text="unknown error",
#         filename="",
#         number="",
#         **_,
#     ):
#         """Init error information with default values."""
#         text = str(text).strip().replace("\n", " ")
#         if number:
#             self.number = number
#         else:
#             number = PATTERN_NUMBER.match(text)
#             self.number = number.group(1).upper() if number else ""
# 
#         self.etype = type[:1] if type else (number[0] if number else "E")
#         self.col = max(col, 1)
#         self.filename = filename
#         self.source = source
#         self.lnum = int(lnum)
#         self.message = text
# 
#     def __repr__(self):
#         return f"<Error:{self.lnum}:{self.col}: {self.number} {self.message}>"
# 
#     def format(self, pattern: str) -> str:
#         """Format the error with the given pattern."""
#         return pattern.format(
#             filename=self.filename,
#             lnum=self.lnum,
#             col=self.col,
#             message=self.message,
#             etype=self.etype,
#             source=self.source,
#             number=self.number,
#         )
# 
#     def to_dict(self) -> Dict[str, Any]:
#         """Return the error as a dict."""
#         return {
#             "source": self.source,
#             "col": self.col,
#             "lnum": self.lnum,
#             "etype": self.etype,
#             "message": self.message,
#             "filename": self.filename,
#             "number": self.number,
#         }
# 
# Path: pylama/utils.py
# def read(filename: str) -> str:
#     """Read the given filename."""
#     with open(filename, encoding="utf-8") as file:
#         return file.read()


import ast
import os.path as op
import re
from argparse import Namespace
from copy import copy
from functools import lru_cache
from os import remove
from tempfile import NamedTemporaryFile
from typing import Dict, List, Set
from pylama.errors import Error
from pylama.utils import read
        return self._tempfile

    def update_params(self, ignore=None, select=None, linters=None, skip=None, **_):
        """Update general params (from file configs or modeline)."""
        if select:
            self.select |= set(select.split(","))
        if ignore:
            self.ignore |= set(ignore.split(","))
        if linters:
            self.linters = linters.split(",")
        if skip is not None:
            self.skip = bool(int(skip))

    @lru_cache(42)
    def get_params(self, name: str) -> Dict:
        """Get params for a linter with the given name."""
        lparams = copy(self.linters_params.get(name, {}))
        for key in ("ignore", "select"):
            if key in lparams and not isinstance(lparams[key], set):
                lparams[key] = set(lparams[key].split(","))
        return lparams

    @lru_cache(42)
    def get_filter(self, name: str, key: str) -> Set:
        """Get select/ignore from linter params."""
        lparams = self.get_params(name)
        return lparams.get(key, set())

    def push(self, filtrate: bool = True, **params):
        """Record an error."""

# Path: pylama/errors.py
# class Error:
#     """Store an error's information."""
# 
#     __slots__ = "source", "col", "lnum", "etype", "message", "filename", "number"
# 
#     def __init__(
#         self,
#         source="pylama",
#         col=1,
#         lnum=1,
#         type=None,  # pylint: disable=R0913
#         text="unknown error",
#         filename="",
#         number="",
#         **_,
#     ):
#         """Init error information with default values."""
#         text = str(text).strip().replace("\n", " ")
#         if number:
#             self.number = number
#         else:
#             number = PATTERN_NUMBER.match(text)
#             self.number = number.group(1).upper() if number else ""
# 
#         self.etype = type[:1] if type else (number[0] if number else "E")
#         self.col = max(col, 1)
#         self.filename = filename
#         self.source = source
#         self.lnum = int(lnum)
#         self.message = text
# 
#     def __repr__(self):
#         return f"<Error:{self.lnum}:{self.col}: {self.number} {self.message}>"
# 
#     def format(self, pattern: str) -> str:
#         """Format the error with the given pattern."""
#         return pattern.format(
#             filename=self.filename,
#             lnum=self.lnum,
#             col=self.col,
#             message=self.message,
#             etype=self.etype,
#             source=self.source,
#             number=self.number,
#         )
# 
#     def to_dict(self) -> Dict[str, Any]:
#         """Return the error as a dict."""
#         return {
#             "source": self.source,
#             "col": self.col,
#             "lnum": self.lnum,
#             "etype": self.etype,
#             "message": self.message,
#             "filename": self.filename,
#             "number": self.number,
#         }
# 
# Path: pylama/utils.py
# def read(filename: str) -> str:
#     """Read the given filename."""
#     with open(filename, encoding="utf-8") as file:
#         return file.read()


# Path: pylama/context.py
import ast
import os.path as op
import re
from argparse import Namespace
from copy import copy
from functools import lru_cache
from os import remove
from tempfile import NamedTemporaryFile
from typing import Dict, List, Set
from pylama.errors import Error
from pylama.utils import read

        return self._tempfile

    def update_params(self, ignore=None, select=None, linters=None, skip=None, **_):
        """Update general params (from file configs or modeline)."""
        if select:
            self.select |= set(select.split(","))
        if ignore:
            self.ignore |= set(ignore.split(","))
        if linters:
            self.linters = linters.split(",")
        if skip is not None:
            self.skip = bool(int(skip))

    @lru_cache(42)
    def get_params(self, name: str) -> Dict:
        """Get params for a linter with the given name."""
        lparams = copy(self.linters_params.get(name, {}))
        for key in ("ignore", "select"):
            if key in lparams and not isinstance(lparams[key], set):
                lparams[key] = set(lparams[key].split(","))
        return lparams

    @lru_cache(42)
    def get_filter(self, name: str, key: str) -> Set:
        """Get select/ignore from linter params."""
        lparams = self.get_params(name)
        return lparams.get(key, set())

    def push(self, filtrate: bool = True, **params):
        """Record an error."""

        err = Error(filename=self.filename, **params)