Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-flake8 for openSUSE:Factory 
checked in at 2024-01-06 17:29:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8 (Old)
 and      /work/SRC/openSUSE:Factory/.python-flake8.new.28375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flake8"

Sat Jan  6 17:29:14 2024 rev:44 rq:1137099 version:7.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flake8/python-flake8.changes      
2023-08-14 22:35:14.748220074 +0200
+++ /work/SRC/openSUSE:Factory/.python-flake8.new.28375/python-flake8.changes   
2024-01-06 17:29:17.063855077 +0100
@@ -1,0 +2,8 @@
+Fri Jan  5 15:25:36 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 7.0.0:
+  * Remove ``--include-in-doctest`` and ``--exclude-from-doctest``
+    options.
+  * Pyflakes has been updated to >= 3.2.0, < 3.3.0
+
+-------------------------------------------------------------------

Old:
----
  flake8-6.1.0.tar.gz

New:
----
  flake8-7.0.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flake8.spec ++++++
--- /var/tmp/diff_new_pack.NQ1bnb/_old  2024-01-06 17:29:17.747880061 +0100
+++ /var/tmp/diff_new_pack.NQ1bnb/_new  2024-01-06 17:29:17.747880061 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-flake8
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-flake8
-Version:        6.1.0
+Version:        7.0.0
 Release:        0
 Summary:        Modular source code checker: pep8, pyflakes and co
 License:        MIT
@@ -35,14 +35,14 @@
 # SECTION test requirements
 BuildRequires:  %{python_module mccabe >= 0.7.0 with %python-mccabe < 0.8.0}
 BuildRequires:  %{python_module pycodestyle >= 2.11.0 with %python-pycodestyle 
< 2.12.0}
-BuildRequires:  %{python_module pyflakes >= 3.1.0 with %python-pyflakes < 
3.2.0}
+BuildRequires:  %{python_module pyflakes >= 3.2.0 with %python-pyflakes < 
3.3.0}
 BuildRequires:  %{python_module pytest}
 # /SECTION
 BuildArch:      noarch
 # 
https://flake8.pycqa.org/en/latest/faq.html#why-does-flake8-use-ranges-for-its-dependencies
 Requires:       (python-mccabe >= 0.7.0 with python-mccabe < 0.8.0)
 Requires:       (python-pycodestyle >= 2.11.0 with python-pycodestyle < 2.12.0)
-Requires:       (python-pyflakes >= 3.1.0 with python-pyflakes < 3.2.0)
+Requires:       (python-pyflakes >= 3.2.0 with python-pyflakes < 3.3.0)
 Requires(post): update-alternatives
 Requires(postun):update-alternatives
 %python_subpackages

