prompt: "TypeError: unsupported format string passed to NoneType.__format__" while running type inference in version 2.12.x
  ### Steps to reproduce
  
  I have no concise reproducer. Exception happens every time I run pylint on some internal code, with astroid 2.12.10 and 2.12.12 (debian bookworm). It does _not_ happen with earlier versions of astroid (not with version 2.9). The pylinted code itself is "valid", it runs in production here.
  
  ### Current behavior
  
  When running pylint on some code, I get this exception:
  ```
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/pylint/utils/ast_walker.py", line 90, in walk
      callback(astroid)
    File "/usr/lib/python3/dist-packages/pylint/checkers/classes/special_methods_checker.py", line 183, in visit_functiondef
      inferred = _safe_infer_call_result(node, node)
    File "/usr/lib/python3/dist-packages/pylint/checkers/classes/special_methods_checker.py", line 42, in _safe_infer_call_result
      value = next(inferit)
    File "/usr/lib/python3/dist-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 1749, in infer_call_result
      yield from returnnode.value.infer(context)
    File "/usr/lib/python3/dist-packages/astroid/nodes/node_ng.py", line 159, in infer
      results = list(self._explicit_inference(self, context, **kwargs))
    File "/usr/lib/python3/dist-packages/astroid/inference_tip.py", line 45, in _inference_tip_cached
      result = _cache[func, node] = list(func(*args, **kwargs))
    File "/usr/lib/python3/dist-packages/astroid/brain/brain_builtin_inference.py", line 956, in _infer_str_format_call
      formatted_string = format_template.format(*pos_values, **keyword_values)
  TypeError: unsupported format string passed to NoneType.__format__
  ```
  
  ### Expected behavior
  
  TypeError exception should not happen
  
  ### `python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"` output
  
  2.12.10,
  2.12.12
  
