<fim-prefix><fim-middle>ing: utf-8 -*-

from __future__ import print_function
from __future__ import absolute_import

from typing import List, TYPE_CHECKING

from zulint.custom_rules import RuleList
if TYPE_CHECKING:
    fro<fix-suffix>m zulint.custom_rules import Rule

# Rule help:
# By default, a rule applies to all files within the extension for which it is specified (e.g. all .py files)
# There are three operators we can use to manually include or exclude files from linting for a rule:
# 'exclude': 'set([<path>, ...])' - if <path> is a filename, excludes that file.
#                                   if <path> is a directory, excludes all files directly below the directory <path>.
# 'exclude_line': 'set([(<path>, <line>), ...])' - excludes all lines matching <line> in the file <path> from linting.
# 'include_only': 'set([<path>, ...])' - includes only those files where <path> is a substring of the filepath.

PYDELIMS = r'''"'()\[\]{}#\\'''
PYREG = r"[^{}]".format(PYDELIMS)
PYSQ = r'"(?:[^"\\]|\\.)*"'
PYDQ = r"'(?:[^'\\]|\\.)*'"
PYLEFT = r"[(\[{]"
PYRIGHT = r"[)\]}]"
PYCODE = PYREG
for depth in range(5):
    PYGROUP = r"""(?:{}|{}|{}{}*{})""".format(PYSQ, PYDQ, PYLEFT, PYCODE, PYRIGHT)
    PYCODE = r"""(?:{}|{})""".format(PYREG, PYGROUP)

FILES_WITH_LEGACY_SUBJECT = {
    # This basically requires a big DB migration:
    'zerver/lib/topic.py',

    # This is for backward compatibility.
    'zerver/tests/test_legacy_subject.py',

    # Other migration-related changes require extreme care.
    'zerver/lib/fix_unreads.py',
    'zerver/tests/test_migrations.py',

    # These use subject in the email sense, and will
    # probably always be exempt:
    'zerver/lib/email_mirror.py',
    'zerver/lib/feedback.py<|endoftext|>