++++++ flake8-6.1.0.tar.gz -> flake8-7.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/.coveragerc new/flake8-7.0.0/.coveragerc
--- old/flake8-6.1.0/.coveragerc        2023-07-29 21:04:17.000000000 +0200
+++ new/flake8-7.0.0/.coveragerc        1970-01-01 01:00:00.000000000 +0100
@@ -1,26 +0,0 @@
-[run]
-branch = True
-source =
-    flake8
-    tests
-omit =
-    # Don't complain if non-runnable code isn't run
-    */__main__.py
-
-[report]
-show_missing = True
-skip_covered = True
-exclude_lines =
-    # Have to re-enable the standard pragma
-    \#\s*pragma: no cover
-
-    # Don't complain if tests don't hit defensive assertion code:
-    ^\s*raise AssertionError\b
-    ^\s*raise NotImplementedError\b
-    ^\s*return NotImplemented\b
-    ^\s*raise$
-
-    # Don't complain if non-runnable code isn't run:
-    ^if __name__ == ['"]__main__['"]:$
-    ^\s*if False:
-    ^\s*if TYPE_CHECKING:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/.pre-commit-config.yaml 
new/flake8-7.0.0/.pre-commit-config.yaml
--- old/flake8-6.1.0/.pre-commit-config.yaml    2023-07-29 21:04:17.000000000 
+0200
+++ new/flake8-7.0.0/.pre-commit-config.yaml    2024-01-05 01:41:07.000000000 
+0100
@@ -1,6 +1,6 @@
 repos:
 -   repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.4.0
+    rev: v4.5.0
     hooks:
     -   id: check-yaml
     -   id: debug-statements
@@ -8,11 +8,11 @@
     -   id: trailing-whitespace
         exclude: ^tests/fixtures/
 -   repo: https://github.com/asottile/setup-cfg-fmt
-    rev: v2.4.0
+    rev: v2.5.0
     hooks:
     -   id: setup-cfg-fmt
 -   repo: https://github.com/asottile/reorder-python-imports
-    rev: v3.10.0
+    rev: v3.12.0
     hooks:
     -   id: reorder-python-imports
         args: [
@@ -21,21 +21,21 @@
             --add-import, 'from __future__ import annotations',
         ]
 -   repo: https://github.com/asottile/pyupgrade
-    rev: v3.9.0
+    rev: v3.15.0
     hooks:
     -   id: pyupgrade
         args: [--py38-plus]
 -   repo: https://github.com/psf/black
-    rev: 23.7.0
+    rev: 23.12.1
     hooks:
     -   id: black
         args: [--line-length=79]
 -   repo: https://github.com/PyCQA/flake8
-    rev: 6.0.0
+    rev: 6.1.0
     hooks:
     -   id: flake8
 -   repo: https://github.com/pre-commit/mirrors-mypy
-    rev: v1.4.1
+    rev: v1.8.0
     hooks:
     -   id: mypy
         exclude: ^(docs/|example-plugin/)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/.readthedocs.yaml 
new/flake8-7.0.0/.readthedocs.yaml
--- old/flake8-6.1.0/.readthedocs.yaml  1970-01-01 01:00:00.000000000 +0100
+++ new/flake8-7.0.0/.readthedocs.yaml  2024-01-05 01:41:07.000000000 +0100
@@ -0,0 +1,10 @@
+version: 2
+
+build:
+  os: ubuntu-22.04
+  tools:
+    python: "3.11"
+python:
+  install:
+  - path: .
+  - requirements: docs/source/requirements.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/docs/source/internal/releases.rst 
new/flake8-7.0.0/docs/source/internal/releases.rst
--- old/flake8-6.1.0/docs/source/internal/releases.rst  2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/docs/source/internal/releases.rst  2024-01-05 
01:41:07.000000000 +0100
@@ -30,7 +30,7 @@
 
 - Large scale refactoring (2.0, 3.0, 5.0, 6.0)
 
-- Subtly breaking CLI changes (3.0, 4.0, 5.0, 6.0)
+- Subtly breaking CLI changes (3.0, 4.0, 5.0, 6.0, 7.0)
 
 - Breaking changes to its plugin interface (3.0)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/docs/source/release-notes/7.0.0.rst 
new/flake8-7.0.0/docs/source/release-notes/7.0.0.rst
--- old/flake8-6.1.0/docs/source/release-notes/7.0.0.rst        1970-01-01 
01:00:00.000000000 +0100
+++ new/flake8-7.0.0/docs/source/release-notes/7.0.0.rst        2024-01-05 
01:41:07.000000000 +0100
@@ -0,0 +1,19 @@
+7.0.0 -- 2024-01-04
+-------------------
+
+You can view the `7.0.0 milestone`_ on GitHub for more details.
+
+Backwards Incompatible Changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Remove ``--include-in-doctest`` and ``--exclude-from-doctest`` options.
+  (See also :issue:`1747`, :pull:`1854`)
+
+New Dependency Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Pyflakes has been updated to >= 3.2.0, < 3.3.0 (See also :pull:`1906`).
+
+.. all links
+.. _7.0.0 milestone:
+    https://github.com/PyCQA/flake8/milestone/49
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/docs/source/release-notes/index.rst 
new/flake8-7.0.0/docs/source/release-notes/index.rst
--- old/flake8-6.1.0/docs/source/release-notes/index.rst        2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/docs/source/release-notes/index.rst        2024-01-05 
01:41:07.000000000 +0100
@@ -5,6 +5,12 @@
 All of the release notes that have been recorded for Flake8 are organized here
 with the newest releases first.
 
+7.x Release Series
+==================
+
+.. toctree::
+   7.0.0
+
 6.x Release Series
 ==================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/docs/source/requirements.txt 
new/flake8-7.0.0/docs/source/requirements.txt
--- old/flake8-6.1.0/docs/source/requirements.txt       2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/docs/source/requirements.txt       2024-01-05 
01:41:07.000000000 +0100
@@ -1,4 +1,4 @@
 sphinx>=2.1.0,!=3.1.0
-sphinx_rtd_theme
-sphinx-prompt
+sphinx-rtd-theme>=1.2.2
+sphinx-prompt>=1.5.0
 docutils!=0.18
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/docs/source/user/invocation.rst 
new/flake8-7.0.0/docs/source/user/invocation.rst
--- old/flake8-6.1.0/docs/source/user/invocation.rst    2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/docs/source/user/invocation.rst    2024-01-05 
01:41:07.000000000 +0100
@@ -51,7 +51,7 @@
 
     This is the last time we will show both versions of an invocation.
     From now on, we'll simply use ``flake8`` and assume that the user
-    knows they can instead use ``python<version> -m flake8`` instead.
+    knows they can instead use ``python<version> -m flake8``.
 
 It's also possible to narrow what |Flake8| will try to check by specifying
 exactly the paths and directories you want it to check. Let's assume that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/docs/source/user/options.rst 
new/flake8-7.0.0/docs/source/user/options.rst
--- old/flake8-6.1.0/docs/source/user/options.rst       2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/docs/source/user/options.rst       2024-01-05 
01:41:07.000000000 +0100
@@ -98,10 +98,6 @@
 
 - :option:`flake8 --doctests`
 
-- :option:`flake8 --include-in-doctest`
-
-- :option:`flake8 --exclude-from-doctest`
-
 - :option:`flake8 --benchmark`
 
 - :option:`flake8 --bug-report`
@@ -997,62 +993,6 @@
         doctests = True
 
 
-.. option:: --include-in-doctest=<paths>
-
-    :ref:`Go back to index <top>`
-
-    Specify which files are checked by PyFlakes for doctest syntax.
-
-    This is registered by the default PyFlakes plugin.
-
-    Command-line example:
-
-    .. prompt:: bash
-
-        flake8 --include-in-doctest=dir/subdir/file.py,dir/other/file.py dir/
-
-    This **can** be specified in config files.
-
-    Example config file usage:
-
-    .. code-block:: ini
-
-        include-in-doctest =
-            dir/subdir/file.py,
-            dir/other/file.py
-        include_in_doctest =
-            dir/subdir/file.py,
-            dir/other/file.py
-
-
-.. option:: --exclude-from-doctest=<paths>
-
-    :ref:`Go back to index <top>`
-
-    Specify which files are not to be checked by PyFlakes for doctest syntax.
-
-    This is registered by the default PyFlakes plugin.
-
-    Command-line example:
-
-    .. prompt:: bash
-
-        flake8 --exclude-from-doctest=dir/subdir/file.py,dir/other/file.py dir/
-
-    This **can** be specified in config files.
-
-    Example config file usage:
-
-    .. code-block:: ini
-
-        exclude-from-doctest =
-            dir/subdir/file.py,
-            dir/other/file.py
-        exclude_from_doctest =
-            dir/subdir/file.py,
-            dir/other/file.py
-
-
 .. option:: --benchmark
 
     :ref:`Go back to index <top>`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/setup.cfg new/flake8-7.0.0/setup.cfg
--- old/flake8-6.1.0/setup.cfg  2023-07-29 21:04:17.000000000 +0200
+++ new/flake8-7.0.0/setup.cfg  2024-01-05 01:41:07.000000000 +0100
@@ -30,7 +30,7 @@
 install_requires =
     mccabe>=0.7.0,<0.8.0
     pycodestyle>=2.11.0,<2.12.0
-    pyflakes>=3.1.0,<3.2.0
+    pyflakes>=3.2.0,<3.3.0
 python_requires = >=3.8.1
 package_dir =
     =src
@@ -54,6 +54,15 @@
 [bdist_wheel]
 universal = 1
 
+[coverage:run]
+source =
+    flake8
+    tests
+plugins = covdefaults
+
+[coverage:report]
+fail_under = 97
+
 [mypy]
 check_untyped_defs = true
 disallow_any_generics = true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/src/flake8/__init__.py 
new/flake8-7.0.0/src/flake8/__init__.py
--- old/flake8-6.1.0/src/flake8/__init__.py     2023-07-29 21:04:17.000000000 
+0200
+++ new/flake8-7.0.0/src/flake8/__init__.py     2024-01-05 01:41:07.000000000 
+0100
@@ -17,7 +17,7 @@
 LOG = logging.getLogger(__name__)
 LOG.addHandler(logging.NullHandler())
 
-__version__ = "6.1.0"
+__version__ = "7.0.0"
 __version_info__ = tuple(int(i) for i in __version__.split(".") if i.isdigit())
 
 _VERBOSITY_TO_LOG_LEVEL = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/src/flake8/_compat.py 
new/flake8-7.0.0/src/flake8/_compat.py
--- old/flake8-6.1.0/src/flake8/_compat.py      2023-07-29 21:04:17.000000000 
+0200
+++ new/flake8-7.0.0/src/flake8/_compat.py      2024-01-05 01:41:07.000000000 
+0100
@@ -3,9 +3,9 @@
 import sys
 import tokenize
 
-if sys.version_info >= (3, 12):
+if sys.version_info >= (3, 12):  # pragma: >=3.12 cover
     FSTRING_START = tokenize.FSTRING_START
     FSTRING_MIDDLE = tokenize.FSTRING_MIDDLE
     FSTRING_END = tokenize.FSTRING_END
-else:
+else:  # pragma: <3.12 cover
     FSTRING_START = FSTRING_MIDDLE = FSTRING_END = -1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/src/flake8/checker.py 
new/flake8-7.0.0/src/flake8/checker.py
--- old/flake8-6.1.0/src/flake8/checker.py      2023-07-29 21:04:17.000000000 
+0200
+++ new/flake8-7.0.0/src/flake8/checker.py      2024-01-05 01:41:07.000000000 
+0100
@@ -70,7 +70,8 @@
     signal.signal(signal.SIGINT, signal.SIG_IGN)
 
     try:
-        _mp_plugins, _mp_options  # for `fork` this'll already be set
+        # for `fork` this'll already be set
+        _mp_plugins, _mp_options  # noqa: B018
     except NameError:
         plugins, options = parse_args(argv)
         _mp_plugins, _mp_options = plugins.checkers, options
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/src/flake8/plugins/pyflakes.py 
new/flake8-7.0.0/src/flake8/plugins/pyflakes.py
--- old/flake8-6.1.0/src/flake8/plugins/pyflakes.py     2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/src/flake8/plugins/pyflakes.py     2024-01-05 
01:41:07.000000000 +0100
@@ -4,13 +4,11 @@
 import argparse
 import ast
 import logging
-import os
 from typing import Any
 from typing import Generator
 
 import pyflakes.checker
 
-from flake8 import utils
 from flake8.options.manager import OptionManager
 
 LOG = logging.getLogger(__name__)
@@ -68,34 +66,12 @@
     """Subclass the Pyflakes checker to conform with the flake8 API."""
 
     with_doctest = False
-    include_in_doctest: list[str] = []
-    exclude_from_doctest: list[str] = []
 
     def __init__(self, tree: ast.AST, filename: str) -> None:
         """Initialize the PyFlakes plugin with an AST tree and filename."""
-        filename = utils.normalize_path(filename)
-        with_doctest = self.with_doctest
-        included_by = [
-            include
-            for include in self.include_in_doctest
-            if include != "" and filename.startswith(include)
-        ]
-        if included_by:
-            with_doctest = True
-
-        for exclude in self.exclude_from_doctest:
-            if exclude != "" and filename.startswith(exclude):
-                with_doctest = False
-                overlapped_by = [
-                    include
-                    for include in included_by
-                    if include.startswith(exclude)
-                ]
-
-                if overlapped_by:
-                    with_doctest = True
-
-        super().__init__(tree, filename=filename, withDoctest=with_doctest)
+        super().__init__(
+            tree, filename=filename, withDoctest=self.with_doctest
+        )
 
     @classmethod
     def add_options(cls, parser: OptionManager) -> None:
@@ -113,24 +89,6 @@
             parse_from_config=True,
             help="also check syntax of the doctests",
         )