instance: {"FAIL_TO_PASS": "[\"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format_uninferable[\\\\n\"]", "PASS_TO_PASS": "[\"tests/unittest_brain_builtin.py::BuiltinsTest::test_infer_property\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[empty-indexes]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[numbered-indexes]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[named-indexes]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[numbered-indexes-from-positional]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[named-indexes-from-keyword]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[mixed-indexes-from-mixed]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[empty-indexes-on-variable]\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format_uninferable[\\\"I\", \"tests/unittest_brain_builtin.py::TestStringNodes::test_string_format_with_specs\"]", "base_commit": "6cf238d089cf4b6753c94cfc089b4a47487711e5", "created_at": "2022-11-12T19:21:34Z", "environment_setup_commit": "fe058bff95745371df5796286d33677c21137847", "hints_text": "Hi @crosser, thanks for the report.\r\n\r\n> I have no concise reproducer. \r\n\r\nWe might be able to help you distill one.\r\n\r\n`pylint` produces a crash report, and shows the link in your terminal, like this:\r\n```shell\r\n************* Module a\r\na.py:1:0: F0002: a.py: Fatal error while checking 'a.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/Users/.../Library/Caches/pylint/pylint-crash-2022-10-29-08-48-25.txt'. (astroid-error)\r\n```\r\nThe offending file is at the top of the crash report. If the code is too long, or contains sensitive information, you can use the knowledge that the crash happened in `_infer_str_format_call` to look for calls to `.format()` on strings. You should be able to then just provide us those calls--and enough surrounding code to rebuild the objects you provided to `format()`. \r\n\r\nDoing this would be a tremendous help!\n> `pylint` produces a crash report, and shows the link in your terminal, like this:\r\n\r\nNo, not really, it does not. I am attaching a (censored) stderr from running the test. The line in the source code that apparently triggers the problem is pretty innocuous:\r\n\r\n```\r\n    @property\r\n    def vnet_id(self):  # <---- this is the line 266 that is mentioned in the \"Exception on node\" message\r\n        if ...:\r\n```\r\nThere is very similar property definition right before this one, that does not trigger the problem.\r\n\r\n[pyerr.txt](https://github.com/PyCQA/astroid/files/9900190/pyerr.txt)\r\n\r\nPylint command was `python3 -m pylint --jobs=0 --rcfile=test/style/pylint.conf <project-dir>`\r\n\r\n```\r\n$ pylint --version\r\npylint 2.15.5\r\nastroid 2.12.12\r\nPython 3.10.8 (main, Oct 24 2022, 10:07:16) [GCC 12.2.0]\r\n```\r\n\r\nedit:\r\n> enough surrounding code to rebuild the objects you provided to format().\r\n\r\n_I_ did not provide any objects to `format()`, astroid did...\nThanks for providing the traceback.\r\n\r\n> No, not really, it does not. I am attaching a (censored) stderr from running the test. \r\n\r\nI see now that it's because you're invoking pylint from a unittest, so your test is managing the output.\r\n\r\n> The line in the source code that apparently triggers the problem is pretty innocuous:\r\n\r\nThe deeper failure is on the call in line 268, not the function def on line 266. Is there anything you can sanitize and tell us about line 268? Thanks again for providing the help.\n> I see now that it's because you're invoking pylint from a unittest, so your test is managing the output.\r\n\r\nWhen I run pylint by hand\r\n\r\n```\r\npylint --jobs=0 --rcfile=test/style/pylint.conf <module-name> | tee /tmp/pyerr.txt\r\n```\r\nthere is still no \"Fatal error while checking ...\" message in the output\r\n\r\n> > The line in the source code that apparently triggers the problem is pretty innocuous:\r\n> \r\n> The deeper failure is on the call in line 268, not the function def on line 266. Is there anything you can sanitize and tell us about line 268? Thanks again for providing the help.\r\n\r\nOh yes, there is a `something.format()` in that line! But the \"something\" is a literal string:\r\n```\r\n    @property\r\n    def vnet_id(self):\r\n        if self.backend == \"something\":\r\n            return \"{:04x}{:04x}n{:d}\".format(  # <---- this is line 268\r\n                self.<some-attr>, self.<another-attr>, self.<third-attr>\r\n            )\r\n        if self.backend == \"somethingelse\":\r\n            return \"h{:08}n{:d}\".format(self.<more-attr>, self.<and more>)\r\n        return None\r\n```\r\n\nThanks, that was very helpful. Here is a reproducer:\r\n```python\r\nx = \"{:c}\".format(None)\r\n```", "instance_id": "pylint-dev__astroid-1866", "patch": "diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py\n--- a/astroid/brain/brain_builtin_inference.py\n+++ b/astroid/brain/brain_builtin_inference.py\n@@ -954,8 +954,10 @@ def _infer_str_format_call(\n \n     try:\n         formatted_string = format_template.format(*pos_values, **keyword_values)\n-    except (IndexError, KeyError):\n-        # If there is an IndexError there are too few arguments to interpolate\n+    except (IndexError, KeyError, TypeError, ValueError):\n+        # IndexError: there are too few arguments to interpolate\n+        # TypeError: Unsupported format string\n+        # ValueError: Unknown format code\n         return iter([util.Uninferable])\n \n     return iter([nodes.const_factory(formatted_string)])\n", "problem_statement": "\"TypeError: unsupported format string passed to NoneType.__format__\" while running type inference in version 2.12.x\n### Steps to reproduce\r\n\r\nI have no concise reproducer. Exception happens every time I run pylint on some internal code, with astroid 2.12.10 and 2.12.12 (debian bookworm). It does _not_ happen with earlier versions of astroid (not with version 2.9). The pylinted code itself is \"valid\", it runs in production here.\r\n\r\n### Current behavior\r\n\r\nWhen running pylint on some code, I get this exception:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3/dist-packages/pylint/utils/ast_walker.py\", line 90, in walk\r\n    callback(astroid)\r\n  File \"/usr/lib/python3/dist-packages/pylint/checkers/classes/special_methods_checker.py\", line 183, in visit_functiondef\r\n    inferred = _safe_infer_call_result(node, node)\r\n  File \"/usr/lib/python3/dist-packages/pylint/checkers/classes/special_methods_checker.py\", line 42, in _safe_infer_call_result\r\n    value = next(inferit)\r\n  File \"/usr/lib/python3/dist-packages/astroid/nodes/scoped_nodes/scoped_nodes.py\", line 1749, in infer_call_result\r\n    yield from returnnode.value.infer(context)\r\n  File \"/usr/lib/python3/dist-packages/astroid/nodes/node_ng.py\", line 159, in infer\r\n    results = list(self._explicit_inference(self, context, **kwargs))\r\n  File \"/usr/lib/python3/dist-packages/astroid/inference_tip.py\", line 45, in _inference_tip_cached\r\n    result = _cache[func, node] = list(func(*args, **kwargs))\r\n  File \"/usr/lib/python3/dist-packages/astroid/brain/brain_builtin_inference.py\", line 956, in _infer_str_format_call\r\n    formatted_string = format_template.format(*pos_values, **keyword_values)\r\nTypeError: unsupported format string passed to NoneType.__format__\r\n```\r\n\r\n### Expected behavior\r\n\r\nTypeError exception should not happen\r\n\r\n### `python -c \"from astroid import __pkginfo__; print(__pkginfo__.version)\"` output\r\n\r\n2.12.10,\r\n2.12.12\n", "repo": "pylint-dev/astroid", "test_patch": "diff --git a/tests/unittest_brain_builtin.py b/tests/unittest_brain_builtin.py\n--- a/tests/unittest_brain_builtin.py\n+++ b/tests/unittest_brain_builtin.py\n@@ -103,6 +103,12 @@ def test_string_format(self, format_string: str) -> None:\n             \"\"\"\n             \"My name is {fname}, I'm {age}\".format(fsname = \"Daniel\", age = 12)\n             \"\"\",\n+            \"\"\"\n+            \"My unicode character is {:c}\".format(None)\n+            \"\"\",\n+            \"\"\"\n+            \"My hex format is {:4x}\".format('1')\n+            \"\"\",\n         ],\n     )\n     def test_string_format_uninferable(self, format_string: str) -> None:\n", "version": "2.13"}
parsed_commit_content: {"file_diffs":[{"old_file_content":"# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html\n# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE\n# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt\n\n\"\"\"Astroid hooks for various builtins.\"\"\"\n\nfrom __future__ import annotations\n\nimport itertools\nfrom collections.abc import Iterator\nfrom functools import partial\n\nfrom astroid import arguments, helpers, inference_tip, nodes, objects, util\nfrom astroid.builder import AstroidBuilder\nfrom astroid.context import InferenceContext\nfrom astroid.exceptions import (\n    AstroidTypeError,\n    AttributeInferenceError,\n    InferenceError,\n    MroError,\n    UseInferenceDefault,\n)\nfrom astroid.manager import AstroidManager\nfrom astroid.nodes import scoped_nodes\n\nOBJECT_DUNDER_NEW = \"object.__new__\"\n\nSTR_CLASS = \"\"\"\nclass whatever(object):\n    def join(self, iterable):\n        return {rvalue}\n    def replace(self, old, new, count=None):\n        return {rvalue}\n    def format(self, *args, **kwargs):\n        return {rvalue}\n    def encode(self, encoding='ascii', errors=None):\n        return b''\n    def decode(self, encoding='ascii', errors=None):\n        return u''\n    def capitalize(self):\n        return {rvalue}\n    def title(self):\n        return {rvalue}\n    def lower(self):\n        return {rvalue}\n    def upper(self):\n        return {rvalue}\n    def swapcase(self):\n        return {rvalue}\n    def index(self, sub, start=None, end=None):\n        return 0\n    def find(self, sub, start=None, end=None):\n        return 0\n    def count(self, sub, start=None, end=None):\n        return 0\n    def strip(self, chars=None):\n        return {rvalue}\n    def lstrip(self, chars=None):\n        return {rvalue}\n    def rstrip(self, chars=None):\n        return {rvalue}\n    def rjust(self, width, fillchar=None):\n        return {rvalue}\n    def center(self, width, fillchar=None):\n        return {rvalue}\n    def ljust(self, width, fillchar=None):\n        return {rvalue}\n\"\"\"\n\n\nBYTES_CLASS = \"\"\"\nclass whatever(object):\n    def join(self, iterable):\n        return {rvalue}\n    def replace(self, old, new, count=None):\n        return {rvalue}\n    def decode(self, encoding='ascii', errors=None):\n        return u''\n    def capitalize(self):\n        return {rvalue}\n    def title(self):\n        return {rvalue}\n    def lower(self):\n        return {rvalue}\n    def upper(self):\n        return {rvalue}\n    def swapcase(self):\n        return {rvalue}\n    def index(self, sub, start=None, end=None):\n        return 0\n    def find(self, sub, start=None, end=None):\n        return 0\n    def count(self, sub, start=None, end=None):\n        return 0\n    def strip(self, chars=None):\n        return {rvalue}\n    def lstrip(self, chars=None):\n        return {rvalue}\n    def rstrip(self, chars=None):\n        return {rvalue}\n    def rjust(self, width, fillchar=None):\n        return {rvalue}\n    def center(self, width, fillchar=None):\n        return {rvalue}\n    def ljust(self, width, fillchar=None):\n        return {rvalue}\n\"\"\"\n\n\ndef _extend_string_class(class_node, code, rvalue):\n    \"\"\"function to extend builtin str/unicode class\"\"\"\n    code = code.format(rvalue=rvalue)\n    fake = AstroidBuilder(AstroidManager()).string_build(code)[\"whatever\"]\n    for method in fake.mymethods():\n        method.parent = class_node\n        method.lineno = None\n        method.col_offset = None\n        if \"__class__\" in method.locals:\n            method.locals[\"__class__\"] = [class_node]\n        class_node.locals[method.name] = [method]\n        method.parent = class_node\n\n\ndef _extend_builtins(class_transforms):\n    builtin_ast = AstroidManager().builtins_module\n    for class_name, transform in class_transforms.items():\n        transform(builtin_ast[class_name])\n\n\n_extend_builtins(\n    {\n        \"bytes\": partial(_extend_string_class, code=BYTES_CLASS, rvalue=\"b''\"),\n        \"str\": partial(_extend_string_class, code=STR_CLASS, rvalue=\"''\"),\n    }\n)\n\n\ndef _builtin_filter_predicate(node, builtin_name):\n    if (\n        builtin_name == \"type\"\n        and node.root().name == \"re\"\n        and isinstance(node.func, nodes.Name)\n        and node.func.name == \"type\"\n        and isinstance(node.parent, nodes.Assign)\n        and len(node.parent.targets) == 1\n        and isinstance(node.parent.targets[0], nodes.AssignName)\n        and node.parent.targets[0].name in {\"Pattern\", \"Match\"}\n    ):\n        # Handle re.Pattern and re.Match in brain_re\n        # Match these patterns from stdlib/re.py\n        # ```py\n        # Pattern = type(...)\n        # Match = type(...)\n        # ```\n        return False\n    if isinstance(node.func, nodes.Name) and node.func.name == builtin_name:\n        return True\n    if isinstance(node.func, nodes.Attribute):\n        return (\n            node.func.attrname == \"fromkeys\"\n            and isinstance(node.func.expr, nodes.Name)\n            and node.func.expr.name == \"dict\"\n        )\n    return False\n\n\ndef register_builtin_transform(transform, builtin_name):\n    \"\"\"Register a new transform function for the given *builtin_name*.\n\n    The transform function must accept two parameters, a node and\n    an optional context.\n    \"\"\"\n\n    def _transform_wrapper(node, context=None):\n        result = transform(node, context=context)\n        if result:\n            if not result.parent:\n                # Let the transformation function determine\n                # the parent for its result. Otherwise,\n                # we set it to be the node we transformed from.\n                result.parent = node\n\n            if result.lineno is None:\n                result.lineno = node.lineno\n            # Can be a 'Module' see https://github.com/PyCQA/pylint/issues/4671\n            # We don't have a regression test on this one: tread carefully\n            if hasattr(result, \"col_offset\") and result.col_offset is None:\n                result.col_offset = node.col_offset\n        return iter([result])\n\n    AstroidManager().register_transform(\n        nodes.Call,\n        inference_tip(_transform_wrapper),\n        partial(_builtin_filter_predicate, builtin_name=builtin_name),\n    )\n\n\ndef _container_generic_inference(node, context, node_type, transform):\n    args = node.args\n    if not args:\n        return node_type()\n    if len(node.args) > 1:\n        raise UseInferenceDefault()\n\n    (arg,) = args\n    transformed = transform(arg)\n    if not transformed:\n        try:\n            inferred = next(arg.infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault from exc\n        if inferred is util.Uninferable:\n            raise UseInferenceDefault\n        transformed = transform(inferred)\n    if not transformed or transformed is util.Uninferable:\n        raise UseInferenceDefault\n    return transformed\n\n\ndef _container_generic_transform(  # pylint: disable=inconsistent-return-statements\n    arg, context, klass, iterables, build_elts\n):\n    if isinstance(arg, klass):\n        return arg\n    if isinstance(arg, iterables):\n        if all(isinstance(elt, nodes.Const) for elt in arg.elts):\n            elts = [elt.value for elt in arg.elts]\n        else:\n            # TODO: Does not handle deduplication for sets.\n            elts = []\n            for element in arg.elts:\n                if not element:\n                    continue\n                inferred = helpers.safe_infer(element, context=context)\n                if inferred:\n                    evaluated_object = nodes.EvaluatedObject(\n                        original=element, value=inferred\n                    )\n                    elts.append(evaluated_object)\n    elif isinstance(arg, nodes.Dict):\n        # Dicts need to have consts as strings already.\n        if not all(isinstance(elt[0], nodes.Const) for elt in arg.items):\n            raise UseInferenceDefault()\n        elts = [item[0].value for item in arg.items]\n    elif isinstance(arg, nodes.Const) and isinstance(arg.value, (str, bytes)):\n        elts = arg.value\n    else:\n        return\n    return klass.from_elements(elts=build_elts(elts))\n\n\ndef _infer_builtin_container(\n    node, context, klass=None, iterables=None, build_elts=None\n):\n    transform_func = partial(\n        _container_generic_transform,\n        context=context,\n        klass=klass,\n        iterables=iterables,\n        build_elts=build_elts,\n    )\n\n    return _container_generic_inference(node, context, klass, transform_func)\n\n\n# pylint: disable=invalid-name\ninfer_tuple = partial(\n    _infer_builtin_container,\n    klass=nodes.Tuple,\n    iterables=(\n        nodes.List,\n        nodes.Set,\n        objects.FrozenSet,\n        objects.DictItems,\n        objects.DictKeys,\n        objects.DictValues,\n    ),\n    build_elts=tuple,\n)\n\ninfer_list = partial(\n    _infer_builtin_container,\n    klass=nodes.List,\n    iterables=(\n        nodes.Tuple,\n        nodes.Set,\n        objects.FrozenSet,\n        objects.DictItems,\n        objects.DictKeys,\n        objects.DictValues,\n    ),\n    build_elts=list,\n)\n\ninfer_set = partial(\n    _infer_builtin_container,\n    klass=nodes.Set,\n    iterables=(nodes.List, nodes.Tuple, objects.FrozenSet, objects.DictKeys),\n    build_elts=set,\n)\n\ninfer_frozenset = partial(\n    _infer_builtin_container,\n    klass=objects.FrozenSet,\n    iterables=(nodes.List, nodes.Tuple, nodes.Set, objects.FrozenSet, objects.DictKeys),\n    build_elts=frozenset,\n)\n\n\ndef _get_elts(arg, context):\n    def is_iterable(n):\n        return isinstance(n, (nodes.List, nodes.Tuple, nodes.Set))\n\n    try:\n        inferred = next(arg.infer(context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n    if isinstance(inferred, nodes.Dict):\n        items = inferred.items\n    elif is_iterable(inferred):\n        items = []\n        for elt in inferred.elts:\n            # If an item is not a pair of two items,\n            # then fallback to the default inference.\n            # Also, take in consideration only hashable items,\n            # tuples and consts. We are choosing Names as well.\n            if not is_iterable(elt):\n                raise UseInferenceDefault()\n            if len(elt.elts) != 2:\n                raise UseInferenceDefault()\n            if not isinstance(elt.elts[0], (nodes.Tuple, nodes.Const, nodes.Name)):\n                raise UseInferenceDefault()\n            items.append(tuple(elt.elts))\n    else:\n        raise UseInferenceDefault()\n    return items\n\n\ndef infer_dict(node, context=None):\n    \"\"\"Try to infer a dict call to a Dict node.\n\n    The function treats the following cases:\n\n        * dict()\n        * dict(mapping)\n        * dict(iterable)\n        * dict(iterable, **kwargs)\n        * dict(mapping, **kwargs)\n        * dict(**kwargs)\n\n    If a case can't be inferred, we'll fallback to default inference.\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.has_invalid_arguments() or call.has_invalid_keywords():\n        raise UseInferenceDefault\n\n    args = call.positional_arguments\n    kwargs = list(call.keyword_arguments.items())\n\n    if not args and not kwargs:\n        # dict()\n        return nodes.Dict()\n    if kwargs and not args:\n        # dict(a=1, b=2, c=4)\n        items = [(nodes.Const(key), value) for key, value in kwargs]\n    elif len(args) == 1 and kwargs:\n        # dict(some_iterable, b=2, c=4)\n        elts = _get_elts(args[0], context)\n        keys = [(nodes.Const(key), value) for key, value in kwargs]\n        items = elts + keys\n    elif len(args) == 1:\n        items = _get_elts(args[0], context)\n    else:\n        raise UseInferenceDefault()\n    value = nodes.Dict(\n        col_offset=node.col_offset, lineno=node.lineno, parent=node.parent\n    )\n    value.postinit(items)\n    return value\n\n\ndef infer_super(node, context=None):\n    \"\"\"Understand super calls.\n\n    There are some restrictions for what can be understood:\n\n        * unbounded super (one argument form) is not understood.\n\n        * if the super call is not inside a function (classmethod or method),\n          then the default inference will be used.\n\n        * if the super arguments can't be inferred, the default inference\n          will be used.\n    \"\"\"\n    if len(node.args) == 1:\n        # Ignore unbounded super.\n        raise UseInferenceDefault\n\n    scope = node.scope()\n    if not isinstance(scope, nodes.FunctionDef):\n        # Ignore non-method uses of super.\n        raise UseInferenceDefault\n    if scope.type not in (\"classmethod\", \"method\"):\n        # Not interested in staticmethods.\n        raise UseInferenceDefault\n\n    cls = scoped_nodes.get_wrapping_class(scope)\n    if not node.args:\n        mro_pointer = cls\n        # In we are in a classmethod, the interpreter will fill\n        # automatically the class as the second argument, not an instance.\n        if scope.type == \"classmethod\":\n            mro_type = cls\n        else:\n            mro_type = cls.instantiate_class()\n    else:\n        try:\n            mro_pointer = next(node.args[0].infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault from exc\n        try:\n            mro_type = next(node.args[1].infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault from exc\n\n    if mro_pointer is util.Uninferable or mro_type is util.Uninferable:\n        # No way we could understand this.\n        raise UseInferenceDefault\n\n    super_obj = objects.Super(\n        mro_pointer=mro_pointer, mro_type=mro_type, self_class=cls, scope=scope\n    )\n    super_obj.parent = node\n    return super_obj\n\n\ndef _infer_getattr_args(node, context):\n    if len(node.args) not in (2, 3):\n        # Not a valid getattr call.\n        raise UseInferenceDefault\n\n    try:\n        obj = next(node.args[0].infer(context=context))\n        attr = next(node.args[1].infer(context=context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n\n    if obj is util.Uninferable or attr is util.Uninferable:\n        # If one of the arguments is something we can't infer,\n        # then also make the result of the getattr call something\n        # which is unknown.\n        return util.Uninferable, util.Uninferable\n\n    is_string = isinstance(attr, nodes.Const) and isinstance(attr.value, str)\n    if not is_string:\n        raise UseInferenceDefault\n\n    return obj, attr.value\n\n\ndef infer_getattr(node, context=None):\n    \"\"\"Understand getattr calls\n\n    If one of the arguments is an Uninferable object, then the\n    result will be an Uninferable object. Otherwise, the normal attribute\n    lookup will be done.\n    \"\"\"\n    obj, attr = _infer_getattr_args(node, context)\n    if (\n        obj is util.Uninferable\n        or attr is util.Uninferable\n        or not hasattr(obj, \"igetattr\")\n    ):\n        return util.Uninferable\n\n    try:\n        return next(obj.igetattr(attr, context=context))\n    except (StopIteration, InferenceError, AttributeInferenceError):\n        if len(node.args) == 3:\n            # Try to infer the default and return it instead.\n            try:\n                return next(node.args[2].infer(context=context))\n            except (StopIteration, InferenceError) as exc:\n                raise UseInferenceDefault from exc\n\n    raise UseInferenceDefault\n\n\ndef infer_hasattr(node, context=None):\n    \"\"\"Understand hasattr calls\n\n    This always guarantees three possible outcomes for calling\n    hasattr: Const(False) when we are sure that the object\n    doesn't have the intended attribute, Const(True) when\n    we know that the object has the attribute and Uninferable\n    when we are unsure of the outcome of the function call.\n    \"\"\"\n    try:\n        obj, attr = _infer_getattr_args(node, context)\n        if (\n            obj is util.Uninferable\n            or attr is util.Uninferable\n            or not hasattr(obj, \"getattr\")\n        ):\n            return util.Uninferable\n        obj.getattr(attr, context=context)\n    except UseInferenceDefault:\n        # Can't infer something from this function call.\n        return util.Uninferable\n    except AttributeInferenceError:\n        # Doesn't have it.\n        return nodes.Const(False)\n    return nodes.Const(True)\n\n\ndef infer_callable(node, context=None):\n    \"\"\"Understand callable calls\n\n    This follows Python's semantics, where an object\n    is callable if it provides an attribute __call__,\n    even though that attribute is something which can't be\n    called.\n    \"\"\"\n    if len(node.args) != 1:\n        # Invalid callable call.\n        raise UseInferenceDefault\n\n    argument = node.args[0]\n    try:\n        inferred = next(argument.infer(context=context))\n    except (InferenceError, StopIteration):\n        return util.Uninferable\n    if inferred is util.Uninferable:\n        return util.Uninferable\n    return nodes.Const(inferred.callable())\n\n\ndef infer_property(\n    node: nodes.Call, context: InferenceContext | None = None\n) -> objects.Property:\n    \"\"\"Understand `property` class\n\n    This only infers the output of `property`\n    call, not the arguments themselves.\n    \"\"\"\n    if len(node.args) < 1:\n        # Invalid property call.\n        raise UseInferenceDefault\n\n    getter = node.args[0]\n    try:\n        inferred = next(getter.infer(context=context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n\n    if not isinstance(inferred, (nodes.FunctionDef, nodes.Lambda)):\n        raise UseInferenceDefault\n\n    prop_func = objects.Property(\n        function=inferred,\n        name=inferred.name,\n        lineno=node.lineno,\n        parent=node,\n        col_offset=node.col_offset,\n    )\n    prop_func.postinit(\n        body=[],\n        args=inferred.args,\n        doc_node=getattr(inferred, \"doc_node\", None),\n    )\n    return prop_func\n\n\ndef infer_bool(node, context=None):\n    \"\"\"Understand bool calls.\"\"\"\n    if len(node.args) > 1:\n        # Invalid bool call.\n        raise UseInferenceDefault\n\n    if not node.args:\n        return nodes.Const(False)\n\n    argument = node.args[0]\n    try:\n        inferred = next(argument.infer(context=context))\n    except (InferenceError, StopIteration):\n        return util.Uninferable\n    if inferred is util.Uninferable:\n        return util.Uninferable\n\n    bool_value = inferred.bool_value(context=context)\n    if bool_value is util.Uninferable:\n        return util.Uninferable\n    return nodes.Const(bool_value)\n\n\ndef infer_type(node, context=None):\n    \"\"\"Understand the one-argument form of *type*.\"\"\"\n    if len(node.args) != 1:\n        raise UseInferenceDefault\n\n    return helpers.object_type(node.args[0], context)\n\n\ndef infer_slice(node, context=None):\n    \"\"\"Understand `slice` calls.\"\"\"\n    args = node.args\n    if not 0 < len(args) <= 3:\n        raise UseInferenceDefault\n\n    infer_func = partial(helpers.safe_infer, context=context)\n    args = [infer_func(arg) for arg in args]\n    for arg in args:\n        if not arg or arg is util.Uninferable:\n            raise UseInferenceDefault\n        if not isinstance(arg, nodes.Const):\n            raise UseInferenceDefault\n        if not isinstance(arg.value, (type(None), int)):\n            raise UseInferenceDefault\n\n    if len(args) < 3:\n        # Make sure we have 3 arguments.\n        args.extend([None] * (3 - len(args)))\n\n    slice_node = nodes.Slice(\n        lineno=node.lineno, col_offset=node.col_offset, parent=node.parent\n    )\n    slice_node.postinit(*args)\n    return slice_node\n\n\ndef _infer_object__new__decorator(node, context=None):\n    # Instantiate class immediately\n    # since that's what @object.__new__ does\n    return iter((node.instantiate_class(),))\n\n\ndef _infer_object__new__decorator_check(node):\n    \"\"\"Predicate before inference_tip\n\n    Check if the given ClassDef has an @object.__new__ decorator\n    \"\"\"\n    if not node.decorators:\n        return False\n\n    for decorator in node.decorators.nodes:\n        if isinstance(decorator, nodes.Attribute):\n            if decorator.as_string() == OBJECT_DUNDER_NEW:\n                return True\n    return False\n\n\ndef infer_issubclass(callnode, context=None):\n    \"\"\"Infer issubclass() calls\n\n    :param nodes.Call callnode: an `issubclass` call\n    :param InferenceContext context: the context for the inference\n    :rtype nodes.Const: Boolean Const value of the `issubclass` call\n    :raises UseInferenceDefault: If the node cannot be inferred\n    \"\"\"\n    call = arguments.CallSite.from_call(callnode, context=context)\n    if call.keyword_arguments:\n        # issubclass doesn't support keyword arguments\n        raise UseInferenceDefault(\"TypeError: issubclass() takes no keyword arguments\")\n    if len(call.positional_arguments) != 2:\n        raise UseInferenceDefault(\n            f\"Expected two arguments, got {len(call.positional_arguments)}\"\n        )\n    # The left hand argument is the obj to be checked\n    obj_node, class_or_tuple_node = call.positional_arguments\n\n    try:\n        obj_type = next(obj_node.infer(context=context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n    if not isinstance(obj_type, nodes.ClassDef):\n        raise UseInferenceDefault(\"TypeError: arg 1 must be class\")\n\n    # The right hand argument is the class(es) that the given\n    # object is to be checked against.\n    try:\n        class_container = _class_or_tuple_to_container(\n            class_or_tuple_node, context=context\n        )\n    except InferenceError as exc:\n        raise UseInferenceDefault from exc\n    try:\n        issubclass_bool = helpers.object_issubclass(obj_type, class_container, context)\n    except AstroidTypeError as exc:\n        raise UseInferenceDefault(\"TypeError: \" + str(exc)) from exc\n    except MroError as exc:\n        raise UseInferenceDefault from exc\n    return nodes.Const(issubclass_bool)\n\n\ndef infer_isinstance(callnode, context=None):\n    \"\"\"Infer isinstance calls\n\n    :param nodes.Call callnode: an isinstance call\n    :param InferenceContext context: context for call\n        (currently unused but is a common interface for inference)\n    :rtype nodes.Const: Boolean Const value of isinstance call\n\n    :raises UseInferenceDefault: If the node cannot be inferred\n    \"\"\"\n    call = arguments.CallSite.from_call(callnode, context=context)\n    if call.keyword_arguments:\n        # isinstance doesn't support keyword arguments\n        raise UseInferenceDefault(\"TypeError: isinstance() takes no keyword arguments\")\n    if len(call.positional_arguments) != 2:\n        raise UseInferenceDefault(\n            f\"Expected two arguments, got {len(call.positional_arguments)}\"\n        )\n    # The left hand argument is the obj to be checked\n    obj_node, class_or_tuple_node = call.positional_arguments\n    # The right hand argument is the class(es) that the given\n    # obj is to be check is an instance of\n    try:\n        class_container = _class_or_tuple_to_container(\n            class_or_tuple_node, context=context\n        )\n    except InferenceError as exc:\n        raise UseInferenceDefault from exc\n    try:\n        isinstance_bool = helpers.object_isinstance(obj_node, class_container, context)\n    except AstroidTypeError as exc:\n        raise UseInferenceDefault(\"TypeError: \" + str(exc)) from exc\n    except MroError as exc:\n        raise UseInferenceDefault from exc\n    if isinstance_bool is util.Uninferable:\n        raise UseInferenceDefault\n    return nodes.Const(isinstance_bool)\n\n\ndef _class_or_tuple_to_container(node, context=None):\n    # Move inferences results into container\n    # to simplify later logic\n    # raises InferenceError if any of the inferences fall through\n    try:\n        node_infer = next(node.infer(context=context))\n    except StopIteration as e:\n        raise InferenceError(node=node, context=context) from e\n    # arg2 MUST be a type or a TUPLE of types\n    # for isinstance\n    if isinstance(node_infer, nodes.Tuple):\n        try:\n            class_container = [\n                next(node.infer(context=context)) for node in node_infer.elts\n            ]\n        except StopIteration as e:\n            raise InferenceError(node=node, context=context) from e\n        class_container = [\n            klass_node for klass_node in class_container if klass_node is not None\n        ]\n    else:\n        class_container = [node_infer]\n    return class_container\n\n\ndef infer_len(node, context=None):\n    \"\"\"Infer length calls\n\n    :param nodes.Call node: len call to infer\n    :param context.InferenceContext: node context\n    :rtype nodes.Const: a Const node with the inferred length, if possible\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: len() must take no keyword arguments\")\n    if len(call.positional_arguments) != 1:\n        raise UseInferenceDefault(\n            \"TypeError: len() must take exactly one argument \"\n            \"({len}) given\".format(len=len(call.positional_arguments))\n        )\n    [argument_node] = call.positional_arguments\n\n    try:\n        return nodes.Const(helpers.object_len(argument_node, context=context))\n    except (AstroidTypeError, InferenceError) as exc:\n        raise UseInferenceDefault(str(exc)) from exc\n\n\ndef infer_str(node, context=None):\n    \"\"\"Infer str() calls\n\n    :param nodes.Call node: str() call to infer\n    :param context.InferenceContext: node context\n    :rtype nodes.Const: a Const containing an empty string\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: str() must take no keyword arguments\")\n    try:\n        return nodes.Const(\"\")\n    except (AstroidTypeError, InferenceError) as exc:\n        raise UseInferenceDefault(str(exc)) from exc\n\n\ndef infer_int(node, context=None):\n    \"\"\"Infer int() calls\n\n    :param nodes.Call node: int() call to infer\n    :param context.InferenceContext: node context\n    :rtype nodes.Const: a Const containing the integer value of the int() call\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: int() must take no keyword arguments\")\n\n    if call.positional_arguments:\n        try:\n            first_value = next(call.positional_arguments[0].infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault(str(exc)) from exc\n\n        if first_value is util.Uninferable:\n            raise UseInferenceDefault\n\n        if isinstance(first_value, nodes.Const) and isinstance(\n            first_value.value, (int, str)\n        ):\n            try:\n                actual_value = int(first_value.value)\n            except ValueError:\n                return nodes.Const(0)\n            return nodes.Const(actual_value)\n\n    return nodes.Const(0)\n\n\ndef infer_dict_fromkeys(node, context=None):\n    \"\"\"Infer dict.fromkeys\n\n    :param nodes.Call node: dict.fromkeys() call to infer\n    :param context.InferenceContext context: node context\n    :rtype nodes.Dict:\n        a Dictionary containing the values that astroid was able to infer.\n        In case the inference failed for any reason, an empty dictionary\n        will be inferred instead.\n    \"\"\"\n\n    def _build_dict_with_elements(elements):\n        new_node = nodes.Dict(\n            col_offset=node.col_offset, lineno=node.lineno, parent=node.parent\n        )\n        new_node.postinit(elements)\n        return new_node\n\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: int() must take no keyword arguments\")\n    if len(call.positional_arguments) not in {1, 2}:\n        raise UseInferenceDefault(\n            \"TypeError: Needs between 1 and 2 positional arguments\"\n        )\n\n    default = nodes.Const(None)\n    values = call.positional_arguments[0]\n    try:\n        inferred_values = next(values.infer(context=context))\n    except (InferenceError, StopIteration):\n        return _build_dict_with_elements([])\n    if inferred_values is util.Uninferable:\n        return _build_dict_with_elements([])\n\n    # Limit to a couple of potential values, as this can become pretty complicated\n    accepted_iterable_elements = (nodes.Const,)\n    if isinstance(inferred_values, (nodes.List, nodes.Set, nodes.Tuple)):\n        elements = inferred_values.elts\n        for element in elements:\n            if not isinstance(element, accepted_iterable_elements):\n                # Fallback to an empty dict\n                return _build_dict_with_elements([])\n\n        elements_with_value = [(element, default) for element in elements]\n        return _build_dict_with_elements(elements_with_value)\n    if isinstance(inferred_values, nodes.Const) and isinstance(\n        inferred_values.value, (str, bytes)\n    ):\n        elements = [\n            (nodes.Const(element), default) for element in inferred_values.value\n        ]\n        return _build_dict_with_elements(elements)\n    if isinstance(inferred_values, nodes.Dict):\n        keys = inferred_values.itered()\n        for key in keys:\n            if not isinstance(key, accepted_iterable_elements):\n                # Fallback to an empty dict\n                return _build_dict_with_elements([])\n\n        elements_with_value = [(element, default) for element in keys]\n        return _build_dict_with_elements(elements_with_value)\n\n    # Fallback to an empty dictionary\n    return _build_dict_with_elements([])\n\n\ndef _infer_copy_method(\n    node: nodes.Call, context: InferenceContext | None = None\n) -> Iterator[nodes.NodeNG]:\n    assert isinstance(node.func, nodes.Attribute)\n    inferred_orig, inferred_copy = itertools.tee(node.func.expr.infer(context=context))\n    if all(\n        isinstance(\n            inferred_node, (nodes.Dict, nodes.List, nodes.Set, objects.FrozenSet)\n        )\n        for inferred_node in inferred_orig\n    ):\n        return inferred_copy\n\n    raise UseInferenceDefault()\n\n\ndef _is_str_format_call(node: nodes.Call) -> bool:\n    \"\"\"Catch calls to str.format().\"\"\"\n    if not isinstance(node.func, nodes.Attribute) or not node.func.attrname == \"format\":\n        return False\n\n    if isinstance(node.func.expr, nodes.Name):\n        value = helpers.safe_infer(node.func.expr)\n    else:\n        value = node.func.expr\n\n    return isinstance(value, nodes.Const) and isinstance(value.value, str)\n\n\ndef _infer_str_format_call(\n    node: nodes.Call, context: InferenceContext | None = None\n) -> Iterator[nodes.Const | type[util.Uninferable]]:\n    \"\"\"Return a Const node based on the template and passed arguments.\"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if isinstance(node.func.expr, nodes.Name):\n        value: nodes.Const = helpers.safe_infer(node.func.expr)\n    else:\n        value = node.func.expr\n\n    format_template = value.value\n\n    # Get the positional arguments passed\n    inferred_positional = [\n        helpers.safe_infer(i, context) for i in call.positional_arguments\n    ]\n    if not all(isinstance(i, nodes.Const) for i in inferred_positional):\n        return iter([util.Uninferable])\n    pos_values: list[str] = [i.value for i in inferred_positional]\n\n    # Get the keyword arguments passed\n    inferred_keyword = {\n        k: helpers.safe_infer(v, context) for k, v in call.keyword_arguments.items()\n    }\n    if not all(isinstance(i, nodes.Const) for i in inferred_keyword.values()):\n        return iter([util.Uninferable])\n    keyword_values: dict[str, str] = {k: v.value for k, v in inferred_keyword.items()}\n\n    try:\n        formatted_string = format_template.format(*pos_values, **keyword_values)\n    except (IndexError, KeyError):\n        # If there is an IndexError there are too few arguments to interpolate\n        return iter([util.Uninferable])\n\n    return iter([nodes.const_factory(formatted_string)])\n\n\n# Builtins inference\nregister_builtin_transform(infer_bool, \"bool\")\nregister_builtin_transform(infer_super, \"super\")\nregister_builtin_transform(infer_callable, \"callable\")\nregister_builtin_transform(infer_property, \"property\")\nregister_builtin_transform(infer_getattr, \"getattr\")\nregister_builtin_transform(infer_hasattr, \"hasattr\")\nregister_builtin_transform(infer_tuple, \"tuple\")\nregister_builtin_transform(infer_set, \"set\")\nregister_builtin_transform(infer_list, \"list\")\nregister_builtin_transform(infer_dict, \"dict\")\nregister_builtin_transform(infer_frozenset, \"frozenset\")\nregister_builtin_transform(infer_type, \"type\")\nregister_builtin_transform(infer_slice, \"slice\")\nregister_builtin_transform(infer_isinstance, \"isinstance\")\nregister_builtin_transform(infer_issubclass, \"issubclass\")\nregister_builtin_transform(infer_len, \"len\")\nregister_builtin_transform(infer_str, \"str\")\nregister_builtin_transform(infer_int, \"int\")\nregister_builtin_transform(infer_dict_fromkeys, \"dict.fromkeys\")\n\n\n# Infer object.__new__ calls\nAstroidManager().register_transform(\n    nodes.ClassDef,\n    inference_tip(_infer_object__new__decorator),\n    _infer_object__new__decorator_check,\n)\n\nAstroidManager().register_transform(\n    nodes.Call,\n    inference_tip(_infer_copy_method),\n    lambda node: isinstance(node.func, nodes.Attribute)\n    and node.func.attrname == \"copy\",\n)\n\nAstroidManager().register_transform(\n    nodes.Call, inference_tip(_infer_str_format_call), _is_str_format_call\n)\n","new_file_content":"# Copyright (c) 2014-2021 Claudiu Popa <pcmanticore@gmail.com>\n# Copyright (c) 2014-2015 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>\n# Copyright (c) 2015-2016 Ceridwen <ceridwenv@gmail.com>\n# Copyright (c) 2015 Rene Zhang <rz99@cornell.edu>\n# Copyright (c) 2018 Bryce Guinta <bryce.paul.guinta@gmail.com>\n# Copyright (c) 2018 Ville Skyttä <ville.skytta@iki.fi>\n# Copyright (c) 2019-2020 Bryce Guinta <bryce.guinta@protonmail.com>\n# Copyright (c) 2019 Stanislav Levin <slev@altlinux.org>\n# Copyright (c) 2019 David Liu <david@cs.toronto.edu>\n# Copyright (c) 2019 Frédéric Chapoton <fchapoton2@gmail.com>\n# Copyright (c) 2020-2021 hippo91 <guillaume.peillex@gmail.com>\n# Copyright (c) 2020 David Gilman <davidgilman1@gmail.com>\n# Copyright (c) 2020 Ram Rachum <ram@rachum.com>\n# Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>\n# Copyright (c) 2021 Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>\n# Copyright (c) 2021 Nick Drozd <nicholasdrozd@gmail.com>\n# Copyright (c) 2021 Marc Mueller <30130371+cdce8p@users.noreply.github.com>\n\n# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html\n# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE\n\n\"\"\"Astroid hooks for various builtins.\"\"\"\n\nfrom functools import partial\n\nfrom astroid import arguments, helpers, inference_tip, nodes, objects, util\nfrom astroid.builder import AstroidBuilder\nfrom astroid.exceptions import (\n    AstroidTypeError,\n    AttributeInferenceError,\n    InferenceError,\n    MroError,\n    UseInferenceDefault,\n)\nfrom astroid.manager import AstroidManager\nfrom astroid.nodes import scoped_nodes\n\nOBJECT_DUNDER_NEW = \"object.__new__\"\n\nSTR_CLASS = \"\"\"\nclass whatever(object):\n    def join(self, iterable):\n        return {rvalue}\n    def replace(self, old, new, count=None):\n        return {rvalue}\n    def format(self, *args, **kwargs):\n        return {rvalue}\n    def encode(self, encoding='ascii', errors=None):\n        return b''\n    def decode(self, encoding='ascii', errors=None):\n        return u''\n    def capitalize(self):\n        return {rvalue}\n    def title(self):\n        return {rvalue}\n    def lower(self):\n        return {rvalue}\n    def upper(self):\n        return {rvalue}\n    def swapcase(self):\n        return {rvalue}\n    def index(self, sub, start=None, end=None):\n        return 0\n    def find(self, sub, start=None, end=None):\n        return 0\n    def count(self, sub, start=None, end=None):\n        return 0\n    def strip(self, chars=None):\n        return {rvalue}\n    def lstrip(self, chars=None):\n        return {rvalue}\n    def rstrip(self, chars=None):\n        return {rvalue}\n    def rjust(self, width, fillchar=None):\n        return {rvalue}\n    def center(self, width, fillchar=None):\n        return {rvalue}\n    def ljust(self, width, fillchar=None):\n        return {rvalue}\n\"\"\"\n\n\nBYTES_CLASS = \"\"\"\nclass whatever(object):\n    def join(self, iterable):\n        return {rvalue}\n    def replace(self, old, new, count=None):\n        return {rvalue}\n    def decode(self, encoding='ascii', errors=None):\n        return u''\n    def capitalize(self):\n        return {rvalue}\n    def title(self):\n        return {rvalue}\n    def lower(self):\n        return {rvalue}\n    def upper(self):\n        return {rvalue}\n    def swapcase(self):\n        return {rvalue}\n    def index(self, sub, start=None, end=None):\n        return 0\n    def find(self, sub, start=None, end=None):\n        return 0\n    def count(self, sub, start=None, end=None):\n        return 0\n    def strip(self, chars=None):\n        return {rvalue}\n    def lstrip(self, chars=None):\n        return {rvalue}\n    def rstrip(self, chars=None):\n        return {rvalue}\n    def rjust(self, width, fillchar=None):\n        return {rvalue}\n    def center(self, width, fillchar=None):\n        return {rvalue}\n    def ljust(self, width, fillchar=None):\n        return {rvalue}\n\"\"\"\n\n\ndef _extend_string_class(class_node, code, rvalue):\n    \"\"\"function to extend builtin str/unicode class\"\"\"\n    code = code.format(rvalue=rvalue)\n    fake = AstroidBuilder(AstroidManager()).string_build(code)[\"whatever\"]\n    for method in fake.mymethods():\n        method.parent = class_node\n        method.lineno = None\n        method.col_offset = None\n        if \"__class__\" in method.locals:\n            method.locals[\"__class__\"] = [class_node]\n        class_node.locals[method.name] = [method]\n        method.parent = class_node\n\n\ndef _extend_builtins(class_transforms):\n    builtin_ast = AstroidManager().builtins_module\n    for class_name, transform in class_transforms.items():\n        transform(builtin_ast[class_name])\n\n\n_extend_builtins(\n    {\n        \"bytes\": partial(_extend_string_class, code=BYTES_CLASS, rvalue=\"b''\"),\n        \"str\": partial(_extend_string_class, code=STR_CLASS, rvalue=\"''\"),\n    }\n)\n\n\ndef _builtin_filter_predicate(node, builtin_name):\n    if (\n        builtin_name == \"type\"\n        and node.root().name == \"re\"\n        and isinstance(node.func, nodes.Name)\n        and node.func.name == \"type\"\n        and isinstance(node.parent, nodes.Assign)\n        and len(node.parent.targets) == 1\n        and isinstance(node.parent.targets[0], nodes.AssignName)\n        and node.parent.targets[0].name in {\"Pattern\", \"Match\"}\n    ):\n        # Handle re.Pattern and re.Match in brain_re\n        # Match these patterns from stdlib/re.py\n        # ```py\n        # Pattern = type(...)\n        # Match = type(...)\n        # ```\n        return False\n    if isinstance(node.func, nodes.Name) and node.func.name == builtin_name:\n        return True\n    if isinstance(node.func, nodes.Attribute):\n        return (\n            node.func.attrname == \"fromkeys\"\n            and isinstance(node.func.expr, nodes.Name)\n            and node.func.expr.name == \"dict\"\n        )\n    return False\n\n\ndef register_builtin_transform(transform, builtin_name):\n    \"\"\"Register a new transform function for the given *builtin_name*.\n\n    The transform function must accept two parameters, a node and\n    an optional context.\n    \"\"\"\n\n    def _transform_wrapper(node, context=None):\n        result = transform(node, context=context)\n        if result:\n            if not result.parent:\n                # Let the transformation function determine\n                # the parent for its result. Otherwise,\n                # we set it to be the node we transformed from.\n                result.parent = node\n\n            if result.lineno is None:\n                result.lineno = node.lineno\n            # Can be a 'Module' see https://github.com/PyCQA/pylint/issues/4671\n            # We don't have a regression test on this one: tread carefully\n            if hasattr(result, \"col_offset\") and result.col_offset is None:\n                result.col_offset = node.col_offset\n        return iter([result])\n\n    AstroidManager().register_transform(\n        nodes.Call,\n        inference_tip(_transform_wrapper),\n        partial(_builtin_filter_predicate, builtin_name=builtin_name),\n    )\n\n\ndef _container_generic_inference(node, context, node_type, transform):\n    args = node.args\n    if not args:\n        return node_type()\n    if len(node.args) > 1:\n        raise UseInferenceDefault()\n\n    (arg,) = args\n    transformed = transform(arg)\n    if not transformed:\n        try:\n            inferred = next(arg.infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault from exc\n        if inferred is util.Uninferable:\n            raise UseInferenceDefault\n        transformed = transform(inferred)\n    if not transformed or transformed is util.Uninferable:\n        raise UseInferenceDefault\n    return transformed\n\n\ndef _container_generic_transform(  # pylint: disable=inconsistent-return-statements\n    arg, context, klass, iterables, build_elts\n):\n    if isinstance(arg, klass):\n        return arg\n    if isinstance(arg, iterables):\n        if all(isinstance(elt, nodes.Const) for elt in arg.elts):\n            elts = [elt.value for elt in arg.elts]\n        else:\n            # TODO: Does not handle deduplication for sets.\n            elts = []\n            for element in arg.elts:\n                if not element:\n                    continue\n                inferred = helpers.safe_infer(element, context=context)\n                if inferred:\n                    evaluated_object = nodes.EvaluatedObject(\n                        original=element, value=inferred\n                    )\n                    elts.append(evaluated_object)\n    elif isinstance(arg, nodes.Dict):\n        # Dicts need to have consts as strings already.\n        if not all(isinstance(elt[0], nodes.Const) for elt in arg.items):\n            raise UseInferenceDefault()\n        elts = [item[0].value for item in arg.items]\n    elif isinstance(arg, nodes.Const) and isinstance(arg.value, (str, bytes)):\n        elts = arg.value\n    else:\n        return\n    return klass.from_elements(elts=build_elts(elts))\n\n\ndef _infer_builtin_container(\n    node, context, klass=None, iterables=None, build_elts=None\n):\n    transform_func = partial(\n        _container_generic_transform,\n        context=context,\n        klass=klass,\n        iterables=iterables,\n        build_elts=build_elts,\n    )\n\n    return _container_generic_inference(node, context, klass, transform_func)\n\n\n# pylint: disable=invalid-name\ninfer_tuple = partial(\n    _infer_builtin_container,\n    klass=nodes.Tuple,\n    iterables=(\n        nodes.List,\n        nodes.Set,\n        objects.FrozenSet,\n        objects.DictItems,\n        objects.DictKeys,\n        objects.DictValues,\n    ),\n    build_elts=tuple,\n)\n\ninfer_list = partial(\n    _infer_builtin_container,\n    klass=nodes.List,\n    iterables=(\n        nodes.Tuple,\n        nodes.Set,\n        objects.FrozenSet,\n        objects.DictItems,\n        objects.DictKeys,\n        objects.DictValues,\n    ),\n    build_elts=list,\n)\n\ninfer_set = partial(\n    _infer_builtin_container,\n    klass=nodes.Set,\n    iterables=(nodes.List, nodes.Tuple, objects.FrozenSet, objects.DictKeys),\n    build_elts=set,\n)\n\ninfer_frozenset = partial(\n    _infer_builtin_container,\n    klass=objects.FrozenSet,\n    iterables=(nodes.List, nodes.Tuple, nodes.Set, objects.FrozenSet, objects.DictKeys),\n    build_elts=frozenset,\n)\n\n\ndef _get_elts(arg, context):\n    def is_iterable(n):\n        return isinstance(n, (nodes.List, nodes.Tuple, nodes.Set))\n\n    try:\n        inferred = next(arg.infer(context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n    if isinstance(inferred, nodes.Dict):\n        items = inferred.items\n    elif is_iterable(inferred):\n        items = []\n        for elt in inferred.elts:\n            # If an item is not a pair of two items,\n            # then fallback to the default inference.\n            # Also, take in consideration only hashable items,\n            # tuples and consts. We are choosing Names as well.\n            if not is_iterable(elt):\n                raise UseInferenceDefault()\n            if len(elt.elts) != 2:\n                raise UseInferenceDefault()\n            if not isinstance(elt.elts[0], (nodes.Tuple, nodes.Const, nodes.Name)):\n                raise UseInferenceDefault()\n            items.append(tuple(elt.elts))\n    else:\n        raise UseInferenceDefault()\n    return items\n\n\ndef infer_dict(node, context=None):\n    \"\"\"Try to infer a dict call to a Dict node.\n\n    The function treats the following cases:\n\n        * dict()\n        * dict(mapping)\n        * dict(iterable)\n        * dict(iterable, **kwargs)\n        * dict(mapping, **kwargs)\n        * dict(**kwargs)\n\n    If a case can't be inferred, we'll fallback to default inference.\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.has_invalid_arguments() or call.has_invalid_keywords():\n        raise UseInferenceDefault\n\n    args = call.positional_arguments\n    kwargs = list(call.keyword_arguments.items())\n\n    if not args and not kwargs:\n        # dict()\n        return nodes.Dict()\n    if kwargs and not args:\n        # dict(a=1, b=2, c=4)\n        items = [(nodes.Const(key), value) for key, value in kwargs]\n    elif len(args) == 1 and kwargs:\n        # dict(some_iterable, b=2, c=4)\n        elts = _get_elts(args[0], context)\n        keys = [(nodes.Const(key), value) for key, value in kwargs]\n        items = elts + keys\n    elif len(args) == 1:\n        items = _get_elts(args[0], context)\n    else:\n        raise UseInferenceDefault()\n    value = nodes.Dict(\n        col_offset=node.col_offset, lineno=node.lineno, parent=node.parent\n    )\n    value.postinit(items)\n    return value\n\n\ndef infer_super(node, context=None):\n    \"\"\"Understand super calls.\n\n    There are some restrictions for what can be understood:\n\n        * unbounded super (one argument form) is not understood.\n\n        * if the super call is not inside a function (classmethod or method),\n          then the default inference will be used.\n\n        * if the super arguments can't be inferred, the default inference\n          will be used.\n    \"\"\"\n    if len(node.args) == 1:\n        # Ignore unbounded super.\n        raise UseInferenceDefault\n\n    scope = node.scope()\n    if not isinstance(scope, nodes.FunctionDef):\n        # Ignore non-method uses of super.\n        raise UseInferenceDefault\n    if scope.type not in (\"classmethod\", \"method\"):\n        # Not interested in staticmethods.\n        raise UseInferenceDefault\n\n    cls = scoped_nodes.get_wrapping_class(scope)\n    if not node.args:\n        mro_pointer = cls\n        # In we are in a classmethod, the interpreter will fill\n        # automatically the class as the second argument, not an instance.\n        if scope.type == \"classmethod\":\n            mro_type = cls\n        else:\n            mro_type = cls.instantiate_class()\n    else:\n        try:\n            mro_pointer = next(node.args[0].infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault from exc\n        try:\n            mro_type = next(node.args[1].infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault from exc\n\n    if mro_pointer is util.Uninferable or mro_type is util.Uninferable:\n        # No way we could understand this.\n        raise UseInferenceDefault\n\n    super_obj = objects.Super(\n        mro_pointer=mro_pointer, mro_type=mro_type, self_class=cls, scope=scope\n    )\n    super_obj.parent = node\n    return super_obj\n\n\ndef _infer_getattr_args(node, context):\n    if len(node.args) not in (2, 3):\n        # Not a valid getattr call.\n        raise UseInferenceDefault\n\n    try:\n        obj = next(node.args[0].infer(context=context))\n        attr = next(node.args[1].infer(context=context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n\n    if obj is util.Uninferable or attr is util.Uninferable:\n        # If one of the arguments is something we can't infer,\n        # then also make the result of the getattr call something\n        # which is unknown.\n        return util.Uninferable, util.Uninferable\n\n    is_string = isinstance(attr, nodes.Const) and isinstance(attr.value, str)\n    if not is_string:\n        raise UseInferenceDefault\n\n    return obj, attr.value\n\n\ndef infer_getattr(node, context=None):\n    \"\"\"Understand getattr calls\n\n    If one of the arguments is an Uninferable object, then the\n    result will be an Uninferable object. Otherwise, the normal attribute\n    lookup will be done.\n    \"\"\"\n    obj, attr = _infer_getattr_args(node, context)\n    if (\n        obj is util.Uninferable\n        or attr is util.Uninferable\n        or not hasattr(obj, \"igetattr\")\n    ):\n        return util.Uninferable\n\n    try:\n        return next(obj.igetattr(attr, context=context))\n    except (StopIteration, InferenceError, AttributeInferenceError):\n        if len(node.args) == 3:\n            # Try to infer the default and return it instead.\n            try:\n                return next(node.args[2].infer(context=context))\n            except (StopIteration, InferenceError) as exc:\n                raise UseInferenceDefault from exc\n\n    raise UseInferenceDefault\n\n\ndef infer_hasattr(node, context=None):\n    \"\"\"Understand hasattr calls\n\n    This always guarantees three possible outcomes for calling\n    hasattr: Const(False) when we are sure that the object\n    doesn't have the intended attribute, Const(True) when\n    we know that the object has the attribute and Uninferable\n    when we are unsure of the outcome of the function call.\n    \"\"\"\n    try:\n        obj, attr = _infer_getattr_args(node, context)\n        if (\n            obj is util.Uninferable\n            or attr is util.Uninferable\n            or not hasattr(obj, \"getattr\")\n        ):\n            return util.Uninferable\n        obj.getattr(attr, context=context)\n    except UseInferenceDefault:\n        # Can't infer something from this function call.\n        return util.Uninferable\n    except AttributeInferenceError:\n        # Doesn't have it.\n        return nodes.Const(False)\n    return nodes.Const(True)\n\n\ndef infer_callable(node, context=None):\n    \"\"\"Understand callable calls\n\n    This follows Python's semantics, where an object\n    is callable if it provides an attribute __call__,\n    even though that attribute is something which can't be\n    called.\n    \"\"\"\n    if len(node.args) != 1:\n        # Invalid callable call.\n        raise UseInferenceDefault\n\n    argument = node.args[0]\n    try:\n        inferred = next(argument.infer(context=context))\n    except (InferenceError, StopIteration):\n        return util.Uninferable\n    if inferred is util.Uninferable:\n        return util.Uninferable\n    return nodes.Const(inferred.callable())\n\n\ndef infer_property(node, context=None):\n    \"\"\"Understand `property` class\n\n    This only infers the output of `property`\n    call, not the arguments themselves.\n    \"\"\"\n    if len(node.args) < 1:\n        # Invalid property call.\n        raise UseInferenceDefault\n\n    getter = node.args[0]\n    try:\n        inferred = next(getter.infer(context=context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n\n    if not isinstance(inferred, (nodes.FunctionDef, nodes.Lambda)):\n        raise UseInferenceDefault\n\n    return objects.Property(\n        function=inferred,\n        name=inferred.name,\n        doc=getattr(inferred, \"doc\", None),\n        lineno=node.lineno,\n        parent=node,\n        col_offset=node.col_offset,\n    )\n\n\ndef infer_bool(node, context=None):\n    \"\"\"Understand bool calls.\"\"\"\n    if len(node.args) > 1:\n        # Invalid bool call.\n        raise UseInferenceDefault\n\n    if not node.args:\n        return nodes.Const(False)\n\n    argument = node.args[0]\n    try:\n        inferred = next(argument.infer(context=context))\n    except (InferenceError, StopIteration):\n        return util.Uninferable\n    if inferred is util.Uninferable:\n        return util.Uninferable\n\n    bool_value = inferred.bool_value(context=context)\n    if bool_value is util.Uninferable:\n        return util.Uninferable\n    return nodes.Const(bool_value)\n\n\ndef infer_type(node, context=None):\n    \"\"\"Understand the one-argument form of *type*.\"\"\"\n    if len(node.args) != 1:\n        raise UseInferenceDefault\n\n    return helpers.object_type(node.args[0], context)\n\n\ndef infer_slice(node, context=None):\n    \"\"\"Understand `slice` calls.\"\"\"\n    args = node.args\n    if not 0 < len(args) <= 3:\n        raise UseInferenceDefault\n\n    infer_func = partial(helpers.safe_infer, context=context)\n    args = [infer_func(arg) for arg in args]\n    for arg in args:\n        if not arg or arg is util.Uninferable:\n            raise UseInferenceDefault\n        if not isinstance(arg, nodes.Const):\n            raise UseInferenceDefault\n        if not isinstance(arg.value, (type(None), int)):\n            raise UseInferenceDefault\n\n    if len(args) < 3:\n        # Make sure we have 3 arguments.\n        args.extend([None] * (3 - len(args)))\n\n    slice_node = nodes.Slice(\n        lineno=node.lineno, col_offset=node.col_offset, parent=node.parent\n    )\n    slice_node.postinit(*args)\n    return slice_node\n\n\ndef _infer_object__new__decorator(node, context=None):\n    # Instantiate class immediately\n    # since that's what @object.__new__ does\n    return iter((node.instantiate_class(),))\n\n\ndef _infer_object__new__decorator_check(node):\n    \"\"\"Predicate before inference_tip\n\n    Check if the given ClassDef has an @object.__new__ decorator\n    \"\"\"\n    if not node.decorators:\n        return False\n\n    for decorator in node.decorators.nodes:\n        if isinstance(decorator, nodes.Attribute):\n            if decorator.as_string() == OBJECT_DUNDER_NEW:\n                return True\n    return False\n\n\ndef infer_issubclass(callnode, context=None):\n    \"\"\"Infer issubclass() calls\n\n    :param nodes.Call callnode: an `issubclass` call\n    :param InferenceContext context: the context for the inference\n    :rtype nodes.Const: Boolean Const value of the `issubclass` call\n    :raises UseInferenceDefault: If the node cannot be inferred\n    \"\"\"\n    call = arguments.CallSite.from_call(callnode, context=context)\n    if call.keyword_arguments:\n        # issubclass doesn't support keyword arguments\n        raise UseInferenceDefault(\"TypeError: issubclass() takes no keyword arguments\")\n    if len(call.positional_arguments) != 2:\n        raise UseInferenceDefault(\n            f\"Expected two arguments, got {len(call.positional_arguments)}\"\n        )\n    # The left hand argument is the obj to be checked\n    obj_node, class_or_tuple_node = call.positional_arguments\n\n    try:\n        obj_type = next(obj_node.infer(context=context))\n    except (InferenceError, StopIteration) as exc:\n        raise UseInferenceDefault from exc\n    if not isinstance(obj_type, nodes.ClassDef):\n        raise UseInferenceDefault(\"TypeError: arg 1 must be class\")\n\n    # The right hand argument is the class(es) that the given\n    # object is to be checked against.\n    try:\n        class_container = _class_or_tuple_to_container(\n            class_or_tuple_node, context=context\n        )\n    except InferenceError as exc:\n        raise UseInferenceDefault from exc\n    try:\n        issubclass_bool = helpers.object_issubclass(obj_type, class_container, context)\n    except AstroidTypeError as exc:\n        raise UseInferenceDefault(\"TypeError: \" + str(exc)) from exc\n    except MroError as exc:\n        raise UseInferenceDefault from exc\n    return nodes.Const(issubclass_bool)\n\n\ndef infer_isinstance(callnode, context=None):\n    \"\"\"Infer isinstance calls\n\n    :param nodes.Call callnode: an isinstance call\n    :param InferenceContext context: context for call\n        (currently unused but is a common interface for inference)\n    :rtype nodes.Const: Boolean Const value of isinstance call\n\n    :raises UseInferenceDefault: If the node cannot be inferred\n    \"\"\"\n    call = arguments.CallSite.from_call(callnode, context=context)\n    if call.keyword_arguments:\n        # isinstance doesn't support keyword arguments\n        raise UseInferenceDefault(\"TypeError: isinstance() takes no keyword arguments\")\n    if len(call.positional_arguments) != 2:\n        raise UseInferenceDefault(\n            f\"Expected two arguments, got {len(call.positional_arguments)}\"\n        )\n    # The left hand argument is the obj to be checked\n    obj_node, class_or_tuple_node = call.positional_arguments\n    # The right hand argument is the class(es) that the given\n    # obj is to be check is an instance of\n    try:\n        class_container = _class_or_tuple_to_container(\n            class_or_tuple_node, context=context\n        )\n    except InferenceError as exc:\n        raise UseInferenceDefault from exc\n    try:\n        isinstance_bool = helpers.object_isinstance(obj_node, class_container, context)\n    except AstroidTypeError as exc:\n        raise UseInferenceDefault(\"TypeError: \" + str(exc)) from exc\n    except MroError as exc:\n        raise UseInferenceDefault from exc\n    if isinstance_bool is util.Uninferable:\n        raise UseInferenceDefault\n    return nodes.Const(isinstance_bool)\n\n\ndef _class_or_tuple_to_container(node, context=None):\n    # Move inferences results into container\n    # to simplify later logic\n    # raises InferenceError if any of the inferences fall through\n    try:\n        node_infer = next(node.infer(context=context))\n    except StopIteration as e:\n        raise InferenceError(node=node, context=context) from e\n    # arg2 MUST be a type or a TUPLE of types\n    # for isinstance\n    if isinstance(node_infer, nodes.Tuple):\n        try:\n            class_container = [\n                next(node.infer(context=context)) for node in node_infer.elts\n            ]\n        except StopIteration as e:\n            raise InferenceError(node=node, context=context) from e\n        class_container = [\n            klass_node for klass_node in class_container if klass_node is not None\n        ]\n    else:\n        class_container = [node_infer]\n    return class_container\n\n\ndef infer_len(node, context=None):\n    \"\"\"Infer length calls\n\n    :param nodes.Call node: len call to infer\n    :param context.InferenceContext: node context\n    :rtype nodes.Const: a Const node with the inferred length, if possible\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: len() must take no keyword arguments\")\n    if len(call.positional_arguments) != 1:\n        raise UseInferenceDefault(\n            \"TypeError: len() must take exactly one argument \"\n            \"({len}) given\".format(len=len(call.positional_arguments))\n        )\n    [argument_node] = call.positional_arguments\n\n    try:\n        return nodes.Const(helpers.object_len(argument_node, context=context))\n    except (AstroidTypeError, InferenceError) as exc:\n        raise UseInferenceDefault(str(exc)) from exc\n\n\ndef infer_str(node, context=None):\n    \"\"\"Infer str() calls\n\n    :param nodes.Call node: str() call to infer\n    :param context.InferenceContext: node context\n    :rtype nodes.Const: a Const containing an empty string\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: str() must take no keyword arguments\")\n    try:\n        return nodes.Const(\"\")\n    except (AstroidTypeError, InferenceError) as exc:\n        raise UseInferenceDefault(str(exc)) from exc\n\n\ndef infer_int(node, context=None):\n    \"\"\"Infer int() calls\n\n    :param nodes.Call node: int() call to infer\n    :param context.InferenceContext: node context\n    :rtype nodes.Const: a Const containing the integer value of the int() call\n    \"\"\"\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: int() must take no keyword arguments\")\n\n    if call.positional_arguments:\n        try:\n            first_value = next(call.positional_arguments[0].infer(context=context))\n        except (InferenceError, StopIteration) as exc:\n            raise UseInferenceDefault(str(exc)) from exc\n\n        if first_value is util.Uninferable:\n            raise UseInferenceDefault\n\n        if isinstance(first_value, nodes.Const) and isinstance(\n            first_value.value, (int, str)\n        ):\n            try:\n                actual_value = int(first_value.value)\n            except ValueError:\n                return nodes.Const(0)\n            return nodes.Const(actual_value)\n\n    return nodes.Const(0)\n\n\ndef infer_dict_fromkeys(node, context=None):\n    \"\"\"Infer dict.fromkeys\n\n    :param nodes.Call node: dict.fromkeys() call to infer\n    :param context.InferenceContext context: node context\n    :rtype nodes.Dict:\n        a Dictionary containing the values that astroid was able to infer.\n        In case the inference failed for any reason, an empty dictionary\n        will be inferred instead.\n    \"\"\"\n\n    def _build_dict_with_elements(elements):\n        new_node = nodes.Dict(\n            col_offset=node.col_offset, lineno=node.lineno, parent=node.parent\n        )\n        new_node.postinit(elements)\n        return new_node\n\n    call = arguments.CallSite.from_call(node, context=context)\n    if call.keyword_arguments:\n        raise UseInferenceDefault(\"TypeError: int() must take no keyword arguments\")\n    if len(call.positional_arguments) not in {1, 2}:\n        raise UseInferenceDefault(\n            \"TypeError: Needs between 1 and 2 positional arguments\"\n        )\n\n    default = nodes.Const(None)\n    values = call.positional_arguments[0]\n    try:\n        inferred_values = next(values.infer(context=context))\n    except (InferenceError, StopIteration):\n        return _build_dict_with_elements([])\n    if inferred_values is util.Uninferable:\n        return _build_dict_with_elements([])\n\n    # Limit to a couple of potential values, as this can become pretty complicated\n    accepted_iterable_elements = (nodes.Const,)\n    if isinstance(inferred_values, (nodes.List, nodes.Set, nodes.Tuple)):\n        elements = inferred_values.elts\n        for element in elements:\n            if not isinstance(element, accepted_iterable_elements):\n                # Fallback to an empty dict\n                return _build_dict_with_elements([])\n\n        elements_with_value = [(element, default) for element in elements]\n        return _build_dict_with_elements(elements_with_value)\n    if isinstance(inferred_values, nodes.Const) and isinstance(\n        inferred_values.value, (str, bytes)\n    ):\n        elements = [\n            (nodes.Const(element), default) for element in inferred_values.value\n        ]\n        return _build_dict_with_elements(elements)\n    if isinstance(inferred_values, nodes.Dict):\n        keys = inferred_values.itered()\n        for key in keys:\n            if not isinstance(key, accepted_iterable_elements):\n                # Fallback to an empty dict\n                return _build_dict_with_elements([])\n\n        elements_with_value = [(element, default) for element in keys]\n        return _build_dict_with_elements(elements_with_value)\n\n    # Fallback to an empty dictionary\n    return _build_dict_with_elements([])\n\n\n# Builtins inference\nregister_builtin_transform(infer_bool, \"bool\")\nregister_builtin_transform(infer_super, \"super\")\nregister_builtin_transform(infer_callable, \"callable\")\nregister_builtin_transform(infer_property, \"property\")\nregister_builtin_transform(infer_getattr, \"getattr\")\nregister_builtin_transform(infer_hasattr, \"hasattr\")\nregister_builtin_transform(infer_tuple, \"tuple\")\nregister_builtin_transform(infer_set, \"set\")\nregister_builtin_transform(infer_list, \"list\")\nregister_builtin_transform(infer_dict, \"dict\")\nregister_builtin_transform(infer_frozenset, \"frozenset\")\nregister_builtin_transform(infer_type, \"type\")\nregister_builtin_transform(infer_slice, \"slice\")\nregister_builtin_transform(infer_isinstance, \"isinstance\")\nregister_builtin_transform(infer_issubclass, \"issubclass\")\nregister_builtin_transform(infer_len, \"len\")\nregister_builtin_transform(infer_str, \"str\")\nregister_builtin_transform(infer_int, \"int\")\nregister_builtin_transform(infer_dict_fromkeys, \"dict.fromkeys\")\n\n\n# Infer object.__new__ calls\nAstroidManager().register_transform(\n    nodes.ClassDef,\n    inference_tip(_infer_object__new__decorator),\n    _infer_object__new__decorator_check,\n)\n","header":{"file":{"path":"astroid/brain/brain_builtin_inference.py"},"misc_line":null},"index_line":null,"is_binary_file":false,"binary_line":null,"minus_file":{"path":"a/astroid/brain/brain_builtin_inference.py"},"plus_file":{"path":"b/astroid/brain/brain_builtin_inference.py"},"hunks":[{"descriptor":{"old_range":{"start":954,"length":8},"new_range":{"start":954,"length":10},"section":"def _infer_str_format_call("},"line_group":{"all_lines":[{"content":"","type":"context"},{"content":"    try:","type":"context"},{"content":"        formatted_string = format_template.format(*pos_values, **keyword_values)","type":"context"},{"content":"    except (IndexError, KeyError):","type":"deleted"},{"content":"        # If there is an IndexError there are too few arguments to interpolate","type":"deleted"},{"content":"    except (IndexError, KeyError, TypeError, ValueError):","type":"added"},{"content":"        # IndexError: there are too few arguments to interpolate","type":"added"},{"content":"        # TypeError: Unsupported format string","type":"added"},{"content":"        # ValueError: Unknown format code","type":"added"},{"content":"        return iter([util.Uninferable])","type":"context"},{"content":"","type":"context"},{"content":"    return iter([nodes.const_factory(formatted_string)])","type":"context"},{"content":"","type":"context"}]},"modified_entities":[],"added_entities":[],"deleted_entities":[]}]}],"old_commit_hash":"6cf238d089cf4b6753c94cfc089b4a47487711e5","new_commit_hash":"9b6ebb18f75f49da85fd3543b71ed532911b1ede","commit_message":"Update ChangeLog","commit_date":"2021-11-21T17:53:21+01:00","metadata":{}}