{"instance_id": "astropy__astropy-7671", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/astropy/utils/introspection.py b/astropy/utils/introspection.py\nindex 3e784f9fc3..bf91410cd0 100644\n--- a/astropy/utils/introspection.py\n+++ b/astropy/utils/introspection.py\n@@ -4,6 +4,7 @@\n \n \n import inspect\n+import re\n import types\n import importlib\n from distutils.version import LooseVersion\n@@ -139,6 +140,17 @@ def minversion(module, version, inclusive=True, version_path='__version__'):\n     else:\n         have_version = resolve_name(module.__name__, version_path)\n \n+    # LooseVersion raises a TypeError when strings like dev, rc1 are part\n+    # of the version number. Match the dotted numbers only. Regex taken\n+    # from PEP440, https://www.python.org/dev/peps/pep-0440/, Appendix B\n+    expr = r'^([1-9]\\d*!)?(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))*'\n+    m = re.match(expr, version)\n+    if m:\n+        version = m.group(0)\n+    m = re.match(expr, have_version)\n+    if m:\n+        have_version = m.group(0)\n+\n     if inclusive:\n         return LooseVersion(have_version) >= LooseVersion(version)\n     else:\n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 30, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 30, "steps": 7}], "ms": 22767}
{"instance_id": "astropy__astropy-8707", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/astropy/io/fits/card.py b/astropy/io/fits/card.py\nindex 8c1ac5d738..147b71569a 100644\n--- a/astropy/io/fits/card.py\n+++ b/astropy/io/fits/card.py\n@@ -5,7 +5,8 @@ import warnings\n \n import numpy as np\n \n-from .util import _str_to_num, _is_int, translate, _words_group\n+from .util import (_str_to_num, _is_int, translate, _words_group,\n+                   decode_ascii)\n from .verify import _Verify, _ErrList, VerifyError, VerifyWarning\n \n from . import conf\n@@ -554,7 +555,7 @@ class Card(_Verify):\n         \"\"\"\n \n         card = cls()\n-        card._image = _pad(image)\n+        card._image = _pad(decode_ascii(image))\n         card._verified = False\n         return card\n \ndiff --git a/astropy/io/fits/header.py b/astropy/io/fits/header.py\nindex ad07e6d52d..b4716c8575 100644\n--- a/astropy/io/fits/header.py\n+++ b/astropy/io/fits/header.py\n@@ -334,10 +334,10 @@ class Header:\n \n         Parameters\n         ----------\n-        data : str\n-           String containing the entire header.\n+        data : str or bytes\n+           String (unicode or bytes) containing the entire header.\n \n-        sep : str, optional\n+        sep : str or bytes, optional\n             The string separating cards from each other, such as a newline.  By\n             default there is no card separator (as is the case in a raw FITS\n             file).\n@@ -350,6 +350,10 @@ class Header:\n \n         cards = []\n \n+        # Accept both unicode and bytes strings\n+        data = decode_ascii(data)\n+        sep = decode_ascii(sep)\n+\n         # If the card separator contains characters that may validly appear in\n         # a card, the only way to unambiguously distinguish between cards is to\n         # require that they be Card.length long.  However, if the separator\n", "model": "claude-sonnet-5-5", "steps": 13, "finished": true, "patch_lines": 52, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 2, "diff_lines": 52, "steps": 13}], "ms": 45366}
{"instance_id": "astropy__astropy-8872", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/astropy/units/quantity.py b/astropy/units/quantity.py\nindex ded609cbe9..b7f439baac 100644\n--- a/astropy/units/quantity.py\n+++ b/astropy/units/quantity.py\n@@ -296,8 +296,7 @@ class Quantity(np.ndarray, metaclass=InheritDocstrings):\n                 if not copy:\n                     return value\n \n-                if not (np.can_cast(np.float32, value.dtype) or\n-                        value.dtype.fields):\n+                if not (value.dtype.kind in 'fc' or value.dtype.fields):\n                     dtype = float\n \n             return np.array(value, dtype=dtype, copy=copy, order=order,\n@@ -377,7 +376,7 @@ class Quantity(np.ndarray, metaclass=InheritDocstrings):\n                             \"Numpy numeric type.\")\n \n         # by default, cast any integer, boolean, etc., to float\n-        if dtype is None and (not (np.can_cast(np.float32, value.dtype)\n+        if dtype is None and (not (value.dtype.kind in 'fc'\n                                    or value.dtype.fields)\n                               or value.dtype.kind == 'O'):\n             value = value.astype(float)\n", "model": "claude-sonnet-5-5", "steps": 12, "finished": true, "patch_lines": 23, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 23, "steps": 12}], "ms": 45717}
{"instance_id": "pylint-dev__pylint-4551", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/pylint/pyreverse/diagrams.py b/pylint/pyreverse/diagrams.py\nindex bf9f67af6..f111bfe0e 100644\n--- a/pylint/pyreverse/diagrams.py\n+++ b/pylint/pyreverse/diagrams.py\n@@ -122,7 +122,7 @@ class ClassDiagram(Figure, FilterMixIn):\n             if isinstance(node, astroid.Instance):\n                 node = node._proxied\n             if (\n-                isinstance(node, astroid.ClassDef)\n+                isinstance(node, (astroid.ClassDef, astroid.Name))\n                 and hasattr(node, \"name\")\n                 and not self.has_node(node)\n             ):\ndiff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py\nindex 8fa122022..19c39d4f4 100644\n--- a/pylint/pyreverse/inspector.py\n+++ b/pylint/pyreverse/inspector.py\n@@ -218,7 +218,7 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor):\n                     self.visit_module(frame)\n \n             current = frame.locals_type[node.name]\n-            values = set(node.infer())\n+            values = utils.infer_node(node)\n             frame.locals_type[node.name] = list(set(current) | values)\n         except astroid.InferenceError:\n             pass\n@@ -230,7 +230,7 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor):\n         handle instance_attrs_type\n         \"\"\"\n         try:\n-            values = set(node.infer())\n+            values = utils.infer_node(node)\n             current = set(parent.instance_attrs_type[node.attrname])\n             parent.instance_attrs_type[node.attrname] = list(current | values)\n         except astroid.InferenceError:\ndiff --git a/pylint/pyreverse/utils.py b/pylint/pyreverse/utils.py\nindex a24d227ee..bcc4be745 100644\n--- a/pylint/pyreverse/utils.py\n+++ b/pylint/pyreverse/utils.py\n@@ -20,6 +20,8 @@ import os\n import re\n import sys\n \n+import astroid\n+\n RCFILE = \".pyreverserc\"\n \n \n@@ -113,6 +115,72 @@ VIS_MOD = {\n }\n \n \n+def get_annotation_label(ann):\n+    \"\"\"return a string label for an annotation node\"\"\"\n+    if isinstance(ann, astroid.Name):\n+        return ann.name\n+    if isinstance(ann, (astroid.Subscript, astroid.Attribute)):\n+        return ann.as_string()\n+    if isinstance(ann, astroid.Const) and isinstance(ann.value, str):\n+        return ann.value\n+    return \"\"\n+\n+\n+def _find_annotation(node):\n+    \"\"\"return the annotation node of an AssignName/AssignAttr, if any\"\"\"\n+    parent = node.parent\n+    if isinstance(parent, astroid.AnnAssign):\n+        return parent.annotation\n+    if isinstance(node, astroid.AssignAttr):\n+        value = getattr(parent, \"value\", None)\n+        func = node.frame()\n+        if isinstance(value, astroid.Name) and isinstance(func, astroid.FunctionDef):\n+            args = func.args\n+            names = [a.name for a in (args.args or [])]\n+            annotations = list(args.annotations or [])\n+            names += [a.name for a in (args.kwonlyargs or [])]\n+            annotations += list(args.kwonlyargs_annotations or [])\n+            for name, annotation in zip(names, annotations):\n+                if name == value.name:\n+                    return annotation\n+    return None\n+\n+\n+def get_annotation(node):\n+    \"\"\"return a Name node holding the annotation label of `node`, or None\n+\n+    If the assigned value is inferred to be None, the label is wrapped\n+    in Optional[...].\n+    \"\"\"\n+    ann = _find_annotation(node)\n+    label = get_annotation_label(ann)\n+    if not label:\n+        return None\n+    try:\n+        default = next(node.infer())\n+    except (astroid.InferenceError, StopIteration):\n+        default = None\n+    if (\n+        isinstance(default, astroid.Const)\n+        and default.value is None\n+        and not label.startswith(\"Optional\")\n+    ):\n+        label = f\"Optional[{label}]\"\n+    return astroid.Name(name=label, parent=node.parent)\n+\n+\n+def infer_node(node):\n+    \"\"\"return a set with the node annotation if it exists, otherwise the\n+    set of inferred values\"\"\"\n+    ann = get_annotation(node)\n+    if ann:\n+        return {ann}\n+    try:\n+        return set(node.infer())\n+    except astroid.InferenceError:\n+        return set()\n+\n+\n class FilterMixIn:\n     \"\"\"filter nodes according to a mode and nodes' visibility\"\"\"\n \n", "model": "claude-sonnet-5-5", "steps": 16, "finished": false, "patch_lines": 121, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 3, "diff_lines": 121, "steps": 16}], "ms": 111648}
{"instance_id": "pylint-dev__pylint-4661", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/doc/faq.rst b/doc/faq.rst\nindex c817855f8..58ff9ebf1 100644\n--- a/doc/faq.rst\n+++ b/doc/faq.rst\n@@ -93,8 +93,9 @@ localized using the following rules:\n \n * value of the PYLINTHOME environment variable if set\n \n-* \".pylint.d\" subdirectory of the user's home directory if it is found\n-\t(not always findable on Windows platforms)\n+* \"pylint\" subdirectory of the user's cache directory if the home directory\n+\tis found (``~/.cache/pylint`` on Linux, following the XDG Base Directory\n+\tSpecification; not always findable on Windows platforms)\n \n * \".pylint.d\" directory in the current directory\n \ndiff --git a/pylint/config/__init__.py b/pylint/config/__init__.py\nindex 84774d0e3..5fbdb1400 100644\n--- a/pylint/config/__init__.py\n+++ b/pylint/config/__init__.py\n@@ -36,6 +36,8 @@ import os\n import pickle\n import sys\n \n+import platformdirs\n+\n from pylint.config.configuration_mixin import ConfigurationMixIn\n from pylint.config.find_default_config_files import find_default_config_files\n from pylint.config.man_help_formatter import _ManHelpFormatter\n@@ -63,7 +65,7 @@ if \"PYLINTHOME\" in os.environ:\n elif USER_HOME == \"~\":\n     PYLINT_HOME = \".pylint.d\"\n else:\n-    PYLINT_HOME = os.path.join(USER_HOME, \".pylint.d\")\n+    PYLINT_HOME = platformdirs.user_cache_dir(\"pylint\")\n \n \n def _get_pdata_path(base_name, recurs):\n@@ -83,7 +85,7 @@ def load_results(base):\n def save_results(results, base):\n     if not os.path.exists(PYLINT_HOME):\n         try:\n-            os.mkdir(PYLINT_HOME)\n+            os.makedirs(PYLINT_HOME, exist_ok=True)\n         except OSError:\n             print(\"Unable to create directory %s\" % PYLINT_HOME, file=sys.stderr)\n     data_file = _get_pdata_path(base, 1)\n@@ -110,8 +112,9 @@ ENV_HELP = (\n The following environment variables are used:\n     * PYLINTHOME\n     Path to the directory where persistent data for the run will be stored. If\n-not found, it defaults to ~/.pylint.d/ or .pylint.d (in the current working\n-directory).\n+not found, it defaults to the user cache directory (e.g. ~/.cache/pylint on\n+Linux, following the XDG Base Directory Specification) or .pylint.d (in the\n+current working directory) if the home directory cannot be determined.\n     * PYLINTRC\n     Path to the configuration file. See the documentation for the method used\n to search for configuration file.\ndiff --git a/setup.cfg b/setup.cfg\nindex 62a3fd7a5..91eee3e8d 100644\n--- a/setup.cfg\n+++ b/setup.cfg\n@@ -45,6 +45,7 @@ install_requires =\n     astroid>=2.6.5,<2.7 # (You should also upgrade requirements_test_min.txt)\n     isort>=4.2.5,<6\n     mccabe>=0.6,<0.7\n+    platformdirs>=2.2.0\n     toml>=0.7.1\n     colorama;sys_platform==\"win32\"\n python_requires = ~=3.6\n@@ -74,7 +75,7 @@ markers =\n [isort]\n multi_line_output = 3\n line_length = 88\n-known_third_party = astroid, sphinx, isort, pytest, mccabe, six, toml\n+known_third_party = astroid, sphinx, isort, pytest, mccabe, six, toml, platformdirs\n include_trailing_comma = True\n skip_glob = tests/functional/**,tests/input/**,tests/extensions/data/**,tests/regrtest_data/**,tests/data/**,astroid/**,venv/**\n src_paths = pylint\ndiff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py\nindex 004c29281..67a2b5ce6 100644\n--- a/tests/lint/unittest_lint.py\n+++ b/tests/lint/unittest_lint.py\n@@ -46,6 +46,7 @@ from os import chdir, getcwd\n from os.path import abspath, basename, dirname, isdir, join, sep\n from shutil import rmtree\n \n+import platformdirs\n import pytest\n \n from pylint import checkers, config, exceptions, interfaces, lint, testutils\n@@ -631,7 +632,7 @@ def test_pylint_home():\n     if uhome == \"~\":\n         expected = \".pylint.d\"\n     else:\n-        expected = os.path.join(uhome, \".pylint.d\")\n+        expected = platformdirs.user_cache_dir(\"pylint\")\n     assert config.PYLINT_HOME == expected\n \n     try:\n", "model": "claude-sonnet-5-5", "steps": 15, "finished": true, "patch_lines": 101, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 4, "diff_lines": 101, "steps": 15}], "ms": 103324}
{"instance_id": "pylint-dev__pylint-4970", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py\nindex c65b1c893..241993b66 100644\n--- a/pylint/checkers/similar.py\n+++ b/pylint/checkers/similar.py\n@@ -531,6 +531,9 @@ class Similar:\n         \"\"\"iterate on similarities among all files, by making a cartesian\n         product\n         \"\"\"\n+        if self.min_lines <= 0:\n+            # A minimum of 0 lines disables the duplicate code check\n+            return\n         for idx, lineset in enumerate(self.linesets[:-1]):\n             for lineset2 in self.linesets[idx + 1 :]:\n                 yield from self._find_common(lineset, lineset2)\n", "model": "claude-haiku-5-5", "steps": 6, "finished": true, "patch_lines": 14, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 14, "steps": 6}], "ms": 10974}
{"instance_id": "pylint-dev__pylint-6386", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/pylint/config/callback_actions.py b/pylint/config/callback_actions.py\nindex 761995399..7479d7873 100644\n--- a/pylint/config/callback_actions.py\n+++ b/pylint/config/callback_actions.py\n@@ -45,6 +45,32 @@ class _DoNothingAction(_CallbackAction):\n     without erroring when they are then processed again by argparse.\n     \"\"\"\n \n+    def __init__(\n+        self,\n+        option_strings: Sequence[str],\n+        dest: str,\n+        nargs: None = None,\n+        const: None = None,\n+        default: None = None,\n+        type: None = None,\n+        choices: None = None,\n+        required: bool = False,\n+        help: str = \"\",\n+        metavar: str = \"\",\n+    ) -> None:\n+        super().__init__(\n+            option_strings,\n+            dest,\n+            0,\n+            const,\n+            default,\n+            type,\n+            choices,\n+            required,\n+            help,\n+            metavar,\n+        )\n+\n     def __call__(\n         self,\n         parser: argparse.ArgumentParser,\ndiff --git a/pylint/config/utils.py b/pylint/config/utils.py\nindex 8c790416f..c0b862b44 100644\n--- a/pylint/config/utils.py\n+++ b/pylint/config/utils.py\n@@ -207,6 +207,7 @@ PREPROCESSABLE_OPTIONS: dict[\n     \"--output\": (True, _set_output),\n     \"--load-plugins\": (True, _add_plugins),\n     \"--verbose\": (False, _set_verbose_mode),\n+    \"-v\": (False, _set_verbose_mode),\n     \"--enable-all-extensions\": (False, _enable_all_extensions),\n }\n \n@@ -218,7 +219,7 @@ def _preprocess_options(run: Run, args: Sequence[str]) -> list[str]:\n     i = 0\n     while i < len(args):\n         argument = args[i]\n-        if not argument.startswith(\"--\"):\n+        if not argument.startswith(\"-\"):\n             processed_args.append(argument)\n             i += 1\n             continue\n", "model": "claude-sonnet-5-5", "steps": 12, "finished": true, "patch_lines": 58, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 2, "diff_lines": 58, "steps": 12}], "ms": 45620}
{"instance_id": "pylint-dev__pylint-6528", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py\nindex b20cd873c..deba5844e 100644\n--- a/pylint/lint/expand_modules.py\n+++ b/pylint/lint/expand_modules.py\n@@ -46,6 +46,20 @@ def _is_in_ignore_list_re(element: str, ignore_list_re: list[Pattern[str]]) -> b\n     return any(file_pattern.match(element) for file_pattern in ignore_list_re)\n \n \n+def _is_ignored_file(\n+    element: str,\n+    ignore_list: list[str],\n+    ignore_list_re: list[Pattern[str]],\n+    ignore_list_paths_re: list[Pattern[str]],\n+) -> bool:\n+    basename = os.path.basename(element)\n+    return (\n+        basename in ignore_list\n+        or _is_in_ignore_list_re(basename, ignore_list_re)\n+        or _is_in_ignore_list_re(element, ignore_list_paths_re)\n+    )\n+\n+\n def expand_modules(\n     files_or_modules: Sequence[str],\n     ignore_list: list[str],\ndiff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py\nindex 53345a6b1..3664cb229 100644\n--- a/pylint/lint/pylinter.py\n+++ b/pylint/lint/pylinter.py\n@@ -31,7 +31,7 @@ from pylint.constants import (\n )\n from pylint.lint.base_options import _make_linter_options\n from pylint.lint.caching import load_results, save_results\n-from pylint.lint.expand_modules import expand_modules\n+from pylint.lint.expand_modules import _is_ignored_file, expand_modules\n from pylint.lint.message_state_handler import _MessageStateHandler\n from pylint.lint.parallel import check_parallel\n from pylint.lint.report_functions import (\n@@ -579,6 +579,16 @@ class PyLinter(\n                     if any(root.startswith(s) for s in skip_subtrees):\n                         # Skip subtree of already discovered package.\n                         continue\n+\n+                    if _is_ignored_file(\n+                        root,\n+                        self.config.ignore,\n+                        self.config.ignore_patterns,\n+                        self.config.ignore_paths,\n+                    ):\n+                        skip_subtrees.append(root)\n+                        continue\n+\n                     if \"__init__.py\" in files:\n                         skip_subtrees.append(root)\n                         yield root\n", "model": "claude-sonnet-5-5", "steps": 16, "finished": false, "patch_lines": 55, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 2, "diff_lines": 55, "steps": 16}], "ms": 42471}
{"instance_id": "pylint-dev__pylint-6903", "model_name_or_path": "cain-70b-e124", "model_patch": "diff --git a/pylint/lint/run.py b/pylint/lint/run.py\nindex a7e5d5574..da2c8bce2 100644\n--- a/pylint/lint/run.py\n+++ b/pylint/lint/run.py\n@@ -1,232 +1,21 @@\n-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE\n-# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt\n-\n-from __future__ import annotations\n-\n import os\n-import sys\n-import warnings\n-from collections.abc import Sequence\n-from pathlib import Path\n-from typing import Any, ClassVar\n-\n-from pylint import config\n-from pylint.config._pylint_config import (\n-    _handle_pylint_config_commands,\n-    _register_generate_config_options,\n-)\n-from pylint.config.config_initialization import _config_initialization\n-from pylint.config.exceptions import ArgumentPreprocessingError\n-from pylint.config.utils import _preprocess_options\n-from pylint.constants import full_version\n-from pylint.lint.base_options import _make_run_options\n-from pylint.lint.pylinter import PyLinter\n-from pylint.reporters.base_reporter import BaseReporter\n-\n-try:\n-    import multiprocessing\n-    from multiprocessing import synchronize  # noqa pylint: disable=unused-import\n-except ImportError:\n-    multiprocessing = None  # type: ignore[assignment]\n-\n-\n-def _query_cpu() -> int | None:\n-    \"\"\"Try to determine number of CPUs allotted in a docker container.\n-\n-    This is based on discussion and copied from suggestions in\n-    https://bugs.python.org/issue36054.\n-    \"\"\"\n-    cpu_quota, avail_cpu = None, None\n-\n-    if Path(\"/sys/fs/cgroup/cpu/cpu.cfs_quota_us\").is_file():\n-        with open(\"/sys/fs/cgroup/cpu/cpu.cfs_quota_us\", encoding=\"utf-8\") as file:\n-            # Not useful for AWS Batch based jobs as result is -1, but works on local linux systems\n-            cpu_quota = int(file.read().rstrip())\n-\n-    if (\n-        cpu_quota\n-        and cpu_quota != -1\n-        and Path(\"/sys/fs/cgroup/cpu/cpu.cfs_period_us\").is_file()\n-    ):\n-        with open(\"/sys/fs/cgroup/cpu/cpu.cfs_period_us\", encoding=\"utf-8\") as file:\n-            cpu_period = int(file.read().rstrip())\n-        # Divide quota by period and you should get num of allotted CPU to the container, rounded down if fractional.\n-        avail_cpu = int(cpu_quota / cpu_period)\n-    elif Path(\"/sys/fs/cgroup/cpu/cpu.shares\").is_file():\n-        with open(\"/sys/fs/cgroup/cpu/cpu.shares\", encoding=\"utf-8\") as file:\n-            cpu_shares = int(file.read().rstrip())\n-        # For AWS, gives correct value * 1024.\n-        avail_cpu = int(cpu_shares / 1024)\n-    return avail_cpu\n-\n-\n-def _cpu_count() -> int:\n-    \"\"\"Use sched_affinity if available for virtualized or containerized\n-    environments.\n-    \"\"\"\n-    cpu_share = _query_cpu()\n-    cpu_count = None\n-    sched_getaffinity = getattr(os, \"sched_getaffinity\", None)\n-    # pylint: disable=not-callable,using-constant-test,useless-suppression\n-    if sched_getaffinity:\n-        cpu_count = len(sched_getaffinity(0))\n-    elif multiprocessing:\n-        cpu_count = multiprocessing.cpu_count()\n-    else:\n-        cpu_count = 1\n-    if cpu_share is not None:\n-        return min(cpu_share, cpu_count)\n-    return cpu_count\n-\n-\n-UNUSED_PARAM_SENTINEL = object()\n-\n-\n-class Run:\n-    \"\"\"Helper class to use as main for pylint with 'run(*sys.argv[1:])'.\"\"\"\n-\n-    LinterClass = PyLinter\n-    option_groups = (\n-        (\n-            \"Commands\",\n-            \"Options which are actually commands. Options in this \\\n-group are mutually exclusive.\",\n-        ),\n-    )\n-    _is_pylint_config: ClassVar[bool] = False\n-    \"\"\"Boolean whether or not this is a 'pylint-config' run.\n-\n-    Used by _PylintConfigRun to make the 'pylint-config' command work.\n-    \"\"\"\n-\n-    def __init__(\n-        self,\n-        args: Sequence[str],\n-        reporter: BaseReporter | None = None,\n-        exit: bool = True,  # pylint: disable=redefined-builtin\n-        do_exit: Any = UNUSED_PARAM_SENTINEL,\n-    ) -> None:\n-        # Immediately exit if user asks for version\n-        if \"--version\" in args:\n-            print(full_version)\n-            sys.exit(0)\n-\n-        self._rcfile: str | None = None\n-        self._output: str | None = None\n-        self._plugins: list[str] = []\n-        self.verbose: bool = False\n-\n-        # Pre-process certain options and remove them from args list\n-        try:\n-            args = _preprocess_options(self, args)\n-        except ArgumentPreprocessingError as ex:\n-            print(ex, file=sys.stderr)\n-            sys.exit(32)\n-\n-        # Determine configuration file\n-        if self._rcfile is None:\n-            default_file = next(config.find_default_config_files(), None)\n-            if default_file:\n-                self._rcfile = str(default_file)\n-\n-        self.linter = linter = self.LinterClass(\n-            _make_run_options(self),\n-            option_groups=self.option_groups,\n-            pylintrc=self._rcfile,\n-        )\n-        # register standard checkers\n-        linter.load_default_plugins()\n-        # load command line plugins\n-        linter.load_plugin_modules(self._plugins)\n-\n-        linter.disable(\"I\")\n-        linter.enable(\"c-extension-no-member\")\n-\n-        # Register the options needed for 'pylint-config'\n-        # By not registering them by default they don't show up in the normal usage message\n-        if self._is_pylint_config:\n-            _register_generate_config_options(linter._arg_parser)\n-\n-        args = _config_initialization(\n-            linter, args, reporter, config_file=self._rcfile, verbose_mode=self.verbose\n-        )\n-\n-        # Handle the 'pylint-config' command\n-        if self._is_pylint_config:\n-            warnings.warn(\n-                \"NOTE: The 'pylint-config' command is experimental and usage can change\",\n-                UserWarning,\n-            )\n-            code = _handle_pylint_config_commands(linter)\n-            if exit:\n-                sys.exit(code)\n-            return\n-\n-        # Display help messages if there are no files to lint\n-        if not args:\n-            print(linter.help())\n-            sys.exit(32)\n-\n-        if linter.config.jobs < 0:\n-            print(\n-                f\"Jobs number ({linter.config.jobs}) should be greater than or equal to 0\",\n-                file=sys.stderr,\n-            )\n-            sys.exit(32)\n-        if linter.config.jobs > 1 or linter.config.jobs == 0:\n-            if multiprocessing is None:\n-                print(\n-                    \"Multiprocessing library is missing, fallback to single process\",\n-                    file=sys.stderr,\n-                )\n-                linter.set_option(\"jobs\", 1)\n-            elif linter.config.jobs == 0:\n-                linter.config.jobs = _cpu_count()\n-\n-        if self._output:\n-            try:\n-                with open(self._output, \"w\", encoding=\"utf-8\") as output:\n-                    linter.reporter.out = output\n-                    linter.check(args)\n-                    score_value = linter.generate_reports()\n-            except OSError as ex:\n-                print(ex, file=sys.stderr)\n-                sys.exit(32)\n-        else:\n-            linter.check(args)\n-            score_value = linter.generate_reports()\n-\n-        if do_exit is not UNUSED_PARAM_SENTINEL:\n-            warnings.warn(\n-                \"do_exit is deprecated and it is going to be removed in a future version.\",\n-                DeprecationWarning,\n-            )\n-            exit = do_exit\n-\n-        if exit:\n-            if linter.config.exit_zero:\n-                sys.exit(0)\n-            elif linter.any_fail_on_issues():\n-                # We need to make sure we return a failing exit code in this case.\n-                # So we use self.linter.msg_status if that is non-zero, otherwise we just return 1.\n-                sys.exit(self.linter.msg_status or 1)\n-            elif score_value is not None:\n-                if score_value >= linter.config.fail_under:\n-                    sys.exit(0)\n-                else:\n-                    # We need to make sure we return a failing exit code in this case.\n-                    # So we use self.linter.msg_status if that is non-zero, otherwise we just return 1.\n-                    sys.exit(self.linter.msg_status or 1)\n-            else:\n-                sys.exit(self.linter.msg_status)\n-\n-\n-class _PylintConfigRun(Run):\n-    \"\"\"A private wrapper for the 'pylint-config' command.\"\"\"\n-\n-    _is_pylint_config: ClassVar[bool] = True\n-    \"\"\"Boolean whether or not this is a 'pylint-config' run.\n-\n-    Used by _PylintConfigRun to make the 'pylint-config' command work.\n-    \"\"\"\n+import multiprocessing\n+\n+\n+def _query_cpu():\n+    try:\n+        with open('/sys/fs/cgroup/cpu/cpu.cfs_quota_us') as f:\n+            quota = int(f.read())\n+        with open('/sys/fs/cgroup/cpu/cpu.cfs_period_us') as f:\n+            period = int(f.read())\n+        if period > 0:\n+            return max(quota / period, 1)\n+    except (FileNotFoundError, ValueError):\n+        pass\n+    try:\n+        with open('/sys/fs/cgroup/cpu/cpu.shares') as f:\n+            shares = int(f.read())\n+        return max(shares / 1024, 1)\n+    except (FileNotFoundError, ValueError):\n+        pass\n+    return multiprocessing.cpu_count()\n"}
{"instance_id": "pylint-dev__pylint-7080", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py\nindex 5cacc0371..d38c7b7cc 100644\n--- a/pylint/lint/expand_modules.py\n+++ b/pylint/lint/expand_modules.py\n@@ -52,6 +52,7 @@ def _is_ignored_file(\n     ignore_list_re: list[Pattern[str]],\n     ignore_list_paths_re: list[Pattern[str]],\n ) -> bool:\n+    element = os.path.normpath(element)\n     basename = os.path.basename(element)\n     return (\n         basename in ignore_list\n@@ -142,7 +143,9 @@ def expand_modules(\n                     continue\n                 if _is_in_ignore_list_re(\n                     os.path.basename(subfilepath), ignore_list_re\n-                ) or _is_in_ignore_list_re(subfilepath, ignore_list_paths_re):\n+                ) or _is_in_ignore_list_re(\n+                    os.path.normpath(subfilepath), ignore_list_paths_re\n+                ):\n                     continue\n \n                 modpath = _modpath_from_file(\n", "model": "claude-sonnet-5-5", "steps": 16, "finished": false, "patch_lines": 23, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 23, "steps": 16}], "ms": 61215}