-        parser.add_option(
-            "--include-in-doctest",
-            default="",
-            dest="include_in_doctest",
-            parse_from_config=True,
-            comma_separated_list=True,
-            normalize_paths=True,
-            help="Run doctests only on these files",
-        )
-        parser.add_option(
-            "--exclude-from-doctest",
-            default="",
-            dest="exclude_from_doctest",
-            parse_from_config=True,
-            comma_separated_list=True,
-            normalize_paths=True,
-            help="Skip these files when running doctests",
-        )
 
     @classmethod
     def parse_options(cls, options: argparse.Namespace) -> None:
@@ -139,43 +97,6 @@
             cls.builtIns = cls.builtIns.union(options.builtins)
         cls.with_doctest = options.doctests
 
-        if options.include_in_doctest or options.exclude_from_doctest:
-            LOG.warning(
-                "--include-in-doctest / --exclude-from-doctest will be "
-                "removed in a future version.  see PyCQA/flake8#1747"
-            )
-
-        included_files = []
-        for included_file in options.include_in_doctest:
-            if included_file == "":
-                continue
-            if not included_file.startswith((os.sep, "./", "~/")):
-                included_files.append(f"./{included_file}")
-            else:
-                included_files.append(included_file)
-        cls.include_in_doctest = utils.normalize_paths(included_files)
-
-        excluded_files = []
-        for excluded_file in options.exclude_from_doctest:
-            if excluded_file == "":
-                continue
-            if not excluded_file.startswith((os.sep, "./", "~/")):
-                excluded_files.append(f"./{excluded_file}")
-            else:
-                excluded_files.append(excluded_file)
-        cls.exclude_from_doctest = utils.normalize_paths(excluded_files)
-
-        inc_exc = set(cls.include_in_doctest).intersection(
-            cls.exclude_from_doctest
-        )
-        if inc_exc:
-            raise ValueError(
-                f"{inc_exc!r} was specified in both the "
-                f"include-in-doctest and exclude-from-doctest "
-                f"options. You are not allowed to specify it in "
-                f"both for doctesting."
-            )
-
     def run(self) -> Generator[tuple[int, int, str, type[Any]], None, None]:
         """Run the plugin."""
         for message in self.messages:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/src/flake8/processor.py 
