Normal
 
    tus = self._basectx.status(
            self.ctx,
            self._match,
            listignored=b'ignored' in keys,
            listclean=b'clean' in keys,
            listunknown=b'unknown' in keys,
        )

    def status(self):
        return self._status

    def matcher(self, patterns):
        return self.ctx.match(patterns, badfn=self._badfn, cwd=self.cwd)

    def predicate(self, predfn, predrepr=None, cache=False):
        """Create a matcher to select files by predfn(filename)"""
        if cache:
            predfn = util.cachefunc(predfn)
        return matchmod.predicatematcher(
            predfn, predrepr=predrepr, badfn=self._badfn
        )

    def fpredicate(self, predfn, predrepr=None, cache=False):
        """Create a matcher to select files by predfn(fctx) at the current
        revision

        Missing files are ignored.
        """
        ctx = self.ctx
        if ctx.rev() is None:

            def fctxpredfn(f):
                try:
                    fctx = ctx[f]
                except error.LookupError:
                    return False
                try:
                    fctx.audit()
                except error.Abort:
                    return False
                try:
                    return predfn(fctx)
                # open()-ing a directory fails with PermissionError on Windows
                except (
                    FileNotFoundError,
                    PermissionError,
                    NotADirectoryError,
                    IsADirectoryError,
                ):
                    return False

        else:

            def fctxpredfn(f):
                try:
                    fctx = ctx[f]
                except error.LookupError:
                    return False
                return predfn(fctx)

        return self.predicate(fctxpredfn, predrepr=predrepr, cache=cache)

    def never(self):
        """Create a matcher to select nothing"""
        return matchmod.never(badfn=self._badfn)


def match(ctx, cwd, expr, badfn=None):
    """Create a matcher for a single fileset expression"""
    tree = filesetlang.parse(expr)
    tree = filesetlang.analyze(tree)
    tree = filesetlang.optimize(tree)
    mctx = matchctx(ctx.p1(), ctx, cwd, badfn=badfn)
    return getmatch(mctx, tree)


def loadpredicate(ui, extname, registrarobj):
    """Load fileset predicates from specified registrarobj"""
    for name, func in registrarobj._table.items():
        symbols[name] = func


# tell hggettext to extract docstrings from these functions:
i18nfunctions = symbols.values()
  7   ˆl–äY>””Ð;Ê�jãMÜêbÑ¿�þB9ZY¹]t¬¶éd�€þÄƒqðÃÂÁÀ ô    import os
import tarfile

import pytest

from ..constants import *  # NOQA
from ..crypto.key import KeyfileKey
from ..upgrader import AtticRepositoryUpgrader, AtticKeyfileKey
from ..helpers import get_keys_dir
from ..repository import Repository
from . import are_hardlinks_supported


# tar with a repo and repo keyfile from attic
ATTIC_TAR = os.path.join(os.path.dirname(__file__), 'attic.tar.gz')


def untar(tarfname, path, what):
    """
    extract <tarfname> tar archive to <path>, all stuff starting with <what>.

    return path to <what>.
    """

    def files(members):
        for tarinfo in members:
            if tarinfo.name.startswith(what):
                yield tarinfo

    with tarfile.open(tarfname, 'r') as tf:
        tf.extractall(path, members=files(tf))

    return os.path.join(path, what)


def repo_valid(path):
    """
    utility function to check if borg can open a repository

    :param path: the path to the repository
    :returns: if borg can check the repository
    """
    with Repository(str(path), exclusive=True, create=False) as repository:
        # can't check raises() because check() handles the error
        return repository.check()


def key_valid(path):
    """
    check that the new keyfile is alright

    :param path: the path to the key file
    :returns: if the file starts with the borg magic string
    """
    keyfile = os.path.join(get_keys_dir(),
                     