new/flake8-7.0.0/src/flake8/processor.py
--- old/flake8-6.1.0/src/flake8/processor.py    2023-07-29 21:04:17.000000000 
+0200
+++ new/flake8-7.0.0/src/flake8/processor.py    2024-01-05 01:41:07.000000000 
+0100
@@ -3,6 +3,7 @@
 
 import argparse
 import ast
+import functools
 import logging
 import tokenize
 from typing import Any
@@ -114,23 +115,15 @@
         self.verbose = options.verbose
         #: Statistics dictionary
         self.statistics = {"logical lines": 0}
-        self._file_tokens: list[tokenize.TokenInfo] | None = None
-        # map from line number to the line we'll search for `noqa` in
-        self._noqa_line_mapping: dict[int, str] | None = None
         self._fstring_start = -1
 
-    @property
+    @functools.cached_property
     def file_tokens(self) -> list[tokenize.TokenInfo]:
         """Return the complete set of tokens for a file."""
-        if self._file_tokens is None:
-            line_iter = iter(self.lines)
-            self._file_tokens = list(
-                tokenize.generate_tokens(lambda: next(line_iter))
-            )
-
-        return self._file_tokens
+        line_iter = iter(self.lines)
+        return list(tokenize.generate_tokens(lambda: next(line_iter)))
 
-    def fstring_start(self, lineno: int) -> None:
+    def fstring_start(self, lineno: int) -> None:  # pragma: >=3.12 cover
         """Signal the beginning of an fstring."""
         self._fstring_start = lineno
 
@@ -138,7 +131,7 @@
         self, token: tokenize.TokenInfo
     ) -> Generator[str, None, None]:
         """Iterate through the lines of a multiline string."""
-        if token.type == FSTRING_END:
+        if token.type == FSTRING_END:  # pragma: >=3.12 cover
             start = self._fstring_start
         else:
             start = token.start[0]
@@ -209,7 +202,7 @@
                 continue
             if token_type == tokenize.STRING:
                 text = mutate_string(text)
-            elif token_type == FSTRING_MIDDLE:
+            elif token_type == FSTRING_MIDDLE:  # pragma: >=3.12 cover
                 text = "x" * len(text)
             if previous_row:
                 (start_row, start_column) = start
@@ -277,41 +270,37 @@
         joined = "".join(self.lines[min_line - 1 : max_line])
         return dict.fromkeys(line_range, joined)
 
-    def noqa_line_for(self, line_number: int) -> str | None:
-        """Retrieve the line which will be used to determine noqa."""
-        if self._noqa_line_mapping is None:
-            try:
-                file_tokens = self.file_tokens
-            except (tokenize.TokenError, SyntaxError):
-                # if we failed to parse the file tokens, we'll always fail in
-                # the future, so set this so the code does not try again
-                self._noqa_line_mapping = {}
-            else:
-                ret = {}
-
-                min_line = len(self.lines) + 2
-                max_line = -1
-                for tp, _, (s_line, _), (e_line, _), _ in file_tokens:
-                    if tp == tokenize.ENDMARKER:
-                        break
-
-                    min_line = min(min_line, s_line)
-                    max_line = max(max_line, e_line)
-
-                    if tp in (tokenize.NL, tokenize.NEWLINE):
-                        ret.update(self._noqa_line_range(min_line, max_line))
-
-                        min_line = len(self.lines) + 2
-                        max_line = -1
-
-                # in newer versions of python, a `NEWLINE` token is inserted
-                # at the end of the file even if it doesn't have one.
-                # on old pythons, they will not have hit a `NEWLINE`
-                if max_line != -1:
+    @functools.cached_property
+    def _noqa_line_mapping(self) -> dict[int, str]:
+        """Map from line number to the line we'll search for `noqa` in."""
+        try:
+            file_tokens = self.file_tokens
+        except (tokenize.TokenError, SyntaxError):
+            # if we failed to parse the file tokens, we'll always fail in
+            # the future, so set this so the code does not try again
+            return {}
+        else:
+            ret = {}
+
+            min_line = len(self.lines) + 2
+            max_line = -1
+            for tp, _, (s_line, _), (e_line, _), _ in file_tokens:
+                if tp == tokenize.ENDMARKER or tp == tokenize.DEDENT:
+                    continue
+
+                min_line = min(min_line, s_line)
+                max_line = max(max_line, e_line)
+
+                if tp in (tokenize.NL, tokenize.NEWLINE):
                     ret.update(self._noqa_line_range(min_line, max_line))
 
-                self._noqa_line_mapping = ret
+                    min_line = len(self.lines) + 2
+                    max_line = -1
 
+            return ret
+
+    def noqa_line_for(self, line_number: int) -> str | None:
+        """Retrieve the line which will be used to determine noqa."""
         # NOTE(sigmavirus24): Some plugins choose to report errors for empty
         # files on Line 1. In those cases, we shouldn't bother trying to
         # retrieve a physical line (since none exist).
@@ -377,12 +366,8 @@
             # If we have nothing to analyze quit early
             return
 
-        first_byte = ord(self.lines[0][0])
-        if first_byte not in (0xEF, 0xFEFF):
-            return
-
         # If the first byte of the file is a UTF-8 BOM, strip it
-        if first_byte == 0xFEFF:
+        if self.lines[0][:1] == "\uFEFF":
             self.lines[0] = self.lines[0][1:]
         elif self.lines[0][:3] == "\xEF\xBB\xBF":
             self.lines[0] = self.lines[0][3:]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/tests/unit/plugins/reporter_test.py 
new/flake8-7.0.0/tests/unit/plugins/reporter_test.py
--- old/flake8-6.1.0/tests/unit/plugins/reporter_test.py        2023-07-29 
21:04:17.000000000 +0200
+++ new/flake8-7.0.0/tests/unit/plugins/reporter_test.py        2024-01-05 
01:41:07.000000000 +0100
@@ -11,7 +11,7 @@
 
 
 def _opts(**kwargs):
-    kwargs.setdefault("quiet", 0),
+    kwargs.setdefault("quiet", 0)
     kwargs.setdefault("color", "never")
     kwargs.setdefault("output_file", None)
     return argparse.Namespace(**kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-6.1.0/tox.ini new/flake8-7.0.0/tox.ini
--- old/flake8-6.1.0/tox.ini    2023-07-29 21:04:17.000000000 +0200
+++ new/flake8-7.0.0/tox.ini    2024-01-05 01:41:07.000000000 +0100
@@ -6,6 +6,7 @@
 deps =
     pytest!=3.0.5,!=5.2.3
     coverage>=6
+    covdefaults
 commands =
     coverage run -m pytest {posargs}
     coverage report

Reply via